criyle/codenet-compile-errors huggingface dataset:
Language: Java

public void Class() {
	public static void main(String[] args) {
//		2xNのマス目
//		1,2,3,4..
//		5,6,7,8..
//		スタートは(1, 1)


		Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
//      (2,N)
      	ArrayList<Integer> masu1 = new ArrayList<Integer>();
      	ArrayList<Integer> masu2 = new ArrayList<Integer>();
      	for(int i = 0; i < N; i++) {
      		 masu1.add(sc.nextInt());
      	}

      	for(int i = 0; i < N; i++) {
     		 masu2.add(sc.nextInt());
     	}
    	ArrayList<Integer> ans = new ArrayList<Integer>();
      	for (int i = 1; i < N; i++) {
      		int total = 0;
      		int count = i;
      		while (count != 0) {
      			total += masu1.get(count - 1);
      			count--;
      		}
      		for (int j = N; j >= i; j--) {
      			total += masu2.get(j - 1);
      		}
      		ans.add(total);
      	}
      	int total = 0;
      	for(int i = 0; i < N; i++) {
    		 total += masu1.get(i);
    	}
      	total += masu2.get(N-1);
      	ans.add(total);

      	System.out.println(Collections.max(ans));
	}
}

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public void Class() {
       ^
  (use --enable-preview to enable unnamed classes)
Main.java:2: error: illegal start of expression
	public static void main(String[] args) {
	^
Main.java:43: error: class, interface, enum, or record expected
}
^
3 errors
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int a[105][105];
int n;
int main(){
	int ans = 0;
	scanf("%d",&n);
	int t = 0;
	for(int i = 1; i <= 2; i++)
		for(int j = 1; j <= n; j++)
			scanf("%d",&a[i][j]);
	for(int i = n; i >= 1; i--){
		if(a[1][i] > a[2][i-1]){ 
			t = i;
			break;
		}
	}
	int x = y = 0;
	for(int i = 1; i <= n; i++){
		x += a[1][i];
		y += a[2][i];
	}
	int f = max(x,y)+a[2][n];
	for(int i = 1; i <= t; i++)
		ans += a[1][i];
	for(int i = t; i <= n; i++)
		ans += a[2][i];
	printf("%d\n",max(ans,f));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'y' was not declared in this scope
   23 |         int x = y = 0;
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int N;
int A[1][105],A[2][105];

int main(){
	int rec=0,ans=0;
	cin >> N;
	for(int i=0;i<N;i++) cin >> A[1][i];
	for(int i=0;i<N;i++) cin >> A[2][i];
	
	for(int i=0;i<N;i++){
		a[i]+=A[i];
		b[i]+=B[i];
	}
	for(int i=0;i<N;i++){
		rec = A[i]+b[N]-b[i-1];
		ans = max(ans,rec);
	}
	cout << ans <<endl;
	return 0;
}

Compiler output:
a.cc:8:15: error: conflicting declaration 'int A [2][105]'
    8 | int A[1][105],A[2][105];
      |               ^
a.cc:8:5: note: previous declaration as 'int A [1][105]'
    8 | int A[1][105],A[2][105];
      |     ^
a.cc: In function 'int main()':
a.cc:17:17: error: 'a' was not declared in this scope
   17 |                 a[i]+=A[i];
      |                 ^
a.cc:18:17: error: 'b' was not declared in this scope
   18 |                 b[i]+=B[i];
      |                 ^
a.cc:18:23: error: 'B' was not declared in this scope
   18 |                 b[i]+=B[i];
      |                       ^
a.cc:21:28: error: 'b' was not declared in this scope
   21 |                 rec = A[i]+b[N]-b[i-1];
      |                            ^
Language: C

#include<stdio.h>
int main(void){
int N,ame[2*N],i,j,sum=0;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d ",&ame[i]);
}
for(i=N;i<2*N;i++){
scanf("%d ",&ame[i]);
}
sum+=ame[0];
for(i=1;i<=N-1;i++){
if(ame[i]>=ame[i+N-1]) sum+=ame[i]
else {
   for(j=i;j<2*N-1;j++){
        sum+=ame[j+N-1];
         }
   break;
   }
}
sum+=ame[2*N-1];
printf("%d",sum);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:35: error: expected ';' before 'else'
   13 | if(ame[i]>=ame[i+N-1]) sum+=ame[i]
      |                                   ^
      |                                   ;
   14 | else {
      | ~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, ans=0;
    cin >> n;
    vector<int> a1(n), a2(n);
    cin >> a1[0];
    for (int i=1; i<n; i++) {
        int a;
        cin >> a;
        a1[i] = a + a1[i-1];
    }
    for (int i=0; i<n; i++)
        cin >> a2[i];
    reverse(a2.begin(), a2.end());
    for (int i=1; i<n; i++) {
        a2[i] = a2[i] + a2[i-1];
    }
    for (int i=0; i<n; i++) {
        ans = max(ans, a1[i]+a2[n-i-1]);
    }
    cout << ans << endl;
}


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++

#include <iostream>
#include <string>
using namespace std;

int main(){
  int N,A1[101],A2[101],Answer,now = 0;
  cin >> N;
  for (int j = 1; j <= N ; j++){
    cin >> A1[j];
  }
  for (int j = 1; j <= N ; j++){
    cin >> A2[j];
  }
  int j = 1;
  while (j <= N){
    for (int i = 0 ; i <= j; i++){
      now += A1[i]
    }
    for (int i = j ; i <= N; i++){
      now += A2[i]
    }     
    j++;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected ';' before '}' token
   17 |       now += A1[i]
      |                   ^
      |                   ;
   18 |     }
      |     ~              
a.cc:20:19: error: expected ';' before '}' token
   20 |       now += A2[i]
      |                   ^
      |                   ;
   21 |     }
      |     ~
Language: Java

public class Main {
	static int INF = Integer.MAX_VALUE / 2;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] adj = new int[2][N];

		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < N; j++) {
				adj[i][j] = sc.nextInt();
			}
		}
		System.out.println(dfs(adj, 0, 0, N));
	}

	static int dfs(int[][] adj, int i, int j, int N) {
		if(i == 1 && j >= N - 1) return adj[i][j];

		if(i == 1 && j < N-1) {
			return adj[i][j] + dfs(adj, i, j+1, N);
		} else if(i==0 && j >= N-1) {
			return adj[i][j] + dfs(adj, i+1, j, N);
		} else {
			return adj[i][j] + Math.max(dfs(adj, i+1, j, N), dfs(adj, i, j+1, N));
		}
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <map>
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
using namespace std;
int A[2][100];
int search(const int n, int itl, int itr,int sum) {
	int under = 0, right = 0;
	sum += A[itl][itr];
	if (itr == n - 1 && itl) {
		return sum;
	}
	if (itr < n - 1) {
		right = search(n, itl, itr + 1 , sum);
	}
	if (!itl) {
		under = search(n, itl + 1 , itr, sum);
	}
	return max(under, right);
}
int main() {
	int N;
	cin >> N;
	FOR(i, 0, N) cin >> A[0][i];
	FOR(i, 0, N) cin >> A[1][i];
	cout << search(N, 0, 0, 0);
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: expected '}' at end of input
   30 |         return 0;
      |                  ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++

#include<stdio.h>
int main(){
int n,t,s;
t=0;s=0;
int a[100],b[100];
scanf("%d",&n);
for(int k=0;k<n;k++){
scanf("%d",&a[k]);
}
for(int k=0;k<n;k++){
scanf("%d",&b[k]);
}
for(int k=0;k<n;k++){
t=t+a[k];
for(int l=k;l<n;l++){
s=s+b[l];
}
if(s>r)r=s;
}
printf("%d",r);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: 'r' was not declared in this scope
   18 | if(s>r)r=s;
      |      ^
a.cc:20:13: error: 'r' was not declared in this scope
   20 | printf("%d",r);
      |             ^
Language: C++

#include<stdio.h>
int main(){
int n,t,s;
t=0;s=0;
int a[100],b[100];
scanf("%d",&n);
for(int k=0;k<n,k++){
scanf("%d",&a[k]);
}
for(int k=0;k<n,k++){
scanf("%d",&b[k]);
}
for(int k=0;k<n,k++){
t=t+a[k];
for(int l=k;l<n,l++){
s=s+b[l];
}
if(s>r)r=s;
}
printf("%d",r);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: expected ';' before ')' token
    7 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:10:20: error: expected ';' before ')' token
   10 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:13:20: error: expected ';' before ')' token
   13 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:15:20: error: expected ';' before ')' token
   15 | for(int l=k;l<n,l++){
      |                    ^
      |                    ;
a.cc:18:6: error: 'r' was not declared in this scope
   18 | if(s>r)r=s;
      |      ^
a.cc:20:13: error: 'r' was not declared in this scope
   20 | printf("%d",r);
      |             ^
Language: C++

#include<stdio.h>
int main(){
int n,t,s;
t=0;s=0;
int a[100],b[100];
scanf("%d",&n);
for(int k=0;k<n,k++){
scanf("%d,&a[k]);
}
for(int k=0;k<n,k++){
scanf("%d,&b[k]);
}
for(int k=0;k<n,k++){
t=t+a[k];
for(int l=k;l<n,l++){
s=s+b[l];
}
if(s>r)r=s;
}
printf("%d",r);
return 0;
}

Compiler output:
a.cc:8:7: warning: missing terminating " character
    8 | scanf("%d,&a[k]);
      |       ^
a.cc:8:7: error: missing terminating " character
    8 | scanf("%d,&a[k]);
      |       ^~~~~~~~~~~
a.cc:11:7: warning: missing terminating " character
   11 | scanf("%d,&b[k]);
      |       ^
a.cc:11:7: error: missing terminating " character
   11 | scanf("%d,&b[k]);
      |       ^~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:7:20: error: expected ';' before ')' token
    7 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:9:1: error: expected primary-expression before '}' token
    9 | }
      | ^
a.cc:10:20: error: expected ';' before ')' token
   10 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:12:1: error: expected primary-expression before '}' token
   12 | }
      | ^
a.cc:13:20: error: expected ';' before ')' token
   13 | for(int k=0;k<n,k++){
      |                    ^
      |                    ;
a.cc:15:20: error: expected ';' before ')' token
   15 | for(int l=k;l<n,l++){
      |                    ^
      |                    ;
a.cc:18:6: error: 'r' was not declared in this scope
   18 | if(s>r)r=s;
      |      ^
a.cc:20:13: error: 'r' was not declared in this scope
   20 | printf("%d",r);
      |             ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int A[2][100];

  int N;

  cin >> N;

  for (int ii=0; ii<2; ++ii)
    for (int jj=0; jj<N; ++jj)
      cin >> A[ii][jj];


  A[1][0] += A[0][0];
    
  for (int jj=1; jj<N; ++jj)
    A[0][jj] += A[0][jj-1];

  for (int jj=1; jj<N; ++jj)
    A[1][jj] += max(A[0][jj],A[1][jj-1]);

  std::cout << A[1][N-1] << std::endl;
  
  return 0;
}
bas

Compiler output:
a.cc:31:1: error: 'bas' does not name a type
   31 | bas
      | ^~~
Language: C++

#include<algorithm>
using namespace std;
int main(){
    int n, a[2][101];
    scanf("%d", &n);
    int max1 = 0, count;
    for(int i = 0; i < n; i++) scanf("%d", &a[0][i]);
    for(int i = 0; i < n; i++) scanf("%d", &a[1][i]);
    for(int i = 0; i < n; i++){
        count = 0;
        for(int j = i; j>=0; j--) count+=a[0][j];
        for(int j = i; j < n; j++) count+=a[1][j];
        max1 = max(count, max1);
    }
    printf("%d\n", max1);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'scanf' was not declared in this scope
    5 |     scanf("%d", &n);
      |     ^~~~~
a.cc:15:5: error: 'printf' was not declared in this scope
   15 |     printf("%d\n", max1);
      |     ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include<algorithm>
  +++ |+#include <cstdio>
    2 | using namespace std;
Language: C++

#include<stdio.h>
long main()
{
	long N;
	long A[2][100];
	scanf("%d", &N);
	for (long i = 0; i < N; i++) {
		scanf("%d", &A[0][i]);
	}
	for (long i = 0; i < N; i++) {
		scanf("%d", &A[1][i]);
	}
	// 出力
	long output = 0;
	long max = 0,num=0;
	for (long i = 0; i < N; i++){
		max += A[0][i];
	}
	max += A[1][N-1];
	num = max;
	for (long i = N-1; i >1; i--){
		num -= A[0][i];
		num += A[1][i-1];
		if (num>max)max = num;
	}
	printf("%d\n",max);
	return 0;
}

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

#include<stdio.h>
#define scanf scanf_s
long main()
{
	long N;
	long A[2][100];
	scanf("%d", &N);
	for (long i = 0; i < N; i++) {
		scanf("%d", &A[0][i]);
	}
	for (long i = 0; i < N; i++) {
		scanf("%d", &A[1][i]);
	}
	// 出力
	long output = 0;
	long max = 0,num=0;
	for (long i = 0; i < N; i++){
		max += A[0][i];
	}
	max += A[1][N-1];
	num = max;
	for (long i = N-1; i >1; i--){
		num -= A[0][i];
		num += A[1][i-1];
		if (num>max)max = num;
	}
	printf("%d\n",max);
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:2:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    2 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:7:9: note: in expansion of macro 'scanf'
    7 |         scanf("%d", &N);
      |         ^~~~~
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<ll, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1E+05;
const int MAX_M = 2E+05;

struct edge {
    int to;
    ll cost;
};

int N, M;

vector<edge> G[MAX_N + 1];
ll d[MAX_N + 1];
bool used[MAX_N + 1];
int L[MAX_M], R[MAX_M];
ll D[MAX_M];

bool dfs(int t, int l);

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

    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i] >> D[i];
        G[L[i]].push_back((edge) { R[i], D[i] });
        G[R[i]].push_back((edge) { L[i], -D[i] });
    }

    fill(d, d + N + 1, INF);
    bool ans = true;
    for (int i = 1; i <= N; i++) {
        if (!used[i]) {
            dfs(i, 0);
        }
    }
    for (int i = 0; i < M; i++) {
        if (d[R[i]] - d[L[i]] != D[i]) {
            ans = false;
        }
    }
    if (ans) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    return 0;
}

void dfs(int t, int l)
{
    used[t] = true;
    d[t] = l;
    bool res = true;
    for (const auto& e : G[t]) {
        if (!used[e.to]) {
            dfs(e.to, l + e.cost);
        }
    }
    return;
}


Compiler output:
a.cc:91:6: error: ambiguating new declaration of 'void dfs(int, int)'
   91 | void dfs(int t, int l)
      |      ^~~
a.cc:47:6: note: old declaration 'bool dfs(int, int)'
   47 | bool dfs(int t, int l);
      |      ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;


template<class Abel> class WeightedUnionFind{
    vector<int> par; 
    vector<int> r_size; 
    vector<int> rank; 
    vector<Abel> diff_weight;
    public:
        WeightedUnionFind(int N, Abel SUM_UNITY = 0){
            init(N, SUM_UNITY);
        }

        void init(int N, Abel SUM_UNITY = 0){
            par.resize(N); r_size.resize(N); rank.resize(N); diff_weight.resize(N);
            for(int i=0; i<N; ++i){ par[i] = i; r_size[i] = 1; rank[i] = 0; diff_weight[i] = SUM_UNITY; }
        }

        int root(int x){
            if(par[x] == x)return x;
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }

        Abel get_weight(int x){
            root(x);
            return diff_weight[x];
        }

        Abel diff(int x, int y){
            return get_weight(y) - get_weight(x);
        }

        //xとyとが所属する集合を併呑する
        //なお，weight(y) - weight(x) = wとなるようにmerge
        bool merge(int x, int y, Abel w){
            w += get_weight(x); w -= get_weight(y);
            int rx = root(x),  ry = root(y);
            if(rx == ry) return;
            if(rank[rx] < rank[ry]) swap(rx,ry), w = -w;
            if(rank[rx] == rank[ry]) ++rank[rx];
            r_size[rx] += r_size[ry];
            par[ry] = rx;
            diff_weight[ry] = w;
            return true;
        }

        bool same(int x, int y){
            return root(x) == root(y);
        }

        //素集合の大きさを返す
        int size(int x){
            return r_size[root(x)];
        }
};

int main(){
    int N, M, l, r, d;
    cin >> N >> M;
    WeightedUnionFind<int> uf(N,0);
    bool ans = true;
    rep(_,M){
        cin >> l >> r >> d;
        --l; --r;
        if(uf.same(l,r) && abs(uf.diff(l,r)) != d)ans = false;
        uf.merge(l,r,d);
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Compiler output:
a.cc: In member function 'bool WeightedUnionFind<Abel>::merge(int, int, Abel)':
a.cc:65:26: error: return-statement with no value, in function returning 'bool' [-fpermissive]
   65 |             if(rx == ry) return;
      |                          ^~~~~~
a.cc: In instantiation of 'bool WeightedUnionFind<Abel>::merge(int, int, Abel) [with Abel = int]':
a.cc:93:17:   required from here
   93 |         uf.merge(l,r,d);
      |         ~~~~~~~~^~~~~~~
a.cc:65:26: error: return-statement with no value, in function returning 'bool' [-fpermissive]
   65 |             if(rx == ry) return;
      |                          ^~~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 998244353;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

struct edges{
    int to, cost;
};

bool flag = true;

bool dfs(int s, int N, vector<ll> &d, vector<bool> &seen, vector<vector<edges>> &G){
    seen[s] = true;
    for(auto e:G[s]){
        if(d[e.to] == INF){
            d[e.to] = d[s] + e.cost;
            dfs(e.to,N,d,seen,G);
        }
        else if(d[e.to] != d[s] + e.cost){
            flag = false;
            return 0
        }
    }
    return flag;
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<edges>> G(N);
    rep(i,M){
        int L, R, D;
        cin >> L >> R >> D;
        L--;R--;
        G[L].push_back({R, D});
    }
    vector<bool> seen(N,false);
    rep(i,N){
        if(seen[i]) continue;
        vector<ll> d(N,INF);
        flag = true;
        d[i] = 0;
        flag = dfs(i, N, d, seen, G);
        if(!flag){
            break;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Compiler output:
a.cc: In function 'bool dfs(int, int, std::vector<long long int>&, std::vector<bool>&, std::vector<std::vector<edges> >&)':
a.cc:47:21: error: expected ';' before '}' token
   47 |             return 0
      |                     ^
      |                     ;
   48 |         }
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

bool dfs(long v, long pos, long *x, bool *vis, vector<vector<pair<long, long>>> &g){
    x[v] = pos;
    vis[v] = true;
    for(auto u : g[v]){
        long to = u.first;
        long dist = u.second;
        if(vis[to]){
            if(x[to] != pos + dist) return false;
        }
        else{
            dfs(to, pos + dist, x, vis, g);
        }
    }
    return true;
}

long main(){
    long N, M;
    cin >> N >> M;
    long r, l, d, x[N]; 
    bool vis[N]; fill(vis, vis + N, false);
    vector<vector<pair<long, long>>> G(N);
    for(long i=0; i<M; i++){
        cin >> r >> l >> d;
        r --; l --;
        G[r].push_back({l, d});
        G[l].push_back({r, -d});
    }
    bool ans = true;  // ture means satisfaction
    for(long i=0; i<N; i++){
        if(!vis[i]){
            ans = dfs(i, 0, x, vis, G);
            if(!ans) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
vint x;
map<pair<int,int>,bool> seenEdge;
set<int> unSeenVert;
vector<vector<pair<int,int>>> graph;
void dfs(int from,int to,int d)
{
    if(from == -1)
    {
        x[to] = 0;
    }
    else if(unSeenVert.count(to) == 0 and x[to] != x[from] + d)
    {
        cout<<"No"<<endl;
        exit(0);
    }
    else
    x[to] = x[from] + d;

    if(unSeenVert.count(to) == 1)
    unSeenVert.erase(to);
    else
    break;
    seenEdge[{to,d}] = true;
    for (auto &&i : graph[to])
    {
        if(seenEdge[i])
        continue;
        dfs(to,i.first,i.second);
        seenEdge[i] = true;
    }
    
}
int main()
{
    int N,M;
    cin>>N>>M;
    graph.resize(N);
    x.resize(N);
    vint L(M),R=L,D=L;
    for (size_t i = 0; i < M; i++)
    {
        cin>>L[i]>>R[i]>>D[i];
        L[i]--;
        R[i]--;
        graph[L[i]].push_back({R[i],-D[i]}); // x_L[i] = x_R[i] - D[i]
        graph[R[i]].push_back({L[i],D[i]});  // x_R[i] = x_L[i] + D[i]
        unSeenVert.insert(L[i]);
        unSeenVert.insert(R[i]);
    }
    while(!unSeenVert.empty())
    {
        dfs(-1,*unSeenVert.begin(),-1);
    }
    cout<<"Yes"<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:71:5: error: break statement not within loop or switch
   71 |     break;
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<pair<int,int> >adj[MAX];
int arr[MAX];
bool visit[MAX];
void dfs(int src)
{
    if(arr[src]==0)
        arr[src]=1;
    visit[src]=1;
    for(int i=0; i<adj[src].size(); i++)
    {
        int child=adj[src][i].first;
        if(visit[child]==0){
            arr[child]=arr[src]+adj[src][i].second;
            dfs(child);
        }
        else if(abs(arr[src]-arr[child])!=adj[src][i].second){
            cout<<"No"<<endl;
            exit(0);
        }


    }
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,m;
    cin>>n>>m;
    while(m--)
    {
        int u,v,x;
        cin>>u>>v>>x;
        adj[u].push_back({v,x});
        adj[v].push_back({u,x});
    }
    int mx=INT_MAX,s;
    for(int i=1; i<=n; i++)
    {
        if(adj[i].size())
        {
            if(adj[i].size()<mx)
                mx=adj[i].size(),s=i;
        }
    }
    dfs(s);

    cout<<"Yes"<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:21:5: error: reference to 'visit' is ambiguous
   21 |     visit[src]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:6: note:                 'bool visit [1000000]'
   16 | bool visit[MAX];
      |      ^~~~~
a.cc:25:12: error: reference to 'visit' is ambiguous
   25 |         if(visit[child]==0){
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:6: note:                 'bool visit [1000000]'
   16 | bool visit[MAX];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<pair<Pll,ll>> P(M);
    rep(i,M){
        cin >> P[i].first.first >> P[i].first.second >> P[i].second;
    }
    sort(P.begin(), P.end());
    map<ll,ll> mp;
    bool flag = true;
    rep(i,M){
        ll L = P[i].first.first;
        ll R = P[i].first.second;
        ll D = P[i].second;
        if(mp[L] == 0 && mp[R] == 0){
            mp[L] = 1000000000;
            mp[R] = 1000000000 + D;
        }else if(mp[L] == 0 && mp[R] > 0){
            mp[L] = mp[R] - D;
        }else if(mp[L] > 0 && mp[R] == 0){
            mp[R] = mp[L] + D;
        }else{
            if(mp[L] + D != mp[R]){
                flag = false;
                break;
            }
        }
    }
    ll M=0,m=1e18;
    for(auto& p:mp){
        cmax(M,p.second);
        cmin(m,p.second);
    }
    if(M-m>1000000000){
        flag = false;
    }
    cout << ((flag)?"Yes":"No") << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:8: error: redeclaration of 'll M'
   43 |     ll M=0,m=1e18;
      |        ^
a.cc:16:11: note: 'll M' previously declared here
   16 |     ll N, M;
      |           ^
Language: C++

#pragma 03
#pragma GCC optimization ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define eb emplace_back
#define ef emplace_front
#define rep(i, x, n) for (int i = x; i < n; ++i)
#define mp make_pair
#define fi first
#define se second
#define ii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vii vector<pair<int, int>>
#define reverse(s) reverse(s.begin(), s.end())
#define ld long double
#define vs vector<string>
#define inf INT_MAX
#define vc vector<char>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define vb vector<bool>
#define lb(a, x) lower_bound(a.begin(), a.end(), x)
#define ub(a, x) upper_bound(a.begin(), a.end(), x) 
#define vvi vector<vi>
#define mine(a) min_element(a.begin(),a.end())
#define maxe(a) max_element(a.begin(), a.end())
#define iota(a,i) iota(a.begin(),a.end(),i)
#define fileopen(filename) if (fopen(filename".INP", "r")) {freopen(filename".INP", "r", stdin);freopen(filename".OUT", "w", stdout);}
int n, m;
map<ii, int> a;
vi par, val;
vvi adj;
vb d;
int findset(int x) {
	int u = x;
	while (par[x] != -1) {
		x = par[x];
		par[u] = x;
	}
	return x;
}
bool sameset(int x, int y) {
	return findset(x) == findset(y);
}
void unionset(int x, int y) {
	x = findset(x);
	y = findset(y);
	if (x == y) return;
	par[x] = y;
}
void dfs(int x) {
	for (int i : adj[x]) {
		if (d[i] == 0) {
			d[i] = 1;
			val[i] = val[x] + a[mp(x, i)];
			dfs(i);
		}
		else if (val[i] != val[x] + a[mp(x, i)]) {
			cout << "No";
			exit(0);
		}
	}
}
signed main() {
	fastio;
	cin >> n >> m;
	par.resize(n + 1, -1);
	adj.resize(n + 1);
	d.resize(n + 1, 0);
	while (m--) {
		int x, y, z;
		cin >> x >> y >> z;
		a[mp(x, y)] = z;
		a[mp(y, x)] = -z;
		unionset(x, y);
		adj[x].emplace_back(y);
		adj[y].emplace_back(x);
	}
	rep(i, 1, n + 1) {
		if (d[i] == 0) {
			int x = findset(i);
			d[x] = 1;
			val.assign(n + 1, 0);
			dfs(x);
		}
	}
	cout << "Yes";
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Bvector_base<std::allocator<bool> >::_Bvector_impl::~_Bvector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long unsigned int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:67,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_bvector.h:590:14: note: called from here
  590 |       struct _Bvector_impl
      |              ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

// 辺（方向と重み）
struct edge{ ll to, cost; };

// 幅優先探索
void bfs(vector<vector<edge>> &g, ll n, ll node, vi &color, vi &dst, bool &ans, ll cost){
    if((color[node] == 1) && (dst[node] != cost)) ans = false;
    else{
        color[node] = 1;
        dst[node] = cost;
        rep(i, g[node].size()){
            bfs(g, n, g[node][i].to, color, dst, ans, cost + g[node][i].cost);
        }
    }
}

int main(){
    Init();
    ll n, m; cin >> n >> m;
    vector<vector<edge>> g(n, vector<edge>(0));

    // グラフの生成
    rep(i, m){
        ll l, r, d;cin >> l >> r >> d;
        l--; r--; // 0-based
        // 双方向に辺を張る（逆向きはコストもマイナスにする）
        g[l].push_back((edge){r, d});
        g[r].push_back((edge){l, -d});
    }

    // 回答出力用
    bool ans = true;

    // グラフ巡回確認
    vi color(n, 0);
    vi dst(n, -INFLL);

    // 矛盾がないか確認
    rep(i, n)
        if(color[i] == 0) bfs(g, n, i, color, dst, ans, 0LL);
    }

    // 結果出力
    (ans) ? Yes() : No();
}

Compiler output:
a.cc:65:11: error: expected constructor, destructor, or type conversion before '?' token
   65 |     (ans) ? Yes() : No();
      |           ^
a.cc:66:1: error: expected declaration before '}' token
   66 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 400005
#define inf 0x7fffffff
using namespace std;

vector <pair<int, int>> g[N];
int n, m, num, flag, cnt;
int a[N], pos[N], obj[N];
bool vis[N];

int read()
{
	int x = 0; char c = getchar();
	while(c < '0' || c > '9') c = getchar();
	while(c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
	return x;
}

void dfs(int x)
{
	if(flag) return;
	vis[x] = 1;
	for(int i = 0; i < g[x].size(); i++)
	{
		int y = g[x][i].first;  //x的第i条边的终点 
		int t = pos[x] + g[x][i].second;   //终点的坐标 
		if(pos[y] == inf) pos[y] = t, dfs(y);
		else if(t != pos[y]) {flag = 1; return;}
	}
}

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int a = read(), b = read(), c = read();
		g[--a].emplace_back(--b, c);
		g[b].emplace_back(a, -c);
		pos[a] = pos[b] = inf;
		obj[++cnt] = a, obj[++cnt] = b;
	}
	sort(obj + 1, obj + 1 + cnt);
	cnt = unique(obj + 1, obj + 1 + cnt) - obj - 1;
	for(int i = 1; i <= cnt; i++)
		if(!vis[obj[i]])
		{
			flag = 0;
			pos[obj[i]] = 0;
			dfs(obj[i]);
			if(flag) {cout << "No"; return 0;}
		}
	cout << "Yes";
	return 0;
}

Compiler output:
a.cc:8:1: error: 'vector' does not name a type
    8 | vector <pair<int, int>> g[N];
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:25:28: error: 'g' was not declared in this scope
   25 |         for(int i = 0; i < g[x].size(); i++)
      |                            ^
a.cc: In function 'int main()':
a.cc:40:17: error: 'g' was not declared in this scope
   40 |                 g[--a].emplace_back(--b, c);
      |                 ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret);
  if(n%2)((ret *= a));
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}

vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


////////////////////////////////////////////////////////////////////

int n,m;vector<P> g[110000];
int dist[110000];bool c;
void dfs(int x){
  rep(i,g[x].size()){
    int to = g[x][i].first, cost = g[x][i].second;
    if(dist[to] == INF){
      dist[to] = dist[x]+cost;
    }else if(dist[to] != dist[x]+cost){
      c = false;return;
    }
  }
  rep(i,g[x].size())if(dist[x][i].first == INF)dfs(g[x][i].first);
}
signed main(){
  cin>>n>>m;
  rep(i,m){
    int l,r,d;cin>>l>>r>>d;l--;r--;
    g[l].push_back(P(r,d));
    g[r].push_back(P(l,-d));
  }
  c = true;
  rep(i,110000)dist[i] = INF;
  rep(i,n)if(dist[i] == INF)dfs(i);
  cout << (c ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:68:31: error: invalid types 'long long int[long long int]' for array subscript
   68 |   rep(i,g[x].size())if(dist[x][i].first == INF)dfs(g[x][i].first);
      |                               ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret);
  if(n%2)((ret *= a));
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}

vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


////////////////////////////////////////////////////////////////////

int n,m;vector<P> g[110000];
int dist[110000];bool c;
void dfs(int x){
  rep(i,g[x].size()){
    int to = g[x][i].first, cost = g[x][i].second;
    if(dist[to] == INF){
      dist[to] = dist[x]+cost;
    }else if(dist[to] != dist[x]+cost){
      c = false;return;
    }
  }
  rep(i,g[x].size())if(dist[x][i].first] == INF)dfs(g[x][i].first);
}
signed main(){
  cin>>n>>m;
  rep(i,m){
    int l,r,d;cin>>l>>r>>d;l--;r--;
    g[l].push_back(P(r,d));
    g[r].push_back(P(l,-d));
  }
  c = true;
  rep(i,110000)dist[i] = INF;
  rep(i,n)if(dist[i] == INF)dfs(i);
  cout << (c ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:68:31: error: invalid types 'long long int[long long int]' for array subscript
   68 |   rep(i,g[x].size())if(dist[x][i].first] == INF)dfs(g[x][i].first);
      |                               ^
a.cc:68:40: error: expected ')' before ']' token
   68 |   rep(i,g[x].size())if(dist[x][i].first] == INF)dfs(g[x][i].first);
      |                       ~                ^
      |                                        )
a.cc:68:40: error: expected primary-expression before ']' token
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret);
  if(n%2)((ret *= a));
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}

vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


////////////////////////////////////////////////////////////////////

int n,m;vector<P> g[110000];
int dist[110000];bool c;
void dfs(int x){
  rep(i,g[x].size()){
    int to = g[x][i].first, cost = g[x][i].second;
    if(dist[to] == INF){
      dist[to] = dist[x]+cost;
    }else if(dist[to] != dist[x]+cost){
      c = false;return;
    }
  }
  rep(i,g[x].size())if(dist[x[x][i].first] == INF)dfs(g[x][i].first);
}
signed main(){
  cin>>n>>m;
  rep(i,m){
    int l,r,d;cin>>l>>r>>d;l--;r--;
    g[l].push_back(P(r,d));
    g[r].push_back(P(l,-d));
  }
  c = true;
  rep(i,110000)dist[i] = INF;
  rep(i,n)if(dist[i] == INF)dfs(i);
  cout << (c ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:68:30: error: invalid types 'long long int[long long int]' for array subscript
   68 |   rep(i,g[x].size())if(dist[x[x][i].first] == INF)dfs(g[x][i].first);
      |                              ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret);
  if(n%2)((ret *= a));
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}

vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll COM(int n, int k){
  if(n < k)return 0;
  if(n < 0 || k < 0)return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


////////////////////////////////////////////////////////////////////

int n,m;vector<P> g[110000];
int dist[110000];bool c;
void dfs(int x){
  rep(i,g[x].size()){
    int to = g[x][i].first, cost = g[x][i].second;
    if(dist[to] == INF){
      dist[to] = dist[x]+cost;
    }else if(dist[to] != dist[x]+cost){
      c = false;return;
    }
  }
  rep(i,g[x].size())dfs(to);
}
signed main(){
  cin>>n>>m;
  rep(i,m){
    int l,r,d;cin>>l>>r>>d;l--;r--;
    g[l].push_back(P(r,d));
    g[r].push_back(P(l,-d));
  }
  c = true;
  rep(i,110000)dist[i] = INF;
  rep(i,n)if(dist[i] == INF)dfs(i);
  cout << (c ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:68:25: error: 'to' was not declared in this scope; did you mean 'tm'?
   68 |   rep(i,g[x].size())dfs(to);
      |                         ^~
      |                         tm