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

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;



signed main(void) {
  int n, m; cin >> n >> m;
  dsu uf(n);
  rep(i,m) {
    int a, b; cin >> a >> b;
    uf.merge(a,b);
  }
  pl(sz(uf.groups())-1)
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:3: error: 'dsu' was not declared in this scope
   36 |   dsu uf(n);
      |   ^~~
a.cc:39:5: error: 'uf' was not declared in this scope
   39 |     uf.merge(a,b);
      |     ^~
a.cc:41:9: error: 'uf' was not declared in this scope
   41 |   pl(sz(uf.groups())-1)
      |         ^~
a.cc:14:24: note: in definition of macro 'pl'
   14 | #define pl(s) cout << (s) << "\n";
      |                        ^
a.cc:41:6: note: in expansion of macro 'sz'
   41 |   pl(sz(uf.groups())-1)
      |      ^~
Language: C++

#include <algorithm>
#include <chrono>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#include <atcoder/dsu>

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int INF = 2000000009;
const ll INFL = 1e18 + 5LL;
const ld EPS = 1e-11;

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

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

    dsu d(n);
    int ans = n - 1;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        if (!d.same(u, v)) {
            --ans;
            d.merge(u, v);
        }
    }

    cout << ans << "\n";

    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vb = vector<bool>;
using vs = vector<string>;
using vvi = vector<vi>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define each(x, a) for (auto&& x : (a))
#define _overload3(_1, _2, _3, name, ...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) for (int i = (a), i##_len = (n); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
constexpr int inf = (1LL<<31) - 1;
constexpr int mod = 1e9 + 7;
constexpr double eps = 1e-10;
const double pi = acos(-1.0);
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};
template<class T> constexpr void print(const T& t) { cout << t << "\n"; }
template<class T, class U> constexpr bool chmax(T& a, const U& b) { if (a < b) a = b; return a < b; }
template<class T, class U> constexpr bool chmin(T& a, const U& b) { if (a > b) a = b; return a > b; }
template<class T, class U> istream& operator>>(istream& is, pair<T, U>& p) { is >> p.fi >> p.se; return is; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.fi << " " << p.se; return os; }
template<class T> istream& operator>>(istream& is, vector<T>& v) { each(e, v) is >> e; return is; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { each(e, v) os << e << " "; return os; }
struct Init { Init() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); }} init;

// 素集合データ構造(union-find) O(α(n))
struct unionfind {
    // 各ノードの親を格納するリスト
    // 根の場合は-(頂点数)を格納する
    vector<int> par;
    unionfind(int n) {
        // すべてのノードを根として初期化
        par.assign(n, -1);
    }
    // xが属するグループの根を返す
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    // xが属するグループの要素数を返す(find)
    int size(int x) {
        return -par[root(x)];
    }
    // x,yが同じグループに属するかどうかを返す
    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    // xが属するグループとyが属するグループを併合する(union)
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return true;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return false;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    unionfind uf(n);
    rep(m) {
        int a, b;
        cin >> a >> b;
        uf.merge(a, b);
    }
    set<int> s;
    rep(i, n) {
        s.insert(uf.root(i));
    }
    print(sz(s) - 1);
}

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 <algorithm>
#include <atcoder/all>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
using namespace atcoder;
using namespace std;

using Pair = pair<int, int>;
using lint = long long;

#define rep(i, n) for (int i = 0; i < (n); i++)

// const int mod = 1e9 + 7;
// const int mod = 998244353;

template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main() {
    int n, m;
    cin >> n >> m;
    dsu d(n);
    int ret = n - 1;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        if (!d.same(a, b)) ret--;
        d.merge(a, b);
    }
    cout << ret << 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;
#pragma region atcoder
#include <atcoder/dsu>
using namespace atcoder;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;

template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

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

