Can anyone debug this solution

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
bool comp(pair<ll,ll>a,pair<ll,ll>b){
if(a.first==b.first)return a.second>b.second;
return a.first<b.first;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll sp,linenum;
cin >> sp >> linenum;
setspst;
ll h = sp;
while(h–){
ll x;
cin >> x;
spst.insert(x);
}
vector< pair<ll,ll> >v;
map<ll,string>ids;
for(ll i = 0 ; i < linenum ; i++){
ll id,p;
string s;
cin >> id >> p;
cin >> s;
ids[id]=s;
v.push_back(make_pair(p,id));

}

sort(v.rbegin(),v.rend(),comp);
for(ll i = 0 ; i < linenum;i++){ 
   
    if(spst.count(v[i].second)){cout << ids[v[i].second] <<endl;
    }
}
for(ll i = 0 ; i < linenum ; i ++){
     if(!spst.count(v[i].second)){cout << ids[v[i].second] <<endl;}
}

}

problem link : Contest Page | CodeChef