Language: C++

/*
BY: SAFWAAN SHAIKH
PROBLEM: https://atcoder.jp/contests/abc177/tasks/abc177_d
KEY IDEAS: Graphs, Connected Components
TIME COMPLEXITY: 
*/

#define r(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
#include <bits/stdc++.h>
#define f first
#define endl "\n"
#define s second
#define pb push_back
#define ms(a,b) memset(a,b,sizeof(a))
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
char _;

int n,m,a,b;
int ans=0;
int root[200001],size[200001];

int find_root(int v){
	if(v==root[v]){
		return v;
	}
	return root[v] = find_root(root[v]);
}

void unite(int x,int y){
	x = find_root(x);
	y = find_root(y);
	if(x!=y){
		if(size[x] < size[y]) swap(x,y);
		size[x]+=size[y];
		root[y]=x;
	}
}

int main(){
//	freopen("problemname.in", "r", stdin);
//  freopen("problemname.out", "w", stdout);
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);	
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		size[i]=1;root[i]=i;
	}
	for(int i=0;i<m;i++){
		cin>>a>>b;
		unite(a,b);
	}
	for(int i=1;i<=m;i++)ans = max(ans,size[i]);
	
	cout << ans << endl;
	return 0;
}



Compiler output:
a.cc: In function 'void unite(int, int)':
a.cc:38:20: error: reference to 'size' is ambiguous
   38 |                 if(size[x] < size[y]) swap(x,y);
      |                    ^~~~
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:9:
/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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~
a.cc:38:30: error: reference to 'size' is ambiguous
   38 |                 if(size[x] < size[y]) swap(x,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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~
a.cc:39:17: error: reference to 'size' is ambiguous
   39 |                 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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~
a.cc:39:26: error: reference to 'size' is ambiguous
   39 |                 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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:51:17: error: reference to 'size' is ambiguous
   51 |                 size[i]=1;root[i]=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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~
a.cc:57:44: error: reference to 'size' is ambiguous
   57 |         for(int i=1;i<=m;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:25:18: note:                 'int size [200001]'
   25 | int root[200001],size[200001];
      |                  ^~~~