Language: C++

#include <iostream>
#include <vector>
#include <set>

using namespace std;

#define MAXN 200005

int N, M;
vector<int> parent;
vector<int> size;

void init()
{
    parent.assign(N+1, 1);
    size.assign(N+1, 1);
    for (int i = 1; i <= N; i++) {
        parent[i] = i;
    }
}

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

bool same(int u, int v)
{
    return find(u) == find(v);
}

void join(int u, int v)
{
    u = find(u);
    v = find(v);
    
    if (u == v)
        return;
    
    if (size[u] > size[v])
        swap(u, v);
    
    parent[u] = v;
    size[v] += size[u];
}

int main()
{
    cin >> N >> M;
    init();
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        join(a, b);
    }
    set<int, greater<int> > s;
    for (int i = 1; i <= N; i++) {
        s.insert(size[i]);
    }
    cout << *s.begin() << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:16:5: error: reference to 'size' is ambiguous
   16 |     size.assign(N+1, 1);
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~
a.cc: In function 'void join(int, int)':
a.cc:43:9: error: reference to 'size' is ambiguous
   43 |     if (size[u] > size[v])
      |         ^~~~
/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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~
a.cc:43:19: error: reference to 'size' is ambiguous
   43 |     if (size[u] > size[v])
      |                   ^~~~
/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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~
a.cc:47:5: error: reference to 'size' is ambiguous
   47 |     size[v] += size[u];
      |     ^~~~
/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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~
a.cc:47:16: error: reference to 'size' is ambiguous
   47 |     size[v] += size[u];
      |                ^~~~
/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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~
a.cc: In function 'int main()':
a.cc:61:18: error: reference to 'size' is ambiguous
   61 |         s.insert(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:11:13: note:                 'std::vector<int> size'
   11 | vector<int> size;
      |             ^~~~