Language: C++

#include<bits/stdc++.h>
#define ll long long
#define MAX 1000005
#define MOD (ll)(1e9+7)
#define ex(k) (a*(b-n)+(a-b)*(k)-(k)*(k))
using namespace std;

int dsu[MAX];
int size[MAX];

int search(int a)   {
    if(dsu[a]==a)   return a;
    return dsu[a]=search(dsu[a]);
}

void join(int a, int b)  {
    a = search(a);
    b = search(b);
    if(size[a]>size[b]) {
        dsu[b]=a;
        size[a]+=size[b];
    }
    else {
        dsu[a]=b;
        size[b]+=size[a];
    }
}

void solve()	{
    int n,m;
    cin >> n >> m;
    for(int i=1; i<=n; i++) {
        dsu[i]=i;
        size[i]=1;
    }
    while(m--)  {
        int x,y;
        cin >> x >> y;
        if(search(x)!=search(y))    join(x,y);
    }
    int ans=-1;
    for(int i=1; i<=n; i++) {
        ans=max(ans,size[search(i)]);
    }
    cout << ans << endl;
}

int main()	
{
	int t=1;
	//cin >> t;
	for(int i=1; i<=t; i++)	{
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void join(int, int)':
a.cc:19:8: error: reference to 'size' is ambiguous
   19 |     if(size[a]>size[b]) {
      |        ^~~~
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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:19:16: error: reference to 'size' is ambiguous
   19 |     if(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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:21:9: error: reference to 'size' is ambiguous
   21 |         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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:21:18: error: reference to 'size' is ambiguous
   21 |         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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:25:9: error: reference to 'size' is ambiguous
   25 |         size[b]+=size[a];
      |         ^~~~
/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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:25:18: error: reference to 'size' is ambiguous
   25 |         size[b]+=size[a];
      |                  ^~~~
/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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc: In function 'void solve()':
a.cc:34:9: error: reference to 'size' is ambiguous
   34 |         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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~
a.cc:43:21: error: reference to 'size' is ambiguous
   43 |         ans=max(ans,size[search(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:9:5: note:                 'int size [1000005]'
    9 | int size[MAX];
      |     ^~~~