stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define Rep(i,N) for(int i = 0; i < N; i++)



inline void chmax(int &a, int b) { a = max(a, b); }



int main()

{

  int N, M;

  int A[5005], B[5005];

  int maxv = 0;

  

  cin >> N >> M;

  Rep(i,N) cin >> A[i];

  Rep(i,M) cin >> B[i];



  vector<vector<int> >dp(2,vector<int>(5005,0));

  Rep(i,M) {

    Rep(j,N) {

      if(j) dp[1][j + 1] = dp[1][j];

      if(A[j] == B[i])chmax(dp[1][j + 1], dp[0][j] + 1);

      chmax(maxv,dp[1][j + 1]);

    }

    dp[0] = dp[1];

    fill(dp[1].begin(), dp[1].end(),0);

  }



  cout << maxv << endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1970083716463866x):
#include <bits/stdc++.h>

using namespace std;

#define Rep(i,N) for(int i = 0; i < N; i++)



inline void chmax(int &a, int b) { a = max(a, b); }



int main()

{

  int N, M;

  int A[5005], B[5005];

  int maxv = 0;

  

  cin >> N >> M;

  Rep(i,N) cin >> A[i];

  Rep(i,M) cin >> B[i];

  

  Rep(i,M) {

    int now = i, cnt = 0;

    Rep(j,N) {

      if(A[j] == B[now])cnt++, now++;

    }

    chmax(maxv,cnt);

  }



  cout << maxv << endl;

  return 0;

}
// Slower C++ solution:
#include <vector>

#include <iostream>



using namespace std;



int main()

{

	int A, B;



	scanf("%d", &A);

	scanf("%d", &B);



	vector<int> P(A);

	vector<int> Q(B);



	for (int i = 0; i < A; i++) { scanf("%d", &P[i]); }

	for (int i = 0; i < B; i++) { scanf("%d", &Q[i]); }



	int l = 1;

	int r = B;

	int m;



	while(r - l > 1)

	{

		m = (l + r) / 2;



		bool ok = false;



		for (int j = 0; j < (B - m); j++)

		{

			int ptr = j;



			for (int k = 0; k < A; k++)

			{

				if (P[k] == Q[ptr])

				{

					ptr++;

				}



				if (ptr == j + m)

				{

					break;

				}

			}



			if (ptr == j + m)

			{

				ok = true;

			}

		}



		if (ok)

		{

			l = m;

		}

		else

		{

			r = m;

		}

	}



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



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.196630088001199x):
#include <stdio.h>

#include <algorithm>

using namespace std;

int A, B, a[5000], b[5000];

