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

using namespace std;

typedef long long LL;

typedef pair<int, int> P;

typedef pair<int, P> E;

const LL MOD = 1000000007LL;

bool dpX[2][16001];

bool dpY[2][16001];

int main() {

	string s;

	cin >> s;

	int x, y;

	cin >> x >> y;

	int pos = 0;

	while (pos < s.size() && s[pos] == 'F') x--, pos++;

	vector<int> vx, vy;

	bool dir = 0;

	int d = 0;

	while (pos < s.size()) {

		if (s[pos] == 'T') {

			if (dir) vy.push_back(d);

			else vx.push_back(d);

			d = 0;

			dir ^= 1;

		}

		else {

			d++;

		}

		pos++;

	}

	if (dir) vy.push_back(d);

	else vx.push_back(d);

	dpX[0][8000] = 1;

	for (int i = 0; i < vx.size(); i++) {

		for (int j = 0; j <= 16000; j++) dpX[(i + 1) % 2][j] = 0;

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

			if (j + vx[i] <= 16000) dpX[(i + 1) % 2][j + vx[i]] |= dpX[i % 2][j];

			if (j - vx[i] >= 0) dpX[(i + 1) % 2][j - vx[i]] |= dpX[i % 2][j];

		}

	}

	dpY[0][8000] = 1;

	for (int i = 0; i < vy.size(); i++) {

		for (int j = 0; j <= 16000; j++) dpY[(i + 1) % 2][j] = 0;

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

			if (j + vy[i] <= 16000) dpY[(i + 1) % 2][j + vy[i]] |= dpY[i % 2][j];

			if (j - vy[i] >= 0) dpY[(i + 1) % 2][j - vy[i]] |= dpY[i % 2][j];

		}

	}

	if (dpX[vx.size() % 2][x + 8000] && dpY[vy.size() % 2][y + 8000]) {

		cout << "Yes" << endl;

	}

	else {

		cout << "No" << endl;

	}

}

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



using namespace std;

typedef long long ll;

const ll INF = 1LL << 60;

const ll MOD = 1e9 + 7;

bool dp[2][8001];



int main() {

    string s;

    cin >> s;

    int x[2];

    cin >> x[0] >> x[1];

    int n = s.size();

    vector<int> v[2];

    bool dir = 0;

    int len = 0;

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

        if (s[i] == 'F') {

            len++;

        } else {

            v[dir].push_back(len);

            len = 0;

            dir ^= 1;

        }

    }

    v[dir].push_back(len);

    x[0] -= v[0][0];

    v[0].erase(v[0].begin());

    x[0] = abs(x[0]);

    x[1] = abs(x[1]);

    for (int k = 0; k < 2; k++) {

        int sum = 0;

        for (int i = 0; i < v[k].size(); i++) {

            sum += v[k][i];

        }

        if (sum < x[k] || (sum - x[k]) % 2) {

            cout << "No" << endl;

            return 0;

        }

        memset(dp, 0, sizeof(dp));

        dp[0][0] = 1;

        for (int i = 0; i < v[k].size(); i++) {

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

                dp[(i + 1) & 1][j] |= dp[i & 1][j];

                if (j + v[k][i] <= 8000) dp[(i + 1) & 1][j + v[k][i]] |= dp[i & 1][j];

            }

            for (int j = 0; j <= 8000; j++) dp[i & 1][j] = 0;

        }

        if (!dp[v[k].size() & 1][(sum - x[k]) / 2]) {

            cout << "No" << endl;

            return 0;

        }

    }

    cout << "Yes" << endl;

}

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

#include <string>

#include <vector>

#include <algorithm>

#include <queue>

#include <set>

#include <map>

#include <string.h>

#include <cmath>



using namespace std;

typedef long long i64;

typedef long double ld;

typedef pair<i64,i64> P;

#define rep(i,s,e) for(int (i) = (s);(i) <= (e);++(i))



string s;

