Maximum circle: som etest cases are not passing

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {

 ll n,r,c,count=0;
 cin>>n;
 vector<pair<ll,ll>> pt;
 for(ll i=0;i<n;i++)
 {
     cin>>c>>r;
     pt.push_back(make_pair(c-r,c+r));
 }
   sort(pt.begin(), pt.end()); 
   ll cur = pt[0].second; 

 for (ll i = 1; i < n; ++i) { 

    // non intersecting circles 
    if (pt[i].first > cur) { 
        cur = pt[i].second; 
    } 
    // intersecting circles 
    else
        count++; 
} 

 cout<<count;
 return 0;

}

@prajjwalrkstr
The sorting of pairs needs to be done based on the second value , not the first. Make this change. Even still there is a bit of trouble with your if-else conditions. Kindly dry run your program and figure it out as it is really pretty simple. Let me know if you need any further help.

sir i dry run on sampl e case .it is paassing just tell me what i havd to edit in my ciode

@prajjwalrkstr
First of all , sort according to the second element of the pairs.
After that , minor change in your if condition. Change it to pt[i].first >= cur. You missed the =.

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.