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

def main():
    import sys
    input = sys.stdin.buffer.readline
    sys.setrecursionlimit(1000000)
    N = int(input())
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b, c = (int(i) for i in input().split())
        edge[a-1].append((c, b-1))
        edge[b-1].append((c, a-1))

    dist = [-1]*N
    color = [-1]*N

    def dfs(v, G):
        todo = []
        dist[v] = 0
        color[v] = 0
        todo.append(v)
        while todo:
            u = todo[-1]
            for c, next_v in G[u]:
                if dist[next_v] != -1:
                    continue
                dist[next_v] = dist[u] + c
                if dist[next_v] % 2 == 1:
                    color[next_v] = 1
                else:
                    color[next_v] = 0
                todo.append(next_v)
                break
            else:
                todo.pop()

    dfs(0, edge)
    print(*color, sep="\n")
    # print("\n", *dist, sep="\n")


if __name__ == '__main__':
    main()


Compiler output:
a.cc:37:7: error: invalid preprocessing directive #print
   37 |     # print("\n", *dist, sep="\n")
      |       ^~~~~
a.cc:40:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   40 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vector<pii> A(N);
  rep(i,1,N){
    int X,Y,Z; cin>>X>>Y>>Z;
    A[X-1].pb(mp(Y-1,Z));
    A[Y-1].pb(mp(X-1,Z));
  }
  queue<pii> Q;
  vector<bool> F(N,1);
  F[0]=0;
  vi ans(N);
  Q.push(mp(0,0));
  while(Q.size()>0){
    int X=Q.front().first,Y=Q.front().second;
    Q.pop();
    rep(i,0,A[X].size()){
      int Z=Y+A[X][i].second,P=A[X][i].first;
      if(F[P]){
        Q.push(mp(P,Z));
        ans[P]=Z%2;
        F[P]=0;
      }
    }
  }
  rep(i,0,N) cout<<ans[i]<<endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   16 | #define pb push_back
      |            ^~~~~~~~~
a.cc:24:12: note: in expansion of macro 'pb'
   24 |     A[X-1].pb(mp(Y-1,Z));
      |            ^~
a.cc:16:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'push_back'
   16 | #define pb push_back
      |            ^~~~~~~~~
a.cc:25:12: note: in expansion of macro 'pb'
   25 |     A[Y-1].pb(mp(X-1,Z));
      |            ^~
a.cc:35:18: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'size'
   35 |     rep(i,0,A[X].size()){
      |                  ^~~~
a.cc:3:47: note: in definition of macro 'rep'
    3 | #define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
      |                                               ^
a.cc:36:19: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'long long int')
   36 |       int Z=Y+A[X][i].second,P=A[X][i].first;
      |                   ^
