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

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <set>
#include <algorithm>
#include <iostream>
using namespace std;

typedef double LD;
typedef long long LL;
typedef pair<int, int> PII;
#define MP make_pair
#define PB push_back
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i,0,t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())

const int MOD = 1000000007;
const int INF = 1000007;
const LL LINF = 1LL * INF * INF;
const int MAXN = 100007;
const LD EPS = 1e-12;

bool used[MAXN], visited[MAXN];
int X[MAXN], mn, mx;
vector <int> g[MAXN];

void dfs(int v)
{
	visited[v] = true;
	mn = min(mn, X[v]);
	mx = max(mx, X[v]);
	REP(i, SZ(g[v]))
	{
		int to = g[v][i];
		if (!visited[to])
			dfs(to);
	}
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	int n, m;
	bool ok = true;
	cin >> n >> m;
	REP(i, m)
	{
		int l, r, d;
		cin >> l >> r >> d;
		g[l].push_back(r);
		g[r].push_back(l);
		if (used[l])
		{
			if (used[r])
			{
				if (X[r] - X[l] != d)
					ok = false;
			}
			else
				X[r] = X[l] + d;
		}
		else
			X[l] = X[r] - d;
		used[l] = used[r] = true;
	}
	FOR(i, 1, n + 1)
	{
		if (used[i] && !visited[i])
		{
			mn = INT_MAX;
			mx = INT_MIN;
			dfs(i);
			if (mn - mx > 1000000000)
				ok = false;
		}
	}
	cout << (ok ? "Yes" : "No");
	//cout << endl; system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:30: error: 'INT_MAX' was not declared in this scope
   75 |                         mn = INT_MAX;
      |                              ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <iostream>
  +++ |+#include <climits>
    8 | using namespace std;
a.cc:76:30: error: 'INT_MIN' was not declared in this scope
   76 |                         mx = INT_MIN;
      |                              ^~~~~~~
a.cc:76:30: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

const int maxn = 123456, maxm, oo = 1000000000;
int n, m, l[maxm], r[maxm], d[maxm], vis[maxn], v[maxn];
vector<pii> e[maxn];

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	F1 (i, m) cin >> l[i] >> r[i] >> d[i];
}

pair<int, int> dfs(int cur, int val)
{
	vis[cur] = true;
	v[cur] = val;
	int mx = val, mi = val;
	for (pii nxt : e[cur]) if (!vis[nxt.fi])
	{
		pii x = dfs(nxt.fi, val + nxt.se);
		mx = max(mx, x.fi);
		mi = min(mi, x.se);
	}
	return mp(mx, mi);
}

void solve()
{
	bool flag = true;
	F1 (i, m) e[l[i]].pb(mp(r[i], d[i]));
	F1 (i, m) e[r[i]].pb(mp(l[i], -d[i]));
	F1 (i, n) 
		if (!vis[i]) 
		{
			pii x = dfs(i, 0);
			if (x.fi - x.se > oo) flag = false;
		}
	F1 (i, m) if (v[r[i]] - v[l[i]] != d[i]) flag = false;
	if (flag) cout << "Yes\n";
	else cout << "No\n";
}

main()
{
	input();
	solve();
}


Compiler output:
a.cc:34:26: error: uninitialized 'const maxm' [-fpermissive]
   34 | const int maxn = 123456, maxm, oo = 1000000000;
      |                          ^~~~
a.cc:35:13: error: size of array 'l' is not an integral constant-expression
   35 | int n, m, l[maxm], r[maxm], d[maxm], vis[maxn], v[maxn];
      |             ^~~~
a.cc:35:22: error: size of array 'r' is not an integral constant-expression
   35 | int n, m, l[maxm], r[maxm], d[maxm], vis[maxn], v[maxn];
      |                      ^~~~
a.cc:35:31: error: size of array 'd' is not an integral constant-expression
   35 | int n, m, l[maxm], r[maxm], d[maxm], vis[maxn], v[maxn];
      |                               ^~~~
a.cc:75:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   75 | main()
      | ^~~~
Language: C++

8 13
4 2
7 3 9
6 2 3
1 6 4
7 6 9
3 8 9
1 2 2
2 8 12
8 6 9
2 5 5
4 2 18
5 3 7
5 1 515371567
4 8 6

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 8 13
      | ^
Language: C++

#include <SFML/Graphics.hpp>
#include <queue>
#include <iostream>
using namespace std;

struct node
{
	int data;
	node *left, *right, *parent; 
	sf::CircleShape shape; 
	sf::RectangleShape leftone;
	sf::RectangleShape rightone; 
}*root;
class Tree
{
public:
	Tree();
	void insert(int, node*, int, int, int, int);
	void Display(node*); 
	void inOrder(node*); 
	void PostOrder(node*); 
	void PreOrder(node*); 
	bool isEmpty(); 
	void Deletion(int); 
	node* SearchNode(int, node*); 
};
bool Tree::isEmpty()
{
	if (!root)
		return true;
	return false; 
}
Tree::Tree() { root = NULL; }
void Tree::insert(int data, node* Node = root, int x = 250, int y = 50, int a = 260, int b = 85)
{
	node* new_node = new node; 
	new_node->shape.setRadius(20);
	new_node->shape.setFillColor(sf::Color::Green);
	new_node->left = new_node->right = new_node->parent = NULL; 
	new_node->data = data; 
	new_node->shape.setPosition(sf::Vector2f(x, y));
	if (!root)
	{
		root = new_node;
		return; 
	}
	if (data >= Node->data)
	{
		if (Node->right)
			insert(data, Node->right, x + 50, y + 50, a + 50, b + 50); 
		else
		{
			Node->right = new_node;
			new_node->parent = Node; 
			new_node->shape.setPosition(sf::Vector2f((x + 50), (y + 50))); 
			new_node->parent->rightone.setSize(sf::Vector2f(50, 5)); 
			new_node->parent->rightone.setFillColor(sf::Color::Red);
			new_node->parent->rightone.setRotation(230);
			new_node->parent->rightone.setPosition(sf::Vector2f(a+50, b+40));
		}
	}
	else if (data < Node->data)
	{
		if (Node->left)
			insert(data, Node->left, x - 50, y + 50, a - 50, b + 50);
		else
		{
			Node->left = new_node; 
			new_node->parent = Node; 
			new_node->shape.setPosition(sf::Vector2f((x - 50), (y + 50)));
			new_node->parent->leftone.setSize(sf::Vector2f(50, 5));
			new_node->parent->leftone.setFillColor(sf::Color::Red);
			new_node->parent->leftone.setRotation(130);
			new_node->parent->leftone.setPosition(sf::Vector2f(a, b));
		}
	}
}
void Tree::Display(node* Root = root)
{
	if (!root)
	{
		cout << "Nothing to Display";
		return;
	}
	queue<node*> obj;
	obj.push(Root);
	while (!obj.empty())
	{
		node* temp = obj.front();
		window.draw(temp->shape);
		if (temp->left)
			window.draw(temp->leftone);
		if (temp->right)
			window.draw(temp->rightone); 
		//cout << temp->data << " ";
		obj.pop();
		if (temp->left)
			obj.push(temp->left);
		if (temp->right)
			obj.push(temp->right);
	}
	window.display();
}

