func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   const int S = 320;   int a[N];   int dp[S + 1][N];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     int q, p, k;     cin >> q;     for (int j = 1; j <= S; j++) {       for (int i = n; i >= 1; i--) {         if (i + a[i] + j > n)           dp[j][i] = 1;         else           dp[j][i] = dp[j][i + a[i] + j] + 1;       }     }     for (int i = 0; i < q; i++) {       cin >> p >> k;       int cnt = 0;       if (k <= S)         cout << dp[k][p] << endl;       else {         while (p <= n) {           cnt++;           p += a[p] + k;         }         cout << cnt << endl;       }     }     return 0;   }   