Language: C++

//shu wen tong%%%%%%%%%
#include<bits/stdc++.h>
using namespace std;
struct node{
	int x,y;
}a[100001];
queue<node> q;
bool vis[501][501],ok;
int value[501][501];
int T,R,C,n,xi,yi,data;
int main(){
		scanf("%d%d%d",&R,&C,&n);ok=true;
		memset(vis,0,sizeof(vis));
		memset(value,0,sizeof(value));
		while(!q.empty()) q.pop();
		for(int i=1;i<=n;i++){
			scanf("%d%d%d",&xi,&yi,&data);
			a[i].x=xi;a[i].y=yi;
			value[xi][yi]=data;
			vis[xi][yi]=true;
			if(data<0)ok=false;
		}
		if(!ok){
			printf("No\n");
			continue;
		}
		for(int i=1;i<=n;i++) q.push(a[i]);
		while(!q.empty()){
			node now=q.front();q.pop();
			for(int i=1;i<=R;i++) if(i!=now.x&&vis[i][now.y])
			for(int j=1;j<=C;j++) if(j!=now.y&&vis[now.x][j])
			{
				int D=value[i][now.y]+value[now.x][j]-value[now.x][now.y],x=i,y=j;
				if(D<0){
					ok=false;
					break;
				}
				if(!vis[x][y]){
					value[x][y]=D;
					vis[x][y]=true;
					n++;a[n].x=x;a[n].y=y;
					q.push(a[n]);
				}
				else{
					if(value[x][y]!=D){
						ok=false;
						break;
					}
					else ok=true;
				}
			}
			if(!ok)break;	
		}
		if(ok) printf("Yes\n");
		else printf("No\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:49: error: reference to 'data' is ambiguous
   17 |                         scanf("%d%d%d",&xi,&yi,&data);
      |                                                 ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:10:19: note:                 'int data'
   10 | int T,R,C,n,xi,yi,data;
      |                   ^~~~
a.cc:19:39: error: reference to 'data' is ambiguous
   19 |                         value[xi][yi]=data;
      |                                       ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:10:19: note:                 'int data'
   10 | int T,R,C,n,xi,yi,data;
      |                   ^~~~
a.cc:21:28: error: reference to 'data' is ambiguous
   21 |                         if(data<0)ok=false;
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:10:19: note:                 'int data'
   10 | int T,R,C,n,xi,yi,data;
      |                   ^~~~
a.cc:25:25: error: continue statement not within a loop
   25 |                         continue;
      |                         ^~~~~~~~