func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   template <class C>   inline void mini(C& a4, C b4) {     a4 = min(a4, b4);   }   template <class C>   inline void maxi(C& a4, C b4) {     a4 = max(a4, b4);   }   int n, v, e;   int a[307], b[307];   vector<int> GG[307], G[307];   bool del[307], vis[307];   int xx[1000007], yy[1000007], dd[1000007], moves;   long long int go(int x) {     long long int res = a[x] - b[x];     vis[x] = true;     for (__typeof((GG[x]).begin()) i = (GG[x]).begin(); i != (GG[x]).end(); ++i)       if (!vis[*i]) {         G[x].push_back(*i);         G[*i].push_back(x);         res += go(*i);       }     return res;   }   void push(int x, int o, int lim, bool down) {     for (__typeof((G[x]).begin()) i = (G[x]).begin(); i != (G[x]).end(); ++i)       if (*i != o && !del[*i]) {         push(*i, x, INF, down);         int can = lim;         int l = x, r = *i;         if (!down) swap(l, r);         mini(can, a[l]);         mini(can, v - a[r]);         lim -= can;         if (can > 0) {           a[l] -= can;           a[r] += can;           xx[moves] = l;           yy[moves] = r;           dd[moves] = can;           moves++;         }       }   }   int main() {     std::ios_base::sync_with_stdio(0);     cout << setprecision(15) << fixed;     cin >> n >> v >> e;     for (int i = (1); i <= (n); i++) cin >> a[i];     for (int i = (1); i <= (n); i++) cin >> b[i];     while (e--) {       int x, y;       cin >> x >> y;       GG[x].push_back(y);       GG[y].push_back(x);     }     for (int i = (1); i <= (n); i++)       if (!vis[i])         if (go(i) != 0) {           cout <<  NO  << endl;           return 0;         }     bool ok;     do {       ok = false;       for (int i = (1); i <= (n); i++)         if (!del[i]) {           int deg = 0;           for (__typeof((G[i]).begin()) j = (G[i]).begin(); j != (G[i]).end();                ++j)             deg += !del[*j];           if (deg != 1) continue;           if (a[i] != b[i]) push(i, i, abs(a[i] - b[i]), a[i] > b[i]);           del[i] = true;           ok = true;           break;         }     } while (ok);     cout << moves << endl;     for (int i = 0; i < (moves); i++)       cout << xx[i] <<     << yy[i] <<     << dd[i] << endl;     return 0;   }   