func_code_string: #include <bits/stdc++.h>   using namespace std;   int c[200010];   int v[200010];   set<int> not_full;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, m, q, p, x, k;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> c[i];       not_full.insert(i);     }     cin >> m;     while (m--) {       cin >> q;       if (q == 1) {         cin >> p >> x;         while (x > 0) {           if (not_full.find(p) == not_full.end()) {             set<int>::iterator it = not_full.upper_bound(p);             if (it == not_full.end()) {               break;             } else {               p = *it;             }           } else if (v[p] + x < c[p]) {             v[p] += x;             x = 0;           } else {             x = x - (c[p] - v[p]);             v[p] = c[p];             not_full.erase(p);           }         }       } else {         cin >> k;         cout << v[k] <<   n ;       }     }     return 0;   }   