criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
vector<int> v[200005];
vector<int> visit(200005);
int cnt=0;

void dfs(int node)
{
    cnt++;
    visit[node]=1;
    for(auto it:v[node])
    {
        if(visit[it]==0)
        dfs(it);
    }
}

int main() {
	
	int n,m;
	cin>>n>>m;
	
	for(int i=0;i<m;i++)
	{
	    int x,y;
	    cin>>x>>y;
	    v[x].push_back(y);
	    v[y].push_back(x);
	}
	
	vector<int> grp;
	for(int i=1;i<=n;i++)
	{
	    if(visit[i]==0)
	    {
	        cnt=0;
	        dfs(i);
	        grp.push_back(cnt);
	    }
	}
	
	sort(grp.rbegin(),grp.rend());
	cout<<grp[0];
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:12:5: error: reference to 'visit' is ambiguous
   12 |     visit[node]=1;
      |     ^~~~~
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:13: note:                 'std::vector<int> visit'
    6 | vector<int> visit(200005);
      |             ^~~~~
a.cc:15:12: error: reference to 'visit' is ambiguous
   15 |         if(visit[it]==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:6:13: note:                 'std::vector<int> visit'
    6 | vector<int> visit(200005);
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:36:16: error: reference to 'visit' is ambiguous
   36 |             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:6:13: note:                 'std::vector<int> visit'
    6 | vector<int> visit(200005);
      |             ^~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
vector<int> v[200005];
int visit[200005];
int cnt=0;

void dfs(int node)
{
    cnt++;
    visit[node]=1;
    for(auto it:v[node])
    {
        if(visit[it]==0)
        dfs(it);
    }
}

int main() {
	
	int n,m;
	cin>>n>>m;
	
	for(int i=0;i<m;i++)
	{
	    int x,y;
	    cin>>x>>y;
	    v[x].push_back(y);
	    v[y].push_back(x);
	}
	
	vector<int> grp;
	for(int i=1;i<=n;i++)
	{
	    if(visit[i]==0)
	    {
	        cnt=0;
	        dfs(i);
	        grp.push_back(cnt);
	    }
	}
	
	sort(grp.rbegin(),grp.rend());
	cout<<grp[0];
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:12:5: error: reference to 'visit' is ambiguous
   12 |     visit[node]=1;
      |     ^~~~~
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:5: note:                 'int visit [200005]'
    6 | int visit[200005];
      |     ^~~~~
a.cc:15:12: error: reference to 'visit' is ambiguous
   15 |         if(visit[it]==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:6:5: note:                 'int visit [200005]'
    6 | int visit[200005];
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:36:16: error: reference to 'visit' is ambiguous
   36 |             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:6:5: note:                 'int visit [200005]'
    6 | int visit[200005];
      |     ^~~~~
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: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];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define ar array
#define pb push_back
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

// void solve(){

// }
int n,m,cnt,mx=1;
vector<int> adj[n];
vector<bool> vis(n,false);
void dfs(int u){
    vis[u]=true;
    cnt++;
    for(auto v:adj[u]){
        if(!vis[v]){
            dfs(v);
        }
    }
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
    cin>>n>>m;
    FOR(i,0,m){
        int a,b;
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    FOR(i,1,n+1){
        cnt=0;
        if(!vis[i]){
            dfs(i);
            mx=max(mx,cnt);
        }
    }
    cout<<mx;
    return 0;
}

Compiler output:
a.cc:17:17: error: size of array 'adj' is not an integral constant-expression
   17 | vector<int> adj[n];
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[200005];
long long int vis[200005];
long long int cnt=0;
void dfs(long long int node){
    vis[node]=1;
    cnt+=1;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    long long int inf=999999999;
    long long int maxi=-inf;
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            maxi=max(maxi,cnt);
            
        }
    }
   cout<<maxi;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: overloaded function with no contextual type information
   27 |             size=0;
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[200005];
long long int vis[200005];
long long int size=0;
void dfs(long long int node){
    vis[node]=1;
    size++;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    long long int inf=999999999;
    long long int maxi=-inf;
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            maxi=max(maxi,size);
            
        }
    }
   cout<<maxi;
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:8:5: error: reference to 'size' is ambiguous
    8 |     size++;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:27:13: error: reference to 'size' is ambiguous
   27 |             size=0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc:29:27: error: reference to 'size' is ambiguous
   29 |             maxi=max(maxi,size);
      |                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[200005];
long long int vis[200005];
long long int size=0;
void dfs(long long int node){
    vis[node]=1;
    size+=1;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    long long int inf=999999999;
    long long int maxi=-inf;
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            maxi=max(maxi,size);
            
        }
    }
   cout<<maxi;
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:8:5: error: reference to 'size' is ambiguous
    8 |     size+=1;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:27:13: error: reference to 'size' is ambiguous
   27 |             size=0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc:29:27: error: reference to 'size' is ambiguous
   29 |             maxi=max(maxi,size);
      |                           ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[200005];
long long int vis[200005];
long long int size=0;
void dfs(long long int node){
    vis[node]=1;
    size+=1;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            s.insert(size);
            
        }
    }
    auto it=s.end();
    it--;
    cout<<*it;
    
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:8:5: error: reference to 'size' is ambiguous
    8 |     size+=1;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:26:13: error: reference to 'size' is ambiguous
   26 |             size=0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc:28:22: error: reference to 'size' is ambiguous
   28 |             s.insert(size);
      |                      ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[100005];