/*-----------------------------------------------------------------------------------------------------*/
int cnt = 0;
vector<int> used;
void dfs(vvi &G, int v){
	used[v] = cnt;
	for(int nv : G[v]){
		if(used[nv] != -1) continue;
		dfs(G, nv);
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	vvi G(n);
	used.resize(n, -1);
	rep(i,m){
		int a, b; cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	rep(i,n){
		if(used[i] != -1) continue;
		cnt++;
		dfs(G, i);
	}
	cout << cnt - 1 << endl;
}

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

#include <bits/stdc++.h>
#define int long long
#define zmrl(x) (int)((x).size())
#define ahen(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;

int Set[100100];

int Find(int x) {
    return Set[x] == x ? x : Set[x] = Find(Set[x]);
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n,m; cin>>n>>m;
    for (int i=1; i<=n; i++) Set[i] = i;
    while (m--) {
        int a,b; cin>>a>>b;
        a = Find(a), b = Find(b);
        if (a != b) Set[a] = b;
    }
    vector<bool> flag(n+5, false);
    int cnt = 0;
    for (int i=1; i<=n; i++) {
        int a = Find(i);
        if (!flag[a]) {
            flag[a] = true;
            cnt++;
        }
    }
    cout << cnt-1 << '\n';
    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<iostream>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

int main(){
  int n,m; cin >>n >>m;
  
  dsu g(n);
  rep(i,m){
    int a,b; cin >>a >>b;a--; b--;
    if(df)print(a,b);
    g.merge(a,b);
  }
  vector<vector<int>> s=g.groups();
  print(s.size()-1);
}


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

// execute g++ main.cpp -std=c++14 -I C:\Users\naoya\Desktop\code\Atcoder
#include<bits/stdc++.h>
#include<atcoder/all>
typedef long long ll;
typedef long double ld;
using namespace std;
using namespace atcoder;

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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


char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    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);
    }
    int k = d.groups().size();
    cout << k-1 << endl;
}

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

#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair <int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'

vector < vector < int >> g;
vector < int > visit;

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

