Language: C++

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, n) for(int i = 0; i < (int) n; i++)
#define PB push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

const int MAX = 10000007;

int parent[200007];
int size[200007];

int find(int x){
	if(x == parent[x]) return x;
	return parent[x] = find(parent[x]);
}

void join(int a, int b){
	a = find(a);
	b = find(b);

	if(a != b){
		if(size[a] > size[b])
			swap(a, b);

		parent[a] = b;
		if(size[a] == size[b])
			size[b]++;
	}
}

int main(){
	ios::sync_with_stdio(false); cin.tie(0);

	int n, m; cin >> n >> m;

	FOR(i, n) parent[i] = i, size[i] = 1;

	FOR(i, m){
		int a, b; cin >> a >> b;
		a--; b--;
		join(a, b);
	}

	vi cnt(n+1, 0);
	int ans = 0;
	FOR(i, n){
		int p = find(i);
		cnt[p]++;
		ans = max(ans, cnt[p]);
	}

	cout << ans << '\n';

	return 0;
}


Compiler output:
a.cc: In function 'void join(int, int)':
a.cc:31:20: error: reference to 'size' is ambiguous
   31 |                 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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~
a.cc:31:30: error: reference to 'size' is ambiguous
   31 |                 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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~
a.cc:35:20: error: reference to 'size' is ambiguous
   35 |                 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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~
a.cc:35:31: error: reference to 'size' is ambiguous
   35 |                 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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~
a.cc:36:25: error: reference to 'size' is ambiguous
   36 |                         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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:45:34: error: reference to 'size' is ambiguous
   45 |         FOR(i, n) parent[i] = i, 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:19:5: note:                 'int size [200007]'
   19 | int size[200007];
      |     ^~~~