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

#include <set>
#include <atcoder/all>
 
using namespace std;
#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>
 
void print(T x)
{
	std::cout << x << " ";
}
 
template <typename T>
 
void println(T x)
{
	std::cout << x << "\n";
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector <int> siz; // 素集合のサイズを表す配列(1 で初期化)

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    void init(int N) {
        par.resize(N);
        siz.assign(N, 1);  // resize だとなぜか初期化されなかった
        for (int i = 0; i < N; ++i) par[i] = i; // 初期では親は自分自身
    }


    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { return siz[root(x)]; }
};

signed main(void) {
	int n,m;
	cin >> n >> m;
	UnionFind d(n);
	d.init(n);
	rep(i,m){
		int a,b;
		cin >> a>>b;
		d.unite(a,b);
	}
	set<int>st;
	rep(i,n){
		st.insert(d.root(i));
	}
	int ret = st.size();
	print(ret-1);
}

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

#include <bits/stdc++.h>
#include <atcoder/all>
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/all: No such file or directory
    2 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace atcoder;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000


int main(){

	int N,M;
	cin>>N>>M;
	
	dsu D(N);
	
	rep(i,M){
		int u,v;
		cin>>u>>v;
		u--;v--;
		D.merge(u,v);
	}
	
	int cnt = 0;
	
	rep(i,N){
		if(D.leader(i)==i)cnt++;
	}
	
	cout<<cnt-1<<endl;

	return 0;
}


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

#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <sstream>
#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);
    dsu d(N);
    for (int i = 0; i < M; i++)
    {
        cin >> A[i] >> B[i];
        d.merge(A[i], B[i]);
    }
    vector<vector<int>> n = d.groups();
    int ans = n.size() - M;
    cout << ans;
    return 0;
}

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

#include <bits/stdc++.h>
// #include <atcoder/all>
#include <atcoder/dsu>
#include <cstdio>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using namespace atcoder;

int main() {
	int n, m; cin >> n >> m;
	dsu d(n + 4);
	REP(i, m) {
		int u, v; cin >> u >> v;
		d.merge(u, v);
	}

	vector<vector<int> > res = d.groups();
	cout << res.size() - 1 << '\n';
	return 0;
}

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

#include <bits/stdc++.h>
#include <atcoder/all>
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/all: No such file or directory
    2 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

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

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 n,m,a,c,l=0,j;
   cin>>n>>m;
   for(j=0;j<m;j++)
   {
       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]==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:39:11: error: reference to 'visit' is ambiguous
   39 |        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++

using namespace std;
void dfs(int u, vector<vector<int>> &graph, bool visited[])
{
    visited[u] = true;
    for(auto v:graph[u]){
        if(!visited[v])dfs(v,graph,visited);
    }
}
int main()
{

    int n, m;
    cin >> n >> m;
    bool visited[n + 1];
    vector<vector<int>> graph(n + 1);
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        cin >> u >> v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    int count = 0;
    for (int i = 1; i <= n; i++)
    {
        if (!visited[i])
        {
            dfs(i, graph, visited);
            count++;
        }
    }
    cout<< count-1 <<'\n';
}

Compiler output:
a.cc:2:17: error: 'vector' has not been declared
    2 | void dfs(int u, vector<vector<int>> &graph, bool visited[])
      |                 ^~~~~~
a.cc:2:23: error: expected ',' or '...' before '<' token
    2 | void dfs(int u, vector<vector<int>> &graph, bool visited[])
      |                       ^
a.cc: In function 'void dfs(int, int)':
a.cc:4:5: error: 'visited' was not declared in this scope
    4 |     visited[u] = true;
      |     ^~~~~~~