int32_t main() {
	boost;
	int n, m;
	cin >> n >> m;
	g.resize(n + 1);
	for(int i = 1, u , v; i <= m; i++) {
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	visit.resize(n + 1, 0);
	int ans = 0;
	for(int i = 1;  i <= n; i++) {
		if(visit[i])
			continue;
		dfs(i);
		ans++;
	}
	cout << ans - 1 << endl;
}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:15:9: error: reference to 'visit' is ambiguous
   15 |         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:12:16: note:                 'std::vector<long long int> visit'
   12 | vector < int > visit;
      |                ^~~~~
a.cc:17:20: error: reference to 'visit' is ambiguous
   17 |                 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:12:16: note:                 'std::vector<long long int> visit'
   12 | vector < int > visit;
      |                ^~~~~
a.cc: In function 'int32_t main()':
a.cc:33:9: error: reference to 'visit' is ambiguous
   33 |         visit.resize(n + 1, 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:12:16: note:                 'std::vector<long long int> visit'
   12 | vector < int > visit;
      |                ^~~~~
a.cc:36:20: error: reference to 'visit' is ambiguous
   36 |                 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:12:16: note:                 'std::vector<long long int> visit'
   12 | vector < int > visit;
      |                ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <atcoder/all>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
using namespace atcoder;
typedef long long ll;
const int MOD = 1000000007;
//const int MOD =  998244353;
 
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, M; cin >> N >> M;

    dsu ds(N);
    int ans = 0;
    rep(i,M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        ds.merge(a,b);
    }
    set<int> counter;
    rep(i,N){
        counter.insert(ds.leader(i));
    }

    cout << counter.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;

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

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

    set<int> s;
    for(int i=1;i<=N;i++){
        s.insert(d.leader(i));
    }

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


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>
typedef long long ll;
#define F(i,L,R) for (ll i = L; i < R; i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define re(x) scanf("%lld",&x)
using namespace std;


void dfs(ll u, vector<ll> &vis, vector<ll>adj[]){
	vis[i] = 1;
	for(auto i: adj[u]) if(vis[i] == 0) dfs(i, vis, adj);
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n,m, u,v, cnt = 0;
  cin>>n>>m;
  vector<ll> adj[n+1];
  F(i,0,m) cin>>u>>v, adj[u].pb(v), adj[v].pb(u);
  vector<ll> vis(n+1,0);
  F(i,1,n+1) if(!vis[i]) cnt++, dfs(i, vis, adj);
  cout<<cnt;
  return 0;
}

Compiler output:
a.cc: In function 'void dfs(ll, std::vector<long long int>&, std::vector<long long int>*)':
a.cc:13:13: error: 'i' was not declared in this scope
   13 |         vis[i] = 1;
      |             ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
#include <atcoder/all>
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>> list = d.groups();
  cout << list.size() - 1 << endl;

  return 0;
}


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

#include <bits/stdc++.h>
#include <atcoder/all>
#define repl(i, l, r) for (int i = l; i < r; ++i)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;
const int MOD = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

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()
{
	int n, m;
	cin >> n >> m;
	dsu d(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		d.merge(a, b);
	;
	map<int, int> mp;
	rep(i, n) {
		mp[d.leader(i)]++;
	}
	int ans = mp.size();
	--ans;
	cout << ans << endl;
    return 0;
}


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

#include <atcoder/all>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
using P = pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& v) {
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    for (int i = 0; i < v.size(); i++) {
        if (i) os << ", ";
        os << v[i];
    }
    os << "}";
    return os;
}

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

class UnionFind {
    private final int N;
    int[] parent;
    int[] rank;
    int[] size;

    UnionFind(int n) {
        N = n;
        parent = new int[N];
        Arrays.setAll(parent, i -> i);
        size = new int[N];
        Arrays.fill(size, 1);
        rank = new int[N];
    }

    boolean isRoot(int x) {
        return x == parent[x];
    }

    int root(int x) {
        return isRoot(x) ? x : (parent[x] = root(parent[x]));
    }

    boolean same(int x, int y){
        return root(x) == root(y);
    }

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

    void unite(int x, int y){
        x = root(x);
        y = root(y);
        if (x != y) {
            if (rank[x] < rank[y]) {
                parent[x] = y;
                size[y] += size[x];
            } else {
                parent[y] = x;
                size[x] += size[y];
                if (rank[x] == rank[y]) {
                    rank[x]++;
                }
            }
        }
    }
}


Compiler output:
Main.java:10: error: cannot find symbol
        Arrays.setAll(parent, i -> i);
        ^
  symbol:   variable Arrays
  location: class UnionFind
Main.java:12: error: cannot find symbol
        Arrays.fill(size, 1);
        ^
  symbol:   variable Arrays
  location: class UnionFind
2 errors
Language: C++

#include<bits/stdc++.h>
#include<atcoder/all>
#define int long long
using namespace std;
using namespace atcoder;
signed main(){
  int N,M;
  cin>>N>>M;
  dsu D(N);
  while(M--){
    int a,b;
    cin>>a>>b;
    D.merge(a-1,b-1);
  }
  cout<<D.groups().size()-1<<endl;
}

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>
using namespace std;

const int N=100010,M=100010;
int findpa(int x){return fa[x]!=x?fa[x]=findpa(fa[x]):x;}
int fa[N],n,m;

int main(){
	scanf("%d %d",&n,&m);
	int tot=n-1,x,y;
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++) scanf("%d %d",&x,&y),findpa(x)!=findpa(y)?tot--,f[findpa(x)]=findpa(y):0;
	printf("%d\n",tot);
}

Compiler output:
a.cc: In function 'int findpa(int)':
a.cc:5:26: error: 'fa' was not declared in this scope; did you mean 'fma'?
    5 | int findpa(int x){return fa[x]!=x?fa[x]=findpa(fa[x]):x;}
      |                          ^~
      |                          fma
a.cc: In function 'int main()':
a.cc:12:79: error: 'f' was not declared in this scope
   12 |         for(int i=1;i<=m;i++) scanf("%d %d",&x,&y),findpa(x)!=findpa(y)?tot--,f[findpa(x)]=findpa(y):0;
      |                                                                               ^
Language: C++

#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const int MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return (c>r||c<0) ? 0:fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

vector<int>  v[100000];
char visit[100000];

