func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18;   const long long Mod = 1e9 + 7;   const long double Pi = acos(-1);   long long n, m, k;   struct Weapon {     long long Pow, Val;   } a[200009], b[200009];   struct Monster {     long long Att, Def, Val;   } c[200009];   bool Cmp1(Weapon x, Weapon y) { return x.Pow < y.Pow; }   bool Cmp2(Monster x, Monster y) { return x.Att < y.Att; }   long long SufMin[200009];   long long Tree[800009], Lzy[800009];   void Merge(long long Node) {     Tree[Node] = max(Tree[Node * 2], Tree[Node * 2 + 1]);   }   void Build(long long Node, long long l, long long r) {     if (l == r) {       Tree[Node] = -a[l].Val;       return;     }     Build(Node * 2, l, (l + r) / 2);     Build(Node * 2 + 1, (l + r) / 2 + 1, r);     Merge(Node);   }   void LzyUpd(long long Node, long long l, long long r) {     Tree[Node] += Lzy[Node];     if (l != r) {       Lzy[Node * 2] += Lzy[Node];       Lzy[Node * 2 + 1] += Lzy[Node];     }     Lzy[Node] = 0;   }   void Upd(long long Node, long long l, long long r, long long s, long long e,            long long x) {     if (l > r || s > e) return;     LzyUpd(Node, l, r);     if (s > r || e < l) return;     if (s <= l && e >= r) {       Lzy[Node] += x;       LzyUpd(Node, l, r);       return;     }     Upd(Node * 2, l, (l + r) / 2, s, e, x);     Upd(Node * 2 + 1, (l + r) / 2 + 1, r, s, e, x);     Merge(Node);   }   long long Query(long long Node, long long l, long long r) {     LzyUpd(Node, l, r);     return Tree[Node];   }   long long Bin1(long long X) {     long long l = -1, r = n;     while (r - l > 1) {       if (a[(l + r) / 2].Pow > X)         r = (l + r) / 2;       else         l = (l + r) / 2;     }     return r;   }   long long Bin2(long long X) {     long long l = -1, r = m;     while (r - l > 1) {       if (b[(l + r) / 2].Pow > X)         r = (l + r) / 2;       else         l = (l + r) / 2;     }     return (r == m ? inf : SufMin[r]);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m >> k;     for (int i = 0; i < n; i++) {       cin >> a[i].Pow >> a[i].Val;     }     for (int i = 0; i < m; i++) {       cin >> b[i].Pow >> b[i].Val;     }     for (int i = 0; i < k; i++) {       cin >> c[i].Def >> c[i].Att >> c[i].Val;     }     sort(a, a + n, Cmp1);     sort(b, b + m, Cmp1);     sort(c, c + k, Cmp2);     for (int i = m - 1; i >= 0; i--) {       SufMin[i] = b[i].Val;       SufMin[i] = min(SufMin[i], (long long)(i == m - 1 ? inf : SufMin[i + 1]));     }     Build(1, 0, n - 1);     long long Ans = -Bin2(0) + Query(1, 0, n - 1);     for (int i = 0; i < k; i++) {       long long Id = Bin1(c[i].Def);       Upd(1, 0, n - 1, Id, n - 1, c[i].Val);       long long Best1 = Bin2(c[i].Att);       long long Best2 = Query(1, 0, n - 1);       Ans = max(Ans, -Best1 + Best2);     }     cout << Ans << endl;   }   