func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<pair<long long int, long long int>,               pair<long long int, long long int> > >       q;   int main() {     long long int n, x1, cur, x, y, cost, type, ans, best[200501], i;     cin >> n >> x;     for (i = 0; i < n; i++) {       cin >> x1 >> y >> cost;       q.push_back(make_pair(make_pair(x1, -1), make_pair(y, cost)));       q.push_back(make_pair(make_pair(y, 1), make_pair(x1, cost)));     }     for (i = 0; i < 200500; i++) best[i] = 2e9 + 2;     ans = 2e9 + 2;     sort(q.begin(), q.end());     for (i = 0; i < q.size(); i++) {       type = q[i].first.second;       if (type == -1) {         cur = q[i].second.first - q[i].first.first + 1;         if (cur <= x) ans = min(ans, q[i].second.second + best[x - cur]);       } else {         cur = q[i].first.first - q[i].second.first + 1;         best[cur] = min(best[cur], q[i].second.second);       }     }     long long int k = 2e9 + 2;     if (ans == k) ans = -1;     cout << ans << endl;     return 0;   }   