Language: C++

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define f(i,n) for(int i=0;i<n;++i)
typedef vector<int> vi;

//UNION FIND
vi size(200001);
vi par(200001);
void initialize(int n){
    f(i,n){
        par[i]=i;
        size[i]=1;
    }
}
int find_set(int v){
    if(par[v]==v) return v;
    return par[v]=find_set(par[v]);//Does two things, finds parent of currently asked vertex and also makes all vertices in the path connected to the root vertex
    /*Faster Implementation
        while(v!=par[v]){
            par[v]=par[par[v]];
            v=par[v];
        }
        return v;
    *///log*(n))
}
void union_sets(int a,int b){
    a=find_set(a);
    b=find_set(b);
    if(a!=b){
        if(size[a]<size[b])swap(a,b);
        par[b]=a;
        size[a]+=size[b];
    }
}
int main(){
    int n,q;
    cin>>n>>q;
    int z,x,y;
    initialize(n);
    f(i,q){
        cin>>z>>x>>y;
        if(z==0){
            union_sets(x,y);
        }
        else{
            if(find_set(x)==find_set(y))cout<<1<<endl;
            else cout<<0<<endl;
        }
    }


    return 0;
}

Compiler output:
a.cc: In function 'void initialize(int)':
a.cc:13:9: error: reference to 'size' is ambiguous
   13 |         size[i]=1;
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:4: note:                 'vi size'
    8 | vi size(200001);
      |    ^~~~
a.cc: In function 'void union_sets(int, int)':
a.cc:31:12: error: reference to 'size' is ambiguous
   31 |         if(size[a]<size[b])swap(a,b);
      |            ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:4: note:                 'vi size'
    8 | vi size(200001);
      |    ^~~~
a.cc:31:20: error: reference to 'size' is ambiguous
   31 |         if(size[a]<size[b])swap(a,b);
      |                    ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:4: note:                 'vi size'
    8 | vi size(200001);
      |    ^~~~
a.cc:33:9: error: reference to 'size' is ambiguous
   33 |         size[a]+=size[b];
      |         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:4: note:                 'vi size'
    8 | vi size(200001);
      |    ^~~~
a.cc:33:18: error: reference to 'size' is ambiguous
   33 |         size[a]+=size[b];
      |                  ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:4: note:                 'vi size'
    8 | vi size(200001);
      |    ^~~~