func_code_string: #include <bits/stdc++.h>   using namespace std;   struct ad {     int l, r, i;     bool operator<(const ad a) const {       if (l != a.l) return l < a.l;       return r > a.r;     }   };   const int INF = 1000000000;   const int MAXN = 200005;   const int SZ = 1 << 18;   int N, M, A, B;   long long res, resi, resj, C;   pair<int, int> arr[2 * SZ];   ad S[MAXN];   vector<ad> T;   set<pair<int, int> > Q, R;   void build() {     for (int i = SZ - 1; i > 0; i--) {       arr[i] = max(arr[2 * i], arr[2 * i + 1]);     }   }   inline pair<int, int> rmq(int l, int r) {     l += SZ, r += SZ + 1;     pair<int, int> res(0, 0);     for (; l < r; l /= 2, r /= 2) {       if (l & 1) res = max(res, arr[l++]);       if (r & 1) res = max(res, arr[--r]);     }     return res;   }   inline long long calc(ad &a, int A, int B) {     if (a.l > B || a.r < A) return 0;     return min(a.r, B) - max(a.l, A);   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> N >> M;     for (int i = 0; i < N; i++) {       cin >> S[i].l >> S[i].r;       S[i].i = i;     }     sort(S, S + N);     for (int i = 0; i < N; i++) {       if (i > 0 && T.back().r >= S[i].r)         continue;       else         T.push_back(S[i]);     }     for (int i = 0; i < T.size(); i++) {       arr[SZ + i] = pair<int, int>(T[i].r - T[i].l, i);       Q.insert(pair<int, int>(T[i].l, i));       R.insert(pair<int, int>(T[i].r, i));     }     build();     for (int i = 0; i < M; i++) {       cin >> A >> B >> C;       set<pair<int, int> >::iterator it, jt;       it = Q.upper_bound(pair<int, int>(A, INF));       jt = R.lower_bound(pair<int, int>(B, -INF));       if (it != Q.begin()) {         it--;         long long k = calc(T[it->second], A, B) * C;         if (k > res) {           res = k;           resi = T[it->second].i + 1;           resj = i + 1;         }       }       if (jt != R.end()) {         long long k = calc(T[jt->second], A, B) * C;         if (k > res) {           res = k;           resi = T[jt->second].i + 1;           resj = i + 1;         }       }       it = Q.lower_bound(pair<int, int>(A, -INF));       jt = R.upper_bound(pair<int, int>(B, INF));       if (it != Q.end() && jt != R.begin()) {         jt--;         if (it->second <= jt->second) {           pair<int, int> p = rmq(it->second, jt->second);           if (p.first * C > res) {             res = p.first * C;             resi = T[p.second].i + 1;             resj = i + 1;           }         }       }     }     cout << res <<   n ;     if (res > 0) {       cout << resi <<     << resj <<   n ;     }   }   