Error in the code

bool comparator (pair<int,int> a,pair<int,int>b)
{
return a.second<b.second;
}
int main() {
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
vector<pair<int,int>> v(n);
int f=0;
for (int i=0;i<n;i++)
{
cin>>f;
cin>>s;

v[i].first=f;
v[i].second=s;

}
int count=1;

sort(v.begin(),v.end(),comparator);

s=v[0].second;
for (int i=1;i<n;i++)
{
if(v[i].first>=s)
{
count++;
s=v[i].second;
}
}

cout<<count<<endl;
count=1;

}
return 0;

can you please tell me why the code isn’t working ?
i have already included library file and using namespace std

@somilgupta4
Please save your code at ide.codingblcks.com and then share link here

@somilgupta4
I think your code is working fine at hackerblocks. Please submit it here https://hack.codingblocks.com/app/contests/1350/408/problem and check whether it is passing all testcase here or not

how shall i submit my code to my algo ++ course ? i need to complete the track or topic ?
its working fine on contest section not on my course.

@somilgupta4 Raising this issue to the concern department. Will resolved soon.