int main() {

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

	for(int i = 0; i < A; i++) scanf("%d", &a[i]);

	for(int i = 0; i < B; i++) scanf("%d", &b[i]);

	int ret = 0;

	for(int i = 0; i <= B - (ret ? ret : 1); i++) {

		int pos = i;

		for(int j = 0; j < A; j++) {

			if(pos == B) break;

			if(b[pos] == a[j]) pos++;

		}

		ret = max(ret, pos - i);

	}

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

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#define IN 150

using namespace std;



int n,u,f,y,x;

int h[300][300],d[300][300],res[7];

int dice[6],tmp[6];

int dy[] = {0,1,-1,0}, dx[] = {-1,0,0,1}; //w,s,n,e

 

int rot[4][6] = { {4,0,2,3,5,1},

		  {3,1,0,5,4,2},

		  {2,1,5,0,4,3},

		  {1,5,2,3,0,4} };



int die[6][6] = { {0,2,4,1,3,0},

		 {3,0,0,5,0,2},

		 {1,5,0,0,0,4},

		 {4,0,0,0,5,1},

		 {2,0,5,0,0,3},

		 {0,3,1,4,2,0} };



int main(){

  while(scanf("%d",&n),n){

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

      for(int j=0;j<300;j++)h[i][j] = d[i][j] = -1;



    while(n--){

      scanf("%d %d",&u,&f);

      u--; f--;

      dice[0] = u; dice[5] = 5-u;

      dice[1] = f; dice[4] = 5-f;

      dice[2] = die[u][f]; dice[3] = 5 - die[u][f];

      

      f = true;

      y = x = IN;

      while(f){

	f = false;

	for(int i=5;i>=3;i--){

	  for(int j=0;j<4;j++){

	    if(dice[j+1] == i){

	      if(h[y][x] > h[y+dy[j]][x+dx[j]]){

		y = y+dy[j]; x = x+dx[j];

		for(int k=0;k<6;k++)tmp[k] = dice[rot[j][k]];

		for(int k=0;k<6;k++)dice[k] = tmp[k];

		f = true;

		break;

	      }

	    }

	  }

	  if(f)break;

	}

      } 

      h[y][x]++; d[y][x] = dice[0];

    }

    

    for(int i=0;i<7;i++)res[i] = 0;

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

      for(int j=0;j<300;j++)res[d[i][j]+1]++;

    for(int i=1;i<6;i++)printf("%d ",res[i]);

    printf("%d\n",res[6]);

  }

}

// Faster C++ solution for the same problem (measured speedup: 3.9144348836562806x):
#include<cstdio>

#define IN 50

using namespace std;



int n,u,f,y,x;

int h[100][100],d[100][100],res[7];

int dice[6],tmp[6];

int dy[] = {0,1,-1,0}, dx[] = {-1,0,0,1}; //w,s,n,e

 

int rot[4][6] = { {4,0,2,3,5,1},

		  {3,1,0,5,4,2},

		  {2,1,5,0,4,3},

		  {1,5,2,3,0,4} };



int die[6][6] = { {0,2,4,1,3,0},

		 {3,0,0,5,0,2},

		 {1,5,0,0,0,4},

		 {4,0,0,0,5,1},

		 {2,0,5,0,0,3},

		 {0,3,1,4,2,0} };



int main(){

  while(scanf("%d",&n),n){

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

      for(int j=0;j<100;j++)h[i][j] = d[i][j] = -1;



    while(n--){

      scanf("%d %d",&u,&f);

      u--; f--;

      dice[0] = u; dice[5] = 5-u;

      dice[1] = f; dice[4] = 5-f;

      dice[2] = die[u][f]; dice[3] = 5 - die[u][f];

      

      f = true;

      y = x = IN;

      while(f){

	f = false;

	for(int i=5;i>=3;i--){

	  for(int j=0;j<4;j++){

	    if(dice[j+1] == i){

	      if(h[y][x] > h[y+dy[j]][x+dx[j]]){

		y = y+dy[j]; x = x+dx[j];

		for(int k=0;k<6;k++)tmp[k] = dice[rot[j][k]];

		for(int k=0;k<6;k++)dice[k] = tmp[k];

		f = true;

		break;

	      }

	    }

	  }

	  if(f)break;

	}

      } 

      h[y][x]++; d[y][x] = dice[0];

    }

    

    for(int i=0;i<7;i++)res[i] = 0;

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

      for(int j=0;j<100;j++)res[d[i][j]+1]++;

    for(int i=1;i<6;i++)printf("%d ",res[i]);

    printf("%d\n",res[6]);

  }

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



ll N, A, B;

vector<ll> h(100005);



bool check(int k){

    ll tmp = 0;

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

        if(h[i]-B*k <= 0) continue;

        tmp += max(0LL,(h[i]-B*k-1)/(A-B) + 1);

    }



    if(tmp <= k) return true;

    else return false;

}



int solve(){

    int left = 0, right = 1000000000;

    int mid;

    while(right - left > 1){

        mid = (left+right)/2;

        bool v = check(mid);

        if(v) right = mid;

        else left = mid;

    }



    return right;

}



int main(){

    cin >> N >> A >> B;

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



    cout << solve() << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.8090672753548633x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



ll N, A, B;

ll h[100005];



bool check(int k){

    ll cnt = 0;

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

        if(h[i]-k*B <= 0) continue;

        cnt += (h[i]-k*B-1)/(A-B) + 1;

    }



    if(cnt <= k) return true;

    else return false;

}



int solve(){

    ll left = 0, right = 1000000001;



    while(right - left > 1){

        ll mid = (left+right)/2;

        if(check(mid)) right = mid;

        else left = mid;

    }



    return right;

}





int main(){

    cin >> N >> A >> B;

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



    cout << solve() << endl;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

*/



ll N, A, B;

vector<ll> h(100005);



bool check(int k){

    ll tmp = 0;

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

        if(h[i]-B*k <= 0) continue;

        tmp += max(0LL,(h[i]-B*k-1)/(A-B) + 1);

    }



    if(tmp <= k) return true;

    else return false;

}



int solve(){

    int left = 0, right = 1000000000;

    int mid;

    while(right - left > 1){

        mid = (left+right)/2;

        bool v = check(mid);

        if(v) right = mid;

        else left = mid;

    }



    return right;

}



int main(){

    cin >> N >> A >> B;

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



    cout << solve() << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.7825939673241147x):
#include <bits/stdc++.h>

using namespace std;

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

#define rep(i,n) for(int i=0;i<n;i++)

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

#define reprev(i,n) reprrev(i,0,n)

typedef long long ll;

typedef unsigned long long ull;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

    sizeは(int)とキャストしよう

    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？

    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）

    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか

    cin.tie(0);

    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう



*/



const ll mod = 1e9+7;



void chmod(ll &M){

    if(M >= mod) M %= mod;

    else if(M < 0){

        M += (abs(M)/mod + 1)*mod;

        M %= mod;

    }

}



int getl(int i, int N) { return i==0? N-1:i-1; };

int getr(int i, int N) { return i==N-1? 0:i+1; };



/* <--------------------------------------------> */



int n;

ll A, B;

vector<ll> h;



bool check(ll k){

    ll cnt=0;

    rep(i, n){

        if(h[i]-k*B <= 0) continue;

        

        cnt += (h[i]-k*B + (A-B-1)) / (A-B);

    }

    if(cnt<=k) return true;

    else return false;

}



int main(void){

    cin.tie(0);

    ios::sync_with_stdio(false);



    cin >> n;

    cin >> A >> B;

    h.assign(n, 0);

    rep(i, n) cin >> h[i];



    int left=0, right=1e9;

    int mid;

    while(right-left > 1){

        mid = (left+right)/2;

        if(check(mid)) right=mid;

        else left=mid;

    }



    cout << right << '\n';





    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

 

/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

    sizeは(int)とキャストしよう

    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？

*/



ll N, A, B;

vector<ll> h(100005, 0);



bool check(int n){

    if(n == 0) return false;

    ll res = 0;



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

        ll tmp = h[i]-B*n;

        if(tmp <= 0) continue;



        res += (tmp-1)/(A-B) + 1;

    }



    if(res <= n) return true;

    else return false;

}



ll solve(){

    ll left = 0, right = 1e9;

    ll mid;



    while(left+1 < right){

        mid = (left + right)/2;

        if(check(mid)) right = mid;

        else left = mid;

    }



    return right;

}



int main(){

    cin >> N >> A >> B;

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



    cout << solve() << endl;

    

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.781578970673706x):
#include <bits/stdc++.h>

using namespace std;

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

#define rep(i,n) for(int i=0;i<n;i++)

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

#define reprev(i,n) reprrev(i,0,n)

typedef long long ll;

typedef unsigned long long ull;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }



