Sort game string

#include
#include
using namespace std;
bool numeric(pair<string,int>str1,pair<string,int>str2)
{
int key1;
int key2;
key1=str1.second;
key2=str2.second;
if(key1==key2)
{
return str1.first<str2.first;
}
return key1>key2;
}
int main()
{
int x;
cin>>x;
int n;
cin>>n;
pair<string,int>p[100000];
string str;
int a;
for(int i=0;i<n;i++)
{
cin>>str;
cin>>a;
p[i]=make_pair(str,a);
}
sort(p,p+n,numeric);
for(int i=0;i<n;i++)
{
if(p[i].second<=x)
continue;
else
cout<<p[i].first<<" "<<p[i].second<<endl;
}

}

what is the problem in my code bcz test case is not passed

This is quite a simple problem. all we have to do is to sort using comparator function.
Kindly refer to this code.

Hope it clears all ur doubts.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.