Unable to reduce the time exceeded

The question is uncle johny - easy section .
#include
#include
#include
using namespace std;

int main() {
int t;
vector v;
cin>>t;
while(t–)
{ int n ;
int j,k;
cin>>n;
int num;
for(j =0;j<n;j++)
{
cin>>num;
v.push_back(num);
}
int pos;
cin>> pos;
int temps = v[pos-1];

    sort(v.begin(),v.end());
     for(j =0;j<n;j++)
     { if(v[j]==temps)
       cout<<j+1<<endl;
     }
     
    
}
return 0;

}

this is the solution that i had written and i am unable to understand how to reduce the time limit. thankyou in advance!

Providing link to question and your solution, would have helped viewers understand better.

sorry new to this platform…but would keep that in mind!
Problem statement : JOHNY Problem - CodeChef
My solution : CodeChef: Practical coding for everyone

Time complexity to use sort function will be O(nlog(n)) [worst case].
Think of any other approach to solve in O(n) [worst time]. :+1:

Try thinking of a logic that would work without sorting !

@rattle087 just look at the position where u have declared the vector.Vector just pushes every value to last element. So in your case it is just pushing every element of every test case.your vector contains all the value of test cases.Hope it will help you. Happy Coding!