Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

struct edge{
    int to; ll cost;
};

void solve() {
	int n, m; cin >> n >> m;
    int s, t; cin >> s >> t;
    --s; --t;
    vector<edge> G[100100];
    rep(i, m) {
        int u, v; ll d; cin >> u >> v >> d;
        --u; --v;
        G[u].pb(edge{v, d});
        G[v].pb(edge{u, d});
    }
    
    priority_queue<P, vector<P>, greater<P>> que;
    vector<ll> dist1(n, INF), dist2(n, INF);
    vector<ll> num1(n, 0), num2(n, 0);

    dist1[s] = 0; num1[s] = 1LL;
    que.push(0, s);
    while(!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.sc;
        if(dist1[v] < p.fr) continue;
        for(auto u: G[v]) {
            if(dist1[u.to] > dist1[v] + u.cost) {
                dist1[u.to] = dist1[v] + u.cost;
                num1[u.to] = num1[v];
                que.push(P(dist1[u.to], u.to));
            } else if(dist1[u.to] == dist1[v] + u.cost) {
                num1[u.to] += num1[v];
                num1[u.to] %= mod;
            }
        }
    }

    dist2[t] = 0; num2[t] = 0;
    que.push(0, t);
    while(!que.empty()) {
        P p = que.top(); que.pop();
        int v = p.sc;
        if(dist2[v] < p.fr) continue;
        for(auto u: G[v]) {
            if(dist2[u.to] > dist2[v] + u.cost) {
                dist2[u.to] = dist2[v] + u.cost;
                num2[u.to] = num2[v];
                que.push(P(dist[u.to], u.to));
            } else if(dist2[u.to] == dist2[v] + u.cost) {
                num2[u.to] += num2[v];
                num2[u.to] %= mod;
            }
        }
    }

    ll d = dist1[t];
    ll res = (num1[t] * num2[s]) % mod;

    //頂点x上で出会うもの
    rep(x, n) {
        if(dist1[x] + dist2[x] == d && dist1[x] == dist2[x]) {
            res -= ((num1[x] * num2[x]) % mod);
            res += mod;
        }
    }

    //辺(x, y)上で出会うもの
    rep(x, n) {
        for(auto p: G[x]) {
            int y = p.fr; ll cost = p.sc;
            if(dist1[x] + cost + dist2[y] == d) {
                res -= ((num1[x] * num2[y]) % mod);
                res += mod;
            }
        }
    }

    cout << res << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:73:13: error: no matching function for call to 'std::priority_queue<std::pair<long long int, int>, std::vector<std::pair<long long int, int> >, std::greater<std::pair<long long int, int> > >::push(int, int&)'
   73 |     que.push(0, s);
      |     ~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:10:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<std::pair<long long int, int> >; value_type = std::pair<long long int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<std::pair<long long int, int> >; value_type = std::pair<long long int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:91:13: error: no matching function for call to 'std::priority_queue<std::pair<long long int, int>, std::vector<std::pair<long long int, int> >, std::greater<std::pair<long long int, int> > >::push(int, int&)'
   91 |     que.push(0, t);
      |     ~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<std::pair<long long int, int> >; value_type = std::pair<long long int, int>]'
  736 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<std::pair<long long int, int> >; value_type = std::pair<long long int, int>]'
  744 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note:   candidate expects 1 argument, 2 provided
a.cc:100:28: error: 'dist' was not declared in this scope; did you mean 'dist2'?
  100 |                 que.push(P(dist[u.to], u.to));
      |                            ^~~~
      |                            dist2
a.cc:43:12: error: 'struct edge' has no member named 'first'
   43 | #define fr first
      |            ^~~~~
a.cc:122:23: note: in expansion of macro 'fr'
  122 |             int y = p.fr; ll cost = p.sc;
      |                       ^~
a.cc:44:12: error: 'struct edge' has no member named 'second'
   44 | #define sc second
      |            ^~~~~~
a.cc:122:39: note: in expansion of macro 'sc'
  122 |             int y = p.fr; ll cost = p.sc;
      |                                       ^~