func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[200010], b[200010], n, m, q;   vector<pair<int, int> > e[200010];   long long T[800010], d[800010];   long long f[200010];   void push(int id) {     T[id << 1] += d[id];     T[id << 1 | 1] += d[id];     d[id << 1] += d[id];     d[id << 1 | 1] += d[id];     d[id] = 0;     return;   }   void upd(int x, int y, long long dx, int id = 1, int l = 0, int r = n) {     if (x >= r || l >= y) return;     if (x <= l && r <= y) {       T[id] += dx;       d[id] += dx;       return;     }     push(id);     upd(x, y, dx, id << 1, l, l + r >> 1);     upd(x, y, dx, id << 1 | 1, l + r >> 1, r);     T[id] = min(T[id << 1], T[id << 1 | 1]);     return;   }   void build() {     for (int i = 0; i < n; i++) upd(i, i + 1, b[i]);     for (int i = 0; i < n; i++) {       for (auto p : e[i]) {         int to, cost;         tie(to, cost) = p;         upd(0, to + 1, cost);       }       f[i] = T[1];     }     memset(T, 0, sizeof(T));     memset(d, 0, sizeof(d));     for (int i = 0; i < n; i++) upd(i, i + 1, a[i] + f[i]);     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> m >> q;     for (int i = 0; i < n - 1; i++) cin >> a[i] >> b[i + 1];     for (int i = 0, u, v, w; i < m; i++) {       cin >> u >> v >> w;       e[--u].push_back((make_pair((--v), (w))));     }     build();     cout << T[1] << endl;     while (q--) {       int x, w;       cin >> x >> w;       upd(x - 1, x, w - a[x - 1]);       a[x - 1] = w;       cout << T[1] << endl;     }     return 0;   }   