Runtime error is occuring

#include<bits/stdc++.h>
using namespace std;
bool mycompare(pair<string,int>p1,pair<string,int>p2){
if(p1.second==p2.second)
return p1.first<p2.first;
return p1.second>p2.second;
}
int main() {
int min_salary,n;
cin>>min_salary>>n;
string name;
int salary;
pair<string,int>emp[10005];
for(int i=0;i<n;i++){
cin>>name>>salary;
emp[i].first=name;
emp[i].second=salary;
}
sort(emp,emp+n,mycompare);
for(int i=0;i<n;i++){
if(emp[i].second>min_salary)
cout<<emp[i].first<<" "<<emp[i].second<<endl;
}
}

@Detoxo_16 you have to make a vector of pair<string, int> because a pair can have only 2 elements. You have to store n number of pairs in a vector.

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.