a.cc:5:16: error: 'graph' was not declared in this scope
    5 |     for(auto v:graph[u]){
      |                ^~~~~
a.cc: In function 'int main()':
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin >> n >> m;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:15:5: error: 'vector' was not declared in this scope
   15 |     vector<vector<int>> graph(n + 1);
      |     ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:15:19: error: expected primary-expression before 'int'
   15 |     vector<vector<int>> graph(n + 1);
      |                   ^~~
a.cc:20:9: error: 'graph' was not declared in this scope
   20 |         graph[u].push_back(v);
      |         ^~~~~
a.cc:28:20: error: 'graph' was not declared in this scope
   28 |             dfs(i, graph, visited);
      |                    ^~~~~
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout<< count-1 <<'\n';
      |     ^~~~
a.cc:32:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define foreach(c,itr) for(__typeof(c)::iterator itr=c.begin();itr!=c.end();itr++)
typedef long long ll;
typedef long double ld;

ll n,m;
ll a[100005],b[100005];
vector<ll> v[100005];
bool vis[100005][100005]={false};
ll i,j,l;

void bfs(int x){
	queue<ll> q;
	q.push(i);
	
	while(!q.empty()){
		rep(j,v[q.front()].size()){
			q.push(v[q.front()][j]);
			vis[q.front()][v[q.front()][j]]=true;
			vis[v[q.front()][j]][q.front()]=true;
		} 
		q.pop();	
	}
}

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

    cin>>n>>m;
    rep(i,m){
    	cin>>a[i]>>b[i];
    	v[a[i]].push_back(b[i]);
    	v[b[i]].push_back(a[i]);
    	vis[a[i]][b[i]]=true;
    	vis[b[i]][a[i]]=true;
	}
	for(i=1;i<=n;i++){
		vis[i][i]=true;
	}
	for(i=1;i<=n;i++){
		bfs(i);
	}
	ll ans=0;
	for(i=1;i<=n;i++){
		for(j=i+1;j<=n;j++){
			if(vis[i][j]==false){
				ans++;
				rep(l,v[i].size()){
					vis[j][v[i][l]]=true;
					vis[v[i][l]][j]=true;
				}
				rep(l,v[j].size()){
					vis[i][v[j][l]]=true;
					vis[v[j][l]][i]=true;
				}
			}	
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
/tmp/ccjTUbEf.o: in function `bfs(int)':
a.cc:(.text+0x1f): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x36): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0xc5): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x117): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x152): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x192): relocation truncated to fit: R_X86_64_PC32 against symbol `j' defined in .bss section in /tmp/ccjTUbEf.o
/tmp/ccjTUbEf.o: in function `main':
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x258): relocation truncated to fit: R_X86_64_PC32 against symbol `i' defined in .bss section in /tmp/ccjTUbEf.o
a.cc:(.text+0x286): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

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 n,m,a,c,l=0;
   cin>>n>>m;
   for(ll i=0;i<m;i++)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }
   check(1);

   for(ll i=1;i<=n;i++)
   {
       if(visit[i]==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]==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:38:11: error: reference to 'visit' is ambiguous
   38 |        if(visit[i]==0) l++;
      |           ^~~~~
/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 <bits/stdc++.h>
#include <atcoder/all>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
using namespace atcoder;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N,M;
    cin >> N >> M;
    dsu d(N);
    rep (i, M) {
        int u,v;
        cin >> u >> v;
        d.merge(u, v);
    }
    cout << d.groups().size()-1 << endl;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<typename T> string join(vector<T> &vec ,string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
vector<int> uf(200010);
int root(int p){
    if(p == uf[p]) return p;
    else{
        
        return uf[p] = root(uf[p]);
    }
}
int main(void){
    int n,m;
    cin >> n >> m;
    n++;
    rep(i,n+1){
        uf[i] = i;
    }
    rep(i,m){
        int a,b;
        cin >> a >> b;
        int rx = root(uf[a]);
        int ry = root(uf[b]);
        if(rx!=ry){
            uf[rx] = ry;
        }
    }
    rep(i,n){
        int p = root(i);
        if(!mp[p]){
            mp[p] = 1;
        }else{
            mp[p]++;
        }
    }
  vector<int> vec(n+1,0);
  
  rep(i,n){
    vec[root(uf[i])] = 1;
  }
  int sum = 0;
  rep(i,n){
    if(vec[i]==1) sum++;
 //   cout << root(uf[i]) << endl;
  }
  cout << sum-2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:13: error: 'mp' was not declared in this scope; did you mean 'p'?
   43 |         if(!mp[p]){
      |             ^~
      |             p
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]==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 n,m,a,c,l=0;
   cin>>n>>m;
   for(ll i=0;i<m;i++)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }
   check(1);

   for(ll i=1;i<=n;i++)
   {
       if(visit[i]==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]==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 [200005]'
    5 | bool visit[200005];
      |      ^~~~~
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 [200005]'
    5 | bool visit[200005];
      |      ^~~~~
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 [200005]'
    5 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:38:11: error: reference to 'visit' is ambiguous
   38 |        if(visit[i]==0) l++;
      |           ^~~~~
/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: Java

import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Set<Integer> set = new HashSet<Integer>();
		UnionFindTree tree = new UnionFindTree(n);
		for(int i = 0; i<n; i++) {
			tree.makeSet(i);
		}
		for(int i = 0; i < m; i++) {
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;
			tree.union(a, b);
		}
		for(int i = 0 ; i < n; i++) {
			set.add(tree.parent[i]);
		}
		System.out.println(set.size()-1);
	}
}

Compiler output:
Main.java:12: error: cannot find symbol
		UnionFindTree tree = new UnionFindTree(n);
		^
  symbol:   class UnionFindTree
  location: class Main
Main.java:12: error: cannot find symbol
		UnionFindTree tree = new UnionFindTree(n);
		                         ^
  symbol:   class UnionFindTree
  location: class Main
2 errors
Language: C++

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

#define ll long long int
#define li long int
#define ar array

#define min2(a,b) a < b ? a : b
#define max2(a,b) a < b ? b : a

#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)

const int nax=1e5+5;
int adj[nax][nax];
bool visited[nax];
int cnt;
int n;

bool sorter2(const pair<li,li> &a, 
              const pair<li,li> &b) 
{ 
    return (a.second < b.second); 
} 

void explore(int v){
	visited[v]=true;
	for(int u=0;u<n;u++){
		if(adj[v][u]){
			if(!visited[u]){
				explore(u);
			}
		}
	}
}

void dfs(){
	for(int i=0;i<n;i++){
		if (!visited[i]){
			cnt++;
			explore(i);
		}
	}
}

int main(){
	#ifndef ONLINE_JUDGE		
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
	    
	ios::sync_with_stdio(0);

	int m;
	cin >> n >> m;

	for(int i=0;i<m;i++){
		int v,u;
		cin >> v >> u;

		adj[v][u]=1;
		adj[u][v]=1;
	}

	cnt=0;
	dfs();

	cout << cnt-1 << endl;
}

Compiler output:
/tmp/cc5UzHIF.o: in function `explore(int)':
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5UzHIF.o
/tmp/cc5UzHIF.o: in function `dfs()':
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0xd1): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5UzHIF.o
/tmp/cc5UzHIF.o: in function `main':
a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5UzHIF.o
a.cc:(.text+0x229): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/cc5UzHIF.o
collect2: error: ld returned 1 exit status
Language: C++

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

int par[100010];

int parent(int i){
  if(par[i]==i) return i;
  else{
    return par[i]=parent(par[i]);
  }
}

int main(){
  int N,M; cin >> N >> M;
  
  for(int i=0; i<N; i++) par[i]=i;

  for(int i=0; i<M; i++){
    int A,B; cin >> A >> B;
    A--; B--;
    int pa=par[A], pb=par[B];
    if(pa>pb){
      par[pa]=pb;
    }else(pb>pa){
      par[pb]=pa;
    }
  }
  
  set<int> S;
  for(int i=0; i<N; i++){
    S.insert(parent(par[i]));
  }
  cout << S.size()-1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: expected ';' before '{' token
   24 |     }else(pb>pa){
      |                 ^
      |                 ;
Language: C++

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

#define ll long long int
#define li long int
#define ar array

#define min2(a,b) a < b ? a : b
#define max2(a,b) a < b ? b : a

#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)

const int nax=1e5+5;
int adj[nax][nax];
bool visited[nax];
int cnt;
int n;

bool sorter2(const pair<li,li> &a, 
              const pair<li,li> &b) 
{ 
    return (a.second < b.second); 
} 

void explore(int v){
	visited[v]=true;
	for(int u=0;u<n;u++){
		if(adj[v][u]){
			if(!visited[u]){
				explore(u);
			}
		}
	}
}

void dfs(){
	for(int i=0;i<n;i++){
		if (!visited[i]){
			cnt++;
			explore(i);
		}
	}
}

int main(){
	#ifndef ONLINE_JUDGE		
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
	    
	ios::sync_with_stdio(0);

	int m;
	cin >> n >> m;

	for(int i=0;i<m;i++){
		int v,u;
		cin >> v >> u;

		adj[v][u]=1;
		adj[u][v]=1;
	}

	cnt=0;
	dfs();

	cout << cnt-1 << endl;
}

Compiler output:
/tmp/ccxWb0c2.o: in function `explore(int)':
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccxWb0c2.o
/tmp/ccxWb0c2.o: in function `dfs()':
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0xd1): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccxWb0c2.o
/tmp/ccxWb0c2.o: in function `main':
a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccxWb0c2.o
a.cc:(.text+0x229): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccxWb0c2.o
collect2: error: ld returned 1 exit status
Language: C++

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

ll n,m,a,c,d,e,f,j,l=0;

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

void dfs(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)
        {
            dfs(nx);
        }
    }

}

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

   cin>>n>>m;
   for(ll i=0;i<m;i++)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }
   dfs(1);
   for(ll i=1;i<=n;i++)
   {
       if(visit[i]==0) l++;
   }
   cout<<l<<endl;
   return 0;
}


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:12:8: error: reference to 'visit' is ambiguous
   12 |     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:7:6: note:                 'bool visit [200005]'
    7 | bool visit[200005];
      |      ^~~~~
