Language: C++

#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

lli par[200001],size[200001];

lli find(lli a)
{
	if(par[a]<0)
		return a;
	return par[a]=find(par[a]);
}

void Union(lli a,lli b)
{
	par[b]=a;
	size[a]+=size[b];
}

int main()
{
	fastio;
	lli n,m,i,j,a,b,one=0,ans=0;
	map<lli,lli> mp;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		par[i]=-1, size[i]=1;
	for(i=0;i<m;i++)
	{
		cin>>a>>b;
		a=find(a);
		b=find(b);
		if(a!=b)
		{
			Union(a,b);
		}
	}
//	for(i=1;i<=n;i++)
//		cout<<par[i]<<" ";
//	cout<<endl;
//	for(i=1;i<=n;i++)
//		cout<<size[i]<<' ';
//	cout<<endl;
	for(i=1;i<=n;i++)
	{
		if(par[i]==-1 && size[i]>1)
			mp[size[i]]++;
		else if(size[i]==1)
			one++;
	}
	for(auto it : mp)
	{
		ans=max(ans,it.first);
//		cout<<it.first<<" "<<it.second<<endl;	
	}
	if(one==n)
		cout<<1;
	else
		cout<<ans;	
	return 0;
}


Compiler output:
a.cc: In function 'void Union(long long int, long long int)':
a.cc:23:9: error: reference to 'size' is ambiguous
   23 |         size[a]+=size[b];
      |         ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~
a.cc:23:18: error: reference to 'size' is ambiguous
   23 |         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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:33:28: error: reference to 'size' is ambiguous
   33 |                 par[i]=-1, size[i]=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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~
a.cc:52:34: error: reference to 'size' is ambiguous
   52 |                 if(par[i]==-1 && size[i]>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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~
a.cc:53:28: error: reference to 'size' is ambiguous
   53 |                         mp[size[i]]++;
      |                            ^~~~
/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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~
a.cc:54:25: error: reference to 'size' is ambiguous
   54 |                 else if(size[i]==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:11:17: note:                 'long long int size [200001]'
   11 | lli par[200001],size[200001];
      |                 ^~~~