Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;
#define all(v) v.begin(),v.end()
#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define pp pair<ll,ll>
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  ma0t vector<vector<ll>>
#define el cout<<'\n';
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int N=2*(1e5)+10;
int size[N];
int par[N];
void ini(){
  for(int i=0;i<N;i++)
  size[i]=1,par[i]=i;
}
int parent(int x){
  if(par[x]==x)
  return x;
  return par[x]=parent(par[x]);
}
void uni(int x,int y){
  x=parent(x);
  y=parent(y);
  if(x==y)
  return ;
  if(size[x]<size[y])
  swap(x,y);
  par[y]=x;
  size[x]+=size[y];
  size[y]=0;
}
void solve(){
  ll n,m;
  cin>>n>>m;
  ini();
  ll u,vv;
  fr(i,0,m){
    cin>>u>>vv;
    uni(u,vv);
  }
vll v(n);
fr(i,1,n+1){
  v[i-1]=size[i];
}
sort(all(v));
ll ans=0;
ll curr=0;
for(int i=0;i<n;i++){  
  d1(v[i]);
  if(curr+v[i]>(ll)0){
   
  
    ans+=curr+v[i];
  
    curr-=curr+v[i];
  }

}
cout<<ans;


}
int main()
{
    ll t=1;
  //  cin>>t;
    while(t--)
    {
     solve();
     cout<<endl;
    }
	return 0;
}

Compiler output:
a.cc: In function 'void ini()':
a.cc:28:3: error: reference to 'size' is ambiguous
   28 |   size[i]=1,par[i]=i;
      |   ^~~~
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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc: In function 'void uni(int, int)':
a.cc:40:6: error: reference to 'size' is ambiguous
   40 |   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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc:40:14: error: reference to 'size' is ambiguous
   40 |   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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc:43:3: error: reference to 'size' is ambiguous
   43 |   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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc:43:12: error: reference to 'size' is ambiguous
   43 |   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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc:44:3: error: reference to 'size' is ambiguous
   44 |   size[y]=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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~
a.cc: In function 'void solve()':
a.cc:57:10: error: reference to 'size' is ambiguous
   57 |   v[i-1]=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:24:5: note:                 'int size [200010]'
   24 | int size[N];
      |     ^~~~