JOHNY -i am getting answer right but why codechef does not accept this

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
int n,i;
cin>>n;
long int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
int b,c;
cin>>b;
c=a[b-1];
sort(a,a+n);
for(i=0;i<n;i++)
{
if(a[i]==c)
{
cout<<i+1;
}
}

}
}

//