func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T1, class T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  {  << p.first <<  ,  << p.second <<  } ;     return os;   }   const int N = 3e5 + 5;   const int oo = 1e9 + 7;   vector<pair<int, pair<int, int> > > g[N];   int f[N];   int ans[N];   int x[N];   int y[N];   bool vis[N];   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 1; i <= m; i++) {       int w;       cin >> x[i] >> y[i] >> w;       g[x[i]].push_back({i, {y[i], w}});       g[y[i]].push_back({i, {x[i], w}});     }     for (int i = 2; i <= n - 1; i++) {       for (auto p : g[i]) {         f[i] += p.second.second;       }       assert(f[i] % 2 == 0);       f[i] /= 2;     }     queue<int> q;     q.push(1);     vis[1] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       for (auto p : g[u]) {         int i = p.first;         int v = p.second.first;         int w = p.second.second;         if (vis[v]) continue;         if (x[i] == u)           ans[i] = 0;         else           ans[i] = 1;         if (v == n) continue;         f[v] -= w;         if (f[v] == 0) {           vis[v] = 1;           q.push(v);         }       }     }     for (int i = 1; i <= m; i++) cout << ans[i] <<   n ;   }   