criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

#define int long long

int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

/*
#define cin ifs
#define cout ofs
ifstream ifs("in.txt");
ofstream ofs("out.txt");
//*/

//ダイクストラ法を用いて単一始点最短路問題を解く
const int MAX_V = 100000;
const int INF = 1e12;

struct edge {
    int to, cost;
};
typedef pair<int, int> P;

int V;
vector<edge> G[MAX_V];
int d1[MAX_V], n1[MAX_V];
int d2[MAX_V], n2[MAX_V];

void dijkstra(int s, int d[MAX_V], int n[MAX_V]) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    n[s] = 1;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                n[e.to] = 1;
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            } else if (d[e.to] == d[v] + e.cost) {
                n[e.to] += n[v];
                n[e.to] %= mod;
            }
        }
    }
}

int M, S, T;
vector<int> ns;
int mod = 1e9 + 7;

signed main() {
    cin >> V >> M >> S >> T;
    S--;
    T--;
    for (int i = 0; i < M; i++) {
        int U, V, D;
        cin >> U >> V >> D;
        G[U - 1].push_back({V - 1, D});
        G[V - 1].push_back({U - 1, D});
    }
    dijkstra(S, d1, n1);
    dijkstra(T, d2, n2);
    for (int i = 0; i < V; i++) {
        if (d1[i] == d1[T] / 2.0) {
            ns.push_back(n1[i] * n2[i] % mod);
        } else if (d1[i] < d1[T] / 2.0) {
            for (int j = 0; j < G[i].size(); j++) {
                edge e = G[i][j];
                if (d1[i] + d2[e.to] + e.cost == d1[T] &&
                    d1[e.to] > d1[T] / 2.0) {
                    ns.push_back(n1[i] * n2[e.to] % mod);
                }
            }
        }
    }
    int ans = 0, sum = 0;
    for (int i = 0; i < ns.size(); i++) {
        sum += ns[i];
        sum += mod;
    }
    for (int i = 0; i < ns.size(); i++) {
        ans += (ns[i] % mod) * ((sum + mod - ns[i]) % mod);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dijkstra(long long int, long long int*, long long int*)':
a.cc:51:28: error: 'mod' was not declared in this scope; did you mean 'modf'?
   51 |                 n[e.to] %= mod;
      |                            ^~~
      |                            modf
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7,N = 1e5 + 1;
int s,t,n,m;
long long dp[2][N],dis[2][N];
struct edges{
	int x,y,w;
}e[N<<1];
struct node{
	int x,w;
	node(int a = 0,int b = 0){
		x = a;w = b;
	}
};
void add(long long &a,int b){
	a+=b;
	a%=M;
	if(a >= M)a-=M;
	if(a < 0)a+=M;
}
vector<node>g[N];
bool vis[N];
void dijk(int s,bool at){
	long long *dis = ::dis[at];
	memset(vis,0,sizeof vis);
	int *dp = ::dp[at];
	dis[s] = 0;
	dp[s] = 1;
	priority_queue<pair<long long,int>>q;
	q.push({0,s});
	while(!q.empty()){
		int x = q.top().second;
		long long w = -q.top().first;
		q.pop();
		if(vis[x])continue;
		vis[x] = 1;
		for(auto i : g[x]){
			int y = i.x;
			long long cur = w + i.w;
			if(cur == dis[y])add(dp[y],dp[x]);
			if(cur >= dis[y])continue;
			dp[y] = dp[x];
			dis[y] = cur;
			q.push({-dis[y],y});
		}
	}
}
int main(){
	//freopen("input.txt","r",stdin);
	scanf("%d%d",&n,&m);
	scanf("%d%d",&s,&t);	
	for(int i = 0;i < m;i++){
		scanf("%d%d%d",&e[i].x,&e[i].y,&e[i].w);
		int a = --e[i].x,b = --e[i].y,c = e[i].w;
		g[a].push_back({b,c});
		g[b].push_back({a,c});
	}
	for(int i = 0;i < n;i++)dis[0][i] = dis[1][i] = 1e18;
	dijk(--s,0);
	dijk(--t,1);
	long long mndis = dis[0][t];
	long long ans = dp[0][t]*1LL*dp[0][t]%M;
	for(auto i : e){
		long long mn = min(dis[0][i.x],dis[0][i.y]);
		long long mx = min(dis[1][i.x],dis[1][i.y]);
		if(mn == dis[0][i.y])swap(i.x,i.y);
		if(mn >= mndis>>1 || mx >= mndis>>1 && mn + mx + i.w == mndis)continue;
		add(ans,-(dp[0][i.x]*1LL*dp[0][i.x]%M)*(dp[1][i.y]*1LL*dp[1][i.y]%M)%M);
	}
	for(int i = 0;i < n;i++)
		if(dis[0][i] == dis[1][i])add(ans,-(dp[0][i]*1LL*dp[0][i]%M)*(dp[1][i]*1LL*dp[1][i]%M)%M);
	printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'void dijk(int, bool)':
a.cc:26:26: error: cannot convert 'long long int*' to 'int*' in initialization
   26 |         int *dp = ::dp[at];
      |                   ~~~~~~~^
      |                          |
      |                          long long int*
a.cc:40:50: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int'
   40 |                         if(cur == dis[y])add(dp[y],dp[x]);
      |                                              ~~~~^
a.cc:15:21: note:   initializing argument 1 of 'void add(long long int&, int)'
   15 | void add(long long &a,int b){
      |          ~~~~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
//#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,ll> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

struct S {
	int a,b;ll c;
	S(int x,int y,ll z):a(x),b(y),c(z) {}
};

int n,m,s,t;
vector<P> g[100000];
vector<S> LIST;
ll d[2][100000],dp[2][100000];
const int MOD=1e9+7;

void dijkstra(int type,int start) {
	priority_queue<P,vector<P>,greater<P> > pq;
	REP(i,n) d[type][i]=LINF;
	dp[type][start]=1;
	d[type][start]=0;
	pq.push(P(0,start));
	while(!pq.empty()) {
		P p=pq.top();pq.pop();
		int v=p.se;
		if(d[type][v]<p.fi) continue;
		for(auto e:g[v]) {
			if(d[type][e.fi]<d[type][v]+e.se) continue;
			if(d[type][e.fi]==d[type][v]+e.se) (dp[type][e.fi]+=dp[type][v])%=MOD;
			else {
				dp[type][e.fi]=dp[type][v];
				d[type][e.fi]=d[type][v]+e.se;
				pq.push(P(d[type][e.fi],e.fi));
			}
		}
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin>>n>>m>>s>>t;
	s--,t--;
	REP(i,m) {
		int v,u;ll D;cin>>v>>u>>D;
		v--,u--;
		g[u].pb(P(v,D));g[v].pb(P(u,D));
		LIST.pb(S(u,v,D));
	}

	dijkstra(0,s);
	dijkstra(1,t);

	ll dif=0;

	REP(i,m) {
		int u=LIST[i].a,v=LIST[i].b;ll D=LIST[i].c;
		if(d[0][u]>d[0][v]) swap(u,v);
		if(d[0][u]*2<d[0][t]&&d[0][v]*2>d[0][t]&&d[0][u]+d[1][v]+D==d[0][t]) {
			ll num=dp[0][u]*dp[1][v]%MOD;
			(dif+=num*num)%=MOD;
		}
	}
	REP(i,n) {
		if(d[0][i]+d[1][i]==d[0][t]&&d[0][i]==d[1][i]) {
			ll num=dp[0][i]*dp[1][i]%MOD;
			(dif+=num*num)%=MDO;
		}
	}
	cout<<(dp[0][t]*dp[1][s]-dif+MOD)%MOD<<endl;

	//REP(i,n) cout<<dp[0][i]<<' '<<dp[1][i]<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:41: error: 'MDO' was not declared in this scope; did you mean 'MOD'?
   85 |                         (dif+=num*num)%=MDO;
      |                                         ^~~
      |                                         MOD
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define for_(i,a,b) for(int i=(a);i<(b);++i)
template< typename T > using Vec = vector< T >;
typedef long long lint;
template< typename T > void modAdd(T& a, T b, T mod) { (a += b) %= MOD; }//a = (a + b) % mod; }
 
struct Edge {
	int v;
	lint d;
	bool operator > (const Edge& e) const { return d > e.d; }
};
 
int N, M, S, T, U[200005], V[200005];
lint D[200005];
Vec< Vec< Edge > > edge;
 
lint dst[2][100005];
lint numpath[2][100010];
const lint MOD = (lint)1e9 + 7;
 
void calcDist(int piv, int start) {
	priority_queue< Edge, Vec< Edge >, greater< Edge > > que;
	que.push(Edge{start, 0});
	dst[piv][start] = 0;
	numpath[piv][start] = 1;
	while (!que.empty()) {
		Edge e = que.top(); que.pop();
		//if (dst[piv][e.v] < e.d) continue;
		for (const Edge& ei : edge[e.v]) {
			if (dst[piv][ei.v] == -1 || dst[piv][ei.v] > e.d + ei.d) {
				dst[piv][ei.v] = e.d + ei.d;
				numpath[piv][ei.v] = numpath[piv][e.v];
				que.push(Edge{ei.v, dst[piv][ei.v]});
			} else if (dst[piv][ei.v] == e.d + ei.d) {
				modAdd(numpath[piv][ei.v], numpath[piv][e.v], MOD);
			}
		}
	}
}
 
void solve() {
	memset(dst, -1, sizeof(dst));
	calcDist(0, S);
	calcDist(1, T);
  
  assert(numpath[0][S] == numpath[1][T]);
	
	lint collision = 0;	
	
	for_(v,0,N) {
		if (dst[0][v] == dst[1][v] && dst[0][v] + dst[1][v] == dst[0][T]) {
			lint num = (numpath[0][v] * numpath[1][v]) % MOD;
			modAdd(collision, num * num, MOD);
		}
	}
	
	double thr = (double)dst[0][T] / 2.;
	for_(i,0,M) {
		int u = U[i], v = V[i], d = D[i];
		if (abs(dst[0][v] - dst[0][u]) == d) {
			if (dst[0][v] + d == dst[0][u]) swap(u, v);
			if (dst[0][u] + dst[1][v] + d == dst[0][T] && (double)dst[0][u] < thr && (double)(dst[0][u] + d) > thr) {
				lint num = (numpath[0][u] * numpath[1][v]) % MOD;
				modAdd(collision, num * num, MOD);
			}
		}
	}
	
	cout << ((numpath[0][T] * numpath[1][S] - collision + MOD) % MOD) << endl;
}
 
int main() {
	cin >> N >> M;
	cin >> S >> T;
	--S; --T;
	
	edge.assign(N, Vec< Edge >());
	for_(i,0,M) {
		cin >> U[i] >> V[i] >> D[i];
		--U[i]; --V[i];
		edge[U[i]].push_back(Edge{V[i], D[i]});
		edge[V[i]].push_back(Edge{U[i], D[i]});
	}
	
	solve();
}


Compiler output:
a.cc: In function 'void modAdd(T&, T, T)':
a.cc:7:68: error: 'MOD' was not declared in this scope
    7 | template< typename T > void modAdd(T& a, T b, T mod) { (a += b) %= MOD; }//a = (a + b) % mod; }
      |                                                                    ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define for_(i,a,b) for(int i=(a);i<(b);++i)
template< typename T > using Vec = vector< T >;
typedef long long lint;
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b) % mod; }
 
struct Edge {
	int v;
	lint d;
	bool operator > (const Edge& e) const { return d > e.d; }
};
 
int N, M, S, T, U[200005], V[200005];
lint D[200005];
Vec< Vec< Edge > > edge;
 
lint dst[2][100005];
lint numpath[2][100010];
const lint MOD = (lint)1e9 + 7;
 
void calcDist(int piv, int start) {
	priority_queue< Edge, Vec< Edge >, greater< Edge > > que;
	que.push(Edge{start, 0});
	dst[piv][start] = 0;
	numpath[piv][start] = 1;
	while (!que.empty()) {
		Edge e = que.top(); que.pop();
		//if (dst[piv][e.v] < e.d) continue;
		for (const Edge& ei : edge[e.v]) {
			if (dst[piv][ei.v] == -1 || dst[piv][ei.v] > e.d + ei.d) {
				dst[piv][ei.v] = e.d + ei.d;
				numpath[piv][ei.v] = numpath[piv][e.v];
				que.push(Edge{ei.v, dst[piv][ei.v]});
			} else if (dst[piv][ei.v] == e.d + ei.d) {
				modAdd(numpath[piv][ei.v], numpath[piv][e.v], MOD);
			}
		}
	}
}
 
void solve() {
	memset(dst, -1, sizeof(dst));
	calcDist(0, S);
	calcDist(1, T);
  
  assert(numpath[0][T] == numpath[1][S]);
	
	lint collision = 0;	
	
	for_(v,0,N) {
		if (dst[0][v] == dst[1][v] && dst[0][v] + dst[1][v] == dst[0][T]) {
			lint num = (numpath[0][v] * numpath[1][v]) % MOD;
			modAdd(collision, num * num, MOD);
		}
	}
	
	double thr = (double)dst[0][T] / 2.;
	for_(i,0,M) {
		int u = U[i], v = V[i], d = D[i];
		if (abs(dst[0][v] - dst[0][u]) == d) {
			if (dst[0][v] + d == dst[0][u]) swap(u, v);
			if (dst[0][u] + dst[1][v] + d == dst[0][T] && (double)dst[0][u] < thr && (double)(dst[0][u] + d) > thr) {
				lint num = (numpath[0][u] * numpath[1][v]) % MOD;
				modAdd(collision, num * num, MOD);
			}
		}
	}
	
	cout << ((numpath[0][T] * numpath[1][S] - collision + MOD) % MOD) << endl;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,int> PLI;
const int MAXN=100005;
const int MAXM=200005;
const LL INF=1e18;
const int mod=1e9+7;

vector<PLI > edge[MAXN];
int n,m,s,t,e[MAXM][3];
LL dis1[MAXN],dis2[MAXN];
LL num1[MAXN],num2[MAXN];

priority_queue<PLI,vector<PLI>,greater<PLI> > pq; 
void SPFA(int s,LL* dis,LL* num){
    for(int i=1;i<=n;i++){
        num[i]=0;
        dis[i]=INF;
    }
    dis[s]=0; num[s]=1;
    pq.push(PLI(0,s));
    while(!pq.empty()){
        PLI a=pq.top(); pq.pop();
        int u=a.second;;
        for(int i=0;i<edge[u].size();i++){
            int v=edge[u][i].first;
            LL d=edge[u][i].second;
            if (dis[v]>=dis[u]+d){
                if (dis[v]>dis[u]+d) num[v]=num[u],pq.push(PLI(dis[u]+d,v));
                else (num[v]+=num[u])%=mod;
                dis[v]=dis[u]+d;
            }
        }
    }
}

int main(){    
    scanf("%d%d%d%d",&n,&m,&s,&t);
    for(int i=1;i<=m;i++){
        int a,b,c; scanf("%d%d%d",&a,&b,&c);
        e[i][0]=a; e[i][1]=b; e[i][2]=c;
        edge[a].push_back(MP(b,c));
        edge[b].push_back(MP(a,c));
    }
    SPFA(s,dis1,num1);
    SPFA(t,dis2,num2);
    LL ans=num1[t]*num2[s]%mod;    
    LL ans1=0;
    for(int i=1;i<=n;i++){
        if (dis1[i]==dis2[i] && dis1[i]+dis2[i]==dis1[t]){
            LL tmp=num1[i]*num2[i]%mod;
            ans-=tmp*tmp%mod;
            if (ans<0) ans+=mod;
        }
    }
    //LL ans2=0;
    for(int i=1;i<=m;i++){
        int a,b,c; a=e[i][0]; b=e[i][1]; c=e[i][2];
        if (dis1[a]>dis1[b]) swap(a,b);
        if (dis1[a]*2<dis1[t] && dis2[b]*2<dis1[t] && dis1[a]+dis2[b]+c==dis1[t]){
            LL tmp=num1[a]*num2[b]%mod;
            ans-=tmp*tmp%mod;
            if (ans<0) ans+=mod;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:27: error: 'MP' was not declared in this scope
   43 |         edge[a].push_back(MP(b,c));
      |                           ^~
Language: C++

#include <bits/stdc++.h>
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<LL,int> PII;
const int MAXN=100005;
const int MAXM=200005;
const int INF=1000000007;
const int mod=1000000007;

vector<PII > edge[MAXN];
int n,m,s,t,e[MAXM][3];
LL dis1[MAXN],dis2[MAXN];
LL num1[MAXN],num2[MAXN];

priority_queue<PII,vector<PII>,greater<PII> > pq; 
void SPFA(int s,LL* dis,LL* num){
    for(int i=1;i<=n;i++){
        num[i]=0;
        dis[i]=INF;
    }
    dis[s]=0; num[s]=1;
    pq.push(MP(0,s));
    while(!pq.empty()){
        PII a=pq.top(); pq.pop();
        int u=a.second;
        for(int i=0;i<edge[u].size();i++){
            int v=edge[u][i].first;
            LL d=edge[u][i].second;
            if (dis[v]>=dis[u]+d){
                if (dis[v]>dis[u]+d) num[v]=num[u],pq.push(MP(dis[u]+d,v));
                else (num[v]+=num[u])%=mod;
                dis[v]=dis[u]+d;
            }
        }
    }
}

int main(){
    scanf("%d%d%d%d",&n,&m,&s,&t);
    for(int i=1;i<=m;i++){
        int a,b,c; scanf("%d%d%d",&a,&b,&c);
        e[i][0]=a; e[i][1]=b; e[i][2]=c;
        edge[a].push_back(MP(b,c));
        edge[b].push_back(MP(a,c));
    }
    SPFA(s,dis1,num1);
    SPFA(t,dis2,num2);
    LL ans=num1[t]*num2[s]%mod;
    LL ans1=0;
    for(int i=1;i<=n;i++){
        if (dis1[i]==dis2[i] && dis1[i]+dis2[i]==dis1[t]){
            ans1+=(((num1[a]*num2[b])%mod)*((num1[a]*num2[b])%mod))%mod;
            ans1%=mod;
        }
    }
    LL ans2=0;
    for(int i=1;i<=m;i++){
        int a,b,c; a=e[i][0]; b=e[i][1]; c=e[i][2];
        //dis1[a]=dis2[b]+c-2*x
        //0<x<c
        //0<2x=dis2[b]-dis1[a]+c<2c
        if (0<dis2[b]-dis1[a]+c && dis2[b]-dis1[a]<c && dis1[a]+dis2[b]+c==dis1[t]){
            ans2+=(((num1[a]*num2[b])%mod)*((num1[a]*num2[b])%mod))%mod;
            ans2%=mod;
        }
        swap(a,b);
        if (0<dis2[b]-dis1[a]+c && dis2[b]-dis1[a]<c && dis1[a]+dis2[b]+c==dis1[t]){
            ans2+=(((num1[a]*num2[b])%mod)*((num1[a]*num2[b])%mod))%mod;
            ans2%=mod;
        }
    }
    printf("%lld\n",((ans-ans1-ans2)%mod+mod)%mod);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:27: error: 'a' was not declared in this scope
   53 |             ans1+=(((num1[a]*num2[b])%mod)*((num1[a]*num2[b])%mod))%mod;
      |                           ^
a.cc:53:35: error: 'b' was not declared in this scope
   53 |             ans1+=(((num1[a]*num2[b])%mod)*((num1[a]*num2[b])%mod))%mod;
      |                                   ^
Language: C++

#include <bits/stdc++.h>
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<LL,int> PII;
const int MAXN=100005;
const int MAXM=200005;
const int INF=1000000007;
const int mod=1000000007;

vector<PII > edge[MAXN];
int n,m,s,t,e[MAXM][3];
LL dis1[MAXN],dis2[MAXN];
LL num1[MAXN],num2[MAXN];

priority_queue<PII,vector<PII>,greater<PII> > pq; 
void SPFA(int s,int* dis,LL* num){
    for(int i=1;i<=n;i++){
        num[i]=0;
        dis[i]=INF;
    }
    dis[s]=0; num[s]=1;
    pq.push(MP(0,s));
    while(!pq.empty()){
        PII a=pq.top(); pq.pop();
        int u=a.second;
        for(int i=0;i<edge[u].size();i++){
            int v=edge[u][i].first;
            LL d=edge[u][i].second;
            if (dis[v]>=dis[u]+d){
                if (dis[v]>dis[u]+d) num[v]=num[u],pq.push(MP(dis[u]+d,v));
                else (num[v]+=num[u])%=mod;
                dis[v]=dis[u]+d;
            }
        }
    }
}

int main(){
    scanf("%d%d%d%d",&n,&m,&s,&t);
    for(int i=1;i<=m;i++){
        int a,b,c; scanf("%d%d%d",&a,&b,&c);
        e[i][0]=a; e[i][1]=b; e[i][2]=c;
        edge[a].push_back(MP(b,c));
        edge[b].push_back(MP(a,c));
    }
    SPFA(s,dis1,num1);
    SPFA(t,dis2,num2);
    LL ans=num1[t]*num2[s]%mod;
    LL ans1=0;
    for(int i=1;i<=n;i++){
        if (dis1[i]==dis2[i] && dis1[i]+dis2[i]==dis1[t]){
            ans1+=num1[i]*num2[i]%mod;
            ans1%=mod;
        }
    }
    LL ans2=0;
    for(int i=1;i<=m;i++){
        int a,b,c; a=e[i][0]; b=e[i][1]; c=e[i][2];
        //dis1[a]=dis2[b]+c-2*x
        //0<x<c
        //0<2x=dis2[b]-dis1[a]+c<2c
        if (0<dis2[b]-dis1[a]+c && dis2[b]-dis1[a]<c && dis1[a]+dis2[b]+c==dis1[t]){
            ans2+=num1[a]*num2[b]%mod;
            ans2%=mod;
        }
        swap(a,b);
        if (0<dis2[b]-dis1[a]+c && dis2[b]-dis1[a]<c && dis1[a]+dis2[b]+c==dis1[t]){
            ans2+=num1[a]*num2[b]%mod;
            ans2%=mod;
        }
    }
    printf("%lld\n",((ans-ans1-ans2)%mod+mod)%mod);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:12: error: cannot convert 'LL*' {aka 'long long int*'} to 'int*'
   47 |     SPFA(s,dis1,num1);
      |            ^~~~
      |            |
      |            LL* {aka long long int*}
a.cc:17:22: note:   initializing argument 2 of 'void SPFA(int, int*, LL*)'
   17 | void SPFA(int s,int* dis,LL* num){
      |                 ~~~~~^~~
a.cc:48:12: error: cannot convert 'LL*' {aka 'long long int*'} to 'int*'
   48 |     SPFA(t,dis2,num2);
      |            ^~~~
      |            |
      |            LL* {aka long long int*}
a.cc:17:22: note:   initializing argument 2 of 'void SPFA(int, int*, LL*)'
   17 | void SPFA(int s,int* dis,LL* num){
      |                 ~~~~~^~~
Language: C++

#coding:utf-8
import numpy as np
import pylab
import wave

def wavread(filename):
    wf = wave.open(filename, "r")
    fs = wf.getframerate()
    x = wf.readframes(wf.getnframes())
    x = np.frombuffer(x, dtype="int16") / 32768.0  # (-1, 1)に正規化
    wf.close()
    return x, float(fs)

if __name__ == "__main__":
    # 波形を表示
    wav, fs = wavread("a.wav")
    t = np.arange(0.0, len(wav) / fs, 1/fs)
    pylab.plot(t * 1000, wav)
    pylab.xlabel("time [ms]")
    pylab.ylabel("amplitude")
    pylab.show()

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #coding
    1 | #coding:utf-8
      |  ^~~~~~
a.cc:10:52: error: stray '#' in program
   10 |     x = np.frombuffer(x, dtype="int16") / 32768.0  # (-1, 1)に正規化
      |                                                    ^
a.cc:15:7: error: invalid preprocessing directive #\U00006ce2\U00005f62\U00003092\U00008868\U0000793a
   15 |     # 波形を表示
      |       ^~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import numpy as np
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
vector<pair<int,long long> > nei[100005];
int n,m,s,t;
long long dis1[100005],dis2[100005];
void dij()
{
	priority_queue<pair<long long,int> > q1;
	q1.push(make_pair(0,s));
	
	memset(dis1,-1,sizeof(dis1));dis1[s]=0;
	while(!q1.empty())
	{
		long long d=q1.top().first;
		int x=q1.top().second;
		q1.pop();
		for(int i=0;i<nei[x].size();i++)
		{
			if(dis1[nei[x][i].first]<=-d+nei[x][i].second&&dis1[nei[x][i].first]!=-1) continue;
			dis1[nei[x][i].first]=-d+nei[x][i].second;
			q1.push(make_pair(d-nei[x][i].second,nei[x][i].first));
		}
	}
	
	
	priority_queue<pair<long long,int> > q2;
	q2.push(make_pair(0,t));
	memset(dis2,-1,sizeof(dis2));dis2[t]=0;
	while(!q2.empty())
	{
		long long d=q2.top().first;
		int x=q2.top().second;
		q2.pop();
		for(int i=0;i<nei[x].size();i++)
		{
			if(dis2[nei[x][i].first]<=-d+nei[x][i].second&&dis2[nei[x][i].first]!=-1) continue;
			dis2[nei[x][i].first]=-d+nei[x][i].second;
			q2.push(make_pair(d-nei[x][i].second,nei[x][i].first));
		}
	}
}
long long dp1[100005],dp2[100005];
long long dfs1(int v)
{
	if(dp1[v]!=-1) return dp1[v];
	dp1[v]=0;
	for(int i=0;i<nei[v].size();i++)
	{
		if(dis1[v]+nei[v][i].second==dis1[nei[v][i].first])
		{
			dp1[v]+=dfs1(nei[v][i].first);
			dp1[v]%=1000000007;
		}
	}
	return dp1[v];
}
vector<pair<int,int> >res;
long long dfs2(int v)
{
	if(dp2[v]!=-1) return dp2[v];
	dp2[v]=0;
	for(int i=0;i<nei[v].size();i++)
	{
		if(dis2[v]+nei[v][i].second==dis2[nei[v][i].first])
		{
			dp2[v]+=dfs2(nei[v][i].first);
			if(dis2[v]<dis1[v]&&dis2[nei[v][i].first]>dis1[nei[v][i].first]) res.push_back(make_pair(v,nei[v][i].first));
			if(dis2[v]*2==dis) res.push_back(make_pair(v,v));
			dp2[v]%=1000000007;
		}
	}
	return dp2[v];
}
long long mul(long long x)
{
	return x*x%1000000007;
}
int main()
{
	cin>>n>>m>>s>>t;
	s--,t--;
	for(int i=0;i<m;i++)
	{
		int u,v;
		long long d;
		cin>>u>>v>>d;
		u--,v--;
		nei[u].push_back(make_pair(v,d));
		nei[v].push_back(make_pair(u,d));
	}
	dij();
	memset(dp1,-1,sizeof(dp1));
	memset(dp2,-1,sizeof(dp2));
	dp1[t]=1;
	dp2[s]=1;
	dfs1(s);
	dfs2(t);
//	for(int i=0;i<n;i++)if(dis1[i]==dis2[i]) res.push_back(make_pair(i,i));
	long long ans=mul(dp1[s]);
	for(int i=0;i<res.size();i++)
	{
		ans=ans-mul((1ll*dp1[res[i].first]*dp2[res[i].second])%1000000007);
		ans%=1000000007;
		if(ans<0) ans+=1000000007;
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'long long int dfs2(int)':
a.cc:82:39: error: 'dis' was not declared in this scope; did you mean 'div'?
   82 |                         if(dis2[v]*2==dis) res.push_back(make_pair(v,v));
      |                                       ^~~
      |                                       div
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pii;
const int N=1e5+10,M=4e5+10,p=1e9+7;
int n,m,s,t,fs[N],gs[N],ft[N],gt[N],vis[N],ans,al;
int tot,fi[N],ne[M],a[M],c[M];
inline void A(int &x,int y){x+=y;if (x>=p) x-=p;}
inline void add(int x,int y,int z){
	a[++tot]=y;c[tot]=z;ne[tot]=fi[x];fi[x]=tot;
}
inline int dp(int x,int *f,int *g){
	if (vis[x]) return g[x];vis[x]=1;
	for (int i=fi[x];i;i=ne[i]) if (f[x]-c[i]==f[a[i]]) A(g[x],dp(a[i],f,g));
	return g[x];
}	
inline void dij(int *f,int *g,int s,int t){
	priority_queue<pii,vector<pii>,greater<pii> > q;
	for (int i=1;i<=n;++i) f[i]=1e15;
	f[s]=0;q.push(make_pair(0,s));
	while (!q.empty()){
		pii tmp=q.top();q.pop();
		int u=tmp.second;
		if (tmp.first>f[u]) continue;
		for (int i=fi[u];i;i=ne[i]) if (f[u]+c[i]<f[a[i]]) f[a[i]]=f[u]+c[i],q.push(make_pair(f[a[i]],a[i]));
	}
	memset(vis,0,sizeof vis);
	g[s]=1;vis[s]=1;
	dp(t,f,g);
}
inline void solve(int x){
	if (vis[x]) return;vis[x]=1;
	if (fs[x]*2==al) {A(ans,p-1ll*gs[x]*gt[x]%p);return;}
	for (int i=fi[x];i;i=ne[i]) if (fs[x]+c[i]==fs[a[i]]){
		if (fs[a[i]]*2>al) A(ans,p-1ll*gs[x]*gt[a[i]]%p);
			else solve(a[i]);
	}
}
signed main(){
	scanf("%lld%lld%lld%lld",&n,&m,&s,&t);
	for (int i=1,x,y,z;i<=m;++i) scanf("%lld%lld%lld",&x,&y,&z),add(x,y,z),add(y,x,z);
	dij(fs,gs,s,t);dij(ft,gt,t,s);
	for (int i=1;i<=n;++i) (gs[i]*=gs[i])%=p,(gt[i]*=gt[i])%=p;
	al=fs[t];ans=gs[t]%p;
	memset(vis,0,sizeof vis);
	solve(s);
	printf("%lld\n",ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:28: error: expected ')' before ';' token
   47 |         printf("%lld\n",ans;
      |               ~            ^
      |                            )
Language: C++

#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

#ifndef ASSERT
#	define ASSERT(...)
#endif
#define MOD 1000000007

struct Graph
{
	struct Edge
	{
		Edge()
		{}

		Edge(int from, int to, int weight)
			: u(from)
			, v(to)
			, w(weight)
		{}

		int u, v;
		int w;
	};

	int nvert, nedge;
	vector< vector<Edge> > ve;
	vector<Edge> edges;

	vector<ll> d;
	vector<int> a;

	Graph(int n)
		: nvert(n)
		, nedge(0)
		, ve(n)
		, d(n, 1LL<<60)
		, a(n, 0)
	{}

	void add_edge(int u, int v, int w)
	{
		ASSERT(0 <= u && u < nvert);
		ASSERT(0 <= v && v < nvert);
		ASSERT(0 <= w);
		ASSERT(u != v);
		ve[u].push_back(Edge(u, v, w));
		ve[v].push_back(Edge(v, u, w));
		edges.push_back(Edge(u, v, w));
		edges.push_back(Edge(v, u, w));
		++nedge;
	}

	ll dijkstra(int io, int i1)
	{
		d[io] = 0;
		a[io] = 1;

		priority_queue< pair<ll,int> > q;
		q.push( make_pair(0,io) );

		vector<bool> processed(nvert, false);
		int step = 0;
		while(!q.empty())
		{
			int u = q.top().second;
			if(u == i1)
				break;
			ll du = q.top().first;
			q.pop();
			if(d[u] < du)
				continue;
			
			if(processed[u])
				continue;
			processed[u] = true;
			
			++step;

			for(int i=0; i<ve[u].size(); ++i)
			{
				Edge &e = ve[u][i];
				int v = (u == e.v ? e.u : e.v);
				ASSERT(v != u);

				if(d[u] + e.w  <= d[v])
				{
					if(d[u] + e.w  < d[v])
					{
						a[v] = 0;
					}
					
					a[v] = (a[v] + a[u]) % MOD;
					d[v] = d[u] + e.w;
					q.push( make_pair(-d[v], v) );
				}
			}
		}

		return d[i1];
	}
};


int main()
{
	ios::sync_with_stdio(false);

	int n, m, s, t;
	//cin >> n >> m >> s >> t;
	scanf("%d %d %d %d", &n, &m, &s, &t);
	Graph graph(n+1);
	for(int i=0; i<m; ++i)
	{
		int u, v, w;
		//cin >> u >> v >> w;
		scanf("%d %d %d", &u, &v, &w);
		graph.add_edge(u, v, w);
	}
	Graph graph2(graph);

	ll len = graph.dijkstra(s, t);
	graph2.dijkstra(t, s);

	vector<ll> q1(n+1, 0);
	vector<ll> q2(n+1, 0);
	
	print(graph.a[t]);
	ll ans = graph.a[t]*1LL*graph.a[t] % MOD;
	for(int i=0; i<graph.edges.size(); i+=1)
	{
		int u = graph.edges[i].u;
		int v = graph.edges[i].v;
		if(graph.d[u] + graph.edges[i].w + graph2.d[v] == len)
		{
			ll t1 = graph.d[u], t2 = graph.d[v];
			if(t1*2 < len && len < t2*2)
			{
				ans = (ans + MOD - graph.a[u]*1LL*graph.a[u]%MOD * graph2.a[v]%MOD *graph2.a[v]%MOD) % MOD;
			}
			else if(t1*2 == len)
			{
				q1[u] += graph.a[u];
			}
			else if(t2*2 == len)
			{
				q2[v] += graph2.a[v];
			}
		}
	}
	
	for(int i=0; i<n; ++i)
		ans = (ans + MOD - q1[i]*q2[i]%MOD) % MOD;

	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:141:9: error: 'print' was not declared in this scope; did you mean 'rint'?
  141 |         print(graph.a[t]);
      |         ^~~~~
      |         rint
Language: C++

#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

#ifndef ASSERT
#	define ASSERT(...)
#endif
#define MOD 1000000007

struct Graph
{
	struct Edge
	{
		Edge()
		{}

		Edge(int from, int to, ll weight)
			: u(from)
			, v(to)
			, w(weight)
		{}

		int u, v;
		ll w;
	};

	int nvert, nedge;
	vector< vector<Edge> > ve;
	vector<Edge> edges;

	vector<ll> d;
	vector<int> a;

	Graph(int n)
		: nvert(n)
		, nedge(0)
		, ve(n)
		, d(n, 1LL<<60)
		, a(n, 0)
	{}

	void add_edge(int u, int v, int w)
	{
		ASSERT(0 <= u && u < nvert);
		ASSERT(0 <= v && v < nvert);
		ASSERT(0 <= w);
		ve[u].push_back(Edge(u, v, w));
		ve[v].push_back(Edge(v, u, w));
		edges.push_back(Edge(u, v, w));
		edges.push_back(Edge(v, u, w));
		++nedge;
	}

	ll dijkstra(int io, int i1)
	{
		d[io] = 0;
		a[io] = 1;

		priority_queue< pair<int,int> > q;
		q.push( make_pair(0,io) );

		vector<bool> processed(nvert, false);
		int step = 0;
		while(!q.empty())
		{
			int u = q.top().second;
			if(u == i1)
				break;
			int du = q.top().first;
			q.pop();
			if(d[u] < du)
				continue;
			
			if(processed[u])
				continue;
			processed[u] = true;
			
			++step;

			for(int i=0; i<ve[u].size(); ++i)
			{
				Edge &e = ve[u][i];
				int v = (u == e.v ? e.u : e.v);
				ASSERT(v != u);

				if(d[u] + e.w  <= d[v])
				{
					if(d[u] + e.w  < d[v])
					{
						a[v] = 0;
					}
					
					a[v] = (a[v] + a[u]) % MOD;
					d[v] = d[u] + e.w;
					q.push( make_pair(-d[v], v) );
				}
			}
		}

		return d[i1];
	}
};


int main()
{
	ios::sync_with_stdio(false);

	int n, m, s, t;
	//cin >> n >> m >> s >> t;
	scanf("%d %d %d %d", &n, &m, &s, &t);
	Graph graph(n+1);
	for(int i=0; i<m; ++i)
	{
		int u, v, w;
		//cin >> u >> v >> w;
		scanf("%d %d %d", &u, &v, &w);
		graph.add_edge(u, v, w);
	}
	Graph graph2(graph);

	ll len = graph.dijkstra(s, t);
	graph2.dijkstra(t, s);

	print(graph.a[t], graph2.a[s]);
	ll ans = graph.a[t]*1LL*graph.a[t] % MOD;
	for(int i=0; i<graph.edges.size(); i+=1)
	{
		int u = graph.edges[i].u;
		int v = graph.edges[i].v;
		if(graph.d[u] + graph.edges[i].w + graph2.d[v] == len)
		{
			ll t1 = graph.d[u], t2 = graph.d[v];
			if(t1*2 <= len && len < t2*2)
				ans = (ans + MOD - graph.a[u]*1LL*graph2.a[v]%MOD) % MOD;
		}
	}

	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:137:9: error: 'print' was not declared in this scope; did you mean 'rint'?
  137 |         print(graph.a[t], graph2.a[s]);
      |         ^~~~~
      |         rint
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

struct edge{
   int to, cost;
   edge(int to, int cost):to(to), cost(cost){}
};
vector<edge> G[100010];
int d[100010], e[100010]; 
int n, m, s, t;
int tim, ans;
int dp[100010];

void dijkstra(int s){
    fill(d, d + 100010, INF);//V, INF
    d[s] = 0;
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(d[s], s));
    dp[s] = 1;
    while(!q.empty()){
        P p = q.top(); q.pop();
        int from = p.second;
        int cost = p.first;
        if(d[from] < cost) continue;
        rep(i, 0, G[from].size()){
            edge e = G[from][i];
            int next = e.to;
            int newCost = e.cost + cost;
            if(d[next] > newCost){
                dp[next] = dp[from];
                d[next] = newCost;
                q.push(P(newCost, next));
            }else if(d[next] == newCost){
                (dp[next] += dp[from]) %= mod;
            }
        }
    }
}

int dfs(int now, int pre){
    if(now == t) return 1;
    if(e[now] != -1) return e[now];
    int res = 0;
    rep(i, 0, G[now].size()){
        int next = G[now][i].to;
        int cost = G[now][i].cost;
        if(next == pre) continue;
        if(d[next] != d[now] + cost) continue;
        if((tim - 2 * d[now]) * (tim - 2 * d[next]) <= 0){
            int tmp = dfs(nest, now);
            ans -= tmp * (tmp - 1);
        }
        res += dfs(next, now);
    }
    return e[now] = res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m >> s >> t;
    s--; t--;
    rep(i, 0, m){
        int u, v, c;
        cin >> u >> v >> c;
        u--; v--;
        G[u].push_back(edge{v, c});
        G[v].push_back(edge{u, c});
    }
    dijkstra(s);
    tim = d[t];
    ans = dp[t] * (dp[t] - 1) % mod;
    memset(e, -1, sizeof(e));
    cout << ans << endl;
}
/*
8 10
1 5
1 2 2
2 3 1
2 4 1
3 5 1
4 5 1
1 6 1
6 7 1
6 8 1
7 5 2
8 5 2
===
10
*/

Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:60:27: error: 'nest' was not declared in this scope; did you mean 'next'?
   60 |             int tmp = dfs(nest, now);
      |                           ^~~~
      |                           next
Language: C++

#include<bits/stdc++.h>
/*
*/

using namespace std;


int main(){
	long long int mod = 1000000007LL;
	long long int N, M;
	cin >> N >> M;
	long long int S, T;
	cin >> S >> T;
	S--; T--;
	vector<vector<pair<long long int, long long int>>>route(N);
	vector<long long int>u(M), v(M), d(M);
	for( size_t i = 0; i < M; i++ ){
		long long int U, V, D;
		cin >> U >> V >> D;
		U--; V--;
		u[i] = U;
		v[i] = V;
		d[i] = D;
		route[U].push_back(make_pair(V, D));
		route[V].push_back(make_pair(U, D));
	}
	priority_queue<pair<long long int, long long int>, vector<pair<long long int, long long int>>, greater<pair<long long int, long long int>>>que;
	que.push(make_pair(0, S));
	long long int STtime = 1LL << 60;
	vector < long long int >Stime(N, 1LL << 60), Ttime(N, 1LL << 60), Scount(N, 0), Tcount(N, 0);
	Stime[S] = 0;
	Ttime[T] = 0;
	Scount[S] = 1;
	Tcount[T] = 1;
	while( que.size() ){
		auto now = que.top(); que.pop();
		if( now.first > STtime ){
			break;
		}
		if( Stime[now.second] < now.first ){
			continue;
		}
		if( now.second == T ){
			STtime = now.first;
			continue;
		}
		for( auto x : route[now.second] ){
			auto next = now;
			next.first += x.second;
			next.second = x.first;
			if( Stime[next.second] == next.first ){
				Scount[next.second] += Scount[now.second];
				Scount %= mod;
				continue;
			}
			if( Stime[next.second] > next.first ){
				Stime[next.second] = next.first;
				Scount[next.second] = Scount[now.second];
				que.push(next);
			}
		}
	}
	que.push(make_pair(0, T));
	while( que.size() ){
		auto now = que.top(); que.pop();
		if( now.first > STtime ){
			break;
		}
		if( Ttime[now.second] < now.first ){
			continue;
		}
		if( now.second == S ){
			STtime = now.first;
			continue;
		}
		for( auto x : route[now.second] ){
			auto next = now;
			next.first += x.second;
			next.second = x.first;
			if( Ttime[next.second] == next.first ){
				Tcount[next.second] += Tcount[now.second];
				Tcount[next.second] %= mod;
				continue;
			}
			if( Ttime[next.second] > next.first ){
				Ttime[next.second] = next.first;
				Tcount[next.second] = Tcount[now.second];
				que.push(next);
			}
		}
	}
	vector<long long int >test;
	for( size_t i = 0; i < N; i++ ){
		if( Stime[i] * 2 == STtime && Ttime[i] * 2 == STtime ){
			test.push_back(Scount[i] * Tcount[i] % mod);
		}
	}
	for( size_t i = 0; i < M; i++ ){
		if( Stime[u[i]] + Ttime[v[i]] + d[i] == STtime ){
			if( Stime[u[i]] * 2 < STtime && ( Stime[u[i]] + d[i] ) * 2 > STtime ){
				test.push_back(Scount[u[i]] * Tcount[v[i]] % mod);
			}
		}
		if( Stime[v[i]] + Ttime[u[i]] + d[i] == STtime ){
			if( Stime[v[i]] * 2 < STtime && ( Stime[v[i]] + d[i] ) * 2 > STtime ){
				test.push_back(Scount[v[i]] * Tcount[u[i]] % mod);
			}
		}
	}
	long long int ans = 0,memo=0;
	for( auto x : test ){
		ans += x * memo;
		memo += x;
		memo %= mod;
		ans %= mod;
	}
	ans *= 2;
	ans %= mod;
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:40: error: no match for 'operator%=' (operand types are 'std::vector<long long int>' and 'long long int')
   53 |                                 Scount %= mod;
      |                                 ~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

long long MOD = 1000000007LL;

template<class T>
vector<T> dijkstra(vector<vector<int>> E, vector<vector<T>> W, int s, T inf, vector<long long> &pat)
{
    int n = (int)E.size();

    for (int i=0; i<n; i++)
        pat[i] = 0;

    vector<T> D(n, inf);
    typedef pair<T,int> P;
    priority_queue<P,vector<P>,greater<P>> Q;

    D[s] = T();
    pat[s] = 1;
    Q.push(make_pair(D[s], s));

    while (!Q.empty())
    {
        long long d = Q.top().first;
        int p = Q.top().second;
        Q.pop();
        if (d > D[p])
            continue;
        for (int i=0; i<(int)E[p].size(); i++)
        {
            int t = E[p][i];
            if (d+W[p][i] < D[t])
                D[t] = d+W[p][i],
                pat[t] = 0LL,
                Q.push(make_pair(D[t], t))
            if (d+W[p][i]==D[t])
                pat[t] += pat[p],
                pat[t] = (pat[t]>=MOD ? pat[t]-MOD : pat[t]);
        }
    }
    return D;
}

int main()
{
    ios::sync_with_stdio(false);

    int N, M;
    cin>>N>>M;
    int S, T;
    cin>>S>>T;
    S--, T--;
    vector<vector<int>> E(N);
    vector<vector<long long>> D(N);
    for (int i=0; i<M; i++)
    {
        int u, v;
        long long d;
        cin>>u>>v>>d;
        E[u-1].push_back(v-1);
        E[v-1].push_back(u-1);
        D[u-1].push_back(d);
        D[v-1].push_back(d);
    }
    vector<long long> DS(N), DT(N), PS(N), PT(N);
    long long oo = 10000000000LL*N;
    DS = dijkstra(E, D, S, oo, PS);
    DT = dijkstra(E, D, T, oo, PT);

    long long ans = PS[T]*PS[T]%MOD;
    for (int i=0; i<N; i++)
    if (DS[i]+DT[i] == DS[T])
    {
        if (DS[i]*2 == DS[T])
            ans -= PS[i]*PT[i]%MOD;
        else
            for (int j=0; j<(int)E[i].size(); j++)
            if (DS[i]*2 < DS[T]&& DS[T] < DS[E[i][j]]*2 && DS[i]+D[i][j]+DT[E[i][j]]==DS[T])
                ans -= PS[i]*PT[E[i][j]]%MOD;
    }
    cout<<ans%MOD<<endl;
}


Compiler output:
a.cc: In function 'std::vector<_Tp> dijkstra(std::vector<std::vector<int> >, std::vector<std::vector<_Tp> >, int, T, std::vector<long long int>&)':
a.cc:39:43: error: expected ';' before 'if'
   39 |                 Q.push(make_pair(D[t], t))
      |                                           ^
      |                                           ;
   40 |             if (d+W[p][i]==D[t])
      |             ~~
Language: C++

#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;

int N,M,S,T;
vector<pair<int, int> > G[100100];

const long long mod = 1000000007;

pair<vector<long long>, vector<long long> > dist(int s)
{
	vector<long long> dist(N,1e18);
	priority_queue<pair<long long, int> > Q;
	Q.push({0,s}); dist[s] = 0;
	while (!Q.empty()){
		int x = Q.top().second; long long c = -Q.top().first; Q.pop();
		if (dist[x] < c) continue;
		for (auto &p : G[x]){
			int y = p.first;
			long long nc = p.second + c;
			if (dist[y] > nc){
				Q.push({-nc,y});
				dist[y] = nc;
			}
		}
	}

	vector<long long> cnt(N);
	cnt[s] = 1;
	vector<pair<long long, int> > st;
	for (int i=0;i<N;i++) st.push_back({dist[i],i});
	sort(st.begin(),st.end());
	for (auto &p : st){
		int x = p.second;
		for (auto &p : G[x]){
			int y = p.first, c = p.second;
			if (dist[y] == dist[x] + c) cnt[y] = (cnt[y] + cnt[x]) % mod;
		}
	}
	return {dist, cnt};
}

int main()
{
	scanf ("%d %d %d %d",&N,&M,&S,&T); S--; T--;
	for (int i=0;i<M;i++){
		int x,y,c; scanf ("%d %d %d",&x,&y,&c); x--; y--;
		G[x].push_back({y,c});
		G[y].push_back({x,c});
	}

	auto p = dist(S);
	auto q = dist(T);

	long long u = p.first[T];
	long long ans = p.second[T]; ans = ans * ans % mod;
	if (u % 2 == 0) for (int i=0;i<N;i++){
		if (p.first[i] == u / 2 && q.first[i] == u / 2){
			long long now = p.second[i] * q.second[i] % mod;
			ans = (ans + mod - now * now % mod) % mod;
		}
	}

	vector<bool> can(N);
	for (int i=0;i<N;i++) if (p.first[i] + q.first[i] == u) can[i] = 1;
	for (int i=0;i<N;i++) if (can[i] && p.first[i] < u/2){
		for (auto &e : G[i]){
			int j = e.first;
			if (can[j] && q.first[j] < u/2 && p.first[i] + e.second + q.first[j] == u){
				long long now = p.second[i] * q.second[j] % mod;
				ans = (ans + mod - now * now % mod) % mod;
			}
		}
	}
	printf ("%lld\n",ans);


	return 0;
}

Compiler output:
a.cc: In function 'std::pair<std::vector<long long int>, std::vector<long long int> > dist(int)':
a.cc:33:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   33 |         sort(st.begin(),st.end());
      |         ^~~~
      |         short
Language: C++

#include <queue>
#include <vector>
#include <iostream>
using namespace std;
const int mod = 1000000007;
struct edge { int to, cost; };
struct state { int pos; long long cost; };
bool operator<(const state& s1, const state& s2) { return s1.cost > s2.cost; };
int N, M, S, T, a[200009], b[200009], c[200009]; vector<edge> g[100009];
vector<long long> shortest_path(int start) {
	vector<long long> res(N, 1LL << 60); res[start] = 0;
	priority_queue<state> que; que.push(state{ start, 0 });
	while (!que.empty()) {
		int pos = que.top().pos; que.pop();
		for (edge e : g[pos]) {
			if (res[e.to] > res[pos] + e.cost) {
				res[e.to] = res[pos] + e.cost;
				que.push(state{ e.to, res[e.to] });
			}
		}
	}
	return res;
}
vector<int> calc(int start, vector<long long> dist) {
	vector<int> res(N), p(N); res[start] = 1;
	for (int i = 0; i < N; i++) p[i] = i;
	sort(p.begin(), p.end(), [&](int i, int j) { return dist[i] < dist[j]; });
	for (int i = 1; i < N; i++) {
		for (edge e : g[p[i]]) {
			if (dist[e.to] + e.cost == dist[p[i]]) {
				res[p[i]] += res[e.to];
				if (res[p[i]] >= mod) res[p[i]] -= mod;
			}
		}
	}
	return res;
}
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> N >> M >> S >> T; S--, T--;
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i] >> c[i]; a[i]--, b[i]--;
		g[a[i]].push_back(edge{ b[i], c[i] });
		g[b[i]].push_back(edge{ a[i], c[i] });
	}
	vector<long long> ds = shortest_path(S);
	vector<long long> dt = shortest_path(T);
	vector<int> cs = calc(S, ds);
	vector<int> ct = calc(T, dt);
	int ret = 0;
	for (int i = 0; i < N; i++) {
		if (ds[i] * 2 == ds[T] && dt[i] * 2 == ds[T]) {
			ret = (ret + 1LL * cs[i] * cs[i] % mod * ct[i] % mod * ct[i]) % mod;
		}
	}
	for (int i = 0; i < M; i++) {
		if (ds[a[i]] + dt[b[i]] + c[i] == ds[T] && ds[a[i]] * 2 < ds[T] && dt[b[i]] * 2 < ds[T]) {
			ret = (ret + 1LL * cs[a[i]] * cs[a[i]] % mod * ct[b[i]] % mod * ct[b[i]]) % mod;
		}
		if (ds[b[i]] + dt[a[i]] + c[i] == ds[T] && ds[b[i]] * 2 < ds[T] && dt[a[i]] * 2 < ds[T]) {
			ret = (ret + 1LL * cs[b[i]] * cs[b[i]] % mod * ct[a[i]] % mod * ct[a[i]]) % mod;
		}
	}
	cout << (1LL * cs[T] * cs[T] - ret + mod) % mod << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'std::vector<int> calc(int, std::vector<long long int>)':
a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |         sort(p.begin(), p.end(), [&](int i, int j) { return dist[i] < dist[j]; });
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;

ll modpow(ll a, ll b, ll m = mod) {
	ll ans = 1;
	a %= m;
	while (b) {
		if (b & 1) ans = ans * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return ans;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll s;
	cin >> s;
	ll ans = s / 7;
	vector<ll> vec;
	for (int i = 1; i * i <= s; i++) {
		if (s % i == 0) {
			if (i >= 7) vec.pb(i);
			if (s / i >= 7 && i != s / i) vec.pb(s / i);
		}
	}
	for (int i : vec) {
		ans--;
		ans += 9 * modpow(10, i - 1) % mod;
		ans -= s / i - 1;
		ans %= mod;
	}
	vector<ll> cnt = { 0,9,90,900,9000,90000,900000,9000000,90000000 };
	for (int i = 1; i <= 6; i++) {
		for (int j = i; j <= 8; j++) {
			if (i == j) {
				if (s > 0 && s % i == 0) {
					ll rem = s / i;
					if (rem <= cnt[i]) ans += cnt[i] - rem + 1;
				}
			}
			else {
				for (ll x = 1; x <= cnt[i]; x++) {
					ll t = s;
					t -= x * i;
					for (int k = i + 1; k < j; k++) {
						t -= cnt[k] * k;
					}
					if (t > 0 && t % j == 0) {
						ll rem = t / j;
						if (rem <= cnt[j]) {
							ans++;
						}
					}
				}
			}
		}
	}
	ans %= mod;
	if (ans < 0) ans += mod;
	cout << ans << '\n';
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#define pb push_back
 
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
 
const int mod = 1e9 + 7;
 
ll S, mul = 9, cnt, ans;
int pref[15000005];
bool ck[100000005];
 
ll binpw(ll base, ll pw){
	ll ans = 1;
	while(pw){
		if(pw & 1) ans = (ans * base) % mod;
		base = (base * base) % mod;
		pw >>= 1;
	}
	return ans;
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin >> S;
	ck[0] = 1;
	for(int i = 1; i <= 7; i++){
		for(int j = 1; j <= mul; j++){
			++cnt;
			pref[cnt] = pref[cnt - 1] + i;
			ans += (pref[cnt] >= S && ck[pref[cnt] - S]);
			ck[pref[cnt]] = 1;
		}
		mul *= 10;
	}
	//cout << "OK\n";
	int pos = -1;
	int temp = pref[cnt];
	for(int i = 1; temp <= (S + 100000000); i++){
		temp += 8;
		ans += (temp >= S && ck[temp - S]);
	}
	//cout << ans << "\n";
	for(int i = (S - 1) / 8; i >= 1; i--){
		if(!(S % i)){
			ll tmp = S / i, tmp2 = binpw(10, tmp - 1) * 9;
			//cout << tmp << " " << tmp2 % mod << "\n";
			//if(tmp2 < i) continue;
			//cout << ans << " " << tmp2 << "\n";
			ans = (ans + tmp2 - i + 1 + mod) % mod;
		}
		else{
			ans++;
			if(ans >= mod) ans -= mod;
		}
	}
	if(!(S % 8)){
		ans += 90000000 - S / 8;
		//cout << 90000000 - S / 8 + 1 << "\n";
		//if(ans >= mod) ans -= mod;
		if(ans >= mod) ans -= mod;
	}
	cout << ans;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.