func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   struct pos {     long long int x;     long long int h;     int indx;     int sum;   } p[100005];   bool cmp(pos a, pos b) { return a.x < b.x; }   bool cmp2(pos a, pos b) { return a.indx < b.indx; }   int bs(long long int key) {     int l = 0;     int r = n;     int mid;     while (l <= r) {       mid = (l + r) / 2;       if (p[mid].x == key) {         return mid;       } else if (p[mid].x < key) {         l = mid + 1;       } else {         r = mid - 1;       }     }   }   int main() {     scanf( %d , &n);     long long int ar[n + 5];     for (int i = 0; i < n; i++) {       scanf( %lld%lld , &p[i].x, &p[i].h);       p[i].indx = i;       p[i].sum = 1;     }     sort(p, p + n, cmp);     p[n - 1].sum = 1;     for (int i = n - 2; i >= 0; i--) {       long long int val = p[i].h + p[i].x;       int poscnt = 1;       while (val > p[i + poscnt].x && poscnt + i < n) {         p[i].sum += p[poscnt + i].sum;         poscnt += p[poscnt + i].sum;       }     }     sort(p, p + n, cmp2);     for (int i = 0; i < n; i++) {       printf( %d  , p[i].sum);     }     printf(  n );     return 0;   }   