func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<long long> a;   struct SegTree {     struct Node {       long long left, right, mid, size;     };     Node combine(const Node& A, const Node& B, long long m) {       Node C;       if (A.left < A.size) {         C.left = A.left;       } else {         if ((a[m - 1] > 0) <= (a[m] > 0)) {           C.left = A.size + B.left;         } else {           C.left = A.size;         }       }       if (B.right < B.size) {         C.right = B.right;       } else {         if ((a[m - 1] > 0) <= (a[m] > 0)) {           C.right = B.size + A.right;         } else {           C.right = B.size;         }       }       C.mid = max(A.mid, B.mid);       if ((a[m - 1] > 0) <= (a[m] > 0)) {         C.mid = max(C.mid, A.right + B.left);       }       C.size = A.size + B.size;       return C;     }     long long size;     vector<Node> t;     void init(long long n) {       size = n;       t.resize(4 * size);     }     void build(long long x, long long lx, long long rx) {       if (lx + 1 == rx) {         if (a[lx] == 0) {           t[x] = {0, 0, 0, 1};         } else {           t[x] = {1, 1, 1, 1};         }       } else {         long long m = (lx + rx) / 2;         build(2 * x + 1, lx, m);         build(2 * x + 2, m, rx);         t[x] = combine(t[2 * x + 1], t[2 * x + 2], m);       }     }     void build(long long n) {       init(n);       build(0, 0, size);     }     void set(long long v, long long x, long long lx, long long rx) {       if (lx + 1 == rx) {         if (a[lx] == 0) {           t[x] = {0, 0, 0, 1};         } else {           t[x] = {1, 1, 1, 1};         }       } else {         long long m = (lx + rx) / 2;         if (v < m) {           set(v, 2 * x + 1, lx, m);         } else {           set(v, 2 * x + 2, m, rx);         }         t[x] = combine(t[2 * x + 1], t[2 * x + 2], m);       }     }     void set(long long v) { set(v, 0, 0, size); }   };   void solve() {     long long Q;     Q = 1;     while (Q--) {       long long n;       cin >> n;       vector<long long> b(n);       for (long long i = 0; i < n; ++i) cin >> b[i];       ;       a.resize(n - 1);       for (long long i = 0; i < n - 1; ++i) {         a[i] = b[i] - b[i + 1];       }       SegTree tree;       if (a.size() != 0) {         tree.build(a.size());       }       long long m;       cin >> m;       while (m--) {         long long l, r, d;         cin >> l >> r >> d;         --l, --r;         if (a.size() == 0) {           cout << 1 <<    ;           continue;         }         if (l > 0) {           a[l - 1] -= d;           tree.set(l - 1);         }         if (r < a.size()) {           a[r] += d;           tree.set(r);         }         cout << tree.t[0].mid + 1 <<    ;       }     }   }   signed main(signed argc, char** argv) {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     if (argc > 1 && (string)argv[1] ==  local ) {       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);       solve();       while (cin.peek() != EOF) {         if (isspace(cin.peek()))           cin.get();         else {           cout <<   n ;           solve();         }       }     } else {       solve();     }   }   