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

using namespace std;



int vis[1010][1010];

char ch[1010][1010];



int main() {

	memset(vis, -1, sizeof(vis));

	ios_base::sync_with_stdio(0);

	cin.tie(0); cout.tie(0);

	

	int x, y;

	cin >> x >> y;

	

	queue<pair<int, pair<int, int> > > q;

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

		for(int j = 1; j <= y; j++) {

			cin >> ch[i][j];

			

			if(ch[i][j] == '#') {

				vis[i][j] = 0;

				q.push(make_pair(0, make_pair(i, j)));

			}

		}

	}

	

	int ans = 0;

	while(!q.empty()) {

		int val = q.front().first;

		int tarX = q.front().second.first;

		int tarY = q.front().second.second;

		q.pop();

		

		ans = max(ans, val);

		if(tarX < x && vis[tarX + 1][tarY] == -1) {

			vis[tarX + 1][tarY] = val + 1;

			q.push(make_pair(val + 1, make_pair(tarX + 1, tarY)));

		}

		

		if(tarX > 1 && vis[tarX - 1][tarY] == -1) {

			vis[tarX - 1][tarY] = val + 1;

			q.push(make_pair(val + 1, make_pair(tarX - 1, tarY)));

		}

		

		if(tarY < y && vis[tarX][tarY + 1] == -1) {

			vis[tarX][tarY + 1] = val + 1;

			q.push(make_pair(val + 1, make_pair(tarX, tarY + 1)));

		}

		

		if(tarY > 1 && vis[tarX][tarY - 1] == -1) {

			vis[tarX][tarY - 1] = val + 1;

			q.push(make_pair(val + 1, make_pair(tarX, tarY - 1)));

		}

	}

	

	cout << ans << "\n";

}

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

#include <cstring>

#include <algorithm>

using namespace std;



string str;

int i, ok1;

int k, t, j, lg, n, m, rez;

char a[1001][1001];

int mn=9999999;

int mat[1001][1001];



struct coada

{

    int x, y, dist;

}C[1000001], aux;



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

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

int inc, fin, x, y;

int main()

{

    cin>>n>>m;

    cin.get();

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

        cin.getline(a[i], 1001);



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

        mat[i][0]=mat[i][m+1]=-1;

    for (j=0;j<=m+1;j++)

        mat[0][j]=mat[n+1][j]=-1;

    inc=-1;

    fin=0;

    int nr=0;

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

        for (j=0;j<=m;j++)

        {

            if (a[i][j]=='#')

            {

                C[nr].x=i;

                C[nr].y=j+1;

                C[nr].dist=1;

                mat[i][j+1]=1;

                nr++;

            }

        }

    fin=nr-1;

    while (fin>inc)

    {

        inc++;

        aux=C[inc];

        for (k=0;k<4;k++)

        {

            x=aux.x+dx[k];

            y=aux.y+dy[k];

            if (mat[x][y]==0)

            {

                mat[x][y]=mat[aux.x][aux.y]+1;

                fin++;

                C[fin].x=x;

                C[fin].y=y;

                C[fin].dist=mat[x][y];

            }



        }

    }

    int mx=0;

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

        for (j=1;j<=m;j++)

        if (mx<mat[i][j]) mx=mat[i][j];

    cout<<mx-1<<'\n';

    return 0;

}


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

int main(){int a;std::cin>>a;std::cout<<!a;}

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

main(){puts(getchar()-48?"0":"1");}

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

int main(){int a;std::cin>>a;std::cout<<!a;}

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

main(){puts(getchar()-48?"0":"1");}

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

int main(){int a;std::cin>>a;std::cout<<!a;}

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

main(){puts(getchar()-48?"0":"1");}

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

main(){int a;std::cin>>a;std::cout<<!a;}

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

main(){puts(getchar()-48?"0":"1");}

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

using namespace std;



template<typename T, typename U>

using pv=vector<pair<T,U>>;

template<typename T>

using pque=priority_queue<T>;

template<typename T>

using lpque=priority_queue<T,vector<T>,greater<T>>;



using ll=long long;

using intpair=pair<int,int>;

using llpair=pair<ll,ll>;

using ilpair=pair<int,ll>;

using lipair=pair<ll,int>;

using intvec=vector<int>;

using llvec=vector<ll>;

using intq=queue<int>;