int x;

int y;



bool f = true;



bool ok(vector<int>& d , int A)

{

	vector<bool> dp(20000,false);

	auto acc = [](int i){

		return i + 10000;

	};



	dp[acc(0)] = true;



	for(int i = 0;i < d.size();i++)

	{

		vector<bool> before = move(dp);

		dp.assign(20000,false);

		for(int j = -10000;j < 10000;j++)

		{

			int index = acc(j);

			if(index + d[i] < dp.size() && !f)

				dp[index] = dp[index] || before[index + d[i]];

			if(0 <= index - d[i])

				dp[index] = dp[index] || before[index - d[i]];

		}

      	f =  false;

	}





	return dp[acc(A)];

}

int main()

{

	cin >> s >> x >> y;



	vector<int> d[2];





	int now = 0;

	int cou = 0;



	for(char c : s)

	{

		if(c == 'T')

		{

			d[now].push_back(cou);

			now = 1 - now;

			cou = 0;

		}

		else

		{

			cou++;

		}

	}



	if(cou != 0)

	{

		d[now].push_back(cou);

	}



	if(ok(d[0],x) && ok(d[1] , y))

	{

		cout << "Yes" << endl;

	}

	else

	{

		cout << "No" << endl;

	}



}






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

#include <string>

#include <vector>

#include <algorithm>

#include <queue>

#include <set>

#include <map>

#include <cmath>

#include <bitset>

using namespace std;

typedef long long i64;

typedef long double ld;

typedef pair<i64,i64> P;

#define rep(i,s,e) for(int i = (s);i <= (e);i++)



string s;

int x;

int y;



bitset<16010> bit[2];





int main(){

	cin >> s >> x >> y;

	x += 8000;

	y += 8000;

	vector<int> vec;

	vec.push_back(0);

	for(char c : s){

		if(c == 'T'){

			vec.push_back(0);

		}

		else{

			vec.back()++;

		}

	}

	bit[0][8000] = 1;

	bit[1][8000] = 1;

	for(int i = 0;i < vec.size();i++){

		if(i == 0){

			bit[i % 2] = (bit[i % 2] << vec[i]);

		}

		else{

			bit[i % 2] = (bit[i % 2] << vec[i]) | (bit[i % 2] >> vec[i]);

		}

	}



	if(bit[0][x] && bit[1][y]){

		cout << "Yes" << endl;

	}

	else{

		cout << "No" << endl;

	}

}


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

using namespace std;

int main()

{

    int a,b,c,d;

    cin>>a>>b>>c>>d;

    if(a+b>c+d)cout<<"Left\n";

    else if(a+b<c+d)cout<<"Right\n";

    else cout<<"Balanced\n";

    return 0;

}


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

int main()

{

    int A,B,C,D;

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

    if((A+B)>(C+D))printf("Left\n");

    else if((A+B)<(C+D))printf("Right\n");

    else

        printf("Balanced\n");





}

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

using namespace std;

void display()

{

    int a, b, c, d;

    cin>>a>>b>>c>>d;

    puts(a+b == c+d ? "Balanced" : a+b > c+d ? "Left" : "Right");

}

int main(void)

{

    display();

}


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

int main()

{

    int A,B,C,D;

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

    if((A+B)>(C+D))printf("Left\n");

    else if((A+B)<(C+D))printf("Right\n");

    else

        printf("Balanced\n");





}

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

using namespace std;

int a,b,c,d;

int main(){

cin>>a>>b>>c>>d;

if (a+b<c+d) puts("Right");

else if (a+b>c+d) puts("Left");

else puts("Balanced");

}

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

#include <cstring>

#include <algorithm>

using namespace std;

int a,b,c,d;



int main()

{

    while (scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)

    {

        if (a+b==c+d) puts("Balanced");

        else if (a+b>c+d) puts("Left");

        else puts("Right");

    }

    return 0;

}




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

#define Tp template<typename Ty>

