Language: C++

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

#define                                 pai                                         acos(-1)
#define                                 ll                                          long long
#define                                 pb                                          push_back
#define                                 mp                                          make_pair
#define                                 pll                                         pair<ll,ll>
#define                                 sz(a)                                       (ll)a.size()
#define                                 endl                                        "\n"
#define                                 gcd(a, b)                                   __gcd(a, b)
#define                                 lcm(a, b)                                   (((a)*(b))/gcd(a,b))
#define                                 all(vec)                                    vec.begin(),vec.end()
#define                                 ms(a, b)                                    memset(a,b,sizeof(a))
#define                                 TEST_CASE(t)                                for(int www=1;www<=t;www++)
#define                                 PRINT_CASE                                  printf("Case %d: ",z)
#define                                 fii                                         freopen("input.txt","r",stdin);
#define                                 foo                                         freopen("output.txt","w",stdout);
#define                                 fast                                        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

const ll mod  = 1e9 +07;
const ll mxn  = 1e6 +10;

vector<ll>adj[mxn];
bool visit[mxn];

ll cnt=0;
void dfs(ll s)
{
    cnt++;
    visit[s]=true;
    for(ll i=0;i<adj[s].size();i++)
    {
        ll u=adj[s][i];
        if(!visit[u])
        {
            dfs(u);
        }
    }
}
int  main()
{
    ll i,j,k,a,b,c,d=0,n,m,t,h,u,v,x,y,z;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    ll mx=0;
    for(i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            cnt=0;
            dfs(i);
            mx=max(mx,cnt);
        }
    }
    cout<<mx<<endl;
    return 0;
}




Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:31:5: error: reference to 'visit' is ambiguous
   31 |     visit[s]=true;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:6: note:                 'bool visit [1000010]'
   25 | bool visit[mxn];
      |      ^~~~~
a.cc:35:13: error: reference to 'visit' is ambiguous
   35 |         if(!visit[u])
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:6: note:                 'bool visit [1000010]'
   25 | bool visit[mxn];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:54:13: error: reference to 'visit' is ambiguous
   54 |         if(!visit[i])
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:25:6: note:                 'bool visit [1000010]'
   25 | bool visit[mxn];
      |      ^~~~~