func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   void read(T &x) {     x = 0;     char c = getchar();     bool p = 0;     for (; c <  0  || c >  9 ; c = getchar())       if (c ==  - ) p = 1;     for (; c >=  0  && c <=  9 ; c = getchar())       x = (x << 3) + (x << 1) + (c ^ 48);     if (p) x = -x;   }   const int N = 1005, M = 10005;   const long long INF = 1000000000000000000;   struct node {     int id;     long long val;     node() {}     node(int _id, long long _val) {       id = _id;       val = _val;     }     bool operator<(node x) const { return val > x.val; }   };   int n, m, s, t;   long long L;   int head[N], pnt[M << 1], nxt[M << 1], E = 0;   int mark[M << 1], fm[M << 1], to[M << 1];   long long weight[M << 1];   void add_edge(int a, int b, long long c) {     pnt[E] = b;     nxt[E] = head[a];     weight[E] = c;     head[a] = E++;   }   priority_queue<node> q;   long long dist[N][2];   long long diff = 0;   void dijkstra(int s, int opt) {     for (int i = 1; i <= n; ++i) dist[i][opt] = INF;     dist[s][opt] = 0;     while (!q.empty()) q.pop();     q.push(node(s, 0));     while (!q.empty()) {       node now = q.top();       q.pop();       int u = now.id;       if (dist[u][opt] != now.val) continue;       for (int i = head[u], v; i != -1; i = nxt[i]) {         v = pnt[i];         if (opt) {           if (mark[i] && dist[u][1] + weight[i] < dist[v][0] + diff) {             weight[i] = weight[i ^ 1] = dist[v][0] + diff - dist[u][1];           }         }         if (dist[v][opt] > dist[u][opt] + weight[i]) {           dist[v][opt] = dist[u][opt] + weight[i];           q.push(node(v, dist[v][opt]));         }       }     }   }   int main() {     memset(head, -1, sizeof(head));     read(n);     read(m);     read(L);     read(s);     read(t);     ++s;     ++t;     for (int i = 1; i <= m; ++i) {       int u, v;       long long w;       read(u);       read(v);       read(w);       fm[E] = u;       fm[E + 1] = v;       to[E] = v;       to[E + 1] = u;       ++u;       ++v;       if (!w) {         mark[E] = mark[E + 1] = 1;         w = 1;       }       add_edge(u, v, w);       add_edge(v, u, w);     }     dijkstra(s, 0);     if (dist[t][0] > L) {       printf( NO n );       return 0;     }     diff = L - dist[t][0];     dijkstra(s, 1);     if (dist[t][1] != L) {       printf( NO n );       return 0;     }     printf( YES n );     for (int i = 0; i < E; i += 2) {       printf( %d %d %lld n , fm[i], to[i], weight[i]);     }     return 0;   }   