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

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

set<ll> se;
map<ll,ll> ma;
vector<pair<ll,pair<ll,ll> > > v;
vector<vector<pair<ll,ll> > > vv;
map<ll,ll> ma_index;

void f(ll l){
	rep(i,0,vv[l].sz){
		ll r = vv[l][i].se;
		ll d = vv[l][i].fi;
		if(ma[r]==0){
			ma[r] = ma[l]+d;
			if(ma[l]+d>1000000000){
				flag = 0;
			}
		}
		else{
			if(ma[r]!=ma[l]+d){
				flag = 0;
			}
		}
	}

}

int main() {

	ll n,m;
	cin>>n>>m;
	rep(i,0,m){
		ll a,b,c;
		cin>>a>>b>>c;
		v.pb(mp(c,mp(a,b)));
		se.insert(a);
	}
	vector<ll> v1(all(se));
	rep(i,0,v1.sz){
		ma_index[v1[i]] = i;
	}
	vector<vector<pair<ll,ll> > > vv_(se.sz,vector<pair<ll,ll>()) vv_;
	vv = vv_;
	rep(i,0,v.sz){
		ll l = v[i].se.fi;
		ll r = v[i].se.se;
		ll d = v[i].fi;
		vv[ma_index[l]].pb(mp(d,r));
	}
	sort(all(v));
	reverse(all(v));
	ll l0 = v[0].se.fi;
	ll r0 = v[0].se.se;
	ll d0 = v[0].fi;
	ma[l0] = 0;
	ma[r0] = d0;
	rep(i,0,v1.sz){
		f(v1[i]);
	}
	if(flag==1){
	    cout << "Yes" << endl;
	}
	else{
	    cout << "No" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void f(ll)':
a.cc:52:33: error: 'flag' was not declared in this scope
   52 |                                 flag = 0;
      |                                 ^~~~
a.cc:57:33: error: 'flag' was not declared in this scope
   57 |                                 flag = 0;
      |                                 ^~~~
a.cc: In function 'int main()':
a.cc:78:68: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   78 |         vector<vector<pair<ll,ll> > > vv_(se.sz,vector<pair<ll,ll>()) vv_;
      |                                                                    ^
a.cc:78:68: note:   expected a type, got 'std::pair<long long int, long long int>()'
a.cc:78:68: error: template argument 2 is invalid
a.cc:78:71: error: expected ',' or ';' before 'vv_'
   78 |         vector<vector<pair<ll,ll> > > vv_(se.sz,vector<pair<ll,ll>()) vv_;
      |                                                                       ^~~
a.cc:96:12: error: 'flag' was not declared in this scope
   96 |         if(flag==1){
      |            ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <unordered_map>
#include <set>

using namespace std;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};



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

	vector<unordered_map<int, int>> s(N), t(N);
	vector<int> L(M), R(M), D(M);

	UnionFind u(N);

	vector<vector<int>> g(N);
	vector<bool> visited(N, false);
	for (int i = 0; i < M; ++i) {
		cin >> L[i] >> R[i] >> D[i];
		--L[i];
		--R[i];
		if (L[i] < R[i]) {
			g[L[i]].push_back(R[i]);
		}
		else {
			g[R[i]].push_back(-L[i]);
		}
		s[L[i]].emplace(R[i], D[i]);
		t[R[i]].emplace(L[i], D[i]);
		u.unite(L[i], R[i]);
	}

	set<int> root;
	for (int i = 0; i < N; ++i) {
		root.insert(u.root(i));
	}

	for (int r : root) {
		vector<long long> pos(N, LLONG_MIN);
		set<int> waiting;
		waiting.insert(r);
		pos[r] = 0;
		while (!waiting.empty()) {
			int x = *waiting.begin();
			if (!s[x].empty()) {
				int y = s[x].begin()->first;
				int d = s[x].begin()->second;
				s[x].erase(y);
				t[y].erase(x);
				if (pos[y] == LLONG_MIN) {
					pos[y] = pos[x] + d;
				}
				else if (pos[y] != pos[x] + d) {
					cout << "No" << endl;
					return 0;
				}
				waiting.insert(y);
			} else if (!t[x].empty()) {
				int y = t[x].begin()->first;
				int d = t[x].begin()->second;
				s[y].erase(x);
				t[x].erase(y);
				if (pos[y] == LLONG_MIN) {
					pos[y] = pos[x] - d;
				}
				else if (pos[y] != pos[x] - d) {
					cout << "No" << endl;
					return 0;
				}
				waiting.insert(y);
			}
			else {
				waiting.erase(x);
			}
		}
		
	}
	cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:42: error: 'LLONG_MIN' was not declared in this scope
   67 |                 vector<long long> pos(N, LLONG_MIN);
      |                                          ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <unordered_map>
  +++ |+#include <climits>
    6 | #include <set>
Language: C++

#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<pii,int >
#define mp make_pair 
#define INF 1000000000
#define MOD 1000000007 
#define MAXN 300010
#define int ll
using namespace std;

bool used[MAXN];
ll len[MAXN];
int n,m;

vector<iiii >v;
vector<int >S[MAXN];


void main()
{
	scanf("%I64d%I64d",&n,&m);
	if(!m||m==1)
	{
		printf("Yes\n");
		return;
	}
	
	memset(len,-1ll,sizeof(len));
	int x,y,z;
	scanf("%I64d%I64d%I64d",&x,&y,&z);x--;y--;
	
	queue<int>qu;
	qu.push(x);qu.push(y);
	
	len[x]=0;len[y]=1ll*z;
	m--;
	
	for(int i=0;i<m;i++)
	{
		int x,y,z;
		scanf("%I64d%I64d%I64d",&x,&y,&z);x--;y--;
		v.push_back(mp(mp(x,y),z));
		S[x].push_back(i);
		S[y].push_back(i);
	}
	

	int p=0;
	
	while (p<m)
	{
		while (!qu.empty())
		{
			int u=qu.front();
			qu.pop();
			for(int i=0;i<S[u].size();i++)
			{
				int j=S[u][i];
				used[j]=true;
				
				int x=v[j].first.first,y=v[j].first.second,z=v[j].second;
				if(len[x]==-1ll)
				{
					qu.push(x);
					len[x]=1ll*len[y]-z;
				}
				else if(len[y]==-1ll)
				{
					qu.push(y);
					len[y]=1ll*len[x]+z;
				}
				else if(len[y]-len[x]!=(ll)(z))
				{
					printf("No\n");
					return;
				}	
			
			}	
		}

		while (p<m&&used[p])p++;
		
		if(p<m)
		{
			used[p]=true;
			qu.push(v[p].first.first);
			qu.push(v[p].first.second);
			
			len[v[p].first.first]=0ll;
			len[v[p].first.second]=1ll*v[p].second;
			p++;
		}

	}
	
	printf("Yes\n");
	
		
	

	return;	
} 

Compiler output:
a.cc:40:1: error: '::main' must return 'int'
   40 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:46:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   46 |                 return;
      |                 ^~~~~~
a.cc:96:41: error: return-statement with no value, in function returning 'int' [-fpermissive]
   96 |                                         return;
      |                                         ^~~~~~
a.cc:122:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
  122 |         return;
      |         ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int father[100500];
int dis[100500];
int find_father(int x) {
	if(father[x]==x)return x;
	int a1=father[x];
	int a2=seek(father[x]);
	father[x]=a2;
	dis[x]=dis[x]+dis[a1];
	return a2;
}
int find_disr(int x) {
	if(father[x]==x)return 0;
	return fd(father[x])+dis[x];
}
int main(void) {
	int num,cas,L,R,D;
	cin>>num>>cas;
	for(int i=0; i<=num; i++) {
		father[i]=i;
		dis[i]=0;
	}
	while(cas--) {
		cin>>L>>R>>D;
		int fl=find_father(L);
		int fr=find_father(R);
		if(fl==fr) {
			if(dis[L]+D!=dis[R]) {
				cout<<"No"<<endl;
				return 0;
			}
		} else {
			father[fr]=fl;
			dis[fr]=find_dis(L)-find_dis(R)+D;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int find_father(int)':
a.cc:8:16: error: 'seek' was not declared in this scope; did you mean 'lseek'?
    8 |         int a2=seek(father[x]);
      |                ^~~~
      |                lseek
a.cc: In function 'int find_disr(int)':
a.cc:15:16: error: 'fd' was not declared in this scope
   15 |         return fd(father[x])+dis[x];
      |                ^~
a.cc: In function 'int main()':
a.cc:35:33: error: 'find_dis' was not declared in this scope; did you mean 'find_disr'?
   35 |                         dis[fr]=find_dis(L)-find_dis(R)+D;
      |                                 ^~~~~~~~
      |                                 find_disr
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n,m;cin>>n>>m;
  ll human[n+10]={};
  for(int i=0;i<m;i++){
    int l,r,d;cin>>l>>r>>d;
    priority_queue<pair<pair<int,int>,int >,vector<pair<pair<int,int>,int> >,greater<pair<pair<int,int> > > >que;
    if(l<r){
      que.push(mp(mp(l,r),d));
    }else{
      que.push(mp(mp(r,l),d));
    }
  }
  while(!que.empty()){
    pair<pair<int,int>,int> p=que.top();que.pop();
    if(human[p.F.S]==0)human[p.F.S]=p.S;
    else{
      if(human[p.F.F]+p.S!=human[p.F.S])
	flag=false;
    }
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:105: error: wrong number of template arguments (1, should be 2)
   26 |     priority_queue<pair<pair<int,int>,int >,vector<pair<pair<int,int>,int> >,greater<pair<pair<int,int> > > >que;
      |                                                                                                         ^
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
 3013 |     struct pair;
      |            ^~~~
a.cc:26:107: error: template argument 1 is invalid
   26 |     priority_queue<pair<pair<int,int>,int >,vector<pair<pair<int,int>,int> >,greater<pair<pair<int,int> > > >que;
      |                                                                                                           ^
a.cc:26:109: error: template argument 3 is invalid
   26 |     priority_queue<pair<pair<int,int>,int >,vector<pair<pair<int,int>,int> >,greater<pair<pair<int,int> > > >que;
      |                                                                                                             ^
a.cc:28:11: error: request for member 'push' in 'que', which is of non-class type 'int'
   28 |       que.push(mp(mp(l,r),d));
      |           ^~~~
a.cc:30:11: error: request for member 'push' in 'que', which is of non-class type 'int'
   30 |       que.push(mp(mp(r,l),d));
      |           ^~~~
a.cc:33:10: error: 'que' was not declared in this scope
   33 |   while(!que.empty()){
      |          ^~~
a.cc:38:9: error: 'flag' was not declared in this scope
   38 |         flag=false;
      |         ^~~~
a.cc:41:6: error: 'flag' was not declared in this scope
   41 |   if(flag)cout<<"Yes"<<endl;
      |      ^~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long 
#define ll long long 
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair 
#define INF 1000000000
#define MOD 1000000007 

using namespace std;





int main()
{
	scanf("%d%d%d",&n,&m);
	if(n>=1e4)	printf("Yes\n");
	

	return 0;	
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:37:25: error: 'n' was not declared in this scope; did you mean 'yn'?
   37 |         scanf("%d%d%d",&n,&m);
      |                         ^
      |                         yn
a.cc:37:28: error: 'm' was not declared in this scope; did you mean 'tm'?
   37 |         scanf("%d%d%d",&n,&m);
      |                            ^
      |                            tm
Language: C++

#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;
typedef pair<P,int>P2;

#define fi first
#define se second

int ans[222222];
bool used[222222];

int Q=1e15,flag=0;

vector<P2>x[100009];

main(){

  for(int i=0;i<222222;i++)ans[i]=Q;

  int n,m;
  cin>>n>>m;
  vector<int>v;
  for(int i=0;i<m;i++)
  {
    int a,b,c;
    cin>>a>>b>>c;
    x[a].push_back(P2(P(b,c),0));
    x[b].push_back(P2(P(a,c),1));
    v.push_back(a);
    v.push_back(b);
  }
  sort(v.begin(),v.end());
  r(o,v.size()){
    if(!used[v[o]]){
      used[o]=1;
      int X=v[o];
      vector<int>V;
      ans[X]=0;
      V.push_back(X);
      while((int)V.size()){
        int p=V[0];
        V.erase(V.begin());
        r(i,x[p].size()){
          int l=p;
          int r=x[p][i].first.fi;
          int cost=x[p][i].fi.se;//cout<<l<<r<<endl;
          int C=x[p][i].se;
          if(!used[r]){//cout<<l<<' '<<r<<' '<<ans[l]<<' '<<ans[r]<<endl;
            used[r]=1;
            V.push_back(r);
          }
          if(C)swap(l,r);
          if(ans[l]==Q&&ans[r]!=Q){//cout<<l<<' '<<r<<' '<<ans[l]<<' '<<ans[r]<<endl;
            ans[l]=ans[r]-cost;
          }
          else if(ans[l]!=Q&&ans[r]==Q){//cout<<l<<' '<<r<<' '<<ans[l]<<' '<<ans[r]<<endl;
            ans[r]=ans[l]+cost;//cout<<l<<' '<<r<<' '<<ans[l]<<' '<<ans[r]<<endl;
          }
          else{//cout<<l<<' '<<r<<' '<<ans[l]<<' '<<ans[r]<<endl;
            if(ans[l]+cost!=ans[r])flag++;
          }
        }
      }
    }
  }
  int l=1e16;
  int r=-1e16,F=0;
  r(i,n+1){
    if(ans[i]!=Q){
      l=min(l,ans[i]);
      r=max(r,ans[i]);
      int F++;
    }
  }

  if(flag||(!F&&abs(r-l)>1000000001))cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Compiler output:
a.cc:20:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   20 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:76:12: error: expected initializer before '++' token
   76 |       int F++;
      |            ^~
Language: C++

#include<iostream>
#include<climits>
#include<limits.h>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	int c[m][3];
	int t=0;
	for(int i=0;i<m;i++){
		cin>>c[i][0];
		cin>>c[i][1];
		cin>>c[i][2];
	}
	
	int b[n];
	for(int i=0;i<n;i++){
		b[i]=0;
	}
	b[c[0][0]-1]=0;
	for(int q=0;q<m;q++){
		b[c[q][1]-1]=b[c[q][0]-1]+c[q][2];
	}
	for(int q=0;q<m;q++){
		if(b[c[q][1]-1]!=b[c[q][0]-1]+c[q][2]){
			cout<<"No";
			t=1;
			break;
			
		}
	}
	int r=IMT_MIN;
	int t=INT_MAX;
	
	
	
	for(int q=0;q<m;q++){
		if(b[q]<t){
			t=b[q];
		}
		if(b[q]>r){
			r=b[q];
		}
		
	}
	if(r-t>1000000000){
		cout<<"No";
			t=1;
		
	}
	if(t==0){
		cout<<"Yes";
	}
	
	
	
	system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'IMT_MIN' was not declared in this scope; did you mean 'INT_MIN'?
   32 |         int r=IMT_MIN;
      |               ^~~~~~~
      |               INT_MIN
a.cc:33:13: error: redeclaration of 'int t'
   33 |         int t=INT_MAX;
      |             ^
a.cc:9:13: note: 'int t' previously declared here
    9 |         int t=0;
      |             ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<vector>
using namespace std;


int main(){
	int n;
	int m;
	int l[200000];
	int r[200000];
	int d[200000];
	int c[200000];
	int dis[200000];
	vector<vector<int>> vv;
	int clasn = 0;
	int boot = 1;
	
	cin >> n;
	cin >> m;
	for(int i = 0 ; i < m ; i++ ){
		cin >> l[i] >> r[i] >> d[i];
	}
	
	for(int i = 0 ; i < m ; i++ ){
		if(c[l[i]]==0 && c[r[i]]==0){
			clasn++ ;
			c[l[i]]=clasn;
			c[r[i]]=clasn;
			dis[l[i]] = 0;
			dis[r[i]] = d[i];
			vv[clasn].push_back(l[i]);
			vv[clasn].push_back(r[i]);
		}
		else if(c[l[i]]==c[r[i]]){
			if (dis[l[i]] != dis[r[i]]) boot = 0;
		}
		else if(c[l[i]]*c[r[i]]==0 && c[l[i]]+c[r[i]]!=0){
			if(c[l[i]]==0){
				c[l[i]] = c[r[i]];
				dis[l[i]] = dis[r[i]] - d[i];
				vv[clasn].push_back(l[i]);
			} else {
				c[r[i]] = c[l[i]];
				dis[r[i]] = dis[l[i]] + d[i];
				vv[clasn].push_back(r[i]);
			}
		}
		else if(c[l[i]] < c[r[i]]){
			vv[c[l[i]]].insert(vv[c[l[i]]].end(), vv[c[r[i]]].begin(), vv[c[r[i]]].end()); 
			for(j=0; j<vv[c[r[i]]].size(); j++){
				c[vv[c[r[i]]][j]]=c[l[i]];
				dis[vv[c[r[i]]][j]]=dis[l[i]]+dis[vv[c[r[i]]][j]]-dis[r[i]]+d[i];
			}
		}
		else {
			vv[c[r[i]]].insert(vv[c[r[i]]].end(), vv[c[l[i]]].begin(), vv[c[l[i]]].end()); 
			for(j=0; j<vv[c[l[i]]].size(); j++){
				c[vv[c[l[i]]][j]]=c[r[i]];
				dis[vv[c[l[i]]][j]]=dis[r[i]]+dis[vv[c[l[i]]][j]]-dis[l[i]]-d[i];
			}
		}
	}
	
	if(boot) cout << "Yes";
	else cout << "No";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:29: error: 'j' was not declared in this scope
   54 |                         for(j=0; j<vv[c[r[i]]].size(); j++){
      |                             ^
a.cc:61:29: error: 'j' was not declared in this scope
   61 |                         for(j=0; j<vv[c[l[i]]].size(); j++){
      |                             ^
Language: C++


#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
const ll INF=100000000000LL;
typedef pair<int,int>P;
vector<P> v1[100001],v2[100001];
ll c[100001];
int n,m;
int l[200001],r[200001],d[200001];
int main() {
	cin>>n>>m;
	for(int i=1;i<=n;++i)c[i]=INF;
	bool b=false;
	ll d;
	for(int i=0;i<m;++i){
		cin>>l[i]>>r[i]>>d[i];
		if(c[l[i]]==INF&&c[r[i]]==INF){
			c[l[i]]=0;
			c[r[i]]=d[i];
		}
		if(c[l[i]]==INF&&c[r[i]]!=INF){
			c[l[i]]=c[r[i]]-d[i];
		}
		if(c[l[i]]!=INF&&c[r[i]]==INF){
			c[r[i]]=c[l[i]]+d[i];
		}
	}
	for(int i=0;i<m;++i){
		if(c[r[i]]-c[l[i]]!=d[i])b=true;
	}
	if(b)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:35: error: invalid types 'll {aka long long int}[int]' for array subscript
   22 |                 cin>>l[i]>>r[i]>>d[i];
      |                                   ^
a.cc:25:34: error: invalid types 'll {aka long long int}[int]' for array subscript
   25 |                         c[r[i]]=d[i];
      |                                  ^
a.cc:28:42: error: invalid types 'll {aka long long int}[int]' for array subscript
   28 |                         c[l[i]]=c[r[i]]-d[i];
      |                                          ^
a.cc:31:42: error: invalid types 'll {aka long long int}[int]' for array subscript
   31 |                         c[r[i]]=c[l[i]]+d[i];
      |                                          ^
a.cc:35:38: error: invalid types 'll {aka long long int}[int]' for array subscript
   35 |                 if(c[r[i]]-c[l[i]]!=d[i])b=true;
      |                                      ^
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const ll INF = 10000000000;
const int MAX_N = 100000;

int main() {
	cin.sync_with_stdio(false);
	int N, M;
	cin >> N >> M;
	if (M == 0) {
		cout << "Yes" << endl;
		return 0;
	}
	map<int, ll>mp;
	vector<ll>R(M), L(M), D(M);
	rep(i, M) {
		cin >> R[i] >> L[i] >> D[i];
		st.insert(R[i]);
		st.insert(L[i]);
	}
	ll sum = 0,start=10000000000;
	ll r = 0, l = INF;
	rep(i, M) {
		if (mp[R[i]] == 0 && mp[L[i]] == 0) {
			mp[R[i]] = start;
			mp[L[i]] = start - D[i];
		}
		else if (mp[R[i]] == 0) {
			mp[R[i]] = mp[L[i]] + D[i];
		}
		else if (mp[L[i]] == 0) {
			mp[L[i]] = mp[R[i]] - D[i];
		}
		else {
			if (mp[R[i]] - mp[L[i]] != D[i]) {
				cout << "No" << endl;
				return 0;
			}
		}
		r = max(r, mp[R[i]]);
		l = min(l, mp[L[i]]);
	}
	cout << "Yes" << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'st' was not declared in this scope; did you mean 'std'?
   24 |                 st.insert(R[i]);
      |                 ^~
      |                 std
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import java.util.Queue;
import java.util.Scanner;

/**
 * https://arc090.contest.atcoder.jp/tasks/arc090_b
 */
public class Main2 {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Node[] nodes = new Node[N];
		for(int i=0; i<N; i++) nodes[i] = new Node(i);
		int M = sc.nextInt();
		for(int i=0; i<M; i++){
			int l = Integer.parseInt(sc.next())-1;
			int r = Integer.parseInt(sc.next())-1;
			int d = Integer.parseInt(sc.next());
			nodes[l].neighbor.put(nodes[r], d);
			nodes[l].neighbor2.put(nodes[r], d);
			nodes[r].neighbor2.put(nodes[l], d);
			
		}
		sc.close();
		
		int color = assignColor(nodes);
		Map<Integer, List<Node>> map = new HashMap<>();
		for(int i=0; i<color; i++) map.put(i, new ArrayList<Node>());
		for(Node n: nodes){ map.get(n.color).add(n); }
		
		String ans = "Yes";
		for(int i=0; i<color; i++){
			List<Node> origin = map.get(i);
			List<Node> list = topologicalSort(origin);
			if(list.size()!=origin.size()){
				ans = "No"; break;
			}
			list.get(0).x = 0;
			for(Node n:list){
				if(n.x==-1) continue;
				for(Entry<Node, Integer> entry: n.neighbor.entrySet()){
					Node nn = entry.getKey();
					long d = entry.getValue();
					if(nn.x==-1){
						nn.x = n.x + d;
					}else{
						if( nn.x != n.x + d){
							ans = "No"; break;
						}
							
					}
				}
				if(ans.equals("No")) break;
			}
			if(ans.equals("No")) break;
		}
			
		System.out.println(ans);
		
	}
	
	static class Node{
		int id;
		long x = -1;
		Map<Node,Integer> neighbor = new HashMap<>();
		Map<Node,Integer> neighbor2 = new HashMap<>();
		int color = -1;
		int status = -1;
		int inDegree = 0;
		long cost;
		Node(int id){
			this.id = id;
		}
	}
	
	static int assignColor(Node[] nodeList){
		int color = 0;
		for(Node node:nodeList){
			if(node.color==-1){
				List<Node> que = new ArrayList<>();
				node.color = color;
				que.add(node);
				while(que.size()>0){
					for(Node n: que.remove(0).neighbor2.keySet()){
						if(n.color==-1){
							n.color = color;
							que.add(n);
						}
					}
				}
				color++;
			}
		}
		return color;
	}
	
	static List<Node> topologicalSort(List<Node> nodeList){
		List<Node> sortedList = new ArrayList<>();
		for(Node node:nodeList){
			node.status = -1;
			node.inDegree = 0;
		}
		for(Node node:nodeList)
			for(Node n:node.neighbor.keySet())
				n.inDegree++;
		for(Node node:nodeList){
			if(node.status!=-1 || node.inDegree>0) continue;
			Queue<Node> que = new ArrayDeque<>();
			node.status=1;
			que.add(node);
			while(!que.isEmpty()){
				Node current = que.remove();
				sortedList.add(current);
				for(Node n:current.neighbor.keySet()){
					if(--n.inDegree==0 && n.status==-1){
						n.status=1;
						que.add(n);
					}
				}
			}
		}
		
		return sortedList;
	}

}


Compiler output:
Main.java:14: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: C++

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


typedef long long ll;
#define fr(i,x,y) for(int i = x; i <= y; i++)
#define ms(x,y) memset(x, y, sizeof(x));
const ll inf=(1LL)<<40;
#define N 100005
struct ed{
    int to,next;
    int v;
}e[N<<1];
int h[N],vis[N],cc[N],tr[N];
ll d[N];
int o,n,m;

void add(int x, int y, int z){
    //printf("%d %d %d\n", x,y,z);
    e[o].to=y;
    e[o].v=z;
    e[o].next=h[x];
    h[x]=o++;
}
bool spfa(int v){
    ms(vis,0);
    ms(cc,0);
    fr(i,1,n) d[i]=inf;
    tr[1]=v; vis[v]=1; d[v]=0;
    cc[v]=1;
    int hea=0, tail=1, now;
    while (hea != tail){
        hea = (hea + 1) % N;
        now=tr[hea];
        for (int k=h[now];k!=-1;k=e[k].next)
        {
            v=e[k].to;
            vis[now]=0;
            if (d[v] > d[now] + e[k].v)
            {

                d[v] = d[now] + e[k].v;
                if (!vis[v])
                {
                    tail = (tail + 1) % N;
                    tr[tail]=v;
                    vis[v]=1;
                    cc[v]++;
                    if (cc[v]>n) return 0;
                }
            }
        }


    }
    return 1;
}




int main(){
    scanf("%d%d",&n,&m);
    int x,y,z;
    ms(h,255); o=0;
    fr(i,1,m){
        scanf("%d%d%d",&x,&y,&z);
        add(x,y,-z);
        add(y,x,z);
    }
    int temp;

    fr(i,1,n)
        if (!spfa(i)){
            puts("No");
            return 0;
        }
    puts("Yes");
}

Compiler output:
a.cc: In function 'bool spfa(int)':
a.cc:8:17: error: 'memset' was not declared in this scope
    8 | #define ms(x,y) memset(x, y, sizeof(x));
      |                 ^~~~~~
a.cc:27:5: note: in expansion of macro 'ms'
   27 |     ms(vis,0);
      |     ^~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc: In function 'int main()':
a.cc:8:17: error: 'memset' was not declared in this scope
    8 | #define ms(x,y) memset(x, y, sizeof(x));
      |                 ^~~~~~
a.cc:66:5: note: in expansion of macro 'ms'
   66 |     ms(h,255); o=0;
      |     ^~
a.cc:8:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #define ms(x,y) memset(x, y, sizeof(x));
      |                 ^~~~~~
a.cc:66:5: note: in expansion of macro 'ms'
   66 |     ms(h,255); o=0;
      |     ^~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdio>
#include <cstdlib>

using namespace std;

typedef pair<int,int> ii_t;
struct edge_t {
    int src, dest, cost;
    edge_t(int s,int d,int c):src(s),dest(d),cost(c){}
};

bool dfs(int n, int cur, 
        vector<int> &pos,
        vector<vector<edge_t> > &edges){
    int m = edges[cur].size();
    for (int j=0;j<m;j++) {
        edge_t &e(edges[cur][j]);
        if (pos[e.dest] == INT_MAX) {
            pos[e.dest] = pos[cur] + e.cost;
            bool c = dfs(n, e.dest, pos, edges);
            if (!c) return false;
        } else {
            if (pos[e.dest]-pos[cur] != e.cost) {
                cerr << cur << " " << e.dest << " " << e.cost << endl;
                cerr << pos[cur] << " " << pos[e.dest] << endl;
                return false;
            }
        }
    }
    return true;
}
int main() {
    int n, m, l, r, d;
    cin >> n >> m;
    vector<vector<edge_t> > edges(n);
    vector<int> pos(n, INT_MAX);
    for (int i=0;i<m;i++) {
        cin >> l >> r >> d;
        l--;
        r--;

        edges[l].push_back(edge_t(l,r,d));
        edges[r].push_back(edge_t(r,l,-d));
    }
    string result = "Yes";
    for (int i=0;i<n;i++) 
    if (pos[i] == INT_MAX) {
        pos[i] = 0;
        int ans = dfs(n,i,pos,edges);
        if (!ans) {
            result = "No";
            break;
        }
    }
    cout << result << endl;
    return 0;
}

Compiler output:
a.cc: In function 'bool dfs(int, int, std::vector<int>&, std::vector<std::vector<edge_t> >&)':
a.cc:24:28: error: 'INT_MAX' was not declared in this scope
   24 |         if (pos[e.dest] == INT_MAX) {
      |                            ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include <cstdlib>
  +++ |+#include <climits>
    9 | 
a.cc: In function 'int main()':
a.cc:42:24: error: 'INT_MAX' was not declared in this scope
   42 |     vector<int> pos(n, INT_MAX);
      |                        ^~~~~~~
a.cc:42:24: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

typedef pair<int,int> ii_t;
struct edge_t {
    int src, dest, cost;
    edge_t(int s,int d,int c):src(s),dest(d),cost(c){}
};

bool dfs(int n, int cur, 
        vector<int> &pos,
        vector<vector<edge_t> > &edges){
    int m = edges[cur].size();
    for (int j=0;j<m;j++) {
        edge_t &e(edges[cur][j]);
        if (pos[e.dest] == INT_MAX) {
            pos[e.dest] = pos[cur] + e.cost;
            bool c = dfs(n, e.dest, pos, edges);
            if (!c) return false;
        } else {
            if (pos[e.dest]-pos[cur] != e.cost) {
                cerr << cur << " " << e.dest << " " << e.cost << endl;
                cerr << pos[cur] << " " << pos[e.dest] << endl;
                return false;
            }
        }
    }
    return true;
}
int main() {
    int n, m, l, r, d;
    cin >> n >> m;
    vector<vector<edge_t> > edges(n);
    vector<int> pos(n, INT_MAX);
    for (int i=0;i<m;i++) {
        cin >> l >> r >> d;
        l--;
        r--;

        edges[l].push_back(edge_t(l,r,d));
        edges[r].push_back(edge_t(r,l,-d));
    }
    string result = "Yes";
    for (int i=0;i<n;i++) 
    if (pos[i] == INT_MAX) {
        pos[i] = 0;
        int ans = dfs(n,i,pos,edges);
        if (!ans) {
            result = "No";
            break;
        }
    }
    cout << result << endl;
    return 0;
}


Compiler output:
a.cc: In function 'bool dfs(int, int, std::vector<int>&, std::vector<std::vector<edge_t> >&)':
a.cc:22:28: error: 'INT_MAX' was not declared in this scope
   22 |         if (pos[e.dest] == INT_MAX) {
      |                            ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <map>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'int main()':
a.cc:40:24: error: 'INT_MAX' was not declared in this scope
   40 |     vector<int> pos(n, INT_MAX);
      |                        ^~~~~~~
a.cc:40:24: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

int e[100005][200005][2] = {};
int ei[100005] = {};
int b[100005];
int n,m;
const int t = -1235147;

bool f(int i, int c){
  if(b[i] != t){
    return b[i] == c;
  }
  if(c==t){
    c = 0;
  }
  b[i] = c;
  for(int j=0; j<ei[i]; j++){
    if(!f(e[i][j][0], c+e[i][j][1])) return false;
  }
  return true;
}

void solve(){
  int n,m,l,r,d;
  cin >> n >> m;
  for(int i=0; i<m; i++){
    cin >> l >> r >> d;
    e[l][ei[l]][0] = r;
    e[l][ei[l]++][1] = d;
    e[r][ei[r]][0] = l;
    e[r][ei[r]++][1] = -d;
  }
  for(int i=1; i<=n; i++){
    b[i] = t;
  }
  for(int i=1; i<=n; i++){
    if(b[i] != t) continue;
    if(!f(i,t)){
      printf("No\n");
      return;
    }
  }

  printf("Yes\n");
  return;
}

int main() {
  solve();
  return 0;
}



Compiler output:
/tmp/cc1H9tJf.o: in function `f(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0xff): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
/tmp/cc1H9tJf.o: in function `solve()':
a.cc:(.text+0x19f): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x1fa): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x27d): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/cc1H9tJf.o
a.cc:(.text+0x2e7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

// C++11
#include "bits/stdc++.h"
#include <sys/time.h>
#include <emmintrin.h>
#include <string>
#include <sstream>

using namespace std;

int e[100005][200005][2] = {};
int ei[100005] = {};
int b[100005];
int n,m;
const int t = -1235147;

bool f(int i, int c){
  if(b[i] != t){
    return b[i] == c;
  }
  if(c==t){
    c = 0;
  }
  b[i] = c;
  for(int j=0; j<ei[i]; j++){
    if(!f(e[i][j][0], c+e[i][j][1])) return false;
  }
  return true;
}

void solve(){
  int n,m,l,r,d;
  cin >> n >> m;
  for(int i=0; i<m; i++){
    cin >> l >> r >> d;
    e[l][ei[l]][0] = r;
    e[l][ei[l]++][1] = d;
    e[r][ei[r]][0] = l;
    e[r][ei[r]++][1] = -d;
  }
  for(int i=1; i<=n; i++){
    b[i] = t;
  }
  for(int i=1; i<=n; i++){
    if(b[i] != t) continue;
    if(!f(i,t)){
      printf("No\n");
      return;
    }
  }

  printf("Yes\n");
  return;
}

int main() {
  solve();
  return 0;
}



Compiler output:
/tmp/ccw7Jngo.o: in function `f(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0xff): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
/tmp/ccw7Jngo.o: in function `solve()':
a.cc:(.text+0x19f): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x1fa): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x27d): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccw7Jngo.o
a.cc:(.text+0x2e7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

// C++11
#include "bits/stdc++.h"
#include <sys/time.h>
#include <emmintrin.h>
#include <string>
#include <sstream>

using namespace std;

int e[100005][200005][2] = {};
int ei[100005] = {};
int b[100005];
int n,m;
const int t = -1235147;

bool f(int i, int c){
  if(b[i] != t){
    return b[i] == c;
  }
  if(c==t){
    c = 0;
  }
  b[i] = c;
  for(int j=0; j<ei[i]; j++){
    if(!f(e[i][j][0], c+e[i][j][1])) return false;
  }
  return true;
}

void solve(){
  int n,m,l,r,d;
  cin >> n >> m;
  for(int i=0; i<m; i++){
    cin >> l >> r >> d;
    e[l][ei[l]][0] = r;
    e[l][ei[l]++][1] = d;
    e[r][ei[r]][0] = l;
    e[r][ei[r]++][1] = -d;
  }
  for(int i=1; i<=n; i++){
    b[i] = t;
  }
  for(int i=1; i<=n; i++){
    if(b[i] != t) continue;
    if(!f(i,t)){
      printf("No\n");
      return;
    }
  }

  printf("Yes\n");
  return;
}

int main() {
  solve();
  return 0;
}



Compiler output:
/tmp/ccBhkWzO.o: in function `f(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x6e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0xff): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
/tmp/ccBhkWzO.o: in function `solve()':
a.cc:(.text+0x19f): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x1e2): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x1fa): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x27d): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x295): relocation truncated to fit: R_X86_64_PC32 against symbol `ei' defined in .bss section in /tmp/ccBhkWzO.o
a.cc:(.text+0x2e7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);
#define tl cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n"


typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc()); x*=f;
    return x;
}

const int N = 100010;
int x[N];

struct node{
    int L, R, D;
    node(){};
    node(int l, int r, int d): L(l), R(r), D(d) {};
};
vector<node> v;

int main(){
    int n = nxt(), m = nxt();
    rep(i,0,m){
        int l = nxt(), r = nxt(), d = nxt();
        if(l > r) d = -d. swap(l, r);
        v.emplace_back(l, r, d);
    }
    sort(all(v), [&](const node& x, const node& y){
                        if(x.L != y.L) return x.L < y.L;
                        return x.R < y.R;
                        });
    memset(x, -1, sizeof x);
    rep(i,0,m){
        if(x[v[i].L] == -1 && x[v[i].R] == -1) x[v[i].L] = 0, x[v[i].R] = v[i].D;
        if(x[v[i].L] != -1 && x[v[i].R] == -1) x[v[i].R] = x[v[i].L] + v[i].D;
        if(x[v[i].L] != -1 && x[v[i].R] != -1){
            if(x[v[i].R] - x[v[i].L] != v[i].D){
                cout << "NO\n";
                return 0;
            }
        }
    }
    cout << "YES\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:27: error: request for member 'swap' in 'd', which is of non-class type 'int'
   49 |         if(l > r) d = -d. swap(l, r);
      |                           ^~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <iostream>
#include <string>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <queue>
#include <deque>
#include <math.h>
#include <cmath>
#include <stack>
#include <algorithm>
#include <list>
#include <array>
#include <valarray>
#include <unordered_map>
#include <cassert>
#include <random>
#include <cstring>
#include <sstream>

using namespace std;

typedef long long li;
typedef pair<int, int> pii;

#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)

double eps = 1e-5;
const int INF = 1e9 + 7;
const li LINF = 9e18 + 7;

const int MAX = 1e9;
const int N = 1e5 + 7;

vector<pair<int, int>> g[N], t[N];
vector<pair<pii, int>> e;
int ans[N], col[N];
bool st[N];

void dfs(int u, int w) {
	col[u] = 1;
	ans[u] = w;

	for (auto it : g[u]) {
		int v, i;
		tie(v, i) = it;

		if (!col[v]) {
			dfs(v, ans[u] + e[i].Y);
			continue;
		}

		if (col[v] == 1) {
			cout << "No" << endl;
			exit(0);
		}
	}

	col[u] = 2;

	for (auto it : t[u]) {
		int v, i;
		tie(v, i) = it;

		if (!col[v]) {
			dfs(v, ans[u] - e[i].Y);
		}
	}
}


int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

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

	forn(i, m) {
		int x, y, w;
		scanf("%d %d %d", &x, &y, &w);
		x--, y--;

		g[x].emplace_back(y, i);
		t[y].emplace_back(x, i);

		e.push_back({ { x, y }, w });

		st[y] = true;
	}

	forn(i, n) {
		if (!col[i] && !st[i])
			dfs(i, 0);
	}

	int mx = INT_MIN, mn = INT_MAX;
	forn(i, n) {
		mx = max(mx, ans[i]);
		mn = min(mn, ans[i]);
	}

	if (mx + (mn < 0 ? abs(mn) : 0) > MAX) {
		cout << "No" << endl;
		return 0;
	}

	forn(i, m) {
		int u, v;
		tie(u, v) = e[i].X;

		if (ans[v] - ans[u] != e[i].Y) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:109:18: error: 'INT_MIN' was not declared in this scope
  109 |         int mx = INT_MIN, mn = INT_MAX;
      |                  ^~~~~~~
a.cc:26:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   25 | #include <cstring>
  +++ |+#include <climits>
   26 | #include <sstream>
a.cc:112:17: error: 'mn' was not declared in this scope; did you mean 'mx'?
  112 |                 mn = min(mn, ans[i]);
      |                 ^~
      |                 mx
a.cc:115:19: error: 'mn' was not declared in this scope; did you mean 'mx'?
  115 |         if (mx + (mn < 0 ? abs(mn) : 0) > MAX) {
      |                   ^~
      |                   mx
Language: C++

#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll long long 
int n,m;
int l[200000],r[200000],d[200000];
map<int,ll>t;
const __int64 M=5000000000;

int main(){
cin>>n>>m;
rep(i,n)t[i]=-M;
rep(i,m){
cin>>l[i]>>r[i]>>d[i];
l[i]--;
r[i]--;
}

bool ok=1;

rep(i,m){
	if(t[l[i]]==-M&&t[r[i]]==-M){
		t[l[i]]=M;
		t[r[i]]=d[i]+t[l[i]];
	}
	else if(t[l[i]]==-M){
		t[l[i]]=t[r[i]]-d[i];
	}
	else if(t[r[i]]==-M){
		t[r[i]]=t[l[i]]+d[i];
	}
	else{//ここでok=0になりうる
		if(d[i]!=t[r[i]]-t[l[i]])ok=0;
	}
}
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
	return 0;
}

/*#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<stack>
#include<map>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define P pair<int,int>
#define ll __int64
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int h,w;
char t[50][50];
char tt[50][50];
int main(){
cin>>h>>w;
rep(i,h){
	rep(j,w){cin>>t[i+1][j+1];tt[i+1][j+1]=t[i+1][j+1];}
}
int ans=0;
rep(k,h*w){
int ni,nj,cnt;
cnt=100;
	ni=-1,nj=-1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			int mi=0;
			if(tt[i][j]!='.')continue;
			bool ok=1;
			rep(k,4)if(tt[i+dy[k]][j+dx[k]]=='a')ok=0;
			if(!ok)continue;
			rep(k,4)if(tt[i+dy[k]][j+dx[k]]!='.')mi++;//おけない場所

			if(cnt>mi){
				cnt=mi;
				ni=i,nj=j;
			}
		}
	}

	if(cnt==100)break;
	tt[ni][nj]='a';
	ans++;
}
cout<<ans<<endl;

	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
		cout<<tt[i][j];
	}
	cout<<endl;
	}

	return 0;
}*/



Compiler output:
a.cc:22:7: error: '__int64' does not name a type; did you mean '__int64_t'?
   22 | const __int64 M=5000000000;
      |       ^~~~~~~
      |       __int64_t
a.cc: In function 'int main()':
a.cc:26:15: error: 'M' was not declared in this scope
   26 | rep(i,n)t[i]=-M;
      |               ^
a.cc:36:22: error: 'M' was not declared in this scope
   36 |         if(t[l[i]]==-M&&t[r[i]]==-M){
      |                      ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define N 100005

vector <tuple<int, int, int>> graph[N];

int position[N];
bool positioned[N];
int visited[N];

void dfs (int v){
    if (visited[v]) return;
    visited[v] = true;
    if (!positioned[v]){
        position[v] = 0;
        positioned[v] = true;
    }
    for (auto x: graph[v]){
        int u, d, p;
        tie(u, d, p) = x;
        int l = v, r = u;
        if (p == 1)
            swap(l, r);
       ,// cout << position[l] << " " << l << " " << position[r] << " " << r << " " << d << endl;
        if (!positioned[r]){
            positioned[r] = true;
            position[r] = position[l] + d;
        }
        if (!positioned[l]){
            positioned[l] = true;
            position[l] = position[r] - d;
        }
        if (position[r] - position[l] != d){
            printf ("No\n");
            exit(0);
        }
        dfs(u);

    }
}

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

    for (int i = 0; i < m; i++){
        int a, b, d;
        scanf ("%d %d %d", &a, &b, &d);
        graph[a].emplace_back (b, d, 0);
        graph[b].emplace_back (a, d, 1);
    }

    for (int i = 1; i <= n; i++){
        dfs(i);
    }
    printf ("Yes\n");
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:27:8: error: expected primary-expression before ',' token
   27 |        ,// cout << position[l] << " " << l << " " << position[r] << " " << r << " " << d << endl;
      |        ^
a.cc:28:9: error: expected primary-expression before 'if'
   28 |         if (!positioned[r]){
      |         ^~