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

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
typedef long long ll;
using namespace std;

int func1(int a, int b)
{
	int ret = 0;

	while (1)
	{
		if (a < b)
		{
			a = a*2;
			ret++;
		}
		else break;
	}

	return ret;
}

int main(void)
{
	double n, k;
	cin >> n >> k;
	double ans = 0;

	for (int i = 1; i <= n; i++)
	{
		int x = func1(i, 10);
		double tmp = (1 / n) * pow((0.5), x);
		ans += tmp;
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:40: error: 'pow' was not declared in this scope
   35 |                 double tmp = (1 / n) * pow((0.5), x);
      |                                        ^~~
Language: C++

#include <iostream>

using namespace std;

int main() {
	int n, k, i;
	double ans = 0;
	cin >> n >> k;

	for (i = 1; i <= n; i++) {
		if (i < k) {
			ans += (1/(double)n) * pow(0.5,ceil(log2((double)k / i)));
		}
		else {
			ans += 1 / n;
		}
	}

	cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:61: error: 'log2' was not declared in this scope
   12 |                         ans += (1/(double)n) * pow(0.5,ceil(log2((double)k / i)));
      |                                                             ^~~~
a.cc:12:56: error: 'ceil' was not declared in this scope
   12 |                         ans += (1/(double)n) * pow(0.5,ceil(log2((double)k / i)));
      |                                                        ^~~~
a.cc:12:48: error: 'pow' was not declared in this scope
   12 |                         ans += (1/(double)n) * pow(0.5,ceil(log2((double)k / i)));
      |                                                ^~~
Language: C++

N, K = gets.strip.split.map(&:to_i)

ans=0.0

(1..N).each do |i|
	if K<=i
	  ans+=(1.0/N)
	  next
	end
	x=1.0
	j=i
	while j<K
		j*=2
		x*=0.5
	end
	ans+=(1.0/N)*x;
end




puts ans


Compiler output:
a.cc:5:2: error: too many decimal points in number
    5 | (1..N).each do |i|
      |  ^~~~
a.cc:1:1: error: 'N' does not name a type
    1 | N, K = gets.strip.split.map(&:to_i)
      | ^
a.cc:17:1: error: 'end' does not name a type
   17 | end
      | ^~~
Language: Java


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		double ans = 0.0;
		for(int i = 1; i < N + 1; i++) {
			int tmp = i;
			double per = 1.0 / N;
			while(tmp < K) {
				tmp *= 2;
				per /= 2.0
			}
			ans += per;
		}
		System.out.println(ans);
	}

}


Compiler output:
Main.java:16: error: ';' expected
				per /= 2.0
				          ^
1 error
Language: C++

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

int main() {
  double ans_sub = 0;
  int n, k, i, j = 0;
  cin >> n >> k;
  
  for(i = 0; i < n; i++){
    while(i * 2 ^ j >= k){
      j++;
    }
    ans_sub += 0.5 ^ j;
    j = 0;
  }
  
  cout << ans_sub / n << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: invalid operands of types 'double' and 'int' to binary 'operator^'
   13 |     ans_sub += 0.5 ^ j;
      |                ~~~ ^ ~
      |                |     |
      |                |     int
      |                double
Language: C

#include <stdio.h>
int main(){
  int dice=0,goal=0;
  double ans=0;
  scanf("%d",&data);
  scanf("%d",&goal);
  for(int i=1;i<=dice;i++){
    int tmp=i;
    double per=1/dice;
    while(tmp<=goal){
      tmp*=2;
      per/=2;
    }
    ans+=per;
  }
  printf("%lf",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:5:15: error: 'data' undeclared (first use in this function)
    5 |   scanf("%d",&data);
      |               ^~~~
main.c:5:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  double n, k, i, j = 0, ans_sub = 0;
  cin >> n >> k;
  
  for(i = 0; i < n; i++){
    while(i * 2 ^ j >= k){
      j++;
    }
    ans_sub += 0.5 ^ j;
  }
  
  cout << ans_sub / n << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: invalid operands of types 'double' and 'bool' to binary 'operator^'
    9 |     while(i * 2 ^ j >= k){
      |           ~~~~~ ^ ~~~~~~
      |             |       |
      |             double  bool
a.cc:12:20: error: invalid operands of types 'double' and 'double' to binary 'operator^'
   12 |     ans_sub += 0.5 ^ j;
      |                ~~~ ^ ~
      |                |     |
      |                |     double
      |                double
Language: C

#include <stdio.h>
int main(){
  int dice=0 goal=0;
  double ans=0;
  scanf("%d",&data);
  scanf("%d",&goal);
  for(int i=1;i<=dice;i++){
    int tmp=i
    double per=1/dice;
    while(tmp<=goal){
      tmp*=2;
      per/=2;
    }
    ans+=per;
  }
  printf("%lf",ans);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:3:14: error: expected ',' or ';' before 'goal'
    3 |   int dice=0 goal=0;
      |              ^~~~
main.c:5:15: error: 'data' undeclared (first use in this function)
    5 |   scanf("%d",&data);
      |               ^~~~
main.c:5:15: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:15: error: 'goal' undeclared (first use in this function)
    6 |   scanf("%d",&goal);
      |               ^~~~
main.c:9:5: error: expected ',' or ';' before 'double'
    9 |     double per=1/dice;
      |     ^~~~~~
main.c:12:7: error: 'per' undeclared (first use in this function)
   12 |       per/=2;
      |       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    ll N,K;
    cin >> N >> K;
    long double ans = 0;
    for(ll i = 1; i <= N; i++){
        long double tmp = 1;
        ll score = i;
        while(score < K){
            score *= 2;
            tmp /= 2;
        }
        ans += tmp;
    }
    ans /= N;
    cout <<　setprecision(10) <<  ans <<  "\n";
    return 0;
} 


Compiler output:
a.cc:20:12: error: extended character 　 is not valid in an identifier
   20 |     cout <<　setprecision(10) <<  ans <<  "\n";
      |            ^
a.cc: In function 'int main()':
a.cc:20:12: error: '\U00003000setprecision' was not declared in this scope
   20 |     cout <<　setprecision(10) <<  ans <<  "\n";
      |            ^~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
using namespace std;


int main(void){
    // Your code here!
    
    int n, k;
    cin >> n >> k;
    
    double p = 0.0;
    
    for(int i = 1; i <= n; i ++){
        int score = i;
        double p2 = 1.0;
        while(score < k){
            score *= 2;
            p2 *= 0.5;
        }
        p += p2;
    }
    p /= n;
    cout << fixed;
    cout << setprecision(10)　<< p;
}

Compiler output:
a.cc:25:29: error: extended character 　 is not valid in an identifier
   25 |     cout << setprecision(10)　<< p;
      |                             ^
a.cc: In function 'int main()':
a.cc:25:29: error: expected ';' before '\U00003000'
   25 |     cout << setprecision(10)　<< p;
      |                             ^~
      |                             ;
Language: C++


import math

N, K = [int(_) for _ in input().split()]


ans = 0
for i in range(1, N+1):

    if i >= K:
        ans += 1
    else:
        ans += 2 ** (-math.ceil(math.log2(K / i)))

print(ans / N)


Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import math
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <map>

using namespace std;
using ll = long long;

int main()
{
	int n, k;
	cin >> n >> k;

	double cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (i >= k)
			cnt += 1;
		else
		{
			int omote = log2(k / i) + 1;
			cnt += 1 / pow(2, omote);
		}
	}

	cout << long double (cnt / n) << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: expected primary-expression before 'long'
   31 |         cout << long double (cnt / n) << endl;
      |                 ^~~~
Language: C++

#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <map>

using namespace std;
using ll = long long;

int main()
{
	int n, k;
	cin >> n >> k;

	long double cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (i >= k)
			cnt += 1;
		else
		{
			int omote = log2(k / i) + 1;
			cnt += 1 / pow(2, omote);
		}
	}

	cout << long double (cnt / n) << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:17: error: expected primary-expression before 'long'
   31 |         cout << long double (cnt / n) << endl;
      |                 ^~~~
Language: C++

#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <map>

using namespace std;
using ll = long long;

int main()
{
	int n, k;
	cin >> n >> k;

	long double cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (i >= k)
			cnt += 1;
		else
		{
			int omote = log2(long double(k / i)) + 1;
			cnt += 1 / pow(2, omote);
		}
	}

	cout << long double (cnt / n) << endl;


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:42: error: expected primary-expression before 'long'
   26 |                         int omote = log2(long double(k / i)) + 1;
      |                                          ^~~~
a.cc:31:17: error: expected primary-expression before 'long'
   31 |         cout << long double (cnt / n) << endl;
      |                 ^~~~
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<vector>
#include<queue>

using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
vector<i64> dist;
vector<vector<P>> tree;
vector<i32> par;
vector<vector<i32>> doubling;
void bfs(){
    dist[0] = 0;
    queue<i32> que;
    que.push(0);
    while(que.size()){
        i32 now = que.front();
        que.pop();
        rep(i,tree[now].size()){
            if(dist[now] + tree[now][i].second < dist[tree[now][i].first]){
                dist[tree[now][i].first] = dist[now] + tree[now][i].second;
                que.push(tree[now][i].first);
            }
        }
    }
}
vector<i32> depth;
void dfs(i32 now,i32 parent,i32 d){
    depth[now] = d;
    doubling[0][now] = parent;
    for(auto &v: tree[now]){
        if(v.first != parent){
            dfs(v.first,now,d + 1);
        }
    }
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n;
cin >> n;
dist.assign(n,1145141919810);
tree.resize(n);
par.resize(n);
rep(i,n - 1){
    i32 u,v,w;
    cin >> u >> v >> w;
    tree[u - 1].emplace_back(P(v - 1,w));
    tree[v - 1].emplace_back(P(u - 1,w));
}
bfs();
doubling.resize(64,vector<i32> (n,-1));
depth.resize(n);
dfs(0,-1,0);
rep(i,63){
    rep(j,n){
        if(doubling[i][j] == -1) doubling[i + 1][j] = -1;
        else doubling[i + 1][j] = doubling[i][doubling[i][j]];
    }
}
vector<i32> colours(n);
colour[0] = 1;
rep(i,n - 1){
    if(dist[i + 1] % 2 == 0){
        colours[i + 1] = 1;
    }else{
        colours[i + 1] = 0;
    }
}
rep(i,n){
    cout << colours[i] << endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:1: error: 'colour' was not declared in this scope; did you mean 'colours'?
   72 | colour[0] = 1;
      | ^~~~~~
      | colours
Language: C++

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
#include<vector>
#include<queue>

using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;
vector<i64> dist;
vector<vector<P>> tree;
vector<i32> par;
vector<vector<i32>> doubling;
void bfs(){
    dist[0] = 0;
    queue<i32> que;
    que.push(0);
    while(que.size()){
        i32 now = que.front();
        que.pop();
        rep(i,tree[now].size()){
            if(dist[now] + tree[now][i].second < dist[tree[now][i].first]){
                dist[tree[now][i].first] = dist[now] + tree[now][i].second;
                que.push(tree[now][i].first);
            }
        }
    }
}
vector<i32> depth;
void dfs(i32 now,i32 parent,i32 d){
    depth[now] = d;
    doubling[0][now] = parent;
    for(auto &v: tree[now]){
        if(v.first != parent){
            dfs(v.first,now,d + 1);
        }
    }
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n;
cin >> n;
dist.assign(n,1145141919810);
tree.resize(n);
par.resize(n);
rep(i,n - 1){
    i32 u,v,w;
    cin >> u >> v >> w;
    tree[u - 1].emplace_back(P(v - 1,w));
    tree[v - 1].emplace_back(P(u - 1,w));
}
bfs();
doubling.resize(64,vector<i32> (n,-1));
depth.resize(n);
dfs(0,-1,0);
rep(i,63){
    rep(j,n){
        if(doubling[i][j] == -1) doubling[i + 1][j] = -1;
        else doubling[i + 1][j] = doubling[i][doubling[i][j]];
    }
}
vector<i32> colour(n);
colour[0] = 1;
rep(i,n - 1){
    if(dist[i + 1] % 2 == 0){
        colours[i + 1] = 1;
    }else{
        colours[i + 1] = 0;
    }
}
rep(i,n){
    cout << colours[i] << endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:9: error: 'colours' was not declared in this scope; did you mean 'colour'?
   75 |         colours[i + 1] = 1;
      |         ^~~~~~~
      |         colour
a.cc:77:9: error: 'colours' was not declared in this scope; did you mean 'colour'?
   77 |         colours[i + 1] = 0;
      |         ^~~~~~~
      |         colour
a.cc:81:13: error: 'colours' was not declared in this scope; did you mean 'colour'?
   81 |     cout << colours[i] << endl;
      |             ^~~~~~~
      |             colour
Language: C++

#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
map<pair<int,int>,int>mp;
vector<int>adj[MAX];
int visit[MAX];
int color[MAX];
int error,C;
void dfs(int src,int par)
{
    visit[src]=1;
    int c=color[src]^1;
    for(auto i:adj[src])
    {
        if(i==par)
            continue;
        if(!visit[i])
        {
            color[i]=c;
            dfs(i,src);
        }
        else if(color[i]!=c)
        {
            if(mp[ {i,c}]%2!=0)
            {
                error=i;
                C=color[i];
            }
        }
    }


}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=0; i<n-1; i++)
    {
        int a,b,c;
        cin>>a>>b>>c;
        adj[a].push_back(b);
        adj[b].push_back(a);
        mp[ {a,b}]=c;
        mp[ {b,a}]=c;
    }
    dfs(1,0);

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


    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:22:5: error: reference to 'visit' is ambiguous
   22 |     visit[src]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:17:5: note:                 'int visit [1000000]'
   17 | int visit[MAX];
      |     ^~~~~
a.cc:28:13: error: reference to 'visit' is ambiguous
   28 |         if(!visit[i])
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:17:5: note:                 'int visit [1000000]'
   17 | int visit[MAX];
      |     ^~~~~
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) int(x.size())
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));

struct edge { int to, cost; };

vector<vector<edge>>tree;
vector<int>ans;
void dfs(int v, int clr, int p = -1) {
	int m = sz(tree[v]);
	rep(i, m) {
		int u = tree[v][i].to;
		if (u == p)continue;
		int nclr;
		if (tree[v][i].cost == 0)nclr = clr;
		else nclr = 1 - clr;
		ans[u] = nclr;
		dfs(u, ans[u], v);
	}
}

signed main() {
	int N;
	cin >> N;
	tree.resize(N);
	ans.resize(N);
	ans[0] = 0;
	rep(i, N - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		w %= 2;
		tree[u].push_back({ v,w });
		tree[v].push_back({ u,w });
	}
	dfs(0, 0);
	rep(i, N)cout << ans[i] << endl;
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int, long long int)':
a.cc:15:13: error: expected primary-expression before 'long'
   15 | #define int long long int
      |             ^~~~
a.cc:18:15: note: in expansion of macro 'int'
   18 | #define sz(x) int(x.size())
      |               ^~~
a.cc:34:17: note: in expansion of macro 'sz'
   34 |         int m = sz(tree[v]);
      |                 ^~
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) int(x.size())
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));

struct edge { int to, cost; };

vector<vector<edge>>tree;
vector<int>ans;
void dfs(int v, int clr, int p = -1) {
	rep(i, sz(tree[v])) {
		int u = tree[v][i].to;
		if (u == p)continue;
		int nclr;
		if (tree[v][i].cost == 0)nclr = clr;
		else nclr = 1 - clr;
		ans[u] = nclr;
		dfs(u, ans[u], v);
	}
}

signed main() {
	int N;
	cin >> N;
	tree.resize(N);
	ans.resize(N);
	ans[0] = 0;
	rep(i, N - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		u--; v--;
		w %= 2;
		tree[u].push_back({ v,w });
		tree[v].push_back({ u,w });
	}
	dfs(0, 0);
	rep(i, N)cout << ans[i] << endl;
}

Compiler output:
a.cc: In function 'void dfs(long long int, long long int, long long int)':
a.cc:15:13: error: expected primary-expression before 'long'
   15 | #define int long long int
      |             ^~~~
a.cc:16:45: note: in definition of macro 'rep'
   16 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:18:15: note: in expansion of macro 'int'
   18 | #define sz(x) int(x.size())
      |               ^~~
a.cc:34:16: note: in expansion of macro 'sz'
   34 |         rep(i, sz(tree[v])) {
      |                ^~
a.cc:15:13: error: expected ')' before 'long'
   15 | #define int long long int
      |             ^~~~
a.cc:16:45: note: in definition of macro 'rep'
   16 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
a.cc:18:15: note: in expansion of macro 'int'
   18 | #define sz(x) int(x.size())
      |               ^~~
a.cc:34:16: note: in expansion of macro 'sz'
   34 |         rep(i, sz(tree[v])) {
      |                ^~
a.cc:16:44: note: to match this '('
   16 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                            ^
a.cc:34:9: note: in expansion of macro 'rep'
   34 |         rep(i, sz(tree[v])) {
      |         ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int NIL = -1;
const long long INF = 1LL << 60;
const long long MOD = 1e9+7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

vector<vector<long long> dist;
vector<int> color;

void dfs(int v, const Graph &G) {
  for (auto nv : G[v]) {
    if (color[nv] != -1) continue;
    if (dist[v][nv] % 2 == 1) {
      color[nv] = 1 - color[v];
      dfs(nv, G);
    }
    else {
      color[nv] = color[v];
      dfs(nv, G);
    }
  }
}

int main() {
  int N; cin >> N;
  dist.resize(N);
  for (int i = 0; i < N; ++i) dist[i].assign(N, 0);
  Graph G(N);
  for (int i = 0; i < N-1; ++i) {
    int u, v, w; cin >> u >> v >> w;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
    dist[u][v] = w;
    dist[v][u] = w;
  }
  color.assign(N, -1);

  color[0] = 0;
  dfs(0, G);
  for (int i = 0; i < N; ++i) {
    cout << color[i] << endl;
  }
}


Compiler output:
a.cc:13:26: error: template argument 1 is invalid
   13 | vector<vector<long long> dist;
      |                          ^~~~
a.cc:13:26: error: template argument 2 is invalid
a.cc: In function 'void dfs(int, const Graph&)':
a.cc:19:9: error: 'dist' was not declared in this scope
   19 |     if (dist[v][nv] % 2 == 1) {
      |         ^~~~
a.cc: In function 'int main()':
a.cc:32:3: error: 'dist' was not declared in this scope
   32 |   dist.resize(N);
      |   ^~~~
Language: C++

#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;


int main(){
    ll n;
    cin>>n;
    vector<vector<P> > G(n);
    for(ll i=0;i<n-1;i++){
        ll u,v,w;
        cin>>u>>v>>w;
        u--; v--;
        G[u].push_back(P(v,w));
        G[v].push_back(P(u,w));
    }
    vector<bool> ans(n,false);
    vector<bool> done(n,false);
    done[0]=true;
    queue<ll> q;
    q.push(0);
    while(!q.empty()){
        ll now=q.front(); q.pop();
        for(P pp:G[now]){
            ll to=pp.first;
            ll w=pp.second;
            if(!done[to]){
                //cout<<now<<" "<<to<<endl;
                if(w%2==0){
                    ans[to]=ans[now];
                }else{
                    ans[to]=!ans[now];
                }
                done[to]=true;
                q.push(to);
            }
        }
    }
    for(ll i=0;i<n;i++) cout<<ans[i]<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: 'cin' was not declared in this scope
   30 |     cin>>n;
      |     ^~~
a.cc:17:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   16 | #include <iomanip>
  +++ |+#include <iostream>
   17 | #define rep(i,n) for(int i=0;i<n;i++)
a.cc:61:25: error: 'cout' was not declared in this scope
   61 |     for(ll i=0;i<n;i++) cout<<ans[i]<<endl;
      |                         ^~~~
a.cc:61:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
// using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

void dfs(Graph &G, vector<int> &res, int v, int cur, int p = -1)
{
    res[v] = cur;
    for (auto u : G[v])
    {
        if (res[u.to] != -1)
            continue;
        if (u.weight % 2 == 0)
        {
            dfs(G, res, u.to, cur, v);
        }
        else
        {
            dfs(G, res, u.to, 1 - cur, v)
        }
    }
    return;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    Graph G(N);
    for (int i = 0; i < N - 1; i++)
    {
        int u, v, w;
        cin >> u >> v >> w;
        u--, v--;
        G[u].push_back({v, w});
        G[v].push_back({u, w});
    }

    vector<int> res(N, -1);
    dfs(G, res, 0, 0);
    for (auto it : res)
    {
        cout << it << endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'void dfs(Graph&, std::vector<int>&, int, int, int)':
a.cc:35:42: error: expected ';' before '}' token
   35 |             dfs(G, res, u.to, 1 - cur, v)
      |                                          ^
      |                                          ;
   36 |         }
      |         ~
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
struct Edge {
    int to;
    int length;
    Edge(int t, int l) : to(t), length(l) { }
};
using Graph = vector<vector<Edge>>;
vector<int> ans;
 
bool dfs(const Graph &G, int a, int cur = 0){
  ans[a] = cur;
  for(Edge next_a : G[a]){
    if(ans[next_a.to] != -1) continue;
    if(next_a.length % 2 == 0) ans[next_a.to] = ans[a];
    if(next_a.length % 2 == 1) ans[next_a.to] = 1 - ans[a];
  }
  return 0;
}
 
 
int main(){
  int N;
  cin >> N;
  Graph G(N);
  for(int i = 0; i < N - 1; i++){
    int u, v, w;
    cin >> u >> v >> w;
    G[u].push_back(Edge(to, length));
  }
  ans.assign(N, -1);
  for(int i = 0; i < N; i++){
    if(ans[i] != -1) continue;
    dfs(G, i);
  }
  for(int i = 0; i < N; i++){
    cout << ans[i] << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:25: error: 'to' was not declared in this scope; did you mean 'tm'?
   31 |     G[u].push_back(Edge(to, length));
      |                         ^~
      |                         tm
a.cc:31:29: error: 'length' was not declared in this scope
   31 |     G[u].push_back(Edge(to, length));
      |                             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
template <class T>
using Grid = vector<vector<T>>;
vector<vector<pair<int, int>>> g;
vector<int> ans;
void dfs(int i) {
    for (auto x : g[i]) {
        if (ans[x.first] != -1)
            continue;
        if (x.second % 2 == 0)
            ans[x.first] = ans[i];
        else
            ans[x.first] = !ans[i];
        dfs(x.first);
    }
}
int main() {
    int N;
    cin >> N;
    g.resize(N + 1);
    rep(i, N - 1) {
        int a, b, c;
        cin >> a >> b >> c;
        g[a].emplace_back(b, c);
        g[b].emplace_back(a, c);=
    }
    ans.assign(N + 1, -1);
    ans[1] = 0;
    dfs(1);
    rep2(i, N) printf("%d\n", ans[i]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:33: error: expected primary-expression before '=' token
   31 |         g[b].emplace_back(a, c);=
      |                                 ^
a.cc:32:5: error: expected primary-expression before '}' token
   32 |     }
      |     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct edge
{
    ll v,w;
}e1;
vector<edge>E[100005];
ll visit[100005]={0},n,k;
ll color[100005];
void dfs(ll s,ll len=0)
{
    visit[s]=1;
    ll sz=E[s].size();
    for(ll i=0;i<sz;i++)
    {
        ll v=E[s][i].v;
        if(visit[v]==0)
        {  ll w=E[s][i].w;
            if((len+w)%2==0)
                color[v]=0;
            else
                {color[v]=1;}
                
                dfs(v,len+w);
                visit[v]=1;
        }
    }


}
int main()
{
   ll i,u,v,w;
   cin>>n;
   for(i=0;i<n-1;i++)
   {
       cin>>u>>v>>w;
       k=u;
       e1.v=v;
       e1.w=w;
       E[u].push_back(e1);
       e1.v=u;
       E[v].push_back(e1);


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

}


Compiler output:
a.cc: In function 'void dfs(ll, ll)':
a.cc:13:5: error: reference to 'visit' is ambiguous
   13 |     visit[s]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:4: note:                 'll visit [100005]'
    9 | ll visit[100005]={0},n,k;
      |    ^~~~~
a.cc:18:12: error: reference to 'visit' is ambiguous
   18 |         if(visit[v]==0)
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:4: note:                 'll visit [100005]'
    9 | ll visit[100005]={0},n,k;
      |    ^~~~~
a.cc:26:17: error: reference to 'visit' is ambiguous
   26 |                 visit[v]=1;
      |                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:4: note:                 'll visit [100005]'
    9 | ll visit[100005]={0},n,k;
      |    ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct edge
{
    ll v,w;
}e1;
vector<edge>E[100005];
ll visit[100005]={0},n,k;
ll color[100005];
void dfs(ll s,ll len=0)
{
    visit[s]=1;
    ll sz=E[s].size();
    for(ll i=0;i<sz;i++)
    {
        ll v=E[s][i].v;
        if(visit[v]==0)
        {  ll w=E[s][i].w;
            if((len+w)%2==0)
                color[v]=0;
            else
                color[v]=1;
                dfs(v,len+w);
        }
    }


}
int main()
{
   ll i,u,v,w;
   cin>>n;
   for(i=0;i<n-1;i++)
   {
       cin>>u>>v>>w;
       k=u;
       e1.v=v;
       e1.w=w;
       E[u].push_back(e1);
       e1.v=u;
       E[v].push_back(e1);


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

}


Compiler output:
a.cc: In function 'void dfs(ll, ll)':
a.cc:13:5: error: reference to 'visit' is ambiguous
   13 |     visit[s]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:4: note:                 'll visit [100005]'
    9 | ll visit[100005]={0},n,k;
      |    ^~~~~
a.cc:18:12: error: reference to 'visit' is ambiguous
   18 |         if(visit[v]==0)
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:9:4: note:                 'll visit [100005]'
    9 | ll visit[100005]={0},n,k;
      |    ^~~~~
Language: C++

#include<bits/stdc++.h>
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
long long visit[100005];
long long dist[100005];
vector<long long >vec[100005];
map<pair<long long ,long long >,long long >mp;
void bfs(long long  x)
{

   long long  s=x;
   visit[s]=1;
   queue<long long >q;
   q.push(s);
   while(!q.empty()){
    long long  y=q.front();
    q.pop();
    for(long long  i=0;i<vec[y].size();i++)
    {
        if(visit[vec[y][i]]==0)
        {
            visit[vec[y][i]]=1;
            q.push(vec[y][i]);
            dist[vec[y][i]]=dist[y]+mp[{y,vec[y][i]}];
        }




    }




   }





}






int main()
{

long long  a,b,c,d,e;
cin >> a ;
set<long long >s;
if(a==1)
{
    cout << 0 << endl;
}
else{

   a--;
while(a--)
{
    cin >> c >> d >> e;
    s.insert(c);
    s.insert(d);
    vec[c].push_back(d);
    vec[d].push_back(c);
    mp[{c,d}]=e;
    mp[{d,c}]=e;


}
bfs(c);
for(auto it=s.begin();it!=s.end();it++)
{
    if(dist[*it]%2==0)
    {
        cout << 0 << endl;
    }
    else{
        cout << 1 << endl;
    }




}



}






}


Compiler output:
a.cc: In function 'void bfs(long long int)':
a.cc:14:4: error: reference to 'visit' is ambiguous
   14 |    visit[s]=1;
      |    ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:11: note:                 'long long int visit [100005]'
    6 | long long visit[100005];
      |           ^~~~~
a.cc:22:12: error: reference to 'visit' is ambiguous
   22 |         if(visit[vec[y][i]]==0)
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:11: note:                 'long long int visit [100005]'
    6 | long long visit[100005];
      |           ^~~~~
a.cc:24:13: error: reference to 'visit' is ambiguous
   24 |             visit[vec[y][i]]=1;
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:11: note:                 'long long int visit [100005]'
    6 | long long visit[100005];
      |           ^~~~~
Language: C++

#include<bits/stdc++.h>
#define cy cout << "YES" << endl;
#define cn cout << "NO" << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
bool visit[100005];
long long dist[100005];
vector<long long >vec[100005];
map<pair<long long ,long long >,long long >mp;
void bfs(long long  x)
{

   long long  s=x;
   visit[s]=1;
   queue<long long >q;
   q.push(s);
   while(!q.empty()){
    long long  y=q.front();
    q.pop();
    for(long long  i=0;i<vec[y].size();i++)
    {
        if(!visit[vec[y][i]])
        {
            visit[vec[y][i]]=1;
            q.push(vec[y][i]);
            dist[vec[y][i]]=dist[y]+mp[{y,vec[y][i]}];
        }




    }




   }





}






int main()
{

long long  a,b,c,d,e;
cin >> a ;
set<long long >s;
if(a==1)
{
    cout << 0 << endl;
}
else{

   a--;
while(a--)
{
    cin >> c >> d >> e;
    s.insert(c);
    s.insert(d);
    vec[c].push_back(d);
    vec[d].push_back(c);
    mp[{c,d}]=e;
    mp[{d,c}]=e;


}
bfs(c);
for(auto it=s.begin();it!=s.end();it++)
{
    if(dist[*it]%2==0)
    {
        cout << 0 << endl;
    }
    else{
        cout << 1 << endl;
    }




}



}






}


Compiler output:
a.cc: In function 'void bfs(long long int)':
a.cc:14:4: error: reference to 'visit' is ambiguous
   14 |    visit[s]=1;
      |    ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [100005]'
    6 | bool visit[100005];
      |      ^~~~~
a.cc:22:13: error: reference to 'visit' is ambiguous
   22 |         if(!visit[vec[y][i]])
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [100005]'
    6 | bool visit[100005];
      |      ^~~~~
a.cc:24:13: error: reference to 'visit' is ambiguous
   24 |             visit[vec[y][i]]=1;
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [100005]'
    6 | bool visit[100005];
      |      ^~~~~
Language: C++

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    to[u].push_back({v, w});
    to[v].push_back({u, w});
  }
   //bfs
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        int d = dist[v];
        for (auto p : to[v]) {
            if (visited[p.first]){ continue;}
            dist[p.first] =  d+p.second;
            que.push(p.first);
            visited[p.first] = true;
        }
    }
  for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> N;
      |   ^~~
a.cc:8:5: error: 'to' was not declared in this scope
    8 |     to[u].push_back({v, w});
      |     ^~
a.cc:12:5: error: 'queue' was not declared in this scope
   12 |     queue<int> que;
      |     ^~~~~
a.cc:12:11: error: expected primary-expression before 'int'
   12 |     queue<int> que;
      |           ^~~
a.cc:13:5: error: 'que' was not declared in this scope
   13 |     que.push(0);
      |     ^~~
a.cc:17:17: error: 'dist' was not declared in this scope
   17 |         int d = dist[v];
      |                 ^~~~
a.cc:18:23: error: 'to' was not declared in this scope
   18 |         for (auto p : to[v]) {
      |                       ^~
a.cc:19:17: error: 'visited' was not declared in this scope
   19 |             if (visited[p.first]){ continue;}
      |                 ^~~~~~~
a.cc:22:13: error: 'visited' was not declared in this scope
   22 |             visited[p.first] = true;
      |             ^~~~~~~
a.cc:25:31: error: 'cout' was not declared in this scope
   25 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                               ^~~~
a.cc:25:39: error: 'dist' was not declared in this scope
   25 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                                       ^~~~
a.cc:25:54: error: 'endl' was not declared in this scope
   25 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                                                      ^~~~
Language: C++

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    to[u].push_back({v, w});
    to[v].push_back({u, w});
  }
   //bfs
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        int d = 0;
        for (auto p : to[v]) {
            if (visited[p.first]) continue;
            d+=p.second;
            dist[p.first] = d;
            que.push(p.first);
            visited[p.first] = true;
        }
    }
  for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> N;
      |   ^~~
a.cc:8:5: error: 'to' was not declared in this scope
    8 |     to[u].push_back({v, w});
      |     ^~
a.cc:12:5: error: 'queue' was not declared in this scope
   12 |     queue<int> que;
      |     ^~~~~
a.cc:12:11: error: expected primary-expression before 'int'
   12 |     queue<int> que;
      |           ^~~
a.cc:13:5: error: 'que' was not declared in this scope
   13 |     que.push(0);
      |     ^~~
a.cc:18:23: error: 'to' was not declared in this scope
   18 |         for (auto p : to[v]) {
      |                       ^~
a.cc:19:17: error: 'visited' was not declared in this scope
   19 |             if (visited[p.first]) continue;
      |                 ^~~~~~~
a.cc:21:13: error: 'dist' was not declared in this scope
   21 |             dist[p.first] = d;
      |             ^~~~
a.cc:23:13: error: 'visited' was not declared in this scope
   23 |             visited[p.first] = true;
      |             ^~~~~~~
a.cc:26:31: error: 'cout' was not declared in this scope
   26 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                               ^~~~
a.cc:26:39: error: 'dist' was not declared in this scope
   26 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                                       ^~~~
a.cc:26:54: error: 'endl' was not declared in this scope
   26 |   for (int i = 0; i < N; i++) cout << dist[i] % 2 << endl;
      |                                                      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main() {
  int n;
  cin>>n;
  vector<vector<int>>we(n+1,vector<int>(n+1));
  vector<vector<int>>ue(n+1);
  for(int i=1;i<=n;i++){
    int u,v,w;
    cin>>u>>v>>w;
    ue[v].push_back(u);
    ue[u].push_back(v);
    we[u][v]=w;
    we[v][u]=w;
  }
  queue<int>q;
  q.push(1);
  vector<int>l(n+1);
  vector<bool>c(n+1);
  c[1]=true;
  while(!q.empty()){
    int x=q.front();
    q.pop();
    for(int i=0;i<ue[x].size();i++){
      int y=ue[x][i];
      if(!c[y]){
        q.push(y);
        l[y]=l[x]+we[x][y];
        c[y]=true;
      }
    }
  }
  for(int i=1;i<=n;i++){
    cout<<l[i]%2<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    vector<vector<pair<int,int> > > 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});
    }
    vl dists(n,L_INF);
    queue<pair<int,int> > que; //ノード, 総距離
    que.push({0, 0});
    dists[0] = 0;
    while(!que.empty()){
        int node = que.front().first;
        int dist = que.front().second;
        que.pop();
        for(auto nv:g[node]){
            int n_node = nv.first;
            if(dists[n_node] == L_INF){
                dists[n_node] = dist + nv.second;
                que.push({n_node, dist + nv.second});
            }
        }
    }
    rep(i,n){
        out(dists[i] % 2);
    }
}

Compiler output:
a.cc:4:13: error: 'long long long' is too long for GCC
    4 | #define int long long
      |             ^~~~
a.cc:14:19: note: in expansion of macro 'int'
   14 | typedef long long int ll;
      |                   ^~~
a.cc:4:18: error: 'long long long' is too long for GCC
    4 | #define int long long
      |                  ^~~~
a.cc:14:19: note: in expansion of macro 'int'
   14 | typedef long long int ll;
      |                   ^~~
a.cc:4:13: error: 'long long long' is too long for GCC
    4 | #define int long long
      |             ^~~~
a.cc:16:28: note: in expansion of macro 'int'
   16 | typedef unsigned long long int ull;
      |                            ^~~
a.cc:4:18: error: 'long long long' is too long for GCC
    4 | #define int long long
      |                  ^~~~
a.cc:16:28: note: in expansion of macro 'int'
   16 | typedef unsigned long long int ull;
      |                            ^~~