Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

vector<int> to[100005];
int d[100005][100005];//距離の管理
vector<int> e[100005];//乳児数の管理
int used[100005];
int x[100005];

typedef pair<int, int> pi;

int n, m, l, r, d, dist[100001], vis[100001];
vector<pi> adj[100001];

void dfs(int node){
	vis[node] = 1;
	for(auto it:adj[node]){
		if(vis[it.first] != -1){
			if(dist[it.first] != dist[node]+it.second){ cout << "No"; exit(0); }
			continue;
		}
		vis[it.first] = 1;
		dist[it.first] = dist[node]+it.second;
		dfs(it.first);
	}
}

int main(){
	memset(vis, -1, sizeof(vis));
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		cin >> l >> r >> d;
		adj[l].push_back(pi(r, d));
		adj[r].push_back(pi(l, -d));
	}
	for(int i = 1; i <= n; i++){
		if(vis[i] == -1) dfs(i);
	}
	cout << "Yes";
}

Compiler output:
a.cc:36:17: error: conflicting declaration 'int d'
   36 | int n, m, l, r, d, dist[100001], vis[100001];
      |                 ^
a.cc:29:5: note: previous declaration as 'int d [100005][100005]'
   29 | int d[100005][100005];//距離の管理
      |     ^
a.cc: In function 'int main()':
a.cc:56:31: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int [100005][100005]')
   56 |                 cin >> l >> r >> d;
      |                 ~~~~~~~~~~~~~ ^~ ~
      |                          |       |
      |                          |       int [100005][100005]
      |                          std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:3:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int (*)[100005]'
   56 |                 cin >> l >> r >> d;
      |                                  ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'short int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(short int)((int (*)[100005])(& d))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'short unsigned int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(short unsigned int)((int (*)[100005])(& d))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(int)((int (*)[100005])(& d))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'unsigned int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(unsigned int)((int (*)[100005])(& d))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'long int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(long int)((int (*)[100005])(& d))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'long unsigned int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(long unsigned int)((int (*)[100005])(& d))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'long long int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(long long int)((int (*)[100005])(& d))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: invalid conversion from 'int (*)[100005]' to 'long long unsigned int' [-fpermissive]
   56 |                 cin >> l >> r >> d;
      |                                  ^
      |                                  |
      |                                  int (*)[100005]
a.cc:56:34: error: cannot bind rvalue '(long long unsigned int)((int (*)[100005])(& d))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:56:34: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
   56 |                 cin >> l >> r >> d;
      |                                  ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:25: note:   no known conversion for argument 1 from 'int [100005][100005]' to 'float&'
  219 |       operator>>(float& __f)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:26: note:   no known conversion for argument 1 from 'int [100005][100005]' to 'double&'
  223 |       operator>>(double& __f)
      |                  ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:31: note:   no known conversion for argument 1 from 'int [100005][100005]' to 'long double&'
  227 |       operator>>(long double& __f)
      |                  ~~~~~~