func_code_string: #include <bits/stdc++.h>   using namespace std;   struct node {     int pos, h, ans, id, f;   } Do[100001];   int n;   int cmd(node a, node b) { return a.pos < b.pos; }   int cmd2(node a, node b) { return a.id < b.id; }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &Do[i].pos, &Do[i].h);       Do[i].id = i;     }     sort(Do + 1, Do + n + 1, cmd);     Do[n].ans = 1;     Do[n].f = n;     for (int i = n - 1; i >= 1; i--) {       Do[i].ans = 1;       Do[i].f = i;       int next = i + 1;       if (Do[i].pos + Do[i].h - 1 < Do[i + 1].pos) continue;       while (next <= n) {         if (Do[Do[next].f + 1].pos > Do[i].pos + Do[i].h - 1) {           Do[i].ans += Do[next].ans;           Do[i].f = Do[next].f;           break;         } else {           Do[i].ans += Do[next].ans;           Do[i].f = Do[next].f;           next = Do[next].f + 1;         }       }     }     sort(Do + 1, Do + n + 1, cmd2);     for (int i = 1; i <= n; i++) printf( %d  , Do[i].ans);   }   