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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<ll,ll> P;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
vi c(100000);c[0]=0;
void dfs(int i,int p,vvi v){
  c[i]=c[p]+v[p][i];
  rep(j,v.size()){
    if(v[i][j]&&j!=p)dfs(j,i,v);
  }
}
int main(){
  int n,k;cin>>n;
  vvi v(n,vi(n));
  rep(i,n){
    int a,b,x;cin>>a>>b>>x;
    x%=2;
    v[a-1][b-1]=x;
    v[b-1][a-1]=x;
    if(a==1)k=b;
    if(b==1)k=a;
  }
  dfs(k-1,0,v);
  rep(i,n)cout<<c[i]%2<<endl;
}


Compiler output:
a.cc:12:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:12:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:13:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:13:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc:14:14: error: 'c' does not name a type; did you mean 'vc'?
   14 | vi c(100000);c[0]=0;
      |              ^
      |              vc
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
typedef pair<ll,ll> P;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const int inf=1000000007;
const int mod=1000000007;
void chmin(auto &a,auto b){if(b<a)a=b;}
void chmax(auto &a,auto b){if(a<b)a=b;}
int c[100000];c[0]=0;
void dfs(int i,int p,vvi v){
  c[i]=c[p]+v[p][i];
  rep(j,v.size()){
    if(v[i][j]&&j!=p)dfs(j,i,v);
  }
}
int main(){
  int n,k;cin>>n;
  vvi v(n,vi(n));
  rep(i,n){
    int a,b,x;cin>>a>>b>>x;
    x%=2;
    v[a-1][b-1]=x;
    v[b-1][a-1]=x;
    if(a==1)k=b;
    if(b==1)k=a;
  }
  dfs(k-1,0,v);
  rep(i,n)cout<<c[i]%2<<endl;
}

Compiler output:
a.cc:12:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |            ^~~~
a.cc:12:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   12 | void chmin(auto &a,auto b){if(b<a)a=b;}
      |                    ^~~~
a.cc:13:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |            ^~~~
a.cc:13:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   13 | void chmax(auto &a,auto b){if(a<b)a=b;}
      |                    ^~~~
a.cc:14:15: error: 'c' does not name a type; did you mean 'vc'?
   14 | int c[100000];c[0]=0;
      |               ^
      |               vc
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<int,int>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define ceili(x,y) (x+y-1)/y  
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,L,R,X,Y,W,H,N,M,K,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  vector<vector<pint>>Graph(N);
  Vec(dist,lli,N,-1);
  Vec(Color,int,N,0);
  rep(i,0,N-1){
    cin >> A >> B >> C;
    A--;B--;
    Graph[A].pb(pint(B,C%2));
    Graph[B].pb(pint(A,C%2));
  }
  queue<pint> que;
  que.push(pint(0,0));
  dist[0]=1;
  while(!que.empty()){
    auto Xq=que.front;que.pop;
    int pr=Xq.first;
    int pc=Xq.second;
    rep(i,0,Graph[pr].size()){
      int next=Graph[pr][i].first;
      int dt=Graph[pr][i].second;
      if(dist[next])continue;
      dist[next]=1;
      que.push(pint(next,pc^dt));//偶奇判定 1^1=0,1^0=1;
      Color[next]=pc^dt;
  }
  }
  rep(i,0,N)Out(Color[i]);
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: unable to deduce 'auto' from 'que.std::queue<std::pair<int, int> >::front'
   43 |     auto Xq=que.front;que.pop;
      |             ~~~~^~~~~
a.cc:43:17: note:   couldn't deduce template parameter 'auto'
   43 |     auto Xq=que.front;que.pop;
      |                 ^~~~~
a.cc:43:27: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]'
   43 |     auto Xq=que.front;que.pop;
      |                       ~~~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C

