func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e9 + 7, llinf = 1e18 + 123;   void xru() {     setlocale(LC_ALL,  rus );     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   void dolitb(long long p, long long x, set<long long>& s, vector<long long>& a) {     if (s.empty() || s.lower_bound(p) == s.end()) {       return;     }     long long np = *s.lower_bound(p);     if (x > a[np]) {       x -= a[np];       a[np] = 0;       s.erase(s.find(np));       dolitb(np + 1, x, s, a);     } else {       a[np] -= x;     }   }   int main() {     xru();     long long n;     cin >> n;     vector<long long> a(n);     for (long long ghgh = 0; ghgh < a.size(); ghgh++) cin >> a[ghgh];     ;     vector<long long> cnt = a;     set<long long> s;     for (long long i = 0; i < n; i++) {       s.insert(i);     }     long long t;     cin >> t;     vector<long long> ans;     for (long long q = 0; q < t; q++) {       long long num;       cin >> num;       if (num == 1) {         long long p, x;         cin >> p >> x;         p--;         dolitb(p, x, s, a);       } else {         long long p;         cin >> p;         p--;         ans.push_back(cnt[p] - a[p]);       }     }     for (long long ghgha = 0; ghgha < ans.size(); ghgha++)       cout << ans[ghgha] << endl;     ;   }   