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

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++)
    cin>>a.at(i);
  sort(a.begin(),a.end());
  if(a.at(0)==a.at(N-1)){
  if(a.at(0)==N-1 || 2*a.at(0)<=N)
    cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }else if(a.at(N-1)-a.at(0)==1){
     int A=a.at(0); int B=a.at(N-1);
    map<int,int>M; M[A]=0; M[B]=0;
    for(int i=0;i<N;i++)
      if(a.at(i)==A)
        M.at(A)++;
    else
      M.at(B)++;
    int k=M.at(A);
    if(B-K<=0)
      cout<<"No"<<endl;
    else{
     if(2*B-k<=N)
       cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
    }
  }else
    cout<<"No"<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:10: error: 'K' was not declared in this scope
   24 |     if(B-K<=0)
      |          ^
Language: C++

n = int(input())
a = list(map(int,input().split()))

a.sort()
if a[-1] - a[0] >= 2:
    print("No")
elif a[-1] - a[0] == 1:
    m = 0
    for x in a:
        if x == a[0]:
            m += 1
        else:
            break
    if  a[-1]-m <= (n-m)//2 and a[-1]-m > 0:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == n-1 or a[0] <= n//2:
        print("Yes")
    else:
        print("No")


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[1000005],T,n;
bool check(int m,int k)
{
//	cout<<m<<' '<<k<<endl;
	if(k==0)	return false;
	if(m/k>1)	return true;
	return false;
}
int main()
{
//	scanf("%d",&T);
//	while(T--)
	{
		memset(a,0,sizeof(a));
		int maxn=0;
		bool flag=0;
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
		{
			int x;
			scanf("%d",&x);
			maxn=max(maxn,x),a[x]++;
			if(x!=maxn&&x!=maxn-1)	flag=1;
		}
		if(flag)	{printf("No\n");continue;}
		if(n==1&&a[0]!=1)	{printf("No\n");continue;}
		if((a[maxn]==n&&maxn==n-1)||(a[maxn]==n&&maxn==1))	{printf("Yes\n");continue;}
		if(check(n-a[maxn-1],maxn-a[maxn-1]))	{printf("Yes\n");continue;}
		printf("No\n");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:49: error: continue statement not within a loop
   27 |                 if(flag)        {printf("No\n");continue;}
      |                                                 ^~~~~~~~
a.cc:28:57: error: continue statement not within a loop
   28 |                 if(n==1&&a[0]!=1)       {printf("No\n");continue;}
      |                                                         ^~~~~~~~
a.cc:29:90: error: continue statement not within a loop
   29 |                 if((a[maxn]==n&&maxn==n-1)||(a[maxn]==n&&maxn==1))      {printf("Yes\n");continue;}
      |                                                                                          ^~~~~~~~
a.cc:30:74: error: continue statement not within a loop
   30 |                 if(check(n-a[maxn-1],maxn-a[maxn-1]))   {printf("Yes\n");continue;}
      |                                                                          ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define Min(x,y)(x<y?x:y)
#define Max(x,y)(x>y?x:y)
#define For(i,x,y)for(i=x;i<=y;i++)
int a[10005],n,mn;
void Subtask()
{
	puts((n/mn>1||mn==n-1?"Yes":"No"));
}
int main()
{
	int t,mx,i,p;
	t=read();
	while(t--)
	{
		cin>>n;
		mn=n+1;
		mx=p=0;
		For(i,1,n)
		{
			cin>>a[i];
			mn=Min(mn,a[i]);
			mx=Max(mx,a[i]);
		}
		if(mn==mx)
		{
			Subtask();
			continue;
		}
		/*cout<<mn<<mx<<endl;*/
		For(i,1,n)p+=a[i]==mn;
		puts((p>=mx||(n-p)/(mx-p)<=1?"No":"Yes"));
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   14 |         t=read();
      |           ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
Language: C++

#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define pc putchar
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
using namespace std;
const int N=10005;
int n,a[N];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);}
void writeln(int x){write(x),hh;}
void writesp(int x){write(x),pc(' ');}
signed main(){
	n=read();
	int mx=0,mn=1e9;
	for(int i=1;i<=n;i++){
		a[i]=read();
		mx=max(mx,a[i]);
		mn=min(mn,a[i]);
	}
	if(mx-mn>1){
		puts("No");
		continue;
	}
	if(mx==mn){
		if(mx<=n/2||mx==n-1) puts("Yes");
		else puts("No");
	}
	else{
		int c1=0,c2=0;
		for(int i=1;i<=n;i++){
			c1+=(a[i]==mn);
			c2+=(a[i]==mx);
		}
		if(mx-c1>=1&&mx-c1<=c2/2) puts("Yes");
		else puts("No");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:17: error: continue statement not within a loop
   30 |                 continue;
      |                 ^~~~~~~~
Language: C++

//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
int n, m;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    //同じ数で一個のグループができたら死
    int maxa=0, mina=INF;
    map<int,int> m;
    for (int i = 0; i < n; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp);
        m[temp]++;
        chmax(maxa,temp);
        chmin(mina,temp);
    }
    sort(ALL(a));
    if(maxa-mina>1)return no,0;
    if(maxa-mina==0){
        if(a[0]==n-1)return yes,0;
        if(n/a[0]>=2){
            return yes,0;
        }
    }
    else{
        if(m[a[n-1]]<2){
            return no,0;
        }
        if(m[a[0]]+m[a[n-1]]/2=<a[n-1]&&m[a[0]]+1>=a[n-1])return yes,0;
    }
    no;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:54:32: error: expected primary-expression before '<' token
   54 |         if(m[a[0]]+m[a[n-1]]/2=<a[n-1]&&m[a[0]]+1>=a[n-1])return yes,0;
      |                                ^
Language: C++

// CODE by Kazhybay Askar

//#include <ext/pb_ds/assoc_cont ainer.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC    optimize("Ofast")
//#pragma GCC    target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define f      first
#define s      second
#define pb     push_back
#define pf     push_front
#define ppb    pop_back
#define ppf    pop_front
#define Speed  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz     size()
#define all(x) x.begin(),x.end()
#define cont   continue
#define r0     return 0
#define endl   '\n'

typedef long long ll;
typedef long double   ld;
typedef pair<ll,ll>   pll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;

const int MAXN  = 5e5  + 7;
const int MOD   = 1e9  + 7;
const int INF   = 1e9  + 7;
const ll  MINF  = 1e18 + 7;
const int EPS   = 1e-6;
const int dx[]  = {0, 0, 1, -1, -1, -1, 1, 1};
const int dy[]  = {1, -1, 0, 0, -1, 1, -1, 1};
const double pi = acos(-1.0);

ll n,a[MAXN],cnt,cntr,cntr1,mx,mn=INF;

void solve(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]==1){
            cnt++;
        }
        if(a[i]==n-1){
            cntr++;
        }
        if(a[i]>n/2){
            cntr1++;
        }
        mx=max(mx,a[i]);
        mn=min(mn,a[i]);
    }
    if(cnt>1 && cnt!=n){
        cout<<"NO";
        return;
    }
    else if(cntr>1 && cntr<n/2){kvh  
        cout<<"NO";
        return;
    }
    else if(cntr==n){
        cout<<"YES";
        return;
    }
    else if(cntr1==n){
        cout<<"NO";
    }
    else cout<<"YES";
}


