stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)

#define REP(i,a) FOR(i,0,a)

	

using namespace std;



const int MAX_N=1e5;



int N,A[MAX_N];



int main(){

	cin>>N;

	int mx=0,mn=N;

	REP(i,N){

		cin>>A[i];

		mx=max(mx,A[i]);

		mn=min(mn,A[i]);

	}

	bool flg;

	if (mx-mn>1){

		flg=false;

	}else if (mx==mn){

		if (A[0]==N-1 || A[0]<=N/2){

			flg=true;

		}else{

			flg=false;

		}

	}else{

		int n1=0,n2=0;

		REP(i,N){

			if (A[i]==mx){

				n1++;

			}else{

				n2++;

			}

		}

		if (mx-n2>0 && mx-n2<=n1/2){

			flg=true;

		}else{

			flg=false;

		}

	}

	cout<<(flg ? "Yes"  : "No")<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#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("No");return 0;;}

	if(maxn==minn)

	{

		if(minn==n-1)puts("Yes");

		else if(2*minn<=n)puts("Yes");

		else puts("No");

		return 0;

	}

	int cnt=0;

	for(int i=1;i<=n;i++)

		cnt+=a[i]==minn;

	if(minn<cnt)puts("No");

	else if(n-cnt<2*(maxn-cnt))puts("No");

	else puts("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int n;

int a[100100];

int ma,mi=0x3f3f3f3f;

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;++i)scanf("%d",&a[i]),ma=max(ma,a[i]),mi=min(mi,a[i]);

	if(ma-mi>=2)

	{

		puts("No");

		return 0;

	}

	int c=0;

	if(ma==mi)

	{

		if(mi==n-1||mi*2<=n)

			puts("Yes");

		else puts("No");

	}

	else

	{

		for(int i=1;i<=n;++i)

			if(a[i]==mi)c++;

		if(2*(mi+1-c)>n-c||ma-c<=0)

			puts("No");

		else puts("Yes");

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#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("No");return 0;;}

	if(maxn==minn)

	{

		if(minn==n-1)puts("Yes");

		else if(2*minn<=n)puts("Yes");

		else puts("No");

		return 0;

	}

	int cnt=0;

	for(int i=1;i<=n;i++)

		cnt+=a[i]==minn;

	if(minn<cnt)puts("No");

	else if(n-cnt<2*(maxn-cnt))puts("No");

	else puts("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <string>

#include <ctype.h>

#include <stdio.h>

#include <string.h>

#include <iostream>

#include <algorithm>

const int inf = 0x3f3f3f3f;

char buf[(1 << 22)], *p1 = buf, *p2 = buf;

#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)

inline int read() {

    char c = getchar(); int x = 0;

    for (;not isdigit(c); c = getchar());

    for (;isdigit(c); x = x * 10 + c - '0', c = getchar());

    return x;

}



int main () {

    int T;

    // T = read();/

    T = 1;

    while (T--) {

        int n; bool flag = 0;

        n = read();

        int Min = inf, Max = 0;

        int sizMi = 0, sizMa = 0;

        for (int i = 1, tmp; i <= n; i += 1) {

            tmp = read();

            Min = tmp < Min ? sizMi = 0, tmp : Min;

            Max = tmp > Max ? sizMa = 0, tmp : Max;

            sizMi += tmp == Min ? 1 : 0, sizMa += tmp == Max ? 1 : 0;

        }

        if (Min == Max and Min == n - 1) {

        	printf("Yes\n");

        	continue;

        }

        if (Min == Max) sizMi = 0;

        int ZhiShao = sizMi + 1;

        int ZhiDuo = sizMa / 2 + sizMi;

        if (Max < ZhiShao or Max > ZhiDuo) flag = true;

        if (Min < Max - 1) flag = true;

        printf("%s\n", not flag ? "Yes" : "No");

    }

    return 0;

}



/*

analyse:

    If a_max > a_min + 1, it must be false;

    If a_i = a_j - 1, means Size_a_i = 1, Size_a_j > 1, Col_a_i not equal Col_a_j;

    If a_i = a_j, means Size_a_i = 1 and Size_a_j = 1 or Size_a_i > 1 and Size_a_j > 1;

    

    All in all, 

    Note the num of the a_min is A, the num of the a_max if B;

    If n - A < B, is must be false;

*/


// Optimized solution to the same problem (faster):
#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("No");return 0;;}

	if(maxn==minn)

	{

		if(minn==n-1)puts("Yes");

		else if(2*minn<=n)puts("Yes");

		else puts("No");

		return 0;

	}

	int cnt=0;

	for(int i=1;i<=n;i++)

		cnt+=a[i]==minn;

	if(minn<cnt)puts("No");

	else if(n-cnt<2*(maxn-cnt))puts("No");

	else puts("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

#include<cmath>

#include<cstdio>

#include<algorithm>

using namespace std;

const int maxn=100010,inf=1000000000;

int n,a[maxn],maxa,mina,tot;

int main(){

	cin>>n;mina=inf;

	for(int i=1;i<=n;++i){

		scanf("%d",&a[i]);

		maxa=max(maxa,a[i]);

		if(a[i]<mina)mina=a[i],tot=0;

		if(a[i]==mina)tot++;

	}

	//cout<<mina<<' '<<tot<<' '<<maxa<<endl;

	if(maxa-mina>1)puts("No");

	else{

		if(maxa==mina){

			if(maxa<=n/2||maxa==n-1)puts("Yes");

			else puts("No");

		}

		else{

			if((maxa-tot>0)&&(maxa-tot)<=(n-tot)/2)puts("Yes");

			else puts("No");

		}

	}

	//system("pause");

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

 

using namespace std;

using namespace __gnu_pbds;

 

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define fbo find_by_order

#define ook order_of_key

 

typedef long long ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef long double ld; 

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

typedef set<ll>::iterator sit;

typedef map<ll,ll>::iterator mit;



int a[100001];



int main()

{

	ios_base::sync_with_stdio(0); cin.tie(0);

	int n; cin>>n;

	int mini=n;

	int maxi=0;

	for(int i=0;i<n;i++) 

	{

		cin>>a[i];

		mini=min(mini,a[i]);

		maxi=max(maxi,a[i]);

	}

	if(maxi-mini<=1)

	{

		int s = 0; int b = 0;

		for(int i=0;i<n;i++)

		{

			if(a[i]==maxi)

			{

				b++;

			}

			else if(a[i]==maxi-1)

			{

				s++;

			}

		}

		if(b==1)

		{

			cout<<"No\n";

			return 0;

		}

		if(s==0&&maxi==n-1)

		{

			cout<<"Yes\n";

			return 0;

		}

		//from here b >= 2

		//there must be s extra unique colors

		//n - s

		int l = s + 1;

		int r = s + (n-s)/2;

		if(maxi>=l&&maxi<=r) cout<<"Yes\n";

		else cout<<"No\n";

	}

	else

	{

		cout<<"No\n";

	}

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int a[1000000],n;

bool same(int *a,int n)

{

    for(int i=1;i<n;i++)

    {

        if(a[i]!=a[0]) return false;

    }

    return true;

}

bool dekhao(int *a,int n,int total,int mn,int mx)

{

    int col[total],now=n;

    memset(col,0,sizeof col);

    for(int i=0;i<total;i++)

    {

        if(a[i]==mn)

        {

            col[i]++;

            now--;

        }

        else

        {

            int baki=total-i-1;

             baki=baki*2;

            col[i]=now-baki;

            now-=col[i];

            if(col[i]<=0) return false;

        }

    }

    int prev=0,cs=0;

    for(int i=0;i<total;i++)

    {

        cs+=col[i];

        for(int j=prev;j<cs;j++)

        {

            if(a[j]!=(total-1)+(col[i]>1))

                return false;

        }

        prev=cs;



    }

    return (now==0)&&true;

}





main()

{



    cin>>n;

    for(int i=0;i<n;i++)

    {

        cin>>a[i];

    }

    sort(a,a+n);

    int mn=a[0],mx=a[n-1];

    if(mx-mn>1)

    {

        cout<<"No";return 0;

    }



    if(!same(a,n))

    {

        cout<<((dekhao(a,n,mx,mn,mx))?"Yes":"No");

        return 0;

    }

    else

    {

        if(n==mn+1)

        {

            cout<<"Yes";return 0;

        }

        else if(n<=mn)

        {

            cout<<"No";

            return 0;

        }

        else if(n>=2*mn)

        {

            cout<<"Yes";return 0;

        }

        else

        {

            cout<<"No";

            return 0;

        }

    }



}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <cmath>

#define ll long long

#define rep(i, a, b) for(int i = (a); i <= (b); i++)

#define per(i, b, a) for(int i = (b); i >= (a); i--)

using namespace std;

const int N = 1e5 + 9, inf = 0x3f3f3f3f;

int n, minn = inf, maxx, sum, a[N];

int main(){

    scanf("%d", &n);

    rep(i, 1, n) {

        scanf("%d", &a[i]);

        minn = min(minn, a[i]), maxx = max(maxx, a[i]);

    }

    rep(i, 1, n) if(a[i] != minn && a[i] != maxx) {

        printf("No\n");

        return 0;

    }

    if(minn == n - 1 && maxx == n - 1){

        printf("Yes\n");

        return 0;

    }

    if(minn == maxx){

        if(minn <= n / 2) printf("Yes\n");

        else printf("No\n");

        return 0;

    }

    rep(i, 1, n) if(a[i] == minn) sum++;

    //cout << maxx << " " << minn << " " << sum << endl;

    if(maxx != minn + 1 || maxx <= sum || maxx > (n - sum) / 2 + sum) printf("No\n");

    else printf("Yes\n");

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
// ~maqsat~



// #pragma GCC target ("avx2")

// #pragma GCC optimize ("Ofast")

// #pragma GCC optimize ("unroll-loops")



#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#include <ext/rope>



#define F first

#define S second

#define in insert

#define pb push_back

#define eb emplace_back

#define sz(x) int(x.size())

#define all(x) x.begin(), x.end()

#define count1 __builtin_popcountl

#define debug(x) cerr << (#x) << " = " << (x) << "\n"

#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)

#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

#define ever ;;



using namespace std;

using namespace __gnu_pbds;

using namespace __gnu_cxx;



using ll = long long;

using ull = unsigned long long;

// using big = __int128_t; // -10^38...10^38

using db = double;

using ld = long double;

typedef pair<int,int> ii;

typedef pair<ll,ll> pll;



template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> inline void cmin(T &a, T b) { a = min(a, b); }

template <class T> inline void cmax(T &a, T b) { a = max(a, b); }



const int oo = 0x3f3f3f3f;

const ll N = 1e5 + 123;

const ll MOD = 1e9 + 7;

const ll INF = 1e15 + 9;

const db EPS = 1e-9;

const db PI = acos(-1); // 3.14159265358979323846

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

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



main() {

#ifdef ziel

	freopen("input.in", "r", stdin);

#else

	fre("");

#endif

	ACCELERATE;



	int n;

	cin >> n;



	int a[N];



	int mn = n * 2, mx = -1;

	for (int i = 0; i < n; i++) {

		cin >> a[i];

		cmin(mn, a[i]);

		cmax(mx, a[i]);

	}



	if (mn == mx) {

		if (mn == n - 1) cout << "Yes";

		else if (2 * mx <= n) cout << "Yes";

		else cout << "No";

		return 0;

	}

	else if (mn + 1 == mx) {

		int x = 0, y = 0;

		for (int i = 0; i < n; i++) {

			if (a[i] == mn) x++;

			else y++;

		}



		if (mx > x && x + y / 2 >= mx) cout << "Yes";

		else cout << "No";

		return 0;

	}

	else {

		cout << "No";

		return 0;

	}

	

	return 0;

}

/*

 

*/


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int N=5; 

int read(){

	int f=1,s=0;char c=getchar();

	for(;c<'0'||c>'9';c=getchar())if(c=='0')f=-1;

	for(;c>='0'&&c<='9';c=getchar())s=s*10+c-48;

	return f*s; 

}

const int oo=0x3f3f3f3f;

map<int,int>a;

bool work(){

	int n=read();

    for(int i=1;i<=n;i++)

    	a[read()]++;

    if(a.size()>2)return false;

	int m=a.begin()->first;

    if(a.size()==1){    	

    	if(m==n-1||m+m<=n)return true;

    	else return false;

	}

	if(a.rbegin()->first-a.begin()->first>1)return false;

	if(a.begin()->second<=m&&(m+1-a.begin()->second)*2<=n-a.begin()->second)return true;

	else return false;

}

int main(){

    if(work())printf("Yes");

    else printf("No");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

int a[100005];

int cnt[2][100005];

int main(){

	int n;

	scanf("%d",&n);

	for(int i=1;i<=n;i++){

		scanf("%d",&a[i]);

		cnt[0][a[i]]++;

		cnt[1][a[i]]++;

	}

	int ok=0,sum;

	int remain;

	sum=n-1;

	remain=n-1-a[1];

	cnt[0][a[1]]-=1;

	if(remain>=0&&cnt[0][a[1]]>=remain){

		sum-=remain;

		cnt[0][a[1]]-=remain;

		remain+=1;

		if(cnt[0][a[1]-1]+cnt[0][a[1]]==sum&&cnt[0][a[1]]<=remain&&cnt[0][a[1]]>0){

			ok=1;

			//printf("!\n");

		}

	}

	

	sum=n-1;

	remain=n-1-a[1];

	cnt[1][a[1]]-=1;

	if(remain>=0&&cnt[1][a[1]+1]>=remain){

		sum-=remain;

		cnt[1][a[1]+1]-=remain;

		if(cnt[1][a[1]+1]+cnt[1][a[1]]==sum&&cnt[1][a[1]+1]<=remain&&(cnt[1][a[1]+1]>0&&remain>0||cnt[1][a[1]+1]==0&&remain==0)){

			ok=1;

			//printf("?\n");

		}

	}

	

	if(ok)

		printf("Yes\n");

	else

		printf("No\n");

	

	

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

#define ull unsinged long long

#define ld long double

#define mem(a,b) memset(a,b,sizeof(a))

#define inf (1LL<<62)

#define sf scanf

#define pf printf

#define repi(i,a,b) for(int i=a;i<=b;++i)

#define rep(i,a,b) for(ll i=a;i<=b;++i)

#define depi(i,a,b) for(int i=a;i>=b;--i)

#define dep(i,a,b) for(ll i=a;i>=b;--i)

#define mod 1000000007



using namespace std;



int ans[100005];



int main()

{

    //std::ios::sync_with_stdio(false);

    int n,k,q,s;

    mem(ans,0);

    sf("%d%d%d",&n,&k,&q);

    int m=q-k;

    for(int i=1;i<=q;++i)

    {

        sf("%d",&s);

        ++ans[s];

    }

    for(int i=1;i<=n;++i)

    {

        if(ans[i]<=m)

            pf("No\n");

        else

            pf("Yes\n");

    }



    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,k,q,i,j;

	scanf("%d %d %d",&n,&k,&q);

	int a[n],b[q];

	for(i=0;i<n;i++){

		a[i]=k;

	}

	for(i=0;i<q;i++){

		scanf("%d",&b[i]);

	}

	for(i=0;i<q;i++){

		a[b[i]-1]=a[b[i]-1]+1;

	}

	for(j=0;j<n;j++){

		a[j]=a[j]-q;

		if(a[j]>0)

		printf("Yes\n");

		else

		printf("No\n");

	}

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

#include <cstring>

using namespace std;

int main()

{

    int t=1,i=0,n,q,a[100005],N[100005]= {0},maxl=0,d;

    long long k;

    cin>>n>>k>>q;

    for(i=1; i<=q; i++)

    {

        cin>>a[i];

        N[a[i]]++;

    }

    for(i=1; i<=n; i++)

        if(N[i]>N[maxl])

            maxl=i;

    for(i=1; i<=q; i++)

        if(a[i]!=maxl)

            --k;

    for(i=1; i<=n; i++)

        if(N[i]+k-N[maxl]<=0)

            cout<<"No\n";

        else

            cout<<"Yes\n";

    return 0;

}




// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,k,q,i,j;

	scanf("%d %d %d",&n,&k,&q);

	int a[n],b[q];

	for(i=0;i<n;i++){

		a[i]=k;

	}

	for(i=0;i<q;i++){

		scanf("%d",&b[i]);

	}

	for(i=0;i<q;i++){

		a[b[i]-1]=a[b[i]-1]+1;

	}

	for(j=0;j<n;j++){

		a[j]=a[j]-q;

		if(a[j]>0)

		printf("Yes\n");

		else

		printf("No\n");

	}

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<algorithm>

#include<string.h>

#include<map>

using namespace std;

int main()

{

    map<int,int> m;

    int n,k,q;

    scanf("%d%d%d",&n,&k,&q);

    for(int i=0;i<q;i++)

    {

        int p;

        scanf("%d",&p);

        m[p]++;

    }

    for(int i=1;i<=n;i++)

    {

        if(k-q+m[i]>0)

            printf("Yes\n");

        else

            printf("No\n");

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,k,q,i,j;

	scanf("%d %d %d",&n,&k,&q);

	int a[n],b[q];

	for(i=0;i<n;i++){

		a[i]=k;

	}

	for(i=0;i<q;i++){

		scanf("%d",&b[i]);

	}

	for(i=0;i<q;i++){

		a[b[i]-1]=a[b[i]-1]+1;

	}

	for(j=0;j<n;j++){

		a[j]=a[j]-q;

		if(a[j]>0)

		printf("Yes\n");

		else

		printf("No\n");

	}

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;

const int MAX = 1e5 + 5;



int ara[MAX];

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    

    int n , k , q;

    cin>>n>>k>>q;

    int tgt = q - k;

    

    while(q--) {

        int tmp;

        cin>>tmp;

        ara[tmp]++;

    }

    

    for(int i =1; i <=n ; i++ ) {

        

        if(ara[i] > tgt )  cout<<"Yes\n";

        else cout<<"No\n";

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,k,q,i,j;

	scanf("%d %d %d",&n,&k,&q);

	int a[n],b[q];

	for(i=0;i<n;i++){

		a[i]=k;

	}

	for(i=0;i<q;i++){

		scanf("%d",&b[i]);

	}

	for(i=0;i<q;i++){

		a[b[i]-1]=a[b[i]-1]+1;

	}

	for(j=0;j<n;j++){

		a[j]=a[j]-q;

		if(a[j]>0)

		printf("Yes\n");

		else

		printf("No\n");

	}

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,k,q;

    scanf("%d%d%d",&n,&k,&q);

    int yes;

    int ren[100005];

    for(int i=1;i<=n;i++)

        ren[i]=k;

    for(int i=1;i<=q;i++)

    {

        scanf("%d",&yes);

        ren[yes]++;

    }

    for(int i=1;i<=n;i++)

    {

        if(ren[i]<=q)

            printf("No\n");

        else

            printf("Yes\n");

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

int main(){

	int n,k,q,i,j;

	scanf("%d %d %d",&n,&k,&q);

	int a[n],b[q];

	for(i=0;i<n;i++){

		a[i]=k;

	}

	for(i=0;i<q;i++){

		scanf("%d",&b[i]);

	}

	for(i=0;i<q;i++){

		a[b[i]-1]=a[b[i]-1]+1;

	}

	for(j=0;j<n;j++){

		a[j]=a[j]-q;

		if(a[j]>0)

		printf("Yes\n");

		else

		printf("No\n");

	}

	return 0;

} 

// Fastest known solution for this problem: