func_code_string: #include <bits/stdc++.h>   int setBit(int N, int pos) { return N = N | (1 << pos); }   int resetBit(int N, int pos) { return N = N & ~(1 << pos); }   bool checkBit(int N, int pos) { return (bool)(N & (1 << pos)); }   using namespace std;   const int maxn = 100000;   int n, m, cost[maxn + 5], okayRoad[maxn + 5], par[maxn + 5];   vector<int> graph[maxn + 5], flag[maxn + 5];   map<pair<int, int>, int> mapp, out;   map<pair<int, int>, int>::iterator it;   void bfs() {     queue<int> q;     int i, u, v;     memset(cost, 63, sizeof(cost));     ;     cost[1] = 0;     par[1] = 1;     q.push(1);     while (!q.empty()) {       u = q.front();       q.pop();       int siz = (int)graph[u].size();       for (i = 0; i < siz; i++) {         v = graph[u][i];         if (cost[u] + 1 < cost[v]) {           cost[v] = cost[u] + 1;           okayRoad[v] = okayRoad[u] + flag[u][i];           par[v] = u;           q.push(v);         } else if (cost[u] + 1 == cost[v] &&                    okayRoad[u] + flag[u][i] > okayRoad[v]) {           okayRoad[v] = okayRoad[u] + flag[u][i];           par[v] = u;           q.push(v);         }       }     }   }   void giveOutput() {     int u, v = n;     vector<int> path;     path.push_back(n);     while (v != par[v]) {       v = par[v];       path.push_back(v);     }     int i, j, siz = (int)path.size();     for (i = 1; i < siz; i++) {       u = path[i - 1];       v = path[i];       if (u > v) swap(u, v);       if (mapp[pair<int, int>(u, v)] == 0) out[pair<int, int>(u, v)] = 1;       mapp[pair<int, int>(u, v)] = -1;     }     for (__typeof((mapp).begin()) it = (mapp).begin(); it != (mapp).end(); it++) {       if (it->second == 1) out[it->first] = 0;     }     printf( %d n , (int)out.size());     for (__typeof((out).begin()) it = (out).begin(); it != (out).end(); it++) {       cout << it->first.first <<     << it->first.second <<     << it->second            <<   n ;     }   }   int main() {     int i, u, v, w;     scanf( %d %d , &n, &m);     for (i = 0; i < m; i++) {       scanf( %d %d %d , &u, &v, &w);       if (u > v) swap(u, v);       graph[u].push_back(v);       graph[v].push_back(u);       flag[u].push_back(w);       flag[v].push_back(w);       mapp[pair<int, int>(u, v)] = w;     }     bfs();     giveOutput();     return 0;   }   