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

#include <bits/stdc++.h>
#include <unistd.h>

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

using namespace std;

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: In function 'void solve()':
a.cc:91:5: error: 'dsu' was not declared in this scope
   91 |     dsu d(N);
      |     ^~~
a.cc:95:9: error: 'd' was not declared in this scope
   95 |         d.merge(a-1, b-1);
      |         ^
a.cc:99:20: error: 'd' was not declared in this scope
   99 |         group[i] = d.size(i);
      |                    ^
Language: C++


#include<bits/stdc++.h>
#define ll long long
#define deb(x) cout << #x << " " << x << "\n";
using namespace std;

void dfs(ll ver,unordered_map<int,vector<int>>&g,vector<int>&visited){
	visited[ver] = 1;
	for(auto x:g[ver]){
		if(visited[x] == -1){
				dfs(x,g,visited);
		}
	}
}

void solve(){
	ll n,m,temp1,temp2;
	unordered_map<int,vector<int>>g;
	cin >> n >> m;
	for(ll i = 0 ; i < m ;i++){
		cin >> temp1 >> temp2;
		g[temp1].push_back(temp2);
		g[temp2].push_back(temp1);
	}
	vector<int>visited(n+1,-1);
	temp2 = 0;
	for(ll i = 1; i <= n;i++){
		if(visited[i] == -1){
			dfs(i,g,visited);
			temp2++;
		}
	}
	temp--;
	cout << temp2;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:33:9: error: 'temp' was not declared in this scope; did you mean 'temp2'?
   33 |         temp--;
      |         ^~~~
      |         temp2
Language: C++

#include <bits/stdc++.h>
#include <atcoder/scc>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

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

    scc_graph g(n);

    rep(i,m){
        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;

    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 <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/dsu: No such file or directory
    1 | #include <atcoder/dsu>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

using namespace std;
vector<int> v[100005];


int _gcd(int a,int b)
{
	return (b==0?a:_gcd(b,a%b));
}
bool cmp(int a,int b)
{
	return a>b;
}

int main()
{
	fast;
	#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif
		ll n;
		cin>>n;
		ll m;
		cin m;	
		while(m--)
		{
			ll x,y;
			cin>>x>>y;
			v[x].push_back(y);
			v[y].push_back(x);
		}	
		cout<<((n-1)-m)<<endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:20: error: expected ';' before 'm'
   28 |                 cin m;
      |                    ^~
      |                    ;
Language: C++

#include<bits/stdc++.h>
#include<atcoder/all>

using namespace std;
using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



class UnionFind{
    public:
    vector<ll> par;
    UnionFind(ll size) : par(size,-1){}
    bool unite(ll x,ll y){
        x = root(x),y = root(y);
        if(x == y)return false;
        if(par[y] < par[x])swap(x,y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    bool find(ll x,ll y){
        return root(x) == root(y);
    }
    ll root(ll x){
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }
    ll size(ll x){
        return -par[root(x)];
    }
};

int main(){
  
  int n,m;
  cin >> n >> m;
  UnionFind uf(n);
  rep(i,m){
    int a,b;cin >> a >> b;
    a--;b--;
    uf.unite(a,b);
  }
  int cnt  = 0;
  rep(i,n)if(uf.root(i) == i)cnt++;
  cout << cnt-1 << "\n";



  return 0;
}

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

#include <iostream>
#include <atcoder/all>

using namespace std;

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;
  
}


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

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

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

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

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

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

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int  x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); 
    }

    int cnt=0;
    for(int i=0;i<N;i++){
        if(!tree.same(0,i)){
            tree.unite(0, i);
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc:2:5: error: 'vector' does not name a type
    2 |     vector<int> par;
      |     ^~~~~~
a.cc: In constructor 'UnionFind::UnionFind(int)':
a.cc:4:24: error: class 'UnionFind' does not have any field named 'par'
    4 |     UnionFind(int N) : par(N) {
      |                        ^~~
a.cc:5:36: error: 'par' was not declared in this scope
    5 |         for(int i = 0; i < N; i++) par[i] = i;
      |                                    ^~~
a.cc: In member function 'int UnionFind::root(int)':
a.cc:9:13: error: 'par' was not declared in this scope
    9 |         if (par[x] == x) return x;
      |             ^~~
a.cc:10:16: error: 'par' was not declared in this scope
   10 |         return par[x] = root(par[x]);
      |                ^~~
a.cc: In member function 'void UnionFind::unite(int, int)':
a.cc:17:9: error: 'par' was not declared in this scope
   17 |         par[rx] = ry;
      |         ^~~
a.cc: In function 'int main()':
a.cc:29:5: error: 'cin' was not declared in this scope
   29 |     cin >> N >> M;
      |     ^~~
a.cc:47:5: error: 'cout' was not declared in this scope
   47 |     cout << cnt << endl;
      |     ^~~~
a.cc:47:20: error: 'endl' was not declared in this scope
   47 |     cout << cnt << endl;
      |                    ^~~~
Language: C++

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

int DFS(vector<vector<int>& graph, int idx, vector<bool>& visited)
{
  visited[idx] = true;
  for(int i : graph[idx]) {
    if(!visited[i])	DFS(graph, i, visited);
  }
}
int main(){
  int n;
  cin>>n;
  
  vector<vector<int>> graph(n);
  int m;
  cin>>m;
  
  for(int i = 0; i < m; i++){
    int x, y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  
  int con = 0;
  vector<bool> visited(n);
  for(int i = 0; i < n; i++){
    if(!visited[i]) {
      con++;
      DFS(graph, i, visited);
    }
  }
  cout<<con - 1;
  return 0;
}

Compiler output:
a.cc:5:59: error: template argument 1 is invalid
    5 | int DFS(vector<vector<int>& graph, int idx, vector<bool>& visited)
      |                                                           ^~~~~~~
a.cc:5:59: error: template argument 2 is invalid
a.cc:5:59: error: template argument 1 is invalid
a.cc:5:59: error: template argument 2 is invalid
a.cc:5:59: error: template argument 1 is invalid
a.cc:5:59: error: template argument 2 is invalid
a.cc:5:9: error: invalid template-id
    5 | int DFS(vector<vector<int>& graph, int idx, vector<bool>& visited)
      |         ^~~~~~
a.cc:5:66: error: missing template arguments before ')' token
    5 | int DFS(vector<vector<int>& graph, int idx, vector<bool>& visited)
      |                                                                  ^
a.cc: In function 'int main()':
a.cc:31:10: error: 'DFS' cannot be used as a function
   31 |       DFS(graph, i, visited);
      |       ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

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

  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);
  }
  int ans = d.groups().size() - 1;
  cout << ans << "\n";
  return 0; 
}

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

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

int main(){
	int n, m;
	cin >> n >> m;
	dsu d(n);
	rep(i, m){
		int a,b;
		cin >> a >> b;
		d.merge(a,b);
	}
	vector<vector<int>> g = d.groups();
	ans = g.size() - 1;
	cout << ans << 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<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] = group[j];
    }
}


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;
  vector<int> counts(N, 0);
  for(int i=0; i<N; i++)
  {
    int p = par(i, Par);
    if(counts[p]==0)
    {
      counts[p] ++;
      count ++;
    }
  }
  cout << count-1 << endl;
  return 0;
}