/* attention

    long longのシフト演算には気をつけよう

    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも

    sizeは(int)とキャストしよう

    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？

    詰まった時に、別の分野の問題として考え直す（これdpでは？、グラフとしてみればいいのでは？）

    多くの問題はパターンマッチだが、パターンに落とし込むまでが難しく、そのための訓練としてわからない問題をあれこれ色々な角度から考察してみるのではないか

    cin.tie(0);

    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう



*/



const ll mod = 1e9+7;



void chmod(ll &M){

    if(M >= mod) M %= mod;

    else if(M < 0){

        M += (abs(M)/mod + 1)*mod;

        M %= mod;

    }

}



int getl(int i, int N) { return i==0? N-1:i-1; };

int getr(int i, int N) { return i==N-1? 0:i+1; };



/* <--------------------------------------------> */



int n;

ll A, B;

vector<ll> h;



bool check(ll k){

    ll cnt=0;

    rep(i, n){

        if(h[i]-k*B <= 0) continue;

        

        cnt += (h[i]-k*B + (A-B-1)) / (A-B);

    }

    if(cnt<=k) return true;

    else return false;

}



int main(void){

    cin.tie(0);

    ios::sync_with_stdio(false);



    cin >> n;

    cin >> A >> B;

    h.assign(n, 0);

    rep(i, n) cin >> h[i];



    int left=0, right=1e9;

    int mid;

    while(right-left > 1){

        mid = (left+right)/2;

        if(check(mid)) right=mid;

        else left=mid;

    }



    cout << right << '\n';





    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>



using namespace std;

typedef long long ll;

template<class T=ll> 

T in(){T x;cin>>x;return (x);}

template<class T> 

void print(T &x){cout<<x<<"\n";}

#define rep(i,n) for(int i=0;i<(n);++i)

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

#define reps(x,c) for(auto x:c)

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

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 2147483600

#define MOD 1000000007

#define fi first

#define se second

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

#define dbgv(x) cerr<<#x<<"\n";reps(y,x){cerr<<y<<" ";}cerr<<"\n"



int main(){

  ll n=in(),a=in(),b=in(),ans=1e9;

  vector<ll> h(n);

  rep(i,n){

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

  }

  sort(all(h));

  ll left=1,right=1e9,mid,cnt=0;

  while (right!=left+1) {

    mid =(right+left)/2;

    cnt=0;

    rep(i,n){

      ll temp=h[i]-b*mid;

      if(temp>0){

        cnt+=ceil(1.0*temp/(a-b));

      }

    }

    bool flg=cnt<mid;

    if(flg){

      right=mid;

    }else left=mid;

  }

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*left;

    if(temp>0){

      cnt+=ceil(1.0*temp/(a-b));

    }

  }

  ans=min(ans,max(cnt,left));

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*right;

    if(temp>0){

      cnt+=ceil(1.0*temp/(a-b));

    }

  }

  ans=min(ans,max(cnt,right));

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.319382271963272x):
#include <cstdio>

