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

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

int main() {
  std::string s;
  int k;
  std::cin >> s >> k;
  for (char &c : s) {
    if (k >= ('z' - c + 1)) {
      k -= 'z' - c + 1;
      c = 'a';
    }
  }
  k %= 26;
  if (s.back() > 'z' - k) {
    s.back() += k - 26;
  } else {
    s.back() += k;
  }
  std::cout << s << std::endl;
  return 0;
}
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

int main() {
  std::string s;
  int k;
  std::cin >> s >> k;
  for (char &c : s) {
    if (k >= ('z' - c + 1)) {
      k -= 'z' - c + 1;
      c = 'a';
    }
  }
  k %= 26;
  if (s.back() > 'z' - k) {
    s.back() += k - 26;
  } else {
    s.back() += k;
  }
  std::cout << s << std::endl;
  return 0;
}


Compiler output:
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main() {
      |     ^~~~
a.cc:16:5: note: 'int main()' previously defined here
   16 | int main() {
      |     ^~~~
Language: C++

#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <functional>
#include <cstring>
#include <set>
using namespace std;

typedef long long ll;
#define MAX 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)

int main()
{
	string s; cin >> s;
	int K; cin >> K;

	rep(i, s.size()) {
		if ('z' - s[i] < K) {
			K -= ((int)('z') - (int)s[i] + 1);
			s[i] = 'a';
		}
	}
	rep(i, K) {
		if (s[s.size() - 1] == 'z') s[s.size() - 1] = 'a';
		else s[s.size() - 1]++;
	}

	cout << s << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: 'cin' was not declared in this scope
   20 |         string s; cin >> s;
      |                   ^~~
a.cc:12:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   11 | #include <set>
  +++ |+#include <iostream>
   12 | using namespace std;
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << s << endl;
      |         ^~~~
a.cc:34:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int main(void){
	string s; int K, N;
	cin >> s;
	N = s.size();
	cin >> K;
	
	for(int i=0;i<N;i++){
		int d = ('a'+26-s[i])%26;
		if (K >= d){
			s[i] = 'a';
			K -= d;
		}
	}
	s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26
	cout << s << endl;
	
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:46: error: expected ';' before 'cout'
   33 |         s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26
      |                                              ^
      |                                              ;
   34 |         cout << s << endl;
      |         ~~~~
Language: C++

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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int main(void){
	string s; int K, N;
	cin >> s;
	N = s.size();
	cin >> K;
	
	for(int i=0;i<N;i++){
		int d = ('a'+26-s[i])%26;
		if (K >= d)
			s[i] = 'a';
			K -= d;
		}
	}
	s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26
	cout << s << endl;
	
	
	return 0;
}


Compiler output:
a.cc:33:9: error: 's' does not name a type
   33 |         s[N-1] = 'a' + (s[N-1]-'a' + K%26)%26
      |         ^
a.cc:37:9: error: expected unqualified-id before 'return'
   37 |         return 0;
      |         ^~~~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> k;
    for (int i=0;i<n;i++) {
        int v='z'-s[i]+1;
        if (v<=k) {
            s[i]='a';
            k-=v;
        }
    }
    cout << s << "\n";
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> k;
    for (int i=0;i<n;i++) {
        int v='z'-s[i]+1;
        if (v<=k) {
            s[i]='a';
            k-=v;
        }
    }
    cout << s << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: 'k' was not declared in this scope
    7 |     cin >> k;
      |            ^
a.cc:8:20: error: 'n' was not declared in this scope
    8 |     for (int i=0;i<n;i++) {
      |                    ^
a.cc: At global scope:
a.cc:20:8: error: redefinition of 'std::string s'
   20 | string s;
      |        ^
a.cc:3:8: note: 'std::string s' previously declared here
    3 | string s;
      |        ^
a.cc:21:5: error: redefinition of 'int main()'
   21 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
a.cc: In function 'int main()':
a.cc:24:12: error: 'k' was not declared in this scope
   24 |     cin >> k;
      |            ^
a.cc:25:20: error: 'n' was not declared in this scope
   25 |     for (int i=0;i<n;i++) {
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    cin >> k;
    for (int i=0;i<n;i++) {
        int v='z'-s[i]+1;
        if (v<=k) {
            s[i]='a';
            k-=v;
        }
    }
    cout << s << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: 'k' was not declared in this scope
    7 |     cin >> k;
      |            ^
a.cc:8:20: error: 'n' was not declared in this scope
    8 |     for (int i=0;i<n;i++) {
      |                    ^
Language: C++

#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back      
#define F first
#define S second
#define SS stringstream
#define sqr(x) ((x)*(x))
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define CC(x) cout << (x) << endl
#define pw(x) (1ll<<(x))
#define buli(x) __builtin_popcountll(x)
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define M 1000000007
#define N 211111

#define TASK "1"

using namespace std;

int main(){
	#ifdef home
		freopen(TASK".in","r",stdin);	
		freopen(TASK".out","w",stdout);
	#endif		
	ios::sync_with_stdio(false);
	string s;
	int k;
	cin >> s >> k;
	for (int i = 0; i < s.size(); i++) {
		if (i + 1 == s.size()) {
			k %= 26;
			s[i] = (s[i] - 'a' + k) % 26 + 'a';
		} else {

			int to = 'z' - s[i] + 1;
			to % = 26;
			if (to <= k) {
				s[i] = 'a';
				k -= to;
			}
		}	
	}
	cout << s << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:30: error: expected primary-expression before '=' token
   37 |                         to % = 26;
      |                              ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100005
#define oo 0x3f3f3f3f
using namespace std;

struct node
{
	int x,y,val;
}tr[maxn];
int t,n,r,c;
int fa[maxn],del[maxn],mn1[maxn],mn2[maxn];//del[i]指i到父节点的差值

bool cmp(node a,node b)
{
	if(a.y!=b.y)
	return a.y<b.y;
	else return a.x<b.x;
}//以y轴为第一关键字从小到大排序

int find(int a)
{
	if(fa[a]==a)
	return a;
	int fax=find(fa[a]);
	del[a]+=del[fa[a]];//合并差值
	return fa[a]=fax;
}//找父亲

int unionn(int a,int b,int v)
{
	int fax=find(a),fay=find(b);
	if(fax!=fay)
	{
		del[fax]=v+del[b]-del[a];//推导的性质
		fa[fax]=fay;//合并并查集
		return 1;
	}//不在同一个集合内
	else
	{
		if(del[a]!=del[b]+v)return 0;
		else return 1;
	}//在同一个集合内
}//并查集合并

int main()
{
	memset(mn1,oo,sizeof(mn1));
	memset(mn2,oo,sizeof(mn2));
	int flag=1;
	scanf("%d%d%d",&r,&c,&n);
	for(int i=1;i<=r;++i)
	{
		fa[i]=i;
		del[i]=0;
	}//初始化并查集
	for(int i=1;i<=n;++i)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		tr[i].x=x;
		tr[i].y=y;
		tr[i].val=z;
		if(z<0)flag=0;
	}
	if(!flag)
	{
		printf("No\n");
		continue;
	}
	if(r==1)
	{
		printf("Yes\n");
		continue;
	}//特判行为1
	sort(tr+1,tr+1+n,cmp);//初始化排序
	for(int i=1;i<n;++i)
	{
		if(tr[i].y==tr[i+1].y)
		{
			if(!unionn(tr[i].x,tr[i+1].x,tr[i+1].val-tr[i].val))//顺便结合两行
			flag=0;//与所得结论矛盾
		}
	}//判断是否矛盾
	if(!flag)
	{
		printf("No\n");
		continue;
	}
	for(int i=1;i<=n;++i)
	{
		int fax=find(tr[i].x);
		mn1[fax]=min(mn1[fax],tr[i].val+del[tr[i].x]);
	}//求父节点行上一点的最小值
	for(int i=1;i<=r;++i)
	{
		int fax=find(i);
		mn2[fax]=min(mn2[fax],-del[i]);
	}//求某一行的父节点可能的最小值
	for(int i=1;i<=r;++i)
	{
		if(fa[i]==i&&mn1[i]+mn2[i]<0)
		{
			flag=0;
			break;
		}
	}
	if(!flag)
	printf("No\n");
	else printf("Yes\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:17: error: continue statement not within a loop
   70 |                 continue;
      |                 ^~~~~~~~
a.cc:75:17: error: continue statement not within a loop
   75 |                 continue;
      |                 ^~~~~~~~
a.cc:89:17: error: continue statement not within a loop
   89 |                 continue;
      |                 ^~~~~~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 2000000005
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<ld, ld> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int,int,int,int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const int MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };
int ddx[]={2,2,-2,-2,1,1,-1,-1},ddy[]={1,-1,1,-1,2,-2,2,-2};

int n,m,k;
int x[100000],y[100000],z[100000];
VPi v[200001];
int a[200001];
bool ok=1;
bool bfs(int x)
{
	int mn0=INF,mn1=INF;
	queue<int> q;
	q.push(x);
	a[x]=0;
	while(!q.empty())
	{
		int y=q.front();
		if(y<n)mn0=min(mn0,a[y]);
		else mn1=min(mn1,a[y]);
		q.pop();
		for(auto p:v[y])
		{
			if(a[p.X]==-INF)
			{
				q.push(p.X);
				a[p.X]=p.Y-a[y];
			}
			else if(a[p.X]+a[y]!=p.Y)return 0;
		}
	}
	return mn0+mn1>=0;
}
int main(){
	fill(a,a+200001,-INF);
	scanf("%d%d%d",&n,&m,&k);
	fup(i,0,k-1,1)
	{
		scanf("%d%d%d",x+i,y+i,z+i);
		x[i]--,y[i]--;
		v[x[i]].pb(mp(y[i]+n,z[i]));
		v[y[i]+n].pb(mp(x[i],z[i]));
		chk[x[i]]=chk[n+y[i]]=1;
	}
	fup(i,0,n+n-1,1)if(a[i]==-INF && !bfs(i))return !printf("No");
	puts("Yes");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:102:17: error: 'chk' was not declared in this scope
  102 |                 chk[x[i]]=chk[n+y[i]]=1;
      |                 ^~~
Language: C++

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

int main() {
	int r,c,n;cin>>r>>c>>n;
	map<int,map<int,int>> m;
	vector<int> a(n);
	vector<pair<int,int>> xy(n),yx(n);
	vector<vector<pair<int,int>>> ya(r),xa(c);
	for(int i=0;i<n;i++){
		cin>>xy[i].first>>xy[i].second>>a[i];
		xy[i].first--;
		xy[i].second--;
		yx[i].first=xy[i].second;
		yx[i].second=xy[i].first;
		ya[xy[i].first].push_back(make_pair(xy[i].second,a[i]));
		xa[xy[i].second].push_back(make_pair(xy[i].first,a[i]));
		m[xy[i].first][xy[i].second]=a[i];
	}
//	sort(xy.begin(),xy.end());
//	sort(yx.begin(),yx.end());
	for(int i=0;i<r;i++){
		sort(ya[i].begin(),ya[i].end());
	}
	for(int i=0;i<c;i++){
		sort(xa[i].begin(),xa[i].end());
	}
	for(int i=0;i<c;i++){
		int min=-1;
		int dmax=0;
		map<int,int> md;
		for(int j=0;j<xa[i].size();j++){
			int tempx=xa[i][j].first;
			for(int k=0;k<ya[tempx].size();k++){
				if(dmax<xa[i][j].second-ya[tempx][k].second){
					dmax=xa[i][j].second-ya[tempx][k].second;
				}
				map<int,int>::iterator itr=md.find[ya[tempx][k].first];
				if(itr!=md.end()){
					md[ya[tempx][k].first]=xa[i][j].second-ya[tempx][k].second;
				}else{
					if(md[ya[tempx][k].first]!=xa[i][j].second-ya[tempx][k].second){
						cout<<"No"<<endl;
						return 0;
					}
				}
			}
		}
		for(int j=0;j<xa[i].size();j++){
			if(xa[i][j].second-dmax<0){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:67: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   41 |                                 map<int,int>::iterator itr=md.find[ya[tempx][k].first];
      |                                                                   ^
Language: C++

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

int main() {
	int r,c,n;cin>>r>>c>>n;
	map<int,map<int,int>> m;
	vector<int> a(n);
	vector<pair<int,int>> xy(n),yx(n);
	vector<vector<pair<int,int>>> ya(r),xa(c);
	for(int i=0;i<n;i++){
		cin>>xy[i].first>>xy[i].second>>a[i];
		xy[i].first--;
		xy[i].second--;
		yx[i].first=xy[i].second;
		yx[i].second=xy[i].first;
		ya[xy[i].first].push_back(make_pair(xy[i].second,a[i]));
		xa[xy[i].second].push_back(make_pair(xy[i].first,a[i]));
		m[xy[i].first][xy[i].second]=a[i];
	}
//	sort(xy.begin(),xy.end());
//	sort(yx.begin(),yx.end());
	for(int i=0;i<r;i++){
		sort(ya[i].begin(),ya[i].end());
	}
	for(int i=0;i<c;i++){
		sort(xa[i].begin(),xa[i].end());
	}
	for(int i=0;i<c;i++){
		int min=-1;
		int dmax=0;
		map<int,int> md;
		for(int j=0;j<xa[i].size();j++){
			int tempx=xa[i][j].first;
			for(int k=0;k<ya[tempx].size();k++){
				if(dmax<xa[i][j].second-ya[tempx][k].second){
					dmax=xa[i][j].second-ya[tempx][k].second;
				}
				auto itr=md.find[ya[tempx][k].first];
				if(itr!=md.end()){
					md[ya[tempx][k].first]=xa[i][j].second-ya[tempx][k].second;
				}else{
					if(md[ya[tempx][k].first]!=xa[i][j].second-ya[tempx][k].second){
						cout<<"No"<<endl;
						return 0;
					}
				}
			}
		}
		for(int j=0;j<xa[i].size();j++){
			if(xa[i][j].second-dmax<0){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:49: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   41 |                                 auto itr=md.find[ya[tempx][k].first];
      |                                                 ^
Language: C++

#include<bits/stdc++.h>
#define maxn 500005
#define inf -10000000
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0, f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
    while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
#define PII pair<int,int>
#define fir first
#define sec second
#define ma(a,b) make_pair(a,b)
struct st{
	int x,y,val;
}s[maxn];
int hang[maxn],lie[maxn],c,r,n,t,us[maxn],fl;
vector <int> h[maxn],l[maxn];
map <PII,int> poi;
void dfs(int now,int fa,int ye)
{
	us[now] = 1;
	int fx = s[fa].x,fy = s[fa].y,x = s[now].x,y = s[now].y;
	if(now != fa)
	{
		int cha = s[now].val - s[fa].val;
		if(x == fx)
		{
			if(lie[y] == inf)
			{
				lie[y] = lie[fy] - cha;
			}
			else if(lie[y] != lie[fy] - cha) {fl = 0; return;}
		}
		if(y == fy)
		{
			if(hang[x] == inf)
			{
				hang[x] = hang[fx] - cha;
			}
			else if(hang[x] != lie[fx] - cha) {fl = 0; return;}
		}
	}
	else lie[y] = hang[x] = 0;
	for(int i = 0; i < h[x].size(); i++)
		if(!us[h[x][i]])
			dfs(h[x][i],now,fa);
	for(int i = 0; i < l[y].size(); i++)
		if(!us[l[y][i]])
			dfs(l[y][i],now,fa);
}
void check(int now)
{
	int x = s[now].x,y = s[now].y;
	for(int i = 0; i < h[x].size(); i++)
		for(int j = 0; j < l[y].size(); j++)
			if(s[h[x][i]].val + s[l[y][j]].val - s[now].val < 0)
			{
				fl = 0;
				return ;
			}
}
int main(){
	t = 1
	while(t--)
	{
		fl = 1;
		r = read(); c = read(); n = read();
		for(int i = 1; i <= r; i++)
		{
			h[i].clear();
			hang[i] = inf;
		}
		for(int i = 1; i <= c; i++)
		{
			l[i].clear();
			lie[i] = inf;
		}
		for(int i = 1; i <= n; i++)
		{
			s[i].x = read();
			s[i].y = read();
			s[i].val = read();
			if(s[i].val < 0) fl = 0;
			h[s[i].x].push_back(i);
			l[s[i].y].push_back(i);
			poi[ma(s[i].x,s[i].y)] = i;
			us[i] = 0;
		}
		for(int i = 1; i <= n; i++)
		{
			if(!us[i])
				dfs(i,i,i);
			if(!fl)
			{
				break;
			}
		}
		for(int i = 1; i <= n; i++)
			check(i);
		if(fl) printf("Yes\n");
		else printf("No\n");
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:14: error: expected ';' before 'while'
   75 |         t = 1
      |              ^
      |              ;
   76 |         while(t--)
      |         ~~~~~
Language: C++

#include <bits/stdc++.h>

# define LocalJudge( File ) freopen ( File ".in", "r", stdin )  ;

using namespace std ;

inline void smin ( int& d, int x )  {  ( d > x ) ? d = x : 0 ;  }

const long long inf = ( ~0ull >> 1 ) ;
const int N = 500010 ;

long long a [N] ;
int q [N] ;
bool inq [N] ;
vector < pair < int, int > > g [N] ;

int main ( )  {
	int h, w, cnt ;
	scanf ( "%d %d", & h, & w ) ;
	scanf ( "%d", & cnt ) ;
	for ( int i = 0 ; i < h + w ; ++ i )	g [i].clear ( ) ;
	memset ( inq, 0, sizeof ( bool ) * ( h + w ) ) ;
	for ( int i = 0 ; i < cnt ; ++ i )  {
		int x, y, z ;
		scanf ( "%d %d %d", & x, & y, & z ) ;
		-- x, -- y ;
		g [x].push_back ( make_pair ( h + y, z ) ) ;
		g [h + y].push_back ( make_pair ( x, z ) ) ;
	}
	for ( int i = 0, l = h + w ; i < l ; ++ i )  {
		if ( inq [i] )  {
			continue ;
		}
		int b = 0, e = 1 ;
		q [0] = i ;
		inq [i] = true ;
		a [i] = 0 ;
		while ( b < e )  {
			for ( int j = 0, l = ( int ) g [q [b]].size ( ) ; j < l ; ++ j )  {
				int u = g [q [b]] [j].first ;
				int v = g [q [b]] [j].second ;
				if ( inq [u] )  {
					if ( a [q [b]] + a [u] != v )  {
						puts ( "No" ) ;
						goto h ;
					}
					continue ;
				}
				q [e] = u ;
				a [u] = v - a [q [b]] ;
				inq [u] = true ;
				++ e ;
			}
			++ b ;
		}
		long long m1 = inf, m2 = inf ;
		for ( int j = 0 ; j < e ; ++ j )  {
			if ( q [j] < h ) {
				smin ( m1, a [q [j]] ) ;
			}  else  {
				smin ( m2, a [q [j]] ) ;
			}
		}
		if ( m1 + m2 < 0 )  {
			puts ( "No" ) ;
			goto h ;
		}
	}
	puts ( "Yes" ) ;
	h : ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:40: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   59 |                                 smin ( m1, a [q [j]] ) ;
      |                                        ^~
a.cc:7:25: note:   initializing argument 1 of 'void smin(int&, int)'
    7 | inline void smin ( int& d, int x )  {  ( d > x ) ? d = x : 0 ;  }
      |                    ~~~~~^
a.cc:61:40: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int'
   61 |                                 smin ( m2, a [q [j]] ) ;
      |                                        ^~
a.cc:7:25: note:   initializing argument 1 of 'void smin(int&, int)'
    7 | inline void smin ( int& d, int x )  {  ( d > x ) ? d = x : 0 ;  }
      |                    ~~~~~^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int INF = 1145141919;

using P = pair<int, int>;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int R, C, N;
	cin >> R >> C >> N;
	map<P, int> memo;
	priority_queue<P, vector<P>, greater<P> > q;
	for (int i = 0; i < N; i++) {
		int r, c, a;
		cin >> r >> c >> a;
		r--;
		c--;
		P pos(r, c);
		q.push(pos);
		memo[pos] = a;
	}
	bool ans = true;
	vector<int> diff(R, INF);
	while (!q.empty()) {
		P pos = q.front();
		q.pop();
		int r = pos.first, c = pos.second;
		P b(r + 1, c);
		if (memo.find(b) == memo.end()) {
			if (diff[r] != INF) {
				if (memo[pos] - diff[r] < 0) {
					ans = false;
					break;			
				} else {
					q.push(b);
					memo[b] = memo[pos] - diff[r];
				}
			}
		} else {
			int d = memo[pos] - memo[b];
			if (diff[pos.first] == INF) {
				diff[pos.first] = d;
			} else {
				ans = false;
				break;
			}			
		}
		P u(r - 1, c);
		if (memo.find(u) == memo.end()) {
			if (r > 0 && diff[r - 1] != INF) {
				if (memo[pos] + diff[r - 1] < 0) {
					ans = false;
					break;			
				} else {
					q.push(u);
					memo[u] = memo[pos] + diff[r - 1];
				}				
			}
		}
	}
	cout << (ans ? "Yes" : "No") << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: 'class std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int> >, std::greater<std::pair<int, int> > >' has no member named 'front'
   28 |                 P pos = q.front();
      |                           ^~~~~
Language: C++

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

int main(void){
    int R;
    int C;
    int N;
    string res = "Yes";
    // input
    cin >> R;
    cin >> C;
    cin >> N;
    
    vector<int> rr(N);
    vector<int> cc(N);
    vector<int> aa(N);
    
    for (int i=1; i<=N; i++) {
        cin >> rr[i-1];
        cin >> cc[i-1];
        cin >> aa[i-1];
    } 
    
    //initialize

    vector<int> rca_flag(N, 1);
    vector<int> r_vec(R, 0);
    vector<int> c_vec(C, 0);
    vector<int> r_vec_flag(R, 0);
    vector<int> c_vec_flag(C, 0);
    int go_flg = 1;
    
    
    
    while (go_flg == 1){
        // find first
        for (int i=1; i<=N; i++){
            if (rca_flag[i-1] == 1){
                // initailize
                rca_flag[i-1] = 0;
                r = rr[i-1];
                c = cc[i-1];
                a = aa[i-1];
                r_vec[i-1] = a;
                r_vec_flag[r-1] = 1;
                c_vec[i-1] = 0;
                c_vec_flag[c-1] = 1;
                break;
            }
            if (i == N){
                go_flg = 0;
            }             
        }
        while (go_flg == 1){
            for (int i=1; i<=N; i++){
                if (rca_flag[i-1] == 1){
                    rca_flag[i-1] = 0;
                    r = rr[i-1];
                    c = cc[i-1];
                    a = aa[i-1];
                    if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){
                        if (a != r_vec[r-1] + c_vec[c-1]){
                            res = "No";
                            go_flg = 0;
                        }
                    } else if (r_vec_flag[r-1] == 1){
                        c_vec_flag[c-1] = 1;
                        c_vec[c-1] = a - r_vec[r-1];
                    } else if (c_vec_flag[c-1] == 1){
                        r_vec_flag[r-1] = 1;
                        r_vec[r-1] = a - c_vec[c-1];
                    } 
                }
            }
        }
    }
    

    cout << res << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:17: error: 'r' was not declared in this scope
   42 |                 r = rr[i-1];
      |                 ^
a.cc:43:17: error: 'c' was not declared in this scope
   43 |                 c = cc[i-1];
      |                 ^
a.cc:44:17: error: 'a' was not declared in this scope
   44 |                 a = aa[i-1];
      |                 ^
a.cc:59:21: error: 'r' was not declared in this scope
   59 |                     r = rr[i-1];
      |                     ^
a.cc:60:21: error: 'c' was not declared in this scope
   60 |                     c = cc[i-1];
      |                     ^
a.cc:61:21: error: 'a' was not declared in this scope
   61 |                     a = aa[i-1];
      |                     ^
Language: C++

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

int main(void){
    int R;
    int C;
    int N;
    string res = "Yes";
    // input
    cin >> R;
    cin >> C;
    cin >> N;
    
    for (int i=1; i<=N; i++) {
        cin >> r[i-1];
        cin >> c[i-1];
        cin >> a[i-1];
    } 
    
    //initialize
    vector<int> rr(N);
    vector<int> cc(N);
    vector<int> aa(N);
    vector<int> rca_flag(N, 1);
    vector<int> r_vec(R, 0);
    vector<int> c_vec(C, 0);
    vector<int> r_vec_flag(R, 0);
    vector<int> c_vec_flag(C, 0);
    int go_flg = 1;
    
    
    
    while (go_flg == 1){
        // find first
        for (int i=1; i<=N; i++){
            if (rca_flag[i-1] == 1){
                // initailize
                rca_flag[i-1] = 0;
                r = rr[i-1];
                c = cc[i-1];
                a = aa[i-1];
                r_vec[i-1] = a;
                r_vec_flag[r-1] = 1;
                c_vec[i-1] = 0;
                c_vec_flag[c-1] = 1;
                break;
            }
            if (i == N){
                go_flg = 0;
            }             
        }
        while (go_flg == 1){
            for (int i=1; i<=N; i++){
                if (rca_flag[i-1] == 1){
                    rca_flag[i-1] = 0;
                    r = rr[i-1];
                    c = cc[i-1];
                    a = aa[i-1];
                    if ((r_vec_flag[r-1] == 1) && (c_vec_flag[c-1] == 1)){
                        if (a != r_vec[r-1] + c_vec[c-1]){
                            res = "No";
                            go_flg = 0;
                        }
                    } else if (r_vec_flag[r-1] == 1){
                        c_vec_flag[c-1] = 1;
                        c_vec[c-1] = a - r_vec[r-1];
                    } else if (c_vec_flag[c-1] == 1){
                        r_vec_flag[r-1] = 1;
                        r_vec[r-1] = a - c_vec[c-1];
                    } 
                }
            }
        }
    }
    

    cout << res << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: 'r' was not declared in this scope
   16 |         cin >> r[i-1];
      |                ^
a.cc:17:16: error: 'c' was not declared in this scope
   17 |         cin >> c[i-1];
      |                ^
a.cc:18:16: error: 'a' was not declared in this scope
   18 |         cin >> a[i-1];
      |                ^
a.cc:40:17: error: 'r' was not declared in this scope
   40 |                 r = rr[i-1];
      |                 ^
a.cc:41:17: error: 'c' was not declared in this scope
   41 |                 c = cc[i-1];
      |                 ^
a.cc:42:17: error: 'a' was not declared in this scope
   42 |                 a = aa[i-1];
      |                 ^
a.cc:57:21: error: 'r' was not declared in this scope
   57 |                     r = rr[i-1];
      |                     ^
a.cc:58:21: error: 'c' was not declared in this scope
   58 |                     c = cc[i-1];
      |                     ^
a.cc:59:21: error: 'a' was not declared in this scope
   59 |                     a = aa[i-1];
      |                     ^
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>&, vector<bool> &);
vector<pair<int, long long>> g[1234567];
long long node[1234567] = {0};
int R, C;
long long minR, minC = 1000000000;
 
 
int main(){
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c;
    long long a;
    cin >> r >> c >> a;
    r--; c--;
    g[r].push_back(make_pair( c + R, a));
    g[c + R].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<bool> was(R + C, false);
  
  for(int i = 0; i < R + C; i++){
      if(!DFSUtil(i, visited, was)){
        cout << "No";
        return 0;
      }
  }
  cout << "Yes";
}
 
bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
  if(visited[v]){
    return true;
  }
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    long long a = g[v][i].second;
    if(was[w])){
      if(node[v] + node[w] != a){
        return false;
      }
      continue;
    }
    node[w] = a - node[v];
    was[w] = true;
    was[v] = true;
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited, was)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)':
a.cc:48:15: error: expected primary-expression before ')' token
   48 |     if(was[w])){
      |               ^
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>&, vector<bool> &);
vector<pair<int, long long>> g[1234567];
long long node[1234567] = {0};
int R, C;
long long minR, minC = 1000000000;
 
 
int main(){
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c;
    long long a;
    cin >> r >> c >> a;
    r--; c--;
    g[r].push_back(make_pair( c + R, a));
    g[c + R].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<bool> was(R + C, false);
  if(!DFSUtil(0, visited, was)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
  visited[v] = true;
  was[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    long long a = g[v][i].second;
    if(was[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
    was[w] = true;
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)':
a.cc:54:18: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)'
   54 |       if(!DFSUtil(w, visited)) return false;
      |           ~~~~~~~^~~~~~~~~~~~
a.cc:38:6: note: declared here
   38 | bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
      |      ^~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>&, vector<bool> &);
vector<pair<int, long long>> g[1234567];
long long node[1234567] = {0};
int R, C;
long long minR, minC = 1000000000;
 
 
int main(){
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c;
    long long a;
    cin >> r >> c >> a;
    r--; c--;
    g[r].push_back(make_pair( c + R, a));
    g[c + R].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<bool> was(R + C, false);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
  visited[v] = true;
  was[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    long long a = g[v][i].second;
    if(was[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
    was[w] = true;
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)'
   30 |   if(!DFSUtil(0, visited)){
      |       ~~~~~~~^~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | bool DFSUtil(int, vector<bool>&, vector<bool> &);
      |      ^~~~~~~
a.cc: In function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)':
a.cc:54:18: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)'
   54 |       if(!DFSUtil(w, visited)) return false;
      |           ~~~~~~~^~~~~~~~~~~~
a.cc:38:6: note: declared here
   38 | bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
      |      ^~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>&, vector<bool> &);
vector<pair<int, int>> g[1234567];
long long node[1234567] = {0};
int R, C;
long long minR, minC = 1000000000;
 
 
int main(){
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    r--; c--;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<bool> was(R + C, false);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> &visited, vector<bool> &was){
  visited[v] = true;
  was[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(was[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
    was[w] = true;
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited, was)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: too few arguments to function 'bool DFSUtil(int, std::vector<bool>&, std::vector<bool>&)'
   29 |   if(!DFSUtil(0, visited)){
      |       ~~~~~~~^~~~~~~~~~~~
a.cc:8:6: note: declared here
    8 | bool DFSUtil(int, vector<bool>&, vector<bool> &);
      |      ^~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>);
vector<pair<int, int>> g[1234567];
int node[1234567];
int R, C;
 
int main(){
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}


Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)':
a.cc:45:15: error: 'minR' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:46:16: error: 'minC' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:47:8: error: 'minR' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:47:15: error: 'minC' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |               ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>);
vector<pair<int, int>> g[1234567];
int node[1234567];
 
int main(){
  int R, C;
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}


Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)':
a.cc:45:12: error: 'R' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |            ^
a.cc:45:15: error: 'minR' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:46:13: error: 'R' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |             ^
a.cc:46:16: error: 'minC' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:47:8: error: 'minR' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:47:15: error: 'minC' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |               ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>);
vector<pair<int, int>> g[1234567];
int Node[1234567];
 
int main(){
  int R, C;
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)':
a.cc:40:22: error: 'node' was not declared in this scope; did you mean 'Node'?
   40 |     if(visited[w] && node[v] + node[w] != a){
      |                      ^~~~
      |                      Node
a.cc:43:5: error: 'node' was not declared in this scope; did you mean 'Node'?
   43 |     node[w] = a - node[v];
      |     ^~~~
      |     Node
a.cc:45:12: error: 'R' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |            ^
a.cc:45:15: error: 'minR' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:46:13: error: 'R' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |             ^
a.cc:46:16: error: 'minC' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:47:8: error: 'minR' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:47:15: error: 'minC' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |               ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>);
vector<pair<int, int>> g[1234567];

int main(){
  int R, C;
  cin >> R >> C;
  int N;
  cin >> N;  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)':
a.cc:39:22: error: 'node' was not declared in this scope
   39 |     if(visited[w] && node[v] + node[w] != a){
      |                      ^~~~
a.cc:42:5: error: 'node' was not declared in this scope
   42 |     node[w] = a - node[v];
      |     ^~~~
a.cc:44:12: error: 'R' was not declared in this scope
   44 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |            ^
a.cc:44:15: error: 'minR' was not declared in this scope
   44 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:45:13: error: 'R' was not declared in this scope
   45 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |             ^
a.cc:45:16: error: 'minC' was not declared in this scope
   45 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:46:8: error: 'minR' was not declared in this scope
   46 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:46:15: error: 'minC' was not declared in this scope
   46 |     if(minR + minC < 0) return false;
      |               ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&[]);
 
int main(){
  int R, C;
  cin >> R >> C;
  int N;
  cin >> N;
  vector<pair<int, int>> g[C + R];
  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited, g)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited, const vector<pair<int,int>> &g[]){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited,g)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc:8:62: error: creating array of references
    8 | bool DFSUtil(int, vector<bool>, const vector<pair<int,int>>&[]);
      |                                                              ^
a.cc:35:72: error: declaration of 'g' as array of references
   35 | bool DFSUtil(int v, vector<bool> visited, const vector<pair<int,int>> &g[]){
      |                                                                        ^
a.cc: In function 'bool DFSUtil(...)':
a.cc:36:3: error: 'visited' was not declared in this scope
   36 |   visited[v] = true;
      |   ^~~~~~~
a.cc:36:11: error: 'v' was not declared in this scope
   36 |   visited[v] = true;
      |           ^
a.cc:37:22: error: 'g' was not declared in this scope
   37 |   for(int i = 0; i < g[v].size(); i++){
      |                      ^
a.cc:40:22: error: 'node' was not declared in this scope
   40 |     if(visited[w] && node[v] + node[w] != a){
      |                      ^~~~
a.cc:43:5: error: 'node' was not declared in this scope
   43 |     node[w] = a - node[v];
      |     ^~~~
a.cc:45:12: error: 'R' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |            ^
a.cc:45:15: error: 'minR' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:46:13: error: 'R' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |             ^
a.cc:46:16: error: 'minC' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:47:8: error: 'minR' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:47:15: error: 'minC' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |               ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <vector>
#include <utility>
 
using namespace std;
 
bool DFSUtil(int, vector<bool>);
 
int main(){
  int R, C;
  cin >> R >> C;
  int N;
  cin >> N;
  vector<pair<int, int>> g[C + R];
  
  for(int i = 0; i < N; i++){
    int r, c, a;
    cin >> r >> c >> a;
    g[r].push_back(make_pair( c + C, a));
    g[c + C].push_back(make_pair(r, a));
  }
 
  vector<bool> visited(R + C, false);
  vector<int> node(R + C, 0);
  int minR, minC = pow(10,9);
  if(!DFSUtil(0, visited)){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}
 
bool DFSUtil(int v, vector<bool> visited){
  visited[v] = true;
  for(int i = 0; i < g[v].size(); i++){
    int w = g[v][i]. first;
    int a = g[v][i].second;
    if(visited[w] && node[v] + node[w] != a){
      return false;
    }
    node[w] = a - node[v];
 
    if(v < R) minR = minR >node[v] ? node[v] : minR;
    if(v >= R) minC = minC>node[v] ? node[v] : minC;
    if(minR + minC < 0) return false;
    if(!visited[w]){
      if(!DFSUtil(w, visited)) return false;
    }
  }
  return true;
}

Compiler output:
a.cc: In function 'bool DFSUtil(int, std::vector<bool>)':
a.cc:37:22: error: 'g' was not declared in this scope
   37 |   for(int i = 0; i < g[v].size(); i++){
      |                      ^
a.cc:40:22: error: 'node' was not declared in this scope
   40 |     if(visited[w] && node[v] + node[w] != a){
      |                      ^~~~
a.cc:43:5: error: 'node' was not declared in this scope
   43 |     node[w] = a - node[v];
      |     ^~~~
a.cc:45:12: error: 'R' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |            ^
a.cc:45:15: error: 'minR' was not declared in this scope
   45 |     if(v < R) minR = minR >node[v] ? node[v] : minR;
      |               ^~~~
a.cc:46:13: error: 'R' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |             ^
a.cc:46:16: error: 'minC' was not declared in this scope
   46 |     if(v >= R) minC = minC>node[v] ? node[v] : minC;
      |                ^~~~
a.cc:47:8: error: 'minR' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |        ^~~~
a.cc:47:15: error: 'minC' was not declared in this scope
   47 |     if(minR + minC < 0) return false;
      |               ^~~~