using llq=queue<ll>;

using intmat=vector<intvec>;

using llmat=vector<llvec>;



#define PI 3.141592653589793

#define INTINF ((1<<30)-1)

#define LLINF ((1LL<<62)-1)

#define MPRIME 1000000007

#define MPRIME9 998244353

#define MMPRIME ((1ll<<61)-1)



#define len length()

#define pushb push_back

#define fi first

#define se second



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

#define rall(name) name.rbegin(),name.rend()

#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())



template<class T>

inline bool chmin(T& a, T b) {

	if (a > b) {

		a = b;

		return true;

	}

	return false;

}



template<class T>

inline bool chmax(T& a, T b) {

	if (a < b) {

		a = b;

		return true;

	}

	return false;

}



template<class T>

inline void init(T& v) {

	for(auto &a: v) cin>>a;

}

template<class T, class U>

inline void init(vector<pair<T,U>>& v) {

	for(auto &a: v) cin>>a.first>>a.second;

}

template<class T, class N>

inline void init(T& v, N n) {

	v.resize(n);

	for(auto &a: v) cin>>a;

}

template<class T, class U, class N>

inline void init(vector<pair<T,U>>& v, N n) {

	v.resize(n);

	for(auto &a: v) cin>>a.first>>a.second;

}



template<class T>

inline void out(T a) {

	cout<<a<<endl;

}

template<class T, class... U>

inline void out(T a, U... alist) {

	cout<<a<<" ";

	out(forward<U>(alist)...);

}



template<class N>

void resiz(N n) {

	//empty

}

template<class N, class T, class... U>

void resiz(N n, T&& hd, U&&... tl) {

	hd.resize(n);

	resiz(n,forward<U>(tl)...);

}



ll binpow(ll a, ll ex, ll p) {

	ll result=1;

	while(ex>0) {

		if(ex&1) result=result*a%p;

		ex>>=1;

		a=a*a%p;

	}

	return result;

}





ll A,B,C;



void input() {

	cin>>A;

}



void solve() {

	cout<<abs(A-1)<<endl;

}



int main() {

	cin.tie(nullptr);

	ios_base::sync_with_stdio(false);

	cout<<fixed<<setprecision(15);

	int t=1;

	while(t) {

		input();

		solve();

		t--;

	}

}


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

main(){printf("%d\n",49-getchar());}


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

using namespace std;



#define ll long long

#define endl "\n"



vector<ll> adj[100005];

ll vis[100005];

ll n, m;



void add(ll x, ll y) {

  adj[x].push_back(y);

  adj[y].push_back(x);

}



void solve() {

  ll x;

  cin >> x;

  cout << 1 - x << endl;

}



int main() {

  ll t;

  // cin >> t;

  t = 1;

  while (t--)

    solve();

  return 0;

}

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

using namespace std;



#define ll long long



void solve() {

  ll x;

  cin >> x;

  cout << 1 - x << endl;

}



int main() {

  ios::sync_with_stdio(0);

  cin.tie(0);

  solve();

  return 0;

}

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

#include<algorithm>

#include<math.h>

using namespace std;

typedef long long ll;

const int inf=1e15;

int n;

int main()

{

    cin>>n;

    cout<<!n<<endl;

    return 0;

}

////刷题！！！！！！！！！！！！！！！！


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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

#include<algorithm>

#include<string>



using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	if(n==1) printf("0");

	if(n==0) printf("1");

	return 0;

} 

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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)

using namespace std;

int main()

{

	ios;

	int n;

	cin>>n;

	cout<<(n^1)<<'\n';

}

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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

using namespace std;

int main()

{

	int x;

	scanf("%d",&x);

	if(x==0)

		cout<<'1';

	if(x==1)

		cout<<'0';

	return 0;

}

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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

using namespace std;

int main()

{

    int x;

    cin >> x;

    if(x)

    {

        cout << "0" << endl;

    }

    else cout << "1" << endl;

}


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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

using namespace std;



#define ll unsigned long long

int n;

int main()

{

    scanf("%d",&n);

    cout << !n;

    return 0;

}






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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

* @Author: Nazrul Islam

* @Date:   2020-09-19 13:30:27

* @Last Modified by:   Nazrul Islam

* @Last Modified time: 2020-09-19 13:30:58

*/



#include<bits/stdc++.h>

