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

/*
ACL Beginner Contest - C - Connect Cities
https://atcoder.jp/contests/abl/tasks/abl_c
*/

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

#include <atcoder/dsu>
using namespace atcoder;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

ll sum() { return 0; }
template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;


// AC - 62 ms
// without using ACL
void solve() {
	int n,m,a,b;
    const int mxN=2e5;
    vvi adj(mxN);
	vi vis(mxN),ans;
    cin >> n >> m;
    REP(i,m){
    	cin >> a >> b;
    	--a,--b;
    	adj[a].pb(b);
    	adj[b].pb(a);
	}
	function<void(int)> dfs = [&](int u){
	  vis[u]=1;
	  EACH(v, adj[u]) if(!vis[v]) dfs(v);
	};
	REP(i,n){
		if(!vis[i]){
			ans.pb(i+1);
			dfs(i);
		}
	}
	int sz = ans.size();
	OUT(sz-1);
}

// with ACL
void solve2() {
	int n,m,a,b;
    cin >> n >> m;
    dsu d = dsu(n);
    int ans = n;
    REP(i,m){
    	cin >> a >> b;
    	--a,--b;
    	if(!d.same(a,b)){
    		d.merge(a,b);
    		ans--;
		}
	}
	OUT(ans-1);
}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif

//    int tc; cin >> tc;
//    TC(tc) solve();
	// solve();
	solve2();
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
vector<int>g[N];
int visit[N];
int main()
{
  int m, n, i;
  cin >> n >> m;
  for (i = 0; i < m; i++)
  {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);

  }
  int c = 0;
  queue<int>q;
  for (i = 1; i <= n; i++)
  {
    if (visit[i]==0)
    {
      c++;
      q.push(i);

      while (q.size())
      {
        int u = q.front();
          q.pop();
        visit[u] = 1;
        for (i = 0; i < g[u].size(); i++)
        {
          int v = g[u][i];
          if (visit[v]==0)
          {
            q.push(v);
          }
        }
      }
    }
  }
  cout<<c-1<<endl;
  return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
vector<int>g[N];
bool visit[N];
int main()
{
  int m, n, i;
  cin >> n >> m;
  for (i = 0; i < m; i++)
  {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);

  }
  int c = 0;
  queue<int>q;
  for (i = 1; i <= n; i++)
  {
    if (!visit[i])
    {
      c++;
      q.push(i);

      while (q.size())
      {
        int u = q.front();
        if (!visit[u])
          q.pop();
        visit[u] = true;
        for (i = 0; i < g[u].size(); i++)
        {
          int v = g[u][i];
          if (!visit[v])
          {
            q.push(v);
          }
        }
      }
    }
  }
  cout<<c-1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: reference to 'visit' is ambiguous
   22 |     if (!visit[i])
      |          ^~~~~
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[N];
      |      ^~~~~
a.cc:30:14: error: reference to 'visit' is ambiguous
   30 |         if (!visit[u])
      |              ^~~~~
/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[N];
      |      ^~~~~
a.cc:32:9: error: reference to 'visit' is ambiguous
   32 |         visit[u] = true;
      |         ^~~~~
/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[N];
      |      ^~~~~
a.cc:36:16: error: reference to 'visit' is ambiguous
   36 |           if (!visit[v])
      |                ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [100005]'
    5 | bool visit[N];
      |      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
vector<int>g[N];
bool visit[N];
int main()
{
  int m, n, i;
  cin >> n >> m;
  for (i = 0; i < m; i++)
  {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);

  }
  int c = 0;
  queue<int>q;
  for (i = 1; i <= n; i++)
  {
    if (visit[i] ==false )
    {
      c++;
      q.push(i);

      while (q.size())
      {
        int u = q.front();
        if (!visit[u])
          q.pop();
        visit[u] = true;
        for (i = 0; i < g[u].size(); i++)
        {
          int v = g[u][i];
          if (!visit[v])
          {
            q.push(v);
          }
        }
      }
    }
  }
  cout<<c-1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: reference to 'visit' is ambiguous
   22 |     if (visit[i] ==false )
      |         ^~~~~
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[N];
      |      ^~~~~
