func_code_string: #include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:16777216 )   const int fin = 111110;   struct T {     int cnt, val, l, r, mx, y, ans;     T() : cnt(0), val(-1), l(fin), r(fin), mx(-1000000000), y(-1), ans(-1) {}   };   T a[111111];   void upd(int v) {     a[v].cnt = 1 + a[a[v].r].cnt + a[a[v].l].cnt;     a[v].mx = max(a[v].val, max(a[a[v].r].mx, a[a[v].l].mx));   }   void split(int v, int &l, int &r, int key) {     l = r = fin;     if (v == fin) return;     if (key && (a[v].l == -1 || a[a[v].l].cnt < key)) {       l = v;       split(a[v].r, a[v].r, r, key - a[a[v].l].cnt - 1);       upd(l);     } else {       r = v;       split(a[v].l, l, a[v].l, key);       upd(r);     }   }   int merge(int l, int r) {     if (l == fin) return r;     if (r == fin) return l;     if (a[l].y < a[r].y) {       a[l].r = merge(a[l].r, r);       upd(l);       return l;     } else {       a[r].l = merge(l, a[r].l);       upd(r);       return r;     }   }   int root, m;   void push(int val) {     a[m].y = (rand() << 16) + rand();     a[m].val = val;     a[m].cnt = 1;     a[m].mx = val;     a[m].ans = m + 1;     root = merge(root, m++);   }   int tot = 0;   void print(int v) {     if (v == fin) return;     if (a[v].l != fin) print(a[v].l);     {       if (tot)         printf(   );       else         tot = 1;       printf( %d , a[v].ans);     }     if (a[v].r != fin) print(a[v].r);   }   int fmin(int st, int fn) {     int r1, r2, r3, r4;     split(root, r1, r2, st);     split(r2, r3, r4, fn - st);     int rez = (r3 != -1) ? (a[r3].mx) : (-1000000000);     root = merge(r1, r3);     root = merge(root, r4);     return rez;   }   int n, A, C;   int find(int v, int maxim, int value, int lft) {     if (a[a[v].r].cnt + 1 > maxim)       return find(a[v].r, maxim, value, lft + 1 + a[a[v].l].cnt);     else if (a[a[v].r].mx > value)       return find(a[v].r, maxim, value, lft + 1 + a[a[v].l].cnt);     else if (a[v].val > value)       return lft + a[a[v].l].cnt;     else       return find(a[v].l, maxim - 1 - a[a[v].r].cnt, value, lft);   }   int main() {     a[fin].cnt = 0;     a[fin].mx = -1000000000;     scanf( %d , &n);     for (int(i) = 0; (i) < (n); ++(i)) {       scanf( %d%d , &A, &C);       if (i) {         int high = max(i - C, 0);         if (fmin(high, i) > A) high = find(root, C, A, 0) + 1;         int r1, r2;         split(root, r1, r2, high);         root = r1;         push(A);         root = merge(root, r2);       } else {         a[0].val = A;         a[0].ans = 1;         a[0].cnt = 1;         a[0].mx = A;         root = 0;         m = 1;       }     }     print(root);     cout << endl;   }   