int main()
{
	sf::CircleShape shape(100.f);
	shape.setFillColor(sf::Color::Green);
	int n; 
	Tree obj;
	while (window.isOpen())
	{
		cout << "Enter Number to Insert: "; 
		cin >> n;
		obj.insert(n); 
		sf::Event event;
		obj.Display(); 
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
				window.close();
		}

		window.clear();
	}

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: SFML/Graphics.hpp: No such file or directory
    1 | #include <SFML/Graphics.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define LL long long
#define dob complex<double>
#define Abs(a) ((a) < 0 ? (-(a)) : (a))
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Swap(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define writeln(x) (write(x), putchar('\n'))
#define lowbit(x) ((x)&(-(x)))
using namespace std;
const int N = 100000;
const int yzd = 1e9+7;
void read(int &x) {
    char ch; bool flag = 0;
    for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1); ch = getchar());
    for (x = 0; isdigit(ch); x = (x<<1)+(x<<3)+ch-48, ch = getchar());
    x *= 1-2*flag;
}
void print(int x) {if (x > 9) print(x/10); putchar(x%10+48); }
void write(int x) {if (x < 0) putchar('-'); print(Abs(x)); }
 
int n, m, s, t, u, v, c;
struct tt {int to, next, cost; }edge[(N<<2)+5];
int path[N+5], top;
int ans1[N+5], ans2[N+5], vis[N+5], in[N+5];
LL dist1[N+5], dist2[N+5];
queue<int>Q;
vector<int>to[N+5];
 
void add(int u, int v, int c) {
    edge[++top].to = v, edge[top].cost = c, edge[top].next = path[u], path[u] = top;
}
void SPFA(int s, LL *dist) {
    dist[s] = 0; Q.push(s); vis[s] = 1;
    while (!Q.empty()) {
    int u = Q.front(); Q.pop(); vis[u] = 0;
    for (int i = path[u]; i; i = edge[i].next)
        if (dist[edge[i].to] > dist[u]+edge[i].cost) {
        dist[edge[i].to] = dist[u]+edge[i].cost;
        if (!vis[edge[i].to]) {
            vis[edge[i].to] = 1; Q.push(edge[i].to);
        }
        }
    }
}
void topsort(int s, LL *dist, int *ans) {
    for (int u = 1; u <= n; u++) {
    to[u].clear();
    for (int i = path[u]; i; i = edge[i].next)
        if (dist[edge[i].to] == dist[u]+edge[i].cost) to[u].push_back(edge[i].to), ++in[edge[i].to];
    }
    ans[s] = 1; Q.push(s);
    while (!Q.empty()) {
    int u = Q.front(), size = to[u].size(); Q.pop();
    for (int i = 0; i < size; i++) {
        if (--in[to[u][i]] == 0) Q.push(to[u][i]); (ans[to[u][i]] += ans[u]) %= yzd;
    }
    }
}
void work() {
    read(n), read(m), read(s), read(t);
    for (int i = 1; i <= m; i++) {
    read(u), read(v), read(c); add(u, v, c); add(v, u, c);
    }
    memset(dist1, 127/3, sizeof(dist1));
    SPFA(s, dist1); topsort(s, dist1, ans1);
    memset(dist2, 127/3, sizeof(dist2));
    SPFA(t, dist2); topsort(t, dist2, ans2);
    int ans = 1ll*ans1[t]*ans1[t]%yzd;
    for (int u = 1; u <= n; u++) {
    if (dist1[u] == dist2[u] && dist2[u]*2 == dist1[t]) (ans -= 1ll*ans1[u]*ans1[u]%yzd*ans2[u]%yzd*ans2[u]%yzd) %= yzd;
    for (int i = path[u]; i; i = edge[i].next)
        if (dist1[u]+edge[i].cost+dist2[edge[i].to] == dist1[t] && dist1[u]*2 < dist1[t] && dist2[edge[i].to]*2 < dist1[t])
        (ans -= 1ll*ans1[u]*ans1[u]%yzd*ans2[edge[i].to]%yzd*ans2[edge[i].to]%yzd) %= yzd;
    }
    writeln((ans+yzd)%yzd);
}
int main() {
    work();
    return 0;
}

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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <iostream.h>
 
#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define repb(i, r, l) for (int i = r; i >= l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}
 
using namespace std;                                                                                  
 
mt19937 mrand(random_device{}()); 
const ll mod = 1e9 + 7;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
 
typedef pair < int , int > pii ;                                            
typedef pair < long long  , long long > pll ;

const int N = 3e5 + 123;

int n, m, k;
vector < pii > gr[N];
int a[N];
int dp1[N] , cnt1[N], dp2[N], cnt2[N] , w[N] , v[N] , u[N];

main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int s , t;
	cin >> n >> m >> s >> t;

	rep(i , 1 , n)
		dp1[i] = dp2[i] = 1e17;
	dp1[s] = dp2[t] = 0;
	cnt1[s] = cnt2[t] = 1;
	
	for(int i = 1; i <= m; i++){
		cin >> u[i] >> v[i] >> w[i];
		gr[u[i]].pb({v[i],w[i]});
		gr[v[i]].pb({u[i],w[i]});
	}
	set < pii > st;
	st.insert({0 , s});
	
	while(sz(st) != 0){
		int u = (*st.begin()).se;
		st.erase(st.begin());
		for(auto to : gr[u]){
			if(dp1[to.fi] == dp1[u] + to.se)
				cnt1[to.fi] += cnt1[u], cnt1[to.fi] %= mod;
			else if(dp1[to.fi] > dp1[u] + to.se){
				st.erase({dp1[to.fi] , to.fi});
				dp1[to.fi] = dp1[u] + to.se;
				cnt1[to.fi] = cnt1[u];
                st.insert({dp1[to.fi],to.fi});
			}
		}
	}    

	st.insert({0 , t});
	while(sz(st) != 0){
		int u = (*st.begin()).se;
		st.erase(st.begin());
		for(auto to : gr[u]){
			if(dp2[to.fi] == dp2[u] + to.se)
				cnt2[to.fi] += cnt2[u] , cnt2[to.fi] %= mod;
			else if(dp2[to.fi] > dp2[u] + to.se){
				st.erase({dp2[to.fi] , to.fi});
				dp2[to.fi] = dp2[u] + to.se;
				cnt2[to.fi] = cnt2[u];
                st.insert({dp2[to.fi],to.fi});
			}
		}
	}	
	int tot = cnt1[t] * cnt1[t]%mod;
	for(int i = 1; i <= m; i++){
		if(dp1[u[i]] + dp2[v[i]] > dp2[u[i]] + dp1[v[i]])
			swap(u[i],v[i]);
		if(dp1[u[i]] + dp2[v[i]] + w[i] == dp1[t]){
			int l = max(dp1[u[i]],dp2[v[i]]) , r = min(dp1[u[i]],dp2[v[i]])+w[i];
			if(l < r)
				tot -= cnt1[u[i]] * cnt2[v[i]] % mod * cnt1[u[i]] % mod * cnt2[v[i]] % mod , tot += mod , tot %= mod;
		}
	}

	for(int i = 1; i <= n; i++)
		if(dp1[i] + dp2[i] == dp1[t] and dp1[i] == dp2[i])
			tot -= cnt1[i] * cnt2[i] % mod * cnt1[i] %mod * cnt2[i] % mod , tot += mod , tot %= mod;


	ret(tot);
        
}

