Language: C++

#include<iostream>

using namespace std;

#define MAX_N 10000

int par[MAX_N]; // ???
int rank[MAX_N]; // ??¨?????±???
// ?????????
void init(int n){
  for(int i = 0; i < n; i++){
    par[i] = i;
    rank[i] = 0;
  }
}
// ??¨??????????±???????
int find(int x){
  if(par(x) == x)
    return x;
  else
    return par[x] = find(par[x]);
}
// x??¨y????±??????????????????????
void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x == y) return;
  
  // ??¨??????????????????????????£??¨??????????????????
  if(rank[x] < rank[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(rank[x] == rank[y]) rank[x]++;
  }
}
// x??¨y?????????????????????true
bool same(int x,int y){
  return find(x) == find(y);
}

int main(){

  int n,q;
  cin >> n >> q;
  init(n);
  bool t[n];
  for(int i = 0;i < q;i++){
    int a,x,y;
    cin >> a;
    if(a == 1){
      unite(x,y);
    }
    else{
      bool u;
      u = same(x,y);
      if(u = true){
	cout << 1 << endl;
      }
      else{
	cout << 0 << endl;
      }
    }
  }

  

}

Compiler output:
a.cc: In function 'void init(int)':
a.cc:13:5: error: reference to 'rank' is ambiguous
   13 |     rank[i] = 0;
      |     ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
                 from /usr/include/c++/14/bits/exception_ptr.h:41,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc: In function 'int find(int)':
a.cc:18:9: error: 'par' cannot be used as a function
   18 |   if(par(x) == x)
      |      ~~~^~~
a.cc: In function 'void unite(int, int)':
a.cc:30:6: error: reference to 'rank' is ambiguous
   30 |   if(rank[x] < rank[y]){
      |      ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc:30:16: error: reference to 'rank' is ambiguous
   30 |   if(rank[x] < rank[y]){
      |                ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc:34:8: error: reference to 'rank' is ambiguous
   34 |     if(rank[x] == rank[y]) rank[x]++;
      |        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc:34:19: error: reference to 'rank' is ambiguous
   34 |     if(rank[x] == rank[y]) rank[x]++;
      |                   ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc:34:28: error: reference to 'rank' is ambiguous
   34 |     if(rank[x] == rank[y]) rank[x]++;
      |                            ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:8:5: note:                 'int rank [10000]'
    8 | int rank[MAX_N]; // ??¨?????±???
      |     ^~~~
a.cc: In function 'int find(int)':
a.cc:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^