func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   long long max(long long a, long long b) { return a > b ? a : b; }   struct SegmentTree {    public:     SegmentTree() {       null_value = -INF;       null_modifier = 0;     }     void insert_data(vector<long long> values) {       size = 1;       while (size < values.size()) {         size *= 2;       }       modifier_tree.assign(size * 2 - 1, null_modifier);       tree.assign(size * 2 - 1, null_value);       for (int i = 0; i < values.size(); i++) {         tree[size + i - 1] = values[i];       }       for (int i = size - 2; i >= 0; i--) {         tree[i] = merge(tree[l_child(i)], tree[r_child(i)]);       }     }     void modify_segment(int begin, int end, long long modifier) {       modify_segment(begin, end, modifier, 0, 0, size);     }     long long get_segment(int begin, int end) {       return get_segment(begin, end, 0, 0, size);     }       protected:     vector<long long> tree;     vector<long long> modifier_tree;     int size;     long long null_value;     long long null_modifier;     long long merge(long long segment_1, long long segment_2) {       if (segment_1 != null_value && segment_2 != null_value) {         return max(segment_1, segment_2);       } else if (segment_1 != null_value) {         return segment_1;       } else {         return segment_2;       }     }     long long modify(long long segment, long long modifier) {       if (modifier != null_modifier) {         return segment + modifier;       } else {         return segment;       }     }     long long combine(long long new_modifier, long long old_modifier) {       if (new_modifier != null_modifier && old_modifier != null_modifier) {         return new_modifier + old_modifier;       } else if (new_modifier != null_modifier) {         return new_modifier;       } else {         return old_modifier;       }     }     void add_modifier(int inode, long long modifier) {       if (modifier != null_modifier) {         modifier_tree[inode] = combine(modifier, modifier_tree[inode]);         tree[inode] = modify(tree[inode], modifier);       }     }     int l_child(int inode) { return inode * 2 + 1; }     int r_child(int inode) { return inode * 2 + 2; }     void push(int inode) {       if (modifier_tree[inode] != null_modifier) {         add_modifier(l_child(inode), modifier_tree[inode]);         add_modifier(r_child(inode), modifier_tree[inode]);         modifier_tree[inode] = null_modifier;       }     }     void modify_segment(int begin, int end, long long modifier, int inode,                         int lnode, int rnode) {       if (lnode < rnode) {         if (lnode >= begin && rnode <= end) {           add_modifier(inode, modifier);         } else if (lnode >= end || rnode <= begin) {           return;         } else {           push(inode);           int mnode = (lnode + rnode) / 2;           modify_segment(begin, end, modifier, l_child(inode), lnode, mnode);           modify_segment(begin, end, modifier, r_child(inode), mnode, rnode);           tree[inode] = merge(tree[l_child(inode)], tree[r_child(inode)]);         }       }     }     long long get_segment(int begin, int end, int inode, int lnode, int rnode) {       if (lnode >= begin && rnode <= end) {         return tree[inode];       } else if (lnode >= end || rnode <= begin) {         return null_value;       } else {         push(inode);         int mnode = (lnode + rnode) / 2;         long long l_segment =             get_segment(begin, end, l_child(inode), lnode, mnode);         long long r_segment =             get_segment(begin, end, r_child(inode), mnode, rnode);         return merge(l_segment, r_segment);       }     }   };   signed main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr);     int n, m, p;     cin >> n >> m >> p;     vector<pair<long long, long long>> atk(n), def(m);     vector<pair<long long, pair<long long, long long>>> mon(p);     for (int i = 0; i < n; i++) {       cin >> atk[i].first >> atk[i].second;     }     for (int i = 0; i < m; i++) {       cin >> def[i].first >> def[i].second;     }     for (int i = 0; i < p; i++) {       cin >> mon[i].first >> mon[i].second.first >> mon[i].second.second;     }     sort(atk.begin(), atk.end());     sort(def.begin(), def.end());     sort(mon.begin(), mon.end());     vector<long long> b(m), cb(m);     for (int i = 0; i < m; i++) {       b[i] = def[i].first;       cb[i] = -def[i].second;     }     SegmentTree tree;     tree.insert_data(cb);     int imon = 0;     long long ans = -INF;     for (int i = 0; i < n; i++) {       while (imon < p && mon[imon].first < atk[i].first) {         int rb =             upper_bound(b.begin(), b.end(), mon[imon].second.first) - b.begin();         tree.modify_segment(rb, m, mon[imon].second.second);         imon++;       }       ans = max(ans, tree.get_segment(0, m) - atk[i].second);     }     cout << ans;     return 0;   }   