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

using namespace std;



int n;

long long a,b;



long long h[100005];

long long r[100006];



bool check(long long x)

{

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

        r[i]=max(h[i]-b*x,0ll);

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

    {

        x-=(r[i]+a-b-1)/(a-b);

    }

    if(x<0)return false;

    return true;

}



long long erfen(long long l,long long r)

{

    if(l==r)

        return l;

    int mid=(l+r)/2;

    if(check(mid))return erfen(l,mid);

    else return erfen(mid+1,r);

}



int main()

{

    scanf("%d%lld%lld",&n,&a,&b);

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

        scanf("%lld",&h[i]);

    printf("%lld",erfen(0,1e9));

    return 0;

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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



using namespace std;

typedef long long ll;

ll A,B;

ll D;

int N;

ll h[100005];

int solve(ll n)

{

    ll sum=B*n;

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

    {

        if(h[i]>sum)

        {

            n-=(h[i]-sum)/D;

            if((h[i]-sum)%D)

                n--;

        }

    }

    if(n<0)

        return 0;

    else

        return 1;

}

int main()

{



    scanf("%d",&N);

    scanf("%lld%lld",&A,&B);

    D=A-B;

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

    {

        scanf("%lld",&h[i]);



    }

    ll l=1;

    ll r=1e9;

    ll mid=(l+r)/2;

    while(l<r)

    {

        int flag=solve(mid);

        if(flag)

            r=mid;

        else

            l=mid+1;

        mid=(l+r)/2;

    }



    printf("%lld",l);

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

using namespace std;

#define mod 1000000007

#define MOD(x) ((x)%mod)

long long n,a,b;

long long h[100005];

bool check(long long x)

{

	long long num=0;

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

	{

		if(h[i]<=x*b) continue;

		long long tmp;

		tmp=(h[i]-x*b)/a;

		if(tmp*a!=h[i]-x*b) tmp++;

		num+=tmp;

	}

	if(num>x) return 0;

	return 1;

}

int main()

{

	scanf("%lld%lld%lld",&n,&a,&b);

	a-=b;

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

		scanf("%lld",&h[i]);

	long long l=1,r=1e9;

	long long m;

	while(l<r)

	{

		m=(l+r)/2;

		if(check(m)) r=m;

		else l=m+1;

	}

	printf("%lld",l);

	return 0;

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

using namespace std;

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

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

typedef long long ll;

inline int read() {

	int x=0,s=1; char ch=getchar();

	while (ch<'0'||ch>'9') { if (ch=='-') s=-1; ch=getchar(); }

	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }

	return s*x;

}



const int MAXN=400005,Mo=1000000007;

int n,m,q;

ll A,B,a[MAXN],b[MAXN];

bool check(ll x){

	ll num=0;

	FOR(i,1,n)

	if (a[i]>x*B) {

		ll y=a[i]-x*B;

		num+=(y+A-1)/A;

		if (num>x) return false;

	}

	return true;

}

int main(){

	n=read();

	A=read(),B=read();

	A-=B;

	FOR(i,1,n) a[i]=read();

	int l=0,r=1e9+1,mid;

	while (l+1<r) {

		mid=(l+r)/2;

		if (check(mid)) r=mid; else l=mid;

	}

	printf("%d\n",r);

	

	return 0;

}



/*

*/


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

using namespace std;



const int MAXN = 1e5 + 10;



long long n, a, b, val;

long long v[MAXN];



long long check (int md) {

	long long ret = 0;

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

		if (v[i] - md * b > 0) {

			ret += (v[i] - md * b + a - 1) / a;

		}

	}

	return ret;

}



int main (void) {

	scanf("%lld%ld%lld", &n, &a, &b);

	a = a - b;

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

		scanf("%lld", &v[i]);

	}

	int st = 1, en = 1e9, md;

	while (st != en) {

		md = (st + en) >> 1;

		if (check(md) <= md) en = md;

		else st = md + 1;

	}

	printf("%d\n", st);

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#define N (int)1e6+5

using namespace std;

int n, a, b;

int h[N];

bool check(int x) {

	int dis = a - b;

	int mns = b * x;

	int cnt = 0;

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

		int tmp = h[i] - mns;

		if (tmp <= 0) continue;

		cnt += (tmp + dis - 1) / dis;

		if (cnt > x) return false;

//		cout << i << " " << tmp << " " << cnt << endl;

	}

	return cnt <= x;

}

