func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 2e5 + 5;   long long n, m;   long long a[N], ans[N];   set<long long> active;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     for (long long i = 1; i <= n; i++) {       cin >> a[i];       active.insert(i);     }     cin >> m;     while (m--) {       long long type;       cin >> type;       if (type == 1) {         long long p, x;         cin >> p >> x;         auto it = active.lower_bound(p);         if (it != active.end()) {           long long idx = *it;           ans[idx] += x;           long long diff = 0;           while (idx <= n && ans[idx] >= a[idx]) {             diff = ans[idx] - a[idx];             ans[idx + 1] += diff;             ans[idx] = a[idx];             active.erase(idx);             idx++;           }         }       } else {         long long k;         cin >> k;         cout << ans[k] <<   n ;       }     }     return 0;   }   