func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, qu;   int a[100011];   int st[100011], en[100011];   int pos[100011];   int rt[100011], nxt[100011];   int step[100011];   bool vis[100011];   vector<int> v[100011], vv;   queue<int> q;   void bunhae_interval() {     int r = n % m, mm = n / m;     st[0] = 1;     for (int i = 0; i < m; i++) {       if (i) st[i] = en[i - 1] + 1;       en[i] = st[i] + mm - 1;       if (i < r) en[i]++;       for (int j = st[i]; j <= en[i]; j++) pos[j] = i;     }   }   void update(int x) {     int p = pos[x];     for (int i = st[p]; i <= x; i++) vis[i] = 0;     vis[x] = 1;     q.push(x);     while (!q.empty()) {       int y = q.front();       q.pop();       for (int i = 0; i < v[y].size(); i++) {         int z = v[y][i];         if (vis[z]) continue;         vis[z] = 1;         step[z] = step[y] + 1;         rt[z] = rt[x];         q.push(z);       }     }   }   int main() {     scanf( %d %d , &n, &qu);     m = sqrt(n);     bunhae_interval();     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = n; i >= 1; i--) {       int j = i + a[i];       if (j > n || pos[j] != pos[i])         nxt[i] = j, rt[i] = i, step[i] = 0;       else         rt[i] = rt[j], step[i] = step[j] + 1, v[j].push_back(i);     }     while (qu--) {       int tp, x, y;       scanf( %d %d , &tp, &x);       if (tp == 1) {         int cnt = 1, en = x;         while (1) {           if (rt[en] == en) {             if (nxt[en] > n)               break;             else               cnt++, en = nxt[en];           } else {             cnt += step[en], en = rt[en];           }         }         printf( %d %d n , en, cnt);       } else {         int xx = x + a[x];         if (xx > n) goto la;         vv.clear();         for (int i = 0; i < v[xx].size(); i++)           if (v[xx][i] != x) vv.push_back(v[xx][i]);         v[xx].clear();         for (int i = 0; i < vv.size(); i++) v[xx].push_back(vv[i]);       la:;         scanf( %d , &y);         int z = x + y;         if (z > n || pos[z] != pos[x])           nxt[x] = z, rt[x] = x, step[x] = 0;         else           rt[x] = rt[z], step[x] = step[z] + 1, v[z].push_back(x);         a[x] = y;         update(x);       }     }   }   