Language: C++

//! Lets Get it
#include<bits/stdc++.h>
using namespace std;

typedef double                      ld;
typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define endl                        '\n'
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define kill(x)                     return cout << x << endl , 0;
#define pb                          push_back

const ll MXN = 3e3 + 10;
const ll MXM = (1LL << 18) + 10;
const ll MX5 = 1e5 + 10;
const ll MX6 = 1e6 + 10;
const ll LOG = 20;
const ll INF = 8e18;
const ld eps = 1e-9;
const ll MOD = 1e9 + 7; //998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}
string base2(ll n){
    string a="";while(n>=2){a+=(char)(n%2+'0');n/=2;}a+=(char)(n+'0');reverse(all(a));return a;
}

ll n, m, s, t;
ll dis[2][MX5], par[2][MX5];
vector<pll> G[MX5];
vector<pair<pll, ll>> E;
priority_queue<pll, vector<pll>, greater<pll>> pq;
bool vis[MX5];


inline void Dijkstra(ll Start, ll ind){
    fill(dis[ind], dis[ind] + MX5, INF);
    fill(vis, vis + MX5, 0);

    dis[ind][Start] = 0;
    pq.push({0, Start});

    while(!pq.empty()){
        ll u = pq.top().S, cost = pq.top().F;
        pq.pop();
        if(vis[u]) continue;
        vis[u] = 1;
        for(auto Pr : G[u]){
            ll v = Pr.F, w = Pr.S;
            if(!vis[v] && cost + w < dis[ind][v]){
                dis[ind][v] = cost + w;
                pq.push({dis[ind][v], v});
                par[ind][v] = u;
            }
        }
    }

    return;
}

int main(){
    //fast_io
    //file_io
    cin >> n >> m >> s >> t;
    for(int i = 0; i < m; i ++){
        ll u, v, w;
        cin >> u >> v >> w;
        G[u].pb({v, w});
        G[v].pb({u, w});
        E.pb({{u, v}, w});
    }

    Dijkstra(s, 0);
    Dijkstra(t, 1);

    for(int i = 0; i < m; i ++){
        ll u = E[i].F.F, v = E[i].F.S, w = E[i].S;
        if(dis[0][v] < dis[0][u]) swap(u, v);

        if(dis[0][u] + w + dis[1][v] > dis[0][t]){
            ll ans = dis[0][t] - 1 - dis[0][u] - dis[1][v];
            if(ans < 1){
                cout << "NO" << endl;
            }
            else{
                cout << "CAN " << w - ans << endl;
            }
        }
        else{
            if(check(i)){
                cout << "YES" << endl;
            }
            else{
                ll ans = dis[0][t] - 1 - dis[0][u] - dis[1][v];
                if(ans < 1){
                    cout << "NO" << endl;
                }
                else{
                    cout << "CAN " << w - ans << endl;
                }
            }
        }
    }

    return 0;
}
//! N.N


Compiler output:
a.cc: In function 'int main()':
a.cc:103:16: error: 'check' was not declared in this scope
  103 |             if(check(i)){
      |                ^~~~~