Help me to Debug (Maximum Circles)

#include
#include
#define l long long int
using namespace std;

class circle{
public:
int center;
int radius;
int startpoint;
int endpoint;
};

bool compare(circle a,circle b){
if(a.endpoint == b.endpoint){
return a.startpoint < b.startpoint;
}
else{
return a.startpoint < b.startpoint;
}
}

int main(){
int n;
cin>>n;
int center,radius;
circle arr[n];
for(int i=0;i<n;i++){
cin>>center>>radius;
circle x;
x.center = center;
x.radius = radius;
x.startpoint = center-radius;
x.endpoint = center + radius;
arr[i] = x;
}
sort(arr,arr+n,compare);
int count =1;
circle prev= arr[0];
for(int i=1;i<n;i++){
if(arr[i].startpoint >= prev.endpoint){
prev = arr[i];
count++;
}
}
cout<<count;
return 0;
}

@amangoel987357
hello Aman,
a) image
it should be a,.endpoint < b.endpoint

b) you answer should be n-count becuase in question the are asking minimum number of circle we remove so that remaining cirlces dont overlap

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.