long long int vis[100005];
long long int size=0;
void dfs(long long int node){
    vis[node]=1;
    size+=1;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            s.insert(size);
            
        }
    }
    auto it=s.end();
    it--;
    cout<<*it;
    
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:8:5: error: reference to 'size' is ambiguous
    8 |     size+=1;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:26:13: error: reference to 'size' is ambiguous
   26 |             size=0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
a.cc:28:22: error: reference to 'size' is ambiguous
   28 |             s.insert(size);
      |                      ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:15: note:                 'long long int size'
    5 | long long int size=0;
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<long long int>v[100005];
int vis[100005];
int size=0;
void dfs(long long int node){
    vis[node]=1;
    size+=1;
    for(long long int child:v[node]){
        if(!vis[child])
        dfs(child);
    }
}
int main(){
    set<long long int>s;
    long long int n,m,x,y;
    cin>>n>>m;
    for(long long int i=1;i<=m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    for(long long int i=1;i<=n;i++){
        if(!vis[i]){
            size=0;
            dfs(i);
            s.insert(size);
            
        }
    }
    auto it=s.end();
    it--;
    cout<<*it;
    
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:8:5: error: reference to 'size' is ambiguous
    8 |     size+=1;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:5: note:                 'int size'
    5 | int size=0;
      |     ^~~~
a.cc: In function 'int main()':
a.cc:26:13: error: reference to 'size' is ambiguous
   26 |             size=0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:5: note:                 'int size'
    5 | int size=0;
      |     ^~~~
a.cc:28:22: error: reference to 'size' is ambiguous
   28 |             s.insert(size);
      |                      ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:5:5: note:                 'int size'
    5 | int size=0;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<set<int>> groups;
    vector<int> isOK(n, -1);
    for (int i = 0; i < m; ++i) {
        int x, y;
        cin >> x >> y;
        --x; --y;
        if (isOK[x] == -1 and isOK[y] == -1) {
            int cur = groups.size();
            groups.emplace_back(set<int>({x, y}));
            isOK[x] = cur, isOK[y] = cur;
        } else if (isOK[x] != -1) {
            groups[isOK[x]].insert(y);
            isOK[y] = isOK[x];
        } else {
            groups[isOK[y]].insert(x);
            isOK[x] = isOK[y];
        }
    }
    unsigned int ans = 1;
    for (const auto& p : groups) {
        ans = max(ans, p.size());
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: no matching function for call to 'max(unsigned int&, std::set<int>::size_type)'
   28 |         ans = max(ans, p.size());
      |               ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:28:18: note:   deduced conflicting types for parameter 'const _Tp' ('unsigned int' and 'std::set<int>::size_type' {aka 'long unsigned int'})
   28 |         ans = max(ans, p.size());
      |               ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:28:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'unsigned int'
   28 |         ans = max(ans, p.size());
      |               ~~~^~~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<iostream>
#include<map>
#include<cstring>
#define INF 0x3f3f3f3f
#define eps 1e-10
using namespace std;
set<int> groupc;
int n,m,root[200005],sizex[200005],a,b,ans;
int find(int x){
    if(root[x]==x)
        return x;
    return root[x]=find(root[x]);
}
bool same(int x,int y){
    return find(x)==find(y);
}
void merge(int x,int y){
    x=find(x);
    y=find(y);
    if(sizex[x]<sizex[y])
        swap(x,y);
    sizex[x]+=size[y];
    root[y]=x;
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        root[i]=i;
        sizex[i]=1;
    }
    for(int i=1;i<=m;i++){
        scanf("%d%d",&a,&b);
        if(!same(a,b))
            merge(a,b);
    }
    for(int i=1;i<=n;i++){
        groupc.insert(find(i));
    }
    for(auto e:groupc){
        ans=max(sizex[e],ans);
    }
    printf("%d",ans);
}

Compiler output:
a.cc: In function 'void merge(int, int)':
a.cc:29:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   29 |     sizex[x]+=size[y];
      |                   ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<iterator>
//#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+ 5;
#define ll long long
#define inf 0x3f3f
#define mod 1000000007
#define endl '\n'
int fa[maxn];
int find(int x)
{
    if(x==f[x])
        return x;
    else
        return f[x]=find(f[x]);
}
void Union(int x, int y)
{
	int fx = find(x), fy = find(y);
	fa[fx] = fy;
}
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m;
	for (int i = 1; i < maxn; i++)fa[i] = i;
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int x, y; cin >> x >> y;
		Union(x, y);
	}
	map<int, int>mp;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int t = find(i);
		mp[t]++;
		ans = max(ans, mp[t]);
	}cout << ans << endl;

}
	 


