func_code_string: #include <bits/stdc++.h>   using namespace std;   struct nodo {     int v, c, i, d;     nodo() {}     nodo(int V, int C, int I, int D) { v = V, c = C, i = I, d = D; }   };   int ans[200055], I[200055];   int n, m;   void solve(vector<vector<nodo> > v) {     int d[m + 5];     memset(d, -1, sizeof(d));     queue<int> Q;     Q.push(0);     while (!Q.empty()) {       int u = Q.front();       Q.pop();       for (int i = 0; i < v[u].size(); i++) {         int id = v[u][i].i;         if (d[id] == -1) {           d[id] = v[u][i].d;           int go = v[u][i].v;           I[go] -= v[u][i].c;           if (go != n - 1 && I[go] == 0) {             Q.push(go);           }         }       }     }     for (int i = 0; i < m; i++) ans[i] = d[i];   }   int main() {     scanf( %d%d , &n, &m);     vector<vector<nodo> > v(n + 5);     int a, b, c;     for (int i = 0; i < m; i++) {       scanf( %d%d%d , &a, &b, &c);       a--;       b--;       v[a].push_back(nodo(b, c, i, 0));       v[b].push_back(nodo(a, c, i, 1));       I[a] += c;       I[b] += c;     }     for (int i = 0; i < n; i++) I[i] /= 2;     solve(v);     for (int i = 0; i < m; i++) printf( %d n , ans[i]);   }   