Language: C++

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

# define ll long long int 

const int md = 1e9+7;
ll Parent[100000];
ll size[100000];

void Build(int n)
{ for(ll i=1;i<=n;i++)
   { Parent[i]=i;
     size[i]=1;
   }
}


ll find(ll u)
{
    if(Parent[u]==u) return u;
    else
    {
        return Parent[u]=find(Parent[u]);
    }
}



void Union(ll a, ll b)
{
  ll P_a=  find(a);
  ll P_b=  find(b);
  
  if(P_a!=P_b)
  {
  	size[P_b]+=size[P_a];
  	Parent[P_a]=Parent[P_b];
  }

}

int main()
{
    ll n,m;
    cin>>n>>m;
    
     //std::vector<Edge> E(m) ;
     Build(n);
     
     // for(ll i=0;i<m;i++)
     // {
     //     cin>>E[i].src;
     //     E[i].src--;
     //     cin>>E[i].dest;
     //     E[i].dest--;
     //     cin>>E[i].wt;
     // }

     for(int i=0;i<m;i++)
     {
     	ll x,y;
     	cin>>x>>y;
     	Union(x,y);
     }
      
      unordered_map<int,int> mp;
      ll mx=0;

     for(int i=1;i<=n;i++)
     {
     	int p=find(i);
     	//cout<<p<<endl;
     	if(mp.find(p)==mp.end())
     	{
     		mp[p]=1;
     		mx= max(mx,size[p]);

     	}
     }


     
     
 
     
     cout<<mx<<endl;
    
    
}





Compiler output:
a.cc: In function 'void Build(int)':
a.cc:14:6: error: reference to 'size' is ambiguous
   14 |      size[i]=1;
      |      ^~~~
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:9:4: note:                 'long long int size [100000]'
    9 | ll size[100000];
      |    ^~~~
a.cc: In function 'void Union(long long int, long long int)':
a.cc:37:9: error: reference to 'size' is ambiguous
   37 |         size[P_b]+=size[P_a];
      |         ^~~~
/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:9:4: note:                 'long long int size [100000]'
    9 | ll size[100000];
      |    ^~~~
a.cc:37:20: error: reference to 'size' is ambiguous
   37 |         size[P_b]+=size[P_a];
      |                    ^~~~
/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:9:4: note:                 'long long int size [100000]'
    9 | ll size[100000];
      |    ^~~~
a.cc: In function 'int main()':
a.cc:77:28: error: reference to 'size' is ambiguous
   77 |                 mx= max(mx,size[p]);
      |                            ^~~~
/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:9:4: note:                 'long long int size [100000]'
    9 | ll size[100000];
      |    ^~~~