Compiler output:
a.cc: In function 'int find(int)':
a.cc:17:11: error: 'f' was not declared in this scope
   17 |     if(x==f[x])
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll visited[100000];
ll nodes=0;
vector<ll>A[100000];
int dfs(ll ind){
	if(visited[ind]) return;
	
	nodes++;
	visited[ind]=1;
	for(auto i:A[ind]){
		dfs(i);
	}
	return nodes;
}
int  main(){


// #ifndef ONLINE_JUDGE   
// freopen("input.txt", "r", stdin); 
// // freopen("output.txt", "w", stdout);    
// #endif 
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
memset(visited,0,sizeof(visited));

ll n,m,u,v;
cin>>n>>m;


for(ll i=0;i<m;i++){
	cin>>u>>v;
	A[v].push_back(u);
	A[u].push_back(v);
}

 ll ans =0;
for(ll i=1;i<=n;i++){

	if(visited[i]==0){
	nodes=0;
	dfs(i);
	ans = max(ans,nodes);
}
	
}
cout<<ans;
return 0;
}





Compiler output:
a.cc: In function 'int dfs(long long int)':
a.cc:8:26: error: return-statement with no value, in function returning 'int' [-fpermissive]
    8 |         if(visited[ind]) return;
      |                          ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long
ll visited[100000];
ll nodes=0;
vector<ll>A[100000];
void dfs(ll ind){
	if(visited[ind]) return;
	nodes++;
	visited[ind]=1;
	for(auto i:A[ind]){
		dfs(i);
	}
}
ll main(){


#ifndef ONLINE_JUDGE   
freopen("input.txt", "r", stdin); 
// freopen("output.txt", "w", stdout);    
#endif 
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
memset(visited,0,sizeof(visited));

ll n,m,u,v;
cin>>n>>m;


for(ll i=0;i<m;i++){
	cin>>u>>v;
	A[v].push_back(u);
	A[u].push_back(v);
}

 ans =0;
for(ll i=1;i<=n;i++){

	if(visitec[i]==0){
	nodes=0;
	dfs(i);
	ans = max(ans,nodes);
}
	
}
cout<<ans;
return 0;
}





Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:36:2: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |  ans =0;
      |  ^~~
      |  abs