#include <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  
  int u[n],v[n],w[n],ans[n+1];
  for(int i=1;i<n;i++){gy
    scanf("%d %d %d",&u[i],&v[i],&w[i]);
    ans[i]=2;
  }
  ans[n]=2;
  
  ans[u[1]]=0;
  ans[v[1]]=w[1]%2;
  
  for(int i=2;i<n;i++){
    if(ans[u[i]]==2){
      if(ans[v[i]]==2){
        ans[v[i]]=w[i]%2;
      }else{
        ans[u[i]]=(w[i]+ans[v[i]])%2;
      }
    }
    if(ans[v[i]]==2){
      if(ans[u[i]]==2){
        ans[u[i]]=w[i]%2;
      }else{
        ans[v[i]]=(w[i]+ans[u[i]])%2;
      }
    }
  }
  
  for(int i=1;i<=n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:24: error: unknown type name 'gy'
    8 |   for(int i=1;i<n;i++){gy
      |                        ^~
main.c:9:11: error: expected declaration specifiers or '...' before string constant
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |           ^~~~~~~~~~
main.c:9:22: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                      ^
main.c:9:28: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                            ^
main.c:9:34: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                                  ^
Language: C

#include <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  
  int u[n],v[n],w[n],ans[n+1];
  for(int i=1;i<n;i++){gy
    scanf("%d %d %d",&u[i],&v[i],&w[i]);
    ans[i]=2;
  }
  ans[n]=2;
  
  ans[u[1]]=0;
  ans[v[1]]=w[1]%2;
  
  for(int i=2;i<n;i++){
    if(ans[u[i]]==2){
      if(ans[v[i]]==2){
        ans[v[i]]=w[i]%2;
      }else{
        ans[u[i]]=(w[i]+ans[v[i]])%2;
      }
    }
    if(ans[v[i]]==2){
      if(ans[u[i]]==2){
        ans[u[i]]=w[i]%2;
      }else{
        ans[v[i]]=(w[i]+ans[v[i]])%2;
      }
    }
  }
  
  for(int i=1;i<=n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:24: error: unknown type name 'gy'
    8 |   for(int i=1;i<n;i++){gy
      |                        ^~
main.c:9:11: error: expected declaration specifiers or '...' before string constant
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |           ^~~~~~~~~~
main.c:9:22: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                      ^
main.c:9:28: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                            ^
main.c:9:34: error: expected declaration specifiers or '...' before '&' token
    9 |     scanf("%d %d %d",&u[i],&v[i],&w[i]);
      |                                  ^
Language: C

#inlude <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  
  int u[n],v[n],w[n],ans[n+1];
  for(int i=1;i<n;i++){
    scanf("%d %d %d",&u[i],&v[i],&w[i]);
    ans[i]=2;
  }
  ans[n]=2;
  
  ans[u[1]]=0;
  ans[v[1]]=w[1]%2;
  
  for(int i=2;i<n;i++){
    if(ans[u[i]]==2){
      ans[u[i]]=0;
      ans[v[i]]=w[i]%2;
    }
  }
  
  for(int i=1;i<n;i++){
    printf("%d\n",ans[i]);
  }
  return 0;
}

Compiler output:
main.c:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude <stdio.h>
      |  ^~~~~~
      |  include
main.c: In function 'main':
main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #inlude <stdio.h>
main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |   scanf("%d",&n);
      |   ^~~~~
main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:25:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   25 |     printf("%d\n",ans[i]);
      |     ^~~~~~
main.c:25:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:25:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:25:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}

//根からの距離の偶奇が一致する時２点の距離は偶数になることを利用する
struct Edge{//一回で二つの整数を格納する　コンストラクタ？？
    ll to; ll cost;
    Edge(ll to,ll cost) : to(to), cost(cost){}
};

int N;


int ans[101000];
bool visited[101000];

void dfs(int s,ll cost){
	if(visited[s]){
      return ;
    }

	visited[s]=true;

	if(cost % 2 == 0){
      ans[s]=0;
    }
	else{
      ans[s]=1;
    }
    

	for(auto p:G[s]){// struct Edgeで二つの整数を格納できるようにした場合のそれぞれの要素の特定方法
		dfs(p.to, cost + p.cost);
	}
}

int main(){
	cin >> N;
  vector<Edge> G;
	for(int i = 0; i < N - 1; i++){
		ll u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		G[u].push_back(Edge(v,w));
		G[v].push_back(Edge(u,w));
	}
	dfs(0,0);
	for(int i = 0; i < N; i++){
		cout << ans[i] << endl;
	}
}


Compiler output:
a.cc: In function 'void dfs(int, ll)':
a.cc:74:20: error: 'G' was not declared in this scope
   74 |         for(auto p:G[s]){// struct Edgeで二つの整数を格納できるようにした場合のそれぞれの要素の特定方法
      |                    ^
a.cc: In function 'int main()':
a.cc:86:22: error: '__gnu_cxx::__alloc_traits<std::allocator<Edge>, Edge>::value_type' {aka 'struct Edge'} has no member named 'push_back'
   86 |                 G[u].push_back(Edge(v,w));
      |                      ^~~~~~~~~
a.cc:87:22: error: '__gnu_cxx::__alloc_traits<std::allocator<Edge>, Edge>::value_type' {aka 'struct Edge'} has no member named 'push_back'
   87 |                 G[v].push_back(Edge(u,w));
      |                      ^~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
using namespace std;
//cout <<  << endl;
typedef long long int ll;

#define MAX_N 100010

struct{ll to,cost;};
vector<edge> G[MAX_N];
ll color[MAX_N];

bool dfs(ll v,ll p,ll c){
    color[v]=c;
    for (auto e: G[v]){
        if (e.to==p)continue;
        if (e.cost%2==0)dfs(e.to,v,1-c);
        else dfs(e.to,v,c);
    }
    return true;
}

int main(){
    ll v;
    cin >> v;
    ll s,t,w;
    for (ll i=0;i<v-1;i++){
        cin >> s >> t >> w;
        s--;
        t--;
        G[s-1].push_back(edge{t,w});
        G[t-1].push_back(edge{s,w});
    }
    dfs(0LL,-1,1);
    for (ll i=0;i<v;i++){
        cout << color[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:18:19: error: abstract declarator '<unnamed struct>' used as declaration
   18 | struct{ll to,cost;};
      |                   ^
a.cc:19:8: error: 'edge' was not declared in this scope
   19 | vector<edge> G[MAX_N];
      |        ^~~~
a.cc:19:12: error: template argument 1 is invalid
   19 | vector<edge> G[MAX_N];
      |            ^
a.cc:19:12: error: template argument 2 is invalid
a.cc: In function 'bool dfs(ll, ll, ll)':
a.cc:24:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   24 |     for (auto e: G[v]){
      |                     ^
      |                     std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:24:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
   24 |     for (auto e: G[v]){
      |                     ^
      |                     std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc: In function 'int main()':
a.cc:40:16: error: request for member 'push_back' in 'G[(s - 1)]', which is of non-class type 'int'
   40 |         G[s-1].push_back(edge{t,w});
      |                ^~~~~~~~~
a.cc:40:26: error: 'edge' was not declared in this scope
   40 |         G[s-1].push_back(edge{t,w});
      |                          ^~~~
a.cc:41:16: error: request for member 'push_back' in 'G[(t - 1)]', which is of non-class type 'int'
   41 |         G[t-1].push_back(edge{s,w});
      |                ^~~~~~~~~
a.cc:41:30: error: expected ')' before '{' token
   41 |         G[t-1].push_back(edge{s,w});
      |                         ~    ^
      |                              )
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
using namespace std;
//cout <<  << endl;
typedef long long int ll;

#define MAX_N 100010

struct{ll to,cost;};
vector<edge> G[MAX_N];
ll color[MAX_N];

bool dfs(ll v,ll p,ll c){
    color[v]=c;
    for (auto e: G[v]){
        if (e.to==p)continue;
        else if (e.cost%2==0)dfs(e.to,v,1-c);
        else dfs(e.to,v,c);
    }
    return true;
}

int main(){
    ll v;
    cin >> v;
    ll s,t,w;
    for (ll i=0;i<v-1;i++){
        cin >> s >> t >> w;
        s--;
        t--;
        G[s-1].push_back(edge{t,w});
        G[t-1].push_back(edge{s,w});
    }
    dfs(0LL,-1,1);
    for (ll i=0;i<v;i++){
        cout << color[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:18:19: error: abstract declarator '<unnamed struct>' used as declaration
   18 | struct{ll to,cost;};
      |                   ^
a.cc:19:8: error: 'edge' was not declared in this scope
   19 | vector<edge> G[MAX_N];
      |        ^~~~
a.cc:19:12: error: template argument 1 is invalid
   19 | vector<edge> G[MAX_N];
      |            ^
a.cc:19:12: error: template argument 2 is invalid
a.cc: In function 'bool dfs(ll, ll, ll)':
a.cc:24:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   24 |     for (auto e: G[v]){
      |                     ^
      |                     std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:24:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
   24 |     for (auto e: G[v]){
      |                     ^
      |                     std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc: In function 'int main()':
a.cc:40:16: error: request for member 'push_back' in 'G[(s - 1)]', which is of non-class type 'int'
   40 |         G[s-1].push_back(edge{t,w});
      |                ^~~~~~~~~
a.cc:40:26: error: 'edge' was not declared in this scope
   40 |         G[s-1].push_back(edge{t,w});
      |                          ^~~~
a.cc:41:16: error: request for member 'push_back' in 'G[(t - 1)]', which is of non-class type 'int'
   41 |         G[t-1].push_back(edge{s,w});
      |                ^~~~~~~~~
a.cc:41:30: error: expected ')' before '{' token
   41 |         G[t-1].push_back(edge{s,w});
      |                         ~    ^
      |                              )
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
using namespace std;
//cout <<  << endl;
typedef long long int ll;

#define MAX_N 100010

vector<edge> G[MAX_N];
ll color[MAX_N];

bool dfs(ll v,ll p,ll c){
    color[v]=c;
    for (auto e: G[v]){
        if (e.to==p)continue;
        else if (e.cost%2==0)dfs(e.to,v,1-c);
        else dfs(e.to,v,c);
    }
    return true;
}

int main(){
    ll v;
    cin >> v;
    ll s,t,w;
    for (ll i=0;i<v-1;i++){
        cin >> s >> t >> w;
        s--;
        t--;
        G[s-1].push_back(edge{t,w});
        G[t-1].push_back(edge{s,w});
    }
    dfs(0LL,-1,1);
    for (ll i=0;i<v;i++){
        cout << color[i] << endl;
    }
    return 0;
}


Compiler output:
a.cc:18:8: error: 'edge' was not declared in this scope
   18 | vector<edge> G[MAX_N];
      |        ^~~~
a.cc:18:12: error: template argument 1 is invalid
   18 | vector<edge> G[MAX_N];
      |            ^
a.cc:18:12: error: template argument 2 is invalid
a.cc: In function 'bool dfs(ll, ll, ll)':
a.cc:23:21: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   23 |     for (auto e: G[v]){
      |                     ^
      |                     std::begin
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:23:21: error: 'end' was not declared in this scope; did you mean 'std::end'?
   23 |     for (auto e: G[v]){
      |                     ^
      |                     std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc: In function 'int main()':
a.cc:39:16: error: request for member 'push_back' in 'G[(s - 1)]', which is of non-class type 'int'
   39 |         G[s-1].push_back(edge{t,w});
      |                ^~~~~~~~~
a.cc:39:26: error: 'edge' was not declared in this scope
   39 |         G[s-1].push_back(edge{t,w});
      |                          ^~~~
a.cc:40:16: error: request for member 'push_back' in 'G[(t - 1)]', which is of non-class type 'int'
   40 |         G[t-1].push_back(edge{s,w});
      |                ^~~~~~~~~
a.cc:40:30: error: expected ')' before '{' token
   40 |         G[t-1].push_back(edge{s,w});
      |                         ~    ^
      |                              )
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
using  pill = pair<int,ll>;
using  Graph = vector<vector<pii>>;

int main(){
    int N; cin >> N;
    Graph G(N);
    rep(i,N-1){
        int from,to,cost;
        cin >> from >> to >> cost;
        from--; to--;
        G[from].push_back(pill(to,cost));
        G[to].push_back(pill(from,cost));
    }

    vector<bool> seen(100005);
    vector<ll> dist(100005);
    seen.assign(N,false);
    rep(i,N){
        seen[i] = true;
        for(auto next_f : G[i]){
            if(seen[next_f.first]) continue;
            if(next_f.first == 0) dist[next_f.first] = 0;
            dist[next_f.first] = dist[i] + next_f.second;
            seen[next_f.first] = true;
        } 
    }

    rep(i,N){
        if(dist[i] % 2 == 0) cout << "0" << endl;
        else cout << "1" << endl;
    }
}


Compiler output:
a.cc:8:30: error: 'pii' was not declared in this scope
    8 | using  Graph = vector<vector<pii>>;
      |                              ^~~
a.cc:8:30: error: template argument 1 is invalid
a.cc:8:30: error: template argument 2 is invalid
a.cc:8:33: error: template argument 1 is invalid
    8 | using  Graph = vector<vector<pii>>;
      |                                 ^~
a.cc:8:33: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:12:5: error: 'Graph' was not declared in this scope; did you mean 'isgraph'?
   12 |     Graph G(N);
      |     ^~~~~
      |     isgraph
a.cc:17:9: error: 'G' was not declared in this scope
   17 |         G[from].push_back(pill(to,cost));
      |         ^
a.cc:26:27: error: 'G' was not declared in this scope
   26 |         for(auto next_f : G[i]){
      |                           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define f first 
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mp make_pair
#define pb push_back
#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define ALL(r) r.begin(), r.end()
int par[100001];
vector<pair<int,int>>v[100005];
int c[100005],vis[100005];
void bfs()
{
	queue<int>q;
	q.push(0);
	c[0] = 0;
	vis[0] = 1;
	while(!q.empty())
	{
		int node = q.front();
		q.pop();
		for (int i = 0; i < v[node].size(); ++i)
		{
			if(vis[v[node][i].f]==0)
			{
				if(((v[node][i].s)%2) == 1)
					c[v[node][i].f] = 1-c[node];
				else
					c[v[node][i].f] = c[node];
				vis[v[node][i].f] = 1;
				q.push(v[node][i].f);
			}
		}
	}
}
void dfs(int v1, int now){
    c[v1] = now;
 
    for(int i=0;i<v[v1].size();i++)
    {
        int w = v[v1][i].s;
        int next_v = v[v1][i].f;
        if (c[next_v] != -1)
            continue;
        if (w % 2)
            dfs(next_v, 1-now);
        else
            dfs(next_v, now);
    }
}
int main(){
  int n;
  FIO;  
  cin >> n;
  int u,v1,w;
  memset(vis,0,sizeof(vis));
  for (int i = 0; i < n; ++i)
  {
  	c[i] = -1;
  }
  for (int i = 0; i < n-1; ++i)
  {
  	cin >> u >> v1 >> w;
  	u--;v1--;
  	v[u].pb({v1,w});
  	v[v1].pb({u,w});
  }
  dfs();
  for (int i = 0; i < n; ++i)
  {
  	cout <<  c[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:6: error: too few arguments to function 'void dfs(int, int)'
   71 |   dfs();
      |   ~~~^~
a.cc:39:6: note: declared here
   39 | void dfs(int v1, int now){
      |      ^~~
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
#define V vector<int>
// clang-format on

int N;
long long cost[MAX_N][MAX_N];
int color[MAX_N];
bool visited[MAX_N];

int main(void)
{
  cin >> N;
  vector<V> G(N + 1);
  REP(i, N - 1)
  {
    long long u, v, w;
    cin >> u >> v >> w;
    // 0-indexed
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
    cost[u][v] = w;
    cost[v][u] = w;
  }

  REP(i, N) visited[i] = false;

  queue<int> q;
  q.push(0);
  color[0] = 0;
  visited[0] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    visited[u] = true;
    for (auto v : G[u]) {
      if (visited[v]) continue;
      // 偶数なら同じ色分けに
      if (cost[u][v] % 2 == 0) {
        color[v] = color[u];
      }
      else {
        color[v] = 1 - color[u];
      }
      q.push(v);
    }
  }

  REP(i, N) cout << color[i] << endl;

  return 0;
}


Compiler output:
/tmp/cc9ODsFk.o: in function `main':
a.cc:(.text+0x1c3): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x212): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x247): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x2b5): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x30e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x323): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x33c): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x35e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
a.cc:(.text+0x3e4): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/cc9ODsFk.o
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

int N;
int cost[MAX_N][MAX_N];
int col[MAX_N];
int visited[MAX_N];

int main(void)
{
  cin >> N;
  vector<vector<int>> G(N, vector<int>(0));
  REP(i, N - 1)
  {
    int u, v, w;
    cin >> u >> v >> w;
    // 0-indexed
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
    cost[u][v] = w;
    cost[v][u] = w;
  }

  REP(i, N) visited[i] = false;

  queue<int> q;
  q.push(0);
  col[0] = 0;
  visited[0] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    visited[u] = true;
    for (int v : G[u]) {
      if (visited[v]) continue;
      cout << u << ":" << v << cost[u][v] << endl;
      // 偶数なら同じ色分けに
      if (cost[u][v] % 2 == 0) {
        col[v] = col[u];
      }
      else {
        col[v] = 1 - col[u];
      }
      q.push(v);
    }
  }

  REP(i, N) cout << col[i] << endl;

  return 0;
}


Compiler output:
/tmp/ccbyjpkG.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x237): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x241): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x281): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x2fa): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x3d5): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x3ea): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x403): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x425): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
a.cc:(.text+0x4ab): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccbyjpkG.o
collect2: error: ld returned 1 exit status
Language: C++

#include <stdio.h>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

int N;
int cost[MAX_N][MAX_N];
int col[MAX_N];
int visited[MAX_N];

int main(void)
{
  cin >> N;
  vector<vector<int>> G(N, vector<int>(0));
  REP(i, N - 1)
  {
    int u, v, w;
    cin >> u >> v >> w;
    // 0-indexed
    u--, v--;
    G[u].push_back(v);
    G[v].push_back(u);
    cost[u][v] = w;
    cost[v][u] = w;
  }

  REP(i, N) visited[i] = false;

  queue<int> q;
  q.push(0);
  col[0] = 0;
  visited[0] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    visited[u] = true;
    for (int v : G[u]) {
      if (visited[v]) continue;
      cout << u << ":" << v << cost[u][v] << endl;
      // 偶数なら同じ色分けに
      if (cost[u][v] % 2 == 0) {
        col[v] = col[u];
      }
      else {
        col[v] = 1 - col[u];
      }
      q.push(v);
    }
  }

  REP(i, N) cout << col[i] << endl;

  return 0;
}


Compiler output:
/tmp/ccYo2Con.o: in function `main':
a.cc:(.text+0x1ef): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x237): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x241): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x281): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x2fa): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x3d5): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x3ea): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x403): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x425): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
a.cc:(.text+0x4ab): relocation truncated to fit: R_X86_64_PC32 against symbol `col' defined in .bss section in /tmp/ccYo2Con.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define frone(i,n) for(int i=1;i<=n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n;
	cin >> n;
    int ans[n];
    fr(i,n){
      ans[i] = -1;
    }
    int u,v,w;
    fr(i,n-1){
      cin >> u>>v>>w;
      if(i==0){
        ans[u-1]=0;
        ans[v-1]=w%2;
      }
      else{
        if(ans[u-1]!=-1){
          ans[v-1]=(ans[u-1]+w)%2;
        }else if(ans[v-1]!=-1){
          ans[u-1]=(ans[v-1]+w)%2;
        }
      }
    }
    fr(i,n){
      if(a[i]==-1)a[i]=0;
      cout<<ans[i]<<" "<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:10: error: 'a' was not declared in this scope
   36 |       if(a[i]==-1)a[i]=0;
      |          ^
Language: C++

#include<bits/stdc++.h>
#include <math.h>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define frone(i,n) for(int i=1;i<=n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n;
	cin >> n;
    int ans[n];
    fr(i,n){
      ans[i] = -1;
    }
    int u,v,w;
    fr(i,n-1){
      cin >> u>>v>>w;
      if(i==0){
        ans[u-1]=0;
        ans[v-1]=w%2;
      }
      else{
        if(ans[u-1]!=-1){
          ans[v-1]=(ans[u-1]+w)%2;
        }else if(ans[v-1]!=-1){
          ans[u-1]=(ans[v-1]+w)%2;
        }
      }
    }
    if(n==1)a[0]=0;
    fr(i,n){
      cout<<ans[i]<<" "<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:13: error: 'a' was not declared in this scope
   35 |     if(n==1)a[0]=0;
      |             ^
Language: C++

#include<bits/stdc++.h>
#include<math.h>
#include <stdio.h>
#include<vector>
#include<stdlib.h>
//#include <algorithm>
#include <limits>
#include<string>
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define ll long long
#define d_5 100000
struct edge{
  struct treev* to;
  ll length;
};
struct treev{
  int num;
  vector<edge> nexts;
  treev* parent;
};
bool cmp(const edge &a, const edge &b)
{
    return a.to->num < b.to->num;
}
ll* result;
treev* createtreenode(int num,treev* root){
  //cout << "c" << endl;
  treev* newt=new treev;
  if(newt==NULL){
    while(1){
      root->num=1;
    }
  }
  newt->num=num;
  newt->parent=root;
  newt->nexts={};
  //cout << "fff" << endl;
  return newt;
}
void insertree(treev* root,ll len,int Va,int Vb){//結ぶ頂点を
  //cout << len << endl;
  if(root->num==Va){
    //cout << "w" << endl;
    root->nexts.push_back({createtreenode(Vb,root),len});
    //cout << "ttt" << endl;
    return;
  }else if(root->num==Vb){
    //cout << "r" << endl;
    root->nexts.push_back({createtreenode(Va,root),len});
    return;
  }else{
    for(auto i:root->nexts){
      insertree(i.to,len,Va,Vb);
    }
  }
  return;
}
void search(treev* root,ll depth){
    if(depth % 2 == 0){
      result[root->num]=1;
    }else{
      result[root->num]=0;
    }
  for(auto i:root->nexts){
    search(i.to,depth+i.length);
  }
  return;
}
int main(void){
  ll N;
  cin >> N;
  ll* w = malloc(sizeof(ll)*(N-1));
  int* u=malloc(sizeof(int)*(N-1));
  int* v=malloc(sizeof(int)*(N-1));
  treev* root=NULL;
  result=(ll*)malloc(sizeof(ll)*(N+1));
  rep(i,N-1){
    cin >> u[i] >> v[i] >> w[i];
  }
  rep(i,N-1){
    if(root==NULL){
      root=createtreenode(u[i],NULL);
      insertree(root,w[i],u[i],v[i]);
    }else{
      insertree(root,w[i],u[i],v[i]);
    }
    //cout << "d" << endl;
  }
  result[root->num]=0;
  search(root,0);
  rep(i,N){
    cout << result[i+1] << endl;
  }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:17: error: invalid conversion from 'void*' to 'long long int*' [-fpermissive]
   76 |   ll* w = malloc(sizeof(ll)*(N-1));
      |           ~~~~~~^~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
a.cc:77:16: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   77 |   int* u=malloc(sizeof(int)*(N-1));
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
a.cc:78:16: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   78 |   int* v=malloc(sizeof(int)*(N-1));
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~
      |                |
      |                void*
Language: C++

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

struct Edge{
    int to; // 辺の行先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t),weight(w){}
};

using Graph = vector<vector<Edge>>;
vector<int> color;
Graph G(N+1);

void dfs(int v,int weight){
    color[v] = weight % 2;
    for( auto next_v : G[v]){
        if(color[next_v.to] == -1){
            dfs(next_v.to,weight + next_v.weight);
        }
    }
}

int main(){
    int N;
    cin >> N;
    
    for(int i = 0; i < N - 1; i++){
        int from, to, weight;
        cin >> from >> to >> weight;
        G[from].push_back(Edge(to,weight));
        G[to].push_back(Edge(from,weight));
    }   

    color.assign(N + 1,-1);
    // for(int v = 1; v <= N; v++){
    //     if(color[v] != -1) continue;
    //     dfs(G,v,0);
    // }
    dfs(1,0);

    for(int i = 1; i <= N; i++){
        cout << color[i] << endl;
    }


}

Compiler output:
a.cc:12:9: error: 'N' was not declared in this scope
   12 | Graph G(N+1);
      |         ^
Language: C++

#include <iostream>

#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>
#include<stack>
#include<queue>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP2(i, s, n) for(int i=s;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
#define bitSearch(bit, n) for(int bit = 0; bit < (1 << N); bit++)
using namespace std;

void printAns(long long a) { cout << a << endl; }

void yesno(bool a) { if (a)cout << "Yes" << endl; else cout << "No" << endl; }

void YESNO(bool a) { if (a)cout << "YES" << endl; else cout << "NO" << endl; }

typedef long long ll;
typedef unsigned long ul;
typedef long double ld;

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//ll INF = 10000000;
//ll mod = 1000000007;//10^9+7

using Graph = vector<vector<pair<int, int>>>;

int color[100100];

void dfs(const Graph G, int v, ll dis) {
    if(color[v]==-1)return;
    color[v] = dis % 2;
    for (auto next_v:G[v]) {
            dfs(G, next_v.first, dis + next_v.second);
        }
    }
}



//番号ズレ注意！！
int main() {
    int N;
    cin >> N;
    Graph G(N + 1);
    REP(i, N - 1) {
        int from, to, length;
        cin >> from >> to >> length;
        G[from].push_back(make_pair(to, length));
        G[to].push_back(make_pair(from, length));
    }
    REP(i,N+1){
        color[i]=-1;
    }
    dfs(G, 1, 0);
    REP_1(i, N) {
        cout << color[i] << endl;
    }
}


Compiler output:
a.cc:60:1: error: expected declaration before '}' token
   60 | }
      | ^
Language: C++

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

const int MAX_E = 1e5 + 10;
const int MAX_V = 1e5 + 10;
const int INF = 2e9;
struct edge{ int to, cost; };
typedef pair<int, int> P;
vector<edge> G[MAX_V + 10];
int d[MAX_V + 10];
int V, E;

void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P>> que;
    for (int i = 1; i <= V; ++i) d[i] = INF;
    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); ++i){
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}


int main(){

    cin >> V;
    E = V-1;
    for (int i = 0; i < E; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        G[a].push_back(edge{b,c});
        G[b].push_back(edge{a,c});
    }

    int s = 1;
    dijkstra(s);

    for (int i = 1; i <= V; i++){
		cout << d[i] % 2 << endl;    		
    }
    return 0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: expected ';' before '}' token
   54 |     return 0
      |             ^
      |             ;
   55 | }
      | ~
Language: Java

import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug == false) {
            return;
        }
        System.out.println(str);
    }

    public static class Edge {
        int u;
        int v;
        int w;

        public Edge(int u, int v, int w) {
            this.u = u;
            this.v = v;
            this.w = w;

        }
    }
    public static class Node {
        List<Edge> edge = new LinkedList<>();
    }

    public static void main(String[] args) {

        int N;
        Node[] node;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            set = new HashMap<>();
            node = new Node[N];
            for (int i = 0; i < N; i++) {
                node[i] = new Node();
            }
            for (int i = 0; i < N - 1; i++) {
                int u = sc.nextInt();
                int v = sc.nextInt();
                int w = sc.nextInt();
                Edge e = new Edge(u, v, w);
                node[u-1].edge.add(e);
                node[v-1].edge.add(e);
            }
        }
        int[] distans = new int[N];
        HashSet<Edge> visited = new HashSet<>();
        Deque<Integer> queue = new ArrayDeque<>();
        queue.push(1);
        distans[0] = 0;
        Integer target;
        while((target = queue.pollFirst()) != null){
            //List<Edge> list = set.get(target);
            List<Edge> list = node[target -1].edge;
            for(Edge e : list){
                if(visited.contains(e)){
                    continue;
                }else{
                    int d = (distans[target-1] + e.w) %2;
                    int i;
                    if(e.u != target ){
                        i = e.u;
                    }else{
                        i = e.v;
                    }
                    queue.addLast(i);
                    distans[i  -1] = d;
                    debug(i+":"+distans[i  -1]);
                    visited.add(e);
                }
            }
        }
        for(int i : distans){
            System.out.println(i%2);
        }
    }


}


Compiler output:
Main.java:40: error: cannot find symbol
            set = new HashMap<>();
            ^
  symbol:   variable set
  location: class Main
1 error
Language: C++

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

vector<vector<pair<int, int>>> graph; //pair<to, cost>
vector<int> color;
vector<LL> length;

void dfs(int from) {
  for (int i = 0; i < graph[from].size(); i ++) {
    int to   = graph[from][i].first;
    int cost = graph[from][i].second;
    length[to] = length[from] + cost;
    if (length[to] % 2 == 0) color[to] = 0;
    else color[to] = 1;
    dfs(to);
  }
}

int main() {
  int n; cin >> n;
  graph = vector<vector<pair<int, int>>>(n);
  for (int i = 0; i < n - 1; i ++) {
    int x, y, z;
    cin >> x >> y >> z;
    x --, y --;
    graph[x].push_back(make_pair(y, z));
  }

  color = vector<int>(n);
  length = vector<int>(n);
  color[0] = 0, length[0] = 0;
  dfs(0);

  for (int i = 0; i < n; i ++) cout << color[i] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   31 |   length = vector<int>(n);
      |                         ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second < b.second;
}

int N;

int edge[10001][10001] ={-1};
int node[10001] = {0};
int visi[10001] = {0};

void dfs(int u){
    visi[u] = 1;

    for(int i = 1;i<=N;i++){
        if(edge[u][i] == -1)continue;
        if(visi[i])continue;
        node[i] = (node[u] + edge[u][i])%2;
        dfs(i);
    }

}

int Dx[6] = { 0, 0, 1, 1,-1,-1};
int Dy[6] = { 1,-1, 1, 0, 0,-1};

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;
int main(){

  cin >>N;

  for(int i = 1;i<=N;i++){
      for(int j = 1;j<=N;j++){
          edge[i][j] = -1;
      }
  }

  for(int i = 0;i < N-1;i++){
      int u,v,w;
      cin >>u>>v>>w;
      edge[u][v] = w%2;
      edge[v][u] = w%2;
  }

  node[1] = 1;
  dfs(1);

  for(int i = 1;i<=N;i++){
      if(node[i])cout <<'1'<<endl;
      else cout <<'0'<<endl;
  }
  return 0;
}



Compiler output:
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.