Compiler output:
a.cc:7:36: error: expected identifier before ')' token
    7 | int par(int i, vector<int> &group, )
      |                                    ^
a.cc: In function 'int par(int, std::vector<int>&, int)':
a.cc:12:20: error: too few arguments to function 'int par(int, std::vector<int>&, int)'
   12 |      group[i] = par(group[i], group);
      |                 ~~~^~~~~~~~~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int par(int i, vector<int> &group, )
      |     ^~~
a.cc: In function 'bool same(int, int, std::vector<int>&)':
a.cc:19:9: error: too few arguments to function 'int par(int, std::vector<int>&, int)'
   19 |   if(par(i, group) == par(j, group) )
      |      ~~~^~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int par(int i, vector<int> &group, )
      |     ^~~
a.cc:19:26: error: too few arguments to function 'int par(int, std::vector<int>&, int)'
   19 |   if(par(i, group) == par(j, group) )
      |                       ~~~^~~~~~~~~~
a.cc:7:5: note: declared here
    7 | int par(int i, vector<int> &group, )
      |     ^~~
a.cc: In function 'int main()':
a.cc:57:16: error: too few arguments to function 'int par(int, std::vector<int>&, int)'
   57 |     int p = par(i, Par);
      |             ~~~^~~~~~~~
a.cc:7:5: note: declared here
    7 | int par(int i, vector<int> &group, )
      |     ^~~