a.cc:30:14: error: reference to 'visit' is ambiguous
   30 |         if (!visit[u])
      |              ^~~~~
/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[N];
      |      ^~~~~
a.cc:32:9: error: reference to 'visit' is ambiguous
   32 |         visit[u] = true;
      |         ^~~~~
/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[N];
      |      ^~~~~
a.cc:36:16: error: reference to 'visit' is ambiguous
   36 |           if (!visit[v])
      |                ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [100005]'
    5 | bool visit[N];
      |      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
vector<int>g[N];
bool visit[N];
int main()
{
  int m, n, i;
  cin >> n >> m;
  for (i = 0; i < m; i++)
  {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);

  }
  int c = 0;
  queue<int>q;
  for (i = 1; i <= n; i++)
  {
    if (visit[i] == 0)
    {
      c++;
      q.push(i);

      while (q.size())
      {
        int u = q.front();
        if (!visit[u])
          q.pop();
        visit[u] = true;
        for (i = 0; i < g[u].size(); i++)
        {
          int v = g[u][i];
          if (!visit[v])
          {
            q.push(v);
          }
        }
      }
    }
  }
  cout<<c-1<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: reference to 'visit' is ambiguous
   22 |     if (visit[i] == 0)
      |         ^~~~~
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[N];
      |      ^~~~~
a.cc:30:14: error: reference to 'visit' is ambiguous
   30 |         if (!visit[u])
      |              ^~~~~
/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[N];
      |      ^~~~~
a.cc:32:9: error: reference to 'visit' is ambiguous
   32 |         visit[u] = true;
      |         ^~~~~
/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[N];
      |      ^~~~~
a.cc:36:16: error: reference to 'visit' is ambiguous
   36 |           if (!visit[v])
      |                ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:6: note:                 'bool visit [100005]'
    5 | bool visit[N];
      |      ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll ar[N];
ll root(ll i){
	while(ar[i]!=i){
		ar[i]=ar[ar[i]];
		i=ar[i];
	}
	return i;
}
void dunion(ll a,ll b){
	a=root(a); b=root(b);
	if(a==b) continue;
	if(b<a) swap(a,b);
	ar[b]=a;
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n,m;
	cin>>n>>m;
	for(i=1;i<=n;i++){
		ar[i]=i;
	}
	for(i=1;i<=m;i++){
		cin>>k>>l;
		dunion(k,l);
	}
	
	k=0;
	for(i=1;i<=n;i++){
		if(ar[i]==i){
			k+=1;	
		}
	}
	cout<<(k-1);
	return 0;
}

Compiler output:
a.cc: In function 'void dunion(long long int, long long int)':
a.cc:36:18: error: continue statement not within a loop
   36 |         if(a==b) continue;
      |                  ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;

#define _GLIBCXX_DEBUG
#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end())

void Add(ll &a, ll b){a=(a+b)%mod;}
void Pro(ll &a, ll b){a=(a*b)%mod;}

int main(){
    ll N,M; cin>>N>>M;
    dsu d(N);
    rep(i,M){
        ll x,y; cin>>x>>y; x--; y--;
        d.merge(x,y);
    }
    cout<<d.groups().size()-1<<endl;
}

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



void dfs(int u,vector<vector<int>>&g,vector<bool> &vis){
 
 vis[u]=1;
 for(auto v:g[u]){
      
        if(vis[v]==0){
        dfs(v,g,vis);
        }
 }

}

int main()
{

    int count=0;
int n,m;
cin>>n>>m;

vector<vector<int>> g(n+1);
vector<bool> vis(n+1,false);

for(int i=0;i<m;i++){

int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);

}


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

  if(vis[i]==false){
     
    dfs(i,g,vis);
    count++;
}
}
cout<<count-1<<endl;

}

