Language: C++

#include <bits/stdc++.h>

using namespace std;

const int MAX = 2 * 1000 * 100 + 11;
int parent[MAX];
int size[MAX];
int n, m;

void make_set(int node) {
	parent[node] = node;
	size[node] = 1;
}

int find_parent(int node) {
	if(node == parent[node]) {
		return node;
	}
	
	return parent[node] = find_parent(parent[node]);
}

int union_set(int firstNode, int secondNode) {
	int parentOfFirstNode = find_parent(firstNode);
	int parentOfSecondNode = find_parent(secondNode);
	
	if(parentOfFirstNode != parentOfSecondNode) {
		if(size[parentOfFirstNode] < size[parentOfSecondNode])
			swap(parentOfFirstNode, parentOfSecondNode);
		
		parent[parentOfSecondNode] = parentOfFirstNode;
		
		size[parentOfSecondNode] += size[parentOfFirstNode];
	}
}

map<int, int> mp;

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++) {
		make_set(i);
	}
	
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		union_set(x, y);
	}
	
	for(int i = 1; i <= n; i++) {
		int parentOfNodeI = find_parent(i);
		mp[parentOfNodeI]++;
	}
	
	int res = 0;
	for(auto it: mp) {
		res = max(res, it.second);
	}
	
	cout << res;
	return 0;
}


Compiler output:
a.cc: In function 'void make_set(int)':
a.cc:12:9: error: reference to 'size' is ambiguous
   12 |         size[node] = 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:7:5: note:                 'int size [200011]'
    7 | int size[MAX];
      |     ^~~~
a.cc: In function 'int union_set(int, int)':
a.cc:28:20: error: reference to 'size' is ambiguous
   28 |                 if(size[parentOfFirstNode] < size[parentOfSecondNode])
      |                    ^~~~
/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:7:5: note:                 'int size [200011]'
    7 | int size[MAX];
      |     ^~~~
a.cc:28:46: error: reference to 'size' is ambiguous
   28 |                 if(size[parentOfFirstNode] < size[parentOfSecondNode])
      |                                              ^~~~
/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:7:5: note:                 'int size [200011]'
    7 | int size[MAX];
      |     ^~~~
a.cc:33:17: error: reference to 'size' is ambiguous
   33 |                 size[parentOfSecondNode] += size[parentOfFirstNode];
      |                 ^~~~
/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:7:5: note:                 'int size [200011]'
    7 | int size[MAX];
      |     ^~~~
a.cc:33:45: error: reference to 'size' is ambiguous
   33 |                 size[parentOfSecondNode] += size[parentOfFirstNode];
      |                                             ^~~~
/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:7:5: note:                 'int size [200011]'
    7 | int size[MAX];
      |     ^~~~
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^