Language: C++

#include<bits/stdc++.h>
using namespace std;
long long int ctr=0;
map<long long int,bool>visit;
void dfs(map<long long int ,list<long long int >>m,long long int node)
{
    ctr++;
    visit[node]=true;
    for(auto x:m[node])
    {
        if(visit[x]==false)
        {
            dfs(m,x);
        }
    }
}
int main()
{
    long long int n,M;
    cin>>n>>M;
    map<long long int ,list<long long int >>m;

    while(M--)
    {
        long long int a,b;
        cin>>a>>b;
        m[a].push_back(b);
        m[b].push_back(a);

    }
    long long int ans=0;
    
    for(long long int i=1;i<=n;i++)
    {
        visit[i]=false;
    }

    for(long long int i=1;i<=n;i++)
    {
        if(!visit[i])
        {
            dfs(m,i);
            ans=max(ans,ctr);
            ctr=0;
        }
    }
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(std::map<long long int, std::__cxx11::list<long long int> >, long long int)':
a.cc:8:5: error: reference to 'visit' is ambiguous
    8 |     visit[node]=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:4:24: note:                 'std::map<long long int, bool> visit'
    4 | map<long long int,bool>visit;
      |                        ^~~~~
a.cc:11:12: error: reference to 'visit' is ambiguous
   11 |         if(visit[x]==false)
      |            ^~~~~
/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:24: note:                 'std::map<long long int, bool> visit'
    4 | map<long long int,bool>visit;
      |                        ^~~~~
a.cc: In function 'int main()':
a.cc:35:9: error: reference to 'visit' is ambiguous
   35 |         visit[i]=false;
      |         ^~~~~
/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:24: note:                 'std::map<long long int, bool> visit'
    4 | map<long long int,bool>visit;
      |                        ^~~~~
a.cc:40:13: error: reference to 'visit' is ambiguous
   40 |         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:4:24: note:                 'std::map<long long int, bool> visit'
    4 | map<long long int,bool>visit;
      |                        ^~~~~