Language: C++

#include <bits/stdc++.h>
using namespace std;
void dfs( vector<vector<vector<int>>> &G, vector<int> &co,int v,vector<long long> &ee){
  if(G[v].size()==0)
  for(auto s:G[v]){
    if(co[v]!=-1) continue;
    ee[s[0]]=ee[v];
    ee[s[0]]+=s[1];
    if(ee[s[0]]%2==0) co[s[0]]=0;
    else co[s[0]]=1;
    dfs(G,co,s[0],ee);
  }
}
    

int main() {
  int n;
  cin>>n;
  vector<long long> ee(n);
  vector<int> co(n,-1);
  co[0]=0;
  vector<vector<vector<int>>> G(n,vector<vector<int>> (0,vector<int> (1)));
  for(int i=0;i<n-1;i++){
    int a,s,d;
    cin>>a>>s>>d;
    vector<vector<int>> dd(1)={{s-1,d}};
    vector<vector<int>> ad(1)={{a-1,d}};
    G[a-1].push_back(dd);
    G[s-1].push_back(ad);
  }
  dfs(G,co,0,ee);
  for(int i=0;i<n;i++){
    cout<<co[i]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:30: error: expected ',' or ';' before '=' token
   26 |     vector<vector<int>> dd(1)={{s-1,d}};
      |                              ^
a.cc:27:30: error: expected ',' or ';' before '=' token
   27 |     vector<vector<int>> ad(1)={{a-1,d}};
      |                              ^
a.cc:28:21: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(std::vector<std::vector<int> >&)'
   28 |     G[a-1].push_back(dd);
      |     ~~~~~~~~~~~~~~~~^~~~
In file included from /usr/include/c++/14/vector:66,
                 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_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:29:21: error: no matching function for call to 'std::vector<std::vector<int> >::push_back(std::vector<std::vector<int> >&)'
   29 |     G[s-1].push_back(ad);
      |     ~~~~~~~~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; value_type = std::vector<int>]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<int> >::value_type&&' {aka 'std::vector<int>&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~