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

#include <iostream>
#include <string>
#include <vector>
// #include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define RFOR(i, j, k) for(int i=j ; i>=k ; i--)
#define REP(i, j) FOR(i, 0, j)
#define RREP(i, j) RFOR(i, j, 0)
#define PI 3.1415926535897932384626433832795
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;

#define UNION_FIND_MAX_N 100005
int par[UNION_FIND_MAX_N];
int ran[UNION_FIND_MAX_N];

void init(int n){
    for(int i=0; i<n; i++){
        par[i] = i;
        ran[i] = 0;
    }
}

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

void unite(int x, int y){
    x = find(x);
    y = find(y);
    if( x == y ) return;

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

bool same(int x, int y){
    return find(x) == find(y);
}
#include "union_find.cpp"
#include <algorithm>
using namespace std;

#define MAX_E 200010

struct edge {
    long long u, v, cost;
    edge(){};
    edge(long long a, long long b, long long c){
        u = a;
        v = b;
        cost = c;
    }
};

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

edge es[MAX_E];
int V, E;

long long kruskal(){
    sort(es, es + E, comp);
    init(V);
    long long res = 0;
    for (int i = 0; i < E; i++) {
        edge e = es[i];
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

#define INF (1<<31)

int main() {
    
    int N; cin >> N;
    vector<pii> pa(N), pb(N);

    REP(i, N) {
        int a, b;
        cin >> a >> b;
        pa[i] = make_pair(a, i);
        pb[i] = make_pair(b, i);
    }

    sort(pa.begin(), pa.end());
    sort(pb.begin(), pb.end());

    REP(i, N-1) {
        es[i]   = edge(pa[i].second, pa[i+1].second, pa[i+1].first-pa[i].first);
        es[i+N] = edge(pb[i].second, pb[i+1].second, pb[i+1].first-pb[i].first);
    }

    V = N;
    E = N*2;

    ll res = kruskal();

    cout << res << endl;


    return 0;
}




Compiler output:
a.cc:82:10: fatal error: union_find.cpp: No such file or directory
   82 | #include "union_find.cpp"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
// #include <unordered_map>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <climits>

using namespace std;

#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define FOR(i, j, k) for(int i=j ; i<k ; i++)
#define RFOR(i, j, k) for(int i=j ; i>=k ; i--)
#define REP(i, j) FOR(i, 0, j)
#define RREP(i, j) RFOR(i, j, 0)
#define PI 3.1415926535897932384626433832795
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;
#include "union_find.cpp"
#include <algorithm>
using namespace std;

#define MAX_E 200010

struct edge {
    long long u, v, cost;
    edge(){};
    edge(long long a, long long b, long long c){
        u = a;
        v = b;
        cost = c;
    }
};

bool comp(const edge& e1, const edge& e2) {
    return e1.cost < e2.cost;
}

edge es[MAX_E];
int V, E;

long long kruskal(){
    sort(es, es + E, comp);
    init(V);
    long long res = 0;
    for (int i = 0; i < E; i++) {
        edge e = es[i];
        if (!same(e.u, e.v)) {
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}

#define INF (1<<31)

int main() {
    
    int N; cin >> N;
    vector<pii> pa(N), pb(N);

    REP(i, N) {
        int a, b;
        cin >> a >> b;
        pa[i] = make_pair(a, i);
        pb[i] = make_pair(b, i);
    }

    sort(pa.begin(), pa.end());
    sort(pb.begin(), pb.end());

    REP(i, N-1) {
        es[i]   = edge(pa[i].second, pa[i+1].second, pa[i+1].first-pa[i].first);
        es[i+N] = edge(pb[i].second, pb[i+1].second, pb[i+1].first-pb[i].first);
    }

    V = N;
    E = N*2;

    ll res = kruskal();

    cout << res << endl;


    return 0;
}




Compiler output:
a.cc:49:10: fatal error: union_find.cpp: No such file or directory
   49 | #include "union_find.cpp"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

  sort(ALL(x));
  sort(ALL(y));

  REP(i, N - 1) {
    // x
    int tmp1, tmp2, from, to, cost;
    tie(tmp1, tmp2, from) = x[i];
    tie(tmp2, cost, to) = x[i + 1];
    e.emplace_back(Edge(from, to, abs(tmp2 - tmp1)));
  }
  
  REP(i, N) {
    // y
    int tmp1, tmp2, from, to, cost;
    tie(tmp1, tmp2, from) = y[i];
    tie(tmp2, cost, to) = y[i + 1];
    e.emplace_back(Edge(from, to, abs(tmp2 - tmp1)));    
  }

  int ans = kruscal();
  cout << ans << endl;
  
  return 0;
}



Compiler output:
a.cc:1:7: error: expected constructor, destructor, or type conversion before '(' token
    1 |   sort(ALL(x));
      |       ^
a.cc:2:7: error: expected constructor, destructor, or type conversion before '(' token
    2 |   sort(ALL(y));
      |       ^
a.cc:4:6: error: expected constructor, destructor, or type conversion before '(' token
    4 |   REP(i, N - 1) {
      |      ^
a.cc:12:6: error: expected constructor, destructor, or type conversion before '(' token
   12 |   REP(i, N) {
      |      ^
a.cc:20:13: error: 'kruscal' was not declared in this scope
   20 |   int ans = kruscal();
      |             ^~~~~~~
a.cc:21:3: error: 'cout' does not name a type
   21 |   cout << ans << endl;
      |   ^~~~
a.cc:23:3: error: expected unqualified-id before 'return'
   23 |   return 0;
      |   ^~~~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C++

#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <cassert>
#include <tuple>

using namespace std;
typedef long long ll;
const ll INF = 1e15;


using Weight = ll;
class Edge {
public:
	int s, d;
	Weight w;
	Edge() : s(0), d(0), w(0) {}
	Edge(int s, int d, Weight w) : s(s), d(d), w(w) {}
	bool operator < (const Edge &e) const {
		return w != e.w ? w < e.w :
			   s != e.s ? s < e.s :
			   d < e.d;
	}
};
using Graph = vector<vector<Edge>>;

// 最小全域木とそのコストを返す O(ElogE)
pair<Weight, Graph> prim(Graph& g) {
	vector<int> visited(g.size());
	Weight cost = 0;
	Graph f(g.size());
	priority_queue<Edge> que;
	que.push(Edge(-1, 0, 0));
	while (!que.empty()) {
		Edge now = que.top();
		now.w *= -1;
		que.pop();
		if (visited[now.d])
			continue;
		visited[now.d] = true;
		cost += now.w;
		if(now.s >= 0)
			f[now.s].push_back(now);
		for (auto&& e : g[now.d]) {
			if (!visited[e.d])
				que.push(Edge(e.s, e.d, -e.w));
		}
	}
	return make_pair(cost, f);
}

using P = pair<ll, ll>;
int main() {
	ll N;
	cin >> N;
	Graph g(N);
	vector<P> xv(N);
	vector<P> yv(N);
	for (int i = 0;i < N;i++) {
		ll x, y;
		cin >> x >> y;
		xv[i] = P(x, i);
		yv[i] = P(y, i);
	}
	sort(xv.begin(), xv.end());
	sort(yv.begin(), yv.end());
	for (int i = 0;i < N;i++) {
		if (i > 0) {
			g[xv[i].second].push_back(Edge(xv[i].second, xv[i - 1].second, abs(xv[i].first - xv[i - 1].first)));
			g[yv[i].second].push_back(Edge(yv[i].second, yv[i - 1].second, abs(yv[i].first - yv[i - 1].first)));
		}
		if (i < N - 1) {
			g[xv[i].second].push_back(Edge(xv[i].second, xv[i + 1].second, abs(xv[i].first - xv[i + 1].first)));
			g[yv[i].second].push_back(Edge(yv[i].second, yv[i + 1].second, abs(yv[i].first - yv[i + 1].first)));
		}
	}
	Weight cost;
	Graph f;
	tie(cost, f) = prim(g);
	cout << cost << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   69 |         sort(xv.begin(), xv.end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <queue>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#define INF (LLONG_MAX>>2)
using namespace std;

typedef long long ll;

class edge{
public:
  int to;
  int weight;
  edge(int to, int weight){
    this->to = to;
    this->weight = weight;
  }
};

ll minimumSpannTree(int, vector<edge>*);

int main(){
  int n; cin >> n;
  vector<edge> graph[n+1];

  pair<int, int> xp[n+1], yp[n+1]; //(頂点番号・座標)のpair
  int x, y;
  for(int i=1; i<=n; i++){
    cin >> x >> y;
    xp[i] = make_pair(x, i);
    yp[i] = make_pair(y, i);
  }

  //隣り合う頂点同士を探すためにソート
  sort(xp+1, xp+n+1); sort(yp+1, yp+n+1);

  //グラフ作成
  for(int i=1; i<n; i++){
    int s=xp[i].second, t=xp[i+1].second;
    int weight = abs(xp[i].first-xp[i+1].first);
    graph[s].push_back(edge(t, weight));
    graph[t].push_back(edge(s, weight));

    s=yp[i].second, t=yp[i+1].second;
    weight = abs(yp[i].first-yp[i+1].first);
    graph[s].push_back(edge(t, weight));
    graph[t].push_back(edge(s, weight));
  }

  ll ans = minimumSpannTree(n, graph);

  cout << ans << endl;

  return 0;
}

ll minimumSpannTree(int n, vector<edge>* graph){
  ll minDis[n+1];
  bool added[n+1];
  for(int i=1; i<=n; i++){
    minDis[i] = INF;
    added[i] = false;
  }

  priority_queue<pair<ll, int>, vector<pair<ll, int> >, greater<pair<ll, int> > > pq;
  pq.push(make_pair(0, 1));//とりあえず頂点1をプッシュ
  minDis[1] = 0;

  ll res = 0;
  while(!pq.empty()){
    pair<ll, int> nowP = pq.top(); pq.pop(); //先頭要素をポップ
    ll nowDis = nowP.first; int nowNode = nowP.second;
    if(added[nowNode]) continue;

    added[nowNode] = true;
    res += nowDis;

    for(int i=0; i<graph[nowNode].size(); i++){
      edge e = graph[nowNode][i];
      if(e.weight < minDis[e.to]){
        minDis[e.to] = e.weight;
        pq.push(make_pair(minDis[e.to], e.to));
      }
    }
  }

  return res;
}


Compiler output:
a.cc: In function 'll minimumSpannTree(int, std::vector<edge>*)':
a.cc:7:14: error: 'LLONG_MAX' was not declared in this scope
    7 | #define INF (LLONG_MAX>>2)
      |              ^~~~~~~~~
a.cc:63:17: note: in expansion of macro 'INF'
   63 |     minDis[i] = INF;
      |                 ^~~
a.cc:7:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cmath>
  +++ |+#include <climits>
    7 | #define INF (LLONG_MAX>>2)
Language: C++

#include "Union_Find.h"

bool UnionFindTree::Is_valid_index(int index) {
	return index >= 0 && index < whole_size_m;
}

int UnionFindTree::Root_of_rec(int index) {
	if (parent_p_m[index] == index) {
		return index;
	} else {
		return parent_p_m[index] = Root_of_rec(parent_p_m[index]);
	}
}

UnionFindTree::UnionFindTree(int whole_size)
	: whole_size_m(whole_size) {
	parent_p_m = new int[whole_size_m];
	rank_p_m = new int[whole_size_m];
	size_p_m = new int[whole_size_m];
	for (int i = 0; i < whole_size_m; ++i) {
		parent_p_m[i] = i;
		rank_p_m[i] = 1;
		size_p_m[i] = 1;
	}
}

UnionFindTree::~UnionFindTree() {
	delete[] parent_p_m;
	delete[] rank_p_m;
	delete[] size_p_m;
}

int UnionFindTree::Root_of(int index) {
	if (Is_valid_index(index) == false) return -1;
	return Root_of_rec(index);
}

void UnionFindTree::Unite(int index_l, int index_r) {
	if (Is_valid_index(index_l) == false || Is_valid_index(index_r) == false) return;
	int root_l = Root_of(index_l);
	int root_r = Root_of(index_r);
	if (root_l == root_r) return;

	if (rank_p_m[root_l] > rank_p_m[root_r]) {
		parent_p_m[root_r] = root_l;
		size_p_m[root_r] += root_l;
	} else {
		parent_p_m[root_l] = root_r;
		size_p_m[root_l] += root_r;
		if (rank_p_m[root_l] == rank_p_m[root_r]) ++rank_p_m[root_r];
	}
}

bool UnionFindTree::Are_together(int index_l, int index_r) {
	return Root_of(index_l) == Root_of(index_r);
}

int UnionFindTree::Size_of_set(int index) {
	return size_p_m[index];
}

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#endif

int N;
int A[100001], B[100001];
PP PA[100001], PB[100001];
PriorityQ<pair<int, PP> > Q;
int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i] >> B[i];
		PA[i] = PP(A[i], i);
		PB[i] = PP(B[i], i);
	}
	sort(PA, PA + N);
	sort(PB, PB + N);
	REP(i, 0, N - 1) {
		Q.push(make_pair(PA[i + 1].first - PA[i].first, PP(PA[i + 1].second, PA[i].second)));
		Q.push(make_pair(PB[i + 1].first - PB[i].first, PP(PB[i + 1].second, PB[i].second)));
	}

	UnionFindTree U(N);
	LL sum = 0;
	while (!Q.empty()) {
		auto cp = Q.top(); Q.pop();
		int c = cp.first;
		PP p = cp.second;
		int l = p.first;
		int r = p.second;
		if (!U.Are_together(l, r)) {
			U.Unite(l, r);
			sum += c;
		}
	}
	cout << sum << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: Union_Find.h: No such file or directory
    1 | #include "Union_Find.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

class Edge {
public:
    int from;
    int to;
    int cost;

    Edge(int from, int to, int cost): from{from}, to{to}, cost{cost} {}
    bool operator<(const Edge& other) const {
        return this->cost < other.cost;
    }
    bool operator>(const Edge& other) const {
        return this->cost > other.cost;
    }
};

class UnionFindTree {
public:
    vector<int> parent;

    UnionFindTree(int size) {
        parent.resize((unsigned long) (size + 1));
        iota(parent.begin(), parent.end(), 0);
    }

    bool isSameSet(int x, int y) {
        return findRoot(x) == findRoot(y);
    }

    void unionSet(int x, int y) {
        int xRoot { findRoot(x) };
        int yRoot { findRoot(y) };
        if (xRoot == yRoot) { return; }

        parent[xRoot] = yRoot;
    }

    int getNumberOfSet() {
        int n = 0;
        for (int i = 0; parent.size(); ++i) {
            if (parent[i] == i) { n++; }
        }
        return n;
    }

private:
    int findRoot(int x) {
        if (parent[x] == x) {
            return x;
        }
        return parent[x] = findRoot(parent[x]);
    }
};

int kruskal(int v, vector<Edge>& edges) {
    sort(edges.begin(), edges.end());
    UnionFindTree uf(v);
    int res { 0 };
    for (auto& e : edges) {
        if (!uf.isSameSet(e.from, e.to)) {
            uf.unionSet(e.from, e.to);
            res += e.cost;
        }
    }
    return res;
}

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

    vector<pair<int, int>> xList((unsigned long) N);
    vector<pair<int, int>> yList((unsigned long) N);
    for (int i { 0 }; i < N; ++i) {
        int x, y;
        cin >> x >> y;
        xList[i] = { x, i };
        yList[i] = { y, i };
    }
    sort(xList.begin(), xList.end());
    sort(yList.begin(), yList.end());

    vector<Edge> edges;
    for (int i { 1 }; i < N; ++i) {
        edges.push_back(Edge(xList[i - 1].second, xList[i].second, abs(xList[i - 1].first - xList[i].first)));
        edges.push_back(Edge(xList[i].second, xList[i + 1].second, abs(xList[i].first - xList[i + 1].first)));
        edges.push_back(Edge(yList[i - 1].second, yList[i].second, abs(yList[i - 1].first - yList[i].first)));
        edges.push_back(Edge(yList[i].second, yList[i + 1].second, abs(yList[i].first - yList[i + 1].first)));
    }

    cout << kruskal(N, edges) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int kruskal(int, std::vector<Edge>&)':
a.cc:61:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   61 |     sort(edges.begin(), edges.end());
      |     ^~~~
      |     short
a.cc: In function 'int main()':
a.cc:85:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   85 |     sort(xList.begin(), xList.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
struct X{
	int id;
	LL x;
	LL y;
	X(){
		id=0;
		x=0;
		y=0;
	}
	X(int _id,LL _x,LL _y){
		id=_id;
		x=_x;
		y=_y;
	}
	LL getCost(X &x1){
		LL X1=x-x1.x;
		if (X1<0){
			X1=-X1;
		}
		LL Y1=y-x1.y;
		if (Y1<0){
			Y1=-Y1;
		}
		if (X1<Y1){
			return X1;
		}else{
			return Y1;
		}
	}
};
struct EDGE{
	X p1;
	X p2;
	LL cost;
	EDGE(X _p1,X _p2){
		p1=_p1;
		p2=_p2;
		cost=p1.getCost(p2);
	}
  // コストの大小で順序定義
  bool operator<(const EDGE& o) const {
    return cost < o.cost;
  }
	bool find(const EDGE &edge){
		if (p1.id==edge.p1.id && p2.id==edge.p2.id){
			return true;
		}
		if (p1.id==edge.p2.id && p2.id==edge.p1.id){
			return true;
		}
		return false;
	}

};
bool SortX(X &x1,X &x2){
	if (x1.x<x2.x){
		return true;
	}
	return false;
}
bool SortY(X &x1,X &x2){
	if (x1.y<x2.y){
		return true;
	}
	return false;
}
// 素集合データ構造
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
	  for (int i=0;i<n;i++){
		par[i] = i;
	  }
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

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

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

// 頂点数と辺集合の組として定義したグラフ
struct Graph
{
  int n;  // 頂点数
  vector<EDGE> edges;  // 辺集合

  // クラスカル法で無向最小全域木のコストの和を計算する
  // グラフが非連結のときは最小全域森のコストの和となる
  LL kruskal() {
    // コストが小さい順にソート
    sort(edges.begin(), edges.end());

    UnionFind uf(n);
    LL min_cost = 0;

    for (int i=0;i<edges.size();i++) {
      EDGE& e = edges[i];
	  if (!uf.same(e.p1.id, e.p2.id)) {
        // 辺を追加しても閉路ができないなら、その辺を採用する
        min_cost += e.cost;
		uf.unite(e.p1.id, e.p2.id);
      }
    }

    return min_cost;
  }
};

int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	vector<X> City;
	int i,j;
	LL x,y;
	for (i=0;i<N;i++){
		cin>>x>>y;
		City.push_back(X(i,x,y));
	}
	sort(City.begin(),City.end(),SortX);
	Graph graph;
	graph.n=N;
	for (i=0;i<N-1;i++){
		graph.edges.push_back(edge);
	}
	sort(City.begin(),City.end(),SortY);
	for (i=0;i<N-1;i++){
		EDGE edge(City[i],City[i+1]);
		graph.edges.push_back(edge);
	}
	cout << graph.kruskal() << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:165:39: error: 'edge' was not declared in this scope
  165 |                 graph.edges.push_back(edge);
      |                                       ^~~~
Language: C++

#include<iostream>
#include<cstring>
#include<math.h>
#include<stdlib.h>
#include<cstring>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;
const int Max = 2*1e5+5;
const int mod = 1e9+7;
const int Hash = 10000;
const int INF = 1<<30;
const ll llINF = 1e18;

int n, m;
struct edge
{
    int start, finish, w;
};
struct node
{
    int a,b, index;
};
node in[Max];//点的输入
edge arr[Max];//储存所有的边，在该数组上跑克鲁斯卡尔算法，O(nlogn)
bool cmp1(const node& t1, const node& t2)
{
    return t1.a<t2.a;
}
bool cmp2(const node& t1, const node& t2)
{
    return t1.b<t2.b;
}
bool cmp3(const edge& t1, const edge& t2)
{
    return t1.w<t2.w;
}
int isvisited[Max];
void init( )
{
    for(int i=0; i<Max; i++)
        isvisited[i] = i;
}
int f(int k)
{
    if(k != isvisited[k])
        k = f(isvisited[k]);
    return k;
}
int main( )
{
    //freopen("input.txt", "r", stdin);
    scanf("%d", &n)
    for(int i=0; i<n; i++)
    {
        scanf("%d%d", &in[i].a, &in[i].b);
        in[i].index = i;
    }
    //将所有的可能生成树中的边都加到数组arr中
    int cnt = 0;
    sort(in, in+n, cmp1);
    for(int i=0; i<n-1; i++)
        arr[cnt++] = (edge){in[i].index, in[i+1].index, in[i+1].a-in[i].a};
    sort(in, in+n, cmp2);
    for(int i=0; i<n-1; i++)
        arr[cnt++] = (edge){in[i].index, in[i+1].index, in[i+1].b-in[i].b};
    //克鲁斯卡尔算法
    ll ans = 0;
    init( );
    sort(arr, arr+cnt, cmp3);
    for(int i=0; i<cnt; i++)
    {
        int a = f(arr[i].start);
        int b = f(arr[i].finish);
        if(a == b)
            continue;
        ans += arr[i].w;
        isvisited[a] = b;
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:58:20: error: expected ';' before 'for'
   58 |     scanf("%d", &n)
      |                    ^
      |                    ;
   59 |     for(int i=0; i<n; i++)
      |     ~~~             
a.cc:59:18: error: 'i' was not declared in this scope
   59 |     for(int i=0; i<n; i++)
      |                  ^
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstring>
#include <set>
 
using namespace std;
 
const int maxn = 1e5 + 5;
 
struct Node {
    int x, y, id;
}node[maxn];
 
struct Edge {
    int u, v, val;
    bool operator <(const Edge& rhs) const {
        return val < rhs.val;
    }
}e[maxn << 1];
 
int par[maxn];
int n;
 
bool cmp1(const Node &a, const Node &b) {
    return a.x < b.x;
}
 
bool cmp2(const Node &a, const Node &b) {
    return a.y < b.y;
}
 
void init() {
    for (int i = 0; i <= n; i ++)
        par[i] = i;
}
 
int findpar(int x) {
    return par[x] = (par[x] == x ? x : findpar(par[x]));
}
 
void unite(int x, int y) {
    x = findpar(x), y = findpar(y);
    if (x == y) return;
    par[x] = y;
}
 
int main(int argc, char const *argv[]) {
    
    cin >> n;
 
    init();
 
    for (int i = 1; i <= n; i ++) {
        scanf("%d%d", &node[i].x, &node[i].y);
        node[i].id = i;
    }
 
    sort(node + 1, node + n + 1, cmp1);
 
    int cnt = 0;
    for (int i = 2; i <= n; i ++)
        e[cnt ++] = (Edge){node[i - 1].id, node[i].id, node[i].x - node[i - 1].x};
    
    sort(node + 1, node + n + 1, cmp2);
    for (int i = 2; i <= n; i ++)
        e[cnt ++] = (Edge){node[i - 1].id, node[i].id, node[i].y - node[i - 1].y};
 
    sort(e, e + cnt);
 
    long long ans = 0;
    for (int i = 0; i < cnt; i ++) {
        int u = e[i].u, v = e[i].v, val = e[i].val;
        if (findpar(u) == findpar(v)) continue;
        unite(u, v);
        ans += val;
    }
 
    cout << ans << endl;
 
    return 0;
 


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:84:14: error: expected '}' at end of input
   84 |     return 0;
      |              ^
a.cc:51:40: note: to match this '{'
   51 | int main(int argc, char const *argv[]) {
      |                                        ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <set>

using namespace std;

struct point
{
	int id;
	int x;
	int y;
};

struct edge
{
	int src;
	int dst;
	int cost;

	bool operator<(const edge &other) const
	{
		return other.cost < cost;
	}
};

int main()
{
	int N;
	cin >> N;
	vector<point> p(N);

	for (int i = 0; i < N; ++i) {
		p[i].id = i;
		cin >> p[i].x >> p[i].y;
	}

	vector<vector<edge>> g(N);

	sort(p.begin(), p.end(), [](auto &a, auto &b) {return a.x < b.x; });
	for (int i = 0; i + 1 < N; ++i) {
		edge e;
		e.src = p[i].id;
		e.dst = p[i + 1].id;
		e.cost = p[i + 1].x - p[i].x;
		g[e.src].push_back(e);
		swap(e.src, e.dst);
		g[e.src].push_back(e);
	}

	sort(p.begin(), p.end(), [](auto &a, auto &b) {return a.y < b.y; });
	for (int i = 0; i + 1 < N; ++i) {
		edge e;
		e.src = p[i].id;
		e.dst = p[i + 1].id;
		e.cost = p[i + 1].y - p[i].y;
		g[e.src].push_back(e);
		swap(e.src, e.dst);
		g[e.src].push_back(e);
	}

	set<int> visited;
	priority_queue<edge> q;
	auto visit = [&](int x) -> bool {
		if (!visited.insert(x).second) {
			return false;
		}
		for (auto &e : g[x]) {
			q.push(e);
		}
		return true;
	};
	visit(0);
	int ans = 0;
	while (!q.empty()) {
		auto e = q.top();
		q.pop();
		if (visit(e.dst)) {
			ans += e.cost;
		}
	}
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   40 |         sort(p.begin(), p.end(), [](auto &a, auto &b) {return a.x < b.x; });
      |         ^~~~
      |         short
Language: C++

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

const int M=100010;

struct Edge
{
	int u,v,c;
	bool operator < (const Edge &b) const {return c<b.c;}
}e[M<<1];

struct Point
{
	int x,y,id;
}a[M];

bool cmp1(Point a,Point b)
{
	return a.x<b.x;
}

bool cmp2(Point a,Point b)
{
	return a.y<b.y;
}

ll ans;
int n,tot;
int f[M];

inline int getf(int x) {return f[x]==x?x:f[x]=getf(f[x]);}

int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i].x>>a[i].y,a[i].id=i;
	sort(a,a+n,cmp1);
	for(int i=0;i+1<n;i++)
		e[tot++]=(Edge){a[i].id,a[i+1].id,abs(a[i].x-a[i+1].x)};
	sort(a,a+n,cmp2);
	for(int i=0;i+1<n;i++)
		e[tot++]=(Edge){a[i].id,a[i+1].id,abs(a[i].y-a[i+1].y)};
	for(int i=0;i<n;i++)
		f[i]=i;
	sort(e,e+tot);
	for(int i=0;i<tot;i++)
	{
		int u=e[i].u,v=e[i].v;
		if(getf(u)!=getf(v))
			ans+=e[i].c,f[getf(u)]=getf(v);
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc:27:1: error: 'll' does not name a type
   27 | ll ans;
      | ^~
a.cc: In function 'int main()':
a.cc:52:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   52 |                         ans+=e[i].c,f[getf(u)]=getf(v);
      |                         ^~~
      |                         abs
a.cc:54:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   54 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <numeric>
#include <cassert>
#include <functional>
using namespace std;

typedef unsigned long long int llui;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
constexpr double pi = 3.141592653589793238462643383279502884L;

// TODO: Mod class

const int sz = 1e5 + 5;
int group[sz];
typedef pair<int, pii> piii;

int Find(int n) {
  int g = group[n];
  if (g != n) {
    group[n] = Find(g);
  }
  return group[n];
}

void Union(int n, int m) {
  int g1 = Find(n);
  int g2 = Find(m);
  if (g1 != g2) {
    group[g1] = g2;
  }
}

piii make_piii(int a, int b, int c) {
  return make_pair(a, make_pair(b, c));
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pii> ori(n);
  for (int i = 0; i < n; ++i) {
    cin >> ori[i].first >> ori[i].second;
  }
  sort(ori.begin(), ori.end());
  ori.resize(unique(ori.begin(), ori.end()) - ori.begin());

  vector<pii> x;
  vector<pii> y;
  for (int i = 0; i < ori.size(); ++i) {
    int a, b;
    a = ori[i].first;
    b = ori[i].second;
    x.push_back(make_pair(a, i));
    y.push_back(make_pair(b, i));
  }

  sort(x.begin(), x.end());
  sort(y.begin(), y.end());

  vector<piii> xdiff;
  vector<piii> ydiff;

  for (int i = 0; i < xdiff.size(); ++i) {
    xdiff.push_back(make_piii(abs(x[i].first - x[i + 1].first), x[i].second, x[i + 1].second));
    ydiff.push_back(make_piii(abs(y[i].first - y[i + 1].first), y[i].second, y[i + 1].second));
  }

  sort(xdiff.begin(), xdiff.end());
  sort(ydiff.begin(), ydiff.end());

  for (int i = 0; i < n; ++i) {
    group[i] = i;
  }

  int fx = 0;
  int fy = 0;
  ll cost = 0;
  for (int i = 0; i < ori.size() - 1; ++i) {
    piii now;
    if (fx == xidff.size() && fy == ydiff.size()) {
      break;
    }
    if (fx == xdiff.size()) {
      now = ydiff[fy++];
    } else if (fy == ydiff.size()) {
      now = xdiff[fx++];
    } else {
      if (xdiff[fx].first < ydiff[fy].first) {
        now = xdiff[fx++];
      } else {
        now = ydiff[fy++];
      }
    }
    
    if (Find(now.second.first) == Find(now.second.second)) {
      --i;
      continue;
    }
    Union(now.second.first, now.second.second);
    cost += now.first;
  }

  cout << cost << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:15: error: 'xidff' was not declared in this scope; did you mean 'xdiff'?
  100 |     if (fx == xidff.size() && fy == ydiff.size()) {
      |               ^~~~~
      |               xdiff
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

#define ll long long
using namespace std;

ll N;
vector <ll> x;
vector <ll> y;

int main(){
  ll inp;
  ll result =0;

  ll a;
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> inp;
    x.push_back(inp);
    cin >> inp;
    y.push_back(inp);
  }

  sort(x.begin(),x.end());
  sort(y.begin(),y.end());

  for(int i = 0;i < N ; i++){
    if(i==1|| i ==N-1){
      if((x[i]-x[i-1])<(y[i]-y[i-1])) result += x[i]-x[i-1];
      else result += y[i]-y[i-1];}
    else{
      if((x[i]-x[i-1])<(y[i]-y[i-1])) result += x[i]-x[i-1];
      else result += y[i]-y[i-1];}
  }
    
  }

  cout << result << endl;
  return 0;
  
}


Compiler output:
a.cc:41:3: error: 'cout' does not name a type
   41 |   cout << result << endl;
      |   ^~~~
a.cc:42:3: error: expected unqualified-id before 'return'
   42 |   return 0;
      |   ^~~~~~
a.cc:44:1: error: expected declaration before '}' token
   44 | }
      | ^
Language: C++

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

int main() {
	int N;
	cin >> N;
	vector<int> xs(N, 0);
	vector<int> ys(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> xs[i] >> ys[i];
	}
	vector<int> connected;
	connected.push_back(0);
	vector<int> visited(N, 0);
	visited[0] = 1;
	int cost = 0;
	while (connected.size() != N) {
		int min_index = -1;
		int min_cost = INT_MAX;
		for (int i = 0; i < N; i++) {
			if (visited[i] == 1) {
				continue;
			}
			for (int j = 0; j < connected.size(); j++) {
				int temp = min(abs(xs[i] - xs[connected[j]]), abs(ys[i] - ys[connected[j]]));
				if (temp < min_cost) {
					min_index = i;
					min_cost = temp;
				}
			}
		}
		connected.push_back(min_index);
		cost += min_cost;
		visited[min_index] = 1;
	}
	cout << cost << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: 'INT_MAX' was not declared in this scope
   21 |                 int min_cost = INT_MAX;
      |                                ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;


static const long long INF = 200000;
#define N 100000

struct POINT {
    int x;
    int y;
};

int n;
POINT p[N];
long long cost[N + 1][N + 1];
int d[N + 1][N + 1];

int main() {
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> p[i].x >> p[i].y;
    }
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            cost[i][j] = INF;
        }
    }
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            if ( i == j ) continue;
            cost[i][j] = min(abs(p[i].x - p[j].x), abs(p[i].y - p[j].y));
        }
    }
    
    for ( int k = 0; k < n; k++ ) {
        for ( int i = 0; i < n; i++ ) {
            for ( int j = 0; j < n; j++ ) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    
    long long ans = 0;
    int minc = INF;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            int tmp = d[i][j];
            minc = min(tmp, minc);
        }
        ans += minc;
    }
    
    cout << ans << endl;
    
    return 0;
}

Compiler output:
/tmp/ccU1HuA2.o: in function `main':
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccU1HuA2.o
a.cc:(.text+0x255): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccU1HuA2.o
a.cc:(.text+0x281): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccU1HuA2.o
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccU1HuA2.o
a.cc:(.text+0x33b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccU1HuA2.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;


static const long long INF = 200000;
#define N 100000

struct POINT {
    int x;
    int y;
};

int n;
POINT p[N];
long long cost[N + 1][N + 1];
int d[N + 1][N + 1];

int main() {
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        cin >> p[i].x >> p[i].y;
    }
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            cost[i][j] = INF;
        }
    }
    
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            if ( i == j ) continue;
            cost[i][j] = min(abs(p[i].x - p[j].x), abs(p[i].y - p[j].y));
        }
    }
    
    for ( int k = 0; k < n; k++ ) {
        for ( int i = 0; i < n; i++ ) {
            for ( int j = 0; j < n; j++ ) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    
    long long ans = 0;
    int minc = INF;
    for ( int i = 0; i < n; i++ ) {
        for ( int j = 0; j < n; j++ ) {
            int tmp = d[i][j];
            minc = min(tmp, minc);
        }
        ans += minc;
    }
    
    cout << ans << endl;
    
    return 0;
}

Compiler output:
/tmp/ccvnl5A8.o: in function `main':
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvnl5A8.o
a.cc:(.text+0x255): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvnl5A8.o
a.cc:(.text+0x281): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvnl5A8.o
a.cc:(.text+0x2ba): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvnl5A8.o
a.cc:(.text+0x33b): relocation truncated to fit: R_X86_64_PC32 against symbol `d' defined in .bss section in /tmp/ccvnl5A8.o
collect2: error: ld returned 1 exit status
Language: C

#include <iostream>  

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define FORr(i, j, k) for(int i = j; i >= k; --i)
#define repr(i, j) FOR(i, j, 0)
#define INF (1 << 30)
#define ft first
#define sd second

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

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

P p[100000];
bool went[100000];

int main() {
	int N;
	scanf("%d", &N);
	int i, j;
	ll ans = 0;
	for(i = 0; i < N; ++i) scanf("%lld %lld", &p[i].ft, &p[i].sd);
	for(i = 0; i < N - 1; ++i) {
		int latte = INF;
		for(j = 0; j < N; ++j) {
			if(i == j || went[i]) continue;
			int tmp = min(abs(p[i].ft - p[j].ft), abs(p[i].sd - p[j].sd));
			if(tmp < latte) {
				latte = tmp;
			}
		}
		went[i] = true;
		ans += latte;
	}
	printf("%lld\n", ans);
	return 0;
}

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

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define min(a,b)(a>b ? b:a)
void Swap(int*a,int*b){
	long long int temp=*a;
	*a=*b;
	*b=temp;
}
int main(){
	int n=0;
	cin>>n;
	int data[100000][2];
	for(int i=0;i<n;i++){
		cin>>data[i][0]>>data[i][1];
	}
	for(int i=0;i<n;i++){
		int k=i;
		for(int j=i+1;j<n;j++){
			if(data[k][0]>data[j][0]){
				k=j;
			}
		}
		Swap(&data[k][0],&data[i][0]);
		Swap(&data[k][1],&data[i][1]);
	}
	for(int i=0;i<n;i++){
		int k=i;
		for(int j=i+1;j<n;j++){
			if(data[k][0]==data[j][0]){
				if(data[k][1]>data[j][1]){
					k=j;
				}
			}else if(data[k][0]<data[j][0]{
				continue;
			}else{
				break;
			}
		}
		Swap(&data[k][0],&data[i][0]);
		Swap(&data[k][1],&data[i][1]);
	}
	int prevX=data[0][0];
	int prevY=data[0][1];
	int value=0;
	for(int i=0;i<n;i++){
		value=min(abs(prevX-data[i][0]),abs(prevY-data[i][1]));
	}
	cout<<value<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:55: error: expected ')' before '{' token
   35 |                         }else if(data[k][0]<data[j][0]{
      |                                 ~                     ^
      |                                                       )
a.cc:40:17: error: expected primary-expression before '}' token
   40 |                 }
      |                 ^
Language: C

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int64 long long int
#define uint64 unsigned long long int
using namespace std;


const int N = 100005;
int n, DS[N], SZ[N];
int64 ans, cnt;
vector <pair<int,int>> vx, vy;
vector <struct Edge> D;

struct Edge {
	int64 c;
	int x;
	int y;
};

int root (int i)
{
	while (DS[DS[i]] != i)
		i = DS[DS[i]];
	return i;
}

int merge (int x, int y)
{
	int r = root (x);
	int rr = root (y);
	if (r == rr) return 0;
	if (SZ[r] < SZ[rr]) {
		DS[rr] = r;
		SZ[r] += SZ[rr];
	} else {
		DS[r] = rr;
		SZ[rr] += SZ[r];
	}
	return 1;
}
bool cmp (struct Edge A, struct Edge B)
{
	return A.c < B.c;
}
int main ()
{
	scanf ("%d", &n);
	for (int i = 0; i <= n; i++) DS[i] = i, SZ[i] = 0;
	for (int i = 0; i < n; i++) {
		int x, y;
		scanf ("%d %d", &x, &y);
		vx.pb ({x, i + 1});
		vy.pb ({y, i + 1});
	}
	sort (vx.begin (), vx.end ());
	sort (vy.begin (), vy.end ());
	for (int i = 0; i < vx.size () - 1; i++) {
		struct Edge E;
		E.c = vx[i + 1].first - vx[i].first;
		E.x = vx[i].second;
		E.y = vx[i + 1].second;
		D.pb (E);
	}
	for (int i = 0; i < vy.size () - 1; i++) {
		struct Edge E;
		E.c = vy[i + 1].first - vy[i].first;
		E.x = vy[i].second;
		E.y = vy[i + 1].second;
		D.pb (E);
	}
	sort (D.begin (), D.end (), cmp);
	for (auto p : D) {
		int64 c = p.c;
		int x = p.x, y = p.y;
		if (merge (x, y)) {
			cnt++;
			ans += c;
		}
		if (cnt == n - 1) break;
	}
	printf ("%lld\n", ans);
	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<cmath>
#include<queue>
#include<cstdio>
using namespace std;
priority_queue<pair<int,pair<int,int> > > q;
pair<int,int> pos[111111];
int pa[111111],n,ans,cnt;
int root(int x)
{
	if (pa[x]!=x) pa[x]=root(pa[x]);
	return pa[x];
}
bool Union(int x,int y)
{
	int rx=root(x);
	int ry=root(y);
	if (rx==ry) return 0;
	pa[rx]=ry;
	return 1;
}
int dis(int i,int j)
{
	return min(abs(pos[i].first-pos[j].first),abs(pos[i].second-pos[j].second));
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&pos[i].first,&pos[i].second);
	}
	for (int i=1;i<=n;i++)
	{
		for (int j=i+1;j<=n;j++)
		{
			q.push(make_pair(-dis(i,j),make_pair(i,j))); 
		}
	}
	for (int i=1;i<=n;i++) pa[i]=i;
	while(cnt<n-1)
	{
		int x=q.top().second.first,y=q.top().second.second,z=-q.top().first;
		q.pop();
		if (Union(x,y))
		{
			ans+=z;
			cnt++;
		}
	}
	cout<<ans<<endl;
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:52:18: error: expected '}' at end of input
   52 |         return 0;
      |                  ^
a.cc:27:1: note: to match this '{'
   27 | {
      | ^
Language: Java


import java.math.BigInteger;
import java.util.*;
public class B {



public static void main(String[] args)
{
  Scanner sc=new Scanner(System.in);
  fact=new long[100001];
  fact[0]=1;
  for(int i=1;i<100001;i++) {
    fact[i]=(fact[i-1]%mod*i%mod+mod)%mod;
  }
 int n=sc.nextInt();
 int m=sc.nextInt();
 if((n==1&&m>1)||(m==1&&n>1)) {
   System.out.println(0);
 }else {
 if(n%2==0&&m%2==0)
 System.out.println(fact[n]*fact[m]*2%mod);
 else
   System.out.println(fact[n]*fact[m]%mod);
 }
}


   
static long modInverse(long fac, int p) 
{ 
    return pow(fac, p - 2); 
} 


static long nCr(int n, int r, 
                         int p) 
{ 

  
    if (r == 0) 
        return 1; 


    long [] fac = new long [n + 1]; 
    fac[0] = 1; 

    for (int i = 1; i <= n; i++) 
        fac[i] = fac[i - 1] * i % p; 

    return (fac[n] * modInverse(fac[r], p) 
            % p * modInverse(fac[n - r], p) 
            % p) 
        % p; 
} 


public static long[] fact;
public static long[] invfact;
public static long ncr(int n, int r){
  if(r > n) return 0;
  return ((((fact[n]) * (invfact[r])) % mod)* invfact[n-r]) % mod;
}
static int mod=(int)1e9+7;
static long pow(long x,long y) {
 long res=1l;
 while(y!=0) {
   if(y%2==1) {
     res=x*res%mod;
   }
   y/=2;
   x=x*x%mod;
 }
 return res;
}


}
 








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

#include<cstdio.h>
#include<cmaths>
using namespace std;
const int M=1000000007;
int n,m;
long long ans=1;
int main(){
	scanf("%d%d",&n,&m);
	if(abs(n-m)>1){
		printf("-1\n");
		return 0;
	}
	for(int i=1;i<=n;++i)ans=ans*i%M;
	for(int i=1;i<=m;++i)ans=ans*i%M;
	if(n!=m)printf("%lld\n",ans);
	else printf("%lld\n",2*ans%M);
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const mod=1000000007;
int main() {
ll n,m;
cin>>n>>m;
ll aa=1;
if(abs(n-m)>=2){
cout<<0<<endl;}
else{
for(ll i=1; i<=n; i++){
aa=(aa*i)%mod;}
for(ll i=1; i<=m; i++){
aa=(aa*i)%mod;}
cout<<aa<<endl;}}


Compiler output:
a.cc:5:7: error: 'mod' does not name a type
    5 | const mod=1000000007;
      |       ^~~
a.cc: In function 'int main()':
a.cc:14:11: error: 'mod' was not declared in this scope; did you mean 'modf'?
   14 | aa=(aa*i)%mod;}
      |           ^~~
      |           modf
a.cc:16:11: error: 'mod' was not declared in this scope; did you mean 'modf'?
   16 | aa=(aa*i)%mod;}
      |           ^~~
      |           modf
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long M=sc.nextLong();
    long sum_N = 1;
    long sum_M = 1;
    long ans = 0;
    long n_m = Math.abs(N-M);
    long l = (Long)Math.pow(10, 9) + 7;
    
    if(n_m < 2){
      for(long i = N;i <= 0;i--){
        sum_N *= i;
      }
      for(long j = M;j <= 0;j--){
        sum_M *= j;
      }
      if(n_m == 0){
        ans =sum_N * sum_M * 2;
      }else{
        ans =sum_N * sum_M;
      }
    }
    System.out.println(ans % l);
  }
}
      

Compiler output:
Main.java:12: error: incompatible types: double cannot be converted to Long
    long l = (Long)Math.pow(10, 9) + 7;
                           ^
1 error
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long M=sc.nextLong();
    long sum_N = 1;
    long sum_M = 1;
    long ans = 0;
    long n_m = Math.abs(N-M);
    long l = Math.pow(10, 9) + 7;
    
    if(n_m < 2){
      for(long i = N;i <= 0;i--){
        sum_N *= i;
      }
      for(long j = M;j <= 0;j--){
        sum_M *= j;
      }
      if(n_m == 0){
        ans =sum_N * sum_M * 2;
      }else{
        ans =sum_N * sum_M;
      }
    }
    System.out.println(ans % l);
  }
}
      

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from double to long
    long l = Math.pow(10, 9) + 7;
                             ^
1 error
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long M=sc.nextLong();
    long sum_N = 1;
    long sum_M = 1;
    long ans = 0;
    int n_m = Math.abs(N-M);
    
    if(n_m < 2){
      for(long i = N;i <= 0;i--){
        sum_N *= i;
      }
      for(long j = M;j <= 0;j--){
        sum_M *= j;
      }
      if(n_m == 0){
        ans =sum_N * sum_M * 2;
      }else{
        ans =sum_N * sum_M;
      }
    }
    System.out.println(ans);
  }
}
      

Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
    int n_m = Math.abs(N-M);
                      ^
1 error
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long M=sc.nextLong();
    long sum_N = 1;
    long sum_M = 1;
    long ans = 0;
    int n_m = Math.abs(N-M);
    
    if(n_m < 2){
      for(long i = N;i <= 0;i--){
        sum_N *= i;
      }
      for(long j = M;j <= 0;j--){
        sum_M *= j;
      }
      if(n_m = 0){
        ans =sum_N * sum_M * 2;
      }else{
        ans =sum_N * sum_M;
      }
    }
    System.out.println(ans);
  }
}
      

Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
    int n_m = Math.abs(N-M);
                      ^
Main.java:20: error: incompatible types: int cannot be converted to boolean
      if(n_m = 0){
             ^
2 errors
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long M=sc.nextLong();
    long sum_N = 0;
    long sum_M = 0;
    
    if(Math.abs(N-M) < 2){
      for(long i = N;i = 0;i--){
        sum_N *= i;
      }
      for(long j = M;j = 0;j--){
        sum_M *= j;
      }
    }
    System.out.println(sum_N * sum_M);
  }
}
      

Compiler output:
Main.java:12: error: incompatible types: long cannot be converted to boolean
      for(long i = N;i = 0;i--){
                       ^
Main.java:15: error: incompatible types: long cannot be converted to boolean
      for(long j = M;j = 0;j--){
                       ^
2 errors