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

#include <iostream>
#include <vector>

int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    int n, m; std::cin >> n >> m;
    std::vector<std::vector<int>> edge(n);
    for(int i = 0; i < m; ++i){
        int u, v; std::cin >> u >> v; --u; --v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    std::vector<bool> Yet(n, true);
    std::vector<int> Stack(n);
    int res = 0;
    for(int i = 0; i < n; ++i) if(Yet[i]){
        int len = 0, cnt = 0;
        Stack[len++] = i; ++cnt;
        while(len){
            const int v = Stack[--len];
            for(const int nv : edge[v]) if(Yet[nv]){
                Stack[len++] = nv; ++cnt;
            }
        }
        if(res < cnt) res = cnt;
    }
    std:cout << res << '\n';
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |     std:cout << res << '\n';
      |         ^~~~
      |         std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//atcoder
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dfs(vector<vector<ll> > adj,ll root,ll &count,vector<bool> &vis){
	vis[root]=true;
	count++;
	for(in i=0; i<adj[root].size(); i++){
		if(vis[adj[root][i]]==false) dfs(adj,adj[root][i],count,vis);
	}
   return count;	
}
int main(){
	ll n,m,u,v,ans=INT_MIN,count;
	cin>>n>>m;
	vector<vector<ll> > adj(n+1);
	vector<bool>vis(n+1,false);
	while(m>0){
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
		m--;
	}
	for(ll i=1; i<n+1; i++){
		count=0;
		if(vis[i]==false) {
			ans=max(ans,dfs(adj,i,count,vis));
		}
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'll dfs(std::vector<std::vector<long long int> >, ll, ll&, std::vector<bool>&)':
a.cc:8:13: error: 'in' was not declared in this scope; did you mean 'yn'?
    8 |         for(in i=0; i<adj[root].size(); i++){
      |             ^~
      |             yn
a.cc:8:21: error: 'i' was not declared in this scope
    8 |         for(in i=0; i<adj[root].size(); i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define MX 200005
using namespace std;
vector<int>adj[MX];
int vis[MX];
int dfs(int u){
  int ret=1;
  vis[u]=1;
  for(int v:adj[u])
    if(!vis[v])ret+=dfs(v);
  return ret;
}
int main()
{
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int u,v;
    cin>>u>>v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int mx=1;
  for(i=1;i<=n;i++)
    if(vis[i]!=0)
      mx=max(mx,dfs(i));
  cout<<mx<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: 'i' was not declared in this scope
   24 |   for(i=1;i<=n;i++)
      |       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
struct UnionFind {
  vector<int> a;
  UnionFind(int n) : a(n) {
    for(int i = 0; i < n; i++) a[i] = i;
  }

  int root(int x) { 
    if (a[x] == x) return x;
    return a[x] = root(a[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    a[rx] = ry;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  } 
};

int main() {
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  rep (i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }

  map<int, int> mp;
  rep (i, n) {
    mp[uf.root(i)]++;
  }

  vector<int> a;
  for (auto v : mp) a.push_back(v.second);
  sort(a.begin(), a.end());
  ll minus = 0;
  for (int i = 0; i < a.size() i++) {
    a[i] -= minus;
    minus = a[i];
    ans += minus;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:31: error: expected ';' before 'i'
   63 |   for (int i = 0; i < a.size() i++) {
      |                               ^~
      |                               ;
a.cc:66:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |     ans += minus;
      |     ^~~
      |     abs
a.cc:68:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> g[n+1];
  for(int i=0;i<m;i++){
  int x,y;
  cin>>x>>y;
    g[x].push_back(y);
  }
  int c=0;
  for(int i=0;i<n+1;i++){
  int k=g[i].size();
  c=max(x,k);}
  cout<<c+1;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'x' was not declared in this scope
   15 |   c=max(x,k);}
      |         ^
Language: Java

import java.util.*;
import java.io.*;

public class Main {
	static FastReader in = new FastReader();

	public static void main(String[] args) {
		solve();
	}

	static void solve() {
		int n = in.nextInt(), m = in.nextInt();
		
		HashSet<Integer>[] edges = new HashSet[n];
		for(int i = 0; i < n; i++) edges[i] = new HashSet<>();
		for(int i = 0; i < m; i++)
		{
			int a = in.nextInt() - 1, b = in.nextInt() - 1;
			edges[a].add(b);
			edges[b].add(a);
		}
		ff(n, edges);
	}
	
	static void ff(int n, HashSet<Integer>[] adj)
	{
		Queue<Integer> q = new LinkedList<Integer>();
		int maxsize = 0;
		boolean[] visited = new boolean[n];
		for(int i = 0; i < n; i++)
		{
			if(!visited[i])
			{
				int currsize = 0;
				q.add(i);
				visited[i] = true;
				while(!q.isEmpty())
				{
					int curr = q.poll();
					currsize++;
					for(int adjnode : adj[curr])
					{
						visited[adjnode] ? continue : visited[adjnode] = true;
						q.add(adjnode);
					}
				}
				maxsize = Math.max(currsize,  maxsize);
			}
			
		}
		System.out.println(maxsize);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readarr(int abc) {
			int[] a = new int[abc];
			for (int i = 0; i < abc; i++)
				a[i] = nextInt();
			return a;
		}
	}
}





Compiler output:
Main.java:43: error: illegal start of expression
						visited[adjnode] ? continue : visited[adjnode] = true;
						                   ^
Main.java:43: error: not a statement
						visited[adjnode] ? continue : visited[adjnode] = true;
						                 ^
Main.java:43: error: ';' expected
						visited[adjnode] ? continue : visited[adjnode] = true;
						                           ^
3 errors
Language: C++

#if loc||local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i,n) for(ll i=0;i<ll(n);++i)
#define repr(i,n) for(ll i=ll(n);i-->0;)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n,m;
  cin>>n>>m;
  vector<vector<int>> adj(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    adj[a].emplace_back(b);
    adj[b].emplace_back(a);
  }
  vector<int> seen(n);
  auto dfs = [&](auot&&dfs,int cur,int prv)->int{
    if(seen[cur])return 0;
    seen[cur] = 1;
    int res = 0;
    for(auto to:adj[cur])if(to!=prv)res+=dfs(dfs,to,cur);
    return res;
  };
  int ans = 0;
  rep(i,n)chmax(ans,dfs(dfs,i,-1));
  cout<<(ans)<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:18: error: 'auot' has not been declared
   43 |   auto dfs = [&](auot&&dfs,int cur,int prv)->int{
      |                  ^~~~
a.cc: In lambda function:
a.cc:47:45: error: expression cannot be used as a function
   47 |     for(auto to:adj[cur])if(to!=prv)res+=dfs(dfs,to,cur);
      |                                          ~~~^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:51:24: error: no match for call to '(main()::<lambda(int&&, int, int)>) (main()::<lambda(int&&, int, int)>&, ll&, int)'
   51 |   rep(i,n)chmax(ans,dfs(dfs,i,-1));
      |                     ~~~^~~~~~~~~~
a.cc:43:14: note: candidate: 'main()::<lambda(int&&, int, int)>'
   43 |   auto dfs = [&](auot&&dfs,int cur,int prv)->int{
      |              ^
a.cc:43:14: note:   no known conversion for argument 1 from 'main()::<lambda(int&&, int, int)>' to 'int&&'
Language: C++

#if loc||local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i,n) for(ll i=0;i<ll(n);++i)
#define repr(i,n) for(ll i=ll(n);i-->0;)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n,m;
  cin>>n>>m;
  vector<vector<int>> adj(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    adj[a].emplace_back(b);
    adj[b].emplace_back(a);
  }
  vector<int> seen(n);
  auto dfs = [&](auot&&dfs,int cur,int prv)->int{
    if(seen[cur])return 0;
    seen[cur] = 1;
    int res = 0;
    for(auto to:adj[cur])if(to!=prv)res+=dfs(dfs,to,cur);
    return res;
  };
  int ans = 0;
  rep(i,n)chmax(ans,dfs(dfs,i));
  cout<<(ans)<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:18: error: 'auot' has not been declared
   43 |   auto dfs = [&](auot&&dfs,int cur,int prv)->int{
      |                  ^~~~
a.cc: In lambda function:
a.cc:47:45: error: expression cannot be used as a function
   47 |     for(auto to:adj[cur])if(to!=prv)res+=dfs(dfs,to,cur);
      |                                          ~~~^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:51:24: error: no match for call to '(main()::<lambda(int&&, int, int)>) (main()::<lambda(int&&, int, int)>&, ll&)'
   51 |   rep(i,n)chmax(ans,dfs(dfs,i));
      |                     ~~~^~~~~~~
a.cc:43:14: note: candidate: 'main()::<lambda(int&&, int, int)>'
   43 |   auto dfs = [&](auot&&dfs,int cur,int prv)->int{
      |              ^
a.cc:43:14: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <bits/stdc++.h>

using namespace std;

int explore(int root, int parent, const vector< vector<int> >& graph, vector<int>& component_id, int color) {
    component_id[root] = color;
    int tam = 1; // Só o vértice sozinho... 
    for(const auto& viz : graph[root]) {
        if(component_id[viz] == -1) {
            tam += explore(viz, root, graph, component_id, color);
        }
    }
    return tam;
}


int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n, m;
    cin >> n >> m;
    vector< vector<int> > graph(n);

    for(int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> component_id(n, -1);
    int cor_atual = 0;
    int maior_tamanho_de_componente = 0;
    
    for(int i = 0; i < n; ++i) {
        if(component_id[i] == -1) {
            int T = explore(i, -1, graph, component_id, cor_atual);
            maior_tamanho_de_componente = max(maior_tamanho_de_componente, T); 
            cor_atual++;
        }
    }
    
    cout << maior_tamanho_de_componente << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'g' was not declared in this scope
   28 |         g[a].push_back(b);
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
 
vector<ll> adj[200006];
vector<bool> visit(200004,0);
 
void dfs(ll node,ll &c)
{
    visit[node]=true;
    c++;
    for(auto child:adj[node])
    {
        if(visit[child]==false)
        {
            dfs(child,c);
        }
    }
}
 
void solve()
{
    ll n,e,a,b,res=0,c,i;
    cin>>n>>e;
    // visit.resize(n+1,false);
 
    while(e--)
    {
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
 
    for(i=1;i<=n;i++)
    {
        if(visit[i]==false)
        {
            c=0;
            dfs(i,c);
            res=max(res,c);
        }
    }
 
    cout<<res;
}
 
int main()
{
   solve();
}

Compiler output:
a.cc: In function 'void dfs(ll, ll&)':
a.cc:10:5: error: reference to 'visit' is ambiguous
   10 |     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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit(200004,0);
      |              ^~~~~
a.cc:14:12: error: reference to 'visit' is ambiguous
   14 |         if(visit[child]==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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit(200004,0);
      |              ^~~~~
a.cc: In function 'void solve()':
a.cc:36:12: error: reference to 'visit' is ambiguous
   36 |         if(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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit(200004,0);
      |              ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
 
vector<ll> adj[200006];
vector<bool> visit;
 
void dfs(ll node,ll &c)
{
    visit[node]=true;
    c++;
    for(auto child:adj[node])
    {
        if(visit[child]==false)
        {
            dfs(child,c);
        }
    }
}
 
void solve()
{
    ll n,e,a,b,res=0,c,i;
    cin>>n>>e;
    visit.resize(n+1,false);
 
    while(e--)
    {
        cin>>a>>b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
 
    for(i=1;i<=n;i++)
    {
        if(visit[i]==false)
        {
            c=0;
            dfs(i,c);
            res=max(res,c);
        }
    }
 
    cout<<res;
}
 
int main()
{
   solve();
}

Compiler output:
a.cc: In function 'void dfs(ll, ll&)':
a.cc:10:5: error: reference to 'visit' is ambiguous
   10 |     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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit;
      |              ^~~~~
a.cc:14:12: error: reference to 'visit' is ambiguous
   14 |         if(visit[child]==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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit;
      |              ^~~~~
a.cc: In function 'void solve()':
a.cc:25:5: error: reference to 'visit' is ambiguous
   25 |     visit.resize(n+1,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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit;
      |              ^~~~~
a.cc:36:12: error: reference to 'visit' is ambiguous
   36 |         if(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:6:14: note:                 'std::vector<bool> visit'
    6 | vector<bool> visit;
      |              ^~~~~
Language: C++

#include<iostream>
using namespace std;
const int N = 2e5 + 5;
int n,m, siz[N] , par[N];
int dsu_parent(int node){
    if(node==par[node){
        return node;
    }
    return par[node] = dsu_parent(par[node]);
}
void dsu_union(int a,int b){
    a = dsu_parent(a);
    b = dsu_parent(b);
    if(a==b)return;
    if(siz[a]<siz[b])swap(a,b);
    par[b]=a;
    siz[a]+=siz[b];
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        par[i]=i;
        siz[i]=1;
    }
    for(int i=1;i<=m;i++){
        int u,v;cin>>u>>v;
        dsu_union(u,v);
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
      	if(i==par[i])ans = max(ans , siz[i] );
    }
    cout<<ans;
}


Compiler output:
a.cc: In function 'int dsu_parent(int)':
a.cc:6:22: error: expected ']' before ')' token
    6 |     if(node==par[node){
      |                      ^
      |                      ]
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int n,m;cin>>n>>m;
    vector<int> popu(n);
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        popu[a].push_back(b);
        popu[b].push_back(a);
    }
    
    vector<int> list(n);
    priority_queue<int> max;
    
    for(int i=0;i<n;i++){
        if(list[i]!=0) continue;
        vector<int> dist(n);
        queue<int> que;

        dist[i]=0;
        que.push(i);
        int sum = 0;

        while(!que.empty()){
            int p=que.front();
            que.pop();

            for(auto np:popu[p]){
                if(dist[np]!=0)continue;
                dist[np]=1;
                sum+=1;
                que.push(np);
            }
        }
        max.push(sum);
    }
    cout << max.top();   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: request for member 'push_back' in 'popu.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   12 |         popu[a].push_back(b);
      |                 ^~~~~~~~~
a.cc:13:17: error: request for member 'push_back' in 'popu.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   13 |         popu[b].push_back(a);
      |                 ^~~~~~~~~
a.cc:32:31: error: 'begin' was not declared in this scope
   32 |             for(auto np:popu[p]){
      |                               ^
a.cc:32:31: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:32:31: error: 'end' was not declared in this scope
   32 |             for(auto np:popu[p]){
      |                               ^
a.cc:32:31: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
    int n,m;cin>>n>>m;
    vector<int> pop(n);
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        pop[a].push_back(b);
        pop[b].push_back(a);
    }
    
    vector<int> list(n);
    priority_queue<int> max;
    
    for(int i=0;i<n;i++){
        if(list[i]!=0) continue;
        vector<int> dist(n);
        queue<int> que;

        dist[i]=0;
        que.push(i);
        int sum = 0;

        while(!que.empty()){
            int p=que.front();
            que.pop();

            for(auto np:pop[p]){
                if(dist[np]!=0)continue;
                dist[np]=1;
                sum+=1;
                que.push(np);
            }
        }
        max.push(sum);
    }
    cout << max.top();   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: request for member 'push_back' in 'pop.std::vector<int>::operator[](((std::vector<int>::size_type)a))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   12 |         pop[a].push_back(b);
      |                ^~~~~~~~~
a.cc:13:16: error: request for member 'push_back' in 'pop.std::vector<int>::operator[](((std::vector<int>::size_type)b))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   13 |         pop[b].push_back(a);
      |                ^~~~~~~~~
a.cc:32:30: error: 'begin' was not declared in this scope
   32 |             for(auto np:pop[p]){
      |                              ^
a.cc:32:30: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:32:30: error: 'end' was not declared in this scope
   32 |             for(auto np:pop[p]){
      |                              ^
a.cc:32:30: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
Language: Java

import java.util.*;
public class Friends {
	private static int count=0;
	
	void addEdge(ArrayList<ArrayList<Integer>> adj,int u,int v) {
		adj.get(u).add(v);
		adj.get(v).add(u);
	}

	void DFS(ArrayList<ArrayList<Integer>> adj,int v,int n) {
		boolean[] visited=new boolean[n];
		for(int i=0;i<n;i++) {
			visited[i]=false;
		}
		
		DFSutil(adj,v,n,visited);
	}
	
	void DFSutil(ArrayList<ArrayList<Integer>> adj,int v,int n,boolean[] visited) {
		visited[v]=true;
//		System.out.println(v+" ");
		count+=1;
		
		Iterator<Integer> i = adj.get(v).listIterator();
		while(i.hasNext()) {
			int o=i.next();
			if(!visited[o]) {
				DFSutil(adj,o,n,visited);
			}
		}
	}
	
	int CountComponent(ArrayList<ArrayList<Integer>> adj,int v,int n) {
		boolean[] visited=new boolean[n];
		int maxcnt=0;
		for(int i=0;i<n;i++) {
			if(!visited[i]) {
				 DFSutil(adj,v,n,visited);
			}
			if(i==0) {
				maxcnt=count;
			}
			else {
				if(maxcnt<count) {
					maxcnt=count;
				}
			}
			count=0;
		}
		return maxcnt;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		int m=input.nextInt();
		Friends graph=new Friends();
		ArrayList<ArrayList<Integer>> adj=new ArrayList<ArrayList<Integer>>(n);
		for(int i=0;i<n;i++) {
			adj.add(new ArrayList<Integer>());
		}
		for(int i=0;i<m;i++) {
			int a=input.nextInt()-1;
			int b=input.nextInt()-1;
			graph.addEdge(adj, a, b);
		}
		int ans1=graph.CountComponent(adj,0,n);
		System.out.println(ans1);
		
	}

}


Compiler output:
Main.java:2: error: class Friends is public, should be declared in a file named Friends.java
public class Friends {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair

#define cerr cout
#define endl '\n'
using namespace std;

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ld eps = 1e-7;
const ll mod = 1000000007;
const ll N = 998244353;

ll binpow(ll b, ll p){ ll ans = 1; while(p > 0){if(p & 1) ans = (ans * b) % mod; b = (b * b) % mod; p >>= 1;}return ans;}
ll modinv(ll x){return binpow(x, mod - 2);}

const int mxn = 2e5 + 100;
vi adj[mxn];
bool vis[mxn];
set<int> s;

void dfs(int v)
{
	vis[v] = 1;
	s.insert(v);
	for(int u : adj[v])
	{
		if(!vis[u])
			dfs(u);
	}
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m, i, ans = 0, a , b;
	cin >> n >> m;
	while(m--)
	{
		cin >> a >> b;
		adj[a].eb(b);
		adj[b].eb(a);
	}
	for(i = 1; i <= n; i++)
	{
		if(!vis[i])
			dfs(i);
		ans = max(sz(s), ans);
		s.clear();
	}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:27: error: 'sz' was not declared in this scope; did you mean 's'?
   73 |                 ans = max(sz(s), ans);
      |                           ^~
      |                           s
Language: C++

#include <bits/stdc++.h>
#include <limits>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
#define fi(i, n) for( int i=0 ; i<n ; i++ )
#define f(i, a, b) for( int i=a ; i<b ; i++ )
#define vi vector<int>
#define pb push_back
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
ll fact(ll n)
{
    ll ans = 1e14;
    for(ll i = 1; i<=sqrt(n); i++)
    {
        if(n%i==0)
        {
            ll sol = (i - 1) + (n/i - 1);
            ans = min(ans,sol);
        }
    }
    return ans;
}
int visited[200000] = {0};
vector<vector<int> > v(200000);
int dfs(int x)
{
    int ans = 0;
    if(visited[x]==0)
    {
        visited[x] = 1;
        ans++;
        for(auto it = v[x].begin();v[x].end();it++)
        {
            ans = ans + dfs(it);
        }
    }
    return ans;
}
int main()
{
    ll n,m;
    cin>>n>>m;
    fi(i,m)
    {
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int ans = 0;
    fi(i,n)
    {
        if(visited[i]==0)
        {
            ans = max(ans,dfs(i));
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:39:44: error: could not convert '(& v.std::vector<std::vector<int> >::operator[](((std::vector<std::vector<int> >::size_type)x)))->std::vector<int>::end()' from 'std::vector<int>::iterator' to 'bool'
   39 |         for(auto it = v[x].begin();v[x].end();it++)
      |                                    ~~~~~~~~^~
      |                                            |
      |                                            std::vector<int>::iterator
a.cc:41:29: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int'
   41 |             ans = ans + dfs(it);
      |                             ^~
      |                             |
      |                             __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:32:13: note:   initializing argument 1 of 'int dfs(int)'
   32 | int dfs(int x)
      |         ~~~~^
Language: C++

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 5;

int n, m, visit[N];
vector<int> adj[N];

int dfs(int node) {
	if(visit[node])
		return 0;
	visit[node] = 1;
	int ret = 1;
	for(int x: adj[node])
		ret += dfs(x);
	return ret;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;

    REP(i, 0, m) {
    	int x, y;
    	cin >> x >> y;
    	--x, --y;
    	adj[x].pb(y);
    	adj[y].pb(x);
    }
    int res = 0;
    REP(i, 0, n) {
    	if(!visit[i]) {
    		chkmax(res, dfs(i));
    	}
    }
    cout << res << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:26:12: error: reference to 'visit' is ambiguous
   26 |         if(visit[node])
      |            ^~~~~
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:22:11: note:                 'int visit [200005]'
   22 | int n, m, visit[N];
      |           ^~~~~
a.cc:28:9: error: reference to 'visit' is ambiguous
   28 |         visit[node] = 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:22:11: note:                 'int visit [200005]'
   22 | int n, m, visit[N];
      |           ^~~~~
a.cc: In function 'int main()':
a.cc:49:13: error: reference to 'visit' is ambiguous
   49 |         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:22:11: note:                 'int visit [200005]'
   22 | int n, m, visit[N];
      |           ^~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
 
struct UnionFind {
	vector<int> r;
 
	UnionFind(int N) {
		r = vector<int>(N, -1);
	}
	int root(int x) {
		if (r[x] < 0)return x;
		return r[x] = root(r[x]);
	}

Compiler output:
a.cc:15:10: error: expected '}' at end of input
   15 |         }
      |          ^
a.cc:6:18: note: to match this '{'
    6 | struct UnionFind {
      |                  ^
a.cc:15:10: error: expected unqualified-id at end of input
   15 |         }
      |          ^
Language: C++

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

const int MaxN=2e5;
const int MaxM=2e5;

int cnt[MaxN+1];
int who[MaxN+1];

inline int FindRoot(int x){
	if(who[x]!=x)
		who[x]=FindRoot(who[x]);
	return who[x];
}
int main(){
	int N, M;
	int A, B, who_A, who_B;
	
	scanf("%d %d\n",&N,&M);
	for(int i=1;i<=N;i++)
		who[i]=i, cnt[i]=1;
	int ans=1;
	while(M-->0){
		scanf("%d %d\n",&A,&B);
		who_A=FindRoot(A);
		who_B=FindRoot(B);
		if(who_A==who_B) continue;
		if(cnt[who_A]<cnt[who_B])
			swap(who_A,who_B);
		who[who_B]=who_A;
		cnt[who_A]=+=cnt[who_B];
		ans=max(ans,cnt[who_A]);
	}
	printf("%d\n",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected primary-expression before '+=' token
   31 |                 cnt[who_A]=+=cnt[who_B];
      |                            ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

//#define cin fi
//#define cout fo
//
//ifstream fi ("");
//ofstream fo (".INP");

int cnt;
int n , u, v;
int vis[1000001];
int adj[1000001];

void dfs(int u){
	cnt++;
	vis[u] = 1;
	for (int v : adj[u]){
		if (!vis[v]) dfs(v);
	}
}

int main(){
//	freopen("test.txt" , "r" , stdin);
//	ios_base:: sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= m  ; i++){
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_bakc(u);
	}
	int res = 0;
	for (int i = 1; i <= n ; i++){
		if (!vis[i]){
			cnt = 0;
			dfs(i);
			res = min (res, cnt);
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:19:27: error: 'begin' was not declared in this scope
   19 |         for (int v : adj[u]){
      |                           ^
a.cc:19:27: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:19:27: error: 'end' was not declared in this scope
   19 |         for (int v : adj[u]){
      |                           ^
a.cc:19:27: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc: In function 'int main()':
a.cc:29:21: error: 'm' was not declared in this scope
   29 |         cin >> n >> m;
      |                     ^
a.cc:32:24: error: request for member 'push_back' in 'adj[u]', which is of non-class type 'int'
   32 |                 adj[u].push_back(v);
      |                        ^~~~~~~~~
a.cc:33:24: error: request for member 'push_bakc' in 'adj[v]', which is of non-class type 'int'
   33 |                 adj[v].push_bakc(u);
      |                        ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<vector<int> > gr;
vector<bool> visit;
vector<int> ele;
vector<int> grup;
void dfs(int u,int t){
	visit[u] = true;
	grup[u] = t;
	for(int v : gr[u])
		if(!visit[v])
			dfs(v,t);
}
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	gr.assign(n+1,vector<int>());
	visit.assign(n+1,false);
	ele.assign(n+1,0);
	grup.assign(n+1,0);
	int a,b;
	while(m--){
		scanf("%d %d",&a,&b);
		gr[a].push_back(b);
		gr[b].push_back(a);
	}
	int t = 1;
	for(int i = 1; i <= n; i++){
		if(!visit[i]){
			dfs(i,t);
			t++;
		}
	}
	for(int x : grup)
		if(x)
			ele[x]++;
	sort(ele.begin(), ele.end());
	printf("%d\n", ele[n]);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:8:9: error: reference to 'visit' is ambiguous
    8 |         visit[u] = 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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc:11:21: error: reference to 'visit' is ambiguous
   11 |                 if(!visit[v])
      |                     ^~~~~
/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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc: In function 'int main()':
a.cc:18:9: error: reference to 'visit' is ambiguous
   18 |         visit.assign(n+1,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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc:29:21: error: reference to 'visit' is ambiguous
   29 |                 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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<vector<int> > gr;
vector<bool> visit;
vector<int> ele;
vector<int> grup;
void dfs(int u,int t){
	visit[u] = 1;
	grup[u] = t;
	for(int v : gr[u])
		if(!visit[v])
			dfs(v,t);
}
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	gr.assign(n+1,vector<int>());
	visit.assign(n+1,false);
	ele.assign(n+1,0);
	grup.assign(n+1,0);
	int a,b;
	while(m--){
		scanf("%d %d",&a,&b);
		gr[a].push_back(b);
		gr[b].push_back(a);
	}
	int t = 1;
	for(int i = 1; i <= n; i++){
		if(!visit[i]){
			dfs(i,t);
			t++;
		}
	}
	for(int x : grup)
		if(x)
			ele[x]++;
	sort(ele.begin(), ele.end());
	printf("%d\n", ele[n]);
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int, int)':
a.cc:8:9: error: reference to 'visit' is ambiguous
    8 |         visit[u] = 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:4:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc:11:21: error: reference to 'visit' is ambiguous
   11 |                 if(!visit[v])
      |                     ^~~~~
/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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc: In function 'int main()':
a.cc:18:9: error: reference to 'visit' is ambiguous
   18 |         visit.assign(n+1,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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
a.cc:29:21: error: reference to 'visit' is ambiguous
   29 |                 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:14: note:                 'std::vector<bool> visit'
    4 | vector<bool> visit;
      |              ^~~~~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int dfs(vector<vector<int>> & g, vector<bool> & b, int idx)
{
  	b[idx] = false;
	int cnt = 1;
	for (int i = 0, len = g[idx].size(); i < len; i++)
		if (b[i]) cnt += dfs(g, b, i);
	return cnt;
}

int main(void)
{
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n, m;
  cin >> n >> m;
  
  vector<vector<int>> g;
  g.resize(n);
  
  for (int i = 0, j, k; i < m; i++)
  {
	cin >> j >> k;
	g[j-1].push_back(k-1);
	g[k-1].push_back(j-1);
  }
  
  vector<bool> b;
  b.resize(n);
  for (int i = 0; i < n; i++) b[i] = true; 

  int max = 0;
  for (int i = 0; i < n; i++)
	if (b[i]) max = max < (cnt = dfs(g, b, i)) ? cnt : max;

  cout << max;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:32: error: 'cnt' was not declared in this scope; did you mean 'int'?
   40 |         if (b[i]) max = max < (cnt = dfs(g, b, i)) ? cnt : max;
      |                                ^~~
      |                                int
Language: C++

#include<iostream>
#include<vector>

using namespace std;

void dfs(vector<vector<int>> & g, vector<bool> & b, int idx)
{
  	b[idx] = false;
	for (int i = 0, len = g[idx].length(); i < len; i++)
		if (b[i]) dfs(g, b, i);
}

int main(void)
{
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  
  int n, m;
  cin >> n >> m;
  
  vector<vector<int>> g;
  g.resize(n);
  
  for (int i = 0, j, k; i < m; i++)
  {
	cin >> j >> k;
	g[j].push_back(k);
	g[k].push_back(j);
  }
  
  vector<bool> b;
  b.resize(n);
  for (bool & i : b) i = true; 

  int cnt = 0;
  for (int i = 0; i < n; i++)
  {
	if (b[i])
	{
	  cnt++;
	  dfs(g, b, i);
	}
  }
  cout << cnt;
  
  return 0;
}


Compiler output:
a.cc: In function 'void dfs(std::vector<std::vector<int> >&, std::vector<bool>&, int)':
a.cc:9:38: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'length'
    9 |         for (int i = 0, len = g[idx].length(); i < len; i++)
      |                                      ^~~~~~
a.cc: In function 'int main()':
a.cc:34:19: error: cannot bind non-const lvalue reference of type 'bool&' to an rvalue of type 'bool'
   34 |   for (bool & i : b) i = true;
      |                   ^
In file included from /usr/include/c++/14/vector:67,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_bvector.h:99:5: note:   after user-defined conversion: 'std::_Bit_reference::operator bool() const'
   99 |     operator bool() const _GLIBCXX_NOEXCEPT
      |     ^~~~~~~~