func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long f = 1, x = 0;     char s = getchar();     while (s <  0  || s >  9 ) {       if (s ==  - ) f = -1;       s = getchar();     }     while (s >=  0  && s <=  9 ) {       x = x * 10 + (s -  0 );       s = getchar();     }     return x * f;   }   const int jzm = 1000000007;   const int zxy = 998244353;   int n, m, i, j, s, o, k;   int U[100005], V[100005], W[100005];   struct it {     int v, w;     it() { v = w = 0; }     it(int V, int W) {       v = V;       w = W;     }   };   vector<it> g[100005];   vector<it> g2[100005];   bool v[100005];   long long dp1[100005] = {(long long)1e18}, dp2[100005] = {(long long)1e18};   long long f1[100005][2], f2[100005][2];   int tre1[100005 << 2], tre2[100005 << 2], M;   int bing1(int a, int b) { return dp1[a] < dp1[b] ? a : b; }   int bing2(int a, int b) { return dp2[a] < dp2[b] ? a : b; }   void maketree(int n) {     M = 1;     while (M < n + 2) M <<= 1;   }   void addt1(int x, int y) {     int s = M + x;     tre1[s] = y;     s >>= 1;     while (s) {       tre1[s] = bing1(tre1[s << 1], tre1[s << 1 | 1]);       s >>= 1;     }   }   void addt2(int x, int y) {     int s = M + x;     tre2[s] = y;     s >>= 1;     while (s) {       tre2[s] = bing2(tre2[s << 1], tre2[s << 1 | 1]);       s >>= 1;     }   }   int findall1() { return tre1[1]; }   int findall2() { return tre2[1]; }   bool cmp(long long *a, long long *b) { return a[0] == b[0] && a[1] == b[1]; }   int main() {     n = read();     m = read();     int S = read(), T = read();     for (int i = 1; i <= m; i++) {       s = read();       o = read();       k = read();       g[s].push_back(it(o, k));       g2[o].push_back(it(s, k));       U[i] = s;       V[i] = o;       W[i] = k;     }     maketree(n);     for (int i = 1; i <= n; i++) dp1[i] = dp2[i] = 1e18;     dp1[S] = 0;     f1[S][0] = f1[S][1] = 1;     addt1(S, S);     dp2[T] = 0;     f2[T][0] = f2[T][1] = 1;     addt2(T, T);     for (int i = 1; i < n; i++) {       int t = findall1();       if (t == 0) break;       for (int j = 0; j < g[t].size(); j++) {         int y = g[t][j].v, w = g[t][j].w;         if (dp1[t] + w < dp1[y]) {           dp1[y] = dp1[t] + w;           f1[y][0] = f1[t][0];           f1[y][1] = f1[t][1];           addt1(y, y);         } else if (dp1[t] + w == dp1[y]) {           (f1[y][0] += f1[t][0]) %= jzm;           (f1[y][1] += f1[t][1]) %= zxy;         }       }       addt1(t, 0);     }     for (int i = 1; i < n; i++) {       int t = findall2();       if (t == 0) break;       for (int j = 0; j < g2[t].size(); j++) {         int y = g2[t][j].v, w = g2[t][j].w;         if (dp2[t] + w < dp2[y]) {           dp2[y] = dp2[t] + w;           f2[y][0] = f2[t][0];           f2[y][1] = f2[t][1];           addt2(y, y);         } else if (dp2[t] + w == dp2[y]) {           (f2[y][0] += f2[t][0]) %= jzm;           (f2[y][1] += f2[t][1]) %= zxy;         }       }       addt2(t, 0);     }     long long F[2] = {f1[T][0], f1[T][1]}, le = dp1[T];     for (int i = 1; i <= m; i++) {       s = U[i];       o = V[i];       k = W[i];       long long F2[2] = {f1[s][0] * 1ll * f2[o][0] % jzm,                          f1[s][1] * 1ll * f2[o][1] % zxy};       if (dp1[s] + (long long)k + dp2[o] > le || !cmp(F, F2)) {         if (le - 1 - dp1[s] - dp2[o] <= 0)           printf( NO n );         else           printf( CAN %d n , k - (le - 1 - dp1[s] - dp2[o]));       } else         printf( YES n );     }     return 0;   }   