Language: C++

#include <bits/stdc++.h>

#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define FF first
#define SS second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define sz(a) (int)a.size()

#define oo 1000000007LL
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 200007

pair <ll, ll> D[maxN];
vii adj[maxN];

int n, m, s, t;

void dijkstra() {
    fto (i, 1, n) {
        D[i].FF = LLONG_MAX;
        D[i].SS = 0LL;
    }

    D[s].FF = 0LL;
    D[s].SS = 1LL;

    set <pair <ll, int> > st;
    st.insert(mp(D[s].FF, s));

    while (!st.empty()) {
        int u = (*st.begin()).SS;
        st.erase(st.begin());

        fto (i, 0, (int)adj[u].size()-1) {
            int v = adj[u][i].FF;
            int w = adj[u][i].SS;

            if (D[v].FF > D[u].FF+(ll)w) {
                st.erase(mp(D[v].FF, v));
                D[v].FF = D[u].FF+(ll)w;
                st.insert(mp(D[v].FF, v));
                D[v].SS = D[u].SS;
            }
            else if (D[v].FF == D[u].FF+(ll)w) D[v].SS = (ll)((D[v].SS+D[u].SS)%oo);
        }
    }

    return;
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen(Pro".inp", "r", stdin);
        freopen(Pro".out", "w", stdout);
    #endif // ONLINE_JUDGE

    scanf("%d%d", &n, &m);
    scanf("%d%d", &s, &t);

    fto (i, 1, m) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        adj[u].eb(v, w);
        adj[v].eb(u, w);
    }

    dijkstra();
    cout << ((ll)(D[t].SS%oo)*((D[t].SS-1LL+oo)%oo))%oo << endl;

    return 0;
}
#include <bits/stdc++.h>

#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)

#define ii pair<int, int>
#define mp make_pair
#define FF first
#define SS second

#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define vll vector<ll>

#define eb emplace_back
#define ef emplace_front
#define lb lower_bound
#define sz(a) (int)a.size()

#define oo 1000000007LL
#define OO 1000000000000000007LL

using namespace std;

#define Pro "tmp"
#define maxN 200007

pair <ll, ll> D[maxN];
vii adj[maxN];

int n, m, s, t;

void dijkstra() {
    fto (i, 1, n) {
        D[i].FF = LLONG_MAX;
        D[i].SS = 0LL;
    }

    D[s].FF = 0LL;
    D[s].SS = 1LL;

    set <pair <ll, int> > st;
    st.insert(mp(D[s].FF, s));

    while (!st.empty()) {
        int u = (*st.begin()).SS;
        st.erase(st.begin());

        fto (i, 0, (int)adj[u].size()-1) {
            int v = adj[u][i].FF;
            int w = adj[u][i].SS;

            if (D[v].FF > D[u].FF+(ll)w) {
                st.erase(mp(D[v].FF, v));
                D[v].FF = D[u].FF+(ll)w;
                st.insert(mp(D[v].FF, v));
                D[v].SS = D[u].SS;
            }
            else if (D[v].FF == D[u].FF+(ll)w) D[v].SS = (ll)((D[v].SS+D[u].SS)%oo);
        }
    }

    return;
}

int main() {
    scanf("%d%d", &n, &m);
    scanf("%d%d", &s, &t);

    fto (i, 1, m) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        adj[u].eb(v, w);
        adj[v].eb(u, w);
    }

    dijkstra();
    cout << ((ll)(D[t].SS%oo)*((D[t].SS-1LL+oo)%oo))%oo << endl;

    return 0;
}


Compiler output:
a.cc:120:15: error: redefinition of 'std::pair<long long int, long long int> D [200007]'
  120 | pair <ll, ll> D[maxN];
      |               ^
a.cc:31:15: note: 'std::pair<long long int, long long int> D [200007]' previously defined here
   31 | pair <ll, ll> D[maxN];
      |               ^
a.cc:121:5: error: redefinition of 'std::vector<std::pair<int, int> > adj [200007]'
  121 | vii adj[maxN];
      |     ^~~
a.cc:32:5: note: 'std::vector<std::pair<int, int> > adj [200007]' previously declared here
   32 | vii adj[maxN];
      |     ^~~
a.cc:123:5: error: redefinition of 'int n'
  123 | int n, m, s, t;
      |     ^
a.cc:34:5: note: 'int n' previously declared here
   34 | int n, m, s, t;
      |     ^
a.cc:123:8: error: redefinition of 'int m'
  123 | int n, m, s, t;
      |        ^
a.cc:34:8: note: 'int m' previously declared here
   34 | int n, m, s, t;
      |        ^
a.cc:123:11: error: redefinition of 'int s'
  123 | int n, m, s, t;
      |           ^
a.cc:34:11: note: 'int s' previously declared here
   34 | int n, m, s, t;
      |           ^
a.cc:123:14: error: redefinition of 'int t'
  123 | int n, m, s, t;
      |              ^
a.cc:34:14: note: 'int t' previously declared here
   34 | int n, m, s, t;
      |              ^
a.cc:125:6: error: redefinition of 'void dijkstra()'
  125 | void dijkstra() {
      |      ^~~~~~~~
a.cc:36:6: note: 'void dijkstra()' previously defined here
   36 | void dijkstra() {
      |      ^~~~~~~~
a.cc:158:5: error: redefinition of 'int main()'
  158 | int main() {
      |     ^~~~
a.cc:69:5: note: 'int main()' previously defined here
   69 | int main() {
      |     ^~~~