func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   const int NMAX = 1e6;   struct eq {     int x, c;     bool operator<(const eq &aux) const { return x < aux.x; }   };   eq a[200005], b[200005];   stack<pair<int, int> > st;   void prec(int &n, eq a[]) {     for (int i = 1; i <= n; ++i) scanf( %d%d , &a[i].x, &a[i].c);     sort(a + 1, a + n + 1);     st.push({a[1].x, a[1].c});     for (int i = 2; i <= n; ++i) {       while (!st.empty() && st.top().second >= a[i].c) st.pop();       st.push({a[i].x, a[i].c});     }     int sz = st.size();     n = sz;     while (!st.empty()) {       a[sz].x = st.top().first;       a[sz].c = st.top().second;       st.pop();       --sz;     }   }   struct monster {     int x, y, c;     bool operator<(const monster &aux) const { return x < aux.x; }   };   monster A[200005];   long long Arb[NMAX * 4 + 5], pref[NMAX * 4 + 5];   void update(int x, long long val, int st = 0, int dr = NMAX, int nod = 1) {     if (st == dr) {       Arb[nod] += val;       pref[nod] = Arb[nod];       return;     }     int mij = (st + dr) / 2;     if (x <= mij)       update(x, val, st, mij, nod * 2);     else       update(x, val, mij + 1, dr, nod * 2 + 1);     Arb[nod] = Arb[nod * 2] + Arb[nod * 2 + 1];     pref[nod] =         max(Arb[nod], max(pref[nod * 2], Arb[nod * 2] + pref[nod * 2 + 1]));   }   int n, m, p;   int main() {     scanf( %d%d%d , &n, &m, &p);     prec(n, a);     prec(m, b);     for (int i = 1; i <= m; ++i) update(b[i - 1].x, -b[i].c + b[i - 1].c);     update(b[m].x, -INF);     for (int i = 1; i <= p; ++i) scanf( %d%d%d , &A[i].x, &A[i].y, &A[i].c);     sort(A + 1, A + p + 1);     int j = 1;     long long Sol = -a[1].c - b[1].c;     for (int i = 1; i <= n; ++i) {       while (j <= p && A[j].x < a[i].x) {         update(A[j].y, A[j].c);         ++j;       }       Sol = max(Sol, pref[1] - a[i].c);     }     printf( %lld , Sol);     return 0;   }   