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;
using Graph = vector<vector<int> >;
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;
    Graph G(n);
    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:65:16: error: no matching function for call to 'std::vector<int>::push_back(edge)'
   65 |         G[u].pb(edge{v, d});
      |         ~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'edge' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'edge' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:66:16: error: no matching function for call to 'std::vector<int>::push_back(edge)'
   66 |         G[v].pb(edge{u, d});
      |         ~~~~~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'edge' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'edge' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:74: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&)'
   74 |     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:80:24: error: request for member 'to' in 'u', which is of non-class type 'int'
   80 |             if(dist1[u.to] > dist1[v] + u.cost) {
      |                        ^~
a.cc:80:43: error: request for member 'cost' in 'u', which is of non-class type 'int'
   80 |             if(dist1[u.to] > dist1[v] + u.cost) {
      |                                           ^~~~
a.cc:81:25: error: request for member 'to' in 'u', which is of non-class type 'int'
   81 |                 dist1[u.to] = dist1[v] + u.cost;
      |                         ^~
a.cc:81:44: error: request for member 'cost' in 'u', which is of non-class type 'int'
   81 |                 dist1[u.to] = dist1[v] + u.cost;
      |                                            ^~~~
a.cc:82:24: error: request for member 'to' in 'u', which is of non-class type 'int'
   82 |                 num1[u.to] = num1[v];
      |                        ^~
a.cc:83:36: error: request for member 'to' in 'u', which is of non-class type 'int'
   83 |                 que.push(P(dist1[u.to], u.to));
      |                                    ^~
a.cc:83:43: error: request for member 'to' in 'u', which is of non-class type 'int'
   83 |                 que.push(P(dist1[u.to], u.to));
      |                                           ^~
a.cc:84:31: error: request for member 'to' in 'u', which is of non-class type 'int'
   84 |             } else if(dist1[u.to] == dist1[v] + u.cost) {
      |                               ^~
a.cc:84:51: error: request for member 'cost' in 'u', which is of non-class type 'int'
   84 |             } else if(dist1[u.to] == dist1[v] + u.cost) {
      |                                                   ^~~~
a.cc:85:24: error: request for member 'to' in 'u', which is of non-class type 'int'
   85 |                 num1[u.to] += num1[v];
      |                        ^~
a.cc:86:24: error: request for member 'to' in 'u', which is of non-class type 'int'
   86 |                 num1[u.to] %= mod;
      |                        ^~
a.cc:92: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&)'
   92 |     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:98:24: error: request for member 'to' in 'u', which is of non-class type 'int'
   98 |             if(dist2[u.to] > dist2[v] + u.cost) {
      |                        ^~
a.cc:98:43: error: request for member 'cost' in 'u', which is of non-class type 'int'
   98 |             if(dist2[u.to] > dist2[v] + u.cost) {
      |                                           ^~~~
a.cc:99:25: error: request for member 'to' in 'u', which is of non-class type 'int'
   99 |                 dist2[u.to] = dist2[v] + u.cost;
      |                         ^~
a.cc:99:44: error: request for member 'cost' in 'u', which is of non-class type 'int'
   99 |                 dist2[u.to] = dist2[v] + u.cost;
      |                                            ^~~~
a.cc:100:24: error: request for member 'to' in 'u', which is of non-class type 'int'
  100 |                 num2[u.to] = num2[v];
      |                        ^~
a.cc:101:28: error: 'dist' was not declared in this scope; did you mean 'dist2'?
  101 |                 que.push(P(dist[u.to], u.to));
      |                            ^~~~
      |                            dist2
a.cc:101:35: error: request for member 'to' in 'u', which is of non-class type 'int'
  101 |                 que.push(P(dist[u.to], u.to));
      |                                   ^~
a.cc:101:42: error: request for member 'to' in 'u', which is of non-class type 'int'
  101 |                 que.push(P(dist[u.to], u.to));
      |                                          ^~
a.cc:102:31: error: request for member 'to' in 'u', which is of non-class type 'int'
  102 |             } else if(dist2[u.to] == dist2[v] + u.cost) {
      |                               ^~
a.cc:102:51: error: request for member 'cost' in 'u', which is of non-class type 'int'
  102 |             } else if(dist2[u.to] == dist2[v] + u.cost) {
      |                                                   ^~~~
a.cc:103:24: error: request for member 'to' in 'u', which is of non-class type 'int'
  103 |                 num2[u.to] += num2[v];
      |                        ^~
a.cc:104:24: error: request for member 'to' in 'u', which is of non-class type 'int'
  104 |                 num2[u.to] %= mod;
      |                        ^~
a.cc:43:12: error: request for member 'first' in 'p', which is of non-class type 'int'
   43 | #define fr first
      |            ^~~~~
a.cc:123:23: note: in expansion of macro 'fr'
  123 |             int y = p.fr; ll cost = p.sc;
      |                       ^~
a.cc:44:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   44 | #define sc second
      |            ^~~~~~
a.cc:123:39: note: in expansion of macro 'sc'
  123 |             int y = p.fr; ll cost = p.sc;
      |                                       ^~