a.cc:14:5: error: reference to 'visit' is ambiguous
   14 |     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:7:6: note:                 'bool visit [200005]'
    7 | bool visit[200005];
      |      ^~~~~
a.cc:19:12: error: reference to 'visit' is ambiguous
   19 |         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:7:6: note:                 'bool visit [200005]'
    7 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:42:11: error: reference to 'visit' is ambiguous
   42 |        if(visit[i]==0) l++;
      |           ^~~~~
/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:7:6: note:                 'bool visit [200005]'
    7 | bool visit[200005];
      |      ^~~~~
Language: C++

c#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using ll = long long;
int main(){
    int n, m;
    cin >> n >> m;
    dsu d(n);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        d.merge(a, b);
    }
    int count = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            if(!(d.same(i, j))){
                count++;
                d.merge(i, j);
            }
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | c#include <bits/stdc++.h>
      |  ^
a.cc:2:10: fatal error: atcoder/all: No such file or directory
    2 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
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++)
ll n,m,a,c,d,e,f,i,j,l=0;
bool visit[200005];
vector<ll>xx[200005];

void dfs(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)
        {
            dfs(nx);
        }
    }

}

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

   cin>>n>>m;
   for(i=0;i<m;i++)
   {
       cin>>a>>c;
       xx[a].push_back(c);
       xx[c].push_back(a);
   }

   dfs(1);

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


Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:11:8: error: reference to 'visit' is ambiguous
   11 |     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:6:6: note:                 'bool visit [200005]'
    6 | 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:6:6: note:                 'bool visit [200005]'
    6 | 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:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:42:11: error: reference to 'visit' is ambiguous
   42 |        if(visit[i]==0) l++;
      |           ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:6:6: note:                 'bool visit [200005]'
    6 | bool visit[200005];
      |      ^~~~~
