func_code_string: #include <bits/stdc++.h>   const int MaxN = 300000;   using namespace std;   long long arr[MaxN + 5], a[MaxN + 5], n;   struct Segment {     int l, r, lx, mx, rx;     int Sign(long long x) { return x > 0 ? 1 : -1; }     void Update(Segment A, Segment B) {       lx = A.lx, rx = B.rx;       mx = max(A.mx, B.mx);       if (a[A.r] && a[B.l] && Sign(a[A.r]) >= Sign(a[B.l])) {         mx = max(mx, A.rx + B.lx);         if (A.mx == A.r - A.l + 1) lx = A.mx + B.lx;         if (B.mx == B.r - B.l + 1) rx = B.mx + A.rx;       }       mx = max(mx, max(lx, rx));       l = A.l, r = B.r;     }   } seg[MaxN * 4 + 5];   void Update(int l, int r, int t, int x, int w) {     if (l == r) {       a[x] += w;       if (a[x] != 0)         seg[t] = (Segment){l, r, 1, 1, 1};       else         seg[t] = (Segment){l, r, 0, 0, 0};       return;     }     int mid = (l + r) >> 1;     if (x <= mid)       Update(l, mid, t * 2, x, w);     else       Update(mid + 1, r, t * 2 + 1, x, w);     seg[t].Update(seg[t * 2], seg[t * 2 + 1]);   }   int main() {     while (~scanf( %d , &n)) {       for (int i = 1; i <= n; i++) scanf( %d , &arr[i]);       for (int i = 1; i <= n; i++) a[i] = arr[i + 1] - arr[i];       for (int i = 1; i < n; i++) Update(1, n - 1, 1, i, 0);       int m;       scanf( %d , &m);       for (int i = 1; i <= m; i++) {         int l, r, w;         scanf( %d%d%d , &l, &r, &w);         if (l - 1 >= 1) Update(1, n - 1, 1, l - 1, w);         if (r <= n - 1) Update(1, n - 1, 1, r, -w);         printf( %d n , seg[1].mx + 1);       }     }     return 0;   }   