#include <bits/stdc++.h>   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   bool replace(std::string& str, const std::string& from, const std::string& to) {     size_t start_pos = str.find(from);     if (start_pos == std::string::npos) return false;     str.replace(start_pos, from.length(), to);     return true;   }   inline int c(string& b) {     int w = 0;     for (auto& c : b) w = w * 10 + c -  0 ;     return w;   }   struct segtree {     vector<int> t;     vector<int> a;     int o = 0, iv = -2e9, ee;     int _func(int v, int vv) { return max(v, vv); }     int func(int v1, int v2) { return _func(t[v1], t[v2]); }     void build(vector<int>& v, int y = -2e9) {       int x = 1;       iv = y;       while (x < v.size()) x <<= 1;       x *= 2;       t.resize(x);       ee = x;       o = x >> 1;       while (v.size() < o) v.push_back(y);       for (int i = 0; i < o; i++) t[i + o] = v[i];       for (int i = o - 1; i > 0; i--) t[i] = func(i * 2, i * 2 + 1);       a.resize(x);     }     void push(int v) {       if (a[v]) {         int v1 = v * 2;         int v2 = v * 2 + 1;         t[v] += a[v];         if (v1 < ee) {           if (v1 > o)             t[v1] += a[v];           else             a[v1] += a[v];         }         if (v2 < ee) {           if (v2 > o)             t[v2] += a[v];           else             a[v2] += a[v];         }         a[v] = 0;       }     }     void _add(int v, int l, int r, int vl, int vr, int w) {       if (vl > vr) return;       if (l > vr || r < vl) return;       if (vl == vr && l <= vl && vr <= r) {         t[v] += w;         return;       }       if (l <= vl && vr <= r) {         a[v] += w;         return;       }       push(v);       int m = (vl + vr) >> 1;       _add(v << 1, l, r, vl, m, w);       _add(1 + (v << 1), l, r, m + 1, vr, w);       if (vl != vr)         t[v] = _func(t[v << 1] + a[v << 1], t[v * 2 + 1] + a[v * 2 + 1]);     }     void add(int l, int r, int v) { _add(1, l, r, 0, o - 1, v); }     int q(int v, int l, int r, int vl, int vr) {       if (vl > vr) return iv;       if (l > vr || r < vl) return iv;       push(v);       if (vl != vr)         t[v] = _func(t[v * 2] + a[v * 2], t[v * 2 + 1] + a[v * 2 + 1]);       if (l <= vl && vr <= r) return a[v] + t[v];       int m = (vl + vr) / 2;       return _func(q(v * 2, l, r, vl, m), q(v * 2 + 1, l, r, m + 1, vr));     }     int query(int l, int r) { return q(1, l, r, 0, o - 1); }   };   int32_t main(int32_t argc, char** argv) {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m, p;     cin >> n >> m >> p;     vector<pair<int, int>> a(n), b(m);     vector<pair<int, pair<int, int>>> y(p);     for (auto& e : a) cin >> e.first >> e.second;     for (auto& e : b) cin >> e.first >> e.second;     for (auto& e : y) cin >> e.first >> e.second.first >> e.second.second;     sort(a.begin(), a.end());     sort(b.begin(), b.end());     sort(y.begin(), y.end());     vector<int> s(m);     for (int i = 0; i < m; i++) s[i] = -b[i].second;     int i1 = 0;     segtree t;     t.build(s, -2e9);     int r = -2e9;     for (int i = 0; i < n; i++) {       while (i1 < y.size() && y[i1].first < a[i].first) {         pair<int, int> a = {y[i1].second.first + 1, -2e9};         auto e = upper_bound(b.begin(), b.end(), a);         int mx = (e - b.begin());         if (mx < m) {           t.add(mx, m - 1, y[i1].second.second);         }         i1++;       }       r = max(r, t.query(0, m - 1) - a[i].second);     }     cout << r;   }   