Compiler output:
a.cc:7:10: fatal error: iostream.h: No such file or directory
    7 | #include <iostream.h>
      |          ^~~~~~~~~~~~
compilation terminated.
Language: Java

import java.io.*; 
  
class Gift  
{ 
    static void point(int a, int b, int c, int d, int n) 
    { 
        int x , flag = 0; 
  
        for (int i = 0; i < n; i++) 
        { 
              
        
            x = b + i * a;  
              
        
            if ((x - d) % c == 0 && x - d >= 0) 
            { 
                System.out.println( x ) ; 
                flag = 1; 
                break; 
            } 
          
        } 
      
 
        if(flag == 0) 
        { 
            System.out.println ("No collision point"); 
        } 
      
          
    }

Compiler output:
Main.java:32: error: reached end of file while parsing
    }
     ^
1 error
Language: C

using namespace std;
bool cmp(int x,int y)
{
    return x>y;
}
int main()
{
    int n,sum=0;
    scanf("%d",&n);
    int a[2][101],b[101]={0},i,j;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[0][i]);
    }
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[1][i]);
    }
    sum=sum+a[0][0]+a[1][n-1];/ / Must pass the upper left corner and the lower right corner, so you can add in advance
    for(i=0;i<n-1;i++)//From the ith to the second line
    {
        for(j=i;j<n-1;j++)
        {
            b[i]=b[i]+a[1][j];/ / Add the second line of data
        }
        for(j=0;j<i;j++)
        {
            b[i]=b[i]+a[0][j+1];/ / Add the first line of data
        }
    }
    sort(b,b+(n-1),cmp);
    sum=sum+b[0];//Plus and the data of the largest road
    printf("%d\n",sum);
    return 0;
}

Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using namespace std;
      | ^~~~~
main.c:1:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    1 | using namespace std;
      |                 ^~~
main.c:2:1: error: unknown type name 'bool'
    2 | bool cmp(int x,int y)
      | ^~~~
main.c:1:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
  +++ |+#include <stdbool.h>
    1 | using namespace std;
main.c: In function 'main':
main.c:9:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | using namespace std;
main.c:9:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 |     scanf("%d",&n);
      |     ^~~~~
main.c:9:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:19:31: error: expected expression before '/' token
   19 |     sum=sum+a[0][0]+a[1][n-1];/ / Must pass the upper left corner and the lower right corner, so you can add in advance
      |                               ^
main.c:33:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   33 |     printf("%d\n",sum);
      |     ^~~~~~
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C


#include<bits/stdc++.h>
#include<cmath>
 
#define mem(a,b) memset(a,b,sizeof a);
#define INF 0x3f3f3f3f
#define MOD 1000000007
 
using namespace std;
 
typedef long long ll;
 
const int maxn=600010;
 
int n,m;
int adl[maxn], mdl[maxn], col[maxn], row[maxn];
 
int main()
{
    int k,sx,sy,dx,dy,x,y;
    while(~scanf("%d",&n) && n)
    {
        mem(adl,0); mem(mdl,0); mem(col,0); mem(row,0);
        scanf("%d",&m);
        while(m--)
        {
            scanf("%d%d%d%d%d",&k,&sx,&sy,&dx,&dy);
            for(int i=0;i<k;i++)
            {
                x=sx+dx*i, y=sy+dy*i;
                col[y]++;
                row[x]++;
                mdl[x+y]++;
                adl[n+x-y]++;
            }
        }
 
        ll rs=0;
        for(int i=0;i<2*n;i++)
        {
            if(col[i]>1) rs+=col[i]-1;
            if(row[i]>1) rs+=row[i]-1;
            if(mdl[i]>1) rs+=mdl[i]-1;
            if(adl[i]>1) rs+=adl[i]-1;
        }
 
        printf("%lld\n",rs);
    }
 
    return 0;
}

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

#include<bits/stdc++.h>
#include<cmath>
 
#define mem(a,b) memset(a,b,sizeof a);
#define INF 0x3f3f3f3f
#define MOD 1000000007
 
using namespace std;
 
typedef long long ll;
 
const int maxn=300;
 
int n,m,l;
ll rs;
int mp[maxn][maxn];
int xr[maxn], yr[maxn];
 
void jde(int x,int y)
{
    // up
    for(int i=x-1,f=1;i>=0 && f;i--)
        if(mp[i][y]==1) rs++, f=0;
 
    // up-right
    for(int i=x-1,j=y+1,f=1;i>=0 && j<=n && f;i--,j++)
        if(mp[i][j]==1) rs++, f=0;
 
    // right
    for(int j=y+1,f=1;j<=n && f;j++)
        if(mp[x][j]==1) rs++, f=0;
 
    // down-right
    for(int i=x+1,j=y+1,f=1;i<=n && j<=n && f;i++,j++)
        if(mp[i][j]==1) rs++, f=0;
 
    // down
    for(int i=x+1,f=1;i<=n && f;i++)
        if(mp[i][y]==1) rs++, f=0;
 
    // down-left
    for(int i=x+1,j=y-1,f=1;i<=n && j>=0 && f;i++,j--)
        if(mp[i][j]==1) rs++, f=0;
 
    // left
    for(int j=y-1,f=1;j>=0 && f;j--)
        if(mp[x][j]==1) rs++, f=0;
 
    // up-left
    for(int i=x-1,j=y-1,f=1;i>=0 && j>=0 && f;i--,j--)
        if(mp[i][j]==1) rs++, f=0;
}
 
