func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[100004];   long long d[100004];   int main() {     int n;     scanf( %d , &n);     a[0] = 0;     long long b = 0, c = 0;     for (int i = 1; i <= n; ++i) {       scanf( %lld , &a[i]);       d[i] = a[i] - a[i - 1];       if (d[i] > 0) b += d[i];     }     if (d[1] < 0) c = d[1];     printf( %lld n , (c + b > 0 ? (c + b + 1) / 2 : (c + b) / 2));     int q;     cin >> q;     while (q--) {       int l, r, x;       scanf( %d%d%d , &l, &r, &x);       if (d[l] > 0) b -= d[l];       d[l] += x;       if (d[l] > 0) b += d[l];       d[l] -= x;       if (r < n) {         if (d[r + 1] > 0) b -= d[r + 1];         d[r + 1] -= x;         if (d[r + 1] > 0) b += d[r + 1];         d[r + 1] += x;       }       if (l == 1) {         if (d[1] < 0) c -= d[1];         d[l] += x;         if (d[1] < 0) c += d[1];         d[l] -= x;       }       d[l] += x;       d[r + 1] -= x;       printf( %lld n , (c + b > 0 ? (c + b + 1) / 2 : (c + b) / 2));     }   }   