Language: C++

#include<bits/stdc++.h>
#define SPEED ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define ll long long int
#define inf 999999999
#define maxn 200003
const ll mod = 1e9+7;
using namespace std;
vector<int> adj[maxn];
int n, t;
bool visit[maxn];
void add_edge(int a, int b)
{
	adj[a].push_back(b);
	adj[b].push_back(a);
}
void dfs(int src)
{
	visit[src] = true;t++;
	for(auto c: adj[src])
	{
		if(!visit[c])
		{
			dfs(c);
		}
	}
}
void code()
{
	int m;
	cin >> n >> m;
	for(int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		add_edge(a,b);
	}
	memset(visit,false,sizeof(visit));
	int maxm = INT_MIN;
	for(int i = 0; i <= n; i++)
	{
		if(!visit[i]){
			t = 0;
			dfs(i);
			maxm= max(t,maxm);
		}
	}
	cout << maxm << "\n";
}
int main()
{
	SPEED
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.out","w",stdout);
	#endif
	int t = 1;
	while(t--)
	{
		code();
	}
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:18:9: error: reference to 'visit' is ambiguous
   18 |         visit[src] = true;t++;
      |         ^~~~~
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:10:6: note:                 'bool visit [200003]'
   10 | bool visit[maxn];
      |      ^~~~~
a.cc:21:21: error: reference to 'visit' is ambiguous
   21 |                 if(!visit[c])
      |                     ^~~~~
/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:10:6: note:                 'bool visit [200003]'
   10 | bool visit[maxn];
      |      ^~~~~
a.cc: In function 'void code()':
a.cc:37:16: error: reference to 'visit' is ambiguous
   37 |         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:10:6: note:                 'bool visit [200003]'
   10 | bool visit[maxn];
      |      ^~~~~
a.cc:37:35: error: reference to 'visit' is ambiguous
   37 |         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:10:6: note:                 'bool visit [200003]'
   10 | bool visit[maxn];
      |      ^~~~~
a.cc:41:21: 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:10:6: note:                 'bool visit [200003]'
   10 | bool visit[maxn];
      |      ^~~~~