What is wrong with this code

#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n,l=0;
cin>>n;
int a[100],b[100];
for(int i=0;i<n;i++)
{
cin>>a[i]>>b[i];
}
for(int i=0;i<n;i++)
{
if(b[i]<=a[i+1])
{
l++;
}
else{continue;}
}
cout<<l;
}
return 0;
}

You should first sort your ending time in increasing order