Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int visit[200002];
vector<int>adj[200002];
queue<int>q;

int bfs()
{
    int cnt,a;
    cnt=1;
    while(!q.empty())
    {
        a=q.front();
        q.pop();
        for(int i=0;i<adj[a].size();i++)
        {
            if(visit[adj[a][i]]==0)
            {
                cnt++;
                visit[adj[a][i]]=visit[a];
                q.push(adj[a][i]);
            }
        }
    }
    return cnt;
}

int main()
{
    int n,m,i,a,b;
    scanf("%d %d",&n,&m);
    for(i=0; i<m; i++)
    {
        scanf("%d %d",&a,&b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    a=0;
    for(i=1; i<=n; i++)
    {
        if(visit[i]==0)
        {
            q.push(i);
            visit[i]=i;
            a=max(a,bfs());
        }
    }
    cout<<a<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int bfs()':
a.cc:18:16: error: reference to 'visit' is ambiguous
   18 |             if(visit[adj[a][i]]==0)
      |                ^~~~~
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:4:5: note:                 'int visit [200002]'
    4 | int visit[200002];
      |     ^~~~~
a.cc:21:17: error: reference to 'visit' is ambiguous
   21 |                 visit[adj[a][i]]=visit[a];
      |                 ^~~~~
/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:4:5: note:                 'int visit [200002]'
    4 | int visit[200002];
      |     ^~~~~
a.cc:21:34: error: reference to 'visit' is ambiguous
   21 |                 visit[adj[a][i]]=visit[a];
      |                                  ^~~~~
/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:4:5: note:                 'int visit [200002]'
    4 | int visit[200002];
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:42:12: error: reference to 'visit' is ambiguous
   42 |         if(visit[i]==0)
      |            ^~~~~
/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:4:5: note:                 'int visit [200002]'
    4 | int visit[200002];
      |     ^~~~~
a.cc:45:13: error: reference to 'visit' is ambiguous
   45 |             visit[i]=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:4:5: note:                 'int visit [200002]'
    4 | int visit[200002];
      |     ^~~~~