Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N(int(1e5 + 2));
const int64_t INF(1e15), MOD = 1e9 + 7;
int n, m, s, t;
vector<pair<int, int>>G[N];
int64_t Prefix[N], Sufix[N], waysPrefix[N], waysSufix[N];
vector<int64_t> dijkstra(int start, int stop) {
   vector<int64_t>D(n, INF);
   auto cmp = [&] (const int &node1, const int &node2) {
      return D[node1] < D[node2];
   };
   multiset<int, decltype(cmp)>s(cmp);
   D[start] = 0;
   s.insert(start);
   while(!s.empty()) {
      int x = *(s.begin());
      s.erase(s.begin());
      int y, cost;
      for(auto it : G[x]) {
         tie(y, cost) = it;
         if(D[x] + cost < D[y]) {
            s.erase(y);
            D[y] = D[x] + cost;
            s.insert(y);
         }
      }
   }
   return D;
}
tuple<int, int, int>E[2 * N];
int32_t main() {
  // ifstream cin("a.in");
   cin >> n >> m >> s >> t;
   s--;
   t--;
   for(int i = 0; i < m; ++i) {
      int x, y, z;
      cin >> x >> y >> z;
      E[i] = make_tuple(x - 1, y - 1, z);
      x--;
      y--;
      G[x].emplace_back(y, z);
      G[y].emplace_back(x, z);
   }

   auto vs = dijkstra(s, t), vt = dijkstra(t, s);
   for(int i = 0; i < n; ++i) {
      Prefix[i] = vs[i];
      Sufix[i] = vt[i];
   }
   vector<int>ind(n);
   auto cmp = [&] (const int &node1, const int &node2) {
      return Prefix[node1] < Prefix[node2];
   };
   for(int i = 0; i < n; ++i)
      ind[i] = i;
   auto Cost_Minim = Sufix[s];
   sort(ind.begin(), ind.end(), cmp);
   waysPrefix[s] = 1;
   for(auto x : ind) {
      int y, cost;
      for(auto it : G[x]) {
         tie(y, cost) = it;
         if(Prefix[y] + cost == Prefix[x]) {
            waysPrefix[x] = (waysPrefix[x] + waysPrefix[y]) % MOD;
         }
      }
   }

   reverse(ind.begin(), ind.end());
   waysSufix[t] = 1;
   for(auto x : ind) {
      int y, cost;
      for(auto it : G[x]) {
         tie(y, cost) = it;
         if(Sufix[y] + cost == Sufix[x]) {
            waysSufix[x] = (waysSufix[x] + waysSufix[y]) % MOD;
         }
      }
   }
   auto answer = waysPrefix[t] * 1LL * (waysPrefix[t] - 1) % MOD;
   for(int meet = 0; meet < n; ++meet) {
      if(meet != t && meet != s && Sufix[meet] == Prefix[meet] && Sufix[meet] + Prefix[meet] == Cost_Minim) {
         // o sa scadem nr de rumuri proaste
         int val1 = waysPrefix[meet], val2 = waysSufix[meet];

         /*/
         s->meet in val1 moduri
         t->meet in val2 moduri
         /*/
         int currWays = (1LL * val1 * val2) % MOD;
         currWays = (1LL * currWays * (currWays - 1  )) % MOD;
         answer = (answer - currWays + MOD) % MOD;


      }
   }

   for(int i = 0; i < m; ++i) {
      int x, y, z;
      tie(x, y, z) = E[i];


      if(Prefix[x] + Sufix[y] + z == Cost_Minim) {
         int val1 = waysPrefix[x], val2 = waysSufix[y];

         /*/
         s->meet in val1 moduri
         t->meet in val2 moduri
         /*/
         int currWays = (1LL * val1 * val2) % MOD;
         currWays = (1LL * currWays * (currWays )) % MOD;
         currWays = (currWays - (1LL * (val1 * val2)) % MOD + MOD) % MOD;
         //answer = (answer - currWays + MOD) % MOD;

      }
      swap(x, y);
      if(Prefix[x] + Sufix[y] + z == Cost_Minim) {
         int val1 = waysPrefix[x], val2 = waysSufix[y];

         /*/
         s->meet in val1 moduri
         t->meet in val2 moduri
         /*/
         int currWays = (1LL * val1 * val2) % MOD;
         currWays = (1LL * currWays * currWays) % MOD;
         currWays = (currWays - (1LL * (val1 * val2)) % MOD + MOD) % MOD;
       //  answer = (answer - currWays + MOD) % MOD;

      }
   }
   cout << answer;
}


Compiler output:
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:5:13: note: in expansion of macro 'int'
    5 | const int N(int(1e5 + 2));
      |             ^~~
a.cc:8:25: error: size of array 'G' is not an integral constant-expression
    8 | vector<pair<int, int>>G[N];
      |                         ^
a.cc:9:16: error: size of array 'Prefix' is not an integral constant-expression
    9 | int64_t Prefix[N], Sufix[N], waysPrefix[N], waysSufix[N];
      |                ^
a.cc:9:26: error: size of array 'Sufix' is not an integral constant-expression
    9 | int64_t Prefix[N], Sufix[N], waysPrefix[N], waysSufix[N];
      |                          ^
a.cc:9:41: error: size of array 'waysPrefix' is not an integral constant-expression
    9 | int64_t Prefix[N], Sufix[N], waysPrefix[N], waysSufix[N];
      |                                         ^
a.cc:9:55: error: size of array 'waysSufix' is not an integral constant-expression
    9 | int64_t Prefix[N], Sufix[N], waysPrefix[N], waysSufix[N];
      |                                                       ^
a.cc:33:25: error: size of array 'E' is not an integral constant-expression
   33 | tuple<int, int, int>E[2 * N];
      |                       ~~^~~