func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 3e5 + 5;   long long n, q, a[maxn], c[maxn];   long long read() {     long long res = 0, f = 1;     char ch;     do {       ch = getchar();       if (ch ==  - ) f = -1;     } while (!isdigit(ch));     do {       res = res * 10 + ch -  0 ;       ch = getchar();     } while (isdigit(ch));     return res * f;   }   long long check(long long x) {     if (!x) return 0;     return x > 0 ? 1 : -1;   }   struct SegmentTree {     long long mxlen[maxn << 2], lmost[maxn << 2], ltype[maxn << 2],         rmost[maxn << 2], rtype[maxn << 2], len[maxn << 2];     void pushup(long long rt, long long l, long long r) {       long long ls = rt << 1, rs = rt << 1 | 1, mx = max(mxlen[ls], mxlen[rs]),                 mid = (l + r) >> 1;       ltype[rt] = ltype[ls];       rtype[rt] = rtype[rs];       mx = max(mx, lmost[ls]);       mx = max(mx, rmost[rs]);       if (rtype[ls] && ltype[rs] && rtype[ls] >= ltype[rs]) {         mx = max(mx, rmost[ls] + lmost[rs]);         if (lmost[ls] == len[ls])           lmost[rt] = lmost[ls] + lmost[rs];         else           lmost[rt] = lmost[ls];         if (rmost[rs] == len[rs])           rmost[rt] = rmost[ls] + rmost[rs];         else           rmost[rt] = rmost[rs];       } else         lmost[rt] = lmost[ls], rmost[rt] = rmost[rs];       mxlen[rt] = mx;     }     void build(long long rt, long long l, long long r) {       len[rt] = r - l + 1;       if (l == r) {         ltype[rt] = rtype[rt] = lmost[rt] = rmost[rt] = 0;         if (a[l]) mxlen[rt] = 1;         if (a[l] > 0) {           ltype[rt] = 1;           lmost[rt] = 1;           rtype[rt] = 1;           rmost[rt] = 1;         } else if (a[l] < 0) {           ltype[rt] = -1;           lmost[rt] = 1;           rtype[rt] = -1;           rmost[rt] = 1;         }         return;       }       long long mid = (l + r) >> 1;       build(rt << 1, l, mid);       build(rt << 1 | 1, mid + 1, r);       pushup(rt, l, r);     }     void update(long long rt, long long l, long long r, long long x,                 long long val) {       if (l == r) {         a[l] += val;         ltype[rt] = rtype[rt] = lmost[rt] = rmost[rt] = 0;         if (a[l]) mxlen[rt] = 1;         if (a[l] > 0) {           ltype[rt] = 1;           lmost[rt] = 1;           rtype[rt] = 1;           rmost[rt] = 1;         } else if (a[l] < 0) {           ltype[rt] = -1;           lmost[rt] = 1;           rtype[rt] = -1;           rmost[rt] = 1;         }         return;       }       long long mid = (l + r) >> 1;       if (x <= mid)         update(rt << 1, l, mid, x, val);       else         update(rt << 1 | 1, mid + 1, r, x, val);       pushup(rt, l, r);     }   } T;   signed main() {     n = read();     for (long long i = (1); i <= (n); ++i) c[i] = read();     if (n == 1) {       q = read();       while (q--) {         long long l = read(), r = read(), x = read();         puts( 1 );       }       return 0;     }     for (long long i = (1); i <= (n - 1); ++i) a[i] = c[i + 1] - c[i];     T.build(1, 1, n - 1);     q = read();     while (q--) {       long long l = read(), r = read(), x = read();       if (l - 1 >= 1) T.update(1, 1, n - 1, l - 1, x);       if (r + 1 <= n) T.update(1, 1, n - 1, r, -x);       printf( %d n , T.mxlen[1] + 1);     }   }   