int main() {

	scanf("%d%d%d", &n, &a, &b);

	int mx = 0;

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

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

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

	}

	int l = 1, r = (mx+b-1) / b, ans;

	while (l <= r) {

		int mid = ((l - r) >> 1) + r;

		if (check(mid)) {

			r = mid - 1;

			ans = mid;

		} else {

			l = mid + 1;

		}

//		cout << mid << " " << ans << " " << check(mid) << endl;

	}

	printf("%d", ans);

	return 0;

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

using namespace std;

int n,a,b;

int h[100005];

inline bool check(long long times)

{

	long long tmp=times;

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

    {

        long long blood=h[i]-b*times;

        if(blood>0)

        {

            long long cnt=blood/(a-b)+(blood%(a-b)==0?0:1);

            tmp-=cnt;

            if(tmp<0)

            {

            	return false;

			}

        }

    }

    return true;

}

int main()

{

	cin>>n>>a>>b;

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

	{

		cin>>h[i];

	}

	int lb=0,rb=1e9,mid;

	int ans=0;

	while(lb<=rb)

	{

		mid=(lb+rb)/2;

		if(check(mid))

		{

			ans=mid;

			rb=mid-1;

		}

		else

		{

			lb=mid+1;

		}

	}

	cout<<ans;

	return 0;

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#include <string.h>

#include <algorithm>



using namespace std;



typedef long long ll;

int num[200000];

int n,a,b;



bool judge(ll m)

{

    ll ty=m*b;

    ll sub=a-b;

    ll sum=0;

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

    {

        if(ty<num[i])

        {

            ll temp=num[i]-ty;

            sum+=temp/sub;

            if(temp%sub)

                sum++;

        }

    }

    if(sum<=m)

        return true;

    return false;

}



int main()

{

    ll Max=0;

    cin>>n>>a>>b;

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

    {

        cin>>num[i];

        Max+=num[i]/b+1;

    }

    sort(num,num+n);

    ll Min=1;

    while(Min<Max)

    {

        ll mid=(Max+Min)>>1;

        if(judge(mid))

            Max=mid;

        else

            Min=mid+1;

    }

    cout<<Min;

    return 0;

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#include<algorithm>

#include<cstdio>

#define ll long long

#define maxn 100005

#define inf 0x3f3f3f3f

using namespace std;

ll a[maxn];

ll r=0, l = 1;

ll n, b, s,sum=0;

int run(ll x)

{

	ll tmp = b - s;

	ll num = x*s;

	sum = 0;

	for (int i = n-1;i >= 0;i--)

	{

		

		if (a[i] - num > 0)

		{

			if ((a[i] - num) % tmp)

				sum += (a[i] - num) / tmp + 1;

			else

				sum += (a[i] - num) / tmp;

		}

	}

	if (sum > x)

		return 1;

	else

		return 0;

}

int main()

{

	cin >> n >> b >> s;

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

	{

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

		r += a[i] / s + 1;

	}

	sort(a, a + n);

	while (l < r)

	{

		ll mid = (r + l) / 2;

		if (run(mid))

			l = mid + 1;

		else

			r = mid;

	}

	printf("%lld\n",r);

	return 0;

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#include<stdio.h>

#include<math.h>

#include<algorithm>

#include <cstdlib>

using namespace std;

long long  a[200000];

long long  n,a1,b1;

long  check(long long  zhi)

{

    long long  t=b1*zhi;

    long long  add=0;

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

    {

        if(a[i]-t>0)

        {

            if((a[i]-t)%(a1-b1)==0)

                add+=(a[i]-t)/(a1-b1);

            else

                add+=(a[i]-t)/(a1-b1)+1;

        }

    }

    return add<=zhi;

}

int  main()

{

    cin>>n>>a1>>b1;

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

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

    long long  st=0,en=1e9;

    long long  mid;

    int t;

    while(st<en-1)

    {

        mid=(en+st)>>1;

        if(check(mid))

        {

            en=mid;

            t=mid;

        }

        else

            st=mid;

    }

    cout<<en<<endl;

    //system("pause");

    return 0;

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#include<algorithm>

#include<stdio.h>

#define EPS 1e-9

#define PI acos(-1.0)

#define INF 0x3f3f3f3f

#define LL long long

const int MOD = 1E9+7;

const int N = 1000000+5;

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

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

using namespace std;



LL n,A,B;

LL a[N];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    while(scanf("%lld%lld%lld",&n,&A,&B)!=EOF)

{

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);



    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

}

    return 0;

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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



using namespace std;

using ll = long long;

const int maxn = 1e5+7;



int n, a, b;

ll h[maxn];

bool check(ll x){

	ll sum=0;

	ll sub=a-b;

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

		if(x*b<h[i]){

			ll tmp=h[i]-x*b;

			sum += (tmp-1)/sub+1;

		}

	}

	return sum<=x;

}

int main()

{

	ios::sync_with_stdio(false);

	cin.tie(0);

	cin >> n >> a >> b;

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

		cin >> h[i];

	}

	sort(h+1, h+1+n);

	ll l=1, r=1e9+7;

	while(l<r){

		ll mid = l+r>>1;

		if(check(mid)){

			r=mid;

		}else{

			l=mid+1;

		}

	}

	cout << r;

}

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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


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

#include <cstdio>

#include <sstream>

#include <cstring>

#include <vector>

#include <algorithm>

#include <cmath>

#include <iomanip>

#include <queue>

#include <stack>

using namespace std;

typedef long long ll;

const int mod=1e9+7;

const int maxn=1e5+10;

ll heal[maxn];

ll A,B;

int N;

bool check(ll x)

{

    ll cnt=0;

    ll gap;

    //cout<<x<<"!"<<endl;

    for(int i=N-1;i>=0;i--)

    {

        //cout<<heal[i]<<' '<<cnt<<endl;

        if(x*B>=heal[i])return true;

        gap=heal[i]-x*B;

       //cout<<"g"<<gap<<endl;

        cnt+=gap/A;

        if(gap%A)cnt++;

        //cout<<cnt<<endl;

        if(cnt>x)return false;

    }

    return true;

}

int main()

{

    cin>>N>>A>>B;

    A-=B;

    for(int i=0;i<N;i++)cin>>heal[i];

    sort(heal,heal+N);

    ll l,r,mid;

    l=1;r=N*heal[N-1]/B+1;

    while(l<r)

    {

        mid=(l+r)>>1;

        if(check(mid))r=mid;

        else l=mid+1;

    }

    cout<<l<<endl;

    return 0;

}


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

#include<algorithm>

using namespace std;

#define LL long long

LL n,A,B;

LL a[1000005];

bool judge(LL x){

    LL temp=x*B;

    LL sub=A-B;

    LL sum=0;

    for(LL i=n;i>=1;i--){

        if(a[i]>temp){

            if((a[i]-temp)%sub)

                sum+=(a[i]-temp)/sub+1;

            else

                sum+=(a[i]-temp)/sub;

        }

    }

    if(sum<=x)

        return true;

    return false;

}

int main() {

    scanf("%lld%lld%lld",&n,&A,&B);

    LL right=0;

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

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

        right+=a[i]/B+1;

    }

    sort(a+1,a+1+n);

    LL left=1;

    while(left<right){

        LL mid=(left+right)>>1;

        if(judge(mid))

            right=mid;

        else

            left=mid+1;

    }

    printf("%lld\n",left);

    return 0;

}


// Fastest known solution for this problem: