Language: C++

#include <bits/stdc++.h>

using namespace std;

int const size = 1e5 + 100;
vector < pair <int, int> > ed[size];
int coord[size];
int used[size];

bool dfs(int v){
	used[v] = 1;
	for (int i = 0; i < (int)ed[v].size(); i++){
		int u = ed[v][i].first;
		int d = ed[v][i].second;
		if (used[u] == 0){
			coord[u] = coord[v] + d;
			return dfs(u);
		}
		else if (coord[u] != coord[v] + d){
			return false;	
		}	
	}
	return true;

}

int main(){
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++){
		int l, r, d;
		cin >> l >> r >> d;
		ed[l].push_back(make_pair(r, d));
		ed[r].push_back(make_pair(l, -d));
	}
	for (int i = 0; i < n; i++){
		if (used[i] == 0){
			if (dfs(i))
				continue;
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}

Compiler output:
a.cc:6:31: error: reference to 'size' is ambiguous
    6 | vector < pair <int, int> > ed[size];
      |                               ^~~~
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:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | int const size = 1e5 + 100;
      |           ^~~~
a.cc:7:11: error: reference to 'size' is ambiguous
    7 | int coord[size];
      |           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | int const size = 1e5 + 100;
      |           ^~~~
a.cc:8:10: error: reference to 'size' is ambiguous
    8 | int used[size];
      |          ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:11: note:                 'const int size'
    5 | int const size = 1e5 + 100;
      |           ^~~~
a.cc: In function 'bool dfs(int)':
a.cc:11:9: error: 'used' was not declared in this scope
   11 |         used[v] = 1;
      |         ^~~~
a.cc:12:34: error: 'ed' was not declared in this scope
   12 |         for (int i = 0; i < (int)ed[v].size(); i++){
      |                                  ^~
a.cc:16:25: error: 'coord' was not declared in this scope
   16 |                         coord[u] = coord[v] + d;
      |                         ^~~~~
a.cc:19:26: error: 'coord' was not declared in this scope
   19 |                 else if (coord[u] != coord[v] + d){
      |                          ^~~~~
a.cc: In function 'int main()':
a.cc:33:17: error: 'ed' was not declared in this scope; did you mean 'd'?
   33 |                 ed[l].push_back(make_pair(r, d));
      |                 ^~
      |                 d
a.cc:37:21: error: 'used' was not declared in this scope
   37 |                 if (used[i] == 0){
      |                     ^~~~