Language: C++

#include <iostream>
using namespace std;
const int maN = 1e5;
int parent[maN];
int size[maN];
void make_set(int v)
{
    parent[v] = v;
}
int find_set(int v)
{
    if(v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b)
{
    int u = find_set(a);
    int v = find_set(b);
    if(u!=v)
    {
        if(size[u] < size[v])
        {
            // swap(u, v);
            parent[u] = v;
            size[v] += size[u];
        }
        else
        {
            parent[v] = u;
            size[u] += size[v];
        }
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    
    for(int i = 0; i <= n; ++i)
    {
        parent[i] = i;
        size[i] = 1;
    }
    for(int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        union_sets(a, b);
    }
    int max_set = 1;
    for(int i = 0; i < n; ++i)
    {
        // cout << size[i] << " ";
        if(max_set < size[i])
            max_set = size[i]; 
    }
    
    cout << max_set;

	return 0;
}


Compiler output:
a.cc: In function 'void union_sets(int, int)':
a.cc:23:12: error: reference to 'size' is ambiguous
   23 |         if(size[u] < size[v])
      |            ^~~~
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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:23:22: error: reference to 'size' is ambiguous
   23 |         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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:27:13: error: reference to 'size' is ambiguous
   27 |             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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:27:24: error: reference to 'size' is ambiguous
   27 |             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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:32:13: error: reference to 'size' is ambiguous
   32 |             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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:32:24: error: reference to 'size' is ambiguous
   32 |             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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:44:9: error: reference to 'size' is ambiguous
   44 |         size[i] = 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 [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:57:22: error: reference to 'size' is ambiguous
   57 |         if(max_set < 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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~
a.cc:58:23: error: reference to 'size' is ambiguous
   58 |             max_set = 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:5:5: note:                 'int size [100000]'
    5 | int size[maN];
      |     ^~~~