#define Ts template<typename Ty,typename... Ar>

#define Reg register

#define RI Reg int

#define Con const

#define CI Con int&

#define I inline

#define W while

#define N 400000

#define int LL

#define LL long long

using namespace std;

int n,b[N+5],S[N+5];LL a[N+5],c[N+5],tmp[N+5];

struct P

{

	LL x,y;I P(Con LL& a=0,Con LL& b=0):x(a),y(b){}

	I P operator - (Con P& o) Con {return P(x-o.x,y-o.y);}

	I LL operator ^ (Con P& o) Con {return x*o.y-y*o.x;}

}p[N+5];

main()

{

	RI i,Mx,t;scanf("%lld",&n);

	for(Mx=0,i=1;i<=n;++i) scanf("%lld",a+i),a[i]>=a[Mx]&&(Mx=i);

	for(t=0,i=Mx;i<=n;++i) tmp[++t]=a[i];for(i=1;i^Mx;++i) tmp[++t]=a[i];

	for(i=1;i<=n;++i) a[i]=tmp[i];

	for(i=1;i<=n;++i) scanf("%lld",b+i);

	for(t=0,i=Mx;i<=n;++i) tmp[++t]=b[i];for(i=1;i^Mx;++i) tmp[++t]=b[i];

	for(i=1;i<=n;++i) b[i]=tmp[i];

	for(a[++n]=a[1],i=2;i<=n;++i) c[i]=2*c[i-1]-c[i-2]+2*b[i-1],a[i]-=c[i];

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

	{

		p[i]=P(i,a[i]);W(T>1&&((p[S[T]]-p[S[T-1]])^(p[i]-p[S[T]]))>0) --T;S[++T]=i;

	}

	LL ans=a[S[1]]+a[S[T]];for(i=2;i<=T;++i) ans+=(a[S[i]]+a[S[i-1]])*(S[i]-S[i-1]);

	for(i=1;i<=n;++i) ans+=2*c[i];return printf("%.12lf",0.5*(ans-2*a[1])/(n-1)),0;

}

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

#define Tp template<typename Ty>

#define Ts template<typename Ty,typename... Ar>

#define Reg register

#define RI Reg int

#define Con const

#define CI Con int&

#define I inline

#define W while

#define N 200000

#define LL long long

using namespace std;

int n,b[N+5],S[N+5];LL a[N+5],c[N+5],tmp[N+5];

struct P

{

	LL x,y;I P(Con LL& a=0,Con LL& b=0):x(a),y(b){}

	I P operator - (Con P& o) Con {return P(x-o.x,y-o.y);}

	I LL operator ^ (Con P& o) Con {return x*o.y-y*o.x;}

}p[N+5];

int main()

{

	RI i,Mx;scanf("%d",&n);

	for(Mx=0,i=1;i<=n;++i) scanf("%lld",a+i),tmp[i]=a[i],a[i]>=a[Mx]&&(Mx=i);

	for(i=Mx;i<=n;++i) a[i-Mx+1]=tmp[i];for(i=1;i^Mx;++i) a[i+(n-Mx+1)]=tmp[i];

	for(i=1;i<=n;++i) scanf("%d",b+i),tmp[i]=b[i];

	for(i=Mx;i<=n;++i) b[i-Mx+1]=tmp[i];for(i=1;i^Mx;++i) b[i+(n-Mx+1)]=tmp[i];

	for(a[++n]=a[1],i=2;i<=n;++i) c[i]=2*c[i-1]-c[i-2]+2*b[i-1],a[i]-=c[i];

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

	{

		p[i]=P(i,a[i]);W(T>1&&((p[S[T]]-p[S[T-1]])^(p[i]-p[S[T]]))>0) --T;S[++T]=i;

	}

	LL ans=a[S[1]]+a[S[T]];for(i=2;i<=T;++i) ans+=(a[S[i]]+a[S[i-1]])*(S[i]-S[i-1]);

	for(i=1;i<=n;++i) ans+=2*c[i];return printf("%.15lf",(ans-2*a[1])/2.0/(n-1)),0;

}

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

