func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 987654321;   const long long int INF = 123456789987654321;   FILE *fin, *fout;   int V, edge_cnt, source, sink;   vector<int> last_edge, nxt_edge, oppo, capa;   void init() {     edge_cnt = 0, last_edge.clear(), nxt_edge.clear(), oppo.clear(), capa.clear(),     last_edge = vector<int>(V, -1);   }   void add(int u, int v, int capa_) {     nxt_edge.push_back(last_edge[u]), last_edge[u] = edge_cnt, oppo.push_back(v),                                       capa.push_back(capa_), edge_cnt++;   }   vector<int> dist;   bool bfs() {     dist.clear(), dist = vector<int>(V, -1);     queue<int> q;     q.push(source), dist[source] = 0;     while (!q.empty()) {       int now = q.front();       q.pop();       for (int i = last_edge[now]; i != -1; i = nxt_edge[i]) {         int nxt = oppo[i];         if (capa[i] && dist[nxt] == -1) {           dist[nxt] = dist[now] + 1;           q.push(nxt);         }       }     }     if (dist[sink] == -1)       return false;     else       return true;   }   vector<int> last_edge2;   int dfs(int now, int flow) {     if (now == sink) return flow;     for (int i = last_edge2[now]; i != -1; i = nxt_edge[i]) {       last_edge2[now] = i;       int nxt = oppo[i];       if (capa[i] && dist[nxt] == dist[now] + 1) {         if (int tmp = dfs(nxt, min(flow, capa[i]))) {           capa[i] -= tmp;           capa[i ^ 1] += tmp;           return tmp;         }       }     }     return 0;   }   int dinic() {     int total_flow = 0;     while (bfs()) {       last_edge2 = last_edge;       while (int tmp = dfs(source, inf)) total_flow += tmp;     }     return total_flow;   }   int N, M;   struct Func {     int a, b, c;   };   vector<Func> F;   vector<pair<int, int> > interval;   struct Restr {     int u, v, d;   };   vector<Restr> restr;   int f(int idx, int x) { return F[idx].a * x * x + F[idx].b * x + F[idx].c; }   const int too_big = 10000000;   void get_network() {     V = 220 * N + 2, source = V - 2, sink = V - 1;     init();     for (int i = 0; i < N; i++) {       int l = interval[i].first, r = interval[i].second;       add(source, 220 * i + (l - 1 + 110), inf);       add(220 * i + (l - 1 + 110), source, 0);       for (int j = 0; j < 219; j++) {         add(220 * i + j, 220 * i + j + 1, too_big - f(i, j + 1 - 110));         add(220 * i + j + 1, 220 * i + j, 0);       }       add(220 * i + (r + 110), sink, inf);       add(sink, 220 * i + (r + 110), 0);     }     for (int i = 0; i < M; i++) {       int u = restr[i].u, v = restr[i].v;       for (int j = 0; j < 220; j++) {         if (j - restr[i].d >= 0 && j - restr[i].d < 220) {           add(220 * u + j, 220 * v + j - restr[i].d, inf);           add(220 * v + j - restr[i].d, 220 * u + j, 0);         }       }     }     printf( %d , too_big * N - dinic());   }   int main() {     scanf( %d %d , &N, &M);     F.resize(N);     for (int i = 0; i < N; i++) {       int a, b, c;       scanf( %d %d %d , &a, &b, &c);       F[i] = {a, b, c};     }     interval.resize(N);     for (int i = 0; i < N; i++) {       scanf( %d %d , &interval[i].first, &interval[i].second);     }     restr.resize(M);     for (int i = 0; i < M; i++) {       int u, v, d;       scanf( %d %d %d , &u, &v, &d);       restr[i] = {--u, --v, d};     }     get_network();   }   