func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000001;   const long long LINF = 1000000000000000001LL;   struct ConvexHullTrick {     struct line {       int a;       long long b;       long long eval(int x) { return (long long)a * x + b; }     };     bool incrSlope, incrQueries, queryMax;     ConvexHullTrick(bool incrSlope, bool incrQueries, bool queryMax)         : incrSlope(incrSlope), incrQueries(incrQueries), queryMax(queryMax) {       assert(incrSlope xor incrQueries xor queryMax);     }     deque<line> lines;     long long overtakes(const line &p, const line &q) {       long long x = p.b - q.b;       int y = p.a - q.a;       return (x >= 0 ? x : x - y + 1) / y;     }     bool redundantTop(const line &l) {       int s = lines.size();       if (l.a == lines[s - 1].a) {         return true;       } else {         return overtakes(l, lines[s - 1]) >=                overtakes(lines[s - 1], lines[s - 2]);       }     }     void add(int a, long long b) {       if (!(incrSlope xor incrQueries xor queryMax)) a *= -1;       if (queryMax) b *= -1;       if (!lines.empty() && a == lines.back().a && b >= lines.back().b) {         return;       }       line l = {a, b};       while (lines.size() >= 2 && redundantTop(l)) {         lines.pop_back();       }       lines.push_back(l);     }     long long query(int x) {       if (!(incrSlope xor incrQueries)) x *= -1;       while (lines.size() >= 2 && lines[0].eval(x) > lines[1].eval(x)) {         lines.pop_front();       }       return lines.front().eval(x) * (queryMax ? -1 : 1);     }   };   int main() {     ios_base::sync_with_stdio(false);     ConvexHullTrick hull(false, false, true);     auto add = [&](long long dpValue, int x) { hull.add(-x, dpValue); };     int n;     cin >> n;     struct rect {       int x, y;       long long a;     };     vector<rect> rects(n);     for (auto &e : rects) {       cin >> e.x >> e.y >> e.a;     }     sort(rects.begin(), rects.end(),          [&](const rect &a, const rect &b) { return a.x < b.x; });     vector<long long> dp(n + 1, 0);     add(0, 0);     for (int i = (1); i <= (n); i++) {       auto r = rects[i - 1];       dp[i] = (long long)r.x * r.y - r.a + hull.query(r.y);       add(dp[i], r.x);     }     long long ans = *max_element(dp.begin(), dp.end());     cout << ans;     return 0;   }   