func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int l[200000], r[200000];   int a[200000], b[200000], c[200000];   int d[800000], p[800000];   set<int> se;   map<int, int> ma;   int rev[800000];   int mac = 0;   long long ans = 0;   int ansi, ansj;   pair<int, int> fen[800000];   void fenUpdate(int pos, pair<int, int> val) {     for (; pos < mac; pos |= pos + 1) fen[pos] = max(fen[pos], val);   }   pair<int, int> fenGet(int pos) {     pair<int, int> ret = make_pair(-1, -1);     for (; pos >= 0; pos = (pos & (pos + 1)) - 1) ret = max(ret, fen[pos]);     return ret;   }   struct Ev {     int x;     bool i;     int ind;     Ev(int x, bool i, int ind) : x(x), i(i), ind(ind) {}     Ev() {}   };   Ev e[400000];   int ec = 0;   bool cmp(const Ev &lhs, const Ev &rhs) {     if (lhs.x != rhs.x) return lhs.x < rhs.x;     return lhs.i < rhs.i;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < (int)(n); ++i) scanf( %d%d , l + i, r + i);     for (int i = 0; i < (int)(m); ++i) scanf( %d%d%d , a + i, b + i, c + i);     for (int i = 0; i < (int)(n); ++i) se.insert(l[i]), se.insert(r[i]);     for (int i = 0; i < (int)(m); ++i) se.insert(a[i]), se.insert(b[i]);     for (int x : se) ma[x] = mac, rev[mac++] = x;     for (int i = 0; i < (int)(n); ++i) l[i] = ma[l[i]], r[i] = ma[r[i]];     for (int i = 0; i < (int)(m); ++i) a[i] = ma[a[i]], b[i] = ma[b[i]];     for (int i = 0; i < (int)(mac); ++i) d[i] = -1;     for (int i = 0; i < (int)(n); ++i)       if (r[i] > d[l[i]]) {         d[l[i]] = r[i];         p[l[i]] = i;       }     for (int i = 1; i < mac; ++i)       if (d[i - 1] > d[i]) {         d[i] = d[i - 1];         p[i] = p[i - 1];       }     for (int i = 0; i < (int)(m); ++i)       if (d[a[i]] > a[i]) {         int r = min(b[i], d[a[i]]);         long long cur = (rev[r] - rev[a[i]]) * (long long)c[i];         if (cur > ans) {           ans = cur;           ansi = p[a[i]];           ansj = i;         }       }     for (int i = 0; i < (int)(mac); ++i) d[i] = mac;     for (int i = 0; i < (int)(n); ++i)       if (l[i] < d[r[i]]) {         d[r[i]] = l[i];         p[r[i]] = i;       }     for (int i = mac - 2; i >= 0; --i)       if (d[i + 1] < d[i]) {         d[i] = d[i + 1];         p[i] = p[i + 1];       }     for (int i = 0; i < (int)(m); ++i)       if (d[b[i]] < b[i]) {         int l = max(a[i], d[b[i]]);         long long cur = (rev[b[i]] - rev[l]) * (long long)c[i];         if (cur > ans) {           ans = cur;           ansi = p[b[i]];           ansj = i;         }       }     for (int i = 0; i < (int)(mac); ++i) fen[i] = make_pair(-1, -1);     for (int i = 0; i < (int)(n); ++i) e[ec++] = Ev(l[i], true, i);     for (int i = 0; i < (int)(m); ++i) e[ec++] = Ev(a[i], false, i);     sort(e, e + ec, cmp);     for (Ev ev : e) {       if (ev.i) {         pair<int, int> ret = fenGet(mac - 1 - r[ev.ind]);         if (ret.first != -1) {           long long cur =               (long long)ret.first * (rev[r[ev.ind]] - rev[l[ev.ind]]);           if (cur > ans) {             ans = cur;             ansi = ev.ind;             ansj = ret.second;           }         }       } else {         fenUpdate(mac - 1 - b[ev.ind], make_pair(c[ev.ind], ev.ind));       }     }     cout << ans << endl;     if (ans != 0) cout << ansi + 1 <<     << ansj + 1 << endl;     return 0;   }   