#include<cstdlib>

#include<algorithm>

#include<iostream>

#include<queue>

#include<vector>

#include <bitset>

using namespace std;

#define INF 1000000000000

#define MAX 100001

typedef long long ll;

typedef pair<ll,ll> P;

typedef pair< pair<int,int>, int> p; 

#define bit(n,k) ((n>>k)&1) /*nのk bit目*/





int main(){

    int N;

    ll A[310000],pre[310000],post[310000];

    cin>>N;

    priority_queue<ll> que,que2;

    for(int i=1;i<=3*N;i++) cin>>A[i];

    ll sum=0,sum2=0;

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

        sum+=A[i];

        sum2+=A[3*N+1-i];

        que.push(-A[i]);

        que2.push(A[3*N+1-i]);

    }

    pre[N]=sum; post[2*N+1]=sum2;

    for(int i=N+1;i<=2*N;i++){

        sum+=A[i];

        sum2+=A[3*N+1-i];

        que.push(-A[i]);

        que2.push(A[3*N+1-i]);

        ll x=que.top(),y=que2.top();

        que.pop(); que2.pop();

        sum+=x; sum2-=y;

        pre[i]=sum; post[3*N+1-i]=sum2;

    }

    ll ans=-10000000000000000;

    for(int i=N;i<=2*N;i++){

        ll temp=pre[i]-post[i+1];

        ans=max(ans,temp);

    }

    cout<<ans<<endl;





}

// Optimized solution to the same problem (faster):
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;



#define INF 1LL << 55

#define MAX (1LL << 31) -1

#define MOD 1000000007

typedef long long ll;

//typedef pair<int,int> P;

//typedef pair<pair<int,int>,ll> p;

#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/

#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

struct edge{ll to,cost,val;};

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

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

//__builtin_popcount(S);

//C.erase(unique(C.begin(),C.end()),C.end());

//#define int ll

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

//#define F function<T(T,T)>





signed main(){

    int N;

    cin>>N;

    vector<ll> a(1+N*3);

    vector<ll> pre(1+N*3),post(1+N*3);

    for(int i=1;i<=3*N;i++){

        cin>>a[i];

    }

    priority_queue<ll> que;

    ll sum=0;

    for(int i=1;i<=2*N;i++){

        que.push(-a[i]);

        sum+=a[i];

        if(N<i) sum+=que.top(),que.pop();

        pre[i]=sum;

    }

    priority_queue<ll> que2;

    sum=0;

    for(int i=3*N;i>=N+1;i--){

        que2.push(a[i]);

        sum+=a[i];

        if(2*N>=i) sum-=que2.top(),que2.pop();

        post[i]=sum;

    }

    ll ans=-INF;

    for(int i=N;i<=2*N;i++){

        chmax(ans,pre[i]-post[i+1]);

    }

    cout<<ans<<endl;





}

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



using namespace std;

const int N = 300003;

const long long infll = 1000000000000000000;

int arr[N];

long long lef[N], righ[N];

int main()

{

    int n;

    scanf("%d",&n);

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

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

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

        lef[i] = -infll, righ[i] = infll;

    long long sum = 0;

    multiset<int> s;

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

        s.insert(arr[i]);

        sum += arr[i];

        if(s.size() == n) {

            lef[i] = sum;

        } else if(s.size() > n) {

            sum -= *s.begin();

            s.erase(s.begin());

            lef[i] = sum;

        }

    }

    s.clear();

    sum = 0;

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

        sum += arr[i];

        s.insert(arr[i]*-1);

        if(s.size() == n) {

            righ[i] = sum;

        } else if (s.size() > n) {

            sum -= *(s.begin()) * -1;

            s.erase(s.begin());

            righ[i] = sum;

        }

    }

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

        lef[i] = max(lef[i],lef[i-1]);

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

        righ[i] = min(righ[i], righ[i+1]);

    long long ans = -infll;

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

        ans = max(ans,lef[i] - righ[i+1]);

    printf("%lld",ans);

    return 0;

}


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

