func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAX = 1e6 + 1;   void solve() {     long long n, m;     cin >> n >> m;     if (m == 0) {       cout << 0;       return;     }     long long total[n + 1];     memset(total, 0, sizeof(total));     long long ai, bi, ci;     for (long long i = 0; i < m; i++) {       cin >> ai >> bi >> ci;       total[ai] -= ci;       total[bi] += ci;     }     long long ans = 0;     for (long long i = 0; i < n + 1; i++) {       if (total[i] > 0) {         ans += total[i];       }     }     cout << ans;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     t = 1;     while (t--) {       solve();     }   }   