a.cc: In function 'bool same(int, int, std::vector<int>&)':
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
Language: C++

#include <iostream>

#include <atcoder/dsu.hpp>

using namespace std;
using namespace atcoder;

typedef unsigned long long ull;

ull N, M;


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

	dsu d(N);

	for (ull i = 0; i < M; i++) {
		ull a, b;
		cin >> a >> b;
		d.merge(a-1, b-1);
	}

	vector<vector<int>> v = d.groups();

	cout << (v.size()-1) << endl;
}

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

#include <iostream>
#include <vector>
using namespace std;
vector<int> adj[100001];
bool visited[100001];

int dfs(int node) {
  if (visited[node]) return 0;
  visited[node] = true;
  for (auto u: adj[node]) dfs(u);
  return 1;
}

int main() {
  int N, M;
  for (int i = 0; i < M; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back[v];
    adj[v].push_back[u];
  }
  int cnt = 0;
  for (int i = 1; i <= N; ++i) cnt += dfs(i);
  cout << cnt-1;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |     adj[u].push_back[v];
      |                     ^
a.cc:20:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |     adj[v].push_back[u];
      |                     ^
Language: C++

#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef pair<ll, ll> pll;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

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

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

    vector<vector<int>> num = d.groups();
    cout << num.size() - 1 << endl;

    return 0;
}

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

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

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,B);
    }
    vector<vector<int>> num = d.groups();
    cout  << num.size()-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 <bits/stdc++.h>
using namespace std;

#define REP(i,n) for(lol i=0;i<long long(n);i++)

int main()
{
  int n,m; cin>>n>>m;
  int a[n], b[n];
  REP(i,m)
    cin>>a[i]>>b[i];
    
  int ans = n-m-1;
    
  if(ans<0)
    ans=0;
    
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:22: error: 'lol' was not declared in this scope; did you mean 'logl'?
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                      ^~~
a.cc:10:3: note: in expansion of macro 'REP'
   10 |   REP(i,m)
      |   ^~~
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   REP(i,m)
      |       ^
a.cc:4:30: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                              ^
a.cc:4:32: error: expected primary-expression before 'long'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                                ^~~~
a.cc:10:3: note: in expansion of macro 'REP'
   10 |   REP(i,m)
      |   ^~~
a.cc:4:32: error: expected ';' before 'long'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                                ^~~~
a.cc:10:3: note: in expansion of macro 'REP'
   10 |   REP(i,m)
      |   ^~~
a.cc:4:32: error: expected primary-expression before 'long'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                                ^~~~
a.cc:10:3: note: in expansion of macro 'REP'
   10 |   REP(i,m)
      |   ^~~
a.cc:4:32: error: expected ')' before 'long'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                     ~          ^~~~
a.cc:10:3: note: in expansion of macro 'REP'
   10 |   REP(i,m)
      |   ^~~
a.cc:10:7: error: 'i' was not declared in this scope
   10 |   REP(i,m)
      |       ^
a.cc:4:45: note: in definition of macro 'REP'
    4 | #define REP(i,n) for(lol i=0;i<long long(n);i++)
      |                                             ^
Language: C++

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

int main()
{
  int n,m; cin>>n>>m;
  int a[n], b[n];
  REP(i,m)
    cin>>a[i]>>b[i];
    
  int ans = n-m-1;
    
  if(ans<0)
    ans=0;
    
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   REP(i,m)
      |       ^
a.cc:8:3: error: 'REP' was not declared in this scope
    8 |   REP(i,m)
      |   ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>
#include <atcoder/dsu>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

ll ans;

int main(void) {
    int n, m;
    cin >> n >> m;
    dsu d(n);
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        d.merge(a, b);
    }
    auto v = d.groups();

    ans = (ll) sz(v);



    
    cout << ans-1 << endl;
    return 0;
}





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


/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

#define endl "\n"

/* see https://cp-algorithms.com/data_structures/disjoint_set_union.html
 * Also known as union find structure. 
 * Note that the above link has some optimizations for faster combining of sets if needed. 
 */

struct Dsu {
    vector<int> p;
/* initializes each (0..size-1) to single set */
    Dsu(int size) {
        p.resize(size);
        iota(p.begin(), p.end(), 0);
    }

/* makes v a single set, removes it from other set if contained there. */
    void make_set(int v) {
        p[v] = v;
    }

/* finds set representative for member v */
    int find_set(int v) {
        if (v == p[v])
            return v;
        return p[v] = find_set(p[v]);
    }

/* combines the sets of two members. 
 * Use the bigger set as param a for optimized performance.  */
    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b)
            p[b] = a;
    }
};