Language: C++

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

#define ll long long int
#define li long int
#define ar array

#define min2(a,b) a < b ? a : b
#define max2(a,b) a < b ? b : a

#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i < int(r); ++i)

const int nax=1e5+5;
int adj[nax][nax];
// vector<int> adj[n]
bool visited[nax];
int cnt;
int n;

bool sorter2(const pair<li,li> &a, 
              const pair<li,li> &b) 
{ 
    return (a.second < b.second); 
} 

void explore(int v){
	visited[v]=true;
	for(int u=0;u<n;u++){
		if(adj[v][u]){
			if(!visited[u]){
				explore(u);
			}
		}
	}
}

void dfs(){
	for(int i=0;i<n;i++){
		if (visited[i]){
			continue;
		}else{
			cnt++;
			explore(i);
		}
	}
}

int main(){
	#ifndef ONLINE_JUDGE		
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
	    
	ios::sync_with_stdio(0);

	int m;
	cin >> n >> m;

	// vector<vector<int> > adj(n);

	for(int i=0;i<m;i++){
		int v,u;
		cin >> v >> u;

		// adj[v].push_back(u);
		// adj[u].push_back(v);
		adj[v][u]=1;
		adj[u][v]=1;
	}

	cnt=0;
	dfs();

	cout << cnt-1 << endl;
}

