func_code_string: #include <bits/stdc++.h>   using namespace std;   int seg[(long long int)3e5 * 3];   int laz[(long long int)3e5 * 3];   void build(int index, int a, int b, int *ar) {     if (a == b) {       seg[index] = ar[a];       return;     }     int mid = (a + b) / 2;     build(2 * index, a, mid, ar);     build(2 * index + 1, mid + 1, b, ar);     seg[index] = max(seg[2 * index], seg[2 * index + 1]);   }   void la(int l, int r, int index) {     seg[index] += laz[index];     int a = 2 * index;     int b = 2 * index + 1;     if (l < r) {       laz[a] += laz[index];       laz[b] += laz[index];     }     laz[index] = 0;   }   void upd(int val, int l, int r, int x, int y, int index) {     la(x, y, index);     if (x > r || l > y) return;     if (l <= x and r >= y) {       laz[index] += val;       la(x, y, index);       return;     }     int mid = (x + y) / 2;     upd(val, l, r, x, mid, 2 * index);     upd(val, l, r, mid + 1, y, 2 * index + 1);     seg[index] = max(seg[2 * index], seg[2 * index + 1]);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, m, p;     cin >> n >> m >> p;     vector<pair<int, int>> weap;     vector<pair<int, int>> armr;     vector<pair<int, pair<int, int>>> monst;     for (int i = 0; i < n; i++) {       int a, b;       cin >> a >> b;       weap.push_back({a, b});     }     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       armr.push_back({a, b});     }     for (int i = 0; i < p; i++) {       int a, b, c;       cin >> a >> b >> c;       monst.push_back({a, {b, c}});     }     sort(weap.begin(), weap.end());     sort(armr.begin(), armr.end());     sort(monst.begin(), monst.end());     int pt = 0;     int ar[(int)3e5];     for (int i = 0; i < m; i++) ar[i + 1] = -armr[i].second;     build(1, 1, m, ar);     int ans = -2 * (1e9 + 7);     for (int i = 0; i < n; i++) {       while (pt < p and weap[i].first > monst[pt].first) {         int l = upper_bound(armr.begin(), armr.end(),                             make_pair(monst[pt].second.first, (int)1e9 + 7)) -                 armr.begin();         l++;         if (l <= m) {           upd(monst[pt].second.second, l, m, 1, m, 1);         }         pt++;       }       ans = max(ans, (seg[1] - weap[i].second));     }     cout << ans << endl;   }   