It is the sort game code, can you help me why I am getting run error

#include
using namespace std;
int main()
{
long long m,n,temp;
cin>>m>>n;
string a[100],c[100],temp1;
long long b[100],d[100];

for(int i=0;i<n;i++)
{
    cin>>a[i];
    cin>>b[i];
}
for(int i=0;i<n-1;i++)
{
    if(b[i]==b[i+1])
    {
       if(a[i] > a[i+1]) {
     temp1 = a[i];
     a[i] = a[i+1];
     a[i+1] = temp1;
     temp = b[i];
     b[i] = b[i+1];
     b[i+1] = temp;
    }
    }
}
for(int i=0;i<n;i++)
{
    if(b[i]>m)
    {
        cout<<a[i]<<" "<<b[i]<<endl;
    }
}
return 0;

}

Hi @harshulgarg21
The way you are sorting is wrong because you are just comparing the two consecutive elements.
Instead you should use a class to store name and salary and then for sorting use a compare function where you can compare two strings.

This is a better and more optimal way to solve this kind of ques :

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.