Language: C++

#include<bits/stdc++.h>

using namespace std;

const int N=2e5+10;
int parent[N],size[N],n,m;

int find(int x);
void unionvertices(int x,int y);


int main()
{
	scanf("%d %d",&n,&m);
	for (int i=1;i<=n;i++)
	{
		size[i]=1;
		parent[i]=i;
	}
	int x,y,ans=0;
	for (int i=1;i<=m;i++)
	{
		scanf("%d %d",&x,&y);
		unionvertices(x,y);
	}
	for (int i=1;i<=n;i++)
	{
		if (find(i)==i)   ans=max(ans,size[i]);
	}
	printf("%d",ans);
	return 0;
} 

int find(int x)
{
	while (x!=parent[x])
	{
		x=parent[x];
	}
	return x;
}
void unionvertices(int x,int y)
{
	x=parent[x];
	y=parent[y];
	if (x!=y)
	{
		parent[y]=x;
		size[x]+=size[y];
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: reference to 'size' is ambiguous
   17 |                 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:6:15: note:                 'int size [200010]'
    6 | int parent[N],size[N],n,m;
      |               ^~~~
a.cc:28:47: error: reference to 'size' is ambiguous
   28 |                 if (find(i)==i)   ans=max(ans,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:6:15: note:                 'int size [200010]'
    6 | int parent[N],size[N],n,m;
      |               ^~~~
a.cc: In function 'void unionvertices(int, int)':
a.cc:49:17: error: reference to 'size' is ambiguous
   49 |                 size[x]+=size[y];
      |                 ^~~~
/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:6:15: note:                 'int size [200010]'
    6 | int parent[N],size[N],n,m;
      |               ^~~~
a.cc:49:26: error: reference to 'size' is ambiguous
   49 |                 size[x]+=size[y];
      |                          ^~~~
/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:6:15: note:                 'int size [200010]'
    6 | int parent[N],size[N],n,m;
      |               ^~~~