Language: C++

#include<iostream>
#define n_max 1e5
using namespace std;
int find(int);
int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];

bool same(int x,int y){
  return find(x) == find(y);
}

void unite(int x,int y){
  
  x= find(x);
  y= find(y);
  

  if(rank[x] > rank[y]){
    par[y] = x;
  }
  else {
    par[x] = y;
    if(rank[x] == rank[y]) rank[y]++;
  }

}


int find(int x){
  if(x != par[x]){
    par[x] = find(par[x]);
  }
  return par[x];
}

int main(){
  
  int n,q;
  cin >>n>>q;
  
  for(int i=0;i<n;i++){
    par[i]=i;
    rank[i]=0;
  }
  
  for(int i=0;i<q;i++){
    cin >>com[i]>>x[i]>>y[i];

    if(com[i]){
      same(x[i],y[i]);
      cout <<same(x[i],y[i])<<endl;
    }
    else{
      unite(x[i],y[i]);
    }
    
    
  }


 
  
}

Compiler output:
a.cc:2:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:9: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |         ^~~~~
a.cc:2:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    2 | #define n_max 1e5
      |               ^~~
      |               |
      |               double
a.cc:5:9: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |         ^~~~~
a.cc:2:15: error: size of array 'com' has non-integral type 'double'
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:9: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |         ^~~~~
a.cc:2:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:18: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                  ^~~~~
a.cc:2:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    2 | #define n_max 1e5
      |               ^~~
      |               |
      |               double
a.cc:5:18: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                  ^~~~~
a.cc:2:15: error: size of array 'x' has non-integral type 'double'
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:18: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                  ^~~~~
a.cc:2:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:27: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                           ^~~~~
a.cc:2:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    2 | #define n_max 1e5
      |               ^~~
      |               |
      |               double
a.cc:5:27: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                           ^~~~~
a.cc:2:15: error: size of array 'y' has non-integral type 'double'
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:27: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                           ^~~~~
a.cc:2:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:38: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                      ^~~~~
a.cc:2:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    2 | #define n_max 1e5
      |               ^~~
      |               |
      |               double
a.cc:5:38: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                      ^~~~~
a.cc:2:15: error: size of array 'par' has non-integral type 'double'
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:38: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                      ^~~~~
a.cc:2:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:50: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                                  ^~~~~
a.cc:2:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    2 | #define n_max 1e5
      |               ^~~
      |               |
      |               double
a.cc:5:50: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                                  ^~~~~
a.cc:2:15: error: size of array 'rank' has non-integral type 'double'
    2 | #define n_max 1e5
      |               ^~~
a.cc:5:50: note: in expansion of macro 'n_max'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                                  ^~~~~
a.cc: In function 'void unite(int, int)':
a.cc:17:6: error: reference to 'rank' is ambiguous
   17 |   if(rank[x] > rank[y]){
      |      ^~~~
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:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~
a.cc:17:16: error: reference to 'rank' is ambiguous
   17 |   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:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~
a.cc:22:8: error: reference to 'rank' is ambiguous
   22 |     if(rank[x] == rank[y]) rank[y]++;
      |        ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~
a.cc:22:19: error: reference to 'rank' is ambiguous
   22 |     if(rank[x] == rank[y]) rank[y]++;
      |                   ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~
a.cc:22:28: error: reference to 'rank' is ambiguous
   22 |     if(rank[x] == rank[y]) rank[y]++;
      |                            ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~
a.cc: In function 'int main()':
a.cc:42:5: error: reference to 'rank' is ambiguous
   42 |     rank[i]=0;
      |     ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
 1437 |     struct rank
      |            ^~~~
a.cc:5:45: note:                 'int rank [1]'
    5 | int com[n_max],x[n_max],y[n_max],par[n_max],rank[n_max];
      |                                             ^~~~