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

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> to(n),cost(n);
  for(int i=0;i<n-1;i++){
    int a,b,w;
    cin>>a>>b>>w;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
    cost[a].push_back(w);
    cost[b].push_back(w);
  }
    vector<int> ans(n,-1);
    queue<int> q;
    ans[0]=0;
    q.push(0);
    while(!q.empty());
    int v=q.front();
    q.pop();
    for(int i=0;i<to[v].size();i++){
      int u=to[v][i];
      int w=cost[v][i];
      if(ans[u]!= -1) continue;
      ans[u]=(ans[v]+w)%2;
      q.push(u);
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}


Compiler output:
a.cc:34:3: error: expected unqualified-id before 'for'
   34 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:34:15: error: 'i' does not name a type
   34 |   for(int i=0;i<n;i++){
      |               ^
a.cc:34:19: error: 'i' does not name a type
   34 |   for(int i=0;i<n;i++){
      |                   ^
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> to(n),cost(n);
  for(int i=0;i<n-1;i++){
    int a,b,w;
    cin>>a>>b>>w;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
    cost[a].push_back(w);
    cost[b].push_back(w);
    vector<int> ans(n,-1);
    queue<int> q;
    ans[0]=0;
    q.push(0);
    while(!q.empty());
    int v=q.front();
    q.pop();
    for(int i=0;i<to[v].size();i++){
      int u=to[v][i];
      int w=cost[v][i];
      if(ans[u]!= -1) continue;
      ans[u]=(ans[v]+w)%2;
      q.push(u);
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     cout<<ans[i]<<endl;
      |           ^~~
      |           abs
Language: C++

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> G(n,vector<int> (0));
  vector<vector<int>> b(n,vector<int> (0));
  
  sort(b.begin(),b.end());
  for(int i=0;i<n-1;i++){
    int a,s,w;
    cin>>a>>s>>w;
    a=b[i][0]-1;
    s=b[i][1]-1;
    G[a].push_back(s);
    G[s].push_back(a);
    b[a].push_back(w);
    b[s].push_back(w);
  }
  vector<int> co(n,-1);
  co[0]=0;
  queue<int> que;
  que.push(0);
  int j=0;
  while(!que.empty()){
    int v=que.front();
    que.pop();
    for(int nv=0;nv<G[v].size();nv++){
      int u=G[v][uv];
      int w=b[v][uv];
      if(co[u]!= (-1)) continue;
      if((co[v]+w)%2==0){
        co[u]=0;
      }
      else{
        co[u]=1;
      }
      j++;
      que.push(u);
    }
  }
  for(int i=0;i<n;i++){
    cout<<co[i]<<endl;
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:31:18: error: 'uv' was not declared in this scope; did you mean 'u'?
   31 |       int u=G[v][uv];
      |                  ^~
      |                  u
Language: C++

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> G(n,vector<int> (0));
  vector<vector<long long>> b(n,vector<long long> (3));
  for(int i=0;i<n-1;i++){
    cin>>b[i][0]>>b[i][1]>>b[i][2];
  }
  sort(b.begin(),b.end());
  for(int i=0;i<n-1;i++){
    int a,s;
    a=b[i][0]-1;
    s=b[i][1]-1;
    G[a].push_back(s);
    G[s].push_back(a);
  }
  vector<long long> lengh(n);
  vector<int> co(n,-1);
  co[0]=0;
  queue<int> que;
  que.push(0);
  int j=0;
  while(!que.empty()){
    int v=que.front();
    que.pop();
    for(int nv;G[v]){
      if(co[nv]!=-1) continue;
      lengh[nv]==lengh[v]+b[j][2];
      if(lengh[nv]%2==0){
        co[nv]=0;
      }
      else{
        co[nv]=1;
      }
      j++;
      que.push(nv);
    }
  }
  for(int i=0;i<n;i++){
    cout<<co[i]<<endl;
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:30:19: error: could not convert 'G.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)v))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool'
   30 |     for(int nv;G[v]){
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
a.cc:30:20: error: expected ';' before ')' token
   30 |     for(int nv;G[v]){
      |                    ^
      |                    ;
Language: C++

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


int main() {
  int n;
  cin>>n;
  vector<vector<int>> G(n,vector<int> (0));
  vector<vector<long long>> b(n,vector<long long> (3));
  for(int i=0;i<n-1;i++){
    cin>>b[i][0]>>b[i][1]>>b[i][2];
  }
  sort(b.begin(),b.end());
  for(int i=0;i<n-1;i++){
    int a,s;
    a=b[i][0]-1;
    s=b[i][1]-1;
    G[a].push_back(s);
    G[s].push_back(a);
  }
  vector<long long> lengh(n);
  vector<int> co(n,-1);
  co[0]=0;
  queue<int> que;
  que.push_back(0);
  int j=0;
  while(!que.empty()){
    int v=que.front();
    que.pop();
    for(int nv;G[v]){
      if(co[nv]!=-1) continue;
      lengh[nv]==lengh[v]+b[j][2];
      if(lengh[nv]%2==0){
        co[nv]=0;
      }
      else{
        co[nv]=1;
      }
      j++;
      que.push(nv);
    }
  }
  for(int i=0;i<n;i++){
    cout<<co[i]<<endl;
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:25:7: error: 'class std::queue<int>' has no member named 'push_back'
   25 |   que.push_back(0);
      |       ^~~~~~~~~
a.cc:30:19: error: could not convert 'G.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)v))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'bool'
   30 |     for(int nv;G[v]){
      |                   ^
      |                   |
      |                   __gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type {aka std::vector<int>}
a.cc:30:20: error: expected ';' before ')' token
   30 |     for(int nv;G[v]){
      |                    ^
      |                    ;
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int weight[100001][100001];
vector<vector<int>> M;
int sum;



int main()
{
	int n; cin >> n;
	rep(i,n)M.emplace_back(0);
	sum=0;
	rep(i,n-1)
	{
		int foo,fooo;
		cin >> foo >> fooo;
		foo--;fooo--;
		M[foo].push_back(fooo);
		M[fooo].push_back(foo);
		int w;
		cin >> w;
		weight[foo][fooo]=w;
		weight[fooo][foo]=w;
	}
	stack<int> S;
	S.push(0);
	vector<int> color(n);
	rep(i,n)color[i]=-1;
	color[0]=0;

	//0に0を塗った
	while (!S.empty())
	{
		int now = S.top();
		int next = -1;
		rep(i,M[now].size())
		{
			//cout<<sum<<endl;
			if(color[M[now][i]]==-1)
			{
				S.push(M[now][i]);
				next=S.top();
				break;
			}
		}
		//もし次の結合があれば
		if(next != -1)
		{
			sum += weight[now][next];
			sum %=2;
			color[next] = sum%2;
		}
		//行き止まりだったら
		else if(next == -1)
		{
			int pre = S.top();
			S.pop();
			//cout<<pre<<':'<<S.top()<<endl;
			if(!S.empty())sum-=weight[pre][S.top()];
		}
	}

	rep(i,n)
	cout<<color[i]<<endl;
	



	return 0;
}

Compiler output:
/tmp/ccOUlVh6.o: in function `main':
a.cc:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0xf3): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x28b): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x2d8): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x337): relocation truncated to fit: R_X86_64_PC32 against symbol `M' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x38c): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x394): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x39a): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccOUlVh6.o
a.cc:(.text+0x3b1): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define PB push_back
#define MP make_pair
using ll = long long;
using Pii = pair<int, int>;
const int MOD = 1000000007;
const int INF = 1000000000;

const ll LINF = 1000000000000000000;
using P = pair<ll, int>;
struct edge{
    int to, cost;
    edge(int To, int Cost) : to(To), cost(Cost){};
};


int V;
vector<vector<edge>> G;
vector<ll> d;

void dijkstra(int s){ //頂点sからの距離を求める
    //P first: 距離　second: 頂点
    priority_queue<P, vector<P>, greater<P>> que;
    fill(ALL(d), LLINF);
    d[s] = 0;
    que.push(MP(0, s));

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

int main(){
    cin >> V;
    G.resize(V);
    d.resize(V);
    REP(i, V-1){
        int u, v, w; cin >> u >> v >> w;
        --u; --v;
        G[u].PB(edge(v, w)); G[v].PB(edge(u, w));
    }
    dijkstra(0);
    REP(i, V){
        if(d[i] % 2) cout << 1 << "\n";
        else cout << 0 << "\n";
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dijkstra(int)':
a.cc:45:18: error: 'LLINF' was not declared in this scope; did you mean 'LINF'?
   45 |     fill(ALL(d), LLINF);
      |                  ^~~~~
      |                  LINF
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;
		

}

ll N;

struct Edge{
ll to;
  ll cost;
};

vector<Edge>G[101000];

ll ans[101000];

bool visited[101000];

void dfs(ll 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]){
    dfs(p.to,p.cost+cost);
  }
}


int main(){
  
  
  cin>>N;
  
  vector<ll>a(N);
  vector<ll>b(N);
  vector<ll>c(N);
  
  rep(i,N){
cin>>a[i]>>b[i]>>c[i];
    G[a[i]-1].push_back(Edge(b[i]-1,c[i]));
    G[b[i]-1].push_back(Edge(a[i]-1,c[i]));
    
  }
  
  dfs(0,0);
  
  rep(i,N){
cout<<ans[i]<<endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:90:41: error: no matching function for call to 'Edge::Edge(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   90 |     G[a[i]-1].push_back(Edge(b[i]-1,c[i]));
      |                                         ^
a.cc:49:8: note: candidate: 'Edge::Edge()'
   49 | struct Edge{
      |        ^~~~
a.cc:49:8: note:   candidate expects 0 arguments, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(const Edge&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(Edge&&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
a.cc:91:41: error: no matching function for call to 'Edge::Edge(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   91 |     G[b[i]-1].push_back(Edge(a[i]-1,c[i]));
      |                                         ^
a.cc:49:8: note: candidate: 'Edge::Edge()'
   49 | struct Edge{
      |        ^~~~
a.cc:49:8: note:   candidate expects 0 arguments, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(const Edge&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(Edge&&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
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;
		

}

ll N;

struct Edge{
ll to,
  ll cost;
  Edge(ll to,ll cost):to(to),cost(cost){};
  
};

vector<Edge>G[101000];

ll ans[101000];

bool visited[101000];

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

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

  for(auto p:G[s]){
    dfs(p.to,p.cost+cost);
  }
}


int main(){
  
  
  cin>>N;
  
  vector<ll>a(N);
  vector<ll>b(N);
  vector<ll>c(N);
  
  rep(i,N){
cin>>a[i]>>b[i]>>c[i];
    G[a[i]-1].push_back(Edge(b[i]-1.c[i]));
    G[b[i]-1].push_back(Edge(a[i]-1,c[i]));
    
  }
  
  dfs(0,0);
  
  rep(i,N){
cout<<ans[i]<<endl;
  }
}



Compiler output:
a.cc:51:3: error: expected ';' at end of member declaration
   51 |   ll cost;
      |   ^~
      |     ;
a.cc:51:3: error: declaration of 'll Edge::ll' changes meaning of 'll' [-Wchanges-meaning]
a.cc:50:1: note: used here to mean 'typedef long long int ll'
   50 | ll to,
      | ^~
a.cc:3:19: note: declared here
    3 | typedef long long ll;
      |                   ^~
a.cc:51:6: error: 'cost' does not name a type; did you mean 'const'?
   51 |   ll cost;
      |      ^~~~
      |      const
a.cc:52:10: error: expected ')' before 'to'
   52 |   Edge(ll to,ll cost):to(to),cost(cost){};
      |       ~  ^~~
      |          )
a.cc: In function 'void dfs(ll, ll)':
a.cc:69:1: error: 'a' was not declared in this scope
   69 | a[s]=0;
      | ^
a.cc:72:1: error: 'a' was not declared in this scope
   72 | a[s]=1;
      | ^
a.cc:76:16: error: 'struct Edge' has no member named 'cost'
   76 |     dfs(p.to,p.cost+cost);
      |                ^~~~
a.cc: In function 'int main()':
a.cc:92:35: error: unable to find numeric literal operator 'operator""c'
   92 |     G[a[i]-1].push_back(Edge(b[i]-1.c[i]));
      |                                   ^~~
a.cc:93:41: error: no matching function for call to 'Edge::Edge(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   93 |     G[b[i]-1].push_back(Edge(a[i]-1,c[i]));
      |                                         ^
a.cc:49:8: note: candidate: 'Edge::Edge()'
   49 | struct Edge{
      |        ^~~~
a.cc:49:8: note:   candidate expects 0 arguments, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(const Edge&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
a.cc:49:8: note: candidate: 'constexpr Edge::Edge(Edge&&)'
a.cc:49:8: note:   candidate expects 1 argument, 2 provided
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

struct edge{
  int to, w;
};

using graph = vector<vector<edge>>;

int main() {
  int n; cin >> n;
  graph g(n);

  REP(i, n-1){
    int u, v, w; cin >> u >> v >> w;
    --u; --v;

    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }

  vector<int> dis(n, -1);
  function<void(int, int)> dfs = [&](int u, int d){
    dis[u] = d;

    for(auto e : g[u]){
      if(dis[e.to] == -1) dfs(e.to, d + e.w);
    }

  };

  dfs(0, 0);

  for(int x : d) cout << x % 2 << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:15: error: 'd' was not declared in this scope
   47 |   for(int x : d) cout << x % 2 << endl;
      |               ^
Language: C++

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

struct edge{
  int to, w;
};

using graph = vector<vector<edge>>;

int main() {
  int n; cin >> n;
  graph g(n);

  REP(i, n-1){
    int u, v, w; cin >> u >> v >> w;
    --u; --v;

    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }

  vector<int> d(n, -1);
  function<void(int, int)> dfs = [&](int u, int d){
    d[u] = d;

    for(auto e : g[u]){
      if(d[e.to] == -1) dfs(e.to, d + e.w);
    }

  };

  dfs(0, 0);

  for(int x : d) cout << x % 2 << endl;

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:37:6: error: invalid types 'int[int]' for array subscript
   37 |     d[u] = d;
      |      ^
a.cc:40:11: error: invalid types 'int[int]' for array subscript
   40 |       if(d[e.to] == -1) dfs(e.to, d + e.w);
      |           ^
Language: Java

import java.util.*;

public class Main {
    static int[] colors;
    static ArrayList<Path>[] graph;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		graph = new ArrayList[n + 1];
		for (int i = 1; i <= n; i++) {
		    graph[i] = new ArrayList<Path>();
		}
		for (int i = 0; i < n - 1; i++) {
		    int a = sc.nextInt();
		    int b = sc.nextInt();
		    int length = sc.nextInt();
		    graph[a].add(new Path(b, length));
		    graph[b].add(new Path(a, length));
		}
		colors = new int[n + 1];
		Arrays.fill(colors, -1);
		search(1, 0);
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= n; i++) {
		    System.out.print(color[i]);
		}
		
	}
	
	static void search(int idx, int color) {
	    if (colors[idx] != -1) {
	        return;
	    }
	    colors[idx] = color;
	    for (Path x : graph[idx]) {
	        int next;
	        if (x.length % 2 == 0) {
	            next = color;
	        } else {
	            next = (1 + color) % 2;
	        }
	        search(x.to, next);
	    }
	}
	
	static class Path {
	    int to;
	    int length;
	    
	    public Path (int to, int length) {
	        this.to = to;
	        this.length = length;
	    }
	}
}


Compiler output:
Main.java:25: error: cannot find symbol
		    System.out.print(color[i]);
		                     ^
  symbol:   variable color
  location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
using Graph = vector<vector<P>>;

int main(){
  int n;
  cin >> n;
  Graph G(n);
  rep(i,n-1) {
    int u, v, c;
    cin >> u >> v >> c;
    u--; v--;
    G[u].push_back({v,c});
    G[v].push_back({u,c});
  }  
  vector<int> color(n);

  void dfs = [&](int u, int p, int c) {
    color[u] = c;
    for (auto v : G[u]) {
      if (v.first == p) continue;
      dfs(v.first, u, (v.second %2 == 0 ? c : 1-c));
    }
  }
  dfs(0,-1,1);
  for (auto ans : color) cout << ans << endl;
  return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: variable or field 'dfs' declared void
   22 |   void dfs = [&](int u, int p, int c) {
      |        ^~~
a.cc: In lambda function:
a.cc:26:7: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   26 |       dfs(v.first, u, (v.second %2 == 0 ? c : 1-c));
      |       ^~~
      |       ffs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
using Graph = vector<vector<P>>;

int main(){
  int n;
  cin >> n;
  Graph G(n);
  rep(i,n-1) {
    int u, v, c;
    cin >> u >> v >> c;
    u--; v--;
    G[u].push_back({v,c});
    G[v].push_back({u,c});
  }  
  vector<int> color(n);

  auto dfs = [&](int u, int p, int c) {
    color[u] = c;
    for (auto v : G[u]) {
      if (v.first == p) continue;
      dfs(v.first, u, (v.second %2 == 0 ? c : 1-c));
    }
  }
  dfs(0,-1,1);
  for (auto ans : color) cout << ans << endl;
  return 0;
} 

Compiler output:
a.cc: In lambda function:
a.cc:26:7: error: use of 'dfs' before deduction of 'auto'
   26 |       dfs(v.first, u, (v.second %2 == 0 ? c : 1-c));
      |       ^~~
a.cc: In function 'int main()':
a.cc:29:3: error: expected ',' or ';' before 'dfs'
   29 |   dfs(0,-1,1);
      |   ^~~
Language: C++

// https://atcoder.jp/contests/abc126/tasks/abc126_d

#include "algorithm"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N;
  cin >> N;

  // f: node, s: length
  V<VPL> edges(N, VPL());
  rep(i, N - 1) {
    ll u, v, w;
    cin >> u >> v >> w;
    --u, --v;
    edges[u].emplace_back(v, w);
    edges[v].emplace_back(u, w);
  }

  VL colors(N, -1);

  std::function<void(ll)> rec;
  rec = [&](ll u) {
    ll c = colors[u];

    for (auto edge : edges[u]) {
      ll v = edge.first;
      ll l = edge.second;
      if (colors[v] != -1) continue;

      colors[v] = l % 2 == 0 ? c : 1 - c;
      rec(v);
    }
  };

  colors[0] = 1;
  rec(0);

  rep(i, N) { cout << colors[i] << endl; }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:44:8: error: 'function' is not a member of 'std'
   44 |   std::function<void(ll)> rec;
      |        ^~~~~~~~
a.cc:7:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    6 | #include "set"
  +++ |+#include <functional>
    7 | #include "vector"
a.cc:44:17: error: expected primary-expression before 'void'
   44 |   std::function<void(ll)> rec;
      |                 ^~~~
a.cc:45:3: error: 'rec' was not declared in this scope; did you mean 'rep'?
   45 |   rec = [&](ll u) {
      |   ^~~
      |   rep
Language: C++

// https://atcoder.jp/contests/abc126/tasks/abc126_d

#include "algorithm"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N;
  cin >> N;

  // f: node, s: length
  V<VPL> edges(N, VPL());
  rep(i, N - 1) {
    ll u, v, w;
    cin >> u >> v >> w;
    --u, --v;
    edges[u].emplace_back(v, w);
    edges[v].emplace_back(u, w);
  }

  VL colors(N, -1);

  function<void(ll)> rec;
  rec = [&](ll u) {
    ll c = colors[u];

    for (auto edge : edges[u]) {
      ll v = edge.first;
      ll l = edge.second;
      if (colors[v] != -1) continue;

      colors[v] = l % 2 == 0 ? c : 1 - c;
      rec(v);
    }
  };

  colors[0] = 1;
  rec(0);

  rep(i, N) { cout << colors[i] << endl; }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:44:3: error: 'function' was not declared in this scope
   44 |   function<void(ll)> rec;
      |   ^~~~~~~~
a.cc:7:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    6 | #include "set"
  +++ |+#include <functional>
    7 | #include "vector"
a.cc:44:12: error: expected primary-expression before 'void'
   44 |   function<void(ll)> rec;
      |            ^~~~
a.cc:45:3: error: 'rec' was not declared in this scope; did you mean 'rep'?
   45 |   rec = [&](ll u) {
      |   ^~~
      |   rep
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define ll long long
#define rep(i,l,r) for(long long i = l; i < r; i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define V_MAX 1e5 + 1
vector<map<ll, pair<ll, ll>>> G[V_MAX];
vector<ll> color(V_MAX,0);

bool is_bipartite(ll v, ll c){
    color[v] = c;
    rep(i, 0, G[v].size()){
        if(color[G[v][i].fi] == c) return false;
        if(color[G[v][i].se] == 0 && !is_bipartite(G[v][i].fi, -c)) return false;
    }
    return true;
}

int main(){
    ll n; cin >> n;
    
    rep(i,0,n){
        ll u, v, w;
        cin >> u >> v >> w;
        G[u].pb(mp(v,w));
        G[v].pb(mp(u,w));
    }

    if(is_bipartite(0, 1)){
        rep(i,0,n) cout << color[i] << endl;
    }else{
        cout << "-1" << endl;
    }

}

Compiler output:
a.cc:12:8: error: 'map' was not declared in this scope
   12 | vector<map<ll, pair<ll, ll>>> G[V_MAX];
      |        ^~~
a.cc:3:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    2 | #include<vector>
  +++ |+#include <map>
    3 | using namespace std;
a.cc:12:27: error: template argument 1 is invalid
   12 | vector<map<ll, pair<ll, ll>>> G[V_MAX];
      |                           ^~
a.cc:12:27: error: template argument 2 is invalid
a.cc:12:29: error: expected unqualified-id before '>' token
   12 | vector<map<ll, pair<ll, ll>>> G[V_MAX];
      |                             ^
a.cc: In function 'bool is_bipartite(long long int, long long int)':
a.cc:17:15: error: 'G' was not declared in this scope
   17 |     rep(i, 0, G[v].size()){
      |               ^
a.cc:5:45: note: in definition of macro 'rep'
    5 | #define rep(i,l,r) for(long long i = l; i < r; i++)
      |                                             ^
a.cc: In function 'int main()':
a.cc:30:9: error: 'G' was not declared in this scope
   30 |         G[u].pb(mp(v,w));
      |         ^
Language: Java


import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class EvenRelation {
static HashMap<Integer,Integer> set=new HashMap<>();
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		HashMap<Integer, ArrayList<Integer>> hmap = new HashMap<>();
		HashMap<Integer, ArrayList<Integer>> weights = new HashMap<>();

		for (int i = 0; i < n-1; i++) {
			int u = scn.nextInt();
			int v = scn.nextInt();
			int w = scn.nextInt();
			if (hmap.containsKey(u)) {
				ArrayList<Integer> al=hmap.get(u);
				ArrayList<Integer> w1=weights.get(u);	
				w1.add(w);
				weights.put(u, w1);
				al.add(v);
				hmap.put(u,al);
			} else {
				ArrayList<Integer> al=new ArrayList<>();
				al.add(v);
				ArrayList<Integer> w1=new ArrayList<>();	
				w1.add(w);
				weights.put(u, w1);
				hmap.put(u,al);
			}
			if (hmap.containsKey(v)) {
				ArrayList<Integer> al=hmap.get(v);
				al.add(u);
				ArrayList<Integer> w1=weights.get(v);	
				w1.add(w);
				weights.put(v, w1);
				hmap.put(v,al);
			} else {
				ArrayList<Integer> al=new ArrayList<>();
				al.add(u);
				ArrayList<Integer> w1=new ArrayList<>();	
				w1.add(w);
				weights.put(v, w1);
				hmap.put(v,al);
			}
		}
		HashSet<Integer> visited =new HashSet<>();
		for(int i=1;i<=n;i++) {
			if(!visited.contains(i)) {
				solve(hmap,weights,visited,i,0);
			}
		}
		for(int x=1;x<=n;x++) {
			System.out.println(set.get(x));
		}
	}
	
	public static void solve(HashMap<Integer, ArrayList<Integer>> hmap,HashMap<Integer, ArrayList<Integer>> weights, HashSet<Integer> visited, int ele, int color) {
		visited.add(ele);
		set.put(ele, color);
		//System.out.println(color+" "+ele);
		ArrayList<Integer> a=hmap.get(ele);
		ArrayList<Integer> w=weights.get(ele);
		for(int i=0;a!=null &&i<a.size();i++) {
			if(!visited.contains(a.get(i))) {
				if(w.get(i)%2==0)
					solve(hmap,weights,visited,a.get(i),color);
				else
					solve(hmap,weights,visited,a.get(i),color==1?0:1);
				
				//System.out.println("ret "+ele);
			}
		}
	}

}


Compiler output:
Main.java:7: error: class EvenRelation is public, should be declared in a file named EvenRelation.java
public class EvenRelation {
       ^
1 error
Language: C++

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

int main()
{
  int N; cin >> N;
  vector<vector<int>> UVW(N - 1, vector<int>(3));
  for (int i = 0; i < N - 1; i++)
  {
    int u, v, w;
    cin >> u >> v >> w;
    UVW[i][0] = u;
    UVW[i][1] = v;
    UVW[i][2] = w;
  }
  sort(UVW.begin(), UVW.end(), [](vector<int> &x, vector<int> &y){
    if (x[0] != y[0]) return x[0] < y[0];
    else if (x[1] != y[1]) return x[1] < y[1];
  });
  
  int cr_color = 0
  int color[100005];
  for (int j = 1; j <= N; j++)
    color[j] = -1;
  
  for (vector<int> uvw : UVW)
  {
    int ui = uvw[0], vi = uvw[1], wi = uvw[2];
    if (color[ui] == -1 && color[vi] == -1 && wi % 2 == 0)
    {
      color[ui] = cr_color;
      color[vi] = cr_color;
      cr_color ++;
    }
    else if (color[ui] == -1 && color[vi] == -1 && wi % 2 == 1)
    {
      color[ui] = cr_color;
      color[vi] = cr_color;
    }
    else if (color[ui] != -1 && color[vi] == -1 && wi % 2 == 0)
    {
      color[vi] = color[ui];
    }
    else if (color[ui] != -1 && color[vi] == -1 && wi % 2 == 1)
    {
      color[vi] = (color[ui] + 1) % 2; // 1だったら0を、0だったら1を出力
    }
    else if (color[ui] == -1 && color[vi] != -1 && wi % 2 == 0)
    {
      color[ui] = color[vi];
    }
    else if (color[ui] == -1 && color[vi] != -1 && wi % 2 == 1)
    {
      color[ui] = (color[vi] + 1) % 2; // 1だったら0を、0だったら1を出力
    }
    else if (color[ui] != -1 && color[vi] != -1 && wi % 2 == 0)
    {
      if 
      
  }
  
  for (int j = 1; j <= N; j++)
    cout << color[j] << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:3: error: expected ',' or ';' before 'int'
   25 |   int color[100005];
      |   ^~~
a.cc:27:5: error: 'color' was not declared in this scope; did you mean 'cr_color'?
   27 |     color[j] = -1;
      |     ^~~~~
      |     cr_color
a.cc:32:9: error: 'color' was not declared in this scope; did you mean 'cr_color'?
   32 |     if (color[ui] == -1 && color[vi] == -1 && wi % 2 == 0)
      |         ^~~~~
      |         cr_color
a.cc:63:3: error: expected '(' before '}' token
   63 |   }
      |   ^
      |   (
a.cc:66:13: error: 'color' was not declared in this scope; did you mean 'cr_color'?
   66 |     cout << color[j] << endl;
      |             ^~~~~
      |             cr_color
a.cc:69:2: error: expected '}' at end of input
   69 | }
      |  ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
a.cc: In lambda function:
a.cc:22:3: warning: control reaches end of non-void function [-Wreturn-type]
   22 |   });
      |   ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}

long long com(long long n,long long k){
	
}
long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}
class G{
	long long node;
	long long w;
	
};
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin>>N;
	vector<pair<int,int>>G[N+1];
	for(int i=0;i<N-1;i++){
		int a,b,w;
		cin>>a>>b>>w;
		G[a].push_back(make_pair(b,w));
		G[b].push_back(make_pair(a,w));
	}
	vector<long long>dp(N+1,INF);
	stack<int>que;
	que.push(1);
	dp[1]=0;
	while(!que.empty()){
		int u=que.top();
		que.pop();
		int s=G[u].size();
		for(int i=0;i<s;i++){
			int k=G[u][i].firs thert;
			if(dp[k]!=INF){
				continue;
			}
			dp[k]=dp[u]+G[u][i].second;
			que.push(k);
		}
	}
	for(int i=1;i<=N;i++){
		cout<<dp[i];
	}
}


Compiler output:
a.cc: In function 'long long int com(long long int, long long int)':
a.cc:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^
a.cc: In function 'int main()':
a.cc:69:39: 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 'firs'; did you mean 'first'?
   69 |                         int k=G[u][i].firs thert;
      |                                       ^~~~
      |                                       first
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
#include <list>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

const int N = 100010;
const int MOD = 1e9+7;
int M[N][N];
vector<int> v(N);

void dp(int n, int k, int cnt){
    if(k==n) return;
    for(int i=k+1;i<=n;i++){
        if(M[k][i]==0){
            v[i] = 1;
            dp(n, i, cnt);
        }
        else if(M[k][i]==1 && cnt==0){cnt^=1; v[i] = 0;}
        else if(M[k][i]==1 && cnt==1){cnt^=1; v[i] = 1;}
    }
    dp(n, ++k, cnt);
}

int main(){
    int n;cin>>n;
    rep(i,n){
        rep(j,n){M[i][j]=-1;}
    }
    rep(i,n-1){
        int u,v,w;
        cin>>u>>v>>w;
        M[u][v] = w%2;
        M[v][u] = w%2;
    }
    v[1]=1;
    dp(n, 1, 0);
    rep(i,n) {cout << v[i+1] << endl;}
}


Compiler output:
/tmp/cclfDAEP.o: in function `dp(int, int, int)':
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
a.cc:(.text+0xcb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
a.cc:(.text+0x120): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
/tmp/cclfDAEP.o: in function `main':
a.cc:(.text+0x2a9): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
a.cc:(.text+0x2e6): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
/tmp/cclfDAEP.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x34c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
a.cc:(.text+0x372): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cclfDAEP.o
collect2: error: ld returned 1 exit status
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
#include <list>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

const int N = 100010;
const int MOD = 1e9+7;
ll M[N][N];
vector<ll> v(N);

void dp(int n, int k){
    if(k==n) return;
    for(int i=k+1;i<=n;i++){
        if(M[k][i]>0 && M[k][i] % 2 == 0){
            v[i] = 1;
            dp(n, i);
        }
        else v[i] = 0;
    }
    dp(n, ++k);
}

int main(){
    ll n;cin>>n;
    rep(i,n-1){
        ll u,v,w;
        cin>>u>>v>>w;
        M[u][v] = w;
        M[v][u] = w;
    }
    v[1]=1;
//    dp(n, 1);
    rep(i,n) {cout << v[i+1] << endl;}
}


Compiler output:
/tmp/ccmR7AXw.o: in function `dp(int, int)':
a.cc:(.text+0x90): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
a.cc:(.text+0xbf): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
/tmp/ccmR7AXw.o: in function `main':
a.cc:(.text+0x1d3): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
a.cc:(.text+0x1fd): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
/tmp/ccmR7AXw.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x26c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
a.cc:(.text+0x292): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccmR7AXw.o
collect2: error: ld returned 1 exit status
Language: C++

// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
#include <list>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

const int N = 100010;
const int MOD = 1e9+7;
ll M[N][N];
vector<ll> v(N);

void dp(int n, int k){
    if(k==n) return;
    for(int i=k+1;i<=n;i++){
        if(M[k][i]>0 && M[k][i] % 2 == 0){
            v[i] = 1;
            dp(n, i);
        }
        else v[i] = 0;
    }
    dp(n, ++k);
}

int main(){
    ll n;cin>>n;
    rep(i,n-1){
        ll u,v,w;
        cin>>u>>v>>w;
        M[u][v] = w;
        M[v][u] = w;
    }
    v[1]=1;
    dp(n, 1);
    rep(i,n) {cout << v[i+1] << endl;}
}


Compiler output:
/tmp/ccAEfFj0.o: in function `dp(int, int)':
a.cc:(.text+0x90): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
a.cc:(.text+0xbf): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
/tmp/ccAEfFj0.o: in function `main':
a.cc:(.text+0x1d3): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
a.cc:(.text+0x20d): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
/tmp/ccAEfFj0.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x27c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
a.cc:(.text+0x2a2): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccAEfFj0.o
collect2: error: ld returned 1 exit status
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class main {

    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int N = std.nextInt();

        List<List<Integer>> to = new ArrayList<>(N);
        List<List<Integer>> cost = new ArrayList<>(N);
        for (int i = 0; i < N; i++) {
            to.add(new ArrayList<>());
            cost.add(new ArrayList<>());
        }

        for (int i = 0; i < N - 1; i++) {
            int a = std.nextInt();
            int b = std.nextInt();
            int w = std.nextInt();
            a--;
            b--;

            to.get(a).add(b);
            cost.get(a).add(w);
        }

        int[] ans = new int[N];
        Deque<Integer> deque = new ArrayDeque<>();
        Arrays.fill(ans, - 1);
        ans[0] = 0;
        deque.add(0);
        while (!deque.isEmpty()) {
            int v = deque.pollFirst();
            for (int i = 0; i < to.get(v).size(); i++) {
                int u = to.get(v).get(i);
                int w = cost.get(v).get(i);
                if (ans[u] != -1) {
                    continue;
                }

                ans[u] = (ans[v] + w) % 2;
                deque.add(u);
            }
        }

        Arrays.stream(ans).map(Math::abs).forEach(System.out::println);
    }
}


Compiler output:
Main.java:8: error: class main is public, should be declared in a file named main.java
public class main {
       ^
1 error
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 main(){
  int n;cin>>n;
  vi c(n,-1);
  vector<vector<P>> v(n);
  rep(i,n){
    int a,b,x;cin>>a>>b>>x;
    x%=2;
    v[a-1].emplace_back(b-1,x);
    v[b-1].emplace_back(a-1,x);
  }
  queue<int> q;
  while(!q.empty()){
    int i=q.front();
    q.pop();
    for(auto j:v){
      c[j.first]=c[i]+j.second;
      q.push(j.first);
    }
  }
  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: In function 'int main()':
a.cc:29:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   29 |       c[j.first]=c[i]+j.second;
      |           ^~~~~
a.cc:29:25: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   29 |       c[j.first]=c[i]+j.second;
      |                         ^~~~~~
a.cc:30:16: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   30 |       q.push(j.first);
      |                ^~~~~
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 main(){
  int n;cin>>n;
  vi c(n,-1);
  vector<vector<P>> v(n);
  rep(i,n){
    int a,b,x;cin>>a>>b>>x;
    x%=2;
    v[a-1].emplace_back(b-1,x);
    v[b-1].emplace_back(a-1,x);
  }
  queue<int> q;
  while(!q.empty()){
    int i=q.top();
    q.pop();
    for(auto j:v){
      c[j.first]=c[i]+j.second;
      q.push(j.first);
    }
  }
  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: In function 'int main()':
a.cc:26:13: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   26 |     int i=q.top();
      |             ^~~
      |             pop
a.cc:29:11: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   29 |       c[j.first]=c[i]+j.second;
      |           ^~~~~
a.cc:29:25: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'second'
   29 |       c[j.first]=c[i]+j.second;
      |                         ^~~~~~
a.cc:30:16: error: 'class std::vector<std::pair<long long int, long long int> >' has no member named 'first'
   30 |       q.push(j.first);
      |                ^~~~~