Language: C++

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

int main() {
    int n;cin>>n;
    vector<pair<int,int,>> a[n];
    for (int i=0;i<n-1;i++) {
        int b,c,d;cin>>b>>c>>d;
        a[b-1].push_back({c-1,d});
        a[c-1].push_back({b-1,d});
    }
    ll dist[n]{}
    int vis[n]{};
    queue<int> q;
    q.push(0);
    while (q.size()) {
        int v=q.front();q.pop();
        vis[v]=1;
        for (auto p:a[v])
            if (!vis[p.first]) {
                dist[p.first]=dist[v]+p.second;
                q.push(p.first);
            }
    }
    for (inti i=0;i<n;i++)
        cout<<dist[i]%2<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:24: error: wrong number of template arguments (3, should be 2)
    7 |     vector<pair<int,int,>> a[n];
      |                        ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:7:25: error: template argument 1 is invalid
    7 |     vector<pair<int,int,>> a[n];
      |                         ^~
a.cc:7:25: error: template argument 2 is invalid
a.cc:10:16: error: request for member 'push_back' in 'a[(b - 1)]', which is of non-class type 'int'
   10 |         a[b-1].push_back({c-1,d});
      |                ^~~~~~~~~
a.cc:11:16: error: request for member 'push_back' in 'a[(c - 1)]', which is of non-class type 'int'
   11 |         a[c-1].push_back({b-1,d});
      |                ^~~~~~~~~
a.cc:14:5: error: expected ',' or ';' before 'int'
   14 |     int vis[n]{};
      |     ^~~
a.cc:19:9: error: 'vis' was not declared in this scope
   19 |         vis[v]=1;
      |         ^~~
a.cc:20:24: error: 'begin' was not declared in this scope
   20 |         for (auto p:a[v])
      |                        ^
a.cc:20:24: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:20:24: error: 'end' was not declared in this scope
   20 |         for (auto p:a[v])
      |                        ^
a.cc:20:24: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc:26:10: error: 'inti' was not declared in this scope; did you mean 'int'?
   26 |     for (inti i=0;i<n;i++)
      |          ^~~~
      |          int
a.cc:26:19: error: 'i' was not declared in this scope
   26 |     for (inti i=0;i<n;i++)
      |                   ^