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

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define se second
#define fr first
using namespace std;

const ll N = 2e5 + 7;
const ll mod = 1e9 + 7;

ll n , m , a , cnt , b , c , ans ;
vector<int>g[N];
set<int>st;
ll used[N];
int main(){
    cin >> n >> m;
    for( int i = 0;i < m;i ++ ){
        ll x , y;
        cin >> x >> y;
        g[x].pb(y);
        g[y].pb(x);
    }
    dfs(1);
    for( int i = 1;i <= n;i ++ ){
        if( !used[i] ){
                dfs(i);
                ans ++;
        }
    }
    cout << ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:23:5: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   23 |     dfs(1);
      |     ^~~
      |     ffs
Language: C++

#include<bits/stdc++.h>
#include<vector>
#include<atcoder/dsu>
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;

int main(){
    int N, M;
    cin >> N >> M;
    dsu d(N);
    int A[N], B[N];
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        d.merge(A[i], B[i]);
    }

    int lead[N];
    ll ans=0;
    lead[0] = d.leader(1);
    for(int i=0; i<N; i++){
        lead[i] = d.leader(i+1);
        if(lead[0] !=lead[i]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc:3:9: fatal error: atcoder/dsu: No such file or directory
    3 | #include<atcoder/dsu>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <set>
using namespace std;
#define ll long long 
#define vvll vector<vector<long long>>
#define vll vector<long long>
#define fri(i,n) for(int i=0;i<n;i++)
#define fri1(i,n) for(int i=n-1;i>=0;i--)
#define map map<ll,ll>
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ump unordered_map<long long ,long long>
#define ub upper_bound
#define bsearch binary_search
ll parent[100001]={0};
int find(int x)
{
    if(parent[x]!=x)
    {
        parent[x]=find(parent[x]);
    }
    return parent[x];
}
int main() 
{
    fast
    ll n,m,x,y;
    cin>>n>>m;
    fri(i,n)
    {
        parent[i]=i;
    }
    fri(i,m)
    {
        cin>>x>>y;
        if(find(y)!=find(x))
        {
        parent[y]=x;
        }
    }
    
    cout<<st.size()-1<<"\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:11: error: 'st' was not declared in this scope; did you mean 'std'?
   42 |     cout<<st.size()-1<<"\n";
      |           ^~
      |           std
Language: C++

#include<bits/stdc++.h>
#include<vector>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;

int main(){
    int N, M;
    cin >> N >> M;
    dsu d(N);
    int A[N], B[N];
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        d.merge(A[i], B[i]);
    }

    int lead[N];
    ll ans=0;
    lead[0] = d.leader(1);
    for(int i=0; i<N; i++){
        lead[i] = d.leader(i+1);
        if(lead[0] !=lead[i]){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc:3:9: fatal error: atcoder/all: No such file or directory
    3 | #include<atcoder/all>
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <atcoder/dsu>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 59);
constexpr ll MOD = 1000000007ll;

// structure ------------------------------------------

// // Unionfind 素集合データ構造
// struct Unionfind {
// 	vector<ll> par;
// 	vector<ll> rank;

// 	Unionfind(ll n) : par(n), rank(n) {
// 		REP(i, n) { par[i] = i; }
// 	}

// 	ll root(ll v) {
// 		if(par[v] == v) return v;
// 		return par[v] = root(par[v]);
// 	}

// 	void unite(ll x, ll y) {
// 		x = root(x);
// 		y = root(y);
// 		if(x == y) return;

// 		if(rank[x] < rank[y]) {
// 			par[x] = y;
// 		} else {
// 			par[y] = x;
// 			if(rank[x] == rank[y]) { rank[x]++; }
// 		}
// 	}

// 	bool is_same(ll x, ll y) { return root(x) == root(y); }
// };


// function -------------------------------------------


// main -----------------------------------------------

int main() {

	ll n, m;
	cin >> n >> m;
  
  atcoder::dsu uf(n);

	REP(i, m){
		ll a, b;
		cin >> a >> b;
		a --;
		b --;
		// 要素aが含まれる集合とbが含まれる集合を結合
		uf.marge(a, b);
	}

	set<ll> st;
	REP(i, n){
		// 要素iが含まれる集合の親の種類をカウント
		// cout << uf.root(i) << endl;
		if(st.count(uf.leader(i)) == 0){
			st.insert(uf.leader(i));
		}
	}

	// カウント-1が答え
	cout << ((ll)st.size() - (ll)1) << endl;

}

Compiler output:
a.cc:2:10: fatal error: atcoder/dsu: No such file or directory
    2 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
using namespace std;
unordered_map<int, int> map;

void createnode(int node)
{
  map[node] = node;
}

int findparent(int node)
{
  if (node == map[node])
    return node;
  map[node] = findparent(node)
  return map[node];
}

void mergenodes(int node1, int node2)
{
  int a = findparent(node1);
  int b = findparent(node2);
  if (a == b)
    return;
  if ( a < b)
    swap(a, b);
  map[b] = a;
}

int main() {
    int n, m;
  	cin >> n >> m;  	
  	int x = m;
  	while (x)
    {
      x -= 1;
      int a, b;
      cin >> a >> b;
      if (map.find(a) == map.end())
      	createnode(a);
      if (map.find(b) == map.end())
        createnode(b);
      mergenodes(a, b);
    }
  	unordered_set<int> s1;
  	for(int i=1; i<=n; i++)
    {
      int a = findparent(i);
      s1.insert(a);
    }
  	cout<<s1.size()-1;  	
  
}

Compiler output:
a.cc: In function 'int findparent(int)':
a.cc:18:31: error: expected ';' before 'return'
   18 |   map[node] = findparent(node)
      |                               ^
      |                               ;
   19 |   return map[node];
      |   ~~~~~~                       
a.cc:18:13: warning: control reaches end of non-void function [-Wreturn-type]
   18 |   map[node] = findparent(node)
Language: C++

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

int main(){
    int n,m;
    cin >> n >> m;
    dsu d(n);
    vector<int> v(2);
    for(int i=0; i<m; i++){
        cin >> v.at(0) >> v.at(1);
        d.merge(v.at(0)-1,v.at(1)-1);
    }
    if(d.same(0,n-1) == 1){
        cout << 0 << endl;
        return 0;
    }
    else{
        cout << 1 << endl;
        return 0;
    }
}

Compiler output:
a.cc:1:10: fatal error: atcoder/dsu: No such file or directory
    1 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdlib.h>

#include<iostream>
#include<vector>
using namespace std;
int vis[100001];
vector<int> arr[100001];
void dfs(int node)
{
    vis[node]=1;
    for(int child: arr[node])
        if(vis[child]==0)
        dfs(child);
}
int main()
{
    ll a,b,n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
        cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);  
    int co=0;
    for(int i=1;i<=n;i++)
        if(!vis[i])
        dfs(i),co++;
    cout<<co-1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'll' was not declared in this scope
   17 |     ll a,b,n,m;
      |     ^~
a.cc:18:10: error: 'n' was not declared in this scope
   18 |     cin>>n>>m;
      |          ^
a.cc:18:13: error: 'm' was not declared in this scope; did you mean 'tm'?
   18 |     cin>>n>>m;
      |             ^
      |             tm
a.cc:20:14: error: 'a' was not declared in this scope
   20 |         cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);
      |              ^
a.cc:20:17: error: 'b' was not declared in this scope
   20 |         cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);
      |                 ^
Language: C++

#include<stdlib.h>
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
using namespace std;
int vis[100001];
vector<int> arr[100001];
void dfs(int node)
{
    vis[node]=1;
    for(int child: arr[node])
        if(vis[child]==0)
        dfs(child);
}
int main()
{
    ll a,b,n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
        cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);  
    int co=0;
    for(int i=1;i<=n;i++)
        if(!vis[i])
        dfs(i),co++;
    cout<<co-1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'll' was not declared in this scope
   17 |     ll a,b,n,m;
      |     ^~
a.cc:18:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   18 |     cin>>n>>m;
      |          ^
      |          yn
a.cc:18:13: error: 'm' was not declared in this scope; did you mean 'tm'?
   18 |     cin>>n>>m;
      |             ^
      |             tm
a.cc:20:14: error: 'a' was not declared in this scope
   20 |         cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);
      |              ^
a.cc:20:17: error: 'b' was not declared in this scope
   20 |         cin>>a>>b,arr[a].push_back(b),arr[b].push_back(a);
      |                 ^
Language: C++

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

int main()
{
  int city, road;
  
  cin>>city>>road;
  
  bool p[city+1]={false};
  
  for(int i=1; i<=road; i++)
  {
    int begin, end;
    
    cin>>begin>>end;
    
    p[begin]=true;
    p[end]=true;
  }
  
  int ans=0;
  
  for(int i=1; i<=city; i++)
  {
    if(p[i]=false)
    {
      ans++;
    }
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inclide; did you mean #include?
    1 | #inclide<bits/stdc++.h>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin>>city>>road;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inclide<bits/stdc++.h>
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout<<ans<<endl;
      |   ^~~~
a.cc:32:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:14: error: 'endl' was not declared in this scope
   32 |   cout<<ans<<endl;
      |              ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inclide<bits/stdc++.h>
Language: C++

#include <atcoder/convolution>
#include <atcoder/dsu>
#include <atcoder/fenwicktree>
#include <atcoder/lazysegtree>
#include <atcoder/math>
#include <atcoder/maxflow>
#include <atcoder/mincostflow>
#include <atcoder/modint>
#include <atcoder/scc>
#include <atcoder/segtree>
#include <atcoder/string>
#include <atcoder/twosat>


Compiler output:
a.cc:1:10: fatal error: atcoder/convolution: No such file or directory
    1 | #include <atcoder/convolution>
      |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <atcoder/scc>

using namespace std;
using namespace atcoder;

int main(){
  int N , M;
  int A, B;
  cin >> N >> M;
  
  scc_graph g(N);
  
  for(int i = 0; i < M; i++){
    cin >> A >> B;
    g.add_edge(A, B);
    g.add_edge(B, A);
  }
  
  auto scc = g.scc();
  
  cout << scc.size() << endl;
  
  return 0;
}

Compiler output:
a.cc:3:10: fatal error: atcoder/scc: No such file or directory
    3 | #include <atcoder/scc>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++


#include<bits/stdc++.h>
#define int long long
#define nl '\n'
 using namespace std;

const int mod = 998244353;
const int N = 1E5 + 1;
vector<int> g[N];
bool vis[N];
int comps;

dfs(int node){
   vis[node] = true;
   for(int c : g[node]){
      if(!vis[c])
        dfs(c);
   }
}

int32_t main() 
{

  
  int n, m;
  cin >> n >> m;

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

  for(int i = 1; i <= n; i++){
     if(!vis[i]){
        comps++;
        dfs(i);
     }
  }

  cout << comps - 1;

  return 0;
}



Compiler output:
a.cc:13:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
   13 | dfs(int node){
      | ^~~
a.cc: In function 'int dfs(long long int)':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
Language: C++

#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
const int MAX_ROAD = 400001; 
int nl[MAX_ROAD], nr[MAX_ROAD];    
class DisjointSet
{
    private:
        unsigned int size;   
        int * a;    
    public:
        DisjointSet() { size = 0; a = NULL; }
        DisjointSet(unsigned int _size)
        {
            size = _size;
            a = new int[size+1];
            memset(a, -1, (size+1)*sizeof(int));。 
        }
        ~DisjointSet() { delete [] a; }
        int find(int x) 
        {
            
            if ( a[x] < 0 ) 
                return x;
            a[x] = find(a[x]); 
            return a[x];
        } 
        bool unionset(int x, int y)  
        {
            int rx = find(x);
            int ry = find(y);
            if ( rx < 0 || ry < 0 || rx == ry )   
                return false;
            if ( a[rx] < a[ry]  )    
            {
                a[rx] += a[ry];
                a[ry] = rx; 
            }
            else
            {
                a[ry] += a[rx];
                a[rx] = ry;
            }
            return true;
        } 
}; 
int main()
{
    int n_city = 0, n_road = 0;   
    scanf("%d %d", &n_city, &n_road);   
    
    for ( int i = 1; i <= n_road; ++i ) 
        scanf("%d %d", nl+i, nr+i); 
    
    DisjointSet c(n_city);
    int n_choice = 0;   
    vector<int> ans;   
    
   
    for ( int i = n_road; n_choice < n_city && i > 0; --i )    
    {
        int sl = c.find(nl[i]), sr = c.find(nr[i]);    
        if ( sl != sr )  
        {
            ++n_choice;
            ans.push_back(i);
            c.unionset(sl, sr);
        } 
    }   
    printf("%d\n", n_choice);
    for ( int i = n_choice - 1; i >=0; --i )
        printf("%d\n", ans[i]); 
    return 0;
} 

Compiler output:
a.cc:18:49: error: extended character 。 is not valid in an identifier
   18 |             memset(a, -1, (size+1)*sizeof(int));。
      |                                                 ^
a.cc: In constructor 'DisjointSet::DisjointSet(unsigned int)':
a.cc:18:49: error: '\U00003002' was not declared in this scope
   18 |             memset(a, -1, (size+1)*sizeof(int));。
      |                                                 ^~
Language: C++

#include<stdio.h>
#define MOD 1000000007
int findParent(int i,int parent[])
//function to find the connected component that the ith node belongs to
{
    if(parent[parent[i]]!=parent[i])
        parent[i]=findParent(parent[i],parent);
    return parent[i];
}
void unionNodes(int a,int b,int parent[],int size[])
//to merge the connected components of nodes a and b
{
    int parent_a=findParent(a,parent),parent_b=findParent(b,parent);
    if(parent_a==parent_b)
        return;
    if(size[parent_a]>=size[parent_b])//the larger connected component eats up the smaller one
    {
         size[parent_a]+=size[parent_b];
         parent[parent_b]=parent_a;
    }
    else
    {
         size[parent_b]+=size[parent_a];
         parent[parent_a]=parent_b;
    }
    return;
}

int main()
{

    int N,M,i,a,b;
    scanf(" %d %d",&amp;N,&amp;M);
    int parent[100001]={0},size[100001]={0};
    for(i=1;i<=N;i++)
    {
        parent[i]=i;
        size[i]=1;
    }

    for(i=1;i<=M;i++)
    {
        //scan each edge and merge the connected components of the two nodes
        scanf(" %d %d",&amp;a,&amp;b);
        unionNodes(a,b,parent,size);
    }

    for(i=1;i<=N;i++)
        printf("Node %d belongs to connected component %d\n",i,findParent(i,parent));
    long long ways=1;
    int nos=0;
    for(i=1;i<=N;i++)
    {
        if(findParent(i,parent)==i)//this condition is true only for disjoint connected components
        {
            
            nos++;
        }

    }
    printf("%d",nos);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:21: error: 'amp' was not declared in this scope
   33 |     scanf(" %d %d",&amp;N,&amp;M);
      |                     ^~~
a.cc:33:33: error: expected ';' before ')' token
   33 |     scanf(" %d %d",&amp;N,&amp;M);
      |                                 ^
      |                                 ;
a.cc:44:37: error: expected ';' before ')' token
   44 |         scanf(" %d %d",&amp;a,&amp;b);
      |                                     ^
      |                                     ;
Language: C++

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

int main(){

    int N,M;
    cin >> N >> M;
    vector<int> A(M),B(M);
    for(int i=0;i<M;i++){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }

    scc_graph graph(N);
    for(int i=0;i<M;i++){
        graph.add_edge(A[i],B[i]);
        graph.add_edge(B[i],A[i]);
    }

    auto scc = graph.scc();
    cout << scc.size() - 1;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: atcoder/scc: No such file or directory
    2 | #include <atcoder/scc>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <atcoder/dsu>
#include <bits/stdc++.h>
typedef long long ll;

#define for_(i, a, b) for(int i = (a); i < (b); ++i)
#define rfor_(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int d[5] = {0, 1, 0, -1, 0};

using namespace std;
using namespace atcoder;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    dsu d(N);
    ll Ans;
    int temp1, temp2;
    rep(i, M) {
        cin >> temp1 >> temp2;
        d.merge(temp1, temp2);
    }
    vector<vector<int>> group = d.groups();
    cout << group.size() - 1 << endl;

    
}


Compiler output:
a.cc:1:10: fatal error: atcoder/dsu: No such file or directory
    1 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
bool visit[100005];
vector<ll>xx[100005];

void check(ll ind)
{
    if(visit[ind]==1) return;
    visit[ind]=1;

    for(ll i=0;i<xx[ind].size();i++)
    {
        ll nx=xx[ind][i];
        if(visit[nx]==0)
        {
            check(nx);
        }
    }
}

int main()
{
    ll a,c,d,e,n,m,i,j,k=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a>>c;
        xx[a].push_back(c);
        xx[c].push_back(a);
    }
    check(1);

    for(j=1;j<=n;j++)
    {
        if(visit[j]==0)
        {
            k++;
        }
    }
    cout<<k<<endl;
}


Compiler output:
a.cc: In function 'void check(long long int)':
a.cc:10:8: error: reference to 'visit' is ambiguous
   10 |     if(visit[ind]==1) return;
      |        ^~~~~
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:6: note:                 'bool visit [100005]'
    5 | bool visit[100005];
      |      ^~~~~
a.cc:11:5: error: reference to 'visit' is ambiguous
   11 |     visit[ind]=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:6: note:                 'bool visit [100005]'
    5 | bool visit[100005];
      |      ^~~~~
a.cc:16:12: error: reference to 'visit' is ambiguous
   16 |         if(visit[nx]==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:5:6: note:                 'bool visit [100005]'
    5 | bool visit[100005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:37:12: error: reference to 'visit' is ambiguous
   37 |         if(visit[j]==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:5:6: note:                 'bool visit [100005]'
    5 | bool visit[100005];
      |      ^~~~~
Language: C++

#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long;
using vll = vector<long long>;
using vvll = vector<vll>;
const double EPS = 1e-9;
const long long MOD=1e9+7;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define SZ(x) ((int)(x).size())
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 (b<a) { a=b; return 1; } return 0; }

int main(){
  ll n,m; cin>>n>>m;
  dsu g(n);
  ll cnt=0;
 

  rep(i,m){
    ll a,b; cin>>a>>b;
    ll tmp = g.merge(a,b);
    
  }
  
  ll k=g.groups().size();
  while (k>1)
  {
    cnt += k/2;
    k = (k+1)/2;
  }
  
  
  cout<<cnt<<endl;
}

Compiler output:
a.cc:25:10: fatal error: atcoder/all: No such file or directory
   25 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <atcoder/scc>
using namespace std;
using namespace atcoder;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout << "NO" << endl
#define cono cout << "no" << endl
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){ //最大公約数
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    scc_graph g(n);
    rep0(i,m){
        int a,b;
        cin >> a >> b;
        g.add_edge(a,b);
        g.add_edge(b,a);
    }
    auto scc=g.scc();
    cout << n-scc.size() << endl;
}

Compiler output:
a.cc:2:10: fatal error: atcoder/scc: No such file or directory
    2 | #include <atcoder/scc>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
bool visit[200005];
vector<int>xx[200005];
void check(int ind)
{
    visit[ind]=1;

    for(int i=0;i<xx[ind].size();i++)
    {
        int nx=xx[ind][i];
        if(visit[nx]==0)
        {
            check(nx);
        }
    }
}

int main()
{

   int n,m,a,c,l=0,j;
   scanf("%d %d",&n,&m);
   while(m--)
   {
       scanf("%d %d",&a,&c);
       xx[a].push_back(c);
       xx[c].push_back(a);
   }
   check(1);
   for(j=1;j<=n;j++)
   {
       if(visit[j]==0)
       {
           l++;
       }
   }
   printf("%d\n",l);
   return 0;
}


Compiler output:
a.cc: In function 'void check(int)':
a.cc:7:5: error: reference to 'visit' is ambiguous
    7 |     visit[ind]=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:3:6: note:                 'bool visit [200005]'
    3 | bool visit[200005];
      |      ^~~~~
a.cc:12:12: error: reference to 'visit' is ambiguous
   12 |         if(visit[nx]==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:3:6: note:                 'bool visit [200005]'
    3 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:33:11: error: reference to 'visit' is ambiguous
   33 |        if(visit[j]==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:3:6: note:                 'bool visit [200005]'
    3 | bool visit[200005];
      |      ^~~~~
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {

  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] head = br.readLine().split(" ");
    int n = Integer.parseInt(head[0]);
    int m = Integer.parseInt(head[1]);
    DSU uf = new DSU(n);
    for(int i = 0; i < m; i++){
      String[] data = br.readLine().split(" ");
      int ai = Integer.parseInt(data[0]) - 1;
      int bi = Integer.parseInt(data[1]) - 1;
      uf.merge(ai, bi);
    }
    br.close();
    int ans = 0;
    ArrayList<ArrayList<Integer>> l = uf.groups();
    for(int i = 0; i < l.size(); i++){
      ArrayList ll = l.get(i);
      if(ll != null && ll.size() != 0){
        ans++;
      }
    }
    System.out.println(ans -1);

  }
}
class DSU {
  private int n;
  private int[] parentOrSize;

  public DSU(int n) {
    this.n = n;
    this.parentOrSize = new int[n];
    Arrays.fill(parentOrSize, -1);
  }

  int merge(int a, int b) {
    if (!(0 <= a && a < n) || !(0 <= b && b < n)) {
      // この式が成立しない物は動作しません。
      return -1;
    }
    int x = leader(a);
    int y = leader(b);
    if (x == y) return x;
    if (-parentOrSize[x] < -parentOrSize[y]) {
      int tmp = x;
      x = y;
      y = tmp;
    }
    parentOrSize[x] += parentOrSize[y];
    parentOrSize[y] = x;
    return x;
  }

  boolean same(int a, int b) {
    if (!(0 <= a && a < n) || !(0 <= b && b < n)) {
      // この式が成立しない物は動作しません。
      return false;
    }
    return leader(a) == leader(b);
  }

  int leader(int a) {
    if (parentOrSize[a] < 0) {
      return a;
    } else {
      parentOrSize[a] = leader(parentOrSize[a]);
      return parentOrSize[a];
    }
  }

  int size(int a) {
    if (!(0 <= a && a < n)) {
      // この式が成立しない物は動作しません。
      return -1;
    }
    return -parentOrSize[leader(a)];
  }

  ArrayList<ArrayList<Integer>> groups() {
    int[] leaderBuf = new int[n];
    int[] groupSize = new int[n];
    for (int i = 0; i < n; i++) {
      leaderBuf[i] = leader(i);
      groupSize[leaderBuf[i]]++;
    }
    ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
    for (int i = 0; i < n; i++) {
      result.add(new ArrayList<>());
    }
    for (int i = 0; i < n; i++) {
      result.get(leaderBuf[i]).add(i);
    }
    return result;
  }


Compiler output:
Main.java:101: error: reached end of file while parsing
  }
   ^
1 error
Language: C++

#include <bits/stdc++.h>

int cnt;
vector<int> v[100005];
bool vis[100005];

void dfs(int u) {
  vis[u] = true;
  for (auto &i: v[u]) {
    if (!vis[i]) {
      dfs(i);
    }
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    v[a].emplace_back(b);
    v[b].emplace_back(a);
  }
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      cnt++;
      dfs(i);
    }
  }
  cout << cnt - 1 << endl;
  return 0;
}

Compiler output:
a.cc:4:1: error: 'vector' does not name a type
    4 | vector<int> v[100005];
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:9:17: error: 'v' was not declared in this scope
    9 |   for (auto &i: v[u]) {
      |                 ^
a.cc: In function 'int main()':
a.cc:18:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |   cin >> n >> m;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:23:5: error: 'v' was not declared in this scope
   23 |     v[a].emplace_back(b);
      |     ^
a.cc:32:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   32 |   cout << cnt - 1 << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:32:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   32 |   cout << cnt - 1 << endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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


int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  for (int i=0;i<M;i++)
    cin >> A.at(i) >> B.at(i);
  dsu d(M);
  
  for (int i=0;i<M;i++)
    d.merge(A.at(i)-1,B.at(i)-1);
  
  int flag=0;
  flag=d.size(0);
  int count=d.groups().size();
  
  
  cout << count-1 << endl;
}



Compiler output:
a.cc:2:10: fatal error: atcoder/dsu.hpp: No such file or directory
    2 | #include <atcoder/dsu.hpp>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//#include <iostream>
#include <bits/stdc++.h>
#include <atcoder/all>
//#include "ac-library/atcoder/dsu.hpp"

using namespace std;
using namespace atcoder;

int main() {
    int n, m;
    cin >> n >> m;
    dsu d(n);
    for(int i = 0;i < m;i++) {
        int a, b;
        cin >> a >> b;
        d.merge(a-1, b-1);
    }
    cout << d.groups().size() - 1 << endl;

    return 0;
}


Compiler output:
a.cc:3:10: fatal error: atcoder/all: No such file or directory
    3 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int visit[200005]={0};
vector<int>xx[200005];
void check(int ind)
{
    visit[ind]=1;

    for(int i=0;i<xx[ind].size();i++)
    {
        int nx=xx[ind][i];
        if(visit[nx]==0)
        {
            check(nx);
        }
    }
}

int main()
{

   int n,m,a,c,l=0,j;
   cin>>n>>m;
   while(m--)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }
   check(1);
   for(j=1;j<=n;j++)
   {
       if(visit[j]==0)
       {
           l++;
       }
   }
   cout<<l<<endl;
   return 0;
}


Compiler output:
a.cc: In function 'void check(int)':
a.cc:7:5: error: reference to 'visit' is ambiguous
    7 |     visit[ind]=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:3:5: note:                 'int visit [200005]'
    3 | int visit[200005]={0};
      |     ^~~~~
a.cc:12:12: error: reference to 'visit' is ambiguous
   12 |         if(visit[nx]==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:3:5: note:                 'int visit [200005]'
    3 | int visit[200005]={0};
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:33:11: error: reference to 'visit' is ambiguous
   33 |        if(visit[j]==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:3:5: note:                 'int visit [200005]'
    3 | int visit[200005]={0};
      |     ^~~~~
Language: C

//#include <iostream>
#include <bits/stdc++.h>
#include <atcoder/all>
//#include "ac-library/atcoder/dsu.hpp"

using namespace std;
using namespace atcoder;

int main() {
    int n, m;
    cin >> n >> m;
    dsu d(n);
    for(int i = 0;i < m;i++) {
        int a, b;
        cin >> a >> b;
        d.merge(a-1, b-1);
    }
    cout << d.groups().size() - 1 << endl;

    return 0;
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace std;
using namespace atcoder;
using ll = long long;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define rREP(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define rFOR(i, a, b) for (int i = a; i >= b; --i)
#define aFOR(i, V) for (auto i : V)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
#define INF 1'000'000'007 // 10^9 + 7
#define MOD 1'000'000'007 // 10^9 + 7
#define lINF 1'000'000'000'000'000'007 // 10^18 + 7
// ------------------------------

vector<int> group;
int num = 0;

void bfs(vector<vector<int>> vec, int now) {
    ++num;
    group[now] = num;
    queue<int> q;
    q.push(now);
    while (!q.empty()) {
        now = q.front();
        q.pop();
        group[now] = num;
        aFOR(i, vec[now]) {
            if (!group[i]) {
                q.push(i);
                group[i] = num;
            }
        }
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> vec(N, vector<int>(0));
    vector<int> tmp(N, 0);
    group = tmp;
    dsu d(N);
    REP(i, M) {
        int A, B;
        cin >> A >> B;
        --A, --B;
        d.merge(A, B);
    }
    set<int> s;
    REP(i, N) {
        s.insert(d.leader(i));
    }
    cout << s.size() - 1 << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: atcoder/dsu: No such file or directory
    2 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

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


int main() {
  int N,M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  for (int i=0;i<M;i++)
    cin >> A.at(i) >> B.at(i);
  dsu d(M);
  
  for (int i=0;i<M;i++)
    d.merge(A.at(i)-1,B.at(i)-1);
  
  int flag=0;
  flag=d.size(0);
  int count=d.groups().size();
  
  
  cout << count-1 << endl;
}



Compiler output:
a.cc:2:10: fatal error: atcoder/dsu: No such file or directory
    2 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <atcoder/all>
//#include "ac-library/atcoder/dsu.hpp"

using namespace std;
using namespace atcoder;

int main() {
    int n, m;
    cin >> n >> m;
    dsu d(n);
    for(int i = 0;i < m;i++) {
        int a, b;
        cin >> a >> b;
        d.merge(a-1, b-1);
    }
    cout << d.groups().size() - 1 << endl;

    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

bool visit[200005];
vector<ll>xx[200005];

void check(ll ind)
{
    if(visit[ind]) return;

    visit[ind]=1;

    for(ll i=0;i<xx[ind].size();i++)
    {
        ll nx=xx[ind][i];
        if(visit[nx]==0)
        {
            check(nx);
        }
    }
}

int main()
{

   ll n,m,a,c,l=0,j;
   cin>>n>>m;
   while(m--)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }

   check(1);

   for(j=1;j<=n;j++)
   {
       if(visit[j]==0)
       {
           l++;
       }
   }
   cout<<l<<endl;
   return 0;
}


Compiler output:
a.cc: In function 'void check(long long int)':
a.cc:10:8: error: reference to 'visit' is ambiguous
   10 |     if(visit[ind]) return;
      |        ^~~~~
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:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc:12:5: error: reference to 'visit' is ambiguous
   12 |     visit[ind]=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:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc:17:12: error: reference to 'visit' is ambiguous
   17 |         if(visit[nx]==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:5:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:40:11: error: reference to 'visit' is ambiguous
   40 |        if(visit[j]==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:5:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using ll = long long;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define rREP(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define rFOR(i, a, b) for (int i = a; i >= b; --i)
#define aFOR(i, V) for (auto i : V)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
#define INF 1'000'000'007 // 10^9 + 7
#define MOD 1'000'000'007 // 10^9 + 7
#define lINF 1'000'000'000'000'000'007 // 10^18 + 7
// ------------------------------

vector<int> group;
int num = 0;

void bfs(vector<vector<int>> vec, int now) {
    ++num;
    group[now] = num;
    queue<int> q;
    q.push(now);
    while (!q.empty()) {
        now = q.front();
        q.pop();
        group[now] = num;
        aFOR(i, vec[now]) {
            if (!group[i]) {
                q.push(i);
                group[i] = num;
            }
        }
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> vec(N, vector<int>(0));
    vector<int> tmp(N, 0);
    group = tmp;
    dsu d(N);
    REP(i, M) {
        int A, B;
        cin >> A >> B;
        --A, --B;
        d.merge(A, B);
    }
    set<int> s;
    REP(i, N) {
        s.insert(d.leader(i));
    }
    cout << s.size() - 1 << endl;
    return 0;
}

Compiler output:
a.cc:3:17: error: 'atcoder' is not a namespace-name
    3 | using namespace atcoder;
      |                 ^~~~~~~
a.cc: In function 'int main()':
a.cc:44:5: error: 'dsu' was not declared in this scope
   44 |     dsu d(N);
      |     ^~~
a.cc:49:9: error: 'd' was not declared in this scope
   49 |         d.merge(A, B);
      |         ^
a.cc:53:18: error: 'd' was not declared in this scope
   53 |         s.insert(d.leader(i));
      |                  ^
Language: C++

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

bool visit[200005];

vector<ll>xx[200005];

void check(ll ind)
{
    if(visit[ind]) return;

    visit[ind]=1;

    for(ll i=0;i<xx[ind].size();i++)
    {
        ll nx=xx[ind][i];
        if(visit[nx]==0)
        {
            check(nx);
        }
    }
}

int main()
{

   ll n,m,a,c,l=0,j;
   cin>>n>>m;
   while(m--)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }

   check(1);

   for(j=1;j<=n;j++)
   {
       if(visit[j]==0)
       {
           l++;
       }
   }
   cout<<l<<endl;
   
   return 0;
}


Compiler output:
a.cc: In function 'void check(long long int)':
a.cc:11:8: error: reference to 'visit' is ambiguous
   11 |     if(visit[ind]) return;
      |        ^~~~~
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:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc:13:5: error: reference to 'visit' is ambiguous
   13 |     visit[ind]=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:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc:18:12: error: reference to 'visit' is ambiguous
   18 |         if(visit[nx]==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:5:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:41:11: error: reference to 'visit' is ambiguous
   41 |        if(visit[j]==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:5:6: note:                 'bool visit [200005]'
    5 | bool visit[200005];
      |      ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define rREP(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define rFOR(i, a, b) for (int i = a; i >= b; --i)
#define aFOR(i, V) for (auto i : V)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
#define INF 1'000'000'007 // 10^9 + 7
#define MOD 1'000'000'007 // 10^9 + 7
#define lINF 1'000'000'000'000'000'007 // 10^18 + 7
// ------------------------------

vector<int> group;
int num = 0;

void bfs(vector<vector<int>> vec, int now) {
    ++num;
    group[now] = num;
    queue<int> q;
    q.push(now);
    while (!q.empty()) {
        now = q.front();
        q.pop();
        group[now] = num;
        aFOR(i, vec[now]) {
            if (!group[i]) {
                q.push(i);
                group[i] = num;
            }
        }
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> vec(N, vector<int>(0));
    vector<int> tmp(N, 0);
    group = tmp;
    dsu d(N);
    REP(i, M) {
        int A, B;
        cin >> A >> B;
        --A, --B;
        d.merge(A, B);
    }
    set<int> s;
    REP(i, N) {
        s.insert(d.leader(i));
    }
    cout << s.size() - 1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:5: error: 'dsu' was not declared in this scope
   43 |     dsu d(N);
      |     ^~~
a.cc:48:9: error: 'd' was not declared in this scope
   48 |         d.merge(A, B);
      |         ^
a.cc:52:18: error: 'd' was not declared in this scope
   52 |         s.insert(d.leader(i));
      |                  ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> adj[n];
  int u, v;
  for (int i=0; i<m; i++)
  {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  
  int visited[n], cmp[n] = 0;
  for (int i=0; i<n; i++) cmp[i] = -1;

  for (int i=0; i<n; i++)
  {
    if (visited[i]) continue;
    queue<int> q;
  	q.push(i);
    visited[i] = 1;
    cmp[i] = i;
    while (!q.empty())
    {
      u = q.front();
      q.pop();
      for (auto v: adj[u])
      {
        if (visited[i] == 0)
        {
          q.push(v);
          visited[v] = 1;
          cmp[v] = cmp[u];
        }
      }
    }
  }
  
  int count = 1;
  for (int i=0; i<n; i++)
  {
    if (cmp[i] != -1) count++
  }
  
  cout << count-1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: array must be initialized with a brace-enclosed initializer
   19 |   int visited[n], cmp[n] = 0;
      |                            ^
a.cc:48:30: error: expected ';' before '}' token
   48 |     if (cmp[i] != -1) count++
      |                              ^
      |                              ;
   49 |   }
      |   ~