Compiler output:
a.cc:3:16: error: 'vector' has not been declared
    3 | void dfs(int u,vector<vector<int>>&g,vector<bool> &vis){
      |                ^~~~~~
a.cc:3:22: error: expected ',' or '...' before '<' token
    3 | void dfs(int u,vector<vector<int>>&g,vector<bool> &vis){
      |                      ^
a.cc: In function 'void dfs(int, int)':
a.cc:5:2: error: 'vis' was not declared in this scope
    5 |  vis[u]=1;
      |  ^~~
a.cc:6:13: error: 'g' was not declared in this scope
    6 |  for(auto v:g[u]){
      |             ^
a.cc: In function 'int main()':
a.cc:20:1: error: 'cin' was not declared in this scope
   20 | cin>>n>>m;
      | ^~~
a.cc:22:1: error: 'vector' was not declared in this scope
   22 | vector<vector<int>> g(n+1);
      | ^~~~~~
a.cc:22:15: error: expected primary-expression before 'int'
   22 | vector<vector<int>> g(n+1);
      |               ^~~
a.cc:23:8: error: expected primary-expression before 'bool'
   23 | vector<bool> vis(n+1,false);
      |        ^~~~
a.cc:29:1: error: 'g' was not declared in this scope
   29 | g[a].push_back(b);
      | ^
a.cc:37:6: error: 'vis' was not declared in this scope
   37 |   if(vis[i]==false){
      |      ^~~
a.cc:39:11: error: 'g' was not declared in this scope
   39 |     dfs(i,g,vis);
      |           ^
a.cc:43:1: error: 'cout' was not declared in this scope; did you mean 'count'?
   43 | cout<<count-1<<endl;
      | ^~~~
      | count
a.cc:43:16: error: 'endl' was not declared in this scope
   43 | cout<<count-1<<endl;
      |                ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int n;
vector<vector<int>> g(n);
vector<bool> vis(n,false);



void dfs(int u){
 
 vis[u]=true;
 for(auto v:g[u]){
      if(vis[v])
      continue;

        vis[v]=true;
        dfs(v);

 }

}

int main()
{

    int count=0;
int n,m;
cin>>n>>m;

for(int i=0;i<m;i++){

int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);

}

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

     if(vis[i]==true)
     continue;

     count++;
    dfs(i);

}
cout<<count-1<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: redeclaration of 'int count'
   40 | int count=0;
      |     ^~~~~
a.cc:27:9: note: 'int count' previously declared here
   27 |     int count=0;
      |         ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";
 
const ll inf = 1e18;
const ll N = 1e5 + 2;
 
ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}
 
ll vis[N] = {}, ans = 0;
 
void dfs(vlli v[], ll x){
    if(!vis[x]){
        vis[x]=1;
        forn(i, 0, v[x].size()){
            dfs(v, v[x][i]);
        }
    }
}
 
 
int main(){
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
    ll n;
    cin>>n;
    ll m;
    cin>>m;
    vlli v[n+1];
    forn(i, 0, n){
        ll x, y;
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    
    forn(i, 1, n+1){
        if(!vis[i]){
            f=1;
            ans++;
            dfs(v, i);
        }
    }

    cout<<max(0ll, ans-1)<<endl;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'f' was not declared in this scope
   66 |             f=1;
      |             ^
Language: C++

#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
using namespace std;

struct UnionFind {
    vector<int> par;
    vector<int> sz;
    map<int, int> szmp; // map<size, cnt>
 
    // n : 要素数
    UnionFind(int n = 0){
        if(n > 0) initialize(n);
    }
 
    void initialize(int n){
        par.resize(n);
        sz.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            sz[i] = 1;
        }
        szmp[1] = n;
    }
 
    // 0-index
    int find(int x){
        if(par[x] == x){
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }

    // 0-index
    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return;
        if(sz[x] > sz[y]) swap(x, y);
 
        for(int s : {sz[x], sz[y]}){
            szmp[s]--;
            if(szmp[s] == 0) szmp.erase(s);
        }
        par[x] = y;
        sz[y] += sz[x];
        szmp[sz[y]]++;
    }
 
    // 0-index
    bool same(int x, int y){
        return find(x) == find(y);
    }

    // 0-index
    int size(int x){
        return sz[find(x)];
    }
 
    // 最小要素サイズ
    int minsz(){
        return szmp.begin() -> first;
    }

    // 連結成分個数
    int unitenum(){
        return szmp.size();
    }
};

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

    UnionFind uf(n);

    while(m--){
        int a, b;
        cin >> a >> b;
        uf.unite(a, b);
    }
    cout << uf.size() - 1 << endl;
    return 0;    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:92:20: error: no matching function for call to 'UnionFind::size()'
   92 |     cout << uf.size() - 1 << endl;
      |             ~~~~~~~^~
a.cc:66:9: note: candidate: 'int UnionFind::size(int)'
   66 |     int size(int x){
      |         ^~~~
a.cc:66:9: note:   candidate expects 1 argument, 0 provided
Language: C++

#include<bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define PI              2.0*acos(0.0)
#define pii             pair<int,int>
#define pll             pair<long long,long long>
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost           ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define ss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
using namespace std;

/*
int bs(int l,int r,int n)
{
    int mid,res=inf;

    while(l<=r)
    {
        mid=l+(r-l)/2;

        if(check(mid,n))
        {
            r=mid-1;
            res=min(res,mid);
        }
        else
            l=mid+1;

    }

    return res;
}
*/


//--------------------------code starts here---------------------------------------


#define mx 100005
int parent[mx];

vector<Edge> E;

void makeSet(int u)
{
    parent[u]=u;
}

void init(int n)
{
    for(int i=0;i<=n;i++)
        makeSet(i);
}

int Find(int u)
{
    if(u==parent[u])
        return u;

    return parent[u]=Find(parent[u]);
}

void Union(int u,int v)
{
    int p=Find(u);
    int q=Find(v);

    if(p!=q)
    {
        parent[q]=p;
    }
}



int main()
{
    int n,m,u,v,w;
    sii(n,m);

    init(n);

    Rep(i,1,m)
    {
        sii(u,v);

        Union(u,v);
    }

    set<int> st;

    Rep(i,1,n)
    {
        st.insert(Find(i));
    }

    cout<<st.size()-1;




    return 0;
}


Compiler output:
a.cc:66:8: error: 'Edge' was not declared in this scope
   66 | vector<Edge> E;
      |        ^~~~
a.cc:66:12: error: template argument 1 is invalid
   66 | vector<Edge> E;
      |            ^
a.cc:66:12: error: template argument 2 is invalid
Language: C++

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


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

  for(int i=0;i<m;++i){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    ds.merge(a,b);
  }
  int ans=0;
  for(int i=0;i<n;++i){
    if(!ds.same(0,i))ans++;
  }
  cout << ans << endl;
  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 <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N, M; cin >> N >> M;
    dsu uf(N);
    rep(i, M) {
        int A, B; cin >> A >> B;
        uf.merge(A, B);
    }
    set s;
    rep(i, N) s.insert(uf.leader(i+1));
    cout <<  s.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>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N, M; cin >> N >> M;
    dsu uf(N);
    rep(i, M) {
        int A, B; cin >> A >> B;
        uf.merge(A, B);
    }
    cout << vmax(uf.groups()) - 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>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N, M; cin >> N >> M;
    dsu uf(N);
    rep(i, M) {
        int A, B; cin >> A >> B;
        uf.merge(A, B);
    }
    cout << uf.groups() - 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>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    int N, M; cin >> N >> M;
    uf = dsu(N);
    rep(i, M) {
        int A, B; cin >> A >> B;
        uf.merge(A, B);
    }
    cout << uf.groups() - 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;

int groupNum(int cityNum,vector<int> &road,int M){
  if(cityNum==1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<2*M;i++){
      connected=connected||
        ( (road.at(2*i)<=cityNum)
         &&(road.at(2*i+1)<=cityNum)
         &&( (cityNum==road.at(i)) || (cityNum==road.at(i+1)) ) );
    }
    if(connected){
      return groupNum(cityNum-1,road,M);
    }
    else{
      return groupNum(cityNum-1,road,M)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road,M)-1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: unable to find numeric literal operator 'operator""M'
   29 |   for(int i=0;i<2M;i++){
      |                 ^~
Language: C++

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

int groupNum(int cityNum,vector<int> &road){
  if(cityNum==1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<road.size()/2;i++){
      connected=connected||
        ( (road.at(2*i)<=cityNum)
         &&(road.at(2*i+1)<=cityNum)
         &&( (cityNum==road.at(i)) || (cityNum==road.at(i+1)) ) );
    }
    if(connected){
      return groupNum(cityNum-1,road);
    }
    else{
      return groupNum(cityNum-1,road)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road)-1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:17: error: unable to find numeric literal operator 'operator""M'
   29 |   for(int i=0;i<2M;i++){
      |                 ^~
Language: C++

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

int groupNum(int cityNum,vector<int> &road){
  if(cityNum==1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<road.size()/2;i++){
      connected=connected||
        ((road.at(2*i)<=cityNum)
         &&(road.at(2*i+1)<=cityNum)
         &&((cityNum==road.at(i))||(cityNum==road.at(i+1)));
    }
    if(connected){
      return groupNum(cityNum-1,&road);
    }
    else{
      return groupNum(cityNum-1,&road)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road)-1;
}


Compiler output:
a.cc: In function 'int groupNum(int, std::vector<int>&)':
a.cc:14:60: error: expected ')' before ';' token
   14 |          &&((cityNum==road.at(i))||(cityNum==road.at(i+1)));
      |                                                            ^
      |                                                            )
a.cc:12:9: note: to match this '('
   12 |         ((road.at(2*i)<=cityNum)
      |         ^
a.cc:17:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   17 |       return groupNum(cityNum-1,&road);
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc:20:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   20 |       return groupNum(cityNum-1,&road)+1;
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:29:17: error: unable to find numeric literal operator 'operator""M'
   29 |   for(int i=0;i<2M;i++){
      |                 ^~
Language: C++

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

int groupNum(int cityNum,vector<int> &road){
  if(cityNum==1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<road.length()/2;i++){
      connected=connected||
        ((road.at(2*i)<=cityNum)
         &&(road.at(2*i+1)<=cityNum)
         &&((cityNum==road.at(i))||(cityNum==road.at(i+1)));
    }
    if(connected){
      return groupNum(cityNum-1,&road);
    }
    else{
      return groupNum(cityNum-1,&road)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road)-1;
}


Compiler output:
a.cc: In function 'int groupNum(int, std::vector<int>&)':
a.cc:10:24: error: 'class std::vector<int>' has no member named 'length'
   10 |     for(int i=0;i<road.length()/2;i++){
      |                        ^~~~~~
a.cc:14:60: error: expected ')' before ';' token
   14 |          &&((cityNum==road.at(i))||(cityNum==road.at(i+1)));
      |                                                            ^
      |                                                            )
a.cc:12:9: note: to match this '('
   12 |         ((road.at(2*i)<=cityNum)
      |         ^
a.cc:17:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   17 |       return groupNum(cityNum-1,&road);
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc:20:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   20 |       return groupNum(cityNum-1,&road)+1;
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:29:17: error: unable to find numeric literal operator 'operator""M'
   29 |   for(int i=0;i<2M;i++){
      |                 ^~
Language: C++

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

int groupNum(int cityNum,vector<int> &road){
  if(cityNum=1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<road.length();i++){
      connected=connected||((road.at(i)<=cityNum)&&(citynum==road.at(i)));
    }
    if(connected){
      return groupNum(cityNum-1,&road);
    }
    else{
      return groupNum(cityNum-1,&road)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road)-1;
}


Compiler output:
a.cc: In function 'int groupNum(int, std::vector<int>&)':
a.cc:10:24: error: 'class std::vector<int>' has no member named 'length'
   10 |     for(int i=0;i<road.length();i++){
      |                        ^~~~~~
a.cc:11:53: error: 'citynum' was not declared in this scope; did you mean 'cityNum'?
   11 |       connected=connected||((road.at(i)<=cityNum)&&(citynum==road.at(i)));
      |                                                     ^~~~~~~
      |                                                     cityNum
a.cc:14:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   14 |       return groupNum(cityNum-1,&road);
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc:17:33: error: invalid initialization of non-const reference of type 'std::vector<int>&' from an rvalue of type 'std::vector<int>*'
   17 |       return groupNum(cityNum-1,&road)+1;
      |                                 ^~~~~
a.cc:4:39: note: in passing argument 2 of 'int groupNum(int, std::vector<int>&)'
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ~~~~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:26:17: error: unable to find numeric literal operator 'operator""M'
   26 |   for(int i=0;i<2M;i++){
      |                 ^~
Language: C++

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

int groupNum(int cityNum,vector<int> &road){
  if(cityNum=1){
    return 1;
  }
  else{
    bool connected=false;
    for(int i=0;i<road.length();i++){
      connected=connected||((road.at(i)<=cityNum)&&(citynum==road.at(i)));
    }
    if(connected){
      return groupNum(cityNum-1,&road);
    }
    else{
      return groupNum(cityNum-1,&road)+1;
    }
  }
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> road(2*M);
  for(int i=0;i<2M;i++){
    cin>>road.at(i);
  }
  cout<<groupNum(N,road)-1;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:4:26: error: 'vector' has not been declared
    4 | int groupNum(int cityNum,vector<int> &road){
      |                          ^~~~~~
a.cc:4:32: error: expected ',' or '...' before '<' token
    4 | int groupNum(int cityNum,vector<int> &road){
      |                                ^
a.cc: In function 'int groupNum(int, int)':
a.cc:10:19: error: 'road' was not declared in this scope
   10 |     for(int i=0;i<road.length();i++){
      |                   ^~~~
a.cc:11:53: error: 'citynum' was not declared in this scope; did you mean 'cityNum'?
   11 |       connected=connected||((road.at(i)<=cityNum)&&(citynum==road.at(i)));
      |                                                     ^~~~~~~
      |                                                     cityNum
a.cc:14:34: error: 'road' was not declared in this scope
   14 |       return groupNum(cityNum-1,&road);
      |                                  ^~~~
a.cc:17:34: error: 'road' was not declared in this scope
   17 |       return groupNum(cityNum-1,&road)+1;
      |                                  ^~~~
a.cc: In function 'int main()':
a.cc:24:3: error: 'cin' was not declared in this scope
   24 |   cin>>N>>M;
      |   ^~~
a.cc:25:3: error: 'vector' was not declared in this scope
   25 |   vector<int> road(2*M);
      |   ^~~~~~
a.cc:25:10: error: expected primary-expression before 'int'
   25 |   vector<int> road(2*M);
      |          ^~~
a.cc:26:17: error: unable to find numeric literal operator 'operator""M'
   26 |   for(int i=0;i<2M;i++){
      |                 ^~
a.cc:27:10: error: 'road' was not declared in this scope
   27 |     cin>>road.at(i);
      |          ^~~~
a.cc:29:3: error: 'cout' was not declared in this scope
   29 |   cout<<groupNum(N,road)-1;
      |   ^~~~
a.cc:29:20: error: 'road' was not declared in this scope
   29 |   cout<<groupNum(N,road)-1;
      |                    ^~~~
Language: Java

import java.util.*;

public class BST{
static class Node{
int value;
Node right,left;

	Node(int value){
		this.value=value;
		left=null;
		right=null;
	}
}
static void insert(Node node,int value){
if(value<node.value){
	if(node.left!=null){
		insert(node.left,value);}
		else
	node.left=new Node(value);
	

}else
	if(node.right!=null){
		insert(node.right,value);}
		else{
	node.right=new Node(value);
	}

}
static void inorder(Node node){
	if(node!=null){
inorder(node.left);
System.out.println(node.value);
inorder(node.right);
}

}


public static void main(String[] args) {
	Node node=new Node(3);
	insert(node,5);
	insert(node,2);
	inorder(node);
}

}

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

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

/* MIGHT BE OF USE


#define si(x)	scanf("%d",&x)
#define pi(x)	printf("%d\n",x)

typedef pair<int, int>	pii;
typedef vector<int>		vi;
typedef vector<pii>		vpii;
*/


#define fo(i,a,b) for(i=a;i<b;i++)
#define ll long long
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define sl(x)	scanf("%lld",&x)
#define pl(x)	printf("%lld\n",x)
#define ss(s)	cin>>s
#define ps(s)	cout<<s
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back

typedef pair<ll, ll>	pl;
typedef vector<ll>		vl;
typedef vector<pl>		vpl;
typedef vector<string>	vs;

ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}


vl v[100001];
bool visited[100001]={0};

void dfs(ll att){
    visited[att]=1;
    for(ll i=0;i<v[att].size();i++){
        ll num = v[att][i];
        if(visited[num]) continue;
        visited[num]=1;
        def(num);
    }

}

void solve()
{
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
    ll i, j, n, m;
    cin>>n>>m;
    fo(i,0,m){
        cin>>i>>j;
        v[i].pb(j);
        v[j].pb(i);
    }

    ll ans=0;

    fo(i,1,n+1){
        if(visited[i]) continue;
        dfs(i);
        ans++;
    }
    cout<<ans-1;

}



int main()
{

    ll t = 1;
    //sl(t);
    while(t--)
    {
        solve();
    }

    return 0;
}






Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:49:9: error: 'def' was not declared in this scope; did you mean 'deb'?
   49 |         def(num);
      |         ^~~
      |         deb
Language: C++

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

vector<bool> visit(100005);
vector <int> route[100005];

void dfs(int v){
    visit[v]=1;
    for(int i:route[v]){
        if (visit[i]==1) continue;
        dfs(i);
    }
}

void testcase(){
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        route[a].push_back(b);
        route[b].push_back(a);
    }
    int c=0;
    for(int i=0;i<n;i++){
        if(visit[i]==1) continue;
        dfs(i);
        c++;
    }
    cout << c-1;

}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int q=1;
   // cin >> q;
    while(q--){
    testcase();
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:9:5: error: reference to 'visit' is ambiguous
    9 |     visit[v]=1;
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:5:14: note:                 'std::vector<bool> visit'
    5 | vector<bool> visit(100005);
      |              ^~~~~
a.cc:11:13: error: reference to 'visit' is ambiguous
   11 |         if (visit[i]==1) continue;
      |             ^~~~~
/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:14: note:                 'std::vector<bool> visit'
    5 | vector<bool> visit(100005);
      |              ^~~~~
a.cc: In function 'void testcase()':
a.cc:29:12: error: reference to 'visit' is ambiguous
   29 |         if(visit[i]==1) continue;
      |            ^~~~~
/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:14: note:                 'std::vector<bool> visit'
    5 | vector<bool> visit(100005);
      |              ^~~~~
Language: C++

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



void dfs(int v){
    visit[v]=1;
    for(int i:route[v]){
        if (visit[i]==1) continue;
        dfs(i);
    }
}

void testcase(){

    int n,m;
    cin >> n >> m;
    bool visit[n];
    vector <int> route[n];
    memset(visit,0,sizeof(visit));
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        route[a].push_back(b);
        route[b].push_back(a);
    }
    int c=0;
    for(int i=0;i<n;i++){
        if(visit[i]==1) continue;
        dfs(i);
        c++;
    }
    cout << c-1;

}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int q=1;
   // cin >> q;
    while(q--){
    testcase();
    }
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:8:10: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    8 |     visit[v]=1;
      |          ^
a.cc:9:15: error: 'route' was not declared in this scope
    9 |     for(int i:route[v]){
      |               ^~~~~
a.cc:10:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   10 |         if (visit[i]==1) continue;
      |                  ^