void solve() {
    cini(n);
    cini(m);

    Dsu dsu(n);
    for(int i=0; i<m; i++) {
        cini(a); a--;
        cini(b); b--;
        dsu.union_sets(a,b);
    }

    set<int> s;
    for(int i=0; i<n; i++) 
        s.insert(dsu.find_set(i));

    cout<<s.size()-1<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


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

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
using namespace std;
int p[100010];
void iniciar(int n){
    for(int i = 1; i <= n; i++)
        p[i] = i;
}
int find(int a){
    if(p[a] == a) return a;
    return p[a] = find(p[a]);
}
void unir(int a, int b){
    p[find(b)] = find(a);
}
bool mismoConjunto(int a, int b){
    return find(a) == find(b);
}
void solve(){
    int n, m, a, b;
    cin >> n >> m;
    iniciar(n);
    int nro = n;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        if(!mismoConjunto(a, b)){
            unir(a, b);
            nro--;
        }
    }
    cout << ((nro + 1) >> 1) << "\n";
}
int main(){
    fast;
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
vector<int> seen(200010);
void dfs(const Graph &G, int v ,int count) {
    seen[v] = count;
    for (int next_v : G[v]) { 
        if (seen[next_v]) continue;
        dfs(G, next_v ,count); // 再帰的に探索
    }
}

int main (){
  int N,M;
  cin>>N>>M;
  Graph friends(N);
  rep(i,M){
    int x,y,z=0;
    cin>>x>>y;
 /*   rep(j,friends[x-1].size()){
      if(friends[x-1][j]==y-1)z=1;
    }
    if(z==0){*/
    friends[x-1].push_back(y-1);
    friends[y-1].push_back(x-1);
    //}
  }
    int count = 1;
  //  seen.assign(N, 0);
    for (int v = 0; v < N; ++v) {
        if (seen[v]) continue; // v が探索済みだったらスルー
        dfs(friends, v ,count); // v が未探索なら v を始点とした DFS を行う
        ++count;
    }
  int ans=0;
  rep(i,N){
    ans=max(ans,seen);
  }
  cout<<ans-1;
}


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

#include <bits/stdc++.h>
#include <queue>
#include <string>
#include <algorithm>
#include <atcoder/all>


using namespace atcoder;
using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep1(i, n) for (ll i = 1; i < n + 1; i++)
#define repr(i, n) for (ll i = n - 1; i >= 0; i--)
#define repr1(i, n) for (ll i = n; i > 0; i--)
#define FOR(i, j, n) for (ll i = j; i < n; i++)

const ll MOD = 1000000007; // 10^9+7
const ll MOD2 = 998244353;
const ll INF = 10000000000;

int main(void){
    ll n,m;
    cin >> n >> m;

    vector<ll> a(m,0);
    vector<ll> b(m,0);
    dsu d(n);
    rep(i,m){
        cin >> a[i] >> b[i];
        d.merge(a[i],b[i]);
    }

    ll ans = 0;

    rep(i,n){
        for(int j = i+1;j < n;j++){
            if(d.same(i,j)) continue;
            ans++;
            d.merge(i,j);
        }
    }

    cout << ans << endl;
    return 0;
}

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

#include <atcoder/all>
#include <iostream>

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int n, m;
    std::cin >> n >> m;
    atcoder::dsu d(n);
    for (int i = 0; i < m; ++i) {
        int src, dst;
        std::cin >> src >> dst;
        src -= 1;
        dst -= 1;
        d.merge(src, dst);
    }
    std::cout << d.groups().size() - 1 << std::endl;
    return 0;
}


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

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

