Language: C++

#include<bits/stdc++.h>

using namespace std;
#define llu unsigned long long
#define ll long long
#define p pair<int,int>
#define M 1000000007
//sieve can be used here!
bool isPrime(int n){
	if(n==1)return false;//1 is not prime
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
bool myComp(p a,p b){
	if(a.first==b.first) return a.second<b.second;
	return a.first>b.first;
}
int row[]={-1,0,1,0};
int col[]={0,-1,0,1};
ll squareRoot(ll x){
	ll low=0;
	ll high=x;
	while(low<=high){
		ll mid= low+(high-low)/2;
		if((mid*mid)>x)high=mid-1;
		else if(mid*mid<x)low=mid+1;
		else return mid;
	}
	return low;
}
void dfs(char par,int r,int c,vector<vector<char>>& arr,vector<vector<bool>>& visited){
	int n=arr.size();
	int m=arr[0].size();
	visited[r][c]=true;
	arr[r][c]=par;
	for(int i=0;i<4;i++){
		int newRow=r+row[i];
		int newCol=c+col[i];
		if(newRow>=0&&newRow<n&&newCol>=0&&newCol<m&&!visited[newRow][newCol]&&arr[newRow][newCol]!='-'){
			if(par=='B') dfs('W',newRow,newCol,arr,visited);
			else dfs('B',newRow,newCol,arr,visited);
		}
	}
}
//DSu
int par[200003];
int size[200003];
void initialiseDSU(){
	for(int i=0;i<200003;i++){
		par[i]=i;
		size[i]=1;
	}
}
int find_root(int a){
	if(a==par[a])return a;
	par[a]=find_root(par[a]);
	return par[a];
}
int Union(int a,int b){
	int c=find_root(a);
	int d=find_root(b);
	if(c==d) return size[c];
	if(size[c]>size[d]){
		par[d]=c;
		size[c]+=size[d];
		return size[c];
	}
	else{
		par[c]=d;
		size[d]+=size[c];
		return size[d];
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	initialiseDSU();
	int n,m;
	cin>>n>>m;
	int ans=INT_MIN;
	while(m>0){
		int a,b;
		cin>>a>>b;
		ans=max(ans,Union(a,b));
		m--;
	}
	cout<<ans;
	return 0;
}



Compiler output:
a.cc: In function 'void initialiseDSU()':
a.cc:53:17: error: reference to 'size' is ambiguous
   53 |                 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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc: In function 'int Union(int, int)':
a.cc:64:25: error: reference to 'size' is ambiguous
   64 |         if(c==d) return size[c];
      |                         ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:65:12: error: reference to 'size' is ambiguous
   65 |         if(size[c]>size[d]){
      |            ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:65:20: error: reference to 'size' is ambiguous
   65 |         if(size[c]>size[d]){
      |                    ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:67:17: error: reference to 'size' is ambiguous
   67 |                 size[c]+=size[d];
      |                 ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:67:26: error: reference to 'size' is ambiguous
   67 |                 size[c]+=size[d];
      |                          ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:68:24: error: reference to 'size' is ambiguous
   68 |                 return size[c];
      |                        ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:72:17: error: reference to 'size' is ambiguous
   72 |                 size[d]+=size[c];
      |                 ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:72:26: error: reference to 'size' is ambiguous
   72 |                 size[d]+=size[c];
      |                          ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~
a.cc:73:24: error: reference to 'size' is ambiguous
   73 |                 return size[d];
      |                        ^~~~
/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:49:5: note:                 'int size [200003]'
   49 | int size[200003];
      |     ^~~~