#include <cmath>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}

int h[100001];

int main(){

  int n=read(),a=read(),b=read();a-=b;

  rep(i,n)h[i]=read();

  int left=0,right=1000000000;

  ll temp,cnt=0,mid;

  while (right>left+1) {

    mid=(right+left)>>1;

    cnt=0;

    rep(i,n){

      temp=h[i]-b*mid+a-1;

      if(temp>a-1)cnt+=temp/a;

    }

    if(cnt<=mid)right=mid;

    else left=mid;

  }

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

  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>



using namespace std;

typedef long long ll;

template<class T=ll> 

T in(){T x;cin>>x;return (x);}

template<class T> 

void print(T &x){cout<<x<<"\n";}

#define rep(i,n) for(int i=0;i<(n);++i)

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

#define reps(x,c) for(auto x:c)

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

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 2147483600

#define MOD 1000000007

#define fi first

#define se second

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

#define dbgv(x) cerr<<#x<<"\n";reps(y,x){cerr<<y<<" ";}cerr<<"\n"



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}



int main(){

  ll n=read(),a=read(),b=read(),ans=1e9;

  vector<ll> h(n);

  rep(i,n){

    h[i]=read();

  }

  ll left=1,right=1e9,mid,cnt=0;

  while (right!=left+1) {

    mid =(right+left)/2;

    cnt=0;

    rep(i,n){

      ll temp=h[i]-b*mid;

      if(temp>0){

        cnt+=ceil(1.0*temp/(a-b));

      }

    }

    if(cnt<mid){

      right=mid;

    }else left=mid;

  }

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*right;

    if(temp>0){

      cnt+=ceil(1.0*temp/(a-b));

    }

  }

  ans=min(ans,max(cnt,right));

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*left;

    if(temp>0){

      cnt+=ceil(1.0*temp/(a-b));

    }

  }

  ans=min(ans,max(cnt,left));

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.245449546816278x):
#include <cstdio>

#include <cmath>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}

int h[100001];

int main(){

  int n=read(),a=read(),b=read();a-=b;

  rep(i,n)h[i]=read();

  int left=0,right=1000000000;

  ll temp,cnt=0,mid;

  while (right>left+1) {

    mid=(right+left)>>1;

    cnt=0;

    rep(i,n){

      temp=h[i]-b*mid+a-1;

      if(temp>a-1)cnt+=temp/a;

    }

    if(cnt<=mid)right=mid;

    else left=mid;

  }

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

  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>



using namespace std;

typedef long long ll;

template<class T=ll> 

T in(){T x;cin>>x;return (x);}

template<class T> 

void print(T &x){cout<<x<<"\n";}

#define rep(i,n) for(int i=0;i<(n);++i)

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

#define reps(x,c) for(auto x:c)

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

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 2147483600

#define MOD 1000000007

#define fi first

#define se second

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

#define dbgv(x) cerr<<#x<<"\n";reps(y,x){cerr<<y<<" ";}cerr<<"\n"



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}



