kindly look at this suggest edits i m sick of this
#include
#include
using namespace std;
struct circle {
int start, end;
};
// Comparison function modified
// according to the end value
bool comp(circle a, circle b)
{
if (a.end == b.end)
return a.start < b.start;
return a.end < b.end;
}
// Fucntion to return the count
// of non intersecting circles
int main()
{
int n,c,r;
cin>>n;
circle diameter[n];
for(int i=0;i<n;i++)
{
cin>>c;
cin>>r;
diameter[i].start = c - r;
diameter[i].end = c + r;
}
// sorting with smallest finish time first
sort(diameter, diameter + n, comp);
// count stores number of
// circles to be removed
int count = 0;
// cur stores ending of first circle
int cur = diameter[0].end;
for (int i = 1; i < n; ++i) {
// non intersecting circles
if (diameter[i].start > cur) {
cur = diameter[i].end;
}
// intersecting circles
else
count++;
}
cout << count << "\n";
}