func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, a[100009], x[100009], h[100009], id[100009], seg[400009];   void upd(int pos, int l, int r, int pp, int v) {     if (l == r) {       seg[pos] = v;       return;     }     int m = (l + r) / 2;     if (m >= pp)       upd(2 * pos + 1, l, m, pp, v);     else       upd(2 * pos + 2, m + 1, r, pp, v);     seg[pos] = max(seg[2 * pos + 1], seg[2 * pos + 2]);   }   int qu(int pos, int l, int r, int b, int e) {     if (b <= l && r <= e) return seg[pos];     int m = (l + r) / 2;     int r1 = 0, r2 = 0;     if (m >= b) r1 = qu(2 * pos + 1, l, m, b, e);     if (m < e) r2 = qu(2 * pos + 2, m + 1, r, b, e);     return max(r1, r2);   }   int ans[100009];   void bs(int i, int l, int r) {     int m;     int o = x[i] + h[i] - 1;     while (r - l > 1) {       m = (l + r) / 2;       if (o < x[m])         r = m;       else         l = m;     }     if (l == i)       ans[id[i]] = i;     else       ans[id[i]] = qu(0, 0, n - 1, i + 1, l);     upd(0, 0, n - 1, i, ans[id[i]]);     ans[id[i]] -= i;     ans[id[i]]++;   }   pair<int, pair<int, int> > p[100009];   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x[i] >> h[i];       p[i] = {x[i], {h[i], i}};     }     sort(p, p + n);     for (int i = 0; i < n; i++) {       x[i] = p[i].first;       h[i] = p[i].second.first;       id[i] = p[i].second.second;     }     ans[id[n - 1]] = 1;     upd(0, 0, n - 1, n - 1, n - 1);     for (int i = n - 2; i >= 0; i--) {       bs(i, i, n);     }     for (int i = 0; i < n; i++) cout << ans[i] <<    ;   }   