func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long a = 0, b = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) b = -1;       c = getchar();     }     while (isdigit(c)) {       a = a * 10 + c -  0 ;       c = getchar();     }     return a * b;   }   const long long N = 3e5 + 50, M = 6e5 + 50;   long long n, m, w[N], tot, h[N], nx[M], ver[M], ed[M], dat[N * 8], lazy[N * 8],       ans;   void add(long long u, long long v, long long z) {     ver[++tot] = v;     ed[tot] = z;     nx[tot] = h[u];     h[u] = tot;   }   void spread(long long p) {     if (lazy[p]) {       dat[(p << 1)] += lazy[p];       dat[(p << 1 | 1)] += lazy[p];       lazy[(p << 1)] += lazy[p];       lazy[(p << 1 | 1)] += lazy[p];       lazy[p] = 0;     }   }   void change(long long p, long long l, long long r, long long u, long long v,               long long z) {     if (l >= u && r <= v) {       dat[p] += z;       lazy[p] += z;       return;     }     spread(p);     long long mid = (l + r) >> 1;     if (u <= mid) change((p << 1), l, mid, u, v, z);     if (v > mid) change((p << 1 | 1), mid + 1, r, u, v, z);     dat[p] = max(dat[(p << 1)], dat[(p << 1 | 1)]);   }   signed main() {     n = read();     m = read();     for (register long long i = 1; i <= n; i++) {       w[i] = read();     }     for (register long long i = 1, u, v, z; i <= m; i++) {       u = read();       v = read();       z = read();       add(v, u, z);     }     for (register long long i = 1; i <= n; i++) {       change(1, 1, n, i, i, ans);       change(1, 1, n, 1, i, -w[i]);       for (register long long j = h[i]; j; j = nx[j]) {         change(1, 1, n, 1, ver[j], ed[j]);       }       ans = max(ans, dat[1]);     }     printf( %lld n , ans);     return 0;   }   