Language: C++

#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;*/ //int order_of_key, it find_by_order

typedef long long ll;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> pii;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define isz(x) (int)(x).size()

/* <----------------------------------------------------------> */

const int MAX = 1e5 + 7;
const ll M = 1e9 + 7, INF = 1e16;
ll ds[MAX], dt[MAX], cs[MAX], ct[MAX];
int n, m;

vector<pair<int, ll> > g[MAX];

priority_queue<pair<ll, int> > q;

void dijkstra(int s, ll *d, ll *c)
{
    forn (i, n) d[i] = INF;
    d[s] = 0;
    c[s] = 1;
    q.push({0, s});
    while (!q.empty())
    {
        ll v = q.top().sd, cur = -q.top().ft;
        q.pop();
        if (d[v] < cur) continue;
        for (pair<int, ll> e : g[v])
        {
            if (d[e.ft] > cur + e.sd)
            {
                d[e.ft] = (cur + e.sd) % M;
                c[e.ft] = c[v];
                q.push({-d[e.ft], e.ft});
            }
            else if (d[e.ft] == cur + e.sd)
                c[e.ft] = (c[e.ft] + c[v]) % M;
        }
    }
}

void solve()
{
    int s, t;
    scanf("%d%d%d%d", &n, &m, &s, &t);
    --s; --t;
    forn (i, m)
    {
        int v, u, d;
        scanf("%d%d%d", &v, &u, &d);
        g[v - 1].pb({u - 1, (ll)d});
        g[u - 1].pb({v - 1, (ll)d});
    }

    dijkstra(s, ds, cs);
    dijkstra(t, dt, ct);

    ll ans = cs[t] * cs[t] % M;
    forn (i, n) if (ds[i] + dt[i] == ds[t] && ds[i] == dt[i])
        ans = (((ans - cs[i] * cs[i] % M * cst[i] % M * ct[i] % M) % M) + M) % M;
    forn (v, n) for (pair<int, ll> e : g[v])
        if (ds[v] + e.sd + dt[e.ft] == ds[t] && ds[v] * 2 < ds[t] && ds[t] < (ds[v] + e.sd) * 2)
            ans = (((ans - cs[v] * cs[v] % M * ct[e.ft] % M * ct[e.ft] % M) % M) + M) % M;
    printf("%lld", ans);
}

/* <----------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME ""

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    solve();

    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:94:44: error: 'cst' was not declared in this scope; did you mean 'ct'?
   94 |         ans = (((ans - cs[i] * cs[i] % M * cst[i] % M * ct[i] % M) % M) + M) % M;
      |                                            ^~~
      |                                            ct