Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <tuple>

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

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

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

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

  priority_queue<Edge<T>, vector<Edge<T>>, greater<Edge<T>>> 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(const Edge<T> &e : edges[now.to]) {
      T tmp_cost = now.cost + e.cost;
      if (dist[e.to] > tmp_cost) {
        dist[e.to] = tmp_cost;
        p_que.emplace(e.to, dist[e.to]);
      }
    }
  }

  return dist;
}

int main() {
  cin.tie(0);
  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;
    u--;v--;
    edges[u].emplace_back(make_pair(v,len));
    edges[v].emplace_back(make_pair(u,len));
  }

  auto ans = Dijkstra<int>(edges, 0);

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

Compiler output:
a.cc:14:1: error: expected ',' or ';' before 'using'
   14 | using namespace std;
      | ^~~~~
a.cc:27:1: error: 'vector' does not name a type
   27 | vector<T> Dijkstra(vector<vector<Edge<T>>> &edges, int st) {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:57:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   57 |   cin.tie(0);
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:58:3: error: 'ios' has not been declared
   58 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:63:3: error: 'vector' was not declared in this scope
   63 |   vector<vector<Edge<int> > > edges(N);
      |   ^~~~~~
a.cc:63:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:63:27: error: expected primary-expression before '>' token
   63 |   vector<vector<Edge<int> > > edges(N);
      |                           ^
a.cc:63:29: error: expected primary-expression before '>' token
   63 |   vector<vector<Edge<int> > > edges(N);
      |                             ^
a.cc:63:31: error: 'edges' was not declared in this scope
   63 |   vector<vector<Edge<int> > > edges(N);
      |                               ^~~~~
a.cc:68:27: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   68 |     edges[u].emplace_back(make_pair(v,len));
      |                           ^~~~~~~~~
      |                           std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:72:14: error: 'Dijkstra' was not declared in this scope
   72 |   auto ans = Dijkstra<int>(edges, 0);
      |              ^~~~~~~~
a.cc:72:23: error: expected primary-expression before 'int'
   72 |   auto ans = Dijkstra<int>(edges, 0);
      |                       ^~~
a.cc:76:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   76 |       cout<<1<<"\n";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:78:7: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   78 |       cout<<0<<"\n";
      |       ^~~~
      |       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~