Language: C++

#include <bits/stdc++.h>

using namespace std;
int n, m;
vector<int> link(2e5 + 5), size(2e5 + 5, 1);

int find(int a){
	if(link[a] == a) return a;
	return link[a] = find(link[a]);
}


void join(int a, int b){
	if(size[a] < size[b]) swap(a, b);
	size[a] += size[b];
	link[b] = a;
}

int main(){
	cin >> n >> m;
	for(int i = 1; i <= n; ++i) link[i] = i;
	for(int i = 0; i < m; ++i){
		int a, b;
		cin >> a >> b;
		a = find(a); b = find(b);
		if(a!=b) join(a, b);
	}
	cout << *max_element(size.begin(), size.begin() + n + 2);
}

Compiler output:
a.cc:5:17: error: 'std::vector<int> link' redeclared as different kind of entity
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                 ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
  819 | extern int link (const char *__from, const char *__to)
      |            ^~~~
a.cc: In function 'int find(int)':
a.cc:8:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    8 |         if(link[a] == a) return a;
      |                  ^
a.cc:8:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(link[a] == a) return a;
      |            ~~~~~~~~^~~~
a.cc:9:22: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |         return link[a] = find(link[a]);
      |                      ^
a.cc:9:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
    9 |         return link[a] = find(link[a]);
      |                                     ^
a.cc:9:30: error: no matching function for call to 'find(int (&)(const char*, const char*) noexcept)'
    9 |         return link[a] = find(link[a]);
      |                          ~~~~^~~~~~~~~
a.cc:7:5: note: candidate: 'int find(int)' (near match)
    7 | int find(int a){
      |     ^~~~
a.cc:7:5: note:   conversion of argument 1 would be ill-formed:
a.cc:9:37: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'int' [-fpermissive]
    9 |         return link[a] = find(link[a]);
      |                               ~~~~~~^
      |                                     |
      |                                     int (*)(const char*, const char*) noexcept
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:3842:5: note: candidate: 'template<class _IIter, class _Tp> _IIter std::find(_IIter, _IIter, const _Tp&)'
 3842 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:3842:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note:   candidate expects 4 arguments, 1 provided
In file included from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   candidate expects 3 arguments, 1 provided
a.cc: In function 'void join(int, int)':
a.cc:14:12: error: reference to 'size' is ambiguous
   14 |         if(size[a] < size[b]) swap(a, 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:
/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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~
a.cc:14:22: error: reference to 'size' is ambiguous
   14 |         if(size[a] < size[b]) swap(a, 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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~
a.cc:15:9: error: reference to 'size' is ambiguous
   15 |         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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~
a.cc:15:20: error: reference to 'size' is ambiguous
   15 |         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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~
a.cc:16:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |         link[b] = a;
      |               ^
a.cc:16:17: error: assignment of read-only location '*(link + ((sizetype)b))'
   16 |         link[b] = a;
      |         ~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:21:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   21 |         for(int i = 1; i <= n; ++i) link[i] = i;
      |                                           ^
a.cc:21:45: error: assignment of read-only location '*(link + ((sizetype)i))'
   21 |         for(int i = 1; i <= n; ++i) link[i] = i;
      |                                     ~~~~~~~~^~~
a.cc:28:30: error: reference to 'size' is ambiguous
   28 |         cout << *max_element(size.begin(), size.begin() + n + 2);
      |                              ^~~~
/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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~
a.cc:28:44: error: reference to 'size' is ambiguous
   28 |         cout << *max_element(size.begin(), size.begin() + n + 2);
      |                                            ^~~~
/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:5:28: note:                 'std::vector<int> size'
    5 | vector<int> link(2e5 + 5), size(2e5 + 5, 1);
      |                            ^~~~