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

#include<iostream>
#include<queue>

using namespace std;
static const int N = 100000;
static const int INFTY =(1<<21);

int n, M[N][N];
int d[N];
int m;
int p[N];
int g[N];
int c;

void bfs(int s){
  queue<int> q;
  q.push(s);
  d[s]=0;
  p[s]=0;
  int u;
  while(!q.empty()){
    u = q.front(); q.pop();
    g[u]=1;
    for (int v=0;v<n;v++){
      if(M[u][v]==INFTY)continue;
      if((p[v]!=INFTY)&&(p[v]!=p[u]+M[u][v])){
        c=1;
      }
      p[v]=p[u]+M[u][v];
      if(d[v]!= INFTY)continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int k=0;k<n;k++){
    if(g[k]==0)bfs(k);
  }
}

int main(){
  int u,k,v;
  c=0;

  cin >>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)M[i][j]=INFTY;
  }

  cin >>m;
  for(int i=0;i<m;i++){
    cin >>u>>k>>v;
    u--;
    k--;
    M[u][k]=v;
    M[k][u]=(-v);
  }

  for(int i=0;i<n;i++)d[i]=INFTY;
  for(int j=0;j<n;j++)p[j]=INFTY;
  bfs(0);
  if(c==1){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


Compiler output:
/tmp/cc1yVkIJ.o: in function `bfs(int)':
a.cc:(.text+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x17e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x1be): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x1d5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/cc1yVkIJ.o
a.cc:(.text+0x1f3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>

using namespace std;
static const int N = 100000;
static const int INFTY =(1<<21);

int n, M[N][N];
int d[N];
int m;
int p[N];
int g[N];
int c;

void bfs(int s){
  queue<int> q;
  q.push(s);
  d[s]=0;
  p[s]=0;
  int u;
  while(!q.empty()){
    u = q.front(); q.pop();
    g[u]=1;
    for (int v=0;v<n;v++){
      if(M[u][v]==INFTY)continue;
      if((p[v]!=INFTY)&&(p[v]!=p[u]+M[u][v])){
        c=1;
      }
      p[v]=p[u]+M[u][v];
      if(d[v]!= INFTY)continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int k=0;k<n;k++){
    if(g[k]==0)bfs(k);
  }
}

int main(){
  int u,k,v;
  c=0;

  cin >>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)M[i][j]=INFTY;
  }

  cin >>m;
  for(int i=0;i<m;i++){
    cin >>u>>k>>v;
    u--;
    k--;
    M[u][k]=v;
    M[k][u]=(-v);
  }

  for(int i=0;i<n;i++)d[i]=INFTY;
  for(int j=0;j<n;j++)p[j]=INFTY;
  bfs(0);
  if(c==1){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}


Compiler output:
/tmp/ccLfElw2.o: in function `bfs(int)':
a.cc:(.text+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x17e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x1be): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x1d5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccLfElw2.o
a.cc:(.text+0x1f3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>

using namespace std;
static const int N = 100000;
static const int INFTY =(1<<21);

int n, M[N][N];
int d[N];
int m;
int p[N];
int g[N];
int c;

void bfs(int s){
  queue<int> q;
  q.push(s);
  d[s]=0;
  p[s]=0;
  int u;
  while(!q.empty()){
    u = q.front(); q.pop();
    g[u]=1;
    for (int v=0;v<n;v++){
      if(M[u][v]==INFTY)continue;
      if((p[v]!=INFTY)&&(p[v]!=p[u]+M[u][v])){
        c=1;
      }
      p[v]=p[u]+M[u][v];
      if(d[v]!= INFTY)continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int k=0;k<n;k++){
    if(g[k]==0)bfs(k);
  }
}

int main(){
  int u,k,v;
  c=0;

  cin >>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)M[i][j]=INFTY;
  }

  cin >>m;
  for(int i=0;i<m;i++){
    cin >>u>>k>>v;
    u--;
    k--;
    M[u][k]=v;
    M[k][u]=(-v);
  }

  for(int i=0;i<n;i++)d[i]=INFTY;
  for(int j=0;j<n;j++)p[j]=INFTY;
  bfs(0);
  if(c==1){
    cout<<"No"<<endl;
  }
  if(c==0){
    cout<<"Yes"<<endl;
  }
  return 0;
}


Compiler output:
/tmp/ccvRoU7Q.o: in function `bfs(int)':
a.cc:(.text+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x17e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x1be): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x1d5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvRoU7Q.o
a.cc:(.text+0x1f3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<queue>

using namespace std;
static const int N = 100000;
static const int INFTY =(1<<21);

int n, M[N][N];
int d[N];
int m;
int p[N];
int g[N];
int c;

void bfs(int s){
  queue<int> q;
  q.push(s);
  d[s]=0;
  p[s]=0;
  int u;
  while(!q.empty()){
    u = q.front(); q.pop();
    g[u]=1;
    for (int v=0;v<n;v++){
      if(M[u][v]==INFTY)continue;
      if((p[v]!=INFTY)&&(p[v]!=p[u]+M[u][v])){
        c=1;
      }
      p[v]=p[u]+M[u][v];
      if(d[v]!= INFTY)continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int k=0;k<n;k++){
    if(g[k]==0)bfs(k);
  }
  // for (int i=0;i<n;i++){
  //   cout<<i+1<<" "<<((d[i]==INFTY)?(-1):d[i])<<endl;
  // }
}

int main(){
  int u,k,v;
  c=0;

  cin >>n;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)M[i][j]=INFTY;
  }

  cin >>m;
  for(int i=0;i<m;i++){
    cin >>u>>k>>v;
    u--;
    k--;
    M[u][k]=v;
    M[k][u]=(-v);
  }
  // for(int i=0;i<n;i++){
  //   for(int j=0;j<n;j++)cout<<M[i][j]<<endl;
  // }
  for(int i=0;i<n;i++)d[i]=INFTY;
  for(int j=0;j<n;j++)p[j]=INFTY;
  bfs(0);
  if(c==1){
    cout<<"No"<<endl;
  }
  if(c==0){
    cout<<"Yes"<<endl;
  }
  return 0;
}


Compiler output:
/tmp/ccxK7kdE.o: in function `bfs(int)':
a.cc:(.text+0x47): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `g' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x119): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x130): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x17e): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x1be): relocation truncated to fit: R_X86_64_PC32 against symbol `p' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x1d5): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccxK7kdE.o
a.cc:(.text+0x1f3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
signed main(){
    int n,m;cin>>n>>m;
    rep(i,0,m){
        int a,b,c;cin>>a>>b>>c;
    }
cout<<"Yes"<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:13: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    3 |     int n,m;cin>>n>>m;
      |             ^~~
      |             std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:4:9: error: 'i' was not declared in this scope
    4 |     rep(i,0,m){
      |         ^
a.cc:4:5: error: 'rep' was not declared in this scope
    4 |     rep(i,0,m){
      |     ^~~
a.cc:7:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 | cout<<"Yes"<<endl;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 | cout<<"Yes"<<endl;
      |              ^~~~
      |              std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <iostream>
int main(){
  cout<<"Yes"<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    3 |   cout<<"Yes"<<endl;
      |   ^~~~
      |   std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:3:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    3 |   cout<<"Yes"<<endl;
      |                ^~~~
      |                std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

import java.util.Scanner;
import java.util.Arrays;

public class Main{
	static final int MaxN = 400000;
	static final int MaxV = 100000;
	static int []pre = new int[MaxN + 5];
	static int []last = new int[MaxN + 5];
	static int []other = new int[MaxN + 5];
	static int []cost = new int[MaxN + 5];
	static int []a = new int [MaxV + 5];
	static boolean []vis = new boolean[MaxV + 5];
	static boolean flag = true;
	static int n, m, all;
	public static void build(int u, int v, int c){
		pre[++all] = last[u];
		last[u] = all;
		other[all] = v;
		cost[all] = c;
	}
	public static void dfs(int u, int sum){
		if(flag == false) return;
		if(vis[u]){
			if(a[u] != sum) flag = false;
			return;
		}
		vis[u] = true;
		a[u] = sum;
		int ed, dr, add;
		ed = last[u];
		while(ed != -1){
			dr = other[ed];
			add = cost[ed];
			dfs(dr, sum + add);
			ed = pre[ed];
		}
	}
	public static void main(String[] args){
		all = -1;
		Arrays.fill(last, -1);
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		for(int i = 1; i <= m; i++){
			int u, v, c;
			u = sc.nextInt();
			v = sc.nextInt();
			c = sc.nextInt();
			build(u, v, c);
			build(v, u, -c);
		}
		for(int i = 1; i <= n; i++){
			if(!vis[i]) dfs(i, i);
		}
		if(flag == true) System.out.println("Yes\n");
		else System.out.println("No\n");
	}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Arrays;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main{
      | ^~~~~~
Language: C

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define Max 100010
using namespace std;
struct node
{
    int n,d;
}push;
vector<node>  e[Max];
bool vis[Max];
int flag=0;
int dis[Max];
void dfs(int x)
{
    vis[x]=true;
    if(flag)
    return;
    for(int i=0;i<e[x].size();i++)
    {
        node tmp;
        tmp=e[x][i];
        if(vis[tmp.n])
        {
            if(dis[tmp.n]!=dis[x]+tmp.d)
            {
                flag=1;
                break;
            }
        }
        else
        {
            dis[tmp.n]=dis[x]+tmp.d;
            dfs(tmp.n);
        }
    }
}
int main()
{
    int N,M;
    int l,r,d;
    scanf("%d%d",&N,&M);
    int i;
    for(i=0;i<M;i++)
    {
        scanf("%d%d%d",&l,&r,&d);
        push.n=r;
        push.d=d;
        e[l].push_back(push);
        push.n=l;
        push.d=-1*d;
        e[r].push_back(push);
    }
    for(i=0;i<N;i++)
    {
        if(vis[i]==false)
        {
            dfs(i);
        }
        if(flag)
            break;
    }
    if(flag)
        printf("No\n");
    else printf("Yes\n");
    return 0;
}


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

#include <iostream>
#include <queue>
#include <stdio.h>
using namespace std;
int f=0;
int seedis(int x,int *arr,long long *dis)
{
    if(arr[x]==0) return dis[x];
    else return seedis(arr[x],arr,dis) + dis[x];
}
int seef(int l,int *arr)
{
    if(arr[l]==0) return l;
    else return seef(arr[l],arr);
}
void hebing(int l,int r,int d,int *arr,long long *dis)
{
    int lf=seef(l,arr);
    int rf=seef(r,arr);
    if(rf==lf)
    {
        if(seedis(r,arr,dis)-seedis(l,arr,dis)!=d) f=1;
        return;
    }
    arr[rf]=lf;
    dis[r]=seedis(l,arr,dis)+d;
}
int main()
{
    int n,m;
    int *arr;
    long long *dis;
    cin>>n>>m;
    arr=new int[n+1];
    dis=new int[n+1];
    fill(arr+1,arr+n+1,0);
    fill(dis+1,dis+n+1,0);
    int l,r,d;
    for(int i=0;i<m;i++)
    {
        cin>>l>>r>>d;
        hebing(l,r,d,arr,dis);
        if(f==1) break;
    }
    if(f) cout<<"No";
    else cout<<"Yes";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:9: error: cannot convert 'int*' to 'long long int*' in assignment
   35 |     dis=new int[n+1];
      |         ^~~~~~~~~~~~
      |         |
      |         int*
Language: C++

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF LONG_MAX/3

struct edge {ll u, c;};

vector<edge> v[100000];
ll d[100000];
bool visited[100000];

int main(){
    cin.sync_with_stdio(false);
    ll n, m, mini;
    cin >> n >> m;
    mini = n;
    rep(i, m) {
        ll l, r, c;
        cin >> l >> r >> c;
        l--, r--;
        edge e1{r, c}, e2{l, -c};
        v[l].pb(e1);
        v[r].pb(e2);
        minch(mini, l);
    }
    rep(i, n) d[i] = INF;
    bool ok = true;
    while(true) {
        queue<ll> q;
        q.push(mini);
        d[mini] = 0;
        while(q.size()) {
            int p = q.front(); q.pop();
            if (visited[p]) continue;
            visited[p] = true;
            rep(i, v[p].size()) {
                int u = v[p][i].u, c = v[p][i].c;
                if (!visited[u] && d[u] == INF) {
                    d[u] = d[p] + c;
                    q.push(u);
                } else if (visited[u] && d[u] != d[p] + c) {
                    ok = false;
                }
            }
        }
        bool fin = -1;
        rep(i, n) if (!visited[i]) fin = i;
        if (fin == -1) break;
        mini = i;
    }
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:16: error: 'i' was not declared in this scope
   68 |         mini = i;
      |                ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include <unordered_set>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using std::cout;
using std::vector;
using std::endl;
using std::cin;
using std::string;
using std::min;
using std::max;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e9;
typedef std::pair<int,int> P;
struct edge {ll to,cost;};
#define VMAX 200000+10
    ll d[VMAX];
    ll N,M,L[VMAX],R[VMAX],D[VMAX];
    ll ans=0;
    std::vector<edge> G[VMAX];
    bool dijkstra(int s){
        //頂点数N 辺の数 E
        queue<P> que;
//一回もチェックしたことがないなら距離を0にする
        if(d[s]==INF) d[s]=0;
        que.push(P(d[s],s));
        while(!que.empty()){

            P p =que.front();que.pop();
            int v=p.second;
            for(int i=0;i<(signed)G[v].size();i++){
                edge e =G[v][i];
//まだ訪れていないなら
                    if(d[e.to]==INF)
{
                    d[e.to]=d[v]+e.cost;
                    que.push(P(d[e.to],e.to));
                }
//訪れていて与えられた情報と異なる場合
              else if(d[e.to]!=d[v]+e.cost){ 
                return false;
                }
              }
        }
        return true;
    }

int main(){
    std::ios_base::sync_with_stdio(false);
    cin>>N>>M;
    REP(i,M){
		cin>>L[i]>>R[i]>>D[i];

			G[L[i]].push_back({R[i],D[i]});
//線をx座標として考えると,右から左に向かうということはxを小さくするということ
G[R[i]].push_back({L[i],-D[i]});
	}
    bool f=true;
    std::fill(d,d+N + 1,INF);
    EREP(i,N){
        if(!dijkstra(i))f=false;
    }
    cout<<(f?"Yes":"No")<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'bool dijkstra(int)':
a.cc:47:9: error: 'queue' was not declared in this scope; did you mean 'std::queue'?
   47 |         queue<P> que;
      |         ^~~~~
      |         std::queue
In file included from /usr/include/c++/14/queue:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_queue.h:96:11: note: 'std::queue' declared here
   96 |     class queue
      |           ^~~~~
a.cc:47:16: error: expected primary-expression before '>' token
   47 |         queue<P> que;
      |                ^
a.cc:47:18: error: 'que' was not declared in this scope
   47 |         queue<P> que;
      |                  ^~~
Language: Java

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

class InputData {
    public int R;
    public int L;
    public int D;
    public boolean done;
}

public class Main {
    public static void dump(HashMap<Integer, Integer> in) {
        for (Integer k : in.keySet()) {
            System.out.println(k + " => " + in.get(k));
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();

        List<InputData> input = new ArrayList<>();
        for (int i = 0; i < M; i++) {
            InputData tmp = new InputData();
            tmp.R = sc.nextInt();
            tmp.L = sc.nextInt();
            tmp.D = sc.nextInt();
            tmp.done = false;
            input.add(tmp);
        }

        HashMap<Integer, Integer> defined = new HashMap();

        boolean up_first = true;
        boolean first = true;
        while(true) {
            if (up_first) first = true;
            boolean add = false;
            boolean all_done = true;
            for (InputData d : input) {
                //dump(defined);
                if (d.done == true) continue;
                if (first && d.done == false) {
                    defined.put(d.R, 0);
                    defined.put(d.L, d.D);
                    d.done = true;
                    first = false;
                    continue;
                }
                if (defined.containsKey(d.R) && defined.containsKey(d.L)) {
                    // 矛盾
                    if (defined.get(d.L) - defined.get(d.R) != d.D) {
                        System.out.println("No");
                        return;
                    }
                }
                if (defined.containsKey(d.R)) {
                    defined.put(d.L, defined.get(d.R) + d.D);
                    d.done = true;
                    continue;
                }
                if (defined.containsKey(d.L)) {
                    defined.put(d.R, defined.get(d.L) - d.D);
                    d.done = true;
                    continue;
                }

                if (d.done == false) all_done = false;
            }
            // 何もaddできなかった場合は距離が分かっている集合が別に存在してしまっている
            if (!add) up_first = true;
            if (!all_done) continue;
            break;
        }
        System.out.println("Yes");
    }


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

#include <cstdio>
#define MIN -1000000000

using namespace std;

int x[100001];

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

    int l, r, d;
    if (m != 0)
    {
        scanf("%d %d %d", &l, &r, &d);

        for (int i = 1; i <= n; i++)
            x[i] = MIN;

        x[l] = 0;
        x[r] = x[l] + d;
    }

    for (int i = 1; i < m; i++)
    {
        scanf("%d %d %d", &l, &r, &d);

        if (x[l] != MIN && x[r] != MIN)
            if (d != x[r] - x[l])
            {
                printf("NO");
                return 0;
            }
            else
 //               printf("HAHA");
        else if (x[l] != MIN)
        {
            x[r] = x[l] + d;
 //           printf("x[l] != 0\n");
        }
        else if (x[r] != MIN)
        {
            x[l] = x[r] - d;
  //          printf("x[r] != 0\n");
        }
    }

    printf("YES");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: expected primary-expression before 'else'
   37 |         else if (x[l] != MIN)
      |         ^~~~
Language: C++

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); (i)++)
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

struct Edge {
   int to, cost;
};

void dfs(int pos, vec<ll> &dist) {
   for (Edge e : G[pos]) {
      if (dist[e.to] == INF) {
         dist[e.to] = dist[pos] + e.cost;
         dfs(e.to, dist);
      }
   }
}

const ll INF = 1e18;
int N, M;
vec<vec<Edge>> G;

int main() {
   cin >> N >> M;
   G = vec<vec<Edge>>(N);
   rep (i, 0, M) {
      int l, r, d;
      cin >> l >> r >> d;
      l--, r--;
      G[l].push_back(Edge{r, d});
      G[r].push_back(Edge{l, -d});
   }

   vec<ll> dist(N, INF);
   rep (i, 0, N) {
      if (dist[i] == INF) {
         dist[i] = 0;
         dfs(i, dist);
      }
   }

   rep (i, 0, N) {
      for (Edge e : G[i]) {
         if (dist[e.to] - dist[i] != e.cost) {
            puts("No");
            return 0;
         }
      }
   }
   puts("Yes");

   return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, std::vector<long long int>&)':
a.cc:20:18: error: 'G' was not declared in this scope
   20 |    for (Edge e : G[pos]) {
      |                  ^
a.cc:21:25: error: 'INF' was not declared in this scope
   21 |       if (dist[e.to] == INF) {
      |                         ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}
int head[100005];
int next[200005];
int to[200005];
int weight[200005];
int v[100005] = {0};
int visited[100005] = {0};

int dfs(int crt){
    int e;
    e = head[crt];
    while (e != -1){
        if (visited[to[e]] == 0){
            visited[to[e]] = 1;
            v[to[e]] = v[crt] + weight[e];
            dfs(to[e]);
        }else if (visited[to[e]] != 0 && v[to[e]] != v[cnt] + weight[e]){
            return 1;
        }else{
            dfs(to[e]);
        }
        e = next[e];
    }
    return 0;
}


int main(void){
    for (int i = 0; i < 100005; i++){
        head[i] = -1;
    }
    int n, m;
    int l, r, d;
    int e = 0;
    scanf("%d %d", &n, &m);
    for (int i = 0; i < m; i++){
        scanf("%d %d %d", &l, &r, &d);
        next[e] = head[l]; 
        head[l] = e; 
        to[e] = r; 
        weight[e] = d;
        e++;

        next[e] = head[r];
        head[r] = e; 
        to[e] = l;
        weight[e] = -1*d;
        e++;
    }
    for (int i = 0; i < n; i++){
        if(dfs(i)){
            printf("No\n");
            return 0;
        }
    }
    
    
    printf("Yes\n");
    return 0;
}


Compiler output:
main.c: In function 'dfs':
main.c:81:56: error: 'cnt' undeclared (first use in this function); did you mean 'crt'?
   81 |         }else if (visited[to[e]] != 0 && v[to[e]] != v[cnt] + weight[e]){
      |                                                        ^~~
      |                                                        crt
main.c:81:56: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<string>
using namespace std;
#define ll long long 

int map[100000][100000];
int n,m;
bool ans = true;

void search(int a,int b){
  for(int i=0;i<n;i++){
    if(map[b][i]!=0&&i!=a){
      if(map[a][i]!=map[a][b]+map[b][i]&&map[a][i]!=0)
        ans = false;
    }
  }
}


int main(){

  cin>>n>>m;

  for(int i=0;i<m;i++){
    int a,b,d;
    cin>>a>>b>>d;
    map[b-1][a-1]=d;
    map[a-1][b-1]=-d;
  }

  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(map[i][j]!=0)
        search(i,j);
    }
  }

  if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

  return 0;
}


Compiler output:
/tmp/cckEHItv.o: in function `search(int, int)':
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckEHItv.o
/tmp/cckEHItv.o: in function `main':
a.cc:(.text+0x120): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckEHItv.o
a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cckEHItv.o
a.cc:(.text+0x1fd): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cckEHItv.o
a.cc:(.text+0x25c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckEHItv.o
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cckEHItv.o
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>
#include <stdlib.h>

int g[100001];
int di[100001];

int main(int i){
    if(g[i]!=i){
        int r = dfs(g[i]);
        di[i]+=di[g[i]];
        //printf("di[%d]=%d\n",i,di[i]);
        return r;
    }else{
        return i;
    }
}
int abc087d(){
    int i,j;
    int N,M;
    scanf("%d %d",&N,&M);
    for(i=1;i<=N;i++)g[i]=i;
    for(i=0;i<M;i++){
        int l,r,d;
        scanf("%d %d %d",&l,&r,&d);
        int g1=dfs(l);
        int g2=dfs(r);
        if(g1!=g2){
            g[r]=g[l];
            di[r]=di[l]+d;
        }else{
            //printf("di[%d](%d)-di[%d](%d)!=%d\n",r,di[r],l,di[l],d);
            if(di[r]-di[l]!=d){
                printf("No\n");
                return 0;
            }
        }
    }
    printf("Yes\n");
}


Compiler output:
main.c: In function 'main':
main.c:9:17: error: implicit declaration of function 'dfs' [-Wimplicit-function-declaration]
    9 |         int r = dfs(g[i]);
      |                 ^~~
Language: C++

#include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;

    vector<unordered_map<int, int>> g(N);

    REP(i, M) {
        int s, t;
        cin >> s >> t;

        s--;
        t--;

        int w;
        cin >> w;

        g[s].emplace_back(t, w);
        g[t].emplace_back(s, -w);
    }

    vector<bool> visited(N, false);
    vector<long long> dist(N, INF);

    REP(i, N) {
        if (visited[i] == false) {
            queue<pair<int, long long>> q;
            q.emplace(i, 0);

            while (!q.empty()) {
                auto& p = q.front();
                q.pop();

                if (dist[p.first] != INF && dist[p.first] != p.second) {
                    cout << "No" << endl;
                    return 0;
                }
                dist[p.first] = p.second;

                if (visited[p.first]) continue;
                visited[p.first] = true;

                for (auto& e : g[p.first]) {
                    if (visited[e.first] && dist[e.first] != p.second + e.second) {
                        cout << "No" << endl;
                        return 0;
                    }
                    q.emplace(e.first, p.second + e.second);
                }
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: 'unordered_map' was not declared in this scope
   21 |     vector<unordered_map<int, int>> g(N);
      |            ^~~~~~~~~~~~~
a.cc:7:1: note: 'std::unordered_map' is defined in header '<unordered_map>'; this is probably fixable by adding '#include <unordered_map>'
    6 | #include <utility>
  +++ |+#include <unordered_map>
    7 | #include <vector>
a.cc:21:34: error: template argument 1 is invalid
   21 |     vector<unordered_map<int, int>> g(N);
      |                                  ^~
a.cc:21:34: error: template argument 2 is invalid
a.cc:33:10: error: invalid types 'int[int]' for array subscript
   33 |         g[s].emplace_back(t, w);
      |          ^
a.cc:34:10: error: invalid types 'int[int]' for array subscript
   34 |         g[t].emplace_back(s, -w);
      |          ^
a.cc:58:33: error: invalid types 'int[int]' for array subscript
   58 |                 for (auto& e : g[p.first]) {
      |                                 ^
Language: C++

#include "bits/stdc++.h"
#define _ ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

const int maxn=100005;
int graph[maxn][maxn];
int ver[maxn];
bool visited[maxn];

void dfs(int v, int n) {
    visited[v] = true;
    for (int u = 0; u < maxn; u++) {
        if (graph[v][u] != 0 && !visited[u]) {
            dfs(u, n);
            ver[v] = graph[u][v] + ver[u];
        }
    }
}

int main() { _
    int n, m;
    cin >> n >> m;
//    ver.resize(n);
//    visited.resize(n);
//    vector<vector<int > > graph(n, vector<int>(n, 0));
    for (int i = 0; i < m; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        graph[l][r] = d;
        graph[r][l] = -d;
    }
    for (int i = 0; i < n; i++) {
        if (!visited[i]) {
            dfs(i, n);
        }
    }
    for (int v = 0; v < n; v++) {
        for (int u = 0; u < n; u++) {
            if (graph[v][u] != 0) {
                int diff = ver[u] - ver[v];
//                cout << u << " " << v << endl;
//                cout << ver[u] << " - " << ver[v] << " = " << diff << " ?= " << graph[v][u] << endl;
                if (diff != graph[v][u]) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Compiler output:
/tmp/ccfYRyPG.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccfYRyPG.o
a.cc:(.text+0x5d): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccfYRyPG.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccfYRyPG.o
a.cc:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccfYRyPG.o
/tmp/ccfYRyPG.o: in function `main':
a.cc:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccfYRyPG.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccfYRyPG.o
a.cc:(.text+0x29e): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccfYRyPG.o
collect2: error: ld returned 1 exit status
Language: C++

#include "bits/stdc++.h"
#define _ ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

const int maxn=100005;
int graph[maxn][maxn];
int ver[maxn];
bool visited[maxn];

void dfs(int v, int n) {
    visited[v] = true;
    for (int u = 0; u < maxn; u++) {
        if (graph[v][u] != 0 && !visited[u]) {
            dfs(u, n);
            ver[v] = graph[u][v] + ver[u];
        }
    }
}

int main() { _
    int n, m;
    cin >> n >> m;
//    ver.resize(n);
//    visited.resize(n);
//    vector<vector<int > > graph(n, vector<int>(n, 0));
    for (int i = 0; i < m; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        graph[l][r] = d;
        graph[r][l] = -d;
    }
    for (int i = 0; i < n; i++) {
        if (!visited[i]) {
            dfs(i, n);
        }
    }
    for (int v = 0; v < n; v++) {
        for (int u = 0; u < n; u++) {
            if (graph[v][u] != 0) {
                int diff = ver[u] - ver[v];
//                cout << u << " " << v << endl;
//                cout << ver[u] << " - " << ver[v] << " = " << diff << " ?= " << graph[v][u] << endl;
                if (diff != graph[v][u]) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Compiler output:
/tmp/ccLBiuYh.o: in function `dfs(int, int)':
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccLBiuYh.o
a.cc:(.text+0x5d): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccLBiuYh.o
a.cc:(.text+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccLBiuYh.o
a.cc:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccLBiuYh.o
/tmp/ccLBiuYh.o: in function `main':
a.cc:(.text+0x206): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccLBiuYh.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccLBiuYh.o
a.cc:(.text+0x29e): relocation truncated to fit: R_X86_64_PC32 against symbol `ver' defined in .bss section in /tmp/ccLBiuYh.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
typedef vector<ll>::iterator vit;

// template from zscoder
vector< ii > adj[200002];
ll ans[200002];

void dfs(int u)
{
    for(ii x: adj[u])
    {
        int v = x.fi;  int w = x.se;
        if(ans[v] < (-10e17))
        {
            ans[v] = ans[u] + w;
            dfs(v);
        }
        else
        {
            if(ans[v]!=(ans[u]+w))
            {
                cout << "No" << endl;
                exit();
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ll n,m;
    cin >> n >> m;
    int l,r,d;
    for(int i = 0 ; i < m; i++)
    {
        cin >> l >> r >> d;
        l--; r--;
        adj[l].pb(mp(r,d));
        adj[r].pb(mp(l,-d));
    }
    memset(ans,ll(-10e18),sizeof(ans));
    for(int i=0;i<n;i++)
	{
		if(ans[i]<-ll(1e17))
		{
			ans[i]=0;
			dfs(i);
		}
	}
    cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:43:21: error: too few arguments to function 'void exit(int)'
   43 |                 exit();
      |                 ~~~~^~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
typedef vector<ll>::iterator vit;

// template from zscoder
ll n,m;
vector< ii > adj[200002];
ll ans[200002];

void dfs(int u)
{
    for(ii x: adj[u])
    {
        int v = x.fi;  int w = x.se;
        if(ans[v] < (-10e17))
        {
            ans[v] = ans[u] + w;
            dfs(v);
        }
        else
        {
            if(ans[v]!=(ans[u]+w))
            {
                cout << "No" << endl;
                exit();
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    cin >> n >> m;
    int l,r,d;
    for(int i = 0 ; i < m; i++)
    {
        cin >> l >> r >> d;
        l--; r--;
        adj[l].pb(mp(r,d));
        adj[r].pb(mp(l,d));
    }
    memset(ans,ll(-10e18),sizeof(ans));
    for(int i=0;i<n;i++)
	{
		if(ans[i]<-ll(1e17))
		{
			ans[i]=0;
			dfs(i);
		}
	}
    cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:44:21: error: too few arguments to function 'void exit(int)'
   44 |                 exit();
      |                 ~~~~^~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C++

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

using ll = long long int;

const int MAX_N = (int)1e5 + 5;

struct rd {int v, cost;};

int n, m;
int path[MAX_N][MAX_N];

int l, r, d;
ll grid[MAX_N];
bool visited[MAX_N];
vector<vector<rd>> graph(MAX_N);
vector<int> nodes;

int main(void){
  // Here your code !
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &l, &r, &d);
    rd tokenl;
    tokenl.v = r;
    tokenl.cost = d;
    graph[l].push_back(tokenl);
    rd tokenr;
    tokenr.v = l;
    tokenr.cost = -1 * d;
    graph[r].push_back(tokenr);
    nodes.push_back(l);
    nodes.push_back(r);
  }
  fill(visited, visited + MAX_N, false);

  sort(nodes.begin(), nodes.end());
  nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());

  stack<int> stk;
  for (int i = 0; i < nodes.size(); ++i) {
    int cnode = nodes[i];
    if (visited[cnode]) continue;
    grid[cnode] = 0;
    visited[cnode] = true;

    stk.push(cnode);
    while (!stk.empty()) {
      int tnode = stk.top();
      stk.pop();
      vector<rd> cgraph = graph[tnode];

      for (int j = 0; j < cgraph.size(); ++j) {
        if (visited[cgraph[j].v]) {
            if (grid[tnode] + cgraph[j].cost != grid[cgraph[j].v]) {
              printf("No\n");
              return 0;
            }
            else {continue;}
        }
        grid[cgraph[j].v] = grid[tnode] + cgraph[j].cost;
        stk.push(cgraph[j].v);
        visited[cgraph[j].v] = true;
      }
    }
  }
  printf("Yes\n");

  return 0;
}

Compiler output:
/tmp/ccGbkElH.o: in function `main':
a.cc:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x4f): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `graph' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0xd7): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccGbkElH.o
a.cc:(.text+0xe3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

using ll = long long int;

const int MAX_N = (int)1e5 + 5;

struct rd {int v, cost;};

int N, M;
int path[MAX_N][MAX_N];

int l, r, d;
ll grid[MAX_N];
bool visited[MAX_N];
vector<vector<rd>> graph(MAX_N);
vector<int> nodes;

int main(void){
  // Here your code !
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; ++i) {
    scanf("%d %d %d", &l, &r, &d);
    rd tokenl;
    tokenl.v = r;
    tokenl.cost = d;
    graph[l].push_back(tokenl);
    rd tokenr;
    tokenr.v = l;
    tokenr.cost = -1 * d;
    graph[r].push_back(tokenr);
    nodes.push_back(l);
    nodes.push_back(r);
  }
  fill(visited, visited + MAX_N, false);

  sort(nodes.begin(), nodes.end());
  nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());

  stack<int> stk;
  for (int i = 0; i < nodes.size(); ++i) {
    int cnode = nodes[i];
    if (visited[cnode]) continue;
    grid[cnode] = 0;
    visited[cnode] = true;

    stk.push(cnode);
    while (!stk.empty()) {
      int tnode = stk.top();
      stk.pop();
      vector<rd> cgraph = graph[tnode];

      for (int j = 0; j < cgraph.size(); ++j) {
        if (visited[cgraph[j].v]) {
            if (grid[tnode] + cgraph[j].cost != grid[cgraph[j].v]) {
              printf("No\n");
              return 0;
            }
            else {continue;}
        }
        grid[cgraph[j].v] = grid[tnode] + cgraph[j].cost;
        stk.push(cgraph[j].v);
        visited[cgraph[j].v] = true;
      }
    }
  }
  printf("Yes\n");

  return 0;
}

Compiler output:
/tmp/ccYx4dD8.o: in function `main':
a.cc:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x4f): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x76): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `graph' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0xd7): relocation truncated to fit: R_X86_64_PC32 against symbol `r' defined in .bss section in /tmp/ccYx4dD8.o
a.cc:(.text+0xe3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status