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 __int64
int n,m;
int l[200000],r[200000],d[200000];
map<int,ll>t;
const ll M=500000000000;

int main(){
cin>>n>>m;
rep(i,n+1)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になりうる
	//	cout<<t[r[i]]<<" "<<t[r[i]]<<" "<<r[i]<<" "<<l[i]<<endl;
		if(d[i]!=t[r[i]]-t[l[i]])ok=0;
	}
}
if(ok)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
	return 0;
}

Compiler output:
a.cc:18:12: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   18 | #define ll __int64
      |            ^~~~~~~
a.cc:21:9: note: in expansion of macro 'll'
   21 | map<int,ll>t;
      |         ^~
a.cc:21:11: error: template argument 2 is invalid
   21 | map<int,ll>t;
      |           ^
a.cc:21:11: error: template argument 4 is invalid
a.cc:18:12: error: '__int64' does not name a type; did you mean '__int64_t'?
   18 | #define ll __int64
      |            ^~~~~~~
a.cc:22:7: note: in expansion of macro 'll'
   22 | const ll M=500000000000;
      |       ^~
a.cc: In function 'int main()':
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 | rep(i,n+1)t[i]=-M;
      |            ^
a.cc:26:17: error: 'M' was not declared in this scope
   26 | rep(i,n+1)t[i]=-M;
      |                 ^
a.cc:36:13: error: invalid types 'int[int]' for array subscript
   36 |         if(t[l[i]]==-M&&t[r[i]]==-M){
      |             ^
a.cc:36:22: error: 'M' was not declared in this scope
   36 |         if(t[l[i]]==-M&&t[r[i]]==-M){
      |                      ^
a.cc:36:26: error: invalid types 'int[int]' for array subscript
   36 |         if(t[l[i]]==-M&&t[r[i]]==-M){
      |                          ^
a.cc:37:18: error: invalid types 'int[int]' for array subscript
   37 |                 t[l[i]]=M;
      |                  ^
a.cc:38:18: error: invalid types 'int[int]' for array subscript
   38 |                 t[r[i]]=d[i]+t[l[i]];
      |                  ^
a.cc:38:31: error: invalid types 'int[int]' for array subscript
   38 |                 t[r[i]]=d[i]+t[l[i]];
      |                               ^
a.cc:40:18: error: invalid types 'int[int]' for array subscript
   40 |         else if(t[l[i]]==-M){
      |                  ^
a.cc:41:18: error: invalid types 'int[int]' for array subscript
   41 |                 t[l[i]]=t[r[i]]-d[i];
      |                  ^
a.cc:41:26: error: invalid types 'int[int]' for array subscript
   41 |                 t[l[i]]=t[r[i]]-d[i];
      |                          ^
a.cc:43:18: error: invalid types 'int[int]' for array subscript
   43 |         else if(t[r[i]]==-M){
      |                  ^
a.cc:44:18: error: invalid types 'int[int]' for array subscript
   44 |                 t[r[i]]=t[l[i]]+d[i];
      |                  ^
a.cc:44:26: error: invalid types 'int[int]' for array subscript
   44 |                 t[r[i]]=t[l[i]]+d[i];
      |                          ^
a.cc:48:27: error: invalid types 'int[int]' for array subscript
   48 |                 if(d[i]!=t[r[i]]-t[l[i]])ok=0;
      |                           ^
a.cc:48:35: error: invalid types 'int[int]' for array subscript
   48 |                 if(d[i]!=t[r[i]]-t[l[i]])ok=0;
      |                                   ^