void go(int o) {
    visit[o]++;
    for (int i : v[o]) {
        if (visit[i]) continue;
        go(i);
    }
}

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

    for (int i = 0; i < m; i++) {
        int a,b;
        scanf("%d %d", &a, &b);
        a--; b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (!visit[i]) go(i), cnt++;
    }
    printf("%d", cnt - 1);
}


// author: rdd6584


Compiler output:
a.cc: In function 'void go(int)':
a.cc:29:5: error: reference to 'visit' is ambiguous
   29 |     visit[o]++;
      |     ^~~~~
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:26:6: note:                 'char visit [100000]'
   26 | char visit[100000];
      |      ^~~~~
a.cc:31:13: error: reference to 'visit' is ambiguous
   31 |         if (visit[i]) 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:26:6: note:                 'char visit [100000]'
   26 | char visit[100000];
      |      ^~~~~
a.cc: In function 'int main()':
a.cc:50:14: error: reference to 'visit' is ambiguous
   50 |         if (!visit[i]) go(i), cnt++;
      |              ^~~~~
/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:26:6: note:                 'char visit [100000]'
   26 | char visit[100000];
      |      ^~~~~
Language: C++

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
  cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
  return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
  cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
  return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
  for (auto& i : arr)cin >> i; return in;
}

/////////////////////////////////////////////////////////////////////////
int main(int argc, char const* argv[])
{
  int n,m;cin >> n >> m;
  dsu uf(n);
  for (int i = 0; i < m; i++) {
    int a,b;cin >> a >> b;
    uf.merge(a,b);
  }
  cout << uf.groups().size() - 1 << '\n';
  return 0;
}


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

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
#include <atcoder/all>
using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;



int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    dsu d(n);
    rep (i, m) {
        int a, b; cin >> a >> b;
        a--; b--;
        d.merge(a, b);
    }
    map<int, int> mp;
    rep (i, n) mp[d.leader(i)]++;
    ll ans = 0;
    cout << mp.size() - 1 << "\n";
    /***************************************************/
    /* Use "submit code (with ACL v1)" when using ACL! */
    /***************************************************/
    return 0;
}

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

#include <bits/stdc++.h>

#include <atcoder/all>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a *= -1, b *= -1;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

typedef struct UnionFindTree {
    vector<int> par;

    UnionFindTree(int n) { par.resize(n, -1); }

    bool is_root(int x) { return par[x] < 0; }

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

    int size(int x) { return -par[find(x)]; }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y) { return find(x) == find(y); }
} UF;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    UF uf(n);
    int cnt = n;
    rep(_, m) {
        int a, b;
        scanf("%d%d", &a, &b);
        --a;
        --b;
        cnt -= uf.unite(a, b);
    }
    printf("%d\n", cnt - 1);
}

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

#include<atcoder/all>
using namespace atcoder;

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

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

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

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

using namespace std;
using namespace atcoder;

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

int op(int a, int b) {return max(a, b);}
int e() {return -1;}

int N, K;
int A[300010];
segtree<int, op, e> seg(300010);

signed main()
{
    cin >> N >> K;
    rep(i, N)cin >> A[i];

    rep(i, N)
    {
        int now = seg.prod(max(0ll, A[i] - K), min(A[i] + K + 1, 300010ll)) + 1;
        now = max(now, 1ll);

        seg.set(A[i], now);
    }

    cout << seg.prod(0, 300010) << endl;

    return 0;
}

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

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

const int MAX_A = 300005;
int op(int a, int b) { return max(a,b);}
int e() { return 0;}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    segtree<int,op,e> dp(MAX_A);
    rep(i,n) {
        int x = a[i];
        int l = max(x-k,0), r = min(x+k+1,MAX_A);
        int now = dp.prod(l,r)+1;
        dp.set(x, now);
    }
    int ans = dp.prod(0,MAX_A);
    cout << ans << endl;
    return 0;
}

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

//Let's join Kaede Takagaki Fan Club !!
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define all(x) x.begin(),x.end()
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
void g(T &a){
	cin >> a;
}
template<class T>
void o(const T &a,bool space=false){
	cout << a << (space?' ':'\n');
}
//ios::sync_with_stdio(false);
const ll mod = 998244353;

