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

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

map<int,int>,mp,used;

int w,h,n;
void add(int x,int y,int i){
  if(x == 0) mp[y] = i;
  else if(y == h) mp[h+x] = i;
  else if(x == w) mp[h+w+h-y] = i;
  else if(y == 0) mp[2*h + w + w - x] = i;
}

typedef pair<int,int> P;
bool check(){
 stack <int> S;
 
 for(P a:mp) {
   int num = a.second;
   if(num == -1) continue;
   if(used[num] == 1 && S.top() != num) return 0;
   if(used[num] == 1) S.pop(),used[num] = 0;
   else S.push(num),used[num] = 1;
 }

 for(P a:mp) {
   int num = a.second;
   if(num == -1) continue;
   if(used[num] == 1 && S.top() != num) return 0;
   if(used[num] == 1) S.pop(),used[num] = 0;
   else S.push(num),used[num] = 1;
 }
 
 return 1;
}

int main(){
  cin>>w>>h>>n;
  memset(mp,-1,sizeof(mp));
  for(int i=0;i<n;i++){
    int x1,y1,x2,y2;

    cin>>x1>>y1>>x2>>y2;
    if(!((x1 == 0 || y1 == 0 ||x1 == w || y1 == w) &&
         (x2 == 0 || y2 == 0 ||x2 == w || y2 == w)))continue;
    add(x1,y1,i);
    add(x2,y2,i);
  }
  
  cout<<(check()? "YES":"NO")<<endl; 
    
  return 0;
}


Compiler output:
a.cc:6:13: error: expected unqualified-id before ',' token
    6 | map<int,int>,mp,used;
      |             ^
a.cc: In function 'int main()':
a.cc:41:10: error: cannot convert 'std::map<int, int>' to 'void*'
   41 |   memset(mp,-1,sizeof(mp));
      |          ^~
      |          |
      |          std::map<int, int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL R, C, N;

struct rim
{
	LL x, y, id;
	int val;
	rim(LL xx, LL yy, LL idid)
		:x(xx), y(yy), id(idid)
	{
		val = value();
	}
	LL value()const
	{
		if (y == 0)return x;
		if (x == R)return R + y;
		if (y == C)return R + C + R - x;
		assert(x == 0);
		return R + C + R + C - y;
	}
};

