Regarding Solution, I think my logic is current but not understanding where am I wrong? I've pasted the code in the description

#include<bits/stdc++.h>
using namespace std;
int x;
bool mysort(const pair<string,int> &a, const pair<string,int> &b)
{
if(a.second == b.second)
if(a.second >= x)
return a.first > b.first;
return a.second > b.second;
}
int main()
{
vector< pair <string, int> > v;
int n;
cin>>x>>n;
string str;
int salary;
for(int i=0;i<n;i++)
{
getline(cin, str);
cin>>salary;
v.push_back( make_pair(str, salary) );
}
sort(v.begin(), v.end(), mysort);
for(int i=0;i<n;i++)
cout<<v[i].first<<" "<<v[i].second<<endl;
return 0;
}

@rtg67GHu_67 Don’ perform any comparision with x in the bool function.
Just sort it in the bool function and then do the comparision with x in the last.