a.cc:37:12: error: 'P' was not declared in this scope
   37 |       if(F[P]){
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int NQ;
int T[100001][100001];

int R[100001];

int sette2(int color, int p, int n){
    for (int i=0;i<n;i++){
        if(T[p][i] > 0 and R[i] == -1){
            if(T[p][i] == 1) R[i] = color;
            else R[i] = color ^ 1;
            sette2(R[i], i, n);
        }
    }
    return 0;
}

int main(void){
    cin >> NQ;
    REP(i,NQ) R[i] = -1;
    R[0] = 0;
    REP(i, NQ-1){
        int u, v, w;
        cin >> u >> v >> w;
        T[u-1][v-1] = w % 2 + 1;
        T[v-1][u-1] = w % 2 + 1;
    }

    sette2(0, 0, NQ);

    REP(i,NQ) cout << R[i] << endl;
    return 0;
}



Compiler output:
/tmp/ccbjZ6fu.o: in function `sette2(int, int, int)':
a.cc:(.text+0x5c): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
a.cc:(.text+0xa8): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
a.cc:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
a.cc:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
/tmp/ccbjZ6fu.o: in function `main':
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccbjZ6fu.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int N;
int T[100001][100001];

int R[100001];

int sette2(int color, int p, int n){
    for (int i=0;i<n;i++){
        if(T[p][i] > 0 and R[i] == -1){
            if(T[p][i] == 1) R[i] = color;
            else R[i] = color ^ 1;
            sette2(R[i], i, n);
        }
    }
    return 0;
}

int main(void){
    cin >> N;
    REP(i,N) R[i] = -1;
    R[0] = 0;
    REP(i, N-1){
        int u, v, w;
        cin >> u >> v >> w;
        T[u-1][v-1] = w % 2 + 1;
        T[v-1][u-1] = w % 2 + 1;
    }

    sette2(0, 0, N);

    REP(i,N) cout << R[i] << endl;
    return 0;
}



Compiler output:
/tmp/ccsv3lRD.o: in function `sette2(int, int, int)':
a.cc:(.text+0x5c): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
a.cc:(.text+0xa8): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
a.cc:(.text+0xcc): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
a.cc:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
/tmp/ccsv3lRD.o: in function `main':
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccsv3lRD.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
 
 ll N;
  cin >>N;
  vector<vector<pl>> vec(N); //隣接リスト
  rep(i,N-1) {
    ll a, b, c;
    cin >>a>>b>>c;
    a--;
    b--;
    vec[a].push_back(mp(b,c));
    vec[b].push_back(mp(a,c));
  }
  
  
  queue<ll> que;
  que.push(0);
  ll dist(N);
  rep(i,N) {
    dist[i]=-1;
  }
  
  dist[0LL]=0;
  
  while(!que.empty()){
        ll v=que.front();
        que.pop();
  for(auto p:vec[v]) {
     if(dist[p.fi]!=-1)continue;
    dist[p.fi]=dist[v]+p.se;
    que.push(p.fi);
  }
    
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   42 |     dist[i]=-1;
      |         ^
a.cc:45:7: error: invalid types 'll {aka long long int}[long long int]' for array subscript
   45 |   dist[0LL]=0;
      |       ^
a.cc:51:13: error: invalid types 'll {aka long long int}[long long int]' for array subscript
   51 |      if(dist[p.fi]!=-1)continue;
      |             ^
a.cc:52:9: error: invalid types 'll {aka long long int}[long long int]' for array subscript
   52 |     dist[p.fi]=dist[v]+p.se;
      |         ^
a.cc:52:20: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   52 |     dist[p.fi]=dist[v]+p.se;
      |                    ^
a.cc:59:16: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   59 |         if(dist[i]%2==0)cout << 0 <<endl;
      |                ^
Language: C++

#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
 
 ll N;
  cin >>N;
  vector<vector<pl>> vec(N); //隣接リスト
  rep(i,N-1) {
    ll a, b, c;
    cin >>a>>b>>c;
    a--;
    b--;
    vec[a].push_back(mp(b,c));
    vec[b].push_back(mp(a,c));
  }
  
  
  queue<ll> que;
  que.push(0);
  ll dist(N,-1);
  
  dist[0]=0;
  
  while(!que.empty()){
        ll v=que.front();
        que.pop();
  fpr(auto p:vec[v]) {
     if(dist[p.fi]!=-1)continue;
    dist[p.fi]=dist[v]+p.se;
    que.push(p.fi);
  }
    
  }

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


Compiler output:
a.cc: In function 'int main()':
a.cc:40:15: error: expression list treated as compound expression in initializer [-fpermissive]
   40 |   ll dist(N,-1);
      |               ^
a.cc:42:7: error: invalid types 'll {aka long long int}[int]' for array subscript
   42 |   dist[0]=0;
      |       ^
a.cc:47:7: error: expected primary-expression before 'auto'
   47 |   fpr(auto p:vec[v]) {
      |       ^~~~
a.cc:47:3: error: 'fpr' was not declared in this scope
   47 |   fpr(auto p:vec[v]) {
      |   ^~~
a.cc:55:8: error: 'n' was not declared in this scope
   55 |  rep(i,n){
      |        ^
a.cc:4:31: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(ll i=0;i<n;i++)
      |                               ^
a.cc:56:16: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   56 |         if(dist[i]%2==0)cout << 0 <<endl;
      |                ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int N;
int T[100001][100001];

int R[100001];

int sette2(int color, int p){
    for (int i=0;i<N;i++){
        if(T[p][i] > 0 and R[i] == -1){
            if(T[p][i] == 1) R[i] = color;
            else R[i] = color ^ 1;
            sette2(R[i], i);
        }
    }
    return 0;
}

int main(void){
    cin >> N;
    REP(i,N) R[i] = -1;
    R[0] = 0;
    REP(i, N-1){
        int u, v, w;
        cin >> u >> v >> w;
        T[u-1][v-1] = w % 2 + 1;
        T[v-1][u-1] = w % 2 + 1;
    }

    sette2(0, 0);

    REP(i,N) cout << R[i] << endl;
    return 0;
}



Compiler output:
/tmp/ccKM4fmQ.o: in function `sette2(int, int)':
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
a.cc:(.text+0xa5): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
a.cc:(.text+0xe0): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
/tmp/ccKM4fmQ.o: in function `main':
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
a.cc:(.text+0x277): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccKM4fmQ.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int N;
int T[100001][100001];

int R[100001];

int setter(int color, int p){
    for (int i=0;i<N;i++){
        if(T[p][i] > 0 and R[i] == -1){
            cout << i << " " << p << " " << T[p][i] << endl;
            if(T[p][i] == 1) R[i] = color;
            else R[i] = color ^ 1;
            setter(R[i], i);
        }
    }
    return 0;
}

int main(void){
    cin >> N;
    REP(i,N) R[i] = -1;
    R[0] = 0;
    REP(i, N-1){
        int u, v, w;
        cin >> u >> v >> w;
        T[u-1][v-1] = w % 2 + 1;
        T[v-1][u-1] = w % 2 + 1;
    }

    setter(0, 0);

    REP(i,N) cout << R[i] << endl;
    return 0;
}



Compiler output:
/tmp/ccqVl85P.o: in function `setter(int, int)':
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
a.cc:(.text+0x139): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
/tmp/ccqVl85P.o: in function `main':
a.cc:(.text+0x1db): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
a.cc:(.text+0x1f7): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
a.cc:(.text+0x30b): relocation truncated to fit: R_X86_64_PC32 against symbol `R' defined in .bss section in /tmp/ccqVl85P.o
collect2: error: ld returned 1 exit status
Language: C++

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] color = new int[n];
		Arrays.fill(color, -1);
		List<Edge> e = new ArrayList<>();
		List<List<Edge>> graph = new ArrayList<>(Collections.nCopies(n, e));
		int dist_from_0 = 0;

		for(int i = 0; i < n - 1; i++) {
			int u = sc.nextInt() - 1;
			int v = sc.nextInt() - 1;
			int w = sc.nextInt();
			graph.get(u).add(new Edge(v, w));
			graph.get(v).add(new Edge(u, w));
		}

		color[0] = 0;
		dfs(graph, color, dist_from_0, 0);
		for(int value : color) {
			System.out.println(value);
		}
		sc.close();
	}

	static class Edge{
		int to;
		int dist;
		public Edge(int to, int dist) {
			this.to = to;
			this.dist = dist;
		}
	}

	static void dfs(List<List<Edge>> graph, int[] color, int dist_from_0, int start) {
		for(Edge next : graph.get(start)) {
			if(color[next.to] != -1) continue;
			dist_from_0 += next.dist;
			if(dist_from_0 % 2 == 0) color[next.to] = 0;
			else color[next.to] = 1;
			dfs(graph, color, dist_from_0, next.to);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Arrays;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Collections;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.List;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Scanner;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Edge{
		int to;
		int dist;
		public Edge(int to, int dist) {
			this.to = to;
			this.dist = dist;
		}
	}

	static void dfs(List<List<Edge>> graph, int[] color, int dist_from_0, int start) {
		for(Edge next : graph.get(start)) {
			if(color[next.to] != -1) continue;
			dist_from_0 += next.dist;
			if(dist_from_0 % 2 == 0) color[next.to] = 0;
			else color[next.to] = 1;
			dfs(graph, color, dist_from_0, next.to);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] color = new int[n];
		Arrays.fill(color, -1);
		List<Edge> e = new ArrayList<>();
		List<List<Edge>> graph = new ArrayList<>(Collections.nCopies(n, e));
		int dist_from_0 = 0;

		for(int i = 0; i < n - 1; i++) {
			int u = sc.nextInt() - 1;
			int v = sc.nextInt() - 1;
			int w = sc.nextInt();
			graph.get(u).add(new Edge(v, w));
			graph.get(v).add(new Edge(u, w));
		}

		color[0] = 0;
		dfs(graph, color, dist_from_0, 0);
		for(int value : color) {
			System.out.println(value);
		}
		sc.close();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Arrays;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Collections;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.List;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Scanner;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  vector<tuple<int,int,int>> data(n);
  rep(i,n) cin >> data[i][0] >> data[i][1] >> data[i][2];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} and 'int')
   13 |   rep(i,n) cin >> data[i][0] >> data[i][1] >> data[i][2];
      |                          ^
a.cc:13:40: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} and 'int')
   13 |   rep(i,n) cin >> data[i][0] >> data[i][1] >> data[i][2];
      |                                        ^
a.cc:13:54: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int, int> >, std::tuple<int, int, int> >::value_type' {aka 'std::tuple<int, int, int>'} and 'int')
   13 |   rep(i,n) cin >> data[i][0] >> data[i][1] >> data[i][2];
      |                                                      ^
Language: C++

#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

int main() {
  ll N;
  cin >> N;

  int ans[N];
  vector<P> aLst[N];

  queue<ll> que;
  for (int i = 0; i < N; ++i) {
    ll u, v, w;
    cin >> u >> v >> w;
    u--;
    v--;
    aLst[u].emplace_back(v, w);
    aLst[v].emplace_back(u, w);
  }

  unordered_map<ll, bool> visited;

  que.push(0);
  ans[0] = 0;
  while (!que.empty()) {
    ll cur = que.front();
    que.pop();
    // cout << "cur=" << cur << endl;
    for (size_t i = 0; i < aLst[cur].size(); ++i) {
      ll cur_child = aLst[cur][i].fs;
      if (visited.count(cur_child) == 0) {
        que.push(cur_child);
        visited[cur_child] = true;
        if (aLst[cur][i].sc % 2 == 0) {
          ans[cur_child] = ans[cur];
        } else {
          ans[cur_child] = 1 - ans[cur];
        }
      }
    }
  }

  for (int i = 0; i < N; ++i) {
    cout << ans[i] << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:35: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'fs'
   73 |       ll cur_child = aLst[cur][i].fs;
      |                                   ^~
a.cc:77:26: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'struct std::pair<long long int, long long int>'} has no member named 'sc'
   77 |         if (aLst[cur][i].sc % 2 == 0) {
      |                          ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;cin>>n;
    vector<vector<pair<int,int>>> tree(n);
    for(int i=0;i<n-1;i++){
        int u,v,w;
        cin>>u>>v>>w;
        u--;
        v--;
        x%=2;
        tree[u].push_back(make_pair(v,w));
        tree[v].push_back(make_pair(u,w));
    }
    vector<int> dist(n,-1);
    dist[0]=0;
    queue<int> que;
    que.push(0);
    while(!que.empty()){
        auto i=que.front();
        que.pop();
        for(auto p:tree[i]){
            if(dist[p.first]>-1) continue;
            dist[p.first]=dist[i]+p.second;
            que.push(p.first);
        }
    }
    for(int i=0;i<n;i++){
        cout<<dist[i]%2<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'x' was not declared in this scope
   11 |         x%=2;
      |         ^
Language: C++

#!/usr/bin/ruby

require 'pp'

N = gets.chomp.to_i

queue = []
table = [nil]*(N)
1.upto(N-1){|e|
   u,v,w = gets.chomp.split(" ").map(&:to_i)
   if table[u] == nil
        table[u] = {color: -1, neibours: [] }
   end

   if table[v] == nil
        table[v] = {color: -1, neibours: [] }
   end

   table[u][:neibours] << [v,w]
   table[v][:neibours] << [u,w]

   if e == 1
      queue << u
      table[u][:color] = 0
   end
}



while !queue.empty? do
    i = queue.shift
    c = table[i][:color]
    table[i][:neibours].each{|node|
       if table[ node[0] ][:color] == -1
          table[ node[0] ][:color] = (node[1]%2 == 0 ? c : c^1)
          queue << node[0]
       end
           }
end


1.upto(N){|n|
  puts table[n][:color]
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/ruby
      |  ^
a.cc:3:9: warning: multi-character character constant [-Wmultichar]
    3 | require 'pp'
      |         ^~~~
a.cc:3:1: error: 'require' does not name a type
    3 | require 'pp'
      | ^~~~~~~
a.cc:30:1: error: expected unqualified-id before 'while'
   30 | while !queue.empty? do
      | ^~~~~
a.cc:39:1: error: 'end' does not name a type
   39 | end
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> a[100005];
int ans[100005];
void dfs(int no,int father){ 
	for (int i=0;i<a[no].size();i++){
		int u=a[no][i].first;
		int w=a[no][i].second%2; 
		if(u!=father){
            ans[u]=ans[no]^w;　
            dfs(u,no);　
        }
  }
}
int main(){
    int n;
	cin>>n;
	for (int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		a[u].push_back({v,c});
		a[v].push_back({u,c});
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++) cout<<ans[i]<<endl;
}

Compiler output:
a.cc:10:30: error: extended character 　 is not valid in an identifier
   10 |             ans[u]=ans[no]^w;　
      |                              ^
a.cc:11:23: error: extended character 　 is not valid in an identifier
   11 |             dfs(u,no);　
      |                       ^
a.cc: In function 'void dfs(int, int)':
a.cc:10:30: error: '\U00003000' was not declared in this scope
   10 |             ans[u]=ans[no]^w;　
      |                              ^~
a.cc:11:25: error: expected ';' before '}' token
   11 |             dfs(u,no);　
      |                         ^
      |                         ;
   12 |         }
      |         ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> a[100005];
int ans[100005];
void dfs(int no,int father){ 
	for (int i=0;i<a[no].size();i++){
		int u=a[no][i].first;
		int w=a[no][i].second%2; 
		if (u!=father){
			ans[u]=ans[no]^w;　
			dfs(u,no);　
		}
	}
}
int main(){
    int n;
	cin>>n;
	for (int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		a[u].push_back({v,c});
		a[v].push_back({u,c});
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++) cout<<ans[i]<<endl;
}


Compiler output:
a.cc:10:42: error: extended character 　 is not valid in an identifier
   10 |                         ans[u]=ans[no]^w;　
      |                                          ^
a.cc:11:35: error: extended character 　 is not valid in an identifier
   11 |                         dfs(u,no);　
      |                                   ^
a.cc: In function 'void dfs(int, int)':
a.cc:10:42: error: '\U00003000' was not declared in this scope
   10 |                         ans[u]=ans[no]^w;　
      |                                          ^~
a.cc:11:37: error: expected ';' before '}' token
   11 |                         dfs(u,no);　
      |                                     ^
      |                                     ;
   12 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> a[100005];
int ans[100005];
void dfs(int no,int father){ //fatherは祖先の頂点
	for (int i=0;i<a[no].size();i++){
		int u=a[no][i].first;
		int w=a[no][i].second%2; //距離が偶数かどうか
		if (u!=father){
			ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
			dfs(u,no);　//noが今度は親になり、uが子になる
		}
	}
}
int main(){
    int n;
	cin>>n;
	for (int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		a[u].push_back({v,c});
		a[v].push_back({u,c});
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++) cout<<ans[i]<<endl;
}

Compiler output:
a.cc:10:42: error: extended character 　 is not valid in an identifier
   10 |                         ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
      |                                          ^
a.cc:11:35: error: extended character 　 is not valid in an identifier
   11 |                         dfs(u,no);　//noが今度は親になり、uが子になる
      |                                   ^
a.cc: In function 'void dfs(int, int)':
a.cc:10:42: error: '\U00003000' was not declared in this scope
   10 |                         ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
      |                                          ^~
a.cc:11:37: error: expected ';' before '}' token
   11 |                         dfs(u,no);　//noが今度は親になり、uが子になる
      |                                     ^
      |                                     ;
   12 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> a[100005];
int ans[100005];
void dfs(int no,int father){ //fatherは祖先の頂点
	for (int i=0;i<a[no].size();i++){
		int u=a[no][i].first;
		int w=a[no][i].second%2; //距離が偶数かどうか
		if (u!=father){
			ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
			dfs(u,no);　//noが今度は親になり、uが子になる
		}
	}
}
int main(){
    int n;
	cin>>n;
	for (int i=1;i<n;i++){
		int u,v,c;
		cin>>u>>v>>c;
		a[u].push_back({v,c});
		a[v].push_back({u,c});
	}
	dfs(1,-1);
	for(i=1;i<=n;i++) cout<<ans[i]<<endl;
}

Compiler output:
a.cc:10:42: error: extended character 　 is not valid in an identifier
   10 |                         ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
      |                                          ^
a.cc:11:35: error: extended character 　 is not valid in an identifier
   11 |                         dfs(u,no);　//noが今度は親になり、uが子になる
      |                                   ^
a.cc: In function 'void dfs(int, int)':
a.cc:10:42: error: '\U00003000' was not declared in this scope
   10 |                         ans[u]=ans[no]^w;　//wの偶奇を利用してズレさせる
      |                                          ^~
a.cc:11:37: error: expected ';' before '}' token
   11 |                         dfs(u,no);　//noが今度は親になり、uが子になる
      |                                     ^
      |                                     ;
   12 |                 }
      |                 ~                    
a.cc: In function 'int main()':
a.cc:25:13: error: 'i' was not declared in this scope
   25 |         for(i=1;i<=n;i++) cout<<ans[i]<<endl;
      |             ^
Language: C++

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

#define long long ll;

int main()
{
    
    int n;
    cin>> n;
    
    for(int index=1;index<=n;index++)
    cout<<index%2<<endl;
    
    
    return 0;
}


Compiler output:
a.cc:1:10: fatal error: bits/stdc++: No such file or directory
    1 | #include <bits/stdc++>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <vector>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// ***************************************

vector<vector<pair<int, int>>> tree{};
vector<int> color{};


void dfs(int V) {
    for (auto& pr : tree[V]) {
        if (color[pr.first] == -1) {
            color[pr.first] = pr.second % 2 == 0 ? color[V] : 1 - color[V];
            dfs(pr.first);
        }
    }
}


int main(void) {

    int N;
    cin >> N;

    REP(i, N) {
        vector<pair<int, int>> vec;
        tree.push_back(vec);
        color.push_back(-1);
    }
    color[0] = 0;

    int u, v, w;
    REP(i, N - 1) {
        cin >> u >> v >> w;
        pair<int, int> p1{ v-1, w }, p2{ u-1, w };
        tree[u - 1].push_back(p1);
        tree[v - 1].push_back(p2);
    }

    dfs(0);

    for (auto& c : color) {
        cout << c << endl;
    }


    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:70:14: error: expected '}' at end of input
   70 |     return 0;
      |              ^
a.cc:43:16: note: to match this '{'
   43 | int main(void) {
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0); cout.tie(0);
	ios::sync_with_stdio(0);
	
	int n; cin >> n; 
	vector<vector<pair<int,int>>> Graph g(n);
	for(int i=0; i<n-1; ++i){
		int u, v, w;
		cin >> u >> v >> w;
		--u; --v;
		w %= 2;
		g[u].push_back(make_pair(v,w));
		g[v].push_back(make_pair(u,w));
	}

	vector<int> color(n,0), dst(n,0);
	vector<bool> visit(n,0);
	stack<int> st;
	color[0]=1;
	visit[0]=1;
	st.push(0);
	while(!st.empty()){
		int z=st.top();
		st.pop();
		if(dst[z]%2==0) color[z]=1;

		for(auto i : g[z]){
			if(!visit[i.first]){
				visit[i.first]=1;
				dst[i.first]=i.second+dst[z];
				st.push(i.first);
			}
		}
	}

	for(int i : color) cout << i << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:45: error: expected initializer before 'g'
    8 |         vector<vector<pair<int,int>>> Graph g(n);
      |                                             ^
a.cc:14:17: error: 'g' was not declared in this scope
   14 |                 g[u].push_back(make_pair(v,w));
      |                 ^
a.cc:29:30: error: 'g' was not declared in this scope
   29 |                 for(auto i : g[z]){
      |                              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
# define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;

ll main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll N;
	cin>>N;
    typedef pair<ll,ll> P;
    vector<ll> l(N+1);

    vector<vector<P>> vw(N+1);

    rep(i,N-1){
        ll u,v,w;
        cin>>u>>v>>w;
        vw[u].push_back(P{v,w});
        vw[v].push_back(P{u,w});
    }

    queue<ll> q;
    q.push(1);
    vector<ll> ans(N+1);

    while(!q.empty()){
        ll u = q.front();q.pop();
        for(auto p:vw[u]){
            ll v = p.first;
            ll w = p.second;
            if(l[v]==0){
                l[v]= l[u]+w;
                ans[v] = l[v]%2;
                q.push(v);
            }
        }
    }
    for(ll i=1;i<=N;i++){
        cout<<ans[i]<<"\n";
    }

    return 0;
}


Compiler output:
a.cc:6:1: error: '::main' must return 'int'
    6 | ll main(){
      | ^~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

// 辺に重みをつける場合 
struct Edge{
  int to;
  int weight;
  Edge(int t,int w) : to(t), weight(w) { }
};

using Graph = vector<vector<Edge>>;

//深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v){
  seen[v] = true; // v を訪問済みにする

  // vから行ける各頂点 next_v について
  for(auto nv : G[v]){
    if (seen[nv]) continue; // next_v が探索済みだったらスルー
    dfs(G, nv); // 再帰的に探索
  } 
}

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, M; cin >> N >> M;
  
  Graph G(N);
  for(int i=0;i<M;i++){
    int A, B, C;
    cin >> A >> B >> C;
    --A; --B;
    G[A].push_back(Edge(B, C));
    G[B].push_back(Edge(B, C));
  }

  seen.assign(N, false); // 全頂点を「未訪問」にして初期化
  dfs(G, 0);

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, long long int)':
a.cc:24:13: error: no match for 'operator[]' (operand types are 'std::vector<bool>' and 'Edge')
   24 |     if (seen[nv]) continue; // next_v が探索済みだったらスルー
      |             ^
In file included from /usr/include/c++/14/vector:67,
                 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/stl_bvector.h:1086:7: note: candidate: 'std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](size_type) [with _Alloc = std::allocator<bool>; reference = std::vector<bool>::reference; size_type = long unsigned int]'
 1086 |       operator[](size_type __n)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:1086:28: note:   no known conversion for argument 1 from 'Edge' to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
 1086 |       operator[](size_type __n)
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_bvector.h:1091:7: note: candidate: 'std::vector<bool, _Alloc>::const_reference std::vector<bool, _Alloc>::operator[](size_type) const [with _Alloc = std::allocator<bool>; const_reference = bool; size_type = long unsigned int]'
 1091 |       operator[](size_type __n) const
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_bvector.h:1091:28: note:   no known conversion for argument 1 from 'Edge' to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
 1091 |       operator[](size_type __n) const
      |                  ~~~~~~~~~~^~~
a.cc:25:12: error: cannot convert 'Edge' to 'long long int'
   25 |     dfs(G, nv); // 再帰的に探索
      |            ^~
      |            |
      |            Edge
a.cc:19:30: note:   initializing argument 2 of 'void dfs(const Graph&, long long int)'
   19 | void dfs(const Graph &G, int v){
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

// 辺に重みをつける場合 
struct Edge{
  int to;
  int weight;
  Edge(int t,int w) : to(t), weight(w) { }
};

using Graph = vector<vector<Edge>>;
int A[100010];

//深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v){
  seen[v] = true; // v を訪問済みにする

  // vから行ける各頂点 next_v について
  for(auto nv : G[v]){
    if (seen[nv.to]) continue; // next_v が探索済みだったらスルー
    if(nv.weight % 2 == 0) A[nv.to] = A[v];
    else{
      if(A[v] == 0) A[nv.to] = 1;
      else A[nv.to] = 0;
    }
    dfs(G, next_v.to); // 再帰的に探索
  } 
}

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N; cin >> N;
  
  Graph G(N);
  for(int i=0;i<N-1;i++){
    int A, B, C;
    cin >> A >> B >> C;
    --A; --B;
    G[A].push_back(Edge(B, C));
    G[B].push_back(Edge(A, C));
  }

  seen.assign(N, false); // 全頂点を「未訪問」にして初期化
  A[0] = 0;
  dfs(G, 0);
  rep(i,N) cout << A[i] << endl;

}

Compiler output:
a.cc: In function 'void dfs(const Graph&, long long int)':
a.cc:31:12: error: 'next_v' was not declared in this scope; did you mean 'nextup'?
   31 |     dfs(G, next_v.to); // 再帰的に探索
      |            ^~~~~~
      |            nextup
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int,int>>> g(100000);
//map<pair<int,int>,int> W;
bool seen[100000];
int color[100000];
int N;

void dfs(int n, int c){
  //cout << n << endl;
  seen[n] = true;
  color[n] = c;
  int cc;
  if(c==0)cc=1;
  else cc=0;
  int w;
  for(auto to : g.at(n)){
    if(seen[to]){}
    else{
      w = to.second;
      if(w%2==0)dfs(to.first,c);
      else dfs(to.first,cc);
    }
  }
  return ;
}
int main(){
  cin >> N;
  //memset(g, -1, sizeof(g));
  memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<N; i++){
    cin >> u >> v >> w;
    g.at(u-1).push_back(make_pair(v-1,w));
    g.at(v-1).push_back(make_pair(u-1,w));
    //W[make_pair(u-1,v-1)] = w;
  }
  dfs(0,0);
  for(int i=0; i<N; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:18:12: error: no match for 'operator[]' (operand types are 'bool [100000]' and 'std::pair<int, int>')
   18 |     if(seen[to]){}
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int,int>> g(100000);
//map<pair<int,int>,int> W;
bool seen[100000];
int color[100000];
int N;

void dfs(int n, int c){
  //cout << n << endl;
  seen[n] = true;
  color[n] = c;
  int cc;
  if(c==0)cc=1;
  else cc=0;
  int w;
  for(auto to : g.at(n)){
    if(seen[to]){}
    else{
      w = to.second;
      if(w%2==0)dfs(to.first,c);
      else dfs(to.first,cc);
    }
  }
  return ;
}
int main(){
  cin >> N;
  //memset(g, -1, sizeof(g));
  memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<N; i++){
    cin >> u >> v >> w;
    g.at(u-1).push_back(make_pair(v-1,w));
    g.at(v-1).push_back(make_pair(u-1,w));
    //W[make_pair(u-1,v-1)] = w;
  }
  dfs(0,0);
  for(int i=0; i<N; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
a.cc:3:38: error: template argument 1 is invalid
    3 | vector<vector<pair<int,int>> g(100000);
      |                                      ^
a.cc:3:38: error: template argument 2 is invalid
a.cc: In function 'void dfs(int, int)':
a.cc:17:17: error: 'g' was not declared in this scope
   17 |   for(auto to : g.at(n)){
      |                 ^
a.cc: In function 'int main()':
a.cc:34:5: error: 'g' was not declared in this scope
   34 |     g.at(u-1).push_back(make_pair(v-1,w));
      |     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int graph[100000][100000];
//bool seen[100000];
int color[100000];

void dfs(int n, int c){
  color[n] = c;
  int cc;
  if(c==0)cc=1;
  else cc=0;
  
  for(int i=0; i<n; i++){
    int w = graph[n][i];
    if(w!=-1){
      if(w%2==0)dfs(i,c);
      else dfs(i,cc);
    }
  }
  return ;
}
int main(){
  int n;cin >> n;
  memset(graph, -1, sizeof(graph));
  //memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<n; i++){
    cin >> u >> v >> w;
    graph[u-1][v-1] = w;
    graph[v-1][u-1] = w;
  }
  dfs(0,0);
  for(int i=0; i<n; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
/tmp/ccOGSE8Z.o: in function `dfs(int, int)':
a.cc:(.text+0x1e): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccOGSE8Z.o
/tmp/ccOGSE8Z.o: in function `main':
a.cc:(.text+0x1cf): relocation truncated to fit: R_X86_64_PC32 against symbol `color' defined in .bss section in /tmp/ccOGSE8Z.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
int graph[100000][100000];
//bool seen[100000];
int color[100000];

void dfs(int n, int c){
  color[n] = c;
  int cc;
  if(c==0)cc=1;
  else cc=0;
  
  for(int i=0; i<n; i++){
    int w = graph[n][i];
    if(w!=-1){
      if(w%2==0)dfs(i,c);
      else dfs(i,cc);
    }
  }
  return ;
}
int main(){
  int n;cin >> n;
  memset(graph, -1, sizeof(graph));
  memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<n; i++){
    cin >> u >> v >> w;
    graph[u-1][v-1] = w;
    graph[v-1][u-1] = w;
  }
  dfs(0,0);
  for(int i=0; i<n; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'seen' was not declared in this scope
   25 |   memset(seen, false, sizeof(seen));
      |          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int graph[100000][100000];
//bool seen[100000];
int color[100000];

void dfs(int n, int c){
  color[n] = c;
  int cc;
  if(c==0)cc=1;
  else cc=0;
  
  for(int i=0; i<n; i++){
    int w = graph[n][i];
    if(w!=-1){
      if(w%2==0)dfs(i,c);
      else dfs(i,cc);
    }
  }
  return ;
}
    

}

int main(){
  int n;cin >> n;
  memset(graph, -1, sizeof(graph));
  memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<n; i++){
    cin >> u >> v >> w;
    graph[u-1][v-1] = w;
    graph[v-1][u-1] = w;
  }
  dfs(0,0);
  for(int i=0; i<n; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
a.cc: In function 'int main()':
a.cc:29:10: error: 'seen' was not declared in this scope
   29 |   memset(seen, false, sizeof(seen));
      |          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int graph[100000][100000];
//bool seen[100000];
int color[100000];

void dfs(int n, int color){
  color[n] = color;
  int cc;
  if(color==0)cc=1;
  else cc=0;
  
  for(int i=0; i<n; i++){
    int w = graph[n][i];
    if(w!=-1){
      if(w%2==0)dfs(i,color);
      else dfs(i,cc);
    }
  }
  return ;
}
    

}

int main(){
  int n;cin >> n;
  memset(graph, -1, sizeof(graph));
  memset(seen, false, sizeof(seen));
  int u,v,w;
  for(int i=0; i<n; i++){
    cin >> u >> v >> w;
    graph[u-1][v-1] = w;
    graph[v-1][u-1] = w;
  }
  dfs(0,0);
  for(int i=0; i<n; i++){
    cout << color[i] << endl;
  }
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:8:8: error: invalid types 'int[int]' for array subscript
    8 |   color[n] = color;
      |        ^
a.cc: At global scope:
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
a.cc: In function 'int main()':
a.cc:29:10: error: 'seen' was not declared in this scope
   29 |   memset(seen, false, sizeof(seen));
      |          ^~~~
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

int main(){
long long int a

cin >> a ;

for(int i=0;i<a;i++){

if(a % 2 == 0){

cout << "1" << endl;
}

else{

cout << "0" << endl;
}

}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:1: error: expected initializer before 'cin'
   10 | cin >> a ;
      | ^~~
a.cc:12:15: error: 'a' was not declared in this scope
   12 | for(int i=0;i<a;i++){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
vector<vector<int>> a(100010);
map<P,int> m;
map<P,bool> b;
vector<bool> ans(100010);
void dfs(int x){
  for(auto au:a[x]){
    if(b[P(x,au)])return;
    ans[au]=(m[P(x,au)]%2?!au[x]:au[x]);
    b[P(x,au)]=b[P(au,x)]=true;
    dfs(au);
  }
}
int main(){
  int n;cin>>n;
  rep(i,n-1){
    int x,y,z;
    cin>>x>>y>>z;
    x--,y--;
    a[x].push_back(y);
    a[y].push_back(x);
    m[P(x,y)]=z;
    m[P(y,x)]=z;
  }
  ans[0]=false;
  dfs(0);
  rep(i,n){
    cout<<(ans[i]?1:0)<<endl;
  }
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:17:30: error: invalid types 'int[int]' for array subscript
   17 |     ans[au]=(m[P(x,au)]%2?!au[x]:au[x]);
      |                              ^
a.cc:17:36: error: invalid types 'int[int]' for array subscript
   17 |     ans[au]=(m[P(x,au)]%2?!au[x]:au[x]);
      |                                    ^