func_code_string: #include <bits/stdc++.h>   using namespace std;   const double pi = 3.1415926535;   const double eps = 1e-6;   struct TP {     int x, h, id;   } P[110000];   bool cmp(TP a, TP b) { return a.x < b.x; }   int n, tot, Z[110000], F[110000], num[110000], ans[110000];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d , &P[i].x, &P[i].h);       P[i].id = i;     }     sort(P, P + n, cmp);     for (int i = n - 1; i >= 0; i--) {       int now = P[i].x + P[i].h, all = 1;       while (tot && Z[tot] < now) {         now = max(now, F[tot]);         all += num[tot];         tot--;       }       tot++;       Z[tot] = P[i].x;       F[tot] = now;       num[tot] = all;       ans[P[i].id] = all;     }     for (int i = 0; i < n; i++) printf( %d  , ans[i]);     puts(  );     cin >> n;   }   