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

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
//parshant
using namespace std;
const int N = 1e5+10;
int n,m;
int dis
;
bool vis
;
vector<pair<int,int> >E
;
bool dfs(int u){
vis[u] = 1;
vector<pair<int,int> >::iterator it;
for(it = E[u].begin(); it != E[u].end(); it++){
int v = (*it).first;//注意这里的迭代器要加（*）
int d = (*it).second;
if(!vis[v]){
dis[v] = dis[u] + d;
if(!dfs(v))
return false;
}
else if(dis[u]+d!=dis[v])
return false;
}
return true;
}
int main(){
cin >> n >> m;
int u,v,w;
int i;
for(i = 1; i <= m; i++){
cin >> u >> v >> w;
E[u].push_back(make_pair(v,w));
E[v].push_back(make_pair(u,-w));
}
for(i = 1; i <= n; i++){
if(!vis[i]){
if(!dfs(i)){
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}

Compiler output:
a.cc: In function 'bool dfs(int)':
a.cc:16:4: error: invalid types 'bool[int]' for array subscript
   16 | vis[u] = 1;
      |    ^
a.cc:18:15: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'begin'
   18 | for(it = E[u].begin(); it != E[u].end(); it++){
      |               ^~~~~
a.cc:18:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'end'
   18 | for(it = E[u].begin(); it != E[u].end(); it++){
      |                                   ^~~
a.cc:21:8: error: invalid types 'bool[int]' for array subscript
   21 | if(!vis[v]){
      |        ^
a.cc:22:4: error: invalid types 'int[int]' for array subscript
   22 | dis[v] = dis[u] + d;
      |    ^
a.cc:22:13: error: invalid types 'int[int]' for array subscript
   22 | dis[v] = dis[u] + d;
      |             ^
a.cc:26:12: error: invalid types 'int[int]' for array subscript
   26 | else if(dis[u]+d!=dis[v])
      |            ^
a.cc:26:22: error: invalid types 'int[int]' for array subscript
   26 | else if(dis[u]+d!=dis[v])
      |                      ^
a.cc: In function 'int main()':
a.cc:37:6: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   37 | E[u].push_back(make_pair(v,w));
      |      ^~~~~~~~~
a.cc:38:6: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   38 | E[v].push_back(make_pair(u,-w));
      |      ^~~~~~~~~
a.cc:41:8: error: invalid types 'bool[int]' for array subscript
   41 | if(!vis[i]){
      |        ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int N = 1e5+10;
int n,m;
int dis
;
bool vis
;
vector<pair<int,int> >E
;
bool dfs(int u){
vis[u] = 1;
vector<pair<int,int> >::iterator it;
for(it = E[u].begin(); it != E[u].end(); it++){
int v = (*it).first;//注意这里的迭代器要加（*）
int d = (*it).second;
if(!vis[v]){
dis[v] = dis[u] + d;
if(!dfs(v))
return false;
}
else if(dis[u]+d!=dis[v])
return false;
}
return true;
}
int main(){
cin >> n >> m;
int u,v,w;
int i;
for(i = 1; i <= m; i++){
cin >> u >> v >> w;
E[u].push_back(make_pair(v,w));
E[v].push_back(make_pair(u,-w));
}
for(i = 1; i <= n; i++){
if(!vis[i]){
if(!dfs(i)){
cout << "No" << endl;
return 0;
}
}
}
cout << "Yes" << endl;
return 0;
}//parshant

Compiler output:
a.cc: In function 'bool dfs(int)':
a.cc:15:4: error: invalid types 'bool[int]' for array subscript
   15 | vis[u] = 1;
      |    ^
a.cc:17:15: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'begin'
   17 | for(it = E[u].begin(); it != E[u].end(); it++){
      |               ^~~~~
a.cc:17:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'end'
   17 | for(it = E[u].begin(); it != E[u].end(); it++){
      |                                   ^~~
a.cc:20:8: error: invalid types 'bool[int]' for array subscript
   20 | if(!vis[v]){
      |        ^
a.cc:21:4: error: invalid types 'int[int]' for array subscript
   21 | dis[v] = dis[u] + d;
      |    ^
a.cc:21:13: error: invalid types 'int[int]' for array subscript
   21 | dis[v] = dis[u] + d;
      |             ^
a.cc:25:12: error: invalid types 'int[int]' for array subscript
   25 | else if(dis[u]+d!=dis[v])
      |            ^
a.cc:25:22: error: invalid types 'int[int]' for array subscript
   25 | else if(dis[u]+d!=dis[v])
      |                      ^
a.cc: In function 'int main()':
a.cc:36:6: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   36 | E[u].push_back(make_pair(v,w));
      |      ^~~~~~~~~
a.cc:37:6: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   37 | E[v].push_back(make_pair(u,-w));
      |      ^~~~~~~~~
a.cc:40:8: error: invalid types 'bool[int]' for array subscript
   40 | if(!vis[i]){
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N,M; cin>>N>>M;
  vector<vector<pii>> A(N);
  rep(i,0,M){
    int L,R,D; cin>>L>>R>>D;
    A[L-1].pb(mp(R-1,D));
    A[R-1].pb(mp(L-1,-D));
  }
  vi F(N,INF);
  rep(i,0,N){
    if(F[i]==INF){
      F[i]=0;
      vi C;
      queue<pii> Q;
      Q.push(mp(0,0));
      while(Q.size()>0){
        int X=Q.front().first,Y=Q.front().second; Q.pop();
        C.pb(X);
        rep(i,0,A[X].size()){
          int P=A[X][i].first,R=Y+A[X][i].second;
          if(F[P]==INF){
            F[P]=R;
            Q.push(mp(P,R));
          }
          else{
            if(F[P]!=R){
              cout<<"No"<<endl;
              return 0;
            }
          }
        }
      }
      set<int> S;
      rep(j,0,C.size()) S.insert(F[C[j]]);
      int H=*rbegin(S),I=*begin(S);
      if(H-I)>1000000000){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:54:14: error: expected primary-expression before '>' token
   54 |       if(H-I)>1000000000){
      |              ^
Language: C++

#include<bits/stdc++.h>

int main(){
    int N,M;
    std::cin>>N>>M;
    std::vector<std::vector<std::pair<int,int>>> graph(N);
    std::vector<int> in(N);
    for(int i=0;i<M;++i){
        int l,r,d;
        std::cin>>l>>r>>d;
        l--;r--;
        graph[l].push_back(std::make_pair(d,r));
        in[r]++;
    }
    std::queue<int> que;
    std::vector<int> dp(N,-1);
    
    for(int i=0;i<N;++i) if(in[i]==0) que.push(i);
    
        while(!que.empty()){
            int u=que.front();que.pop();
            if(dp[u]==-1) dp[u]=0;
            for(auto e:graph[u]){
                if(dp[e.second]==-1){
                    dp[e.second]=dp[u]+e.first;
                    que.push(e.second);
                }
                else if(dp[e.second]!=dp[u]+e.first){
                    std::cout<<"No\n";
                    return 0;
                }
            }
        }
    }
    for(int i=0;i<N;++i) if(in[i]&&dp[i]==-1){
        std::cout<<"No\n";
        return 0;
    }
    std::cout<<"Yes\n";
}


Compiler output:
a.cc:35:5: error: expected unqualified-id before 'for'
   35 |     for(int i=0;i<N;++i) if(in[i]&&dp[i]==-1){
      |     ^~~
a.cc:35:17: error: 'i' does not name a type
   35 |     for(int i=0;i<N;++i) if(in[i]&&dp[i]==-1){
      |                 ^
a.cc:35:21: error: expected unqualified-id before '++' token
   35 |     for(int i=0;i<N;++i) if(in[i]&&dp[i]==-1){
      |                     ^~
a.cc:39:10: error: 'cout' in namespace 'std' does not name a type
   39 |     std::cout<<"Yes\n";
      |          ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int n,m;
  cin >> n >> m;
  UnionFind<int> tree(n);
  G.assign(n,vector<int>(n));
  rep(i,m){
    int l,r,d;
    cin >> l >> r >> d;
    l--;
    r--;
    if(tree.issame(l,r)){
      int diff=tree.diff(l,r);
      if(diff!=d){
        cout << "No"<<endl;
        return 0;
      }
    }
    else tree.merge(l,r,d);
  }
  cout << "Yes"<<endl;
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:75:3: error: 'G' was not declared in this scope
   75 |   G.assign(n,vector<int>(n));
      |   ^
a.cc: At global scope:
a.cc:93:1: error: expected declaration before '}' token
   93 | }
      | ^
Language: C++

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

struct edge{
    ll to, cost;
};

struct zap{
    ll u, v, cost;
};

ll n,m;
vector<vector<edge>> g;

main(){
    cin >> n >> m;
    g.resize(n+10);
    int f1,f2,f3;
    bool ans = true;
    vector<bool> used1(n+10,false);
    vector<zap> zaps;
    for(int i=0;i<m;++i){
        cin >> f1 >> f2 >> f3;
        if(used1[f1] && used1[f2]){
            zaps.push_back({f1,f2,f3});
            continue;
        }
        used1[f1] = true;
        used1[f2] = true;
        g[f2].puush_back({f1,-f3});
        g[f1].push_back({f2,f3});
    }

    vector<bool> used(n+10,false);
    vector<ll> d(n+10,0);
    for(int i=1;i<=n;++i){
        if(!used[i]){
            queue<ll> q;
            q.push(i);
            used[i] = true;
            while(!q.empty()){
                ll v = q.front();
                q.pop();
                for(int j=0;j<g[v].size();++j){
                    ll to = g[v][j].to;
                    ll w = g[v][j].cost;
                    if(!used[to]){
                        used[to] = true;
                        d[to] = d[v]+w;
                        q.push(to);
                    }
                }
            }
        }
    }


    for(int i=0;i<zaps.size();++i){
        if(d[zaps[i].v]-d[zaps[i].u] != zaps[i].cost){
            ans = false;
        }
    }

    if(ans){
        cout << "Yes";
    }
    else{
        cout << "No";
    }

}


Compiler output:
a.cc:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:31:15: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<edge> >, std::vector<edge> >::value_type' {aka 'class std::vector<edge>'} has no member named 'puush_back'; did you mean 'push_back'?
   31 |         g[f2].puush_back({f1,-f3});
      |               ^~~~~~~~~~
      |               push_back
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, g[v].size()) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
//        g[l].emplace_back(r, d);
//        g[r].emplace_back(l, -d);
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }
    for ( int i = 1; i <= n; ++i ) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     rep(i, g[v].size()) {
      |                 ^~~~
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   32 |         g[l].push_back({r, d});
      |              ^~~~~~~~~
a.cc:33:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   33 |         g[r].push_back({l, -d});
      |              ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, g[v].size()) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
//        g[l].emplace_back(r, d);
//        g[r].emplace_back(l, -d);
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     rep(i, g[v].size()) {
      |                 ^~~~
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:33:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   33 |         g[l].push_back({r, d});
      |              ^~~~~~~~~
a.cc:34:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   34 |         g[r].push_back({l, -d});
      |              ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, n) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
//        g[l].emplace_back(r, d);
//        g[r].emplace_back(l, -d);
        g[l].push_back({r, d});
        g[r].push_back({l, -d});
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:12: error: 'n' was not declared in this scope
   11 |     rep(i, n) {
      |            ^
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:33:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   33 |         g[l].push_back({r, d});
      |              ^~~~~~~~~
a.cc:34:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   34 |         g[r].push_back({l, -d});
      |              ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    for (int i = 0; i < g[v].size(); ++i) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:30: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     for (int i = 0; i < g[v].size(); ++i) {
      |                              ^~~~
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   31 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    for ( int i = 0; i < g[v].size(); ++i ) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:31: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     for ( int i = 0; i < g[v].size(); ++i ) {
      |                               ^~~~
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   31 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    int tmp_num = g[v].size();
    rep(i, tmp_num) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:24: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     int tmp_num = g[v].size();
      |                        ^~~~
a.cc:13:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll to = g[v][i].first;
      |                     ^
a.cc:14:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   14 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:33:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   33 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, (int)g[v].size()) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:22: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     rep(i, (int)g[v].size()) {
      |                      ^~~~
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   31 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, (ll)g[v].size()) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:21: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     rep(i, (ll)g[v].size()) {
      |                     ^~~~
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   31 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
vector<bool> mark(100005);
vector<pair<ll, ll>> g(100005);
vector<ll> ans(100005, 1e9);
void dfs ( int v ) {
    mark[v] = true;
    rep(i, g[v].size()) {
        ll to = g[v][i].first;
        ll len = g[v][i].second;
        if ( ans[to] == 1e9 ) {
            ans[to] = ans[v] + len;
        }
        if ( ans[to] != ans[v] + len ) {
            cout << "No" << endl;
            exit(0);
        }
        if ( !mark[to] ) dfs(to);
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    rep(i, m) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        g[l].emplace_back(r, d);
        g[r].emplace_back(l, -d);
    }
    rep(i, n) {
        if ( !mark[i] ) {
            ans[i] = 0;
            dfs(i);
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:11:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   11 |     rep(i, g[v].size()) {
      |                 ^~~~
a.cc:5:39: note: in definition of macro 'rep'
    5 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:12:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   12 |         ll to = g[v][i].first;
      |                     ^
a.cc:13:22: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'int')
   13 |         ll len = g[v][i].second;
      |                      ^
a.cc: In function 'int main()':
a.cc:31:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   31 |         g[l].emplace_back(r, d);
      |              ^~~~~~~~~~~~
a.cc:32:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'emplace_back'
   32 |         g[r].emplace_back(l, -d);
      |              ^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,M; cin>>N>>M;
  vector<vector<pii>> A(N);
  rep(i,0,M){
    int L,R,D; cin>>L>>R>>D;
    A[L-1].pb(mp(R-1,D));
    A[R-1].pb(mp(L-1,-D));
  }
  vi F(N,-1);
  F[0]=0;
  queue<pii> Q;
  Q.pb(mp(0,0));
  string ans="Yes";
  while(Q.size()>0){
    int X=Q.front().first,Y=Q.front().second;
    Q.pop();
    rep(i,0,A[X].size()){
      int B=A[X][i].first,C=Y+A[X][i].second;
      if(F[B]==-1){
        Q.push(mp(B,C));
        F[B]=C;
      }
      else if(F[B]!=C){
        ans="No";
        goto XYZ;
      }
    }
  }
  sort(ALL(F));
  if(F[N-1]-F[0]>1000000000)
    ans="No";
  XYZ:
  cout<<ans<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 'class std::queue<std::pair<long long int, long long int> >' has no member named 'push_back'
   16 | #define pb push_back
      |            ^~~~~~~~~
a.cc:29:5: note: in expansion of macro 'pb'
   29 |   Q.pb(mp(0,0));
      |     ^~
Language: C++

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort
#include <unistd.h>
#include <bits/stdc++.h>

#define pii pair<int,int>
#define REP(i, n) for (long long i = 0; i < (n); i++) 
using namespace std;

using Graph = vector<vector<int>>;

vector< vector< pair<int,int> > > v(100010);	
int V[100010] = {0};
int X[100010] = {0};
typedef long long ll;
static const ll INF = 1000000000000000000LL;
static const ll MOD = 1000000007;


 //1 2 3
 //1 5 4
 //1 6 4

 //2 5 1

//↑があったら2 6 は0 
//3 5 2

bool judge = true;

void dfs(int n)
{
    V[n] = 1;
    REP(i, v[n].size)
    {
        if(X[v[n][i].first] == MOD)
        {
            X[v[n][i].first] = X[n] + v[n][i].second;
        }
        else if(X[v[n][i].first] != X[n] + v[n][i].second)
        {
            judge = false;
        }

        if(V[v[n][i].first] == 0)dfs(v[n][i].first);
    }

}

int main()
{
    ll N, M;
    cin >> N >> M;
    REP(i, N)
    {
        X[i] = MOD;
    }
    REP(i,M)
    {
        int l,r,d;
        cin >> l >> r >> d;
        --l;--r;
        v[l].push_back({r,d});
        v[r].push_back({l,-d});
    
    }

    REP(i,N)
    {
		if(V[i] == 0)
        {
			X[i] = 0;
			dfs(i);
		}
	}
    if(judge) cout << "Yes" << endl;
	else cout << "No" << endl;






    return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:37:17: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; size_type = long unsigned int]' (did you forget the '()' ?)
   37 |     REP(i, v[n].size)
      |                 ^
a.cc:10:46: note: in definition of macro 'REP'
   10 | #define REP(i, n) for (long long i = 0; i < (n); i++)
      |                                              ^
Language: C++

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

bool solve() {
  int N, M; cin >> N >> M;
  vector<vector<int>> g(N);
  vector<vector<int>> d(N);
  for (int i = 0; i < M; i++) {
    int a, b, c; cin >> a >> b >> c; a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
    d[a].push_back(c);
    d[b].push_back(-c);
  }
  vector<int> z(N, INT_MAX);
  auto dfs = [&](auto&& f, int now, int D) -> {
    if (z[now] != INT_MAX) return z[now] == D;
    z[now] = D;
    for (size_t i = 0; i < g[a].size(); i++) {
      if (!f(f, g[now][i], D + d[now][i])) return false;
    }
    return true;
  };
  for (int i = 0; i < N; i++) {
    if (!dfs(dfs, i, 0)) return false;
  }
  return true;
}

int main() {
  cout << (solve() ? "Yes" : "No") << endl;
}


Compiler output:
a.cc: In function 'bool solve()':
a.cc:16:47: error: expected type-specifier before '{' token
   16 |   auto dfs = [&](auto&& f, int now, int D) -> {
      |                                               ^
Language: Java

package main.java.tasks;

import java.util.Scanner;
import java.io.PrintWriter;

public class DPeopleonaLine {

  public void solve(int testNumber, Scanner in, PrintWriter out) {
    boolean f = true;
    int n = in.nextInt();
    int m = in.nextInt();
    PotentialUnionFind puf = new PotentialUnionFind();
    puf.init(n);
    for (int i = 0; i < m; i++) {
      int l = in.nextInt() - 1;
      int r = in.nextInt() - 1;
      long dis = in.nextLong();
      if (puf.find(l, r)) {
        // out.println(i + ": find true");
        // out.println("dif(l, r):" + puf.dif(l, r));
        if (puf.dif(l, r) != dis) {
          f = false;
        }
      } else {
        // out.println(i + ": find false");
        puf.union(l, r, dis);
      }
      // out.println(f);
      /*
      for (int j = 0; j < n; j++) {
        out.println(j + "th weight: " + puf.potential(j));
      }
      */
    }

    out.println(f ? "Yes" : "No");
  }
}


Compiler output:
Main.java:6: error: class DPeopleonaLine is public, should be declared in a file named DPeopleonaLine.java
public class DPeopleonaLine {
       ^
Main.java:12: error: cannot find symbol
    PotentialUnionFind puf = new PotentialUnionFind();
    ^
  symbol:   class PotentialUnionFind
  location: class DPeopleonaLine
Main.java:12: error: cannot find symbol
    PotentialUnionFind puf = new PotentialUnionFind();
                                 ^
  symbol:   class PotentialUnionFind
  location: class DPeopleonaLine
3 errors
Language: C++

#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
const int inf=1e8;
queue<int> q;
struct E{
	int u,v,w;
}e[500000];
int ES;
int first[100007],nt[500000],dis[100007];
int book[100007],v[100007];
int N,M;
inline int R()
{
	char c;
	int f=1,re=0;
	while((c=getchar())<'0'||c>'9')
		if(c=='-') f=-1;
	re=c-48;
	while((c=getchar())>='0'&&c<='9')
		re=re*10+c-48;
	return re*f;
}
bool SPFA(int S)
{
	fill(dis+1,dis+1+N,inf);
	book[S]=1;
	times[S]++;
	q.push(S);
	int t;
	while(!q.empty())
	{
		t=q.front();q.pop();visit[t]=true;
		book[t]=0;
		for(int i=first[t];i;i=nt[i])
		{
			if(dis[e[i].v]==inf)
			{
				dis[e[i].v]=dis[t]+e[i].w;
				if(book[e[i].v]==0)
				{
					q.push(e[i].v);
					book[e[i].v]=1;
				}
			}
			else if(dis[e[i].v]!=dis[t]+e[i].w)
			return false;
		}
	}
	return true;
}
int main()
{
	N=R();M=R();
	int l,r,k;
	for(int i=1;i<=M;i++)
	{
		l=R();r=R();k=R();
		e[++ES]=(E){r,l,-k};
		nt[ES]=first[r];
		first[r]=ES;
		e[++ES]=(E){l,r,k};
		nt[ES]=first[l];
		first[l]=ES;
	}
	/*for(int i=1;i<=N;i++)
	{
		e[++ES]=(E){0,i,0};
		nt[ES]=first[0];
		first[0]=ES;
	}*/
	for(int i=1;i<=N;i++)
	{
		if(!v[i])
		{
			if(!SPFA(i))
			{
				printf("No");
				return 0;
			}
		}
	} 
	printf("Yes");
	return 0;
}

Compiler output:
a.cc: In function 'bool SPFA(int)':
a.cc:29:9: error: 'times' was not declared in this scope; did you mean 'time_t'?
   29 |         times[S]++;
      |         ^~~~~
      |         time_t
a.cc:34:37: error: 'visit' was not declared in this scope
   34 |                 t=q.front();q.pop();visit[t]=true;
      |                                     ^~~~~
a.cc:4:1: note: 'std::visit' is defined in header '<variant>'; this is probably fixable by adding '#include <variant>'
    3 | #include<queue>
  +++ |+#include <variant>
    4 | using namespace std;
Language: C

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;

int n,m;
int tot=0;
int head[50005],dis[50005],vis[50005],f[50005];
struct pp
{
	int v,w,nxt;
}e[100005];
queue <int> q;

int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

void add(int u,int v,int w)
{
	e[tot].v=v;
	e[tot].w=w;
	e[tot].nxt=head[u];
	head[u]=tot++;
}

void in()
{
	n=read();m=read();
	for(int i=1;i<=m;++i)
	{
		int u=read(),v=read(),w=read();
		add(u,v,w);
		add(v,u,-w);
	}
}

bool spfa(int s)
{
	q.push(s);
	f[s]=1;
	dis[s]=0;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		f[u]=0;
		for(int i=head[u];i!=-1;i=e[i].nxt)
		{
			int v=e[i].v;
			if(dis[v]==2147483648)
			{
				dis[v]=dis[u]+e[i].w;
				vis[v]=1;
				if(!f[v])
				{
					q.push(v);
					f[v]=1;
				}
			}
			else if(dis[v]!=dis[u]+e[i].w)
			{
				return false;
			}
		}
	}
	return true;
}

void work()
{
	for(int i=1;i<=n;++i)
	{
		if(!vis[i])
		{
			vis[i]=1;bool flag=spfa(i);
			if(flag==false)
			{
				printf("No\n");
				return ;
			}
		}
	}
	printf("Yes\n");
}

int main()
{
	memset(head,-1,sizeof(head));
	for(int i=0;i<50005;++i)
	dis[i]=2147483648;
	in();
	work();
	return 0;
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

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

int n,m;
int tot=0;
int head[50005],dis[50005],vis[50005],f[50005];
struct pp
{
	int v,w,nxt;
}e[100005];
queue <int> q;

int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}

void add(int u,int v,int w)
{
	e[tot].v=v;
	e[tot].w=w;
	e[tot].nxt=head[u];
	head[u]=tot++;
}

void in()
{
	n=read();m=read();
	for(int i=1;i<=m;++i)
	{
		int u=read(),v=read(),w=read();
		add(u,v,w);
		add(v,u,-w);
	}
}

bool spfa(int s)
{
	q.push(s);
	f[s]=1;
	dis[s]=0;
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		f[u]=0;
		for(int i=head[u];i!=-1;i=e[i].nxt)
		{
			int v=e[i].v;
			if(dis[v]==2147483648)
			{
				dis[v]=dis[u]+e[i].w;
				vis[v]=1;
				if(!f[v])
				{
					q.push(v);
					f[v]=1;
				}
			}
			else if(dis[v]!=dis[u]+e[i].w)
			{
				return false;
			}
		}
	}
	return true;
}

void work()
{
	for(int i=1;i<=n;++i)
	{
		if(!vis[i])
		{
			vis[i]=1;bool flag=spfa(i);
			if(flag==false)
			{
				printf("No\n");
				return ;
			}
		}
	}
	printf("Yes\n");
}

int main()
{
	memset(head,-1,sizeof(head));
	for(int i=0;i<50005;++i)
	dis[i]=2147483648;
	in();
	work();
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.