int main(){
    int N, M;
    cin >> N >> M;   
    scc_graph graph(N);
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        graph.add_edge(a, b);
        graph.add_edge(b,a);
    }
    cout << graph.scc().size() - 1 << 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>
#include <atcoder/scc>

using namespace std;
using namespace atcoder;

int main(int argc, const char *argv[]) {
  int n, m;
  cin >> n >> m;

  vector<vector<int>> g(n);
  scc_graph graph(n);
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    graph.add_edge(a, b);
    graph.add_edge(b, a);
  }

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

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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		int [] in = new int [a];       
        for(int i=0;i<a;i++){int c = sc.nextInt();
                             int d = sc.nextInt();
                             in[c-1]++;
                             in[d-1]++;
                            }
		
        for(int i=0;i<a;i++){if(in[i]==0){ans++;
                                                 }
                            }
     
		System.out.println(ans);
	}
}

Compiler output:
Main.java:14: error: cannot find symbol
        for(int i=0;i<a;i++){if(in[i]==0){ans++;
                                          ^
  symbol:   variable ans
  location: class Main
Main.java:18: error: cannot find symbol
		System.out.println(ans);
		                   ^
  symbol:   variable ans
  location: class Main
2 errors
Language: C++

#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
vector<ll>adj[100005];
bool visit[100005];
ll power(ll x, ll y,ll z){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        ll w=(p*p)%z;
        if(y%2==0)
         return w;
        else
        return (x*w)%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
void dfs(ll x)
{
    visit[x]=true;
    for(auto it=adj[x].begin();it!=adj[x].end();it++)
    {
        if(visit[*it]==false)
        {
            dfs(*it);
        }
        
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
  ll n,m,c=0;
  cin>>n>>m;
  for(int i=0;i<m;i++)
  {
      ll x,y;
      cin>>x>>y;
      adj[x].push_back(y);
      adj[y].push_back(x);
  }
  for(int i=1;i<=n;i++)
  {
      if(visit[i]==false)
      {
          c++;
          dfs(i);
      }
  }
  cout<<c-1;}
 

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:30:5: error: reference to 'visit' is ambiguous
   30 |     visit[x]=true;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:3:
/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:8:6: note:                 'bool visit [100005]'
    8 | bool visit[100005];
      |      ^~~~~
a.cc:33:12: error: reference to 'visit' is ambiguous
   33 |         if(visit[*it]==false)
      |            ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [100005]'
    8 | bool visit[100005];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:56:10: error: reference to 'visit' is ambiguous
   56 |       if(visit[i]==false)
      |          ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:8:6: note:                 'bool visit [100005]'
    8 | bool visit[100005];
      |      ^~~~~
Language: C++

#include <atcoder/all>
#include <bits/stdc++.h>

using namespace atcoder;
using namespace std;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);

	auto d = dsu(n);

	for(int i = 0; i < m; i++) {
		int a, b;
		scanf("%d %d", &a, &b);
		d.merge(a, b);
	}

	printf("%d\n", (int)d.groups().size() - 1);	
}



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

#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],vis[1000000];
vector <long long > v[1000000];
dfs (long long int x)
{
	long long i;
	vis[x]=1;
	for (i=0;i<v[x].size();i++)
	{
		if (vis[v[x][i]]==0)
		{
			dfs(v[x][i]);
		}
	}
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    long long n,m,i,j,k,x,y,z;
    cin>>n>>m;
    z=0;
    for (i=0;i<m;i++)
    {
    	cin>>x>>y;
    	v[x].push_back(y);
    	v[y].push_back(x);
	}
    for (i=1;i<=n;i++)
    {
    	if (vis[i]==0)
    	{
    		z++;
    		dfs(i);
		}
	}
	cout<<z-1<<endl;
}

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

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

struct UnionFindSet {
  vector<int> f;
  ll n;
  UnionFindSet(int n) : f(n) { clear(n); }
  void clear(ll n) {
    this->n = n;
    for (int i = 0; i < n; i++) {
      f[i] = i;
    }
  }
  int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
  void Union (int x, int y) { f[find(y)] = find(x); }
}

int main() {
  int n, m;
  cin >> n >> m;
  UnionFindSet s(n + 1);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    s.Union(a, b);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (s.find(i) == i) cnt++;
  cout << cnt - 1;
}
  
    

Compiler output:
a.cc:6:3: error: 'll' does not name a type
    6 |   ll n;
      |   ^~
a.cc:8:14: error: 'll' has not been declared
    8 |   void clear(ll n) {
      |              ^~
a.cc:16:2: error: expected ';' after struct definition
   16 | }
      |  ^
      |  ;
a.cc: In member function 'void UnionFindSet::clear(int)':
a.cc:9:11: error: 'struct UnionFindSet' has no member named 'n'
    9 |     this->n = n;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define MAX 200005
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
const int N = 3e5 + 5;
#define MOD 1000000007
#define mod1 998244353
 
int n;
int a[N];
int cache[N];
int visit[N]={0};
vector<int> graph[N];

int handle(int x)
{
    return (x%MOD + MOD)%MOD;
}
void dfs(int u)
{
    visit[u]=1;
    for(auto x:graph[u])
    {
        if(!visit[x])
        {
            dfs(x);
        }
    }
}
void GO()
{
    int m;
    cin>>n>>m;
    for (int i = 0; i < m; ++i)
    {
        int u,v;
        cin>>u>>v;
        graph[u].push_back(v);
        graph[v].push_back(u);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i)
    {
        /* code */
        if(!visit[i])
        {
            ans++;
            dfs(i);
        }
    }
    cout<<ans-1;
}

int32_t main()
{
    FAST
    #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif
    int tc;
    tc = 1;
    // cin>>tc;
    while(tc--) GO(); // let's solve this case :)
    return 0;
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:22:5: error: reference to 'visit' is ambiguous
   22 |     visit[u]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:5: note:                 'long long int visit [300005]'
   13 | int visit[N]={0};
      |     ^~~~~
a.cc:25:13: error: reference to 'visit' is ambiguous
   25 |         if(!visit[x])
      |             ^~~~~
/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:13:5: note:                 'long long int visit [300005]'
   13 | int visit[N]={0};
      |     ^~~~~
a.cc: In function 'void GO()':
a.cc:46:13: error: reference to 'visit' is ambiguous
   46 |         if(!visit[i])
      |             ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:13:5: note:                 'long long int visit [300005]'
   13 | int visit[N]={0};
      |     ^~~~~
Language: C++

#include <atcoder/dsu>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    int n,m;
    cin>>n>>m;
    atcoder::dsu d(n);
    for(int i = 0;i < m;++i) {
        int a,b;
        cin>>a>>b;
        --a;--b;
        d.merge(a,b);
    }
    cout<<d.groups().size()-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<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#define N 1000001
using namespace std;
int f[N],G[N],n,m,sum;
int find(int k)
{
    if(k!=f[k]) f[k]=find(f[k]);
    return f[k];
}
int main()
{
    cin>>n>>m
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        x=find(x);
        y=find(y);
        if(x!=y) f[x]=y;
    }
    for(int i=1;i<=n;i++){
    	G[f[i]]=1;
	}
	for(int i=1;i<=n;i++){
		sum+=G[i];
	}
	cout<<sum-1;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected ';' before 'for'
   17 |     cin>>n>>m
      |              ^
      |              ;
   18 |     for(int i=1;i<=n;i++) f[i]=i;
      |     ~~~       
a.cc:18:17: error: 'i' was not declared in this scope
   18 |     for(int i=1;i<=n;i++) f[i]=i;
      |                 ^
Language: C++

#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int N, M, a,b;
    cin >> N >>M;
    dsu uf(N);
    rep(i,M){
        cin >> a >> b;
        --a; --b;
        uf.merge(a,b);
    }
    set<int> cnt;
    rep(i,N){
        cnt.insert(uf.leader(i));
    }
    cout <<  cnt.size() - 1 << endl;
    return 0;
}


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

#include <bits/stdc++.h>
#include <atcoder/all>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using namespace atcoder;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  ll N,M;
  cin >> N >> M;
  vector<P> A(M);
  dsu d(N);
  REP(i,M){
    cin >> A[i].first >> A[i].second;
    A[i].fi--;
    A[i].se--;
    d.merge(A[i].fi,A[i].se);
  }

  set<int> st;
  REP(i,N){
    st.insert(d.leader(i));
  }

  cout << sz(st)-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<iostream> 
#include <list> 
using namespace std; 
  
// Graph class represents a undirected graph 
// using adjacency list representation 
class Graph 
{ 
    int V;    // No. of vertices 
  
    // Pointer to an array containing adjacency lists 
    list<int> *adj; 
  
    // A function used by DFS 
    void DFSUtil(int v, bool visited[]); 
public: 
    Graph(int V);   // Constructor 
    ~Graph(); 
    void addEdge(int v, int w); 
    void connectedComponents(); 
}; 
  
// Method to print connected components in an 
// undirected graph 
void Graph::connectedComponents() 
{ 
    // Mark all the vertices as not visited 
    bool *visited = new bool[V]; 
    for(int v = 0; v < V; v++) 
        visited[v] = false; 
  
    for (int v=0; v<V; v++) 
    { 
        if (visited[v] == false) 
        { 
            // print all reachable vertices 
            // from v 
            DFSUtil(v, visited); 
  
            cout << "\n"; 
        } 
    } 
    delete[] visited; 
} 
  
void Graph::DFSUtil(int v, bool visited[]) 
{ 
    // Mark the current node as visited and print it 
    visited[v] = true; 
    cout << v << " "; 
  
    // Recur for all the vertices 
    // adjacent to this vertex 
    list<int>::iterator i; 
    for(i = adj[v].begin(); i != adj[v].end(); ++i) 
        if(!visited[*i]) 
            DFSUtil(*i, visited); 
} 
  
Graph::Graph(int V) 
{ 
    this->V = V; 
    adj = new list<int>[V]; 
} 
  
Graph::~Graph() 
{ 
    delete[] adj; 
} 
  
// method to add an undirected edge 
void Graph::addEdge(int v, int w) 
{ 
    adj[v].push_back(w); 
    adj[w].push_back(v); 
} 
  
// Driver program to test above 
int main() 
{ 
    int N,M;
  	cin>>N>>M;
  	
    Graph g(N);
  	for (int i = 0; i<M;i++)
    {int x,y;
     cin>>x>>y;
     g.addEdge(x,y);}
  		
    
  
    cout << g.connectedComponents()-1; 
  
    return 0; 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:92:36: error: invalid operands of types 'void' and 'int' to binary 'operator-'
   92 |     cout << g.connectedComponents()-1;
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~
      |                                  |  |
      |                                  |  int
      |                                  void
Language: C++

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en 


constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;
using namespace atcoder;

void Main(){
    int n, m;
    cin >> n >> m;
    dsu d(n);
    REP(i, m) {
        int a, b;
        cin >> a >> b;
        d.merge(a-1, b-1);
    }
    cout << d.groups().size() - 1 << endl;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

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