func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   const long long int mod = 1e9 + 7;   const long long int mod1 = 998244353;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   long long int rand(long long int l, long long int r) {     uniform_int_distribution<long long int> uid(l, r);     return uid(rng);   }   const long long int N = 2e5 + 5;   long long int lazy[4 * N], tr[4 * N];   long long int a[N], b[N], c[N];   void build(long long int nd, long long int s, long long int e) {     if (s == e) {       tr[nd] = b[s];       return;     }     long long int m = (s + e) >> 1;     build(nd << 1, s, m);     build(nd << 1 | 1, m + 1, e);     tr[nd] = min(tr[nd << 1], tr[nd << 1 | 1]);   }   void push_down(long long int nd, long long int s, long long int e) {     if (lazy[nd]) {       tr[nd] += lazy[nd];       if (s != e) {         lazy[nd << 1] += lazy[nd];         lazy[nd << 1 | 1] += lazy[nd];       }       lazy[nd] = 0;     }   }   void update(long long int nd, long long int s, long long int e, long long int l,               long long int r, long long int x) {     push_down(nd, s, e);     if (s > r || e < l) return;     if (l <= s && e <= r) {       lazy[nd] += x;       push_down(nd, s, e);       return;     }     long long int m = (s + e) >> 1;     update(nd << 1, s, m, l, r, x);     update(nd << 1 | 1, m + 1, e, l, r, x);     tr[nd] = min(tr[nd << 1], tr[nd << 1 | 1]);   }   vector<pair<long long int, long long int> > g[N];   void build1(long long int nd, long long int s, long long int e) {     if (s == e) {       tr[nd] = a[s] + c[s];       return;     }     long long int m = (s + e) >> 1;     build1(nd << 1, s, m);     build1(nd << 1 | 1, m + 1, e);     tr[nd] = min(tr[nd << 1], tr[nd << 1 | 1]);   }   void update1(long long int nd, long long int s, long long int e,                long long int idx, long long int x) {     if (s == e) {       a[s] = x;       tr[nd] = x + c[s];       return;     }     long long int m = (s + e) >> 1;     if (idx <= m)       update1(nd << 1, s, m, idx, x);     else       update1(nd << 1 | 1, m + 1, e, idx, x);     tr[nd] = min(tr[nd << 1], tr[nd << 1 | 1]);   }   void solve() {     long long int n, m, q;     cin >> n >> m >> q;     for (long long int i = 1; i <= n - 1; i++) {       cin >> a[i] >> b[i];     }     build(1, 0, n - 1);     for (long long int i = 1; i <= m; i++) {       long long int x, y, z;       cin >> x >> y >> z;       g[x].push_back({y, z});     }     for (long long int i = 1; i <= n; i++) {       for (pair<long long int, long long int> x : g[i]) {         update(1, 0, n - 1, 0, x.first - 1, x.second);       }       c[i] = tr[1];     }     build1(1, 1, n);     cout << tr[1] <<   n ;     for (long long int i = 1; i <= q; i++) {       long long int v, x;       cin >> v >> x;       update1(1, 1, n, v, x);       cout << tr[1] <<   n ;     }   }   signed main() {     ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);     clock_t clk = clock();     long long int t;     t = 1;     for (long long int i = 1; i <= t; i++) {       solve();     }     cerr <<   n           << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;     return 0;   }   