int main(){
    Speed;
    ll T=1;
    //cin>>T;
    while(T--){
        solve();
    }
    r0;
}




Compiler output:
a.cc: In function 'void solve()':
a.cc:63:33: error: 'kvh' was not declared in this scope
   63 |     else if(cntr>1 && cntr<n/2){kvh
      |                                 ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 123;
int n, a[N], mx = 0, mn = 1e5 + 123;

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		mx = max(mx, a[i]);
		mn = min(mn, a[i]);
	}
	if(mx - mn >= 2){
		cout << "No";
		exit(0);
	}
	if(mx - mn == 0){
		if(n == 3 && a[i] <= 2) cout << "Yes";
		else if(a[i] <= n / 2) cout << "Yes";
		else cout << "No";
		exit(0);
	}
	else{
		cout << "No";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: 'i' was not declared in this scope
   20 |                 if(n == 3 && a[i] <= 2) cout << "Yes";
      |                                ^
Language: C++

using namespace std;
const int N = 1e5 + 11;
int n, a[N], ma; 
int main(){
    cin>>n;
    for(int i = 1;i <= n; i++){
        scanf("%d", &a[i]);
        ma = max(ma, a[i]);
    }
    int dl = 0;
    for(int i = 1;i <= n; i++){
        if(ma - a[i] > 1){
            puts("No");
            return 0;
        }
        else if(ma - a[i])dl++;
    }
    if(dl == 0){
        if(ma == n - 1 || ma * 2 <= n)puts("Yes");
        else puts("No");
    }
    else{
        if(n - dl < 2 * (ma - dl) || ma <= dl) puts("No");
        else puts("Yes");
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin>>n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:7:9: error: 'scanf' was not declared in this scope
    7 |         scanf("%d", &a[i]);
      |         ^~~~~
a.cc:8:14: error: 'max' was not declared in this scope; did you mean 'ma'?
    8 |         ma = max(ma, a[i]);
      |              ^~~
      |              ma
a.cc:13:13: error: 'puts' was not declared in this scope
   13 |             puts("No");
      |             ^~~~
a.cc:19:39: error: 'puts' was not declared in this scope
   19 |         if(ma == n - 1 || ma * 2 <= n)puts("Yes");
      |                                       ^~~~
a.cc:20:14: error: 'puts' was not declared in this scope
   20 |         else puts("No");
      |              ^~~~
a.cc:23:48: error: 'puts' was not declared in this scope
   23 |         if(n - dl < 2 * (ma - dl) || ma <= dl) puts("No");
      |                                                ^~~~
a.cc:24:14: error: 'puts' was not declared in this scope
   24 |         else puts("Yes");
      |              ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
typedef long long ll;
typedef multiset<ll> S;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}

int main(){
    int n;cin>>n;
   vi v(n);
  rep(i,n)cin>>v[i];
  sort(all(v));
  ll a=0,b=0;
  rep(i,n){
    if(v[i]==v[0])a++;
    else if(v[i]==v[0]+1)b++;
    else {
      cout<<"No"<<endl;
      return 0;
    }
  }
  int m=-1;
  if(v[0]!=v[n-1])m++;
    if((v[0]+1-a)*2<=b&&m<v[0]+1-a){
      cout<<"Yes"<<endl;
      return 0;
    }
    if(v[0]==v[n-1]){
      if((v[0]-b)*2<=a&&m<v[0]-b){
        cout<<"Yes"<<endl;
        return 0;
      }
      cout<<"No"<<endl;
}


Compiler output:
a.cc:21:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
      |            ^~~~
a.cc:21:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   21 | bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
      |                    ^~~~
a.cc:22:12: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
      |            ^~~~
a.cc:22:20: warning: use of 'auto' in parameter declaration only available with '-std=c++20' or '-fconcepts'
   22 | bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:24:11: note: to match this '{'
   24 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n;
    cin>>n;
    int a[111111], mx = -INF, mn = INF, mxcnt = 0, mncnt = 0;
    rep(i, n) {
        cin>>a[i];
        chmax(mx, a[i]);
        chmin(mn, a[i]);
    }
    if(mx == mn) {
        if(mx == n - 1 || 2 * mx <= n) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    } else {
      　if(mx - mn > 1) {
            cout<<"No"<<endl;
            return 0;
       }
        rep(i, n) {
            if(a[i] == mx) mxcnt++;
            else mncnt++;
        }
        if(mncnt < mx && 2 * (mx - mncnt) <= mxcnt) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Compiler output:
a.cc:34:7: error: extended character 　 is not valid in an identifier
   34 |       　if(mx - mn > 1) {
      |       ^
a.cc: In function 'int main()':
a.cc:34:7: error: '\U00003000if' was not declared in this scope
   34 |       　if(mx - mn > 1) {
      |       ^~~~
Language: C++

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

const int MAXN = 1e5 + 10;

int n;
int a[MAXN];

int main() {
  	cin >> n;
  	for (int i = 0; i < n; i++)
  		cin >> a[i];
  	sort(a, a + n);
 	
  	int t = n - 2;
  	while (t > 0 && a[t] == a[t + 1])
      	t--;
 	if (a[0] ^ a[t] || (a[t] + 1) ^ a[n - 1] || ((t + 2) ^ a[n - 1] && a[t] ^ a[n - 1]) || )
  		return cout << "No" << '\n', 0;
  	cout << "Yes" << '\n';
  	return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:96: error: expected primary-expression before ')' token
   18 |         if (a[0] ^ a[t] || (a[t] + 1) ^ a[n - 1] || ((t + 2) ^ a[n - 1] && a[t] ^ a[n - 1]) || )
      |                                                                                                ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,k,n) for(int i =k;i<n;i++)
using namespace std;
int main()
{
  int n,m,M;
  cin >> n;
  vector<int>(n)a;
  rep(i,0,n)
  {
    cin >> a[i];
  }
  m=*std::min_element(a.begin(),a.end());
  M=*std::max_element(a.begin(),a.end());
  
  if(M-m>1)
  {
    cout << "No" << endl;
  }
  else
  {
    int c=0;
    rep(i,0,n)
    {
      if(a[i]==m)
      {
        ++c;
      }
    }
   
    if(M==m)
    {
      if(m==n-1||m<=n/2)
      {
        cout << "Yes" << endl;
      }
      else
      {
        cout << "No" << endl;
      }
    }
    else
    {
      if(M>c&&(n-c)/2>=M-c)
      {
        cout << "Yes" << endl;
      }
      else
      {
        cout << "No" << endl;
      }
    }
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected ';' before 'a'
    8 |   vector<int>(n)a;
      |                 ^
      |                 ;
a.cc:11:12: error: 'a' was not declared in this scope
   11 |     cin >> a[i];
      |            ^
a.cc:13:23: error: 'a' was not declared in this scope
   13 |   m=*std::min_element(a.begin(),a.end());
      |                       ^
Language: C++

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  int loop,isTrue=1;
  cin >> a[0];
  int Max=a[0],min=a[0];
  for(loop=1;loop<N;loop++){
    cin >> a[loop];
    if(Max<a[loop]){
      Max=a[loop];
    }else if(Min>a[loop]){
      Min=a[loop];
    }
  }
  if(Max-Min>1){
    isTrue=0;
  }else if(Max-Min){
    int colorable=Max-1;
    //人と完全に違う色を被った猫はMax-1匹以下であることが保証される
    //countの値はcolorable以下でなければならない
    int memberable=N-Max+1;
    //人と同じ色を被った猫はN-Max+1匹以下であることが保証される
    //N-countの値はmemberable以下でなければならない
    int count=0;
    for(loop=0;loop<N;loop++){
      if(a[loop]==Min)
        count++;
    }
    if(colorable<count||memberable<N-count)
      isTrue=0;
  }else{
    if(N-Max!=1&&N/2<Max){
      isTrue=0;
    }
  }
  if(isTrue){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'Min' was not declared in this scope; did you mean 'min'?
   15 |     }else if(Min>a[loop]){
      |              ^~~
      |              min
a.cc:19:10: error: 'Min' was not declared in this scope; did you mean 'min'?
   19 |   if(Max-Min>1){
      |          ^~~
      |          min
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
vector <int> a;
signed main(void){
    int n; cin>>n;
    a.resize(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    bool same = true;
    rep(i,n-1) if(a[i] != a[i+1]) same = false;
    if(abs(a[0] - a[n-1])>=2) cout<<"No"<<endl;
    if(same){
        if(a[i] == n-1 || 2*a[i] <=n) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }else{
        int p = count(all(a), a[0]);
        int q = n-p;
        if(p<a[n-1]&& 2*(a[n-1]-p)<=q) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: 'i' was not declared in this scope
   22 |         if(a[i] == n-1 || 2*a[i] <=n) cout<<"Yes"<<endl;
      |              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,mk,num[100005],cc,bs[100005],col[100005];
bool pp=true,bi[100005];
long long ss;
vector<int>pos;
bool ch(int mm)
{
	int r=mm,rr=0;
	memset(bs,0,sizeof(bs));
	memset(col,0,sizeof(col));
	bool p=true;
	if(pos.size()!=0)
	{
		if(r-aa==0)return false;
		int aa=pos.size();
		for(int i=1;i<=n;i++)
		{
			if(bi[i])continue;
			else
			{
				bs[rr+aa]++;
				col[i]=rr+aa;
				rr++;
				rr%=(r-aa);	
			}
		}
		for(int i=0;i<aa;i++)
		{
			bs[i]++;
			col[pos[i]]=i;
		}
		for(int i=1;i<=n;i++)
		{
			if(bs[col[i]]==1)
			{
				if(num[i]!=r-1)p=false;
			}
			else
			{
				if(num[i]!=r)p=false;	
			}
		}
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			bs[rr]++;
			col[i]=rr;
			rr++;
			rr%=(r);
		}
		for(int i=1;i<=n;i++)
		{
			if(bs[col[i]]==1)
			{
				if(num[i]!=r-1)p=false;
			}
			else
			{
				if(num[i]!=r)p=false;	
			}
		}
	}
	/*for(int i=1;i<=n;i++)
	{
		printf("%d ",col[i]);
	}*/
	return p;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    	scanf("%d",&num[i]);
    	mk=max(num[i],mk);
    	ss+=num[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true;
		if(num[i]<mk-1)pp=false;
	}
	if(ch(mk))
	{
		printf("Yes");
	}
	else
	{
		if(ch(mk+1))
		{
			printf("Yes");
		}
		else
		{
			printf("No");
		}
	}
}

Compiler output:
a.cc: In function 'bool ch(int)':
a.cc:15:22: error: 'aa' was not declared in this scope
   15 |                 if(r-aa==0)return false;
      |                      ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,mk,num[100005],cc,bs[100005],col[100005];
bool pp=true,bi[100005];
long long ss;
vector<int>pos
bool ch(int mm)
{
	int r=mm,rr=0;
	memset(bs,0,sizeof(bs));
	memset(col,0,sizeof(col));
	bool p=true;
	if(pos.size()!=0)
	{
		int aa=pos.size();
		for(int i=1;i<=n;i++)
		{
			if(bi[i])continue;
			else
			{
				bs[rr+aa]++;
				col[i]=rr+aa;
				rr++;
				rr%=(r);	
			}
		}
		for(int i=0;i<aa;i++)
		{
			bs[i]++;
			col[pos[i]]=i;
		}
		for(int i=1;i<=n;i++)
		{
			if(bs[col[i]]==1)
			{
				if(num[i]!=r-1)p=false;
			}
			else
			{
				if(num[i]!=r)p=false;	
			}
		}
	}
	else
	{
		for(int i=1;i<=n;i++)
		{
			bs[rr]++;
			col[i]=rr;
			rr++;
			rr%=(r);
		}
		for(int i=1;i<=n;i++)
		{
			if(bs[col[i]]==1)
			{
				if(num[i]!=r-1)p=false;
			}
			else
			{
				if(num[i]!=r)p=false;	
			}
		}
	}
	return p;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    	scanf("%d",&num[i]);
    	mk=max(num[i],mk);
    	ss+=num[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true;
		if(num[i]<mk-1)pp=false;
	}
	if(ch(mk))
	{
		printf("Yes");
	}
	else
	{
		if(ch(mk+1))
		{
			printf("Yes");
		}
		else
		{
			printf("No");
		}
	}
}

Compiler output:
a.cc:7:1: error: expected initializer before 'bool'
    7 | bool ch(int mm)
      | ^~~~
a.cc: In function 'int main()':
a.cc:78:35: error: 'pos' was not declared in this scope; did you mean 'pow'?
   78 |                 if(num[i]<mk)cc++,pos.push_back(i),bi[i]=true;
      |                                   ^~~
      |                                   pow
a.cc:81:12: error: 'ch' was not declared in this scope; did you mean 'cc'?
   81 |         if(ch(mk))
      |            ^~
      |            cc
Language: C++

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    int amax, amin;
    amax = *max_element(A.begin(), A.end());
    amin = *min_element(A.begin(), A.end());

    //cout << amax << " " << amin << '\n';

    if (amax - amin > 1) cout << "No" << '\n';
    else{
        if (amax == amin){
            if (amax == N-1 or 2 * amax <= N) cout << "Yes" << '\n';
            else cout << "No" << '\n';
        }
        else {
            vector<int> D(amax);
            int alone, not_alone = 0, 0;
            
            for (int i = 0; i < N; i++){
                if (A[i] == amin) alone += 1;
                else not_alone += 1;
            }

            if (alone < amax and 2 * (amax - alone) <= not_alone) cout << "Yes" << '\n';
            else cout << "No" << '\n';
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:39: error: expected unqualified-id before numeric constant
   26 |             int alone, not_alone = 0, 0;
      |                                       ^
Language: C++

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,a,r1,r2,cnt1=1,cnt2;

signed main() {
    cin >> n >> r1, r2 = r1+1;
    rep(i,n-1) {
        cin >> a;
        if (r1 == a) cnt1++;
        else if (r2 == a) cnt2++;
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    if (!cnt2) {
        if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl;
        else cout << "No" << endl;
    } else {
        n -= cnt1;
        r2 -= cnt1;
        if (n == r2 || r2*2 <= n) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}





Compiler output:
a.cc:1:1: error: stray '`' in program
    1 | `#include <bits/stdc++.h>
      | ^
a.cc:1:2: error: stray '#' in program
    1 | `#include <bits/stdc++.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | `#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:24:5: error: 'cin' was not declared in this scope
   24 |     cin >> n >> r1, r2 = r1+1;
      |     ^~~
a.cc:30:13: error: 'cout' was not declared in this scope
   30 |             cout << "No" << endl;
      |             ^~~~
a.cc:30:29: error: 'endl' was not declared in this scope
   30 |             cout << "No" << endl;
      |                             ^~~~
a.cc:35:37: error: 'cout' was not declared in this scope
   35 |         if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl;
      |                                     ^~~~
a.cc:35:54: error: 'endl' was not declared in this scope
   35 |         if (n-1 == r1 || r1*2 <= n) cout << "Yes" << endl;
      |                                                      ^~~~
a.cc:36:14: error: 'cout' was not declared in this scope
   36 |         else cout << "No" << endl;
      |              ^~~~
a.cc:36:30: error: 'endl' was not declared in this scope
   36 |         else cout << "No" << endl;
      |                              ^~~~
a.cc:40:35: error: 'cout' was not declared in this scope
   40 |         if (n == r2 || r2*2 <= n) cout << "Yes" << endl;
      |                                   ^~~~
a.cc:40:52: error: 'endl' was not declared in this scope
   40 |         if (n == r2 || r2*2 <= n) cout << "Yes" << endl;
      |                                                    ^~~~
a.cc:41:14: error: 'cout' was not declared in this scope
   41 |         else cout << "No" << endl;
      |              ^~~~
a.cc:41:30: error: 'endl' was not declared in this scope
   41 |         else cout << "No" << endl;
      |                              ^~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n;
  cin>>n;
  int a[n];
  int min_v=100'000;
  int max_v=0;
  REP(i,n){
    cin>>a[i];
    min_v = min(min_v, a[i]);
    max_v = max(max_v, a[i]);
  }
  if(max_v-min_v>1){
    cout<<"No"<<endl;
    return 0;
  }
  //max_v-min_vは、0か1
  if(max_v==min_v){
    if(1<=max_v && max<=n/2){
      cout<<"Yes"<<endl;
    }else if(max_v==n-1){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    return 0;
  }
  //以下max_v-min_vは、1
  int p=0;//唯一の色の帽子をかぶっている猫の数
  int q;
  REP(i,n){
    if(a[i]==min_v){
      p++;
    }
  }
  q = max_v - p;
  if(n-p>=2*q){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:107:23: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<='
  107 |     if(1<=max_v && max<=n/2){
      |                    ~~~^~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int N; cin >> N;
    int a[100100]; 
    map<int, int> mp;
    rep(i, N) {
        cin >> a[i];
        mp[a[i]] ++;
    }
    if(mp.size() != 1 && mp.size() != 2) No();
    else if(mp.size() == 1) {
        if(a[0] == N - 1) Yes();
        else if(a[0] * 2 <= N) Yes();
        else No();
    }
    else {
        int m[2]; int i = 0;
        for(auto mp : p) {
            m[i] = p.fr; i++;
        }
        if(abs(m[0] - m[1]) > 1) No();
        else {
            int k = max(m[0], m[1]);
            if(mp[k - 1] <= k - 1 && mp[k] >= 2) Yes();
            else No();
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:23: error: 'p' was not declared in this scope
   72 |         for(auto mp : p) {
      |                       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int main() {
    int n;
    cin >> n;
    int a[n];
    int flag = 0;
    rep(i,n)cin >> a[i];
    sort(a,a+n);
    if(a[0]==a[n-1]){
        if(a[0]==n-1)flag=1;
        if(a[0] <= n/2)flag=1;
    }
    if(a[0]+1 == a[n-1]){
        int count = 0;
        rep(i,n){
            if(a[i] == a[0])count++;
        }
        int k = a[n-1];
        n -= count;
        k -= count;
        if(a[0]<count)break;
        if(k <= n/2)flag = 1;
    }

    if(flag>0)yn;
    return 0;
}
 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: break statement not within loop or switch
   35 |         if(a[0]<count)break;
      |                       ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,a[1000005];
int main()
{
    n=read();
    int mn=n+1,mx=0;
    for(int i=1;i<=n;i++)
    {
        a[i]=read();
        mn=min(mn,a[i]);
        mx=max(mx,a[i]);
    }
    if(mx>mn+1){puts("No");return 0;}
    if(mx==mn)
    {
        if(mn==n-1){puts("Yes");return 0;}
        if(2*mn<=n){puts("Yes");return 0;}
        puts("No");return 0;
    }
    else
    {
        int cnt=0;
        for(int i=1;i<=n;i++)cnt+=(a[i]==mn);
        if(mn<cnt){puts("No");return 0;}
        if(n-cnt<2*(mx-cnt)){puts("No");return 0;}
        else{puts("Yes");return 0;}
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:11: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
    6 |     n=read();
      |       ~~~~^~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
a.cc:10:18: error: too few arguments to function 'ssize_t read(int, void*, size_t)'
   10 |         a[i]=read();
      |              ~~~~^~
/usr/include/unistd.h:371:16: note: declared here
  371 | extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
      |                ^~~~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int a = 0, b = 0, cnta = 0, cntb = 0;
  rep(i, N) {
      int x; cin >> x;
      if(a == 0) {
          a = x;
          cnta ++;
          continue;
      }
      if(x == a) {
          cnta ++;
          continue;
      }
      if(x != a) {
          if(b == 0) {
              b = x;
              cntb ++;
              continue;
          }
          if(x == b) {
              cntb ++;
              continue;
          }
          if(x != b) {
              cout << "No\n";
              return 0;
          }
      }
  }
  map<int, int> mp;
  mp[a] = cnta;
  mp[b] = cntb;
  if(b == 0) {
      if(N / 2 >= a || a = N - 1) {
          cout << "Yes\n";
          return 0;
      }
      else {
          cout << "No\n";
          return 0;
      }
  } else {
      if(abs(a - b) != 1) {
          cout << "No\n";
          return 0;
      }
      else {
          int y = min(a, b), z = max(a, b);
          N -= mp[y];
          z -= mp[y];
          if(N / 2 >= z ) {
          cout << "Yes\n";
          return 0;
          }
          else {
          cout << "No\n";
          return 0;
          }
      }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:21: error: lvalue required as left operand of assignment
   77 |       if(N / 2 >= a || a = N - 1) {
      |          ~~~~~~~~~~~^~~~
Language: C++

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

int main(){
  int N;cin>>N;
  map<int, int> table;
  for (int i=0;i<N;++i){
    int a;cin>>a;table[a]++;
  } 
  if(table.size()>2) {cout << "No" << endl;return 0;}
  
  vector<pair<int, iny>> v;
  for (auto p:table){
    int k=p.first;int l=p.second;
    pair<int, int> q=make_pair(k,l);
    v.push_back(q);
  }

  if(table.size()==1){
    if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
    cout << "No" << endl; return 0;
  }

  sort(v.begin(), v.end());

  int k=v[1].first, j=v[0].second;
  if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;}
  cout << "No" << endl;return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'iny' was not declared in this scope; did you mean 'int'?
   12 |   vector<pair<int, iny>> v;
      |                    ^~~
      |                    int
a.cc:12:20: error: template argument 2 is invalid
a.cc:12:23: error: template argument 1 is invalid
   12 |   vector<pair<int, iny>> v;
      |                       ^~
a.cc:12:23: error: template argument 2 is invalid
a.cc:16:7: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   16 |     v.push_back(q);
      |       ^~~~~~~~~
a.cc:20:9: error: invalid types 'int[int]' for array subscript
   20 |     if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
      |         ^
a.cc:20:26: error: invalid types 'int[int]' for array subscript
   20 |     if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
      |                          ^
a.cc:24:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   24 |   sort(v.begin(), v.end());
      |          ^~~~~
a.cc:24:21: error: request for member 'end' in 'v', which is of non-class type 'int'
   24 |   sort(v.begin(), v.end());
      |                     ^~~
a.cc:26:10: error: invalid types 'int[int]' for array subscript
   26 |   int k=v[1].first, j=v[0].second;
      |          ^
a.cc:27:11: error: 'j' was not declared in this scope
   27 |   if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;}
      |           ^
Language: C++

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

int main(){
  int N;cin>>N;
  map<int, int> table;
  for (int i=0;i<N;++i){
    int a;cin>>a;table[a]++;
  } 
  if(table.size()>2) {cout << "No" << endl;return 0;}
  
  vector<int> v;
  for (auto p:table){
    int k=p.first;int l=p.second;
    pair<int, int> q=make_pair(k,l);
    v.push_back(q);
  }

  if(table.size()==1){
    if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
    cout << "No" << endl; return 0;
  }

  sort(v.begin(), v.end());

  int k=v[1].first, j=v[0].second;
  if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;}
  cout << "No" << endl;return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: error: no matching function for call to 'std::vector<int>::push_back(std::pair<int, int>&)'
   16 |     v.push_back(q);
      |     ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:20:13: error: request for member 'first' in 'v.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   20 |     if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
      |             ^~~~~
a.cc:20:30: error: request for member 'first' in 'v.std::vector<int>::operator[](0)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   20 |     if(v[0].first==N-1||v[0].first<=N/2){cout << "Yes" << endl;return 0;}
      |                              ^~~~~
a.cc:26:14: error: request for member 'first' in 'v.std::vector<int>::operator[](1)', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   26 |   int k=v[1].first, j=v[0].second;
      |              ^~~~~
a.cc:27:11: error: 'j' was not declared in this scope
   27 |   if(2*(k-j)<=N-j){cout << "Yes" << endl;return 0;}
      |           ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50005;
int a[100005],n;
int main()
{
    scanf("%d",&n);
    int mx=0;
    int mn=0x3f3f3f3f;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
        mn=min(mn,a[i]);
    }
    if(mx-1>mn)
    {
        printf("No\n");
        return 0;
    }
    if(mx==mn)
    {
        if(mn==n-1)
        {
            printf("Yes\n");
            return 0;
        }
        if(2*mn<=n)
        {
            printf("Yes\n");
            return 0;
        }
        else
        {
            printf("No\n");
            return 0;
        }
    }
    else
    {
        int ant=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==mn)
                ant++;
        }
        if(mn<ant)
        {
            printf("No\n");
            return 0;
        }
        if(n-ant<2*(mx-ant))
        {
            pritnf("No\n");
            return 0;
        }
        else
        {
            printf("Yes\n");
            return 0;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:13: error: 'pritnf' was not declared in this scope; did you mean 'printf'?
   55 |             pritnf("No\n");
      |             ^~~~~~
      |             printf
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50005;
int a[100005],n;
int main()
{
    scanf("%d",&n);
    int mx=0;
    int mn=0x3f3f3f3f;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
        mn=min(mn,a[i]);
    }
    if(mx-1>mn)
    {
        printf("No\n");
        return 0;
    }
    if(mx==mn)
    {
        if(mn==n-1)
        {
            printf("Yes\n");
            return 0;
        }
        if(2*mn<=n)
        {
            printf("Yes\n");
            return 0;
        }
        else
        {
            printf("No\n");
            return 0;
        }
    }
    else
    {
        int ant=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]==mn)
                ant++;
        }
        if(mn<cnt)
        {
            printf("No\n");
            return 0;
        }
        if(n-cnt<2*(mx-cnt))
        {
            pritnf("No\n");
            return 0;
        }
        else
        {
            printf("Yes\n");
            return 0;
        }    
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:15: error: 'cnt' was not declared in this scope; did you mean 'ant'?
   48 |         if(mn<cnt)
      |               ^~~
      |               ant
a.cc:53:14: error: 'cnt' was not declared in this scope; did you mean 'ant'?
   53 |         if(n-cnt<2*(mx-cnt))
      |              ^~~
      |              ant
a.cc:55:13: error: 'pritnf' was not declared in this scope; did you mean 'printf'?
   55 |             pritnf("No\n");
      |             ^~~~~~
      |             printf
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	sort(a.begin(),a.end());
	if(a.at(n-1)-a.at(0)>1) cout << "No" << endl;
	else{
		if(a.at(n-1)-a.at(0)==0){
			if(a.at(0)*2<=n || a.at(0)==n-1 || cnt==a.at(0)) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
		else{
			int cnt=0;
			rep(i,n) if(a.at(i)==a.at(0)) cnt++;
			if(cnt<a.at(n-1) && 2*(a.at(n-1)-cnt)<=n-cnt) cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:60: error: 'cnt' was not declared in this scope; did you mean 'int'?
   20 |                         if(a.at(0)*2<=n || a.at(0)==n-1 || cnt==a.at(0)) cout << "Yes" << endl;
      |                                                            ^~~
      |                                                            int
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

    cin>>n;
    rep(i,n)cin>>a[i];
    if((*max_element(a,a+n))-(*min_element(a,a+n))>=2)Cout("No");
    else{
        if((*max_element(a,a+n))-(*min_element(a,a+n))==0){
            if(a[0]==n-1)Cout("Yes");
            else{
                if(a[i]*2<=n)Cout("Yes");
                else Cout("No");
            }
        }
        else{
            c=1;
            assert(c==0);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:22: error: 'i' was not declared in this scope
   41 |                 if(a[i]*2<=n)Cout("Yes");
      |                      ^
Language: C

#include<stdio.h>
int main() {
	int max=0, min=1000000,maxnum=0,minnum=0;
	int n;
	int s[100005];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &s[i]);
		if (max < s[i])max = s[i];
		if (min > s[i])min = s[i];
	}
	if (max - min >= 2) { printf("No"); return 0; }
	if(max==min&&n<2*max) { printf("No"); return 0; }else if(max == min && n >=2 * max){ printf("Yes"); return 0; }
	for (int i = 0; i < n; i++) {
		
		if (max == s[i])maxnum++;
		if (min == s[i])minnum++;
	}
	if (n - maxnum + 1 <= max && max <= n - maxnum + maxnum / 2) { printf("Yes"); return 0; }
	else {
		printf("Yes")
	}
}

Compiler output:
main.c: In function 'main':
main.c:21:30: error: expected ';' before '}' token
   21 |                 printf("Yes")
      |                              ^
      |                              ;
   22 |         }
      |         ~