Language: C++

#include <bits/stdc++.h>

using namespace std;
const int maxn = 2e5+7;
int parent[maxn];
int size[maxn];

int find(int u)
{
    if(parent[u]==u)
        return u;
    else return find(parent[u]);
}
void uni(int x, int y)
{
    x = find(x);
    y = find(y);
    if(size[x]>size[y])
    {
        parent[y] = x;
    }
    else if(size[x]<size[y])
        parent[x] = y;
    else
    {
        parent[y] = x;
        size[x] += 1;
    }

}

int main(){
  int n;
  cin>>n;
  int x[n],y[n];
  for(int i=0;i<=n;i++)
    parent[i] = i;
  for(int i=0;i<=n;i++)
    size[i] = 1;
  for(int i=0;i<n;i++)
    cin>>x[i]>>y[i];

    for(int i=0;i<n;i++)
    {
        for(int j = 0;j<n;j++)
            if((x[i]-x[j])*(y[i]-y[j])>0&&find(x[i])!=find(x[j]))
                uni(x[i],x[j]);
    }
    for(int i=0;i<n;i++)
    {
        int p = find(x[i]);
        int ans = 0;
        for(int j=0;j<=n;j++)
            if(p==parent[j])
                ans+=1;
        cout<<ans<<endl;

    }
  
}


Compiler output:
a.cc: In function 'void uni(int, int)':
a.cc:18:8: error: reference to 'size' is ambiguous
   18 |     if(size[x]>size[y])
      |        ^~~~
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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~
a.cc:18:16: error: reference to 'size' is ambiguous
   18 |     if(size[x]>size[y])
      |                ^~~~
/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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~
a.cc:22:13: error: reference to 'size' is ambiguous
   22 |     else if(size[x]<size[y])
      |             ^~~~
/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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~
a.cc:22:21: error: reference to 'size' is ambiguous
   22 |     else if(size[x]<size[y])
      |                     ^~~~
/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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~
a.cc:27:9: error: reference to 'size' is ambiguous
   27 |         size[x] += 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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~
a.cc: In function 'int main()':
a.cc:39:5: error: reference to 'size' is ambiguous
   39 |     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:6:5: note:                 'int size [200007]'
    6 | int size[maxn];
      |     ^~~~