func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     vector<long long> a(n + 1);     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     int m;     cin >> m;     long long ans = 0;     long long wt = 0, ht = 0;     while (m--) {       long long w, h;       cin >> w >> h;       ans = max(ans + ht, a[w]);       wt = w;       ht = h;       cout << ans << endl;     }     return 0;   }   