a.cc:39:12: error: 'visitec' was not declared in this scope; did you mean 'visited'?
   39 |         if(visitec[i]==0){
      |            ^~~~~~~
      |            visited
Language: C++

#include<bits/stdc++.h>
using namespace std;
int visited[100000];
int nodes=0;
vector<int>A[100000];
void dfs(int ind){
	if(visited[ind]) return;
	nodes++;
	visited[ind]=1;
	for(auto i:A[ind]){
		dfs(i);
	}
}
int main(){


#ifndef ONLINE_JUDGE   
freopen("input.txt", "r", stdin); 
// freopen("output.txt", "w", stdout);    
#endif 
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
memset(visited,0,sizeof(visited));

int n,m,u,v;
cin>>n>>m;


for(int i=0;i<m;i++){
	cin>>u>>v;
	A[v].push_back(u);
	A[u].push_back(v);
}

int ans =0;
for(int i=1;i<=n;i++){

	if(vis[i]==0){
	nodes=0;
	dfs(i);
	ans = max(ans,nodes);
}
	
}
cout<<ans;
return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'vis' was not declared in this scope
   38 |         if(vis[i]==0){
      |            ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxm=1e6+5;
int pre[maxm];
int num[maxm];
int n,m;
int ffind(int x){
    return pre[x]==x?x:pre[x]=ffind(pre[x]);
}
signed main(){
    ios::sync_with_stdio(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        pre[i]=i;
        num[i]=1;
    }
    for(int i=1;i<=m;i++){
        int a,b;cin>>a>.b;
        int x=ffind(a);
        int y=ffind(b);
        if(x==y)continue;
        pre[x]=y;
        num[y]+=num[x];
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(pre[i]==i){
            ans=max(ans,num[i]);
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*
有n个人，给定m个点对<a,b>，表示a和b是朋友，
如果<a,b>且<b,c>那么<a,c>，即关系举有传递性，
保证m对关系没有自环,但是可能有重边。
现在你要将这n个人分成若干个团体，
要求每个团体里的人两两不是朋友关系。
问最少分成多少个团体。

数据范围：n,m<=2e5

仔细想了想,因为朋友关系具有传递性,
那么并查集合并之后,每个集合内部就是完全图,
假设集合内有n个人,要将他们拆开,那么要分成n堆.
那么并查集维护一下集合人数,对所有集合的人数取max就是答案.
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: expected primary-expression before '.' token
   19 |         int a,b;cin>>a>.b;
      |                        ^
Language: C++

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public Scanner scanner = new Scanner(System.in);
	public static final long MODN = 1000000007;
	public PrintStream out = System.out;
	
	public void start() {
		int n = scanInt();
		int m = scanInt();
		
		int[] persons = new int[n];
		List<List<Integer>> groups = new ArrayList<List<Integer>>(n);
		
		for(int i=0; i < n; i++) {
			persons[i] = i;
			List<Integer> tmp = new ArrayList<Integer>();
			tmp.add(i);
			groups.add(tmp);
		}
		
		for(int i=0; i < m; i++) {
			int a = scanInt() - 1;
			int b = scanInt() - 1;
			
			if(persons[a] == persons[b]) continue;
			
			int pb = persons[b];
			List<Integer> groupa = groups.get(persons[a]);
			List<Integer> groupb = groups.get(persons[b]);
			
			for(int cur : groupb) {
				groupa.add(cur);
				persons[cur] = persons[a];
			}
			
			groups.set(pb, null);
		}
		
		int max = 1;
		for(List<Integer> cur : groups) {
			if(cur != null) {
				if(cur.size() > max) max = cur.size();
			}
		}
		
		out.print(max);
	}
	
	//Javaではlong型でも%dでよい
	public void printNums(long[] nums) { for(long cur : nums) out.printf("%d ", cur); out.println();}
	public void printNums(List<Long> nums) { for(long cur : nums) out.printf("%d ", cur); out.println();}
	public long scanNum() { return scanner.nextLong(); }
	public int scanInt() { return scanner.nextInt(); }
	public String scanLine() { return scanner.nextLine(); }
	
	public long[] scanNums(long num) {
		long[] ret = new long[(int) num];
		for(int i=0; i < num; i++) {
			ret[i] = scanner.nextLong();
		}
		return ret;
	}
	
	public List<Long> longArrayToList(long[] arr){
		List<Long> ret = new ArrayList<>(arr.length);
		for(long cur : arr) {
			ret.add(cur);
		}
		return ret;
	}
	
	public Main() {
		
	}
	
	public static void main(String[] args) {
		Main kpc = new Main();
		kpc.start();
	}

}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.ArrayList;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Arrays;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.List;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Scanner;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std ;

#define ll long long int

vector<vector<int>> groups;
vector<bool> visited;
int  size=0;
void dfs(int x)
{
    if(visited[x]) return ;
    visited[x] = true ;
    size++;
    for(int next : groups[x])
        dfs(next);
    return ;
}
int solvere()
{
    int n,p,i,j,x,y;
    cin>>n>>p;
    visited.resize(n+1,false),groups.resize(n+1);
    for(i=0;i<p;i++)
    {
        cin>>x>>y;
        groups[x].push_back(y);
        groups[y].push_back(x);
    }
    int ans=0;
    for(i=1;i<=n;i++)
    {
        if(!visited[i])
        {
            size = 0;
            dfs(i);
            ans=max(ans,size);
        }
    }
    cout<<ans<<endl;
    return 0;    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
    int t=1;
    //cin>>t;
    while(t--)
    solvere();
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:13:5: error: reference to 'size' is ambiguous
   13 |     size++;
      |     ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:6: note:                 'int size'
    8 | int  size=0;
      |      ^~~~
a.cc: In function 'int solvere()':
a.cc:34:13: error: reference to 'size' is ambiguous
   34 |             size = 0;
      |             ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:6: note:                 'int size'
    8 | int  size=0;
      |      ^~~~
a.cc:36:25: error: reference to 'size' is ambiguous
   36 |             ans=max(ans,size);
      |                         ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:8:6: note:                 'int size'
    8 | int  size=0;
      |      ^~~~
Language: C++

import sys
'''
class UnionFindBasic():
    def __init__(self, n):
        self.parents = list(range(n))
    
    def find_root(self, x):
        if self.parents[x] == x:
            return x
        else:
            return self.find(self.parents[x])

    def make_union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y: return
        self.parents[y] = x
'''

class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))
        self.size = [1] * n
    
    def find_root(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find_root(self.parents[x])
            return self.parents[x]
    def make_union(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        
        if x == y : return
        self.size[x] += self.size[y]
        self.parents[y] = x

def main():
    n, m = map(int, input().split())
    uf = UnionFindPathCompression(n)
    for _ in range(m):
        a, b = map(int, input().split())
        uf.make_union(a - 1, b - 1)
    
    ans = max(uf.size)
    print(ans)

if __name__ == "__main__":
    main()

Compiler output:
a.cc:2:1: error: empty character constant
    2 | '''
      | ^~
a.cc:2:3: warning: missing terminating ' character
    2 | '''
      |   ^
a.cc:2:3: error: missing terminating ' character
a.cc:19:1: error: empty character constant
   19 | '''
      | ^~
a.cc:19:3: warning: missing terminating ' character
   19 | '''
      |   ^
a.cc:19:3: error: missing terminating ' character
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;
typedef double ld;

template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7ll;
const double PI=3.14159265358979323846;

struct UnionFind {
    vector<int> par;
    vector<int> siz;
    UnionFind(int _sz) : par(_sz), siz(_sz, 1) {
        rp(i, 0, _sz) par[i] = i;
    }
    int root(int a) {
        while(a != par[a]) {
            a = par[a] = par[par[a]];
        }
        return a;
    }
    bool unite(int a, int b) {
        int root_a = root(a);
        int root_b = root(b);
        if(root_a == root_b) return false;
        else {
            par[b] = root_a;
            siz[root_a] += siz[root_b]; 
            return true;
        }
    }
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;

vector<int> graph[200009];
int visit[200009]={0};

void dfs(int x, int& nodes){
  visit[x]=1;
  nodes++;
  for(int a: graph[x]){
    if(!visit[a])
      dfs(a,nodes);
  }
}
   
int main()
{
  int n,m;
  scanf("%d%d", &n,&m);
  while(m--){
    int x,y;
    scanf("%d%d", &x,&y);
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  int ans=0;
  for(int a=1;a<=n;a++){
    if(!visit[a]){
	      int nodes=0;
	      dfs(a,nodes);
	      ans=max(ans,nodes);
	    }
	}
  printf("%d",ans);
}
    

Compiler output:
a.cc: In function 'void dfs(int, int&)':
a.cc:8:3: error: reference to 'visit' is ambiguous
    8 |   visit[x]=1;
      |   ^~~~~
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:5:5: note:                 'int visit [200009]'
    5 | int visit[200009]={0};
      |     ^~~~~
a.cc:11:9: error: reference to 'visit' is ambiguous
   11 |     if(!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:5:5: note:                 'int visit [200009]'
    5 | int visit[200009]={0};
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:28:9: error: reference to 'visit' is ambiguous
   28 |     if(!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:5:5: note:                 'int visit [200009]'
    5 | int visit[200009]={0};
      |     ^~~~~
Language: Java



import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int m = Integer.parseInt(st.nextToken());

        HashMap<Integer, Set<Integer>> map = new HashMap<>();
        for(int i=1; i<=n; i++){
            map.put(i, new HashSet<Integer>());
        }

        for(int i=0; i<m; i++){
            StringTokenizer pair = new StringTokenizer(br.readLine());
            int v1 = Integer.parseInt(pair.nextToken());
            int v2 = Integer.parseInt(pair.nextToken());

            map.get(v1).add(v2);
            map.get(v2).add(v1);
        }

        int max = 0;
        boolean[] vis = new boolean[n+1];

        for(int i=1; i<=n; i++){
            if(!vis[i]){
                max = Math.max(max, dfs(i, vis, map));
            }
        }

        System.out.println(max);
    }

    static int dfs(int i, boolean[] vis, HashMap<Integer, Set<Integer>> map){
        vis[i] = true;
        int size = 1;

        Set<Integer> fr = map.get(i);
        
        for(int next: fr){
            if(!vis[next]){
                size += dfs(next, vis, map);
            }
        }

        return size;
    }
}


Compiler output:
Main.java:13: error: cannot find symbol
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                                                   ^
  symbol:   class InputStreamReader
  location: class Main
1 error