using namespace std;

#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

typedef long long ll; 

typedef double dd;

typedef vector<int> vi;

typedef vector<char> vc;

typedef list<int> li;

typedef set<int> si;

typedef map<int,int> mp;

#define pb push_back

#define pf push_front

#define mk make_pair

#define sc scanf

#define pr printf

#define pi acos(-1.0)

#define endl '\n'

// char s[200009];

// char st[200009];

// int a[600][600];

// int b[29][10];

// int a[200009];

// int c[200009];

void solve()

{

	ll n, m, i, j, k, l; 

	cin >> n;

	if(n) cout << "0" << endl;

	else cout << "1" << endl;

}

int main()

{

	IO;

	int t; 

	t = 1;

	// cin >> t;

	while(t--)

		solve();

	return 0;

}

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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

using namespace std;

int main()

{

    int n;

    cin>>n;

    n^=1;

    cout<<n;



}


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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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



#define rr(i, b)    for (int i = 0; i < int(b); i++)

#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]

#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl

#define bug(x) cout << #x << " " << x << endl

#define ll long long

#define vii vector <int>



using namespace std;



bool check(string s) {



    int l = 0;

    int r = s.size()/2;



    while(r != s.size()) {

        if(s[l] != s[r]) {

            return false;

        }

        l++;

        r++;

    }



    return true;

}



vector<long long> fac(20 + 1);



void fact() {

    fac[0] = 1;

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

        fac[i] = fac[i - 1] * i;

    }

}



void solve() {

    int x;

    cin >> x;



    cout << !x << endl;

}

 

int main(){

    cin.tie(0);

    ios_base::sync_with_stdio(false);

    //fact();

    int t = 1;

    //cin >> t;



    while(t--)

    solve();

    return 0;

}

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



int main()

{

	int n;

	scanf("%d", &n);

	if(n == 1) printf("0\n");

	else printf("1\n");

}

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

using namespace std;



int main(){

	int a,b,s[5002],t[5002],ans=0;

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

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

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

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

		int k=0,ret=0;

		for(int j=i;j<b;j++){

			while(t[j]!=s[k]){k++; if(k>=a)break;}

			if(k>=a)break;

			ret++; k++;

		}

		if(ret>ans)ans=ret;

	}

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

	return 0;

}

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

#include<algorithm>

using namespace std;



const int INF=1000000000;



int main(){

	int a,b;

	int s[5002],t[5002];

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

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

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

	}

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

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

	}



	int memo[5002]; for(int i=0;i<b;i++)memo[i]=INF;



	int ret=0;

	for(int i=0;i<b-ret;i++){

		int p=0,q=i;

		int cnt=0;

		while(1){

			

			if(s[p]==t[q]){

				if(p>=memo[q])break;

				memo[q]=p;

				cnt++;

				p++;

				q++;

			}

			else {

				p++;

			}

			if(p==a){

				ret=max(ret,cnt);

				break;

			}

			if(ret>cnt+a-p)break;

		}

	}





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

}

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

#include<algorithm>

using namespace std;



int main(){

	int a,b;

	int s[5002],t[5002];

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

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

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

	}

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

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

	}



	int ret=0;

	for(int i=0;i<b-ret;i++){

		int p=0,q=i;

		int cnt=0;

		while(1){

			if(s[p]==t[q]){

				cnt++;

				p++;

				q++;

			}

			else {

				p++;

			}

			if(p==a)break;

		}

		ret=max(ret,cnt);

	}



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

}

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

#include<algorithm>

using namespace std;



const int INF=1000000000;



int main(){

	int a,b;

	int s[5002],t[5002];

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

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

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

	}

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

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

	}



	int memo[5002]; for(int i=0;i<b;i++)memo[i]=INF;



	int ret=0;

	for(int i=0;i<b-ret;i++){

		int p=0,q=i;

		int cnt=0;

		while(1){

			

			if(s[p]==t[q]){

				if(p>=memo[q])break;

				memo[q]=p;

				cnt++;

				p++;

				q++;

			}

			else {

				p++;

			}

			if(p==a){

				ret=max(ret,cnt);

				break;

			}

			if(ret>cnt+a-p)break;

		}

	}





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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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]);

  }

}

// Optimized solution to the same problem (faster):
#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]);

  }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

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

}

// Fastest known solution for this problem: