func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n;   long long Tree[1000001];   long long arr[200001];   void add(long long x, long long val) {     for (; x <= n; x += x & (-x)) Tree[x] += val;     return;   }   long long get(long long x) {     long long sum = 0;     for (; x > 0; x -= x & (-x)) sum += Tree[x];     return sum;   }   void solve() {     long long x = 1;     if (get(1) == 0) {       cout << 1 <<   n ;       return;     }     while (x < n) {       long long curr_val = get(x) * 2;       if (get(x + 1) == curr_val) {         cout << x + 1 <<   n ;         return;       }       long long lo = x + 1;       long long hi = n;       long long lo_bound;       while (lo <= hi) {         if (lo == hi) {           lo_bound = lo;           break;         }         long long mi = (lo + hi) / 2;         if (get(mi) < curr_val)           lo = mi + 1;         else           hi = mi;       }       long long k = lo_bound - 1;       x = (x == k) ? (k + 1) : k;     }     cout << -1 <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long q;     memset(Tree, 0, sizeof Tree);     cin >> n >> q;     for (long long i = 1; i <= n; i++) {       cin >> arr[i];       add(i, arr[i]);     }     long long x, y;     while (q--) {       cin >> x >> y;       add(x, y - arr[x]);       arr[x] = y;       solve();     }     return 0;   }   