func_code_string: #include <bits/stdc++.h>   using namespace std;   int ABS(int a) {     if (a < 0) return (-a);     return a;   }   void input() {}   int a[100005];   int seg[100005];   int nxt[100005];   int hop[100005];   void readInt(int &n) {     n = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) {       n = n * 10 + ch - 48;       ch = getchar();     }   }   int main() {     input();     int n, q;     readInt(n);     readInt(q);     int sq = sqrt(n);     int c = 0, cnt = 0;     for (int i = (0); i < (n); ++i) {       readInt(a[i]);       seg[i] = cnt;       c++;       if (c == sq) c = 0, cnt++;     }     for (int i = (n - 1); i >= (0); --i) {       int to = i + a[i];       hop[i] = 1;       if (to >= n)         nxt[i] = -1;       else if (seg[to] != seg[i])         nxt[i] = to;       else {         nxt[i] = nxt[to];         hop[i] += hop[to];       }     }     while (q--) {       int type;       readInt(type);       if (type == 0) {         int x, y;         readInt(x);         readInt(y);         x--;         int i = x;         a[x] = y;         while (i >= 0) {           if (seg[i] != seg[x]) break;           int to = i + a[i];           hop[i] = 1;           if (to >= n)             nxt[i] = -1;           else if (seg[to] != seg[i])             nxt[i] = to;           else {             nxt[i] = nxt[to];             hop[i] += hop[to];           }           i--;         }       } else {         int x;         readInt(x);         x--;         int ans = 0;         int last = x;         while (x != -1) {           ans += hop[x];           last = x;           x = nxt[x];         }         while (last + a[last] < n) last = last + a[last];         printf( %d %d n , last + 1, ans);       }     }     return 0;   }   