Language: C++

#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define f(i,s,n) for(int i=s;i<=n;++i)
const lli mx = 1e9+7;
const lli mn = 2e5+1;
vector<vector<int>> g(mn);
vector<bool> visit(mn, false);

int n,m,a,b;

int dfs(int x){
    if(visit[x]) return 0;
    visit[x] = true;
    int val=0;
    for(auto vertex:g[x]){
        if(!visit[vertex]){
            val+=dfs(vertex);
        }
    }
    return val+1;
}

int main(){
   
   cin>>n>>m;
    
    set<pair<int, int>> st;
    for(int i=0;i<m;++i){
        cin>>a>>b;
        if(st.find({a,b}) == st.end() && st.find({b,a}) == st.end()){
            g[a].push_back(b);
            g[b].push_back(a);
            st.insert({a,b});
            st.insert({b,a});
           
        }
    }
    int ans = 0;
    for(int i=1;i<=n;++i){
        if(!visit[i]){
            ans = max(ans, dfs(i));
        }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:13:8: error: reference to 'visit' is ambiguous
   13 |     if(visit[x]) return 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:8:14: note:                 'std::vector<bool> visit'
    8 | vector<bool> visit(mn, false);
      |              ^~~~~
a.cc:14:5: error: reference to 'visit' is ambiguous
   14 |     visit[x] = true;
      |     ^~~~~
/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:8:14: note:                 'std::vector<bool> visit'
    8 | vector<bool> visit(mn, false);
      |              ^~~~~
a.cc:17:13: error: reference to 'visit' is ambiguous
   17 |         if(!visit[vertex]){
      |             ^~~~~
/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:8:14: note:                 'std::vector<bool> visit'
    8 | vector<bool> visit(mn, false);
      |              ^~~~~
a.cc: In function 'int main()':
a.cc:41:13: error: reference to 'visit' is ambiguous
   41 |         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:8:14: note:                 'std::vector<bool> visit'
    8 | vector<bool> visit(mn, false);
      |              ^~~~~