int main(){

  ll n=read(),a=read(),b=read(),ans=1e9,c=a-b;

  vector<ll> h(n);

  rep(i,n){

    h[i]=read();

  }

  ll left=1,right=1e9,mid,cnt=0;

  while (right!=left+1) {

    mid =(right+left)/2;

    cnt=0;

    rep(i,n){

      ll temp=h[i]-b*mid+c-1;

      if(temp>0){

        cnt+=temp/c;

      }

    }

    if(cnt<mid){

      right=mid;

    }else left=mid;

  }

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*right+c-1;

    if(temp>0){

      cnt+=temp/c;

    }

  }

  ans=min(ans,max(cnt,right));

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*left+c-1;

    if(temp>0){

      cnt+=temp/c;

    }

  }

  ans=min(ans,max(cnt,left));

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246215145173715x):
#include <cstdio>

#include <cmath>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}

int h[100001];

int main(){

  int n=read(),a=read(),b=read();a-=b;

  rep(i,n)h[i]=read();

  int left=0,right=1000000000;

  ll temp,cnt=0,mid;

  while (right>left+1) {

    mid=(right+left)>>1;

    cnt=0;

    rep(i,n){

      temp=h[i]-b*mid+a-1;

      if(temp>a-1)cnt+=temp/a;

    }

    if(cnt<=mid)right=mid;

    else left=mid;

  }

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

  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <vector>

#include <algorithm>

#include <cmath>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>

#include <bitset>



using namespace std;

typedef long long ll;

template<class T=ll> 

T in(){T x;cin>>x;return (x);}

template<class T> 

void print(T &x){cout<<x<<"\n";}

#define rep(i,n) for(int i=0;i<(n);++i)

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

#define reps(x,c) for(auto x:c)

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

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 2147483600

#define MOD 1000000007

#define fi first

#define se second

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

#define dbgv(x) cerr<<#x<<"\n";reps(y,x){cerr<<y<<" ";}cerr<<"\n"



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}



int main(){

  ll n=read(),a=read(),b=read(),ans=1e9,c=a-b;

  vector<ll> h(n);

  rep(i,n){

    h[i]=read();

  }

  ll left=1,right=1e9,mid,cnt=0;

  while (right!=left+1) {

    mid =(right+left)/2;

    cnt=0;

    rep(i,n){

      ll temp=h[i]-b*mid;

      if(temp>0){

        cnt+=ceil(1.0*temp/c);

      }

    }

    if(cnt<mid){

      right=mid;

    }else left=mid;

  }

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*right;

    if(temp>0){

      cnt+=ceil(1.0*temp/c);

    }

  }

  ans=min(ans,max(cnt,right));

  cnt=0;

  rep(i,n){

    ll temp=h[i]-b*left;

    if(temp>0){

      cnt+=ceil(1.0*temp/c);

    }

  }

  ans=min(ans,max(cnt,left));

  cout<<ans<<endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.245269552585891x):
#include <cstdio>

#include <cmath>



using namespace std;

typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);++i)



inline char tc(){

  static char fl[100],*A=fl,*B=fl;

  return A==B&&(B=(A=fl)+fread(fl,1,100,stdin),A==B)?EOF:*A++;  

}

inline int read(){

  int a=0;static char c;

  while((c=tc())<48||c>57);

  while(c>=48&&c<=57)a=a*10+c-48,c=tc();

  return a;

}

int h[100001];

int main(){

  int n=read(),a=read(),b=read();a-=b;

  rep(i,n)h[i]=read();

  int left=0,right=1000000000;

  ll temp,cnt=0,mid;

  while (right>left+1) {

    mid=(right+left)>>1;

    cnt=0;

    rep(i,n){

      temp=h[i]-b*mid+a-1;

      if(temp>a-1)cnt+=temp/a;

    }

    if(cnt<=mid)right=mid;

    else left=mid;

  }

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

  return 0;

}