Language: C++

#include <bits/stdc++.h>
using namespace std;

const int N = int(1e6) + 5;
int size[N], root[N];
int n;

void Init() {
    for (int i=1; i<=n; i++) {
        size[i] = 1;
        root[i] = i;
    }
}

int GetRoot(int x) {
    while (root[x] != x) {
        root[x] = root[root[x]];
        x = root[x];
    }
    return x;
}

int Union(int a, int b) {
    int ra = GetRoot(a), rb = GetRoot(b);
    if (ra == rb) return 0;
    else {
        if (size[ra] < size[rb]) {
            root[ra] = root[rb];
            size[rb] += size[ra];
        } else {
            root[rb] = root[ra];
            size[ra] += size[rb];
        }
        return 1;
    }
}


void solve() {
    cin >> n;
    Init();
    int m;
    cin >> m;
    for (int a,b; m; m--) {
        cin >> a >> b;
        Union(a, b);
    }
    cout << *max_element(size+1, size + n+1) << '\n';
}

int main() {
    solve();
}

Compiler output:
a.cc: In function 'void Init()':
a.cc:10:9: error: reference to 'size' is ambiguous
   10 |         size[i] = 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:5:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc: In function 'int Union(int, int)':
a.cc:27:13: error: reference to 'size' is ambiguous
   27 |         if (size[ra] < size[rb]) {
      |             ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:27:24: error: reference to 'size' is ambiguous
   27 |         if (size[ra] < size[rb]) {
      |                        ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:29:13: error: reference to 'size' is ambiguous
   29 |             size[rb] += size[ra];
      |             ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:29:25: error: reference to 'size' is ambiguous
   29 |             size[rb] += size[ra];
      |                         ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:32:13: error: reference to 'size' is ambiguous
   32 |             size[ra] += size[rb];
      |             ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:32:25: error: reference to 'size' is ambiguous
   32 |             size[ra] += size[rb];
      |                         ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc: In function 'void solve()':
a.cc:48:26: error: reference to 'size' is ambiguous
   48 |     cout << *max_element(size+1, size + n+1) << '\n';
      |                          ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~
a.cc:48:34: error: reference to 'size' is ambiguous
   48 |     cout << *max_element(size+1, size + n+1) << '\n';
      |                                  ^~~~
/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:5: note:                 'int size [1000005]'
    5 | int size[N], root[N];
      |     ^~~~