func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 10;   long long int inf = -1e15;   long long int seg[maxn << 2], lazy[maxn << 2];   int n, m, p;   vector<long long int> espadas, armaduras;   vector<pair<int, int> > monstros[maxn];   void update(int x, long long int val) {     seg[x] += val;     lazy[x] += val;   }   void propaga(int x) {     if (!lazy[x]) return;     update(x * 2, lazy[x]);     update(x * 2 + 1, lazy[x]);     lazy[x] = 0;   }   void add(int i, int j, int x, int l, int r, int val) {     if (i >= j || l >= r || i >= r || j <= l) return;     if (i >= l && j <= r) {       update(x, val);       return;     }     propaga(x);     int md = (i + j) >> 1;     add(i, md, x * 2, l, r, val);     add(md, j, x * 2 + 1, l, r, val);     seg[x] = max(seg[x * 2], seg[x * 2 + 1]);   }   void build(int i, int j, int no) {     int l = 2 * no;     int r = l + 1;     if (i + 1 == j) {       if (armaduras[i])         seg[no] = -armaduras[i];       else         seg[no] = inf;       return;     }     int mid = (i + j) >> 1;     build(i, mid, l);     build(mid, j, r);     seg[no] = max(seg[l], seg[r]);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     long long int ans = inf;     espadas.resize(maxn);     armaduras.resize(maxn);     cin >> n >> m >> p;     int atk, def;     long long int gold;     for (int i = 1; i <= n; i++) {       cin >> atk >> gold;       atk--;       if (!espadas[atk])         espadas[atk] = gold;       else         espadas[atk] = min(espadas[atk], gold);     }     for (int i = 1; i <= m; i++) {       cin >> def >> gold;       if (!armaduras[def])         armaduras[def] = gold;       else         armaduras[def] = min(armaduras[def], gold);     }     build(1, maxn, 1);     for (int i = 1; i <= p; i++) {       cin >> def >> atk >> gold;       monstros[def].push_back(pair<int, int>(atk, gold));     }     for (int i = 0; i <= maxn - 1; i++) {       for (auto a : monstros[i]) add(1, maxn, 1, a.first + 1, maxn, a.second);       if (espadas[i]) ans = max(ans, seg[1] - espadas[i]);     }     cout << ans << endl;     return 0;   }   