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

#include<cstdio>
#include<map>

using namespace std;
typedef pair<int,int> pp;

class UF {
    public:
    int par[300000]={};
    UF(int n) {
        for(int i=0; i<n; i++)
            par[i] = i;
    }
    int find(int x) {
        if(par[x] == x) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        par[x] = y;
    }
};

int main(void) {
    int n,k,l;
    scanf("%d%d%d",&n,&k,&l);
    UF road(250000), rail(250000);
    for(int i=0; i<k; i++) {
        int x,y;
        scanf("%d%d",&x,&y);
        x--, y--;
        road.unite(x,y);
    }
    for(int i=0; i<l; i++) {
        int x,y;
        scanf("%d%d",&x,&y);
        x--, y--;
        rail.unite(x,y);
    }

    map res<pp>;
    for(int i=0; i<n; i++)
        res[pp(road.find(i),rail.find(i)]++;

    for(int i=0; i<n; i++) {
        printf("%d%c", res[pp(road.find(i),rail.find(i))], i==n-1 ? '\n' : ' ');
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: expected initializer before '<' token
   41 |     map res<pp>;
      |            ^
a.cc:43:9: error: 'res' was not declared in this scope
   43 |         res[pp(road.find(i),rail.find(i)]++;
      |         ^~~
a.cc:43:15: error: expected primary-expression before '(' token
   43 |         res[pp(road.find(i),rail.find(i)]++;
      |               ^
a.cc:43:41: error: expected ')' before ']' token
   43 |         res[pp(road.find(i),rail.find(i)]++;
      |               ~                         ^
      |                                         )
a.cc:46:24: error: 'res' was not declared in this scope
   46 |         printf("%d%c", res[pp(road.find(i),rail.find(i))], i==n-1 ? '\n' : ' ');
      |                        ^~~
Language: C++

#include <stdio.h>
#include <vector>

class Union_Find
{
	std::vector<int>per;
	std::vector<int>rank;
public:
	void init(int size)
	{
		for (int i = 0; i < size; ++i)
		{
			per.push_back(i);
			rank.push_back(0);
		}
	}
	int get_per(int x)
	{
		if (x == per[x]) { return x; }
		return per[x] = get_per(per[x]);
	}
	bool is_same_per(int x, int y)
	{
		return (get_per(x) == get_per(y) ? true : false);
	}
	void togett(int x, int y)
	{
		int x_per = get_per(x), int y_per = get_per(y);
		if (x_per == y_per) { return; }
		if (rank[x_per] < rank[y_per]) 
		{
			per[x_per] = y_per;
		}
		else
		{
			per[y_per] = x_per;
			if (rank[x_per] == rank[y_per]) { ++rank[x_per]; }
		}
	}
};

int N, K, L, p[112345], q[112345], r[112345], s[112345];
Union_Find railway, road;

int main()
{
	scanf("%d%d%d", &N, &K, &L);
	for (int i = 0; i < K; ++i) { scanf("%d%d", &p[i], &q[i]); }
	for (int i = 0; i < L; ++i) { scanf("%d%d", &r[i], &s[i]); }


	return 0;
}

Compiler output:
a.cc: In member function 'void Union_Find::togett(int, int)':
a.cc:28:41: error: expected unqualified-id before 'int'
   28 |                 int x_per = get_per(x), int y_per = get_per(y);
      |                                         ^~~
a.cc:29:30: error: 'y_per' was not declared in this scope; did you mean 'x_per'?
   29 |                 if (x_per == y_per) { return; }
      |                              ^~~~~
      |                              x_per
a.cc:30:40: error: 'y_per' was not declared in this scope; did you mean 'x_per'?
   30 |                 if (rank[x_per] < rank[y_per])
      |                                        ^~~~~
      |                                        x_per
Language: C++

struct UF {
    vector<int> data;
    UF(int n) {
        data.resize(n, -1);
    }
    int root(int i) {
        return data[i] < 0 ? i : data[i] = root(data[i]);
    }
    int size(int i) {
        i = root(i);
        return -data[i];
    }
    void unite(int x, int y) {
        x = root(x), y = root(y);
        if (x == y) return;
        if (size(x) < size(y)) swap(x, y);
        data[x] += data[y];
        data[y] = x;
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
};


Compiler output:
a.cc:2:5: error: 'vector' does not name a type
    2 |     vector<int> data;
      |     ^~~~~~
a.cc: In constructor 'UF::UF(int)':
a.cc:4:9: error: 'data' was not declared in this scope
    4 |         data.resize(n, -1);
      |         ^~~~
a.cc: In member function 'int UF::root(int)':
a.cc:7:16: error: 'data' was not declared in this scope
    7 |         return data[i] < 0 ? i : data[i] = root(data[i]);
      |                ^~~~
a.cc: In member function 'int UF::size(int)':
a.cc:11:17: error: 'data' was not declared in this scope
   11 |         return -data[i];
      |                 ^~~~
a.cc: In member function 'void UF::unite(int, int)':
a.cc:16:32: error: 'swap' was not declared in this scope
   16 |         if (size(x) < size(y)) swap(x, y);
      |                                ^~~~
a.cc:17:9: error: 'data' was not declared in this scope
   17 |         data[x] += data[y];
      |         ^~~~
Language: C++

//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;
 
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
 
using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
 
typedef pair<LL, LL> PP;
 
 
class UnionFindTree {
	int whole_size_m;
	int* parent_p_m;	// 根である場合は自分自身の添え字を入れる
	int* rank_p_m;
	int* size_p_m;		// 集合のサイズ(根に大きさを書く)
 
	bool Is_valid_index(int index);
	int Root_of_rec(int index);
public:
	UnionFindTree(int whole_size);
	~UnionFindTree();
 
	int Root_of(int index);
	void Unite(int index_l, int index_r);
	bool Are_together(int index_l, int index_r);
	int Size_of_set(int index);
};
 
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 rank_p_m[index_l] == rank_p_m[index_r];
}
 
int UnionFindTree::Size_of_set(int index) {
	return size_p_m[index];
}
 
int N, K, L;
multimap<PP, int> M;
 
int main() {
	cin >> N >> K >> L;
	UnionFindTree Ur(N);
	UnionFindTree Ut(N);
	REP(i, 0, K) {
		int buf1, buf2;
		cin >> buf1 >> buf2;
		Ur.Unite(buf1 - 1, buf2 - 1);
	}
	REP(i, 0, L) {
		int buf1, buf2;
		cin >> buf1 >> buf2;
		Ut.Unite(buf1 - 1, buf2 - 1);
	}
	REP(i, 0, N) {
		M.insert(make_pair(PP(Ur.Root_of(i), Ut.Root_of(i)), i));
	}
	volatile int a = M.count(PP(Ur.Root_of(i), Ut.Root_of(i)));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:127:48: error: 'i' was not declared in this scope
  127 |         volatile int a = M.count(PP(Ur.Root_of(i), Ut.Root_of(i)));
      |                                                ^
Language: C++

//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

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

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

typedef pair<LL, LL> PP;


class UnionFindTree {
	int whole_size_m;
	int* parent_p_m;	// 根である場合は自分自身の添え字を入れる
	int* rank_p_m;
	int* size_p_m;		// 集合のサイズ(根に大きさを書く)

	bool Is_valid_index(int index);
	int Root_of_rec(int index);
public:
	UnionFindTree(int whole_size);
	~UnionFindTree();

	int Root_of(int index);
	void Unite(int index_l, int index_r);
	bool Are_together(int index_l, int index_r);
	int Size_of_set(int index);
};

#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 rank_p_m[index_l] == rank_p_m[index_r];
}

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

int N, K, L;
multimap<PP, int> M;

int main() {
	cin >> N >> K >> L;
	UnionFindTree Ur(N);
	UnionFindTree Ut(N);
	REP(i, 0, K) {
		int buf1, buf2;
		cin >> buf1 >> buf2;
		Ur.Unite(buf1 - 1, buf2 - 1);
	}
	REP(i, 0, L) {
		int buf1, buf2;
		cin >> buf1 >> buf2;
		Ut.Unite(buf1 - 1, buf2 - 1);
	}
	REP(i, 0, N) {
		M.insert(make_pair(PP(Ur.Root_of(i), Ut.Root_of(i)), i));
	}
	REP(i, 0, N) {
		cout << M.count(PP(Ur.Root_of(i), Ut.Root_of(i))) << (i == N - 1 ? ' ' : '\n');
	}
	return 0;
}

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

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

// why am I so weak

int n, k, l;
int par[2][200055];

typedef pair<int, int> P;

map<p, int> c;

int fin(int i, int j) {
	if (par[i][j] == j) return j;
	return par[i][j] = fin(i, par[i][j]);
}
int main() {
	scanf("%d %d %d", &n, &k, &l);

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

	while (k--) {
		int x, y;
		scanf("%d %d", &x, &y);
		x--, y--;

		par[0][fin(0, x)] = fin(0, y);
	}

	while (l--) {
		int x, y;

		scanf("%d %d", &x, &y);
		x--, y--;

		par[1][fin(1, x)] = fin(1, y);
	}

	for (int i = 0; i < n; i++) c[P(fin(0, i), fin(1, i))]++;

	for (int i = 0; i < n; i++) {
		if (i) printf(" ");
		printf("%d", c[P(fin(0, i), fin(1, i))]);
	}

	puts("");

	return 0;
}


Compiler output:
a.cc:11:5: error: 'p' was not declared in this scope
   11 | map<p, int> c;
      |     ^
a.cc:11:11: error: template argument 1 is invalid
   11 | map<p, int> c;
      |           ^
a.cc:11:11: error: template argument 3 is invalid
a.cc:11:11: error: template argument 4 is invalid
a.cc: In function 'int main()':
a.cc:41:38: error: no match for 'operator[]' (operand types are 'int' and 'P' {aka 'std::pair<int, int>'})
   41 |         for (int i = 0; i < n; i++) c[P(fin(0, i), fin(1, i))]++;
      |                                      ^
a.cc:45:31: error: no match for 'operator[]' (operand types are 'int' and 'P' {aka 'std::pair<int, int>'})
   45 |                 printf("%d", c[P(fin(0, i), fin(1, i))]);
      |                               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct Union{
  vector<int> r,p;
  Union(int size){init(size);}
  void init(int size){
    r.resize(size);
    p.resize(size);
    for(int i=0;i<size;i++) r[i]=1,p[i]=i;
  }
  int find(int x){
    if(x!=p[x]) p[x]=find(p[x]);
    return p[x];
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};
typedef pair<int,int> P;
int main(){
  int n,k,l,i,j,p,q;
  cin>>n>>k>>l;
  Union u1(n+1),u2(n+1);
  vector<P> v;
  for(i=0;i<k;i++){
    cin>>p>>q;
    v.push_back(P(p,q));
    u1.unite(p,q);
  }
  for(i=0;i<l;i++){
    cin>>p>>q;
    v.push_back(P(p,q));
    u2.unite(p,q);
  }
  map<P> mp;
  for(i=1;i<=n;i++){
    mp[P(u1.find(i),u2.find(i))]++;
  }
  for(i=1;i<=n;i++) cout << mp[P(u1.find(i),u2.find(i))] << " \n"[i==n];
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: wrong number of template arguments (1, should be at least 2)
   42 |   map<P> mp;
      |        ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:44:7: error: no match for 'operator[]' (operand types are 'int' and 'P' {aka 'std::pair<int, int>'})
   44 |     mp[P(u1.find(i),u2.find(i))]++;
      |       ^
a.cc:46:31: error: no match for 'operator[]' (operand types are 'int' and 'P' {aka 'std::pair<int, int>'})
   46 |   for(i=1;i<=n;i++) cout << mp[P(u1.find(i),u2.find(i))] << " \n"[i==n];
      |                               ^
Language: C++

// D_Connectivity.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<unordered_map>
#include<unordered_set>
#include<iostream>
using namespace std;

void BuildCon(unordered_map<int, unordered_set<int>>& paths, int n)
{
	for (int k = 1; k <= n; k++)
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= n && j != i; j++)
			{
				if (paths[i].find(k) != paths[i].end() && paths[k].find(j) != paths[k].end())
				{
					paths[i].insert(j);
					paths[j].insert(i);
				}
			}
}

int main()
{
	int N, K, L;
	cin >> N >> K >> L;
	unordered_map<int, unordered_set<int>>	roads;
	unordered_map<int, unordered_set<int>>	railways;
	for (int i = 0; i < K; i++)
	{
		int a, b;
		cin >> a >> b;
		roads[a].insert(b);
		roads[b].insert(a);
	}
	BuildCon(roads, N);
	for (int i = 0; i < L; i++)
	{
		int a, b;
		cin >> a >> b;
		railways[a].insert(b);
		railways[b].insert(a);
	}
	BuildCon(railways, N);
	for (int i = 1; i <= N; i++)
	{
		int count = 1;
		for (auto t : roads[i])
		{
			if (railways[i].find(t) != railways[i].end())
				count++;
		}
		cout << count;
		if (i != N)
			cout << " ";
		else
			cout << endl;
	}
    return 0;
}


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

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

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, a, b) for(int i = a; i < (int)(b); ++i)

int ans[200000] = {0};
int k[200000];
int l[200000];
int num[200000] = {0};
pair<int, int> pq[100000];
pair<int, int> rs[100000];
pair<int, int> ki[200000];

int main(void)
{
	int N, K, L;
	cin >> N >> K >> L;
	
	Rep(i, N) k[i] = i;
	Rep(i, K){
		int p, q;
		cin >> p >> q;
		p--; q--;
		pq[i] = pair<int, int>(p, q);
	}
	sort(pq, pq + K);
	Rep(i, K){
		int p, q;
		p = pq[i].first;
		q = pq[i].second;
		if(k[p] < k[q]){
			k[q] = k[p];
		}else{
			k[p] = k[q];
		}
	}
#if 0
	Rep(i, N){
		PrintLn(k[i]);
	}
#endif

	Rep(i, N) l[i] = i;
	Rep(i, L){
		int r, s;
		cin >> r >> s;
		r--; s--;
		rs[i] = pair<int, int>(r, s);
	}
	sort(rs, rs + L);
	Rep(i, L){
		int r, s;
		r = rs[i].first;
		s = rs[i].second;
		if(l[r] < l[s]){
			l[s] = l[r];
		}else{
			l[r] = l[s];
		}
	}
#if 0
	Rep(i, N){
		PrintLn(l[i]);
	}
#endif

	Rep(i, N){
		ki[i] = pair<int, int>(k[i], i);
	}
	sort(ki, ki + N);

	int start = 0;
	Rep(i, N){
		if(i != 0 && ki[i - 1].first != ki[i].first){
			For(j, start, i){
				ans[j] = num[l[ki[j].second]];
			}
			start = i;
			memset(num, 0, N * sizeof(int));
		}
		num[l[ki[i].second]]++;
	}
	For(j, start, N){
		ans[j] = num[l[ki[j].second]];
	}

	Rep(i, N){
		cout << ans[i];
		if(i == N - 1){
			cout << endl;
		}else{
			cout << " ";
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:83:25: error: 'memset' was not declared in this scope
   83 |                         memset(num, 0, N * sizeof(int));
      |                         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>

using namespace std;

const int _K=20000+5;
class UnionFind{
	
	int par[_K];
	int siz[_K];
	
public:
	void init(int n){
		for(int i=0; i<n; i++) par[i]=i;
		for(int i=0; i<n; i++) siz[i]=1;
	}
	int find(int x){
		if(par[x]==x){
			return x;
		}else{
			return par[x]=find(par[x]);
		}
	}
	bool same(int x, int y){
		return find(x)==find(y);
	}
	void uni(int x, int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(siz[x]<siz[y]) swap(x, y);
		par[y]=x;
		siz[x]+=siz[y];
	}
	int size(int x){
		return siz[find(x)];
	}
};

int main(){
	
	int N, K, L;
	cin>> N>> K>> L;
	int p[K], q[K];
	for(int i=0; i<K; i++){
		cin>> p[i]>> q[i];
	}
	int r[L], s[L];
	for(int i=0; i<L; i++){
		cin>> r[i]>> s[i];
	}
	
	UnionFind ufoo;
	ufoo.init(N);
	for(int i=0; i<K; i++) ufoo.uni(p[i]-1, q[i]-1);
	Union Find ubar;
	ubar.init(N);
	for(int i=0; i<L; i++){
		if(ufoo.same(r[i]-1, s[i]-1)){
			ubar.uni(r[i]-1, s[i]-1);
		}
	}
	
	for(int i=0; i<N; i++){
		cout<< ubar.size(i)<< endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:9: error: 'Union' was not declared in this scope; did you mean 'union'?
   55 |         Union Find ubar;
      |         ^~~~~
      |         union
a.cc:56:9: error: 'ubar' was not declared in this scope
   56 |         ubar.init(N);
      |         ^~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define ALL(c) c.begin(), c.end()
#define SCANF(x) scanf("%lld", &x)
#define MOD 1000000007
#define MAX_N 1000000
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

/*
逆順ソート sort(ALL(vec), greater<ll>());
ペア定義 P pair = make_pair(100, 200);
集合find set.find(item);
小さい順に取り出したい優先度付きキュー
priority_queue<int, vector<int>, greater<int> > que;
配列の最大要素 *std::max_element(ALL(vec))
*/
int par[2][MAX_N];  //親
int ran[2][MAX_N]; //深さ

//初期化
void init(int n){
    FOR1(n){
        par[0][i] = i;
        par[1][i] = i;
        ran[0][i] = 0;
        ran[1][i] = 0;
    }
}

//根を求める
int find(int x, int t){
    if(par[t][x] == x){
        return x;
    }else{
        return par[t][x] = find(par[t][x], t);
    }
}

//xとyの属する集合の併合
void unite(int x, int y, int t){
    x = find(x, t);
    y = find(y, t);
    if(x == y) return;
    
    if(ran[t][x] < ran[t][y]){
        par[t][x] = y;
    }else{
        par[t][y] = x;
        if(ran[t][x] == ran[t][y]) ran[t][x]++;
    }
}

//同じ集合に属するか否か
bool same(int x, int y, int t){
    return find(x, t) == find(y, t);
}


signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k, l;
	scanf("%d %d %d", &n, &k, &l);
	init(n);
	
	FOR1(k+l){
		int p, q;
		scanf("%d %d", &p, &q);
		if(i < k){
			unite(p-1, q-1, 0);
		}else if(same(p-1, q-1, 0)){
			unite(p-1, q-1, 1);
		}
	}
	
	map<int, int> mp;
	FOR1(n){
		mp[par[1][i]]++;
	}
	
	
	FOR1(n-1){
		printf("%d ", mp[par[1][i]]);
	}
	printf("%d", mp[par[1][n-1]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:36: error: expected ']' before ')' token
  104 |         printf("%d", mp[par[1][n-1]);
      |                                    ^
      |                                    ]
Language: C++

#include<bits/stdc++.h>

using namespace std;


template<typename T>
class UF
{
public:
	UF() {
		size = 0;
	}

	//値を挿入する
	void push( T a ) {
		M[a] = size;
		V.push_back( size );
		rank.push_back( 0 );
		C.push_back( 1 );
		size++;
	}

	//同じグループにする
	void unite( T a, T b ) {
		long long int x = find( M[a] );
		long long int y = find( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] ) {
			V[x] = y;
			C[y] += C[x];
		} else {
			V[y] = x;
			C[x] += C[y];
			if( rank[x] == rank[y] )rank[x]++;
		}
	}

	void merge( T a, T b ) {
		unite( a, b );
	}

	//同じグループにいるかどうか判定する
	bool same( T a, T b ) {
		return find( M[a] ) == find( M[b] );
	}

	//今何グループあるか数を返す
	long long int group() {
		set<long long int >S;
		for( long long int i = 0; i < V.size(); i++ ) {
			S.insert( find( V[i] ) );
		}
		return S.size();
	}

	//グループに属している数を返す
	long long int count( T a ) {
		return C[find( M[a] )];
	}

private:
	vector<long long int>
		C, V, rank;
	map < T, long long int>M;
	long long int size;

	//祖先までたどる
	long long int find( long long int x ) {
		if( V[x] == x )return x;
		else return V[x] = find( V[x] );
	}
};


int main() {
	UF<long long int>uf1, uf2;
	long long int N, K, L;
	cin >> N >> K >> L;
	for( long long int i = 0; i < N; i++ ) {
		uf1.push( i );
		uf2.push( i )
	}
	for( long long int i = 0; i < K; i++ ) {
		long long int p, q;
		cin >> p >> q;
		p--; q--;
		uf1.merge( p, q );
	}
	for( long long int i = 0; i < L; i++ ) {
		long long int r, s;
		cin >> r >> s;
		r--; s--;
		if( uf1.same( r, s ) ) {
			uf2.merge( r, s );
		}
	}
	for( long long int i = 0; i < N; i++ ) {
		cout << uf2.count( i );
		if( i == N - 1 ) {
			cout << endl;
		} else {
			cout << " ";
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:30: error: expected ';' before '}' token
   81 |                 uf2.push( i )
      |                              ^
      |                              ;
   82 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
#define maxn 100005
#define pii pair<int,int>
#define ll long long
using namespace std;
struct point {
	int x,y;
}arr[maxn];
struct node {
	int pos,num;
	bool operator < (const node& a) const{
		return pos != a.pos ? pos < a.pos : num < a.num;
	}
};
bool vis[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,a,b;
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++)
		cin >> arr[i].x >> arr[i].y;
		
	map<int,set<pii> > idxs[2];
	for(int i=1;i<=n;i++) {
		int x = arr[i].x , y = arr[i].y;
		idxs[0][x-y].insert(pii{arr[i].x,i});
		idxs[1][x+y].insert(pii{arr[i].x,i});
	}
	map<int,set<node> > ptrs[2];
	for(int i=0;i<2;i++)
		for(auto now : idxs[i]) {
			int cnt = 0;
			for(pii idx : now.second)
				ptrs[i][now.first].insert(node{idx.first,cnt++});
		}
		
	int len = abs(arr[a].x - arr[b].x) + abs(arr[a].y - arr[b].y);
	queue<int> wait;
	for(int st : {a,b}) {
		wait.push(st);
		int x = arr[st].x , y = arr[st].y;
		idxs[0][x-y].erase(pii{x,st});
		idxs[1][x+y].erase(pii{x,st});
	}
	ll ans = 0;
	while(!wait.empty()) {
		int u = wait.front();
		wait.pop();
		if(vis[u])	continue;
		vis[u] = true;
		
		int x = arr[u].x , y = arr[u].y;
		for(int delta_y_coe : {-1,1}) {
			int ny = y + delta_y_coe * len;
			for(int t : {-1,1}) {
				int type = x + t * ny;
				int l,r;
				if(delta_y_coe == -1) {
					if(t == -1)
						l = x + 1 , r = x + len;
					else
						l = x - len + 1 , r = x;
				}
				else {
					if(t == -1)
						l = x - len , y = x - 1;
					else
						l = x , r = x + len - 1;
				}
				
				// calculate
				auto L = ptrs[min(t+1,1)][type].lower_bound(node{l,-1e9});
				auto R = ptrs[min(t+1,1)][type].upper_bound(node{r,1e9});
				if(R != ptrs[min(t+1,1)][type].begin() && L != ptrs[min(t+1,1)][type].end()) {
					R--;
					int num = max(0,R->num - L->num + 1);
					ans += num;
				}
				// update
				auto it = idxs[min(t+1,1)][type].lower_bound(pii{l,-1e9});
				while(it != idxs[min(t+1,1)][type].end() && it->first <= r) {
					int v = it->second;
					wait.push(v);
					idxs[min(t+1,1)][type].erase(*it);
					it = idxs[min(t+1,1)][type].lower_bound(pii{l,-1e9});
				}
			}
		}
	}
	
	cout << ans/2 << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:84: error: narrowing conversion of '-1.0e+9' from 'double' to 'int' [-Wnarrowing]
   73 |                                 auto L = ptrs[min(t+1,1)][type].lower_bound(node{l,-1e9});
      |                                                                                    ^~~~
a.cc:74:84: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   74 |                                 auto R = ptrs[min(t+1,1)][type].upper_bound(node{r,1e9});
      |                                                                                    ^~~
Language: C++

/*
%Dalao
--InterestingLSY
*/
/*
代码长度  - -
*/ 
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#define pb push_back
#define mp make_pair
#define INF 9999999
#define LINF 9999999999999999
#define uint unsigned int
#define msn(a,v) memset(a,v,sizeof(a))
#define ms(a) msn(a,0)
#define NONE -1
#define ll long long
#define ull unsignedll
#define lb lower_bound
using namespace std;
#define MAXN 100010

int n,D,a,b;

/*****************************************/
class Dot{
public:
int x;int y;int id;
void read(int i){
scanf("%d%d",&x,&y);
id=i;
}
void rotate(){
int xx=x+y,yy=x-y;
x=xx;y=yy;
}
void chg(){
swap(x,y);
}
};Dot dot[MAXN];
Dot getdot(int x,int y,int id){
Dot d1;
d1.x=x;d1.y=y;d1.id=id;
return d1;
}
bool operator<(Dot d1,Dot d2){
if(d1.x!=d2.x)return d1.x<d2.x;
if(d1.y!=d2.y)return d1.y<d2.y;
return d1.id<d2.id;
}
int dsu[MAXN];
void init(){
for(int i=1;i<=n;i++)
dsu[i]=i;
}
int getfa(int pos){
if(dsu[pos]==pos)return pos;
dsu[pos]=getfa(dsu[pos]);
return dsu[pos];
}
void unite(int a,int b){
a=getfa(a);b=getfa(b);
dsu[a]=b;
}
int same(int a,int b){
return getfa(a)==getfa(b);
}
int s(int v){
if(v)return INF;
return v;
}
int du[MAXN];
void getdu(){
ms(du);
for(int j=0;j<2;j++){
sort(dot,dot+n);
for(int i=0;i<n;i++)
du[dot[i].id]+=
(lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y+D,s(!j)))-dot)-
(lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y-D,s(j)))-dot)+
(lb(dot,dot+n,getdot(dot[i].x+D,dot[i].y+D,s(!j)))-dot)-
(lb(dot,dot+n,getdot(dot[i].x+D,dot[i].y-D,s(j)))-dot)
;
if(j==1)return;
for(int i=0;i<n;i++)dot[i].chg();
}
}
void getlian(){
init();
int sum[MAXN];
for(int j=0;j<2;j++){
ms(sum);
sort(dot,dot+n);
for(int i=0;i<n;i++){
int u=lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y-D,0))-dot;
int d=lb(dot,dot+n,getdot(dot[i].x-D,dot[i].y+D,INF))-dot;
if(u==d)continue;
unite(dot[u].id,dot[i].id);
sum[u]++;sum[d-1]--;
}
for(int i=0;i<n;i++){
if(i)sum[i]+=sum[i-1];
if(sum[i])unite(dot[i].id,dot[i+1].id);
}
if(j==1)return;
for(int i=0;i<n;i++)dot[i].chg();
}
}
/************************************************
所有数组下标都从0开始
************************************************/
intmain(){
freopen("E.txt","r",stdin);
scanf("%d%d%d",&n,&a,&b);
for(int i=0;i<n;i++)
dot[i].read(i);
a--;b--;
D=abs(dot[a].x-dot[b].x)+abs(dot[a].y-dot[b].y);
for(int i=0;i<n;i++)
dot[i].rotate();
getdu();
getlian();
ll ans=0;
for(int i=0;i<n;i++)
if(same(i,a))
ans+=du[i];
ans/=2;
printf("%lld\n",ans);
return 0;
}

Compiler output:
a.cc:119:1: error: ISO C++ forbids declaration of 'intmain' with no type [-fpermissive]
  119 | intmain(){
      | ^~~~~~~
Language: C++

import java.util.Scanner;

/**
 * Created by zzt on 17-1-16.
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        int[][] pinholes = new int[N][2];
        for (int i = 0; i < N; i++) {
            pinholes[i][0] = scanner.nextInt();
            pinholes[i][1] = scanner.nextInt();
        }
        int baseD = distance(pinholes[a - 1], pinholes[b - 1]);

        UnionFind uf = new UnionFind(N);
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                if (distance(pinholes[i], pinholes[j]) == baseD) {
                    uf.union(i, j);
                }
            }
        }
//        int pairs = 0;
//        for (int i = 0; i < N; i++) {
//            for (int j = i + 1; j < N; j++) {
//                if (distance(pinholes[i], pinholes[j]) == baseD
//                        && uf.connected(i,a))
//                    pairs++;
//            }
//        }
        System.out.println(uf.edges[uf.find(a)]);
    }

    static int distance(int[] p, int[] q) {
        return Math.abs(p[0] - q[0]) + Math.abs(p[1] - q[1]);
    }

    static class UnionFind {
        private int[] id;
        private int count;
        private int[] sz;
        private long[] edges;

        public UnionFind(int n) {
            count = n;
            id = new int[n];
            sz = new int[n];
            edges = new long[n];
            for (int i = 0; i < n; i++) {
                id[i] = i;
                sz[i] = 1;
            }
        }

        public int count() {
            return count;
        }

        public boolean connected(int p, int q) {
            return find(p) == find(q);
        }

        public int find(int p) {
            while (p != id[p]) {
                id[p] = id[id[p]];
                p = id[p];
            }
            return p;
        }

        public void union(int p, int q) {
            int i = find(p);
            int j = find(q);

            if (i == j) {
                edges[i]++;
                return;
            }
            if (sz[i] < sz[j]) {
                id[i] = j;
                sz[j] += sz[i];
                edges[i]++;
                edges[j] += edges[i];
            } else {
                id[j] = id[i];
                sz[i] += sz[j];
                edges[j]++;
                edges[i] += edges[j];
            }
            count--;
        }

        public int size(int p) {
            return sz[find(p)];
        }
    }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main {
      | ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>

#define MAX_HOLE 1000000000
// #define MAX_HOLE 1000

typedef struct xy {
  int x, y;
} XY;

static int N = 0;
static XY hole[MAX_HOLE] = {0};

static int memo[MAX_HOLE][MAX_HOLE] = {0};

void memo_clear();
int memo_count();
int countup(int now_a, int now_b);
int d(int i, int j);

int main( void ){
  int i, j, k;
  int a,b;

  scanf("%d %d %d", &N, &a, &b);
  for( i = 0; i < N; i++ ){
    scanf("%d %d", &hole[i].x, &hole[i].y);
  }

  memo_clear();
  countup(a-1, b-1);
  printf( "%d\n", memo_count() );
  // printf( "%d\n", countup(a-1, b-1)+1 );

  return 0;
}

int memo_count(){
  int i,j;
  int count;
  for( i = 0; i < N; i++ ){
    for( j = 0; j < N; j++ ){
      if( memo[i][j] == 1 ){
        count++;
      }
    }
  }
  return count/2;
}

void memo_clear(){
  int i,j;
  for( i = 0; i < N; i++ ){
    for( j = 0; j < N; j++ ){
      memo[i][j] = 0;
    }
  }
}

int d(int i, int j){
  return abs(hole[i].x-hole[j].x)+abs(hole[i].y-hole[j].y);
}

int countup(int now_a, int now_b){
  int i;
  int count = 0;
  // // // // // // // // // printf( "%d %d\n", now_a+1, now_b+1 );
  for( i = 0; i < N; i++ ){
    if( i != now_a && i != now_b ){
      // printf( "d(now) = %d\n", d(now_a, now_b) );
      // printf( "d(next1) = %d\n", d(now_a, i) );
      // printf( "d(next2) = %d\n", d(i, now_b) );
      // printf( "memo1 = %d\n", memo[now_a][i] );
      if( ( d(now_a, now_b) == d(now_a, i) ) &&
          ( memo[now_a][i] == 0 ) ){
        // printf( "a\n" );
        // printf( "yes\n" );
        memo[now_a][i] = 1;
        memo[i][now_a] = 1;
        count = countup(now_a, i) + 1;
      }
      // printf( "memo2 = %d\n", memo[i][now_b] );
      if( ( d(now_a, now_b) == d(i, now_b) ) &&
          ( memo[now_b][i] == 0 ) ){
        // printf( "b\n" );
        // printf( "no\n" );
        memo[i][now_b] = 1;
        memo[now_b][i] = 1;
        count = countup(i, now_b) + 1;
      }
    }
  }
  return count==0 ? 1 : count;
}


Compiler output:
/tmp/cc66YPU1.o: in function `memo_count':
main.c:(.text+0x111): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/cc66YPU1.o: in function `memo_clear':
main.c:(.text+0x183): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/cc66YPU1.o: in function `countup':
main.c:(.text+0x2b2): relocation truncated to fit: R_X86_64_PC32 against `.bss'
main.c:(.text+0x2dd): relocation truncated to fit: R_X86_64_PC32 against `.bss'
main.c:(.text+0x308): relocation truncated to fit: R_X86_64_PC32 against `.bss'
main.c:(.text+0x370): relocation truncated to fit: R_X86_64_PC32 against `.bss'
main.c:(.text+0x39b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
main.c:(.text+0x3c6): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  void unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x != y) {
      if(data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

typedef long long int64;

int64 N, R, s, t;
int64 a[100000], b[100000];
UnionFind tree(100000);
int64 ret[100000];

void ask(int v)
{
  map< int, vector< pair< int64, int > > > backet;
  for(int i = 0; i < N; i++) {
    backet[a[i]].push_back(make_pair(b[i], i));
  }
  for(auto &obj : backet) {
    sort(begin(obj.second), end(obj.second));
  }
  for(int i = 0; i < N; i++) {
    auto &cc = backet[a[i] - R];
    auto p = lower_bound(begin(cc), end(cc), make_pair(b[i] - R - v, +INF));
    auto q = lower_bound(begin(cc), end(cc), make_pair(b[i] + R + v, -INF));
    ret[i] += q - p;
    if(p != q) tree.unite(i, p->second);
  }
  for(int i = 0; i < N; i++) {
    auto &cc = backet[a[i] + R];
    auto p = lower_bound(begin(cc), end(cc), make_pair(b[i] - R - v, +INF));
    auto q = lower_bound(begin(cc), end(cc), make_pair(b[i] + R + v, -INF));
    ret[i] += q - p;
    if(p != q) tree.unite(i, p->second);
  }
}

int main()
{
  cin >> N >> s >> t;
  for(int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = x + y;
    b[i] = x - y;
  }
  --s, --t;
  R = max(abs(a[s] - a[t]), abs(b[s] - b[t]));
  ask(false);
  for(int i = 0; i < N; i++) swap(a[i], b[i]);
  ask(true);
  long long res = 0;
  for(int i = 0; i < N; i++) {
    if(tree.find(i) == tree.find(s)) res += ret[i];
  }
  cout << res / 2 << endl;
}

Compiler output:
a.cc: In function 'void ask(int)':
a.cc:54:71: error: 'INF' was not declared in this scope
   54 |     auto p = lower_bound(begin(cc), end(cc), make_pair(b[i] - R - v, +INF));
      |                                                                       ^~~
a.cc:61:71: error: 'INF' was not declared in this scope
   61 |     auto p = lower_bound(begin(cc), end(cc), make_pair(b[i] - R - v, +INF));
      |                                                                       ^~~
Language: C++

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

int n, m;
string s;

int cnt[3005];
int mx[3005], mn[3005];
int dp[3005][3005];
signed main()
{
	cin>>n>>m>>s;
	for(int i=1; i<=n; i++)
	{
		cnt[i]=cnt[i-1]+(s[i-1]=='1');
		mx[i]=cnt[i], mn[i]=cnt[i];
	}
	for(int i=1; i<=m; i++)
	{
		int l, r;
		cin>>l>>r;

		int lol=mn[r]-mn[l-1], lel=mx[r]-mx[l-1];

		for(int j=l; j<=r; j++)
		{
			mn[j]=min(mn[j], mn[l-1]+max(0, lol-(r-j)));
			mx[j]=max(mx[j], mx[l-1]+min(j-l+1, lel));
		}
	}
	// for(int i=1; i<=n; i++)
	// {
	// 	cout<<mx[i]<<" "<<mn[i]<<endl;
	// }
	dp[0][0]=1;
	for(int i=1; i<=n; i++)
	{
		for(int j=mn[i]; j<=mx[i]; j++)
		{
			if(j>0)
			{
				dp[i][j]=dp[i-1][j-1]+dp[i-1][j];
			}
			else
			{
				dp[i][j]=dp[i-1][j];
			}
			dp[i][j]%=1000000007;
		}
	}
	cout<<dp[n][cnt[n]];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:53: error: no matching function for call to 'max(int, long long int)'
   28 |                         mn[j]=min(mn[j], mn[l-1]+max(0, lol-(r-j)));
      |                                                  ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:28:53: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |                         mn[j]=min(mn[j], mn[l-1]+max(0, lol-(r-j)));
      |                                                  ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:28:53: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |                         mn[j]=min(mn[j], mn[l-1]+max(0, lol-(r-j)));
      |                                                  ~~~^~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 2005;
const int MOD = 1e9 + 7;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

int n, m, sum[MAXN], rbd[MAXN];
int dp[MAXN][MAXN];

inline int Inc(int &x, int y) {
	x += y; if (x >= MOD) x -= MOD;
}

void init() {
	read(n); read(m);
	scanf("%s", s + 1);
	for (int i=1;i<=n;++i) {
		sum[i] = sum[i-1] + s[i] - '0';
		rbd[i] = i;
	}
	sum[n+1] = sum[n]; rbd[n+1] = n+1;
	for (int i=1;i<=m;++i) {
		int l, r;
		read(l); read(r);
		cmax(rbd[l], r);
	}
	for (int i=1;i<=n;++i) {
		cmax(rbd[i], rbd[i-1]);
	}
}

void solvee() {
	dp[1][sum[rbd[1]]] = 1;
	for (int i=1;i<=n;++i) {
		for (int j=0;j<=n;++j) {
			int x = dp[i][j];
			if (!x) continue;
			int l = rbd[i], r = rbd[i+1];
			int cnt1 = j, cnt0 = rbd[i] - i + 1 - j;
			if (cnt0) Inc(dp[i+1][j+sum[r]-sum[l-1]], x);
			if (cnt1) Inc(dp[i+1][j-1+sum[r]-sum[l-1]], x);
		}
	}
	printf("%d\n", dp[n+1][0]);
}

int main() {
	init();
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'int Inc(int&, int)':
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'void init()':
a.cc:33:21: error: 's' was not declared in this scope
   33 |         scanf("%s", s + 1);
      |                     ^
a.cc:42:17: error: 'cmax' was not declared in this scope; did you mean 'fmax'?
   42 |                 cmax(rbd[l], r);
      |                 ^~~~
      |                 fmax
a.cc:45:17: error: 'cmax' was not declared in this scope; did you mean 'fmax'?
   45 |                 cmax(rbd[i], rbd[i-1]);
      |                 ^~~~
      |                 fmax
a.cc: In function 'int main()':
a.cc:66:9: error: 'solve' was not declared in this scope; did you mean 'solvee'?
   66 |         solve();
      |         ^~~~~
      |         solvee
Language: C

#include<bits/stdc++.h>
#define N 3005
using namespace std;
const int mod=1e9+7;
int n,m;
int s[N],val[N],dp[2][N];
int main(){
	scanf("%d%d",&n,&m);
	char t[2];gets(t);
	for(int i=1;i<=n;i++) s[i]=getchar()-'0'+s[i-1];
	int cnt=0;
	for(int i=1,ml,mr;i<=m;i++)
		scanf("%d%d",&ml,&mr),val[ml]=max(val[ml],mr);
	for(int i=1;i<=n;i++) val[i]=max(max(i,val[i]),val[i-1]); 
	int now=0;
	dp[now][0]=1;
	for(int i=1;i<=n;i++,now^=1){
		memset(dp[now^1],0,sizeof(dp[0]));
		for(int j=s[val[i]]-(val[i]-i);j<=s[val[i]];j++)
			dp[now^1][j]=(dp[now][j]+ (j==0?0:dp[now][j-1]) )%mod;
	}
	cout<<dp[now][s[n]]<<endl;
	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<bits/stdc++.h>
#define N 3005
using namespace std;
const int mod=1e9+7;
int n,m;
int s[N],val[N],dp[2][N];
int main(){
	scanf("%d%d",&n,&m);
	char t[2];gets(t);
	for(int i=1;i<=n;i++) s[i]=getchar()-'0'+s[i-1];
	int cnt=0;
	for(int i=1,ml,mr;i<=m;i++)
		scanf("%d%d",&ml,&mr),val[ml]=max(val[ml],mr);
	for(int i=1;i<=n;i++) val[i]=max(max(i,val[i]),val[i-1]); 
	int now=0;
	dp[now][0]=1;
	for(int i=1;i<=n;i++,now^=1){
		memset(dp[now^1],0,sizeof(dp[0]));
		for(int j=s[val[i]]-(val[i]-i);j<=s[val[i]];j++)
			dp[now^1][j]=(dp[now][j]+ (j==0?0:dp[now][j-1]) )%mod;
	}
	cout<<dp[now][s[n]]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |         char t[2];gets(t);
      |                   ^~~~
      |                   getw
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
lli n,m;
string s;
vector<lli> sum;
vector<lli> rightend;
vector<vector<lli> > dp;
int main(){
    cin >> n >> m;
    cin >> s;
    sum = vector<lli> (n+1);
    rightend = vector<lli> (n+1);
    for(lli i = 1;i <= n;i++){
        rightend[i] = i;
    }
    for(lli i = 0;i < n;i++){
        sum[i+1] = sum[i] + (s[i] - '0');
    }
    for(lli i = 0;i < m;i++){
        lli l,r;
        cin >> l >> r;
        for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
    }
    dp = vector<vector<lli> > (n+1,vector<lli> (n+1));
    dp[0][0] = 1;
    for(lli i = 0;i < n;i++){
        lli b,e;
        b = max(0ll,i - (rightend[i] - sum[rightend[i]]));
        e = min(i,sum[rightend[i]]);
        for(lli j = b;j <= e;j++){
            dp[i+1][j] += dp[i][j];dp[i+1][j] %= 1000000007;
            dp[i+1][j+1] += dp[i][j];dp[i+1][j] %= 1000000007;
        }
    }
    cout < dp[n][sum[n]] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected ';' before '<=' token
   23 |         for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
      |                        ^~~
      |                        ;
a.cc:23:25: error: expected primary-expression before '<=' token
   23 |         for(lli j = l,j <= r;j++) rightend[j] = max(rightend[j],r);
      |                         ^~
a.cc:36:26: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   36 |     cout < dp[n][sum[n]] << endl;
Language: C++

#include <iostream>
#include <string>
#include <set>

using namespace std;
const long long MOD=1000000007;
void op(set<string> &sSet,int l,int r)
{
	l--;
	r--;
	int strLen=r-l+1;
	set<string> tmpSet;
	set<string>::iterator sit;
	for (sit=sSet.begin();sit!=sSet.end();sit++){
		char *S=(char*)(*sit).c_str();
		int n=0;
		while (n<strLen){
			char ch=*(S+l);
			memcpy(S+l,S+l+1,strLen);
			*(S+r)=ch;
			tmpSet.insert(S);
			n++;
		}
	}
	sSet.insert(tmpSet.begin(),tmpSet.end());
	tmpSet.clear();
	return;
}
int main(int argc, char* argv[])
{
	int N,M;
	cin>>N>>M;
	string S;
	cin>>S;
	set<string> sSet;
	sSet.insert(S);
	int i;
	int l,r;
	long long aw=0;
	for (i=0;i<M;i++){
		cin>>l>>r;
		op(sSet,l,r);
	}
	cout<<sSet.size()%MOD<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void op(std::set<std::__cxx11::basic_string<char> >&, int, int)':
a.cc:19:25: error: 'memcpy' was not declared in this scope
   19 |                         memcpy(S+l,S+l+1,strLen);
      |                         ^~~~~~
a.cc:4:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <set>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<bits/stdc++.h>
#define x first
#define y second

using namespace std;

int N, M, mod, s[3009], rgt[3009], dp[3009][3009];
char sir[3009];

void ad (int &i, int j)
{
    i += j;
    if (i >= mod) i -= mod;
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d\n", &N, &M), mod = 1e9 + 7;
gets (sir + 1);
for (int i=1; i<=N; i++)
    s[i] = s[i - 1] + (sir[i] == '1');
for (int i=1; i<=N; i++)
    rgt[i] = i;
while (M --)
{
    int x, y;
    scanf ("%d %d", &x, &y);
    if (y > rgt[x]) rgt[x] = y;
}
dp[0][0] = 1;
int R = 0;
for (int i=0; i<N; i++)
{
    for (int j=0; j<=R - i; j++)
    if (dp[i][j])
    {
        //printf ("primele %d si pe [%d, %d] inca %d de 1 -> %d\n", i, i + 1, R, j, dp[i][j]);
        int k1 = j, k0 = (R - i) - j, mk0 = 0, mk1 = 0;
        if (rgt[i + 1] > R) mk1 = s[rgt[i + 1]] - s[R], mk0 = rgt[i + 1] - R - mk1;
        k0 += mk0, k1 += mk1;
        if (k1 >= 1) ad (dp[i + 1][k1 - 1], dp[i][j]);
        if (k0 >= 1) ad (dp[i + 1][k1], dp[i][j]);
    }
    if (rgt[i + 1] > R) R = rgt[i + 1];
}
printf ("%d\n", dp[N][0]);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:1: error: 'gets' was not declared in this scope; did you mean 'getw'?
   22 | gets (sir + 1);
      | ^~~~
      | getw
Language: Java

import java.io.*;

public class BoxesAndCandies {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String a = "AtCoder ";
        String b = " Contest";
        String s = br.readLine();
        String s1 = s.toLowerCase();
        String s2 = s1.substring(0,1).toUpperCase() + s1.substring(1);
        String name = a + s2 + b;
       
        System.out.println("A"+s2.charAt(0)+"C");
        
    }
}


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