Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

vector<vector<pair<long long, long long> > > adj;
vector<long long> dist1, np1, dist2, np2;

void dijk(long long u, vector<long long> &d) {
  priority_queue<pair<long long, long long> > pq;
  pq.push(make_pair(0, u));

  while(!pq.empty()) {
    pair<long long, long long> curr = pq.top(); pq.pop();
    curr.first *= -1;
    if(d[curr.second] <= curr.first) continue;
    d[curr.second] = curr.first;
    for(long long i = 0; i<adj[curr.second].size(); ++i) {
      pair<long long, long long> p = adj[curr.second][i];
      if(d[p.first] <= d[curr.second]+p.second) continue;
      pq.push(make_pair(-(d[curr.second]+p.second), p.first));
    }
  }
}

void di2(long long u, vector<long long> &d, vector<ll> &np) {
  priority_queue<pair<ll, ll> > pq;
  for(ll i = 0; i<d.size(); ++i) {
    pq.push(make_pair(-d[i], i));
  }
  while(!pq.empty()) {
    ll curr = pq.top().second; pq.pop();
    for(ll i = 0; i<adj[curr].size(); ++i) {
      pair<ll, ll> p = adj[curr][i];
      if(d[p.first] == d[curr]+p.second) np[p.first] += np[curr];
    }
  }
}

vector<bool> processed;

void dfs(long long curr, vector<long long> &d, vector<long long> &np) {
  processed[curr] = true;
  for(long long i = 0; i<adj[curr].size(); ++i) {
    pair<ll, ll> p = adj[curr][i];
    if(!processed[p.first]) {
      dfs(p.first, d, np);
    }
  }
}

int main() {
  long long n, m; cin >> n >> m;
  long long s, t; cin >> s >> t;
  s--; t--;

  adj.resize(n);
  dist1.assign(n, 1e15);
  dist2.assign(n, 1e15);
  np1.resize(n);
  np2.resize(n);
  for(long long i = 0; i<m; ++i) {
    long long u, v, d; cin >> u >> v >> d;
    u--; v--;
    adj[u].push_back(make_pair(v, d));
    adj[v].push_back(make_pair(u, d));
  }

  np1[s] = 1;
  dijk(s, dist1);
  di2(s, dist1, np1);

  np2[t] = 1;
  dijk(t, dist2);
  di2(t, dist2, np2);

  /*
  for(ll i = 0; i<n; ++i) {
    cout << i << " " << dist1[i] << " " << dist2[i] << " " << np1[i] << " " << np2[i] << endl;
  }
  */
  ll ret = np1[t]*np1[t];
  for(ll i = 0; i<n; ++i) {
    if(dist1[i] == dist2[i] && dist1[i]*2 == dist1[t]) {
      ret -= np1[i] * np2[i];
    }
  }
  //cout << "ret checkpoint " << ret << endl;
  for(ll i = 0; i<n; ++i) {
    for(ll j = 0; j<adj[i].size(); ++j) {
      ll u = i;
      ll v = adj[i][j].first;
      if(dist1[u] + adj[i][j].second != dist1[v] || dist2[v] + adj[i][j].second != dist2[u]) continue;
      /*
      cout << u << " " << v << endl;
      cout << dist1[u] << " " << dist1[v] << endl;
      cout << dist2[u] << " " << dist2[v] << endl;
      cout << endl;
      */
      if(dist1[u] + dist2[v] + adj[i][j].second != dist1[t]) continue;
      if(dist1[u] >= (dist1[t]+1)/2 || dist2[v] >= (dist1[t]+1)/2) continue;
      ret -= np1[u] * np2[v];
      /*
      if(dist1[u] >= dist2[v] && dist1[u] <= dist2[u]) {
        ret -= np1[u] * np2[v];
      }
      if(dist1[u] < dist2[v] && dist1[v] > dist2[v]) {
        ret -= np1[u] * np2[v];
      }
      */
    }
  }
  cout << (ret) % (1e9+7) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:114:17: error: invalid operands of types 'll' {aka 'long long int'} and 'double' to binary 'operator%'
  114 |   cout << (ret) % (1e9+7) << endl;
      |           ~~~~~ ^ ~~~~~~~
      |            |          |
      |            |          double
      |            ll {aka long long int}