int main(void)
{
	cin >> R >> C >> N;
	vector<rim>cash;
	for (int i = 0; i < N; ++i)
	{
		LL x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		bool fl1 = (x1 == 0 || x1 == R);
		bool fl2 = (y1 == 0 || y1 == C);
		bool fl3 = (x2 == 0 || x2 == R);
		bool fl4 = (y2 == 0 || y2 == C);
		if ((fl1 || fl2) && (fl3 || fl4))
		{
			cash.push_back(rim(x1, y1, i));
			cash.push_back(rim(x2, y2, i));
		}
	}
	sort(cash.begin(), cash.end(), [](const rim& c1, const rim&c2) 
	{
		return c1.value() < c2.value();
	});
	list<int>ids;
	for (auto& a : cash)
	{
		ids.push_back(a.id);
	}
	if (ids.empty())
	{
		cout << "YES\n";
		return 0;
	}
	auto lef = ids.begin();
	auto rht = lef;
	rht++;
	if (rht == ids.end())rht = ids.begin();
	for (int i = 0; i < 1e7; ++i)
	{
		while (*lef == *rht)
		{
			lef = ids.erase(lef);
			lef = ids.erase(lef);
			if (ids.empty())
			{
				cout << "YES\n";
				return 0;
			}
			rht = lef;
			if (lef == ids.begin())lef = ids.end();
			--lef;
		}
		lef++;
		rht++;
		if (lef == ids.end())lef = ids.begin();
		if (rht == ids.end())rht = ids.begin();
		if (ids.empty())
		{
			cout << "YES\n";
			return 0;
		}
	}
	cout << "NO\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'list' was not declared in this scope
   72 |         list<int>ids;
      |         ^~~~
a.cc:26:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
   25 | #include <bitset>
  +++ |+#include <list>
   26 | using namespace std;
a.cc:72:14: error: expected primary-expression before 'int'
   72 |         list<int>ids;
      |              ^~~
a.cc:75:17: error: 'ids' was not declared in this scope
   75 |                 ids.push_back(a.id);
      |                 ^~~
a.cc:77:13: error: 'ids' was not declared in this scope
   77 |         if (ids.empty())
      |             ^~~
a.cc:82:20: error: 'ids' was not declared in this scope
   82 |         auto lef = ids.begin();
      |                    ^~~
Language: C++


#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

LL R, C, N;

struct rim
{
	LL x, y, id;
	int val;
	rim(LL xx, LL yy, LL idid)
		:x(xx), y(yy), id(idid)
	{
		val = value();
	}
	LL value()const
	{
		if (y == 0)return x;
		if (x == R)return R + y;
		if (y == C)return R + C + R - x;
		assert(x == 0);
		return R + C + R + C - y;
	}
};

int main(void)
{
	cin >> R >> C >> N;
	vector<rim>cash;
	for (int i = 0; i < N; ++i)
	{
		LL x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		bool fl1 = (x1 == 0 || x1 == R);
		bool fl2 = (y1 == 0 || y1 == C);
		bool fl3 = (x2 == 0 || x2 == R);
		bool fl4 = (y2 == 0 || y2 == C);
		if ((fl1 || fl2) && (fl3 || fl4))
		{
			cash.push_back(rim(x1, y1, i));
			cash.push_back(rim(x2, y2, i));
		}
	}
	sort(cash.begin(), cash.end(), [](const rim& c1, const rim&c2) 
	{
		return c1.value() < c2.value();
	});
	list<int>ids;
	for (auto& a : cash)
	{
		ids.push_back(a.id);
	}
	auto lef = ids.begin();
	auto rht = lef;
	rht++;
	for (int i = 0; i < 1e7; ++i)
	{
		while (*lef == *rht)
		{
			lef = ids.erase(lef);
			lef = ids.erase(lef);
			if (ids.empty())
			{
				cout << "YES\n";
				return 0;
			}
			rht = lef;
			if (lef == ids.begin())lef = ids.end();
			--lef;
		}
		lef++;
		rht++;
		if (lef == ids.end())lef = ids.begin();
		if (rht == ids.end())rht = ids.begin();
		if (ids.empty())
		{
			cout << "YES\n";
			return 0;
		}
	}
	cout << "NO\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:9: error: 'list' was not declared in this scope
   72 |         list<int>ids;
      |         ^~~~
a.cc:26:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>'
   25 | #include <bitset>
  +++ |+#include <list>
   26 | using namespace std;
a.cc:72:14: error: expected primary-expression before 'int'
   72 |         list<int>ids;
      |              ^~~
a.cc:75:17: error: 'ids' was not declared in this scope
   75 |                 ids.push_back(a.id);
      |                 ^~~
a.cc:77:20: error: 'ids' was not declared in this scope
   77 |         auto lef = ids.begin();
      |                    ^~~
Language: C++

#include <cstdio>
#include <map>
#include <utility>
#include <vector>
static const int MAXN = 1e5 + 4;
static const int LOGN = 19;

int mx, my, n;

inline int get_point(int x, int y)
{
    if (y == 0) return x;
    if (x == mx) return mx + y;
    if (y == my) return mx + my + (mx - x);
    if (x == 0) return mx + my + mx + (my - y);
    return -1;
}

typedef std::pair<int, int> num;
std::vector<num> c;
std::map<int, int> dis;

int a[MAXN * 2];

namespace rmq {
    int min[LOGN][MAXN * 2], max[LOGN][MAXN * 2];
    inline void build(int n, int *a) {
        for (int i = 0; i < n; ++i) min[0][i] = max[0][i] = a[i];
        for (int j = 1; j < LOGN; ++j)
            for (int i = 0; i < n - (1 << j); ++i) {
                max[j][i] = std::max(max[j - 1][i], max[j - 1][i + (1 << (j - 1))]);
                min[j][i] = std::min(min[j - 1][i], min[j - 1][i + (1 << (j - 1))]);
            }
    }
    inline std::pair<int, int> query(int l, int r) {
        if (l == r) return std::make_pair(min[0][l], max[0][l]);
        int sz = 8 * sizeof(int) - __builtin_clz(r - l) - 1;
        return std::make_pair(
            std::min(min[sz][l], min[sz][r - (1 << sz) + 1]),
            std::max(max[sz][l], max[sz][r - (1 << sz) + 1])
        );
    }
}

int main()
{
    scanf("%d%d%d", &mx, &my, &n);
    for (int i = 0, x1, y1, x2, y2; i < n; ++i) {
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        int p1 = get_point(x1, y1),
            p2 = get_point(x2, y2);
        if (p1 != -1 && p2 != -1) {
            if (p1 > p2) std::swap(p1, p2);
            c.push_back(num(p1, p2));
            dis.insert(std::make_pair(p1, 0));
            dis.insert(std::make_pair(p2, 0));
        }
    }
    int ct = 0;
    for (auto &kv : dis) kv.second = ct++;
    for (auto &p : c) {
        p.first = dis[p.first], p.second = dis[p.second];
        a[p.first] = p.second;
        a[p.second] = p.first;
    }
    rmq::build(ct, a);

    std::sort(c.begin(), c.end());
    for (auto p : c) if (p.second >= p.first + 2) {
        auto val = rmq::query(p.first + 1, p.second - 1);
        if (val.first < p.first || val.second > p.second) {
            puts("NO"); return 0;
        }
    }

    puts("YES"); return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:10: error: 'sort' is not a member of 'std'
   68 |     std::sort(c.begin(), c.end());
      |          ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


const int kMod = 1e9+7;
const int kMaxN = 1e5+10;

struct Point {
	int x, y, i;

	Point(int x, int y, int i) : x(x), y(y), i(i) {}

	Point() {}
};

struct FenTree {
	int n;
	vector<int> aib;
	FenTree(int n) : n(n) {
		aib.resize(n+1);
	}

	static inline int LSB(int i) {
		return i&-i;
	}

	void update(int i, int val) {
		for (; i <= n; i += LSB(i)) {
			aib[i] += val;
		}
	}

	int query(int i) {
		int res = 0;
		for (; i > 0; i -= LSB(i)) {
			res += aib[i];
		}
		return res;
	}

	int query(int i, int j) {
		if (j > i) {
			return query(j) - query(i-1);
		} else {
			return query(j) + query(n) - query(i-1);
		}
	}
};

bool on_border(int a, int b, int r, int c) {
	return (a == r || a == 0 || b == c || b == 0);
}

void Solve() {
	int r, c, n;

	cin >> r >> c >> n;

	vector<Point> points;
	vector<int> first(n+1), second(n+1);

	for (int i = 1; i <= n; ++i) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;

		if (on_border(x1, y1, r, c) && on_border(x2, y2, r, c)) {
			points.emplace_back(x1, y1, i);
			points.emplace_back(x2, y2, i);
		}
	}

	auto cmp = [&](Point a, Point b) {
		a.x -= 1;
		a.y -= 1;
		b.x -= 1;
		b.y -= 1;

		return atan2(a.y, a.x) < atan2(b.y, b.x);
	};

	sort(points.begin(), points.end(), cmp);

	FenTree fen(points.size());

	for (int i = 0; i < points.size(); ++i) {
		if (first[points[i].i]) {
			second[points[i].i] = i + 1;
			fen.update(i+1, -1);
		} else {
			first[points[i].i] = i + 1;
			fen.update(i+1, 1);
		}
	}

	for (int i = 0; i < points.size(); ++i) {
		if (i+1 == first[points[i].i]) {
			if(fen.query(first[points[i].i], second[points[i].i]) != 0) {
				cout << "NO\n";
				return;
			}
			fen.update(i+1, -2);
			fen.update(second[points[i].i], 2);
		}
	}

	cout << "YES\n";
}

int main() {
	int tests = 1;

	for (;tests; --tests) {
		Solve();
	}
}

Compiler output:
a.cc: In lambda function:
a.cc:81:24: error: 'atan2' was not declared in this scope
   81 |                 return atan2(a.y, a.x) < atan2(b.y, b.x);
      |                        ^~~~~
Language: C++

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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)

int r, c, n, lucky;

int main()
{
	scanf("%d%d%d",&r,&c,&n);
	srand(time(null));
	lucky = rand()%2;
	if(lucky == 0) printf("YES"); else printf("NO");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'null' was not declared in this scope
   12 |         srand(time(null));
      |                    ^~~~
Language: C++

#pragma GCC optimize(3,"Ofast")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
    char c=getchar();bool f=0;x=0;
    while(!isdigit(c)) f|=c=='-',c=getchar();
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
    if(f) x=-x;return x;
}
template<class t> inline void write(t x){
    if(x<0) putchar('-'),write(-x);
    else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=2e5+5;
int n,m,ans,pn,p[N];

struct dislike{
	int l,r;
	inline operator < (const dislike &nt) const {
		if(l==nt.l) return r>nt.r;
		return l<nt.l;
	}
}a[N];

priority_queue<int,vector<int>,greater<int> > q;

signed main(){
	read(n);read(m);
	for(int i=1;i<=n;i++) read(a[i].l),read(a[i].r);
	sort(a+1,a+1+n);
	int l=1,r=m;
	for(int i=1;i<=n;i++){
		q.push(a[i].r);
		if(l<=r&&l<=a[i].l) l++;
		else{
			p[++pn]=q.top();
			q.pop();
		}
	}
	sort(p+1,p+1+pn,greater<int>());
	for(int i=1;i<=pn;i++){
		if(l<=r&&p[i]<=r) r--;
		else ans++;
	}
	write(ans);
}

Compiler output:
a.cc:20:16: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
   20 |         inline operator < (const dislike &nt) const {
      |                ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, L, R;
vector<int> val[N];
int lch[N << 2], rch[N << 2], Max[N << 2], lazy[N << 2];

inline void update(int x)
{
    lazy[x]++;
    Max[x]++;
}

inline void pushup(int x) { Max[x] = max(Max[x << 1], Max[x << 1 | 1]); }

inline void pushdown(int x)
{
    if (lazy[x])
    {
        update(x << 1, lazy[x]);
        update(x << 1 | 1, lazy[x]);
        lazy[x] = 0;
    }
}

void build(int x, int l, int r)
{
    lch[x] = l;
    rch[x] = r;
    if (l == r)
    {
        Max[x] = l;
        return;
    }
    int mid = (l + r) / 2;
    build(x << 1, l, mid);
    build(x << 1 | 1, mid + 1, r);
    pushup(x);
}

void update(int x, int l, int r)
{
    if (l <= lch[x] && rch[x] <= r)
    {
        update(x);
        return;
    }
    pushdown(x);
    int mid = (lch[x] + rch[x]) / 2;
    if (r <= mid)
        update(x << 1, l, r);
    else if (l > mid)
        update(x << 1 | 1, l, r);
    else
        update(x << 1, l, mid), update(x << 1 | 1, mid + 1, r);
    pushup(x);
}

int query(int x, int l, int r)
{
    if (l <= lch[x] && rch[x] <= r)
    {
        return Max[x];
    }
    pushdown(x);
    int mid = (lch[x] + rch[x]) / 2;
    if (r <= mid)
        return query(x << 1, l, r);
    else if (l > mid)
        return query(x << 1 | 1, l, r);
    else
        return max(query(x << 1, l, mid), query(x << 1 | 1, mid + 1, r));
}

int ans = 0;

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d%d", &L, &R);
        val[L].push_back(R);
    }
    build(1, 0, m + 1);
    for (int i = 0; i <= m; ++i)
    {
        for (int j = 0; j < val[i].size(); ++j)
        {
            update(1, 0, val[i][j]);
        }
        ans = max(ans, query(1, i + 1, m + 1) - m - i - 1);
    }
    printf("%d\n", max(ans, n - m));
    return 0;
}

Compiler output:
a.cc: In function 'void pushdown(int)':
a.cc:20:15: error: too many arguments to function 'void update(int)'
   20 |         update(x << 1, lazy[x]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:8:13: note: declared here
    8 | inline void update(int x)
      |             ^~~~~~
a.cc:21:15: error: too many arguments to function 'void update(int)'
   21 |         update(x << 1 | 1, lazy[x]);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:8:13: note: declared here
    8 | inline void update(int x)
      |             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, L, R;
vector<int> val[N];
int lch[N << 2], rch[N << 2], Max[N << 2], lazy[N << 2];
inline void update(int x, int v) {
    lazy[x] += v; Max[x] += v;
}
inline void pushup(int x) {Max[x] = max(Max[x << 1], Max[x << 1 | 1]);}
inline void pushdown(int x) {
    if(lazy[x]) {
        update(x << 1, lazy[x]); update(x << 1 | 1, lazy[x]); lazy[x] = 0; 
    }
}
void build(int x,int l, int r) {
    lch[x] = l; rch[x] = r;
    if(l == r) {
        Max[x] = l; return;
    }
    int mid = (l + r) / 2;
    build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r);
    pushup(x);
}
void update(int x, int l, int r, int v) {
    if(l <= lch[x] && rch[x] <= r) {
        update(x, v); return;
    }
    pushdown(x);
    int mid = (lch[x] + rch[x]) / 2;
    if(r <= mid) update(x << 1, l, r, v);
    else if(l > mid) update(x << 1 | 1, l, r, v);
    else update(x << 1, l, mid, v), update(x << 1 | 1, mid + 1, r, v);
    pushup(x);
}
int query(int x, int l, int r) {
    if(l <= lch[x] && rch[x] <= r) {
        return Max[x];
    }
    pushdown(x);
    int mid = (lch[x] + rch[x]) / 2;
    if(r <= mid) return query(x << 1, l, r);
    else if(l > mid) return query(x << 1 | 1, l, r);
    else return max(query(x << 1, l, mid), query(x << 1 | 1, mid + 1, r));
}
int ans = 0;
int main() {
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++i) {
        scanf("%d%d", &L, &R); val[L].push_back(R);
    }
    build(1, 0, m + 1);
    for(int i = 0; i <= m; ++i) {
        for(int j = 0; j < val[i].size(); ++j) {
            update(1, 0, val[i][j], 1);
        }
        ans = max(ans, query(1, i + 1, m + 1) - m - i - 1);
    }
    printf("%d\n", max(ans, n - m));
    return 0;
}
​

