func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:66777216 )   using namespace std;   struct node {     int num, cnt;     node *l, *r, *p, *path;   };   typedef node *pnode;   const int N = 100003;   node tr[N + 1];   pnode tmp[100002];   const pnode pNull = tr + N;   inline void upd(pnode v) {     if (v == pNull) return;     v->cnt = 1 + v->l->cnt + v->r->cnt;     v->l->p = v;     v->r->p = v;   }   pnode fnd(pnode v, int cnt) {     if (v == pNull) return pNull;     if (v->l->cnt >= cnt)       return fnd(v->l, cnt);     else if (v->l->cnt + 1 == cnt)       return v;     else       return fnd(v->r, cnt - v->l->cnt - 1);   }   inline bool is_left_son(pnode v1, pnode v2) { return v1->l == v2; }   void rotate(pnode v) {     if (v->p == pNull) return;     pnode f = v->p;     if (is_left_son(f, v)) {       pnode tmp = v->r;       v->r = f;       f->l = tmp;       v->p = f->p;       if (is_left_son(v->p, f))         v->p->l = v;       else         v->p->r = v;       f->p = v;       upd(f);       upd(v);     } else {       pnode tmp = v->l;       v->l = f;       f->r = tmp;       v->p = f->p;       if (is_left_son(v->p, f))         v->p->l = v;       else         v->p->r = v;       f->p = v;       upd(f);       upd(v);     }     v->path = f->path;   }   void splay(pnode v) {     while (v->p != pNull) {       if (v->p->p == pNull) {         rotate(v);         break;       }       if (is_left_son(v->p, v) == is_left_son(v->p->p, v->p)) {         rotate(v->p);         rotate(v);       } else {         rotate(v);         rotate(v);       }     }   }   pnode merge(pnode l, pnode r) {     if (l == pNull && r == pNull) return pNull;     if (l == pNull) return r;     if (r == pNull) return l;     pnode q = fnd(r, 1);     splay(q);     q->l = l;     upd(q);     return q;   }   pnode getRoot(pnode v, int &cnt) {     splay(v);     cnt = v->l->cnt + 1;     return v;   }   pnode expose(pnode v) {     splay(v);     if (v->r != pNull) {       v->r->path = v;       v->r->p = pNull;       v->r = pNull;       upd(v);     }     int tmp = 0;     while (v->path != pNull) {       pnode f = v->path;       splay(f);       if (f->r != pNull) {         f->r->path = f;         f->r->p = pNull;         f->r = pNull;         upd(f);       }       pnode old = f->path;       v = merge(f, v);       v->path = old;     }     return v;   }   pnode makeRoot(pnode v) {     pnode root = expose(v);     splay(v);     return v;   }   int a, b, c, d, i, j, n, m, k;   int mas[100004];   int main() {     scanf( %d%d , &n, &m);     for (int _n((n)-1), i(0); i <= _n; i++) {       scanf( %d , &mas[i]);       pnode q = &tr[k++];       q->l = q->r = q->p = pNull;       q->cnt = 1;       q->num = i;       if (i + mas[i] < n) {         q->path = &tr[i + mas[i]];       } else {         q->path = &tr[n];       }     }     pnode q = &tr[k++];     q->l = q->r = q->p = q->path = pNull;     q->cnt = 1;     q->num = n;     for (int _n((m)-1), i(0); i <= _n; i++) {       scanf( %d , &a);       if (a == 0) {         scanf( %d%d , &a, &b);         --a;         pnode link = pNull;         if (a + mas[a] < n)           link = tr + a + mas[a];         else           link = tr + n;         pnode root = makeRoot(link);         c = 0;         pnode pa = expose(tr + a);         expose(link);         tr[a].path = pNull;         mas[a] = b;         if (a + mas[a] < n)           link = tr + a + mas[a];         else           link = tr + n;         tr[a].path = link;       } else {         scanf( %d , &a);         --a;         makeRoot(tr + n);         pnode root = expose(tr + a);         pnode p = fnd(root, 2);         printf( %d %d n , p->num + 1, root->cnt - 1);       }     }   }   