int n, k, a[300005];

int op(int a, int b){
	return max(a, b);
}
int e(){
	return -INF;
}
int main(){
	scanf("%d%d", &n, &k);
	segtree <int, op, e> seg(300005);
	for(int i=1;i<=n;i++){
		scanf("%d", &a[i]);
		int lb = max(0, a[i]-k);
		int ub = min(300000, a[i]+k);
		int cur = max(0, seg.prod(lb, ub+1)) + 1;
		seg.set(a[i], cur);
	}
	printf("%d\n", seg.all_prod());
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=6e5+5;
int n,m,x,k,a[N],tree[N<<2],ans=0;
void pushup(int i)
{
    tree[i]=max(tree[i<<1],tree[i<<1|1]);
}

void update(int i,int l,int r,int x,int k)
{
    if(l==r)
    {
        tree[i]=max(tree[i],k);
        return ;
    }
    int mid=l+(r-l)/2;
    if(x<=mid) update(i<<1,l,mid,x,k);
    else update(i<<1|1,mid+1,r,x,k);
    pushup(i);
}

int query(int i,int l,int r,int m,int n)
{
    if(m<=l && r<=n) return tree[i];
    int ans=0,mid=l+(r-l)/2;
    if(m<=mid) ans=max(ans,query(i<<1,l,mid,m,n));
    if(n>mid) ans=max(ans,query(i<<1|1,mid+1,r,m,n));
    return ans;
}

int main(){
    //memset(tree,0,sizeof(tree));
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]++;
    for(int i=1;i<=n;i++){
        x=query(1,1,300001,max(a[i]-k,1),min(a[i]+k,300001))+1;
        ans=max(ans,x);
        update(1,1,300001,a[i],x);
    }
    printf("%d",ans);
    return 0;
}

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

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int op(int a, int b){
    return max(a, b);
}

int e(){
    return 0;
}

int main(void){
	int N,K,x,i,ans=0;
	segtree <int, op, e> seg(300010);
	
	cin >> N >> K;
	
	REP(i,N){
		scanf("%d", &x);
		int L = max(x - K, 0);
		int R = min(x + K, 300000);
		int tmp = seg.prod(L, R+1) + 1;
		ans = max(ans, tmp);
		seg.set(x, tmp);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>
#include<atcoder/all>


using namespace std;
using namespace atcoder;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.12f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 1010101;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// mod.m での a の逆元 a^ { -1 } を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x /gcd(x, y) * y );
}

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}


ll dx[8] = { 1,-1,0,0,1,1,-1,-1 };
ll dy[8] = { 0,0,1,-1,1,-1,1,-1 };
char c[2010][2010];
ll dp[101010][20];

ll op(ll a, ll b) {
	return max(a, b);
}

ll e() {
	return 0;
}

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll>a(n);
	rep(i, n)cin >> a[i];
	segtree<ll, op, e>dp(301010);
	rep(i, n) {
		ll x = a[i];
		ll l = x - k, r = x + k + 1;
		l = max(l, (ll)0);
		r = min(r, (ll)301010);
		ll now = dp.prod(l, r) + 1;
		dp.set(x, now);
	}
	ll ans = dp.prod((ll)0, (ll)301010);
	cout << ans << endl;
	return 0;
}


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

#include <bits/stdc++.h>
#include <atcoder/segtree.hpp>
using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
//const int mod=998244353;
using P = pair<int,int>;
using Pl= pair<ll,ll>;
using ld=long double;
using V=vector<int>;
using Vl=vector<ll>;
using VV=vector<vector<int>>;
using VVl=vector<vector<ll>>;

ll op(ll a,ll b){
    return max(a,b);
}

ll e(){
    return 0;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;cin >>n>>k;
    Vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    const int MAX_A=300101;
    atcoder::segtree<ll,op,e>dp(MAX_A);
    for (int i = 0; i < n; ++i) {
        int l=a[i]-k;
        int r=a[i]+k+1;
        l=max(0,l),r=min(MAX_A,r);
        dp.set(a[i],dp.prod(l,r)+1);
    }
    ll ans=dp.all_prod();
    cout <<ans<<"\n";
}

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

