Language: C++

#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n;
  cin >> n;
  vector<int> tree(n,0);
  tree.at(0)=1;
  vector<pair<int,int>> bridge;
  for(int i=0; i<n-1; i++){
    int x,y;
    cin >> x >> y;
    if(x >= y){
      bridge.at(i).first=x;
      bridge.at(i).second=y;
    }
    else{
      bridge.at(i).first=y;
      bridge.at(i).second=x;
    }
  sort(pair.begin(),pair.end());
  for(int i=0; i<n-1; i++){
    if(tree.at(bridge.first)==1) tree.at(bridge.second)==0;
    else tree.at(bridge.second)=1;
  }
  int count=0;
  vector<int> zyunretu;
  for(int i=0; i<n; i++){
    if(tree.at(i)==1) count++;
  }
  if(count >= n*2/3){
    int count2=0;
    int count3=0;
    for(int i=0; i<n; i++){
      if(tree.at(i)==0){
      zyunretu.at(3*count2)=i;
      count2++;
      }
    else{
      zyunretu.at(count3+count3/3+1)=i
      count3++;
    }
   if(count <= n*1/3){
    int count2=0;
    int count3=0;
    for(int i=0; i<n; i++){
      if(tree.at(i)==1){
      zyunretu.at(3*count2)=i;
      count2++;
      }
    else{
      zyunretu.at(count3+count3/3+1)=i
      count3++;
    }
    }
 
      
  




Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: missing template arguments before '.' token
   21 |   sort(pair.begin(),pair.end());
      |            ^
a.cc:21:25: error: missing template arguments before '.' token
   21 |   sort(pair.begin(),pair.end());
      |                         ^
a.cc:23:23: error: 'class std::vector<std::pair<int, int> >' has no member named 'first'
   23 |     if(tree.at(bridge.first)==1) tree.at(bridge.second)==0;
      |                       ^~~~~
a.cc:23:49: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   23 |     if(tree.at(bridge.first)==1) tree.at(bridge.second)==0;
      |                                                 ^~~~~~
a.cc:24:25: error: 'class std::vector<std::pair<int, int> >' has no member named 'second'
   24 |     else tree.at(bridge.second)=1;
      |                         ^~~~~~
a.cc:40:39: error: expected ';' before 'count3'
   40 |       zyunretu.at(count3+count3/3+1)=i
      |                                       ^
      |                                       ;
   41 |       count3++;
      |       ~~~~~~                           
a.cc:52:39: error: expected ';' before 'count3'
   52 |       zyunretu.at(count3+count3/3+1)=i
      |                                       ^
      |                                       ;
   53 |       count3++;
      |       ~~~~~~                           
a.cc:55:6: error: expected '}' at end of input
   55 |     }
      |      ^
a.cc:43:22: note: to match this '{'
   43 |    if(count <= n*1/3){
      |                      ^
a.cc:55:6: error: expected '}' at end of input
   55 |     }
      |      ^
a.cc:34:27: note: to match this '{'
   34 |     for(int i=0; i<n; i++){
      |                           ^
a.cc:55:6: error: expected '}' at end of input
   55 |     }
      |      ^
a.cc:31:21: note: to match this '{'
   31 |   if(count >= n*2/3){
      |                     ^
a.cc:55:6: error: expected '}' at end of input
   55 |     }
      |      ^
a.cc:10:27: note: to match this '{'
   10 |   for(int i=0; i<n-1; i++){
      |                           ^
a.cc:55:6: error: expected '}' at end of input
   55 |     }
      |      ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^