Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int size[N], parent[N], ans[N], G[N];
int findSet(int u)
{
    if (u == parent[u]) return u;
    return parent[u] = findSet(parent[u]);
}
void unionSet(int a, int b)
{
    a = findSet(a);
    b = findSet(b);
    if (a == b)
        return;
    if (size[a] < size[b])
        swap(a,b);
    parent[b] = a;
    size[a] += size[b];
}
int main()
{
    int n,m,k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i)
        parent[i] = i,size[i] = 1,ans[i] = 0;
    for (int i = 0; i < m; ++i)
    {
        int u, v;
        cin >> u >> v;
        u --,v --;
        G[u] ++,G[v]++;
        unionSet(u, v);
    }
    for (int i = 0; i < k; ++i)
    {
        int u, v;
        cin >> u >> v;
        u --,v --;
        if (findSet(u) == findSet(v))
            ans[u]++,ans[v]++;
    }
    for (int i = 0; i < n; ++i)
    {
        int s = size[findSet(i)];
        cout << s-1-ans[i]-G[i]<< ' ';
    }
}


Compiler output:
a.cc: In function 'void unionSet(int, int)':
a.cc:16:9: error: reference to 'size' is ambiguous
   16 |     if (size[a] < size[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,
                 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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~
a.cc:16:19: error: reference to 'size' is ambiguous
   16 |     if (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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~
a.cc:19:5: error: reference to 'size' is ambiguous
   19 |     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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~
a.cc:19:16: error: reference to 'size' is ambiguous
   19 |     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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:26:23: error: reference to 'size' is ambiguous
   26 |         parent[i] = i,size[i] = 1,ans[i] = 0;
      |                       ^~~~
/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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~
a.cc:45:17: error: reference to 'size' is ambiguous
   45 |         int s = size[findSet(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:4:5: note:                 'int size [100010]'
    4 | int size[N], parent[N], ans[N], G[N];
      |     ^~~~