Language: C++

#include<bits/stdc++.h>
using namespace std;
#define loop(i,a,b)        for(int i=a;i<b;i++)
int mx=0;
vector<int>ad[200005];
bool visit[200005];
int dfs(int z){
	int ans=0;
	if(!visit[z]){
		visit[z]=true;
		ans++;
		for(auto v:ad[z])ans+=dfs(v);
	}
    return ans;

}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m,x,y;
	cin>>n>>m;
	memset(visit,false,sizeof(visit));
	loop(i,0,m){
		cin>>x>>y;
		x-=1;
		y-=1;
	    ad[x].push_back(y);
	    ad[y].push_back(x);
	}
	for(int i=0;i<n;i++){
		if(!visit[i])mx=max(mx,dfs(i));
	}
    cout<<mx<<endl;
 
}

Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:9:13: error: reference to 'visit' is ambiguous
    9 |         if(!visit[z]){
      |             ^~~~~
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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
a.cc:10:17: error: reference to 'visit' is ambiguous
   10 |                 visit[z]=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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:26:16: error: reference to 'visit' is ambiguous
   26 |         memset(visit,false,sizeof(visit));
      |                ^~~~~
/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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
a.cc:26:35: error: reference to 'visit' is ambiguous
   26 |         memset(visit,false,sizeof(visit));
      |                                   ^~~~~
/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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
a.cc:35:21: error: reference to 'visit' is ambiguous
   35 |                 if(!visit[i])mx=max(mx,dfs(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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~