#include <iostream>
using namespace std;
const int maxn=3e6+7;
struct node{
    int l,r,s;
}pre[maxn];
int n,k,mx,a[maxn];
void build(int k,int l,int r);
void update(int k,int l,int r);
int query(int k,int l,int r);
int main(){
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
    }
    build(1,0,mx);
    int now=0,ans=0;
    for(int i=1;i<=n;i++){
        now=query(1,max(0,a[i]-k),min(mx,a[i]+k))+1;
        ans=max(ans,now);
        update(1,now,now);
    }
    printf("%d\n",ans);
}

void build(int k,int l,int r){
    pre[k].l=l,pre[k].r=r,pre[k].s=0;
    if(l>=r) return;
    build(k*2,l,(l+r)/2);
    build(k*2+1,(l+r)/2+1,r);
}

void update(int k,int l,int r){
    if(l<=pre[k].l&&pre[k].r<=r){
        pre[k].s=l;
        return;
    }
    int mid=(pre[k].l+pre[k].r)/2;
    if(l<=mid) update(k*2,l,r);
    else(mid+1<=r) update(k*2+1,l,r);
    pre[k].s=max(pre[k*2].s,pre[k*2+1].s);
}

int query(int k,int l,int r){
    if(pre[k].l<=l&&pre[k].r<=r){
        return pre[k].s;
    }
    int mid=(pre[k].l+pre[k].r)/2;
    int ans1=0,ans2=0;
    if(l<=mid) ans1=query(k*2,l,r);
    if(mid+1<=r) ans2=query(k*2+1,l,r);
    return max(ans1,ans2);
}



Compiler output:
a.cc: In function 'void update(int, int, int)':
a.cc:41:19: error: expected ';' before 'update'
   41 |     else(mid+1<=r) update(k*2+1,l,r);
      |                   ^~~~~~~
      |                   ;
Language: C

# include <stdio.h>
# include <malloc.h>

int return_value(int, int);

int main(void)
{
    int N, K;
    int * list;
    int i, j;
    int count;

    scanf("%d", &N);
    list = (int *)malloc(N * sizeof(int));
    for (i=0; i<N, ++i)
        scanf("%d", list[i]);

    for (i=0; i<N, ++i)
    {
        for (j=i; j<N; ++j)
        {
            if (return_value(list[i], list[j]) <= K)
            {
                ++count;
                break;
            }
        }
        
    }
    printf("%d", count);

    return 0;
}

int return_value(int i, int j)
{
    if (i > j)
        return (i - j);
    else
        return (j - i);
}

Compiler output:
main.c: In function 'main':
main.c:15:23: error: expected ';' before ')' token
   15 |     for (i=0; i<N, ++i)
      |                       ^
      |                       ;
main.c:18:23: error: expected ';' before ')' token
   18 |     for (i=0; i<N, ++i)
      |                       ^
      |                       ;
Language: C++

#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>
#include<functional>
#include<unordered_set>
#include<unordered_map>
#include<atcoder/all>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;
const long long ll_max = 9223372036854775807;
const long long ll_min = -9223372036854775807;
const int int_max = 2147483647;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> ret;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			ret[i] ++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

template<typename T>
T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



// 繰り返し二乗法
ll pow2(ll n, ll p, ll mod) {
	if (p == 0 || n == 1) {
		return 1;
	}
	else {
		ll ret = pow2(n * n % mod, p / 2, mod);
		if (p % 2 == 1) {
			ret *= n;
		}
		return ret % mod;
	}
}


#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int op(int a, int b) {
	return max(a, b);
}

int e() {
	return 0;
}

int main() {
	ll n, k;
	cin >> n >> k;

	atcoder::segtree<int, op, e> segtree(n + 1);

	ll ans = 0;
	rep(i, 0, n) {
		ll a;
		cin >> a;
		ll l = max(a - k, 0LL);
		ll r = min(a + k, n) + 1;
		ll tmp = segtree.prod(l, r) + 1;
		ans = max(ans, tmp);
		segtree.set(a, tmp);
	}

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


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