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

 
 #include<bits/stdc++.h>

using namespace std;

int maxx=0,minx=100025,c1=0,c2=0,n,x;

int max(int a,int b)
{
	if (a>b) return a;
}
int min(int a,int b)
{
	if (a<b) return a;
}

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) 
	{
		scanf("%d",&x);
		if (maxx=x) {c1++;continue;} 
		if (minx=x) {c2++;continue;} 
		maxx=max(x,maxx);minx=min(x,minx);
		if (maxx=x) c1=1; 
		if (minx=x) c2=1;
	}
	if (maxx-minx>1) cout<<"No";
		else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes";
			else if (maxx=minx+1&&(minx<c2||(maxx-c2)*2>n-c2)) cout<<"Yes";
				else cout<<"No";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:35: error: lvalue required as left operand of assignment
   30 |                 else if (maxx=minx&&c2=n||c2*2<=n) cout<<"Yes";
      |                               ~~~~^~~~
a.cc: In function 'int max(int, int)':
a.cc:11:1: warning: control reaches end of non-void function [-Wreturn-type]
   11 | }
      | ^
a.cc: In function 'int min(int, int)':
a.cc:15:1: warning: control reaches end of non-void function [-Wreturn-type]
   15 | }
      | ^
Language: C++

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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;

signed main(){
    llin(n);
    pl4 p,q;
    p.se=1;
    q.se=1;
    q.fi=-1;
    ll k;
    cin>>p.fi;
    FOR(i,1,n-1){
        cin>>k;
        if(k==p.fi){
            p.se++;
        }else if(k==q.fi){
            q.se++;
        }else if(q.fi==-1){
            q.fi=k;
            if(abs(p.fi-q.fi)!=1){
                sal("No");
                return 0;
            }
        }else{
            sal("No");
            return 0;
        }
    }
    if (q.fi==-1){
        sal((p.fi+1==p.se | p.fi=<p.se/2)?"Yes":"No");
        return 0;
    }
    pl4 b=((p>q)?p:q);
    pl4 s=((p>q)?q:p);
    sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:34: error: expected primary-expression before '<' token
   53 |         sal((p.fi+1==p.se | p.fi=<p.se/2)?"Yes":"No");
      |                                  ^
a.cc:20:23: note: in definition of macro 'sal'
   20 | #define sal(x) cout<<(x)<<endl;
      |                       ^
Language: C++

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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define sal(x) cout<<(x)<<endl;

signed main(){
    llin(n);
    pl4 p,q;
    p.se=0;
    q.se=0;
    ll k;
    cin>>p.fi;
    FOR(i,1,n-1){
        cin>>k;
        if(k==p.fi){
            p.se++;
        }else if(k==q.fi){
            q.se++;
        }else if(q.fi==-1){
            q.fi=k;
            q.se++;
            if(abs(p.fi-q.fi)!=1){
                sal("No");
                return 0;
            }
        }else{
            sal("No");
            return 0;
        }
    }
    if (q.fi=-1){
        sal((s.fi+1==s.se)?"Yes":"No");
        return 0;
    }
    pl4 b=((p>q)?p:q);
    pl4 s=((p>q)?q:p);
    sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:14: error: 's' was not declared in this scope
   48 |         sal((s.fi+1==s.se)?"Yes":"No");
      |              ^
a.cc:20:23: note: in definition of macro 'sal'
   20 | #define sal(x) cout<<(x)<<endl;
      |                       ^
Language: C++

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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define sal(x) cout<<x<<endl

signed main(){
    llin(n);
    pl4 p,q;
    p.se=0;
    q.se=0;
    ll k;
    cin>>p.fi;
    FOR(i,1,n-1){
        cin>>k;
        if(k==p.fi){
            p.se++;
        }else if(k==q.fi){
            q.se++;
        }else if(q.fi==-1){
            q.fi=k;
            q.se++;
            if(abs(p.fi-q.fi)!=1){
                sal("No");
                return 0;
            }
        }else{
            sal("No");
            return 0;
        }
    }
    pl4 b=((p>q)?p:q);
    pl4 s=((p>q)?q:p);
    sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:23: error: invalid operands of types 'const char [3]' and '<unresolved overloaded function type>' to binary 'operator<<'
   20 | #define sal(x) cout<<x<<endl
      |                       ^
a.cc:49:5: note: in expansion of macro 'sal'
   49 |     sal((s.se<=s.fi && s.se+b.se/2>=b.fi)?"Yes":"No");
      |     ^~~
Language: C++

#include<cstdio>
#include<iostream>
#define fi(s) freopen(s,"r",stdin);
#define fo(s) freopen(s,"w",stdout);
using namespace std;
typedef long long ll;
const int N = 1000000 + 5;
ll read() {
	ll x = 0,f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		x = x * 10 + c - '0';
		c = getchar();
	}
	return x * f;
}
int a[N];
int Min,Max,Minjs,Maxjs;a
int main() {
	int n = read();
	Min = N; Max = -1;
	Minjs = Maxjs = 0;
	for(int i = 1;i <= n;++i) {
		a[i] = read();
		Min = min(Min,a[i]); Max = max(Max,a[i]);
	}
	if(Max - Min > 1) {
		puts("No");continue;
	}
	if(Min == Max) {
		if(Min + 1 == n || Min <= (n>>1)) puts("Yes");
		else puts("No");
		continue;
	}
	for(int i = 1;i <= n;++i) {
		if(a[i] == Min) Minjs++;
		if(a[i] == Max) Maxjs++;
	}
	if(Max <= Minjs) {
		puts("No");continue;
	}
	Max -= Minjs;
	if(Max > (Maxjs >> 1) ) {
		puts("No"); continue;
	}
	puts("Yes");
	return 0;
}





Compiler output:
a.cc:21:25: error: 'a' does not name a type
   21 | int Min,Max,Minjs,Maxjs;a
      |                         ^
Language: C++

#include<complex>
#include<cstdio>
using namespace std;
const int N=1e6+7;
int n,minn=0x3f3f3f3f,maxn;
int a[N];
int qread()
{
	int x=0;
	char ch=getchar();
	while(ch<'0' || ch>'9')ch=getchar();
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		a[i]=qread();
		maxn=max(maxn,a[i]);
		minn=min(minn,a[i]);
	}
	if(maxn-minn>=2){puts("Yes");continue;}
	if(maxn==minn && maxn==n-1){puts("No");continue;}
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++)
		if(a[i]==maxn-1)cnt1++;
		else cnt2++;
	int p=maxn-cnt1;
	if(p*2>cnt2 || p<=0)puts("Yes");
	else puts("No");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:38: error: continue statement not within a loop
   24 |         if(maxn-minn>=2){puts("Yes");continue;}
      |                                      ^~~~~~~~
a.cc:25:48: error: continue statement not within a loop
   25 |         if(maxn==minn && maxn==n-1){puts("No");continue;}
      |                                                ^~~~~~~~
Language: C++

#include<iostream>
#include<ctype.h>
#include<cstdio>
#include<algorithm>
using namespace std;
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f|=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return f?-x:x;
}
int a[1000007];
int main(){
// 	freopen("hat.in","r",stdin);
// 	freopen("hat.out","w",stdout);
// 	int T=read();
// 	while(T--){
		int n=read(),maxn=0,x=0,y=0,minn=99999999;
		for(int i=1;i<=n;++i){
			a[i]=read();
			maxn=max(maxn,a[i]);
			minn=min(minn,a[i]);
		}
		if(maxn-minn>1){printf("No\n");return 0;}
		for(int i=1;i<=n;++i)if(a[i]==minn)++x;else ++y;
		if(maxn==minn){
		    if(x==n-1 || x+x<=n)printf("No\n")
		    else printf("Yes\n");return 0;
		}
		if(n-x>maxn+maxn-x-x){printf("No\n");return 0;}
		printf("Yes\n");
// 	}
// 	fclose(stdin);fclose(stdout);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:55: error: expected ';' before 'else'
   27 |                     if(x==n-1 || x+x<=n)printf("No\n")
      |                                                       ^
      |                                                       ;
   28 |                     else printf("Yes\n");return 0;
      |                     ~~~~
Language: C++

#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const int maxn = 1000000 + 10;
int n, maxx, minn, a[maxn];

int main(int argc, char const *argv[])
{
  scanf("%d", &n), maxx = 0, minn = 1e9;
  for(int i = 1; i <= n; ++i)
    scanf("%d", &a[i]), maxx = max(maxx, a[i]), minn = min(minn, a[i]);
  if( maxx - minn > 1 ) {
    printf("No\n"); continue;
  }
  else if( maxx - minn == 0 ) {
    if( 2 * maxx <= n || minn == n - 1 ) printf("Yes\n");
    else printf("No\n");
  }
  else if( maxx - minn == 1 ) {
    int col = 0, x = 0, max_col, min_col, flag = 1;
    for(int i = 1; i <= n; ++i) a[i] == maxx ? ++x : ++col;
    min_col = col + 1, max_col = col + (x >> 1);
    // printf("%d %d\n", max_col, min_col);
    if( min_col > n && max_col < 1 ) flag = flag & 0;
    if( minn + 1 > max_col || minn + 1 < min_col ) flag = flag & 0;
    if( maxx > max_col || maxx < min_col ) flag = flag & 0;
    printf(!flag ? "No\n" : "Yes\n");
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:18:21: error: continue statement not within a loop
   18 |     printf("No\n"); continue;
      |                     ^~~~~~~~
Language: C++

/*
mdzz I once provide a more difficult problem frome this question

consider some obervise facts

let's define 'mx' is the max number and 'mn' is the min number, 'num' is the number of 'mn'

if mx > mn + 1 there is no solution

if mn = mn there should be two stuaiton

	first, all color are different, and num = N - 1
	
	second, all color happen morn than twice , so 2 * mn <= N
	
if mx == mn + 1 , it's also very easy, there still have a obervise fact

	it's says that: all of the mn color are different and the mx color happen at least twice
	
	so we should judge two parts:
		
		first : 2 * (mx - num) <= (N - num)
		
		second : mx - num > 0

if you are interested in this problem, you can think that if there are some people don't say anythings, how shold we judge.
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN = 1e5 + 10, INF = 1e9 + 10;
inline int read() {
	char c = getchar(); int x = 0, f = 1;
	while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * f;
}
int T, N, a[MAXN], mn, mx, num, flag;
int main() {

		N = read();
		for(int i = 1; i <= N; i++) a[i] = read();
		

		mn = -1, mx = -1; num = 0; flag = 0;
		for(int i = 1; i <= N; i++) {
			if(mn == -1) mn = a[i], num = 1;
			else if(a[i] == mn) num++;
			else if(a[i] != mn && ((mx == -1) || (a[i] == mx))) mx = a[i];
			else flag = 1;
		}
		if(flag == 1) {puts("Yes");continue;}
		
		if(mx == -1) mx = mn;
		
		if(mn > mx) swap(mn, mx), num = N - num;
		
		if(mx > mn + 1) {puts("Yes"); continue;}

		if(mn == mx) {
			if(mn == N - 1) puts("No");
			else if(2 * mn <= N && ((mn != 0) || (mn == 0 && N == 1))) puts("No");
			else puts("Yes");
		} else {
			if((2 * (mx - num) <= (N - num)) && (mx > num)) puts("No");
			else puts("Yes");
		}
	
	return 0;
}
/*
3
3
1 2 2 
3 
1 1 2 
5 
4 3 4 3 4 



1
5
2 3 1 1 4 

5
2 2 3 3 3
Yes 
1 2 4 4 4 

1
0


6
3
1 2 2 
3 
1 1 2 
5 
4 3 4 3 4 
5
2 2 3 3 3
1
0
5
0 0 0 0 0 

1


// N Y Y N N
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:53:44: error: continue statement not within a loop
   53 |                 if(flag == 1) {puts("Yes");continue;}
      |                                            ^~~~~~~~
a.cc:59:47: error: continue statement not within a loop
   59 |                 if(mx > mn + 1) {puts("Yes"); continue;}
      |                                               ^~~~~~~~
Language: C

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long maxNum = nums.Max();
    long minNum = nums.Min();
    long minCount = 0;//小さい数の猫の数
    long maxCount = 0;

    for(long i = 0; i < n; i++)
    {
      if(nums[i] == minNum) minCount++;
    }
    maxCount = n - minCount;

    if(maxNum - minNum >= 2) Console.WriteLine("No");
    else if(maxNum - minNum == 0)
    {
      if(maxNum == 1 || maxNum == n-1) Console.WriteLine("Yes");
      else Console.WriteLine("No");
    }else if(maxNum - minNum == 1)
    {
      if(maxCount == 1) Console.WriteLine("No");
      else if(minCount+1 <= maxNum && maxNum <= minCount + (maxCount/2)) Console.WriteLine("Yes");
      else Console.WriteLine("No");
    }

	}
}

Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using System;
      | ^~~~~
main.c:2:1: error: unknown type name 'using'
    2 | using System.Linq;//リストの使用
      | ^~~~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | using System.Linq;//リストの使用
      |             ^
main.c:3:1: error: unknown type name 'using'
    3 | using System.Collections.Generic;
      | ^~~~~
main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | using System.Collections.Generic;
      |             ^
main.c:4:1: error: unknown type name 'class'
    4 | class Program
      | ^~~~~
main.c:5:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    5 | {
      | ^
Language: C++

/*
对于一个来说最多只能去掉一种颜色
所以每个a之间差不能超过1 
*/
#include<map> 
#include<vector> 
#include<cstdio> 
#include<cstring> 
#include<algorithm> 
#define gc getchar()
#define pc putchar 
#define LL long long
inline int read() { 
	int x = 0,f = 1; 
	char c = gc; 
	while(c < '0' || c > '9')c = gc; 
	while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc; 
	return x * f; 
} 
void print(int x) { 
	if(x < 0) { 
		pc('-'); 
		x = -x; 
	} 
	if(x >= 10) print(x / 10); 
	pc(x % 10 + '0'); 
} 

int main() { 
	int n = read(); 
	int mn =  n + 1,mx = -1; 
	for(int q,i = 1;i <= n;++ i) mn = std::min(mn,a),mx = std::max(mx,a); 
	if(mx - mn > 1) { 
		puts("Yes"); 
	} else puts("No"); 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:32:55: error: 'a' was not declared in this scope
   32 |         for(int q,i = 1;i <= n;++ i) mn = std::min(mn,a),mx = std::max(mx,a);
      |                                                       ^
Language: C++

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int a[110000];

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];

    sort(a, a + N);
    if (a[0] == a[N - 1]) {
        if (a[0] + 1 == N || a[0] * 2 <= N)cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    if (a[0] + 1 != a[N - 1]) {
        else cout << "No" << endl;
        return 0;
    }

    int n = 0;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] == a[0]) {a[N - 1]--; n++;}
    }

    if (a[0] > n && a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl;
    else cout << "No" << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: expected '}' before 'else'
   25 |         else cout << "No" << endl;
      |         ^~~~
a.cc:24:31: note: to match this '{'
   24 |     if (a[0] + 1 != a[N - 1]) {
      |                               ^
a.cc: At global scope:
a.cc:30:5: error: expected unqualified-id before 'for'
   30 |     for (int i = 0; i < N - 1; i++) {
      |     ^~~
a.cc:30:21: error: 'i' does not name a type
   30 |     for (int i = 0; i < N - 1; i++) {
      |                     ^
a.cc:30:32: error: 'i' does not name a type
   30 |     for (int i = 0; i < N - 1; i++) {
      |                                ^
a.cc:34:5: error: expected unqualified-id before 'if'
   34 |     if (a[0] > n && a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl;
      |     ^~
a.cc:35:5: error: expected unqualified-id before 'else'
   35 |     else cout << "No" << endl;
      |     ^~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C++

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int a[110000];

signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];

    sort(a, a + N);
    if (a[0] == a[N - 1]) {
        if (a[0] + 1 == N || a[0] * 2 <= N)cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    }
    if (a[0] + 1 != a[N - 1]) {
        else cout << "No" << endl;
        return 0;
    }

    int n = 0;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] == a[0]) {a[N - 1]--; n++;}
    }
    if (a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl;
    else cout << "No" << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: expected '}' before 'else'
   25 |         else cout << "No" << endl;
      |         ^~~~
a.cc:24:31: note: to match this '{'
   24 |     if (a[0] + 1 != a[N - 1]) {
      |                               ^
a.cc: At global scope:
a.cc:30:5: error: expected unqualified-id before 'for'
   30 |     for (int i = 0; i < N - 1; i++) {
      |     ^~~
a.cc:30:21: error: 'i' does not name a type
   30 |     for (int i = 0; i < N - 1; i++) {
      |                     ^
a.cc:30:32: error: 'i' does not name a type
   30 |     for (int i = 0; i < N - 1; i++) {
      |                                ^
a.cc:33:5: error: expected unqualified-id before 'if'
   33 |     if (a[N - 1] != 0 && a[N - 1] * 2 <= N - n)cout << "Yes" << endl;
      |     ^~
a.cc:34:5: error: expected unqualified-id before 'else'
   34 |     else cout << "No" << endl;
      |     ^~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int x,y,i,n,c;
vector <int> a(100010);
cin >> n;
x = 10000000;
y = 0;
for(i=0;i<n;i++){
cin >> a[i];
x = min(x,a[i]);
y = max(y,a[i]);
}
for(i=0;i<n;i++){
    if((y-x)>1){
        cout << "No" << endl;
        return 0;
    }
}
c = 0;
for(i=0;i<n;i++){
    if(a[i]==x){
        c++;
    }
}
if(y>x){
if(x=>c && (n+c)>=2*(x+1)){
    cout << "Yes" << endl;
}else{
    cout << "No" << endl;
}
}else{
    if(n-2*y>=0 || y==(n-1)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:6: error: expected primary-expression before '>' token
   29 | if(x=>c && (n+c)>=2*(x+1)){
      |      ^
Language: C++

#include <bits/stdc++.h>

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 100010;

int n, A[MAXN];
int tot[MAXN];

void wa()
{
	puts("No"); exit(0);
}

int main()
{
	in(n); FOR(i, 1, n) in(A[i]);

	int pos = -1;
	FOR(i, 2, n) if (A[i] != A[1]) pos = i;

	if (pos != -1) {
		if (A[pos] != A[i] + 1 && A[pos] != A[i] - 1) wa();
		FOR(i, pos + 1, n) if (A[i] != A[pos] && A[i] != A[1]) wa();
	}

	if (pos == -1) {
		if (A[1] + 1 != n) {
			if (A[1] * 2 > n) wa();
		}
	}
	else {
		int all = 0;
		if (A[pos] == A[1] + 1) all = A[pos];
		else all = A[1];

		int tot = 0;
		FOR(i, 1, n) if (A[i] == all - 1) tot++;
		if ((all - tot) * 2 + tot > n || n - tot < 2) wa();
	}

	puts("Yes");
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:33: error: 'i' was not declared in this scope
   45 |                 if (A[pos] != A[i] + 1 && A[pos] != A[i] - 1) wa();
      |                                 ^
Language: C++

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)
#define INF 1e9

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1000000000+7;
const int MAX_N=1000;

int main(){
	int n;
	cin>>n;
	int a[n];
	REP(i,n)cin>>a[i];
	sort(a,a+n);
	int small,large;
	REP(i,n){
		if(a[i]==a[0])small++;
		else if(a[i]==a[0]+1)large++;
	}
	string ans;
	if(small+large!=n)ans="No";
	else if(small=n){
		if(n%2==0 && a[0]<=n/2){
			ans="Yes";
		}else if(n%2!=0 && a[0]<n/2+1){
			ans="Yes";
		}else if(a[0]==n-1 &&){
			ans="Yes";
		}else{
			ans="No";
		}
	}else{
		if(small<a[n-1] && large>=2*(a[n-1]-small)){
			ans="Yes";
		}else{
			ans="No";
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:38: error: expected primary-expression before ')' token
   40 |                 }else if(a[0]==n-1 &&){
      |                                      ^
Language: C++

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

#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define EPS (1e-7)
#define INF 1e9

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1000000000+7;
const int MAX_N=1000;

int main(){
	int n;
	cin>>n;
	int a[n];
	REP(i,n)cin>>a[i];
	sort(a,a+n);
	int small,large;
	REP(i,n){
		if(a[i]==a[0])small++;
		else if(a[i]==a[0]+1)large++;
	}
	if(small+large!=n)ans="No";
	else if(small=n){
		if(n%2==0 && a[0]<=n/2){
			ans="Yes";
		}else if(n%2!=0 && a[0]<n/2+1){
			ans="Yes";
		}else if(a[0]==n-1 &&){
			ans="Yes";
		}else{
			ans="No";
		}
	}else{
		if(small<a[n-1] && large>=2*(a[n-1]-small)){
			ans="Yes";
		}else{
			ans="No";
		}
	}
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:27: error: 'ans' was not declared in this scope; did you mean 'abs'?
   33 |         if(small+large!=n)ans="No";
      |                           ^~~
      |                           abs
a.cc:36:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   36 |                         ans="Yes";
      |                         ^~~
      |                         abs
a.cc:38:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |                         ans="Yes";
      |                         ^~~
      |                         abs
a.cc:39:38: error: expected primary-expression before ')' token
   39 |                 }else if(a[0]==n-1 &&){
      |                                      ^
a.cc:40:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |                         ans="Yes";
      |                         ^~~
      |                         abs
a.cc:42:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   42 |                         ans="No";
      |                         ^~~
      |                         abs
a.cc:46:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |                         ans="Yes";
      |                         ^~~
      |                         abs
a.cc:48:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |                         ans="No";
      |                         ^~~
      |                         abs
a.cc:51:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <array>

using namespace std;
const int MAXN = (int)2e5;
array<int, MAXN> arr;

void No() {
    cout << "No" << endl;
    exit(0);
}
void Yes() {
    cout << "Yes" << endl;
    exit(0);
}



int main() {

    int n;
    cin >> n;

    map <int, int> st;


    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        st[arr[i]]++;
    }
    int mn = *min_element(arr.begin(), arr.begin() + n);
    int mx = *max_element(arr.begin(), arr.begin() + n);
    if (st.size() > 2 || (st.size() == 2 && st[mx] == 1)) {
        No();
    }

    if (st.size() == 1 && mn == n - 1) {
        Yes();
    }

    int mnDiff = 1;
    int mxDiff = n / 2;
    if (st.size() != 1) {
        mnDiff = st[mn];
        mxDiff = st[mn] + st[mx] / 2;
    }

    if (mx >= mnDiff && mx <= mxDiff) {
        Yes();
    } else {
        No();
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:15: error: 'min_element' was not declared in this scope
   36 |     int mn = *min_element(arr.begin(), arr.begin() + n);
      |               ^~~~~~~~~~~
a.cc:37:15: error: 'max_element' was not declared in this scope
   37 |     int mx = *max_element(arr.begin(), arr.begin() + n);
      |               ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INF 1e9
int a[100010];
int p,q;
int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  int max=-1,min=INF;
  for(int i=0;i<n;i++){
    if(a[i]>max)max=a[i];
    if(a[i]<min)min=a[i];
  }
  bool flag=false;
  if(max==min){
    if(n==max || n/2>max){
      flag=true;
    }
  }

  for(int i=0;i<n;i++){
    if(a[i]==min)q++;
    else (a[i]==max)p++;
  }
  if(max==min+1){
    if((n==max)&&(max>=p+q/2))flag=true;
  }
  flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:21: error: expected ';' before 'p'
   24 |     else (a[i]==max)p++;
      |                     ^
      |                     ;
a.cc:29:27: error: expected ':' before ';' token
   29 |   flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl;
      |                           ^
      |                           :
a.cc:29:27: error: expected primary-expression before ';' token
a.cc:29:29: error: expected primary-expression before ':' token
   29 |   flag ? cout<<"Yes"<<endl; : cout<<"No"<<endl;
      |                             ^
Language: C++

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

signed main(){
    int n;
    cin >> n;
    int a[n];
    rep(n) cin >> a[i];

    int maxa = *max_element(all(a)), mina = *min_element(all(a));
    if(maxa - mina >= 2){
        cout << "No";
    }else if(maxa - mina == 1){
        if(count(all(a), mina) == 1){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }else{
        if(maxa == n-1 || maxa <= n/2){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   17 | #define all(c) c.begin(), c.end()
      |                  ^~~~~
a.cc:39:29: note: in expansion of macro 'all'
   39 |     int maxa = *max_element(all(a)), mina = *min_element(all(a));
      |                             ^~~
a.cc:17:29: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   17 | #define all(c) c.begin(), c.end()
      |                             ^~~
a.cc:39:29: note: in expansion of macro 'all'
   39 |     int maxa = *max_element(all(a)), mina = *min_element(all(a));
      |                             ^~~
a.cc:40:15: error: 'mina' was not declared in this scope
   40 |     if(maxa - mina >= 2){
      |               ^~~~
a.cc:17:18: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   17 | #define all(c) c.begin(), c.end()
      |                  ^~~~~
a.cc:43:18: note: in expansion of macro 'all'
   43 |         if(count(all(a), mina) == 1){
      |                  ^~~
a.cc:17:29: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   17 | #define all(c) c.begin(), c.end()
      |                             ^~~
a.cc:43:18: note: in expansion of macro 'all'
   43 |         if(count(all(a), mina) == 1){
      |                  ^~~
Language: C++

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

#define cst() int __t;scanf("%d",&__t);while(__t--)
#define rep(i,s,e) for(int i=s;i<e;++i)
#define repb(i,s,e) for(int i=s;i<=e;++i)
#define lep(i,s,e) for(int i=s;i>e;--i)
#define lepb(i,s,e) for(int i=s;i>=e;--i)
#define mst(a,b) memset(a,b,sizeof(a))
#define mcpy(des,sor) memcpy(des,sor,sizeof(sor))
#define pow2(x) ((x)*(x))
#define pt(x) cout<<#x<<"="<<x<<endl;


#define maxn 100006

typedef long long ll;
const int inf = 0x3f3f3f3f;

typedef pair<int,int> pii;

int main()0
{
	int n,a[maxn],ma,mi,si,sa;
	cin>>n;
	ma=0;mi=n;
	repb(i,1,n)
	{
		cin>>a[i];
		ma=max(ma,a[i]);
		mi=min(mi,a[i]);
	}
	if(mi==ma)
	{
		if(a[1]==n-1||2*a[1]<=n)puts("Yes");
		else puts("No");
	}
	else if(mi+1==ma)
	{
		si=sa=0;
		repb(i,1,n)if(a[i]==mi)++si; else ++sa;
		if(si+2*(mi-si+1)<=n&&ma-si>0)puts("Yes");
		else puts("No");
	}
	else puts("No");
}


Compiler output:
a.cc:22:11: error: expected initializer before numeric constant
   22 | int main()0
      |           ^
Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Collections;
import javafx.util.Pair;

public class Main{
    static int[] a = new int[100005];

    public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();

        int mx = 0;
        int mn = 1<<30;
        boolean ok = true;
        for(int i=0;i<n;i++){
            a[i] = in.nextInt();
            mx = Math.max(mx, a[i]);
            mn = Math.min(mn, a[i]);
        }

        if(mx == mn){
            if(mx == n-1 || 2*mx <= n) ok = true;
            else ok = false;
        }
        else if(mx == mn+1){
            int cnt1 = 0, cnt2 = 0;
            for(int i=0;i<n;i++){
                if(a[i] == mx) cnt1++;
                else cnt2++;
            }
            if(cnt2+1 <= mx && mx <= (n+cnt2)/2);
            else ok = false;
        }
        else ok = false;

        if(ok == true) System.out.println("Yes");
        else System.out.println("No");
    }

    static class InputReader{
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream){
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next(){
            while (tokenizer == null || !tokenizer.hasMoreTokens()){
                try{
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e){
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
    }
}


Compiler output:
Main.java:19: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
1 error
Language: Java

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.Collections;
import javafx.util.Pair;

public class B{
    static int[] a = new int[100005];

    public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();

        int mx = 0;
        int mn = 1<<30;
        boolean ok = true;
        for(int i=0;i<n;i++){
            a[i] = in.nextInt();
            mx = Math.max(mx, a[i]);
            mn = Math.min(mn, a[i]);
        }

        if(mx == mn){
            if(mx == n-1 || 2*mx <= n) ok = true;
            else ok = false;
        }
        else if(mx == mn+1){
            int cnt1 = 0, cnt2 = 0;
            for(int i=0;i<n;i++){
                if(a[i] == mx) cnt1++;
                else cnt2++;
            }
            if(cnt2+1 <= mx && mx <= (n+cnt2)/2);
            else ok = false;
        }
        else ok = false;

        if(ok == true) System.out.println("Yes");
        else System.out.println("No");
    }

    static class InputReader{
        public BufferedReader reader;
        public StringTokenizer tokenizer;
        public InputReader(InputStream stream){
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next(){
            while (tokenizer == null || !tokenizer.hasMoreTokens()){
                try{
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e){
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
    }
}


Compiler output:
Main.java:21: error: class B is public, should be declared in a file named B.java
public class B{
       ^
Main.java:19: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
2 errors
Language: C++

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

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

	int nums[N];
	vector<int> a;
	int cur;
	for (int i = 0; i < N; i++) {
		cin >> cur;
		a.push_back(cur);
	}
	sort(a.begin(), a.end());

	if (a[0] == a[a.size()-1]) {
		if (N/a[0] >= 2 || N == a[0]+1) {
			cout << "Yes" << endl;
		}
		else cout << "No" << endl;
	}
	else {
		if (a[a.size()-1]!=a[0]+1) {
			cout << "No" << endl;
		}
		else {
			int t1 = 0, t2 = 0;
			for (int i = 0; i < N; i++) {
				if (a[i] == a[0]) t1++;
				else t2++;
			}
			if (a[a.size()-1] == t1+1 && a[0] == t1) {
				if (t/(y-x) >= 2) cout << "Yes" << endl;
				else cout << "No" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
	}
	// cin >> N;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:37: error: 't' was not declared in this scope; did you mean 't2'?
   36 |                                 if (t/(y-x) >= 2) cout << "Yes" << endl;
      |                                     ^
      |                                     t2
a.cc:36:40: error: 'y' was not declared in this scope
   36 |                                 if (t/(y-x) >= 2) cout << "Yes" << endl;
      |                                        ^
a.cc:36:42: error: 'x' was not declared in this scope
   36 |                                 if (t/(y-x) >= 2) cout << "Yes" << endl;
      |                                          ^
Language: C++

def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n=0,d=0) Array.new(n,d)end
def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end
def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
n = inp[0]
t = inp
dd=t[0]
 
 
max = t.max
min = t.min
minc = t.count(min)
maxc = t.count(max)
 
  if(max - min >= 2)
    puts "No"
    exit
  end
 
if(max == min)
  if(n == (min+1))
    puts "Yes"
    exit
  end
  g = 2*min
  if(t.count(max) >= g)
     puts "Yes"
  else
     puts "No"
  end
end
if(max != min)

  c = max - minc
  g = 2*c
  if(g <= 1)
    puts "No"
    exit
  end
  if(t.count(max) >= g)
     puts "No"
  else
     puts "Yes"
  end
   exit
end

Compiler output:
a.cc:5:28: error: too many decimal points in number
    5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
      |                            ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
      | ^~~
a.cc:6:29: error: 'a' does not name a type
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                             ^
a.cc:6:48: error: expected unqualified-id before 'return'
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                                                ^~~~~~
a.cc:8:50: error: 'end' does not name a type
    8 | def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end
      |                                                  ^~~
a.cc:9:68: error: 'end' does not name a type
    9 | def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
      |                                                                    ^~~
Language: C++

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

using namespace std;

int a;
int a_n[100001];
int N;
int main() {
  cin >> N;
  
  int MIN = 1000000;
  int MAX = 0;
  
  for(int i = 0; i < N; i++) {
    int a;
    cin >> a;
    a_n[a]++;
    MIN = min(MIN,a);
    MAX = max(MAX,a);
  }

  if(MAX - MIN > 1) {
    cout <<"No" <<endl; return 0;
  }

  if(MAX == MIN) {
    if(MAX == N - 1 || MAX <= N / 2) {
      cout << "Yes" <<endl;
      return 0;
    }
  }

   if(MAX - MIN == 1) {
     if(a_n[MIN] > MIN) {
       cout << "No" <<endl;
       return 0;
     }
     if(a_n[MAX] >= 2 * (MAX - a_n[MIN])) {
      cout << "Yes" <<endl;
      return 0;
    }
   }
   cout << "No" <<endl;
}
  

  


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | h#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'h' does not name a type
    1 | h#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> N;
      |   ^~~
a.cc:18:11: error: 'min' was not declared in this scope; did you mean 'main'?
   18 |     MIN = min(MIN,a);
      |           ^~~
      |           main
a.cc:19:11: error: 'max' was not declared in this scope
   19 |     MAX = max(MAX,a);
      |           ^~~
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout <<"No" <<endl; return 0;
      |     ^~~~
a.cc:23:19: error: 'endl' was not declared in this scope
   23 |     cout <<"No" <<endl; return 0;
      |                   ^~~~
a.cc:28:7: error: 'cout' was not declared in this scope
   28 |       cout << "Yes" <<endl;
      |       ^~~~
a.cc:28:23: error: 'endl' was not declared in this scope
   28 |       cout << "Yes" <<endl;
      |                       ^~~~
a.cc:35:8: error: 'cout' was not declared in this scope
   35 |        cout << "No" <<endl;
      |        ^~~~
a.cc:35:23: error: 'endl' was not declared in this scope
   35 |        cout << "No" <<endl;
      |                       ^~~~
a.cc:39:7: error: 'cout' was not declared in this scope
   39 |       cout << "Yes" <<endl;
      |       ^~~~
a.cc:39:23: error: 'endl' was not declared in this scope
   39 |       cout << "Yes" <<endl;
      |                       ^~~~
a.cc:43:4: error: 'cout' was not declared in this scope
   43 |    cout << "No" <<endl;
      |    ^~~~
a.cc:43:19: error: 'endl' was not declared in this scope
   43 |    cout << "No" <<endl;
      |                   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool ok[1000000];

int main(){
int n,cont3=0;
cin>>n;
int v[n],val[2];
val[0]=val[1]=0;
for(int i=0;i<n;i++){
	cin>>v[i];
	if(ok[v[i]]==false){
		ok[v[i]]=true;
		val[cont3]=v[i];
		cont3++;
		if(cont3==3){
			cout<<"No"<<endl;
			return 0;
		}
	}
}

if(cont==1){
	if(n==val[0]+1||n>=val[0]*2)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}
else{
	int cont=0,cont1=0;
	if(val[0]>val[1])
	swap(val[0],val[1]);
	
	for(int i=0;i<n;i++){
		if(v[i]==val[0])
		cont++;
		else
		cont1++;
	}
	if(cont1!=1&&val[1]<=cont+(cont1/2))
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	
}

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:4: error: 'cont' was not declared in this scope; did you mean 'cont3'?
   23 | if(cont==1){
      |    ^~~~
      |    cont3
a.cc:30:13: error: redeclaration of 'int cont'
   30 |         int cont=0,cont1=0;
      |             ^~~~
a.cc:23:4: note: '<typeprefixerror>cont' previously declared here
   23 | if(cont==1){
      |    ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	int m(INF);
	int cnt(0);
	vector<int> v(N); rep(i, 0, N) { cin >> v[i]; }
	int m = *min_element(all(v));
	int M = *max_element(all(v));
	if (M - m > 1) {
		cout << "No" << endl;
	}
	else if(M-m==0) {
		if (m <= N / 2 || m == N - 1)cout << "Yes" << endl;
		else cout << "No" << endl;
		
	}
	else {
		int p(0), q(0);
		rep(i, 0, N)if (v[i] == M)q++;
		p = N - q;
		if (M <= p + q / 2)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: redeclaration of 'int m'
   26 |         int m = *min_element(all(v));
      |             ^
a.cc:23:13: note: 'int m' previously declared here
   23 |         int m(INF);
      |             ^
Language: C++

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

int main(){
  int n;
  std::cin >> n;
  vector<int> a(n);
  int mini = 1e9, maxi = 0, sum = 0;
  for (int i = 0; i < n; i++){
    std::cin >> a[i];
    maxi = max(maxi, a[i]);
    mini = min(mini, a[i]);
    sum += a[i];
  }
  if(maxi - mini > 1){
    std::cout << "No" << std::endl;
    return 0;
  }
  if(maxi == mini){
    if(n - maxi == 1 or n <= n/2){
      std::cout << "Yes" << std::endl;
    }else{
      std::cout << "No" << std::endl;
    }
  }else{
    int p = 0, q = 0;
    for (int i = 0; i < n; i++) {
      p += a[i] == mini;
      q += a[i] == maxi;
    }
    if(x + 1 >= p + 2*q){
      std::cout << "Yes" << std::endl;
    }else{
      std::cout << "No" << std::endl;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:8: error: 'x' was not declared in this scope
   33 |     if(x + 1 >= p + 2*q){
      |        ^
Language: C++

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  vector<ll> v;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a);
  }
  sort(all(v));
  if(v[0]==v[n-1]){
    if(v[0]>0&&v[0]<n){
      cout << "Yes" << endl;
      return 0;
    }  
    else{
      cout << "No" << endl;
      retunr0 ;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:7: error: 'retunr0' was not declared in this scope
   57 |       retunr0 ;
      |       ^~~~~~~
Language: C

#include <stdio.h>
#include<math.h>
int main(void){
    int N;
    scanf("%d",&N);
    int a,b,anum,bnum;
    a=0;b=0;anum=1;bnum=0;
    int make=0;
    scanf("%d",&a);
    for(int i=1;i<N;i++){
        scanf("%d",&kari);if(b==0&&kari!=a)b=kari;
        if(kari==a)anum++;
        else if(kari==b)bnum++;
        else {printf("No");make=1;}
    }
    if(make==0&&abs(a-b)>1&&b!=0){printf("No");make=1;}
    if(a-b==1&&b!=0){
        if(anum>=b*2&&make==0)printf("Yes");
        else if(make==0&&anum==b+1)printf("Yes");
        else if(make==0)printf("No");
    }
    if(b-a==1){
        if(bnum>=a*2&&make==0)printf("Yes");
        else if(make==0&&bnum==a+1)printf("Yes");
        else if(make==0)printf("No");
    }
    if(b==0){if(anum>=a*2&&make==0)printf("Yes");
        else if(make==0&&anum==a+1)printf("Yes");
        else if(make==0)printf("No");
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:21: error: 'kari' undeclared (first use in this function)
   11 |         scanf("%d",&kari);if(b==0&&kari!=a)b=kari;
      |                     ^~~~
main.c:11:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:17: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   16 |     if(make==0&&abs(a-b)>1&&b!=0){printf("No");make=1;}
      |                 ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | int main(void){