Language: C++

#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <functional>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
typedef long long lint;

template<class T = lint>
struct Edge {
	int to;
	T cost;
	Edge() {}
	Edge(int to, int cost) : to(to), cost(cost) {}
	bool operator>(const Edge &r) const { return cost > r.cost; }
};

template<class T = lint>
vector<T> Dijkstra(vector<vector<Edge<T>>> &edges, int st) {

	int V = (int)edges.size();
	const int INF = numeric_limits<int >::max();
	vector<T> dist(V, INF);
	dist[st] = 0;

	priority_queue<Edge, vector<Edge>, greater<Edge>> p_que;
	p_que.emplace(dist[st], st);

	while (!p_que.empty()) {

		Edge<T> now(p_que.top().to, p_que.top().cost);
		p_que.pop();

		if (dist[now.to] < now.cost) continue;
		for (auto &e : edges[now.to]) {
			auto tmp_cost = now.cost + e.cost;
			if (dist[e.to] > tmp_cost) {
				dist[e.to] = tmp_cost;
				p_que.emplace(dist[e.to], e.to);
			}
		}
	}

	return dist;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	int u, v, len;
	vector<vector<Edge<int>>> edges(N);
	for (int i = 0; i < N - 1; i++) {
		cin >> u >> v >> len;
		edges[u - 1].emplace_back(v - 1, len % 2);
		edges[v - 1].emplace_back(u - 1, len % 2);
	}

	auto ans = Dijkstra(edges, 0);

	for (const auto& i : ans) {
		if (i % 2) cout << '1' << "\n";
		else cout << '0' << "\n";
	}

	return 0;
}


Compiler output:
a.cc: In function 'std::vector<_Tp> Dijkstra(std::vector<std::vector<Edge<T> > >&, int)':
a.cc:39:41: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector'
   39 |         priority_queue<Edge, vector<Edge>, greater<Edge>> p_que;
      |                                         ^
a.cc:39:41: note:   expected a type, got 'Edge'
a.cc:39:41: error: template argument 2 is invalid
a.cc:39:52: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp> struct std::greater'
   39 |         priority_queue<Edge, vector<Edge>, greater<Edge>> p_que;
      |                                                    ^~~~
a.cc:39:52: note:   expected a type, got 'Edge'
a.cc:39:56: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Sequence, class _Compare> class std::priority_queue'
   39 |         priority_queue<Edge, vector<Edge>, greater<Edge>> p_que;
      |                                                        ^~
a.cc:39:56: note:   expected a type, got 'Edge'
a.cc:39:56: error: template argument 2 is invalid
a.cc:39:56: error: template argument 3 is invalid
a.cc:40:15: error: request for member 'emplace' in 'p_que', which is of non-class type 'int'
   40 |         p_que.emplace(dist[st], st);
      |               ^~~~~~~
a.cc:42:23: error: request for member 'empty' in 'p_que', which is of non-class type 'int'
   42 |         while (!p_que.empty()) {
      |                       ^~~~~
a.cc:44:35: error: request for member 'top' in 'p_que', which is of non-class type 'int'
   44 |                 Edge<T> now(p_que.top().to, p_que.top().cost);
      |                                   ^~~
a.cc:44:51: error: request for member 'top' in 'p_que', which is of non-class type 'int'
   44 |                 Edge<T> now(p_que.top().to, p_que.top().cost);
      |                                                   ^~~
a.cc:45:23: error: request for member 'pop' in 'p_que', which is of non-class type 'int'
   45 |                 p_que.pop();
      |                       ^~~
a.cc:52:39: error: request for member 'emplace' in 'p_que', which is of non-class type 'int'
   52 |                                 p_que.emplace(dist[e.to], e.to);
      |                                       ^~~~~~~