func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   inline void smin(T &a, const U &b) {     if (a > b) a = b;   }   template <typename T, typename U>   inline void smax(T &a, const U &b) {     if (a < b) a = b;   }   int a[2020];   struct Dinic {     int V, E, src, tar;     int head[2020], work[2020], dis[2020];     int to[8080], nxt[8080];     long long cap[8080];     int q[2020], qf, qb;     void init(int n, int s, int t) {       V = n + 1;       E = 0;       src = s;       tar = t;       for (int i = 0; i <= V; i++) head[i] = -1;     }     void add(int u, int v, long long c) {       to[E] = v;       cap[E] = c;       nxt[E] = head[u];       head[u] = E++;       to[E] = u;       cap[E] = 0;       nxt[E] = head[v];       head[v] = E++;     }     bool bfs() {       for (int i = 0; i <= V; i++) dis[i] = -1;       qf = qb = 0;       q[qb++] = src;       dis[src] = 0;       while (qf < qb && dis[tar] == -1) {         int u = q[qf++];         for (int i = head[u]; i >= 0; i = nxt[i]) {           int v = to[i];           if (dis[v] == -1 && cap[i] > 0) {             dis[v] = dis[u] + 1;             q[qb++] = v;           }         }       }       return dis[tar] >= 0;     }     long long dfs(int u, long long &bot) {       int v;       long long bot1, delta;       if (u == tar) return bot;       for (int &i = work[u]; i >= 0; i = nxt[i]) {         int v = to[i];         if (dis[v] != dis[u] + 1 || cap[i] == 0) continue;         bot1 = min(bot, cap[i]);         if (delta = dfs(v, bot1)) {           cap[i] -= delta;           cap[i ^ 1] += delta;           bot = bot1;           return delta;         }       }       return 0;     }     long long dinic() {       long long ans = 0, delta, bot;       while (bfs()) {         memcpy(work, head, sizeof(int) * V);         delta = 0x3f3f3f3f3f3f3f3fLL;         while (delta = dfs(src, bot = 0x3f3f3f3f3f3f3f3fLL)) ans += delta;       }       return ans;     }   } dinic;   int main() {     int n, m;     scanf( %d %d , &n, &m);     int src = n + m + 1, tar = src + 1;     dinic.init(tar, src, tar);     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       dinic.add(src, i, a[i]);     }     long long ans = 0;     for (int i = n + 1, u, v, w; i <= n + m; i++) {       scanf( %d %d %d , &u, &v, &w);       dinic.add(u, i, 0x3f3f3f3f3f3f3f3fLL);       dinic.add(v, i, 0x3f3f3f3f3f3f3f3fLL);       dinic.add(i, tar, w);       ans += w;     }     printf( %I64d n , ans - dinic.dinic());   }   