Compiler output:
/tmp/ccDCudd3.o: in function `explore(int)':
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0x9a): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccDCudd3.o
/tmp/ccDCudd3.o: in function `dfs()':
a.cc:(.text+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0xce): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0xd7): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccDCudd3.o
/tmp/ccDCudd3.o: in function `main':
a.cc:(.text+0x156): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0x21a): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccDCudd3.o
a.cc:(.text+0x229): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccDCudd3.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#include <atcoder/all>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using namespace atcoder;

int main() {
	int n, m; cin >> n >> m;
	dsu d(n);
	REP(i, m) {
		int u, v; cin >> u >> v;
		d.merge(u, v);
	}

	vector<vector<int> > res = d.groups();
	cout << res.size() - 1 << '\n';
	return 0;
}

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

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

typedef long long ll;

int main(void)
{
    int N,M,a,b;
    cin >> N >> M;
    dsu d(N);

    rep(i,M){
        cin >> a >> b;
        d.merge(a,b);
    }

    cout << d.groups().size()-1 <<endl;
     

    return 0;
}

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

#include<iostream>
#include<vector>
#include<queue>
 
using namespace std;
 
int par(int i, vector<int> &group)
{
  if(i== group[i]) return i;
  else
  {
     group[i] = par(group[i], group);
    return group[i];
  }
}
 
bool same(int i, int j, vector<int> &group)
{
  if(par(i, group) == par(j, group) )
  {
    return true;
  }
  else
  {
    return false;
  }
}
 
void unite(int i, int j, vector<int> &group)
{
    if( !same(i, j, group) )
    {
      group[i] = par(j, group);
    }
}
 
 
int main(void){
 
  int N, M;
  cin >> N >> M;
  vector<int> Par(N);
  for(int i=0; i<N; i++)
  {
    Par[i] = i;
  }
  int a,b;
  for(int i=0; i<M; i++)
  {
      cin >>a >> b;
      unite(a-1, b-1, Par);
  }
  int count = 0;
  
  for(int i=0; i<N; i++)
  {
    
    if(counts[i]!=i)
    {
      count ++;
    }
  }
  cout << count-1 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:8: error: 'counts' was not declared in this scope; did you mean 'count'?
   58 |     if(counts[i]!=i)
      |        ^~~~~~
      |        count
Language: C++

#include <bits/stdc++.h>
#include <atcoder/all>
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;
    a--;
    b--;
    d.merge(a,b);
  }
  vector<vector<int>> a=d.groups();
  cout << (int)a.size()-1 << endl;
}

Compiler output:
a.cc:2:10: fatal error: atcoder/all: No such file or directory
    2 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
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 , sum , ans , k ;
vector<int>g[N];
set<int>st;
ll used[N];
int main(){
    cin >> n >> m;
    for( int i = 0;i < m;i ++ ){
        cin >> x >> y;
        st.insert(x);
        st.insert(y);
    }
    cout << n - st.size();
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: 'x' was not declared in this scope
   18 |         cin >> x >> y;
      |                ^
a.cc:18:21: error: 'y' was not declared in this scope
   18 |         cin >> x >> y;
      |                     ^
Language: C++

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


int main()
{
  int n,m;
  cin >> n >> m;
  int a, b;

  vector<vector<int>> group;
  vector<int> groupNum;
  group.resize(n);
  groupNum.resize(n);
  for (int i = 0; i < n; i++)
  {
    group[i].push_back(i);
    groupNum[i] = i;
  }
  for (int i = 0; i < m; i++)
  {
    cin >> a >> b;
    // switch group
    if (groupNum[a] == groupNum[b]) continue;
    vector<int>& srcGroup = group[groupNum[b]];
    for (int j = 0; j < srcGroup.size(); j++)
    {
      group[groupNum[a]].push_back(srcGroup[j]);
      groupNum[srcGroup[j]] = groupNum[a];
    }
  }
  int count = 0;
  for (int i = 0; i < n; i++)
  {
    if (group[i].size == 0)
    {
      count++;
    }
  }
  cout << count - 1;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   36 |     if (group[i].size == 0)
      |                      ()
Language: C++

#include <atcoder/dsu>
#include <cstdio>
int main(){
  using namespace std;
  using namespace atcoder;

  int n,m;
  scanf("%d%d",&n,&m);
  dsu d(n);
  for (int i=0; i<m; i++) {
    int a,b;
    scanf("%d%d",&a,&b);
    d.merge(a-1,b-1);
  }
  size_t ans = d.groups().size() - 1;
  cout << ans << "\n";
  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 <bits/stdc++.h>
#include <unistd.h>
#include <atcoder/all>

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;
using namespace atcoder;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/(b))
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const LL LL_INF = LL(999999999999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;
const int RUN_SOLVE = 1;

#ifndef LOCAL_H
const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    for(int do_solve_time = 0;do_solve_time < RUN_SOLVE;do_solve_time++){
        void solve();
        if(DO_BENCHMARK){
            clock_t clock_start = clock();
            solve();
            clock_t clock_end = clock();
            const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
            cout << "\n------------------------------------\n" << time << "[ms]\n";
        }
        else solve();
    }
}

/*------------------------------↓ここからコード↓----------------------------------*/
void solve(){
    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);
    }
    vector<int> group (N);
    for(int i = 0;i < N;i++){
        group[i] = d.size(i);
    }
    SORT(group);
    int ans = -1;
    for(int i = 0;i < N;){
        ans++;
        i += group[i];
    }
    cout << ans << endl;
    return;
}


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

#include <atcoder/scc>
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 998244353;

int main() {
    ll N, M; cin >> N >> M;

    scc_graph g(N);

    for (int i = 0; i < M; i++) {
        int u, v; cin >> u >> v;
        g.add_edge(u, v);
        g.add_edge(v, u);
    }

    auto scc = g.scc();
    
    cout << scc.size()-1 << endl;
}

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

#include <atcoder/all>
#include <stdio>
int main(){
  using namespace std;
  using namespace atcoder;

  int n,m;
  scanf("%d%d",&n,&m);
  dsu d(n);
  for (int i=0; i<m; i++) {
    int a,b;
    scanf("%d%d",&a,&b);
    d.merge(a-1,b-1);
  }
  size_t ans = d.groups().size() - 1;
  cout << ans << "\n";
  return 0;
}

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