Compiler output:
a.cc:62:1: error: '\U0000200b' does not name a type
   62 | ​
      |
Language: C++

#include<queue>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,m,l,r,tot,ans,tmp[200010];
pair<int,int>a[200010];
priority_queue<int>q;
char buffer[10000010],*hed;
char Getchar(){
	return *hed++;
}
int rd(){
	int x=0;
	char c;
	do c=Getchar();
	while(!isdigit(c));
	do{
		x=(x<<1)+(x<<3)+(c^48);
		c=Getchar();
	}while(isdigit(c));
	return x;
}
int main(){
	fread(buffer,1,10000000,stdin);
	hed=buffer;
	n=rd(),m=rd();
	l=1,r=m;
	for(int i=1;i<=n;i++)
		a[i].first=rd(),a[i].second=-rd();
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		q.push(a[i].second);
		if(l<=r&&l<=a[i].first)
			l++;
		else{
			tmp[++tot]=-q.top();
			q.pop();
		}
	}
	sort(tmp+1,tmp+tot+1);
	for(int i=tot;i>=1;i--){
		if(l<=r&&tmp[i]<=r)
			r--;
		else ans++;
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int rd()':
a.cc:16:16: error: 'isdigit' was not declared in this scope
   16 |         while(!isdigit(c));
      |                ^~~~~~~
Language: C++

#include <cstdio>
#define gc getchar()
inline int read(){
	int x=0;char c=gc;
	for(;c<48||c>57;c=gc);
	for(;c>47&&c<58;c=gc)
		x=x*10+c-48;
	return x;
}
#define io read()

#define maxn 800005
#define maxm 3200005
#define inf 0x7fffffff
int n,m,s,t;
int st[maxn],pv[maxm],p1[maxm],pf[maxm],tot=1;
inline void side1(int u,int v,int f){
	pv[++tot]=v;
	pf[tot]=f;
	p1[tot]=st[u];
	st[u]=tot;
}
inline void side(int u,int v,int f){
	side1(u,v,f);side1(v,u,0);
}
 
inline void init(){
	n=io;m=io;
	s=n+m*3+1;t=s+1;
	for(int i=1;i<=n;++i){
		int l=io,r=io;
		side(s,i,1);
		if(l)side(i,n+l,1);
		if(r<=m)side(i,n+m+r,1);
	}
	
	int b2=n+m,b3=b2+m;
	for(int i=1;i<m;++i){
		side(n+i+1,n+i,inf);
		side(b2+i,b2+i+1,inf);
	}
	for(int i=1;i<=m;++i){
		side(n+i,b3+i,1);
		side(b2+i,b3+i,1);
		side(b3+i,t,1);
	}
}

int d[maxn],gap[maxn];
inline int sap(int x,int flow){
	if(x==t)return flow;
	int f,rest=flow;
	for(int i=st[x];i;i=p1[i]){
		int v=pv[i];
		if(pf[i]&&d[x]==d[v]+1){
			f=sap(v,pf[i]<rest?pf[i]:rest);
			pf[i]-=f;
			pf[i^1]+=f;
			rest-=f;
			if(!rest||d[s]==t)return flow-rest;
		}
	}
	if(!--gap[d[x]])d[s]=t;
	++gap[++d[x]];
	return flow-rest;
}
 
inline void solve(){
	int ans=n;
	while(d[s]<t)ans-=sap(s,inf);
	printf("%d\n",ans);
}
 
int main(){
	init();
	solve();
	return 0;
}

Compiler output:
a.cc:26:1: error: extended character   is not valid in an identifier
   26 |  
      | ^
a.cc:67:1: error: extended character   is not valid in an identifier
   67 |  
      | ^
a.cc:73:1: error: extended character   is not valid in an identifier
   73 |  
      | ^
a.cc:26:1: error: '\U000000a0' does not name a type
   26 |  
      | ^
a.cc:67:1: error: '\U000000a0' does not name a type
   67 |  
      | ^
a.cc:73:1: error: '\U000000a0' does not name a type
   73 |  
      | ^
Language: C++

#include <cstdio>
#include <string.h>
#include <iostream>
using namespace std;

#define N 810000

int n, m;
int l[N], r[N], tx[N], mi[N], add[N];
int ans;

bool cmp(int x, int y) {
	return l[x] < l[y];
}

void mkt(int k, int q, int h) {
	if (q < h) {
		mkt(k * 2, q, (q + h) / 2);
		mkt(k * 2 + 1, (q + h) / 2 + 1, h);
		mi[k] = min(mi[k * 2], mi[k * 2 + 1]);
	}else {
		mi[k] = m + 1 - q;
	}
}

void modify(int k, int q, int h, int l, int r, int c) {
	if (l <= q && h <= r)
		add[k] += c;
	else {
		if (r <= (q + h) / 2)
			modify(k * 2, q, (q + h) / 2, l, r, c);
		else if ((q + h) / 2 < l)
			modify(k * 2 + 1, (q + h) / 2 + 1, h, l, r, c);
		else
			modify(k * 2, q, (q + h) / 2, l, r, c), modify(k * 2 + 1, (q + h) / 2 + 1, h, l, r, c);
		mi[k] = min(mi[k * 2] + add[k * 2], mi[k * 2 + 1] + add[k * 2 + 1]);
	}
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
		scanf("%d%d", &l[i], &r[i]);
	ans = max(0, n - m);
	ans = - ans;
	for (int i = 1; i <= n; i++)
		tx[i] = i;
	sort(tx + 1, tx + n + 1, cmp);
	mkt(1, 1, m + 1);
	for (int i = 1; i <= n; i++) {
		modify(1, 1, m + 1, 1, r[tx[i]], -1);
		ans = min(ans, l[tx[i]] + mi[1] + add[1]);
		// printf("?? %d %d\n", i, ans);
	}
	printf("%d\n", -ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   48 |         sort(tx + 1, tx + n + 1, cmp);
      |         ^~~~
      |         short
Language: C++

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

const int N = 2e5 + 5;

struct edge {
  int nxt, to;
} e[N];
int fir[N], a[N];

namespace Segment_Tree {
#define mid ((L + R) >> 1)
#define no ID(L, R)
#define lc ID(L, mid)
#define rc ID(mid + 1, R)
  int key[N << 1], lazy[N << 1];
  inline int ID(int L, int R) {return (L + R) | (L != R);}
  inline void PushDown(int L, int R) {
    if (!lazy[no] || L == R) return;
    lazy[lc] += lazy[no];
    lazy[rc] += lazy[no];
    key[lc] += lazy[no];
    key[rc] += lazy[no];
    lazy[no] = 0;
  }
  inline void PushUp(int L, int R) {
    key[no] = max(key[lc], key[rc]);
  }
  inline void Init(int L, int R) {
    lazy[no] = 0;
    if (L == R) {
      key[no] = L;
      return;
    }
    Init(L, mid);
    Init(mid + 1, R);
    PushUp(L, R);
  }
  inline void Add(int L, int R, int l, int r) {
    if (L == l && R == r) {
      key[no] ++;
      lazy[no] ++;
      return;
    }
    PushDown(L, R);
    if (r <= mid) Add(L, mid, l, r);
    else if (l > mid) Add(mid + 1, R, l, r);
    else {
      Add(L, mid, l, mid);
      Add(mid + 1, R, mid + 1, r);
    }
    PushUp(L, R);
  }
  inline int Max(int L, int R, int l, int r) {
    if (L == l && R == r) return key[no];
    PushDown(L, R);
    if (r <= mid) return Max(L, mid, l, r);
    else if (l > mid) return Max(mid + 1, r, l, r);
    else return max(Max(L, mid, l, mid), Max(mid + 1, R, mid + 1, r));
  }
#undef mid
#undef no
#undef lc
#undef rc
}
using namespace Segment_Tree;

int main() {
  int ans = max(0, n - m), n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1, l, r; i <= n; i ++) {
    scanf("%d%d", &l, &r);
    e[i] = (edge){fir[l], r};
    fir[l] = i;
  }
  Segment_Tree::Init(0, m + 1);
  for (int i = 0; i <= m; i ++) {
    for (int j = fir[i]; j; j = e[j].nxt)
      Segment_Tree::Add(0, m + 1, 0, e[j].to);
    ans = max(ans, Segment_Tree::Max(0, m + 1, i + 1, m + 1) - m - i - 1);
  }
  printf("%d\n", ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:20: error: 'n' was not declared in this scope
   70 |   int ans = max(0, n - m), n, m;
      |                    ^
a.cc:70:24: error: 'm' was not declared in this scope; did you mean 'tm'?
   70 |   int ans = max(0, n - m), n, m;
      |                        ^
      |                        tm
Language: C++

#include <iostream> 
#include <cstdio>
#include <algorithm>

using namespace std;

#define For(i , a , b) for (int i = a , _b = b ; i <= _b ; ++i)
#define Ford(i , a  ,b) for (int i = a , _b = b : i >= _b ; --i)
#define Rep(i , n) for (int i = 0 , _n = n ; i < _n ; ++i)
#define sz(A) ((int)A.size())
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)

typedef pair<int , int> pt;
const int maxn = 300000  + 123;
int n, m;
pt a[maxn];

#define fi first
#define se second

void ReadData() {
    cin >> n >> m;
    For(i,1,n) cin >> a[i].first >> a[i].second;
}

bool cmp(pt a, pt b) {
    if (a.second == b.second) return a.first > b.first
    return a.second > b.second;
}

class segmentTree{
public:
    int l[maxn * 4], h[maxn * 4];
    int it[maxn * 4];
    int lazy[maxn * 4];

    void buildTree(const int x, const int lo, const int hi) {
        l[x] = lo; h[x] = hi;
        lazy[x] = 0;
        if (lo == hi) {
            it[x] = lo;
        } else {
            int mid = (lo + hi) >> 1;
            buildTree(LL(x), lo, mid);
            buildTree(RR(x),mid + 1, hi);
            it[x] = min(it[LL(x)], it[RR(x)]);
        }
    } 

    void add(const int x, const int val) {
        it[x] += val;
        lazy[x] += val;
    }

    void pushDown(const int x) {
        if (lazy[x] != 0) {
            add(LL(x), lazy[x]);
            add(RR(x), lazy[x]);
            lazy[x] = 0;
        }
    } 

    void update(const int x, const int u, const int v, const int val) {
        if (l[x] > v || h[x] < u) return;
        if (u <= l[x] && h[x] <= v) {
            add(x,val);
            return;
        }
        pushDown(x);
        update(LL(x),u,v,val);
        update(RR(x),u,v,val);
        it[x] = min(it[LL(x)], it[RR(x)]);
    }
} tree;

void Process() {
    tree.buildTree(1,0,200000);

    int minVal = maxn;
    sort(a + 1, a + 1 + n, cmp);
    For(i,1,n) {
        tree.update(1, a[i].first, 200000, -1);
        minVal = min(minVal, tree.it[1] + m - a[i].second + 1);
    }

    if (minVal >= 0) minVal = 0;
    cout << -minVal << endl; 
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
   // freopen("input.inp" , "r", stdin);
    ReadData();
    Process();

	return 0;

}			

Compiler output:
a.cc: In function 'bool cmp(pt, pt)':
a.cc:28:55: error: expected ';' before 'return'
   28 |     if (a.second == b.second) return a.first > b.first
      |                                                       ^
      |                                                       ;
   29 |     return a.second > b.second;
      |     ~~~~~~
Language: C++

#include <queue>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MN 110000
using namespace std;
struct na{int l,r;}p[MN];
bool cmpl(na a,na b){return a.l==b.l?a.r>b.r:a.l<b.l;}
priority_queue<int,vector<int>,greater<int> > q,_q;
int n,m,mmh;
int main(){
    cin >> n >> m;
    mmh = n;
    for (int i=1;i<=n;i++) cin >> p[i].l >> p[i].r;
    sort(p+1,p+1+n,cmpl);
    for (int i=1;i<=n;i++)
    if (p[i].l==q.size()) q.push(p[i].r),_q.push(q.top()),q.pop();else q.push(p[i].r),mmh--;
    for (int i=q.size()+1;i<=m&&!_q.empty();i++) if (_q.top()<=i) _q.pop(),mmh--;
    printf("%d\n",mmh);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> n >> m;
      |     ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <algorithm>
  +++ |+#include <iostream>
    5 | #define MN 110000
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
typedef pair<LL,LL> P;

const LL MAX_N = 1 << 18;

//セグメント木を持つグローバル配列
LL n;
P dat[2*MAX_N-1];

//初期化
void init(LL n_){
   //簡単のために要素数を2のべき乗に
   n=1;
   while(n<n_) n*=2;
   //全ての値をINT_MAXに
   for(int i=0;i<2*n-1;i++) dat[i]=P(1e7,0);
}

//k番目の値(0-indexed)をaに変更
void update(int k,P p){
   //葉の節点
   k+=n-1;
  dat[k]=p;
  //登りながら更新
  while(k>0){
     k=(k-1)/2;
     dat[k] = min(dat[k*2+1],dat[k*2+2]);
  }
}
//[a,b)の最小値を求める
//後ろの方の引数は、計算の簡単のための引数
//kは節点の番号、l,rはその接点が[l,r)に対応していることを表す
//従って外からはquery(a,b,0,0,nと呼ぶ)
P query(int a,int b,int k=0,int l=0,int r=n){
    //[a,b)と[l,r)が交差しなければINT_MAX
    if(r<=a||b<=l) return P(1e7,0);
    //[a,b)が[l,r)を完全に含んでいればこの接点の値
    if(a<=l&&r<=b) return dat[k];
    else{
       //そうでなければ、2つの子の最小値
       P vl =query(a,b,k*2+1,l,(l+r)/2);
       P vr =query(a,b,k*2+2,(l+r)/2,r);
       return min(vl,vr);
    }
}


int N,M;
int L[250001];
int R[250001];
bool used[250001];
vector<P>v;
vector<LL>que;
int main(){
	cin>>N>>M;
	REP(i,N){
	    cin>>L[i]>>R[i];
	    v.push_back(P(R[i],L[i]));
	    //if(i%1000==0)cout<<i<<endl;
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());

	//初期化
	init(M+10);
	REP(i,M+10){
	    update(i,P(-i,i));
	    used[i]=false;
	    if(i>M){
	       used[i]=true;
	    }
	}
	update(0,P(1e7,0));
        used[0]=true;
        int c=0;
	//Riの大きい方から順に取り出す
	REP(i,N){
	    P q=query(0,v[i].second+1);
	    if(q.first>M){
	       if(used[q.second]==false){
	          int a=0;
	          int b=1/a;
	          return -1;
	       }
	       que.push_back(v[i].first);
	       c++;
	    }else{
	       used[q.second]=true;
	       update(q.second,P(1e7,0));
	    }
	}
	sort(que.begin(),que.end());
	int count=0;
	for(int i=c+1,i<M+1;i++){
	   if(que.size()==count)break;
	   //if(used[i]==false){
	      if(que[count]<=i){
	         count++;
	      }
	   //}
	}
	cout<<max(max(N-M,0),(int)que.size()-count)<<endl;
	return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:100:24: error: expected ';' before '<' token
  100 |         for(int i=c+1,i<M+1;i++){
      |                        ^
      |                        ;
a.cc:100:24: error: expected primary-expression before '<' token
Language: C++

#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

int n,m;
vector<int> l,r;
int match[200000];
bool used[200000];

bool dfs(int v){
  for(int i = 1;i <= l[v];i++){
    int w = match[u];
    if(w < 0){
      match[i] = v;
      return true;
    }
    if(!used[i]){
      used[i] = true;
      bool f = dfs(w);
      used[i] = false;
      if(f){
        match[i] = v;
        return true;
      }
    }
  }
  for(int i = r[v];i <= m;i++){
    int w = match[u];
    if(w < 0){
      match[i] = v;
      return true;
    }
    if(!used[i]){
      used[i] = true;
      bool f = dfs(w);
      used[i] = false;
      if(f){
        match[i] = v;
        return true;
      }
    }
  }
  return false;
}

int bipartite_matching(){
  int res = 0;
  memset(match,-1,sizeof(match));
  memset(used,0,sizeof(used));
  for(int v = 0;v < n;v++){
    if(dfs(v)){
      res++;
    }
  }
  return res;
}

int i,j;
string str;

int main(){
  cin >> n >> m;
  for(int i = 0;i < n;i++){
    int li,ri;
    cin >> li >> ri;
    l.push_back(li);
    r.push_back(ri);
  }
  long long ans = 0;
  cout << n-bipartite_matching() << endl;
}


Compiler output:
a.cc: In function 'bool dfs(int)':
a.cc:14:19: error: 'u' was not declared in this scope
   14 |     int w = match[u];
      |                   ^
a.cc:30:19: error: 'u' was not declared in this scope
   30 |     int w = match[u];
      |                   ^
Language: C++

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m, ans;
pair<int, int> p[200000];
pair<int, int> q[200000];

int main() {
	cin >> n >> m;
	inc(i, n) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		p[i] = MP(r, l + m);
	}
	sort(p, p + n);
	
	int p = 0;
	inc(i, n) {
		int k = max(p + 1, p.FI);
		if(k <= p.SE) { p = k; } else { ans++; }
	}
	
	cout << ans << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: request for member 'first' in 'p', which is of non-class type 'int'
   22 | #define FI first
      |            ^~~~~
a.cc:58:38: note: in expansion of macro 'FI'
   58 |                 int k = max(p + 1, p.FI);
      |                                      ^~
a.cc:23:12: error: request for member 'second' in 'p', which is of non-class type 'int'
   23 | #define SE second
      |            ^~~~~~
a.cc:59:27: note: in expansion of macro 'SE'
   59 |                 if(k <= p.SE) { p = k; } else { ans++; }
      |                           ^~
Language: C++


#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;


typedef long long ll;

struct edge
{
	int v, to;
	int cap, scap;
};

const int M = 1e6 + 7;

int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
vector<edge> e;
vector<int> g[M];
int d[M];
int ptr[M];
int s, t;

bool bfs()
{
	for (int i = 0; i <= t; i++)
	{
		d[i] = -1;
	}
	queue<int> q;
	q.push(s);
	d[s] = 0;
	while (!q.empty())
	{
		int v = q.front();
		q.pop();
		for (auto x : g[v])
		{
			if (e[x].cap > 0 && d[e[x].to] == -1)
			{
				d[e[x].to] = d[v] + 1;
				q.push(e[x].to);
			}
		}
	}
	return d[t] != -1;
}

ll dfs(int v = s, int fl = 1e9)
{
	if (!fl)
	{
		return 0;
	}
	if (v == t)
	{
		return fl;
	}
	for (; ptr[v] < (int) g[v].size(); ptr[v]++)
	{
		int x = g[v][ptr[v]];
		if (e[x].cap > 0 && d[e[x].to] == d[v] + 1)
		{
			ll push = dfs(e[x].to, min(fl, e[x].cap));
			if (push)
			{
				e[x].cap -= push;
				e[x ^ 1].cap += push;
				return push;
			}
		}
	}
	return 0;
}

void add_edge(int v, int to, int cap)
{
	g[v].push_back(e.size());
	e.push_back({v, to, cap, cap});
	g[to].push_back(e.size());
	e.push_back({to, v, 0, 0});
}

int n, m;
vector <int> ind;

void build(int v, int l, int r)
{
	if (r - l == 1)
	{
		ind.push_back(v + n);
	}
	else
	{
		int m = (l + r) / 2;
		add_edge(v + n, n + v * 2 + 1, 1);
		add_edge(v + n, n + v * 2 + 2, 1);
        build(v * 2 + 1, l, m);
		build(v * 2 + 2, m, r);
	}
}

void add(int i, int v, int l, int r, int tl, int tr)
{
	if (tl >= r || tr <= l)
	{
		return;
	}
	if (tl >= l && tr <= r)
	{
		add_edge(i, n + v, 1);
	}
	else
	{
		int tm = (tl + tr) / 2;
		add(i, v * 2 + 1, l, r, tl, tm);
		add(i, v * 2 + 2, l, r, tm, tr);
	}
}

class Main
{
public:
	void solve(std::istream &in, std::ostream &out)
	{
		e.clear();
		for (int i = 0; i < M; i++)
		{
			g[i].clear();
		}
		in >> n >> m;
		ind.clear();
		build(0, 0, m);
        for (int i = 0; i < n; i++)
		{
			int l, r;
			in >> l >> r;
			l--, r--;
            if (l != -1)
			{
				add(i, 0, 0, l + 1, 0, m);
			}
			if (r != m)
			{
				add(i, 0, r, m, 0, m);
			}
		}
		s = ind.back() + 1;
		t = ind.back() + 2;
		for (int i = 0; i < n; i++)
		{
			add_edge(s, i, 1);
		}
        for (int c : ind)
		{
			add_edge(c, t, 1);
		}
		ll ans = 0;
		while (bfs())
		{
			for (int i = 0; i <= t; i++)
			{
				ptr[i] = 0;
			}
			while (ll cur = dfs())
			{
				ans += cur;
			}
		}
		out << n - ans << '\n';
	}
};
 
 

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

bool allLettersAreEqual(string str) {
      for(int i=0; i<str.size(); i++) {
            if(s[i] != s[0]) return false;
      }
      return true;
}

int bruteForce(int N, string str, int max) {
      int res = 1e9;             // max for integer
      for(int i=0; i<N; i++) {      // try out each letter in the string
            char target = str[i];
            string str2 = str;
            int count = 0;


            while(!allLettersAreEqual(str2)) {
                  string str3 = "";
                  for(int i=0; i<str2.size()-1; i++) {
                        if(str2[i] == target || str2[i+1] == target) {
                              str2 += target;
                        }
                        else str3 += str2[i];
                  }
                  str2 = str3;
                  count++;
            }
            res = min(res, count);
      }
            
      return max;
}

int main() {
      string str;
      cin >> str;
      int N = str.length();

      cout << bruteForce(N, str, -1) << endl;
}

Compiler output:
a.cc: In function 'bool allLettersAreEqual(std::string)':
a.cc:7:16: error: 's' was not declared in this scope
    7 |             if(s[i] != s[0]) return false;
      |                ^
Language: C

#include<iostream>
#include<vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
//12:34
int main(){
	string s;
	cin>>s;
	int head,cnt,max,min=s.size();
	for(char c='a';c<='z';c++){
		head=0;
		cnt=0;
		max=0;
		while(head<s.size()){
			if(s[head]==c){
				cnt=0;
			}else{
				cnt+=1;
				if(max<cnt)max=cnt;
			}
			head++;
		}
		if(min>max)min=max;
	}
	cout<<min<<endl;
	return 0;
}

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


#include <iostream>

using namespace std;

int main()
{
    cout<<"Hello World";
    cin >> n;
    int A[2][n], Sum = 0, flag = 0, temp = 0;
    for(int i = 0; i < n; i++){
        cin >> A[0][i];
        Sum += A[0][i];
    }
    
    
    for(int i = 0; i < n; i++){
        if(!flag){
            if(int((Sum - A[0][i])/(n - 1)) >= A[0][i])
                flag = 1;
        }
    }
    
    if(flag == 1)
        cout << "Yes";
    else 
        cout << "No";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'n' was not declared in this scope
    9 |     cin >> n;
      |            ^
a.cc:12:16: error: 'A' was not declared in this scope
   12 |         cin >> A[0][i];
      |                ^
a.cc:19:27: error: 'A' was not declared in this scope
   19 |             if(int((Sum - A[0][i])/(n - 1)) >= A[0][i])
      |                           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main() {
	string str;
	cin >> str;
	bool same = true;
	for (size_t i = 0; i < str.length(); i++)
	{
		if (str[i] != s[0]) same = false;
	}
	if (same) {
		cout << 0 << endl;
	}
	ll ans = 1000;
	for (char c = 'a'; c < 'a' + 26; c++)
	{
		ll cnt = 0;
		bool flag = true;
		string temp = str;
		while (flag && temp.length() > 1) {
			flag = false;
			for (size_t i = 0; i < temp.length() - 1; i++)
			{
				string n;
				if (temp[i] == c || temp[i + 1] == c) {
					temp[i] = c;
				}
				else {
					flag = true;
				}
			}
			temp = temp.substr(0, temp.length() - 1);
			cnt++;
		}
		ans = min(cnt, ans);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:31: error: 's' was not declared in this scope
   18 |                 if (str[i] != s[0]) same = false;
      |                               ^
Language: C++

#include <bits/stdc++.h>
#include<chrono>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
    string s;
    cin >> s;
    priority_queue<int, vector<int>, greater<int>> ans;
    bool same = true;
    rep(i, s.size()-1) {
        if (s[i] != s[i+1]){
            same = false
            break;
        }
    }
    if (same) {
        cout << 0 << endl;
        return 0;
    }
    for (char i = 'a'; i <= 'z'; i++) {
        int count = 0;
        string t = s;
        while (t.size() > 0) {
            string nt;
            bool check = true;
            rep(j, t.size()-1) {
                if (t[j] == i || t[j+1] == i) {
                    nt += i;
                }
                else {
                    nt += t[j];
                    check = false;
                }
            }
            count++;
            t = nt;
            if (check) {
                break;
            }
        }
        ans.push(count);
    }
    cout << ans.top() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: expected ';' before 'break'
   15 |             same = false
      |                         ^
      |                         ;
   16 |             break;
      |             ~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    string s; cin >> s;
    vector<ll> a(26,0);
    ll ans = INF;
    for(int i=0;i<26;i++){
        ll x = -1;
        ll mem = 0;
        char c = 'a' + i;
        for(int j=0;j<(int)(s.size());j++){
            if(s.at(j)==c){
                mem = max(mem,j-(x+1));
                x=j;
            }
        }
        mem=max(mem,(s.size())-(x+1));
        ans = min(ans,mem);
        //cout << c <<" "<<ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'max(ll&, long long unsigned int)'
   25 |         mem=max(mem,(s.size())-(x+1));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
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:25:16: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   25 |         mem=max(mem,(s.size())-(x+1));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
/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:25:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   25 |         mem=max(mem,(s.size())-(x+1));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    cin >> s;
    
    set<char> st;
    for (ll i = 0; i < s.length(); i++) {
        st.insert(s[i]);
    }
    
    if(s.size() == 1) {
        cout << 0 << endl;
        return 0;
    }


    ll ans = 100, cnt;
    for (auto key = st.begin(); key != st.end(); key++) {
        string str = s;
        bool flag = true;
        cbt = 1;

        while (flag) {
            string vacant;
            flag = false;
            for (ll i = 0; i < str.length()-1; i++) {
                if (str[i] == *key || str[i+1] == *key) {
                    vacant += *key;
                } else {
                    vacant += str[i];
                    flag = true;
                }
            }
            if (flag) {
                str = vacant;
                cnt ++;
            }
        }

        ans = min(ans, cnt);
    }


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

Compiler output:
a.cc: In function 'int main()':
a.cc:36:9: error: 'cbt' was not declared in this scope; did you mean 'cnt'?
   36 |         cbt = 1;
      |         ^~~
      |         cnt
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    string s;
    cin >> s;
    ll n=s.size();
    ll ans,mx;]
    ll i,j
    for(i=0;i<n;i++){
        mx=i-1;
        j=i+1;
        while(j<N){
            if(S[i]==S[j])mx=max(j-i,0);
        }
        mx=max(mx,N-1-j);
        ans=min(ans,mx);
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: expected primary-expression before ']' token
   18 |     ll ans,mx;]
      |               ^
a.cc:20:13: error: 'i' was not declared in this scope
   20 |     for(i=0;i<n;i++){
      |             ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    string s;
    cin >> s;
    ll n=s.size();
    ll ans,mx;
    for(i=0;i<n;i++){
        mx=i-1;
        while(j<N){
            if(S[i]==S[j])mx=max(j-i,0);
        }
        mx=max(mx,N-1-j);
        ans=min(ans,mx);
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'i' was not declared in this scope
   19 |     for(i=0;i<n;i++){
      |         ^
a.cc:21:15: error: 'j' was not declared in this scope
   21 |         while(j<N){
      |               ^
a.cc:21:17: error: 'N' was not declared in this scope
   21 |         while(j<N){
      |                 ^
a.cc:22:16: error: 'S' was not declared in this scope
   22 |             if(S[i]==S[j])mx=max(j-i,0);
      |                ^
a.cc:24:19: error: 'N' was not declared in this scope
   24 |         mx=max(mx,N-1-j);
      |                   ^
a.cc:24:23: error: 'j' was not declared in this scope
   24 |         mx=max(mx,N-1-j);
      |                       ^