void fun()
{
    int x,y;
    for(int i=0;i<l;i++)
        jde(xr[i],yr[i]);
}
 
int main()
{
    int sp,sx,sy,dx,dy;
    while(~scanf("%d",&n) && n)
    {
        scanf("%d",&m); mem(mp,0); rs=l=0;
        while(m--)
        {
            scanf("%d%d%d%d%d",&sp,&sx,&sy,&dx,&dy);
            mp[sx][sy]=1; sp--; xr[l]=sx, yr[l]=sy, l++;
            while(sp--) mp[sx+=dx][sy+=dy]=1, xr[l]=sx, yr[l]=sy, l++;
        }
 
        fun();
        printf("%lld\n",rs/2);
    }
 
    return 0;


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

#include<bits/stdc++.h>
#include<cmath>
 
#define mem(a,b) memset(a,b,sizeof a);
#define INF 0x3f3f3f3f
#define MOD 1000000007
 
using namespace std;
 
typedef long long ll;
 
const int maxn=300;
 
int n,m,l;
ll rs;
int mp[maxn][maxn];
int xr[maxn], yr[maxn];
 
void jde(int x,int y)
{
    // up
    for(int i=x-1,f=1;i>=0 && f;i--)
        if(mp[i][y]==1) rs++, f=0;
 
    // up-right
    for(int i=x-1,j=y+1,f=1;i>=0 && j<=n && f;i--,j++)
        if(mp[i][j]==1) rs++, f=0;
 
    // right
    for(int j=y+1,f=1;j<=n && f;j++)
        if(mp[x][j]==1) rs++, f=0;
 
    // down-right
    for(int i=x+1,j=y+1,f=1;i<=n && j<=n && f;i++,j++)
        if(mp[i][j]==1) rs++, f=0;
 
    // down
    for(int i=x+1,f=1;i<=n && f;i++)
        if(mp[i][y]==1) rs++, f=0;
 
    // down-left
    for(int i=x+1,j=y-1,f=1;i<=n && j>=0 && f;i++,j--)
        if(mp[i][j]==1) rs++, f=0;
 
    // left
    for(int j=y-1,f=1;j>=0 && f;j--)
        if(mp[x][j]==1) rs++, f=0;
 
    // up-left
    for(int i=x-1,j=y-1,f=1;i>=0 && j>=0 && f;i--,j--)
        if(mp[i][j]==1) rs++, f=0;
}
 
void fun()
{
    int x,y;
    for(int i=0;i<l;i++)
        jde(xr[i],yr[i]);
}
 
int main()
{
    int sp,sx,sy,dx,dy;
    while(~scanf("%d",&n) && n)
    {
        scanf("%d",&m); mem(mp,0); rs=l=0;
        while(m--)
        {
            scanf("%d%d%d%d%d",&sp,&sx,&sy,&dx,&dy);
            mp[sx][sy]=1; sp--; xr[l]=sx, yr[l]=sy, l++;
            while(sp--) mp[sx+=dx][sy+=dy]=1, xr[l]=sx, yr[l]=sy, l++;
        }
 
        fun();
        printf("%lld\n",rs/2);
    }
 
    return 0;
}

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

#include<bits/stdc++.h>
 2 #define F(i,a,b) for(int i=(a);i<=(b);++i)
 3 #define eF(i,u) for(int i=h[u];i;i=nxt[i])
 4 #define Mod 1000000007
 5 using namespace std;
 6 typedef long long ll;
 7 typedef pair<ll,int> pli;
 8 
 9 int n,m,S,T;
10 ll Ans;
11 int U[200001],V[200001],D[200001];
12 int h[100001],nxt[400001],to[400001],w[400001],tot;
13 void ins(int x,int y,int z){nxt[++tot]=h[x];to[tot]=y;w[tot]=z;h[x]=tot;}
14 
15 ll d1[100001],d2[100001],g1[100001],g2[100001];bool v1[100001],v2[100001];
16 priority_queue<pli,vector<pli>,greater<pli> > pq;
17 
18 void Dij(ll*d,ll*g,bool*v,int s){
19     d[s]=0ll;
20     pq.push(pli(0ll,s));
21     g[s]=1;
22     while(!pq.empty()){
23         pli P=pq.top(); pq.pop();
24         int u=P.second; ll du=P.first;
25         if(v[u]||d[u]<du) continue;
26         v[u]=1;
27         eF(i,u){
28             if(d[to[i]]==du+w[i])
29                 g[to[i]]=(g[to[i]]+g[u])%Mod;
30             if(d[to[i]]>du+w[i])
31                 g[to[i]]=g[u],
32                 d[to[i]]=du+w[i], pq.push(pli(d[to[i]],to[i]));
33         }
34     }
35 }
36 
37 int main(){
38     int x,y,z;
39     scanf("%d%d",&n,&m);
40     scanf("%d%d",&S,&T);
41     F(i,1,m) scanf("%d%d%d",&x,&y,&z), ins(x,y,z), ins(y,x,z), U[i]=x, V[i]=y, D[i]=z;
42     memset(d1,0x3f,sizeof d1);
43     Dij(d1,g1,v1,S);
44     memset(d2,0x3f,sizeof d2);
45     Dij(d2,g2,v2,T);
46     ll Dist=d1[T];
47     Ans=g1[T]*g1[T]%Mod;
48     F(i,1,n){
49         if(d1[i]+d2[i]==Dist&&d1[i]==d2[i])
50             Ans=(Ans-g1[i]*g1[i]%Mod*g2[i]%Mod*g2[i]%Mod)%Mod;
51     }
52     int u,v,d;
53     F(i,1,m){
54         u=U[i], v=V[i], d=D[i];
55         if(d1[u]+d+d2[v]==Dist && d1[u]+d>d2[v] && d2[v]+d>d1[u]){
56             Ans=(Ans-g1[u]*g2[v]%Mod*g1[u]%Mod*g2[v]%Mod)%Mod;
57         }
58         u=V[i], v=U[i], d=D[i];
59         if(d1[u]+d+d2[v]==Dist && d1[u]+d>d2[v] && d2[v]+d>d1[u]){
60             Ans=(Ans-g1[u]*g2[v]%Mod*g1[u]%Mod*g2[v]%Mod)%Mod;
61         }
62     }
63     printf("%lld",(Ans%Mod+Mod)%Mod);
64     return 0;
65 }

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

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int N,M,S,T,u,v,d;
vector<pair<int,int> >G[1<<17];
long mod=1e9+7,a[1<<17],b[1<<17],c[1<<17],d[1<<17];
priority_queue<pair<long,int> >P;
void calc(int S,long*d,long*w)
{
	for(int i=w[S]=1;i<=N;)d[i++]=-1e18;
	P.push({d[S]=0,S});
	while(P.size())
	{
		long c=P.top().first,u=P.top().second;
		P.pop();
		if(d[u]==c)for(pair<int,int>p:G[u])
		{
			long v=p.first,nxt=c-p.second;
			if(d[v]<nxt)w[v]=w[u],P.push({d[v]=nxt,v});
			else if(d[v]==nxt)(w[v]+=w[u])%=mod;
		}
	}
}
main()
{
	cin>>N>>M>>S>>T;
	for(int i=0;i<M;i++)
	{
		cin>>u>>v>>d;
		G[u].push_back({v,d});
		G[v].push_back({u,d});
	}
	calc(S,a,b);
	calc(T,c,d);
	long ans=b[T]*b[T],dt=a[T];;
	for(int i=0;i++<N;)
	{
		if(2*a[i]==dt)ans-=b[i]*b[i]%mod*d[i]%mod*d[i]%mod;
		for(pair<int,int>p:G[i])if(2*a[i]>dt&&2*a[v=p.first]<dt&&a[i]+c[v]-p.second==dt)ans-=b[i]*b[i]%mod*d[v]%mod*d[v]%mod;
	}
	cout<<(ans+mod)%mod<<endl;
}


Compiler output:
a.cc:8:43: error: conflicting declaration 'long int d [131072]'
    8 | long mod=1e9+7,a[1<<17],b[1<<17],c[1<<17],d[1<<17];
      |                                           ^
a.cc:6:17: note: previous declaration as 'int d'
    6 | int N,M,S,T,u,v,d;
      |                 ^
a.cc:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:36:18: error: invalid conversion from 'int' to 'long int*' [-fpermissive]
   36 |         calc(T,c,d);
      |                  ^
      |                  |
      |                  int
a.cc:10:29: note:   initializing argument 3 of 'void calc(int, long int*, long int*)'
   10 | void calc(int S,long*d,long*w)
      |                        ~~~~~^
a.cc:40:51: error: invalid types 'int[int]' for array subscript
   40 |                 if(2*a[i]==dt)ans-=b[i]*b[i]%mod*d[i]%mod*d[i]%mod;
      |                                                   ^
a.cc:40:60: error: invalid types 'int[int]' for array subscript
   40 |                 if(2*a[i]==dt)ans-=b[i]*b[i]%mod*d[i]%mod*d[i]%mod;
      |                                                            ^
a.cc:41:117: error: invalid types 'int[int]' for array subscript
   41 |                 for(pair<int,int>p:G[i])if(2*a[i]>dt&&2*a[v=p.first]<dt&&a[i]+c[v]-p.second==dt)ans-=b[i]*b[i]%mod*d[v]%mod*d[v]%mod;
      |                                                                                                                     ^
a.cc:41:126: error: invalid types 'int[int]' for array subscript
   41 |                 for(pair<int,int>p:G[i])if(2*a[i]>dt&&2*a[v=p.first]<dt&&a[i]+c[v]-p.second==dt)ans-=b[i]*b[i]%mod*d[v]%mod*d[v]%mod;
      |                                                                                                                              ^
Language: C++

import sys
readline = sys.stdin.readline

from heapq import heappop as hpp, heappush as hp
def dijkstra(N, s, Edge):
    inf = geta
    dist = [inf] * N
    dist[s] = 0
    Q = [(0, s)]
    dp = [0]*N
    dp[s] = 1
    while Q:
        dn, vn = hpp(Q)
        if dn > dist[vn]:
            continue
        for df, vf in Edge[vn]:
            if dist[vn] + df < dist[vf]:
                dist[vf] = dist[vn] + df
                dp[vf] = dp[vn]
                hp(Q, (dn + df,vf))
            elif dist[vn] + df == dist[vf]:
                dp[vf] = (dp[vf] + dp[vn]) % MOD
    return dist, dp

MOD = 10**9+7
N, M = map(int, readline().split())
S, T = map(int, readline().split())
S -= 1
T -= 1

geta = 10**15
Edge = [[] for _ in range(N)]
for _ in range(M):
    u, v, d = map(int, readline().split())
    u -= 1
    v -= 1
    Edge[u].append((d, v))
    Edge[v].append((d, u))
    

dists, dps = dijkstra(N, S, Edge)
distt, dpt = dijkstra(N, T, Edge)
st = dists[T]

onpath = [i for i in range(N) if dists[i] + distt[i] == st]

ans = dps[T]**2%MOD
for i in onpath:
    if 2*dists[i] == 2*distt[i] == st:
        ans = (ans - pow(dps[i]*dpt[i], 2, MOD))%MOD
    
    for cost,vf in Edge[i]:
        if dists[i]+cost+distt[vf] == st:
            if 2*dists[i] < st < 2*dists[vf]:
                ans = (ans - pow(dps[i]*dpt[vf], 2, MOD))%MOD
print(ans)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits\stdc++.h>
using namespace std; 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define ll long long
#define pb push_back
const ll mod=1e9+7;
#define rep(i,a,b) for(int i=a;i<=b;i++)
struct P
{
	ll dis;
	int poi;
	P(ll d,int p)
	{
		dis=d;
		poi=p;
	}
};
int n;
vector<pair<int,ll> >E[200005];
vector<int>E2[200005];
bool operator <(const struct P &a,const struct P &b)
{
	return a.dis>b.dis;
}
ll add(ll a,ll b)
{
	return ((a%mod)+(b%mod))%mod;
}
ll app(ll a,ll b)
{
	return ((a%mod)*(b%mod))%mod;
}
bool vis[200005];
ll dis[200005];
bool on[200005];
void dij(int s)
{
	fill(dis,dis+n+1,1e18);
	memset(vis,false,sizeof(vis));
	memset(on,false,sizeof(on));
	priority_queue<struct P>q;
	dis[s]=0;
	q.push(P{0,s});
	while(!q.empty())
	{
		int u=q.top().poi;
		//cout<<u<<"?"<<endl;
		q.pop();
		if(vis[u])continue;
		vis[u]=true;
		rep(i,0,E[u].size()-1)
		{
			int v=E[u][i].first;
			ll w=E[u][i].second;
			if(w+dis[u]<dis[v])
			{
				dis[v]=dis[u]+w;
				q.push(P{dis[v],v});
			}
		}
	}
}

void dfs(int u,int fa)
{
	if(on[u])return; 
	on[u]=true;
	//cout<<u<<"!"<<endl;
	rep(i,0,E[u].size()-1)
	{
		int v=E[u][i].first;
		ll w=E[u][i].second;
		if(v==fa)continue;
		if(dis[v]==dis[u]-w)
		{
			E2[u].pb(v);
			E2[v].pb(u);
			//cout<<u<<" "<<v<<endl;
			dfs(v,u);
		}
	}
}
int dp[200005][2];
bool vis2[200005];
void bfs(int u,int fg)
{
	memset(vis2,false,sizeof(vis2));
	queue<int>q;
	q.push(u);
	dp[u][fg]=1;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		if(vis2[u])continue;
		vis2[u]=1;
		rep(i,0,E2[u].size()-1)
		{
			int v=E2[u][i];
			if(!fg&&dis[v]<dis[u])continue;
			if(fg&&dis[v]>dis[u])continue;
			//if(!fg)cout<<u<<" 11 "<<v<<endl;
			dp[v][fg]=add(dp[v][fg],dp[u][fg]);	
			q.push(v);
		}
		
	}
}
pair<int,int> bian[200005];
int main(int argc, char** argv) {
	int m,s,t;
	cin>>n>>m>>s>>t;
	rep(i,1,m)
	{
		int l,r;
		ll w;
		scanf("%d%d%lld",&l,&r,&w);
		E[l].pb({r,w});
		E[r].pb({l,w});
		bian[i]={l,r};
	}
	dij(s);//cout<<dis[t]<<endl;
	dfs(t,-1);
	bfs(s,0);
	bfs(t,1);
	ll ans=0;
	//cout<<dp[t][0]<<"!!"<<endl;
	if(dis[t]%2==0)
	rep(i,1,n)
	{
		if(on[i]&&dis[i]==dis[t]/2)
		{
		//	cout<<dp[i][0]<<"?"<<" "<<dp[i][1]<<endl;
			ans=add(ans,app(dp[i][0],dp[i][1]));
		}
	}
	rep(i,1,m)
	{
		int l=bian[i].first;
		int r=bian[i].second;
		if(!on[l]||!on[r])continue;
		if(dis[l]>dis[r])swap(l,r);
		
		if(dis[l]<dis[t]/2&&dis[r]>dis[t]/2)
		{//cout<<l<<"!? "<<r<<" "<<dis[l]<<" "<<dis[r]<<endl;
			ans=add(ans,app(dp[l][0],dp[r][1]));
		}
	}
	ll f=dp[t][0];
	f=app(dp[t][0],dp[t][0]);
	cout<<add(f,mod-ans);
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
long long d1[N];
long long d2[N];
long long dp1[N];
long long dp2[N];

vector<pair<long long, long long>> graph[N];
long long n, m;
long long s, t;
long long ans;

void solver(long long v, long long dp[N], long long d[N])
{
	set<pair<long long, long long>> s;
	d[v] = 0;
	dp[v] = 1;
	s.insert({d[v], v});
	while (s.size())
	{
		v = (*s.begin()).second;
		s.erase(s.begin());
		for (auto nei: graph[v])
		{
			long long u = nei.first;
			long long w = nei.second;
			if (d[u] == d[v] + w)
			{
				dp[u] += dp[v];
				dp[u] = dp[u] % mod;
			}
			if (d[u] > d[v] + w)
			{
				s.erase({d[u], u});
				d[u] = d[v] + w;
				dp[u] = dp[v];
				dp[u] = dp[u] % mod;
				s.insert({d[u], u});
			}
		}
	}
} 

int main() 
{
	cin >> n >> m >> s >> t;
	s--;
	t--;
	for (long long i = 0; i < m; i++)
	{
		long long u , v, w;
		cin >> u >> v >> w;
		graph[u - 1].push_back({v - 1, w});
		graph[v - 1].push_back({u - 1, w});
	}
	memset(d1, 127, sizeof d1);
	memset(d2, 127, sizeof d2);
	solver(s, dp1, d1);
	solver(t, dp2, d2);
	long long dist = dp1[t] % mod;
	ans = (dist * dist) % mod;
	for (long long i = 0; i < n; i++)
	{
		for (long long j = 0; j < graph[i].size(); j++)
		{
			long long u = graph[i][j].first;
			long long w = graph[i][j].second;
			if (d1[i] <= d1[t] / 2 && d2[u] <= d1[t] / 2 && d1[i] + d2[u] + w == d1[t])
			{
				ans -= (((dp1[i] * dp1[i]) % mod) * ((dp2[u] * dp2[u]) % mod)) % mod;
			}
		}
		if (d1[i] == d2[i] && d1[i] == dist / 2)
		{
			ans -= (((dp1[i] * dp1[i]) % mod) * ((dp2[i] * dp2[i]) % mod)) % mod;
		}
	}
	cout << ((ans % mod) + mod) % mod << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:73:9: error: 'memset' was not declared in this scope
   73 |         memset(d1, 127, sizeof d1);
      |         ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<numeric>
  +++ |+#include <cstring>
   15 |
Language: C++

//#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
long long d1[N];
long long d2[N];
long long dp1[N];
long long dp2[N];

vector<pair<long long, long long>> graph[N];
long long n, m;
long long s, t;
long long ans;

void solver(long long v, long long dp[N], long long d[N])
{
	set<pair<long long, long long>> s;
	d[v] = 0;
	dp[v] = 1;
	s.insert({d[v], v});
	while (s.size())
	{
		v = (*s.begin()).second;
		s.erase(s.begin());
		for (auto nei: graph[v])
		{
			long long u = nei.first;
			long long w = nei.second;
			if (d[u] == d[v] + w)
			{
				dp[u] += dp[v];
				dp[u] = dp[u] % mod;
			}
			if (d[u] > d[v] + w)
			{
				s.erase({d[u], u});
				d[u] = d[v] + w;
				dp[u] = dp[v];
				dp[u] = dp[u] % mod;
				s.insert({d[u], u});
			}
		}
	}
} 

int main() 
{
	cin >> n >> m >> s >> t;
	s--;
	t--;
	for (long long i = 0; i < m; i++)
	{
		long long u , v, w;
		cin >> u >> v >> w;
		graph[u - 1].push_back({v - 1, w});
		graph[v - 1].push_back({u - 1, w});
	}
	memset(d1, 127, sizeof d1);
	memset(d2, 127, sizeof d2);
	solver(s, dp1, d1);
	solver(t, dp2, d2);
	long long dist = dp1[t] % mod;
	ans = (dist * dist) % mod;
	for (long long i = 0; i < n; i++)
	{
		for (long long j = 0; j < graph[i].size(); j++)
		{
			long long u = graph[i][j].first;
			long long w = graph[i][j].second;
			if (d1[i] < d1[t] / 2 && d2[u] < d1[t] / 2 && d1[i] + d2[u] + w == d1[t])
			{
				ans -= (((dp1[i] * dp1[i]) % mod) * ((dp2[u] * dp2[u]) % mod)) % mod;
			}
		}
		if (d1[i] == d2[i] && d1[i] == dist / 2)
		{
			ans -= (((dp1[i] * dp1[i]) % mod) * ((dp2[i] * dp2[i]) % mod)) % mod;
		}
	}
	cout << ans << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:73:9: error: 'memset' was not declared in this scope
   73 |         memset(d1, 127, sizeof d1);
      |         ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<numeric>
  +++ |+#include <cstring>
   15 |
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define next Next
#define int long long
const int mod=1e9+7;
const int N=4e5+5;
int n,m,S,T,sum,top,ans,x[N],y[N],z[N],dis[5][N],vis[N],gs[5][N],head[N];
struct E{
	int too,next,zh;
}edge[N*2];
struct node{
	int id,val;
};
bool operator < (node a,node b)
{
	return a.val>b.val;
}
void add(int a,int b,int c)
{
	edge[++top].too=b;edge[top].zh=c;
	edge[top].next=head[a];head[a]=top;
}
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
void dj(int s,int op)
{
	memset(dis[op],0x3f,sizeof(dis[op]));
	priority_queue<node>q;
	q.push((node){s,0});
	dis[op][s]=0;gs[op][s]=1;
	memset(vis,0,sizeof(vis));
	while(!q.empty())
	{
		int u=q.top().id;q.pop();
		if(vis[u])continue;
		vis[u]=1;
		for(int i=head[u];i;i=edge[i].next)
		{
			int v=edge[i].too,w=edge[i].zh;
			if(dis[op][v]>dis[op][u]+w)
			{
				dis[op][v]=dis[op][u]+w;
				gs[op][v]=g[op][u];
				q.push((node){v,dis[op][v]});
			}
			if(dis[op][v]==dis[op][u]+w)
			{
				gs[op][v]=(gs[op][v]+gs[op][u])%mod;
			}
		}
	}
}
signed main()
{
	n=read();m=read();
	S=read();T=read();
	for(int i=1;i<=m;i++)
	{
		x[i]=read(),y[i]=read(),z[i]=read();
		add(x[i],y[i],z[i]);
		add(y[i],x[i],z[i]);
	}
	dj(S,1);
	dj(T,2);
	if(dis[1][T]==0x3f3f3f3f3f3f3f3f){puts("0");return 0;}
	sum=dis[1][T];
	ans=gs[1][T]*gs[2][S]%mod;
//	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
	{
		if(dis[1][i]*2==sum&&dis[2][i]*2==sum)ans=(ans-gs[1][i]*gs[1][i]%mod*gs[2][i]%mod*gs[2][i]%mod+mod)%mod;
//		if(dis[2][i]+dis[1][i]==sum)ans=(ans-gs[2][i]*gs[1][i]%mod+mod)%mod;
//		cout<<ans<<endl;
	}
//	cout<<ans<<endl;
//	if(sum%2==1){cout<<ans<<endl;return 0;}
	for(int i=1;i<=m;i++)
	{
		int xu=(dis[2][y[i]]+z[i]-dis[1][x[i]])/2;
		if(dis[1][x[i]]+dis[2][y[i]]+z[i]==sum&&xu>0&&xu<z[i])ans=(ans-gs[1][x[i]]*gs[1][x[i]]%mod*gs[2][y[i]]%mod*gs[2][y[i]]%mod+mod)%mod;
		xu=(dis[1][y[i]]+z[i]-dis[2][x[i]])/2;
		if(dis[2][x[i]]+dis[1][y[i]]+z[i]==sum&&xu>0&&xu<z[i])ans=(ans-gs[2][x[i]]*gs[2][x[i]]%mod*gs[1][y[i]]%mod*gs[1][y[i]]%mod+mod)%mod;
	}
	cout<<ans;
}
/*
给出一张n个节点,m条边的无向图，给出起点s和终点t。询问两个人分别从s和t出发，走最短路不相遇的方案数。
最短路计数好题，减去不符合条件的。
不符合条件的，我们dis[s][x]+dis[t][x]=dis[s][t]
枚举在哪个点（边）相遇 
*/


Compiler output:
a.cc: In function 'void dj(long long int, long long int)':
a.cc:51:43: error: 'g' was not declared in this scope
   51 |                                 gs[op][v]=g[op][u];
      |                                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define INF 1007654321
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<typename U, typename V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

const int MOD = 1e9 + 7;

int main() {
    FAST_IO();
    int N, M; cin >> N >> M;
    int S, T; cin >> S >> T;
    vector<vector<pll>> adj(N);
    --S, --T;
    rep(i, M) {
        ll u, v, d; cin >> u >> v >> d;
        adj[u-1].push_back({v-1, 2*d});
        adj[v-1].push_back({u-1, 2*d});
    }
    // Dijkstra on S
    vector<ll> dist(N, LONG_MAX);
    priority_queue<pll, vector<pll>, greater<pll>> pq;
    dist[S] = 0;
    pq.push({dist[S], S});
    while(!pq.empty()) {
        ll here = pq.top().second;
        ll d = pq.top().first; pq.pop();
        if(d > dist[here]) continue;
        for(auto &e : adj[here]) {
            ll &next = e.first;
            if(dist[next] > dist[here] + e.second) {
                dist[next] = dist[here] + e.second;
                pq.push({dist[next], next});
            }
        }
    }
    ll D = dist[T] / 2;
    vector<pii> B;
    rep(u, N) {
        if(dist[u] == D) {
            B.push_back({u, u});
        } else {
            for(auto &e : adj[u]) {
                if(dist[u] < D && dist[e.first] > D) {
                    B.push_back({u, e.first});
                }
            }
        }
    }
    // calculate cnt(S, u), cnt(v, T)
    vector<int> cntS(N), cntT(N);
    cntS[S] = 1; cntT[T] = 1;
    vector<pll> sorted(N);
    rep(i, N) sorted[i] = {dist[i], i};
    sort(all(sorted));
    rep(i, N) {
        int j = sorted[i].second;
        for(auto &e : adj[j]) {
            if(dist[j] + e.second == dist[e.first]) {
                cntS[e.first] = (cntS[e.first] + cntS[j]) % MOD;    
            }
        }
    }
    rep(i, N) {
        int j = sorted[N - 1 - i].second;
        for(auto &e : adj[j]) {
            if(dist[j] - e.second == dist[e.first]) {
                cntT[e.first] = (cntT[e.first + cntT[j]) % MOD;
            }
        }
    }
    ll sum = 0, sq_sum = 0;
    for(auto &p : B) {
        ll Y = (cntS[p.first] * cntT[p.second]) % MOD;
        sum = (sum + Y) % MOD;
        sq_sum = (sq_sum + Y*Y%MOD) % MOD;
    }
    cout << (sum*sum%MOD - sq_sum + MOD) % MOD << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:56: error: expected ']' before ')' token
   79 |                 cntT[e.first] = (cntT[e.first + cntT[j]) % MOD;
      |                                                        ^
      |                                                        ]
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;
const ll MOD=1e9+7;
const int MAX_V=100000;
const ll INF=1e17;
struct edge {int to; ll cost;};
int V, M, S,T;
vector <edge> G[MAX_V];
ll d[2][MAX_V], n[2][MAX_V];
void dijkstra (int s, int k){
    priority_queue<P, vector<P>, greater<P>> que;
    auto itr=d[k];
    fill(itr,itr+V,INF);
    itr[s]=0;
    que.push(P(0,s));
    while (!que.empty()) {
        P p=que.top();  que.pop();
        int v=p.second;
        if (itr[v]<p.first) continue;
        rep(i,0,G[v].size()){
            edge e=G[v][i];
            if (itr[e.to]>itr[v]+e.cost){
                itr[e.to]=itr[v]+e.cost;
                que.push(P(itr[e.to], e.to));
            }
        }
    }
}
/*
void dfs(int s, int k){
    priority_queue<P, vector<P>, greater<P>> que;
    auto itr=d[k];
    auto N=n[k];
    N[s]=1;
    que.push(P(0,s));
    while (!que.empty()) {
        P p=que.top();  que.pop();
        int v=p.second;
        rep(i,0,G[v].size()){
            edge e=G[v][i];
            if (itr[e.to]==itr[v]+e.cost){
                que.push(P(itr[e.to], e.to));
                N[e.to]+=N[v];
                N[e.to]%=MOD;
            }
        }
    }
}*/
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>V>>M>>S>>T;
    S--; T--;
    rep(i,0,M){
        int u,v; ll D;
        cin>>u>>v>>D;
        u--; v--;
        G[u].pb(edge{v,D});
        G[v].pb(edge{u,D});
    }
    dijkstra(S,0); dijkstra(T, 1);
    dfs(S,0); dfs(T,1);
    ll D=d[0][T];
    ll ans=n[0][T]*n[0][T]%MOD;
    rep(i,0,V){
        if(d[0][i]*2==D){
            ans-=n[0][i]*n[0][i]%MOD*n[1][i]%MOD*n[1][i]%MOD;
            if(ans<0) ans+=MOD;
        }
    }
    rep(i,0,V){
        for(auto &e : G[i]){
            if(d[0][i]*2<D&&d[1][e.to]*2<D){
                ans-=n[0][i]*n[0][i]%MOD*n[1][e.to]%MOD*n[1][e.to]%MOD;
                if(ans<0) ans+=MOD;
            }
        }
    }
    cout <<ans<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   75 |     dfs(S,0); dfs(T,1);
      |     ^~~
      |     ffs
Language: C++

#include <bits/stdc++.h>

using namespace std;

uint64_t MOD = 1000000007;

#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(x) begin(x),end(x)

using Weight = int64_t;
Weight INF = 1000000000000000000ll;
struct Edge {
	int src, dest; Weight weight;
	bool operator < (const Edge &rhs) const { return weight > rhs.weight; }
};

using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int src, int dest, Weight weight) {
	g[src].push_back((Edge) { src, dest, weight });
}

// Dijkstra (Verified: AOJ2005)
void dijkstra(Graph &g, Array &d, int s) {
	d.assign(g.size(), INF);
	d[s] = 0;
	using P = pair<Weight, int>;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(P(0, s));
	while (!que.empty()) {
		Weight dist = que.top().first;
		int v = que.top().second;
		que.pop();
		if (d[v] < dist) continue;
		REP(i, g[v].size()) {
			Edge e = g[v][i];
			if (d[e.dest] > d[v] + e.weight) {
				d[e.dest] = d[v] + e.weight;
				que.push(P(d[e.dest], e.dest));
			}
		}
	}
}

int main() {
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	--s;
	--t;
	Graph g(n);
	REP(i, m) {
		int u, v, d;
		cin >> u >> v >> d;
		--u; --v;
		add_edge(g, u, v, d);
		add_edge(g, v, u, d);
	}
	Array d1;
	dijkstra(g, d1, s);
	Array d2;
	dijkstra(g, d2, t);
	Weight dist = d1[t];
	vector<pair<Weight, int>> v1;
	vector<pair<Weight, int>> v2;
	Graph mg1(n);
	Graph mg2(n);
	REP(i, n) {
		if (d1[i] + d2[i] == dist) {
			v1.emplace_back(d1[i], i);
			v2.emplace_back(d2[i], i);
			for (const auto& e : g[i]) {
				if (d1[e.dest] + d2[e.dest] == dist) {
					if (d1[i] + e.weitht == d1[e.dest]) {
						if (d1[e.dest] < d1[i]) {
							add_edge(mg1, e.src, e.dest, e.weight);
						}
						else {
							add_edge(mg2, e.src, e.dest, e.weight);
						}
					}
				}
			}
		}
	}
	sort(ALL(v1));
	sort(ALL(v2));
	vector<uint64_t> dp1(n, 0);
	vector<uint64_t> dp2(n, 0);
	dp1[s] = 1;
	dp2[t] = 1;
	REP(i, v1.size()) {
		if (!i) continue;
		Weight d;
		int j;
		tie(d, j) = v1[i];
		for (const auto& e : mg1[j]) {
			dp1[j] += dp1[e.dest];
			dp1[i] %= MOD;
		}
	}
	REP(i, v2.size()) {
		if (!i) continue;
		Weight d;
		int j;
		tie(d, j) = v2[i];
		for (const auto& e : mg2[j]) {
			dp2[j] += dp2[e.dest];
			dp2[i] %= MOD;
		}
	}
	uint64_t cnt = dp1[t] * dp1[t];
	cnt %= MOD;
	REP(i, n) {
		if (d1[i] + d2[i] == dist) {
			if (d1[i] == d2[i]) {
				uint64_t mul = dp1[i] * dp2[i];
				mul %= MOD;
				mul *= mul;
				mul %= MOD;
				cnt += MOD - mul;
				cnt %= MOD;
			}
			for (const auto& e : mg2[i]) {
				if (d1[i] * 2 < dist && d1[e.dest] * 2 > dist) {
					uint64_t mul = dp1[i] * dp2[e.dest];
					mul %= MOD;
					mul *= mul;
					mul %= MOD;
					cnt += MOD - mul;
					cnt %= MOD;
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:55: error: 'const struct Edge' has no member named 'weitht'; did you mean 'weight'?
   76 |                                         if (d1[i] + e.weitht == d1[e.dest]) {
      |                                                       ^~~~~~
      |                                                       weight