using namespace std;



#define MAX_N 300005

#define INF 0x3f3f3f3f3f3f3f3f



int n;

int a[MAX_N];



int main()

{

    scanf("%d",&n);

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

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



    vector <long long> dp1(3*n ,-INF) ,dp2(3*n ,INF);

    multiset <int> ms;

    long long sum = 0LL;

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

        ms.insert(a[i]) ,sum += a[i];

        if(ms.size() > n){

            sum -= *ms.begin();

            ms.erase(ms.begin());

        }

        if(ms.size() == n)

            dp1[i] = sum;

    }

    sum = 0 ,ms.clear();

    for(int i=3*n-1; ~i; i--){

        ms.insert(a[i]) ,sum += a[i];

        if(ms.size() > n){

            sum -= *prev(ms.end());

            ms.erase(prev(ms.end()));

        }

        if(ms.size() == n)

            dp2[i] = sum;

    }



    long long ans = -INF;

    for(int i=0; i<3*n-1; i++)

        ans = max(ans ,dp1[i]-dp2[i+1]);

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

}


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



using namespace std;



int main() {

	int a, b;

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

	if (b == 1) {

		cout << 0 << endl;

		return 0;

	}

	else cout << a - b << endl;

	return 0;

}

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

#include<string.h>

#include<algorithm>

using namespace std;

int main()

{

	int n,m,a[10010];

	while(~scanf("%d%d",&n,&m))

	{

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

		a[i]=1;

		int sum=n-m;

		a[m-1]+=sum;

		printf("%d\n",a[m-1]-a[0]);

	}

	return 0;

}

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

using namespace std;

int main()

{int a,b,c;

 cin>>a>>b>>c;

 cout<<(a-c)/(b+c)<<endl;

} 

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

int main()

{

	int x, y, z;

	scanf("%d %d %d",&x,&y,&z);

	x = x - z;

	printf("%d\n",x/(y+z));

}

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

using namespace std;

int a,b,c;

int main(){

    cin>>a>>b>>c;

    cout<<(a-c)/(b+c)<<endl;

    return 0;

}

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

int main()

{

	int x, y, z;

	scanf("%d %d %d",&x,&y,&z);

	x = x - z;

	printf("%d\n",x/(y+z));

}

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

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    cout<<(a-c)/(b+c)<<endl;

}

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

int x,y,z,s,ans;

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int main(){

	read(x);read(y);read(z);

	for(;s+z<=x;s=s+z+y) ans++;

	return printf("%d\n",--ans),0;

}

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

#include<cstdio>

using namespace std;

int main()

{

	int x,y,z,ans;

	scanf("%d%d%d",&x,&y,&z);

	ans=(x-z)/(y+z);

	printf("%d",ans);

	return 0;

}

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

int x,y,z,s,ans;

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int main(){

	read(x);read(y);read(z);

	for(;s+z<=x;s=s+z+y) ans++;

	return printf("%d\n",--ans),0;

}

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

using namespace std;

int main(){

	int a,b,c;

	cin >> a >> b >> c;

	cout << (a-c)/(b+c) << endl;

	return 0;

}

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

int x,y,z,s,ans;

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int main(){

	read(x);read(y);read(z);

	for(;s+z<=x;s=s+z+y) ans++;

	return printf("%d\n",--ans),0;

}

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

using namespace std;

int main()

{

	int a,b,c;

	cin>>a>>b>>c;

	cout<<(a-c)/(b+c)<<endl;

    return 0;

}


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

int x,y,z,s,ans;

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int main(){

	read(x);read(y);read(z);

	for(;s+z<=x;s=s+z+y) ans++;

	return printf("%d\n",--ans),0;

}

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

using namespace std;

int main()

{

    int x,y,z;

    cin>>x>>y>>z;

    cout<<(x-z)/(z+y)<<endl;

    return 0;

}

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

int x,y,z,s,ans;

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int main(){

	read(x);read(y);read(z);

	for(;s+z<=x;s=s+z+y) ans++;

	return printf("%d\n",--ans),0;

}

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

using namespace std;

long long x,y,z,sum=0;

int main() {

    scanf("%lld%lld%lld",&x,&y,&z);

    cout<<(x-z)/(z+y)<<endl;

    return 0;

}

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

#include<stdio.h>

#include<cmath>

using namespace std;

int main(){

	int x,y,z;

	scanf("%d%d%d",&x,&y,&z);

	int ans=floor((x-z)/(y+z));

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

	return 0;

}


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

using namespace std;

int main()

{

	int x,y,z;

	cin>>x>>y>>z;

	int s=0;x-=z;

	while((x-y-z)>=0)

	{

		s++;

		x=x-y-z;

	}

	cout<<s<<endl;

	return 0;

}

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

#include<stdio.h>

#include<cmath>

using namespace std;

int main(){

	int x,y,z;

	scanf("%d%d%d",&x,&y,&z);

	int ans=floor((x-z)/(y+z));

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

	return 0;

}


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

using namespace std;

int main(){

    int x,y,z;

    cin>>x>>y>>z;

    cout<<(x-z)/(y+z)<<endl;

    return 0;

}

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

#include<stdio.h>

#include<cmath>

using namespace std;

int main(){

	int x,y,z;

	scanf("%d%d%d",&x,&y,&z);

	int ans=floor((x-z)/(y+z));

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

	return 0;

}


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

#include <cstdio>

#include <algorithm>

#include <cmath>

#include <vector>

using namespace std;



long long cnt;

int l;

int A[1000000];

int n;

vector<int> G;



// ??????g????????????????????\?????????

void insertionSort(int A[], int n, int g) {

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

    int v = A[i];

    int j = i - g;



    while ( j >= 0 && A[j] > v ) {

      A[j + g] = A[j];

      j -= g;

      cnt++;

    }

    A[j + g] = v;

  }

}



void shellSort(int A[], int n) {

  for ( int h = 1; ;) {

    if ( h > n ) break;

    G.push_back(h);

    h = 3*h + 1;

  }



  for ( int i = G.size()-1; i >= 0; i-- ) {

    insertionSort(A, n, G[i]);

  }

}



int main() {

  cin >> n;



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

  cnt = 0;



  shellSort(A, n);



  cout << G.size() << endl;

  for ( int i = G.size() - 1; i >= 0; i-- ) {

    printf("%d", G[i]);

    if ( i ) printf(" ");

  }

  printf("\n");

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

  for ( int i = 0; i < n; i++ ) printf("%d\n", A[i]);



  return 0;

}

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



int insertionSort(int A[], int n, int g) {

  int cnt = 0;

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

    int v = A[i];

    int j = i - g;

    while ( j >= 0 && v < A[j]) {

      A[j + g] = A[j];

      j -= g;

      cnt++;

    }

    A[j + g] = v;

  }



  return cnt;

}



void shellSort(int A[], int n) {

  int im, m = 1, v = 1, G[100], sum = 0;

  for ( im = 0; v <= n; im++ ) {

    G[im] = v;

    m *= 3;

    v += m;

  }



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

  for ( int i = im - 1; i >= 0; i-- ) {

    if ( i != (im - 1) ) printf(" ");

    printf("%d", G[i]);

    sum += insertionSort(A, n, G[i]);

  }



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

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

    printf("%d\n", A[i]);

  }

}



int main() {

  int n, A[1000000];

  scanf("%d", &n);



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



  shellSort(A, n);



  return 0;

}




// Fastest known solution for this problem: