akhauriyash/Code-Regression huggingface dataset:
//
//  main.cpp
//  179-A
//
//  Created by Parsa Alimohammadi on 6/31/1399 AP.
//  Copyright © 1399 Parsa Alimohammadi. All rights reserved.
//
#define ll long long
#define ldu long double
#define pb push_back
#define pop pop_back()
#define du double
// --------------------------------------------------------------
/*
 #define paii pair<int , int>
 #define pasi pair<string,int>
 #define F first
 #define S second
 */
// --------------------------------------------------------------
#define input_txt freopen("input.txt" , "r" , stdin);
#define output_txt freopen("output.txt" , "w" , stdout);
#define Shield  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug cout << "REAlY!! ";
// #define ashar cout << fixed << setprecision(tedad ashaar) << adadet ke bayad double bashe << endl;

#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
// #include<bits/stdc++.h>

using namespace std;

const int maxn = 1e6 * 1 + 2;

string s;
int main()
{
    Shield
    cin >> s;
    
    if (s[s.length()-1] == 's')
        s= s+"es";
    else
        s = s+'s';
    cout << s;
    
    return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <algorithm>
#include <ctime>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

#define PI 3.14159265358979323846264338327950L

int res;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    for (int i = 0; i < 5; i++)
    {
        int tmp;
        cin >> tmp;
        if (tmp == 0)
        {
            cout << i + 1 << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int a,b,c=0,d;
  cin>>a>>b;
  d=a;
  while(a>0){
    a-=b;
    c++;
  }
  cout<<abs(c-(d/b))<<endl;
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define reg register
#define ll long long
#define inf 0x3f3f3f3f
#define iinf 0x3f3f3f3f3f3f3f3fll
using namespace std;
int n;
char op; 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(max(a,b),c)-min(min(a,b),c)<<endl;
} 

Measured memory_bytes: 256
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
os << P.first;
os << " ";
os << P.second;
os << "\n";
return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//fixed<<setprecision(10)<<ans<<endl;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q;
    cin >> N >> Q;

    int time=0;
    queue<pair<string,int>> q;
    string name;
    int t;
    REP(i,N){
        cin >> name >> t;
        q.push(mp(name,t));
    }   
    while(!q.empty()){
        tie(name,t) = q.front();
        q.pop();
        if(t<=Q){
            time += t;
            cout << name << " " <<  time << endl; 
        }else{
            time += Q;
            t-=Q;
            q.push(mp(name,t));
        }
    }
}


Measured memory_bytes: 6336
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N,A[100010],B[100010],C[100010];

signed main(){
  cin>>N;
  for(int t=0;t<N;t++)cin>>A[t];
  for(int t=0;t<N;t++)cin>>B[t];
  for(int t=0;t<N;t++)cin>>C[t];

  sort(A,A+N);
  sort(C,C+N);

  int ans=0;
  for(int t=0;t<N;t++){
    int a=lower_bound(A,A+N,B[t])-A;
    int c=N-(upper_bound(C,C+N,B[t])-C);
    ans+=a*c;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
typedef long long ll;



int main(){
    ll n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l.at(i);
    ll ans=0;
    // vector<int> iter_lower;

    sort(l.begin(), l.end());

    for(ll i=n-1 ;i>=0;i--){
        for(ll j=i-1;j>=0;j--){
            auto iter_lower = lower_bound(l.begin(), l.end(), l.at(i)+l.at(j));
            ll ng = distance(iter_lower, l.end());
            ans += (n-1-i)-ng;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,s,e) for(int i=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;
const int N = 1e5;
const ll INF = 1e15;
int n;
ll a[N], m[2];

int main() {
  ll s = 0;
  m[0] = INF, m[1] = -INF;
  int c = 0;
  scanf("%d ", &n);
  REP(i,n) {
    scanf("%lld ", a+i);
    s += abs(a[i]);
    if (a[i] > 0)
      m[0] = min(m[0], a[i]);
    else {
      m[1] = max(m[1], a[i]);
      c++;
    }
  }
  if (m[1] < 0 && c&1) s -= min(m[0],-m[1])*2;
  printf("%lld\n", s);
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int32 ab = a + b;
    REP(i,n){
        if(s[i] == 'a'){
            if(ab > 0){
                ANS("Yes");
                ab--;
            }else{
                ANS("No");
            }
        }else if(s[i] == 'b'){
            if(ab > 0 && b > 0){
                ANS("Yes");
                ab--;
                b--;
            }else{
                ANS("No");
            }
        }else if(s[i] == 'c'){
            ANS("No");
        }
    }
    return 0;
}

Measured memory_bytes: 848
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pb push_back
#define log(x,b) (log(b)/log(x))
#define rep(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int mod=1e10+7;

int f(int a,int b){
    int m1=0,m2=0;
    while(a>0){
        m1++;
        a/=10;
    }
    while(b>0){
        m2++;
        b/=10;
    }
    return max(m1,m2);
}

int32_t main()
{
    int n;
    cin>>n;
    int res=mod;
    for(int i=1;i*i<=n;i++){
        if(n%i==0){
            if(res>f(i,n/i))
                res=f(i,n/i);
        }
    }
    cout<<res<<endl;


    return 0;
}


Measured memory_bytes: 3524
import sys

def solve():
      input = sys.stdin.readline
      N = int(input())
      D = [[int(i) for i in input().split()] for _ in range(N)]
      for i in range(N - 2):
            if D[i][0] == D[i][1]:
                  if D[i+1][0] == D[i+1][1]:
                        if D[i + 2][0] == D[i+2][1]:
                              print("Yes")
                              return 0
      print("No")

      return 0

if __name__ == "__main__":
      solve() 

Measured memory_bytes: 9196
#include <iostream>
using namespace std;
int main()
{
	int a,b;
        cin >> a >> b;
	if (a == b) cout << "a" << " == " << "b" << endl;
	else if (a > b) cout << "a" << " > " << "b" << endl;
	else cout << "a" << " < " << "b" << endl;
	
}



Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

set<string> st;
map<string,int> r;
map<string,int> used;
map<string,vector<string>> mp;

void dfs(string s){
	for(string t:mp[s]){
		if(used[t])continue;
		used[t]=1;
		if(r[t]==0){
			st.insert(t);
			continue;
		}
		dfs(t);
	}
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	while(cin >> n,n){
		r.clear();
		mp.clear();
		string ttt;
		st.clear();
		used.clear();
		for(int i=0;i<n;i++){
			string s; cin >> s;
			bool f=1;
			string t="";
			string tt="";
			for(int j=0;j<s.size();j++){
				if(f){
					if(s[j]==':')f=0;
					else t+=s[j];
				}
				else{
					if(s[j]=='.'||s[j]==','){
						mp[t].push_back(tt);
						tt="";
					}
					else{
						tt+=s[j];
					}
				}
			}
			r[t]++;
			if(!i)ttt=t;
		}
		dfs(ttt);
		printf("%d\n",st.size());
	}
}


Measured memory_bytes: 3540
#include "bits/stdc++.h"
using namespace std;
#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
typedef long long ll;

const int INF = 1e9;
const long long LLINF = 1e18;

string a, b;
int main() {
    cin>>a>>b;

    a+=b;
    int num=0;
    REP(i, 0, a.size()){
        num+=(a[i]-'0');
        num*=10;
    }
    num/=10;
    bool flag=false;
    REP(i, 0, 1010){
        if(i*i==num) flag=true;
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

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

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans;

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}

int main(){
	//IO();
	scanf("%d%d",&n,&m);
	if (n>m)
		swap(n,m);
	for(int i=0;i<m;i++)
		printf("%d",n);
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {if ((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint& operator-=(const mint a) {if ((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint& operator*=(const mint a) {(x*=a.x)%=MOD; return *this;}
    mint operator+(const mint a) const {mint res(*this); return res+=a;}
    mint operator-(const mint a) const {mint res(*this); return res-=a;}
    mint operator*(const mint a) const {mint res(*this); return res*=a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD-2);}
    mint& operator/=(const mint a) { return (*this) *= a.inv();}
    mint operator/(const mint a) const {mint res(*this); return res/=a;}
};

const int cmax = 100010;
mint fac[cmax],finv[cmax],inv[cmax];

void com_init() {
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<cmax; i++) {
        fac[i]=fac[i-1]*i;
        inv[i]=-inv[MOD%i]*(MOD/i);
        finv[i]=finv[i-1]*inv[i];
    }
}

mint com(int n, int k) {
    if (n<k) return 0;
    if (n<0||k<0) return 0;
    mint ret=fac[n]*finv[k]*finv[n-k];
    return ret;
}

vi g[N + 1];
int n, k;

mint bfs(int s) {
	vector<bool> seen(n + 1, false);
	queue<int> que;
	com_init();
	seen[s] = true;
	mint ret = k;
	ret *= com(k - 1, g[s].size()) * fac[g[s].size()];
//	cout << ret.x << endl;
	for(auto i : g[s]) {
		seen[i] = true;
		que.push(i);
	}
	while(!que.empty()) {
		int i = que.front();
		que.pop();
		if(g[i].size() == 1) continue;
		ret *= com(k - 2, g[i].size() - 1) * fac[g[i].size() - 1];
//		cout << ret.x << endl;
		for(auto j : g[i]) {
			if(seen[j]) continue;
			seen[j] = true;
			que.push(j);
		}
	}
	return ret;
}

int main() {
	cin >> n >> k;
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	cout << bfs(1).x << endl;
}


Measured memory_bytes: 8952
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=100005;
int n,pos1,pos2;
ll C,x[N],w[N],sum,Max,Max1[N],Max2[N];
int main()
{
    scanf("%d%lld",&n,&C);
    for (int i=1;i<=n;i++) scanf("%lld%lld",&x[i],&w[i]);
    for (int i=1;i<=n;i++)
    {
        sum+=w[i],Max1[i]=max(Max1[i-1],sum-x[i]);
    }
    sum=0;
    for (int i=n;i>=1;i--)
    {
           sum+=w[i],Max2[i]=max(Max2[i+1],sum-(C-x[i]));
           //printf("%lld\n",Max2[i]);
    }
    Max=max(Max1[n],Max2[1]);
   //printf("%d\n",Max);
    sum=0;
    for (int i=1;i<=n;i++) sum+=w[i],Max=max(Max,Max2[i+1]+sum-x[i]*2);
    sum=0;
    for (int i=n;i>=1;i--) sum+=w[i],Max=max(Max,Max1[i-1]+sum-(C-x[i])*2);
    printf("%lld\n",Max);
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  ll ret = 0;
  for (ll i = 1LL; ; i++) {
    ll b = (N - i) / i;
    if (b <= i) break;
    if ((N - i) % i != 0) continue;
    ret += b;
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    x = [0]*10**5

    for i in a:
        x[i] += 1

    ans = 0
    for i in range(len(x)):
        count = 0
        if i == 0:
            ans = max(x[0] + x[1], ans)
        elif i == len(x)-1:
            ans = max(x[len(x)-2] + x[len(x)-1], ans)
        else:
            ans = max(x[i-1] + x[i] + x[i+1], ans)

    print(ans)



Measured memory_bytes: 13964
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================




int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	vvint A(3);
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			int a;
			cin >> a;

			A[i].emplace_back(a);
		}

	}


	int N;
	cin >> N;

	vint B(N);
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}


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

		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {

				if (A[j][k] == B[i]) {
					A[j][k] = -1;
				}


			}
		}
	}


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

		for (int j = 0; j < 3; j++) {
			if (A[i][j] != -1) {
				break;
			}
			else if (j == 2) {
				cout << "Yes";
				return 0;
			}
		}

		for (int j = 0; j < 3; j++) {
			if (A[j][i] != -1) {
				break;
			}
			else if (j == 2) {
				cout << "Yes";
				return 0;
			}
		}


	}

	if (A[0][0] == A[1][1] && A[1][1] == A[2][2] && A[0][0] == -1) {
		cout << "Yes";
		return 0;
	}

	if (A[2][0] == A[1][1] && A[1][1] == A[0][2] && A[1][1] == -1) {
		cout << "Yes";
		return 0;
	}

	cout << "No";




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    for (;;) {
        int r0, w0, c, r;
        cin >> r0 >> w0 >> c >> r;
        
        if (r0 == 0) break;
        
        // target: (r0 + n * r) / (w0 + w) = c
        // r0 + n * r = c * (w0 + w)
        // r0 + n * r = c * w0 [w = 0]
        int up = c * w0 - r0;
        int down = r;

        if (up <= 0) {
            cout << 0 << endl;
        } else {
            cout << 1 + (up - 1) / down << endl;
        }
    }
}


Measured memory_bytes: 3180
#include<bits/stdc++.h>
#include<queue>
using namespace std;
vector<queue<int>>gra;
vector<int>cl;
vector<int>si;
bool dfs(int x, int c) {
  if (cl[x] != -1) {
    return cl[x] == c;
  }
  cl[x] = c;
  for (int i = 0; i < si[x]; i ++) {
    int u = gra[x].front();
    gra[x].pop();
    gra[x].push(u);
    int d = (c + 1) % 2;
    bool kj = dfs(u, d);
    if (!kj) return false;
  }
  return true;
}
int main () {
  int N, M;
  cin >> N >> M;
  gra.resize(N);
  cl.assign(N, -1);
  si.assign(N, 0);
  for (int i = 0; i < M; i ++) {
    int a, b;
    cin >> a >> b;
    a --;
    b --;
    gra[a].push(b);
    gra[b].push(a);
    si[a] ++;
    si[b] ++;
  }
  if (dfs(0, 0)) {
    int kj = 0;
    for (int i = 0; i < N; i ++) {
      kj += cl[i];
      //cout << cl[i] << endl;
    }
    //cout << kj << endl;
    long long ans = (long long)kj * (N - kj);
    long long m = (long long)M;
    cout << ans - m << endl;
  }
  else {
    long long ans = (long long)N * (N - 1);
    ans /= 2;
    long long m = (long long)M;
    cout << ans - m << endl;
  }
}



Measured memory_bytes: 68224
import math
import collections

def main():
    N, K = map(int, input().split())
    ans = {}

    for k in range(K):
        d = int(input())
        A = list(map(int, input().split()))
        for a in A:
            ans[a] = 1
    print(N - len(ans))

    return 0

if __name__ == '__main__':
    main()

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using pii = pair<int, int>;

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;
}

//pow(llpow,modpow)
template <class T>
ll llpow(ll x, T n)
{
    ll ans = 1;
    if (x == 0)
        ans = 0;
    while (n)
    {
        if (n & 1)
            ans *= x;
        x *= x;
        n >>= 1;
    }
    return ans;
}
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
template <class T>
inline T gcd(T x, T y)
{
    if (y == 0)
        return x;
    else
    {
        return gcd(y, x % y);
    }
}
//最小公倍数
template <class T>
inline T lcm(T x, T y) { return x / gcd(x, y) * y; }
//逆元
long long modinv(long long a, long long m)
{
    long long b = m, u = 1, v = 0;
    while (b)
    {
        long long t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0)
        u += m;
    return u;
}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL << 60;
int main()
{
    int n;
    cin >> n;
    vi a(n);
    rep(i, 0, n) cin >> a[i];
    sort(a.begin(), a.end());
    ll sum = 0;
    auto pos = lower_bound(a.begin(), a.end(), 0);
    int dist = distance(a.begin(), pos);
    int p = 0;
    int cnt;
    if (dist % 2)
    {
        if (pos != a.end())
        {
            if(abs(*(pos - 1))>*pos)
            {
                cnt = (dist + 1) / 2;
            }
            else
            {
                cnt = (dist - 1) / 2;
            }
        }
        else
        {
            cnt = (dist - 1) / 2;
        }
        while (cnt--)
        {
            sum += -(a[p] + a[p + 1]);
            p += 2;
        }
        while (n > p)
        {
            sum += a[p];
            p++;
        }
    }
    else
    {
        while (p < n)
        {
            if (a[p] < 0)
                sum += -a[p++];
            else
                sum += a[p++];
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
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;
}

int main() {

    int n, k;
    cin >> n >> k;

    vector<ll> x(n);
    vector<ll> dis(n);
    rep(i, n){
        cin >> x[i];
        if(i){
            dis[i] = dis[i-1] + abs(x[i]-x[i-1]);
        }
    }

    ll ans = 1LL << 60;
    rep(i, n-k+1){
        ll tmp = min(abs(x[i]), abs(x[i+k-1]));
        ll res = tmp + dis[i+k-1] - dis[i];
        ans = min(ans, res);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;


long long solve(long long x, const vector<long long> & As){
    long long count = 0;
    long long cum = 0;
    long long tail = 0;
    for (long long head = 0; head < As.size(); ++head){
        while (tail < As.size() and cum < x){
            cum += As[tail];
            ++tail;
        }
        count += tail - head;
        if (cum > x) --count;
        cum -= As[head];
    }
    return count;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, Q;
    cin >> N >> Q;
    vector<long long> As(N);
    vector<long long> Xs(Q);
    for (auto & a : As) cin >> a;
    for (auto & x : Xs) cin >> x;
    for (auto x : Xs) cout << solve(x, As) << '\n';
    return 0;
}

Measured memory_bytes: 3628
//============================================================================
// Name        : filename.cpp
// Author      : abb
// Version     :
// Copyright   : [My copyright notice]
// Description : test program
//============================================================================

/*
B - Balance

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 200 点

問題文
1 から N の番号がついた N 個の重りがあり、番号 i の重りの重さは W_i です。
ある整数 1 <= T < N に対してこれらの重りを、番号が T 以下の重り と 番号が T より大きい重りの 2 グループに分けることを考え、それぞれのグループの重さの和を S_1, S_2 とします。
このような分け方全てを考えた時、S_1 と S_2 の差の絶対値の最小値を求めてください。

制約

・2 <= N <= 100
・1 <= W_i <= 100
・入力は全て整数である
 */

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i, m, n) for (ll i = (m); i < (ll)(n); ++(i))
#define REPM(i, m, n) for (ll i = (m); i <= (ll)(n); ++(i))
#define REPR(i, m, n) for (ll i = (m); i >= (ll)(n); --(i))
#define REPD(i, m, n, d) for (ll i = (m); i < (ll)(n); i += (d))
#define REPMD(i, m, n, d) for (ll i = (m); i <= (ll)(n); i += (d))
#define ALL(x) begin(x), end(x)

/**
 * エントリポイント．
 * @return 0.
 */
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n;
    cin >> n;
    vector<ll> w(n);
    ll sum = 0;
    REP(i, 0, n)
    {
        cin >> w[i];
        sum += w[i];
    }

    ll s1 = 0, s2;
    ll diff = sum, diff_tmp;
    REP(i, 0, n)
    {
        s1 += w[i];
        s2 = sum - s1;
        diff_tmp = abs(s2 - s1);
        diff = min(diff, diff_tmp);
        if (diff != diff_tmp)
        {
            break;
        }
    }

    cout << diff << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 ll R;
  cin>>R;
  if(R<1200) {
cout<<"ABC"<<endl;
  }
else if(R<2800) {
cout<<"ARC"<<endl;
}
  else {
cout<<"AGC"<<endl;
  }
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	string s[105];
	int p[105];
	int num[105];
	vector<pair<string, pair<int, int>>> vp;
	for(int i=0;i<n;i++){
		cin >> s[i] >> p[i];
		num[i] = i+1;
		vp.push_back(make_pair(s[i], make_pair(-p[i], num[i])));

	}
	sort(vp.begin(), vp.end());
	for(int i=0;i<n;i++){
		cout << vp[i].second.second << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
long long a[1005],b[1005],c[1005];
inline bool cmp(long long x,long long y)
{
	return x>y;
}
inline bool cmp2(pair <long long,pair<long long,long long> > x,pair <long long,pair<long long,long long> > y)
{
	return a[x.first]+b[x.second.first]+c[x.second.second]>
		   a[y.first]+b[y.second.first]+c[y.second.second];
}
pair <long long,pair<long long,long long> > ans[1000005];
int main(int argc, char** argv) {
	long long K;
	long long x,y,z;
	cin >> x >> y >> z >> K;
	long long cnt=0;
	for(long long i=1;i<=x;i++) cin >> a[i];
	for(long long i=1;i<=y;i++) cin >> b[i];
	for(long long i=1;i<=z;i++) cin >> c[i];
	sort(a+1,a+x+1,cmp);
	sort(b+1,b+y+1,cmp);
	sort(c+1,c+z+1,cmp);
//	cout << a[1] << " " <<b[1] << " " << c[1] << "\n";
	for(long long i=1;i<=x;i++)
	{
		for(long long j=1;j<=y;j++)
		{
			for(long long k=1;k<=z;k++)
			{
				if(i*j*k>K+1) break;
				ans[++cnt]={i,{j,k}};
			}
		}
	}
	sort(ans+1,ans+cnt+1,cmp2);
	for(long long i=1;i<=K;i++)
	{
		cout << a[ans[i].first]+b[ans[i].second.first]+c[ans[i].second.second] << "\n";
//		cout << ans[i].first << " " << ans[i].second.first << " " << ans[i].second.second << "\n";
	}
	return 0;
}

Measured memory_bytes: 4352
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int p[] = new int[123456];

		while (true) {
			int n = sc.nextInt();
			if (n == 0) return;

			int count = 0;
			for (int i = n + 1; i <= 2 * n; i++) {
				if (isPrime(i)) {
					//System.out.println(i);
					count++;
				}
			}
			System.out.println(count);
		}
	}

	private static boolean isPrime(int a) {

		if (a == 1 && a == 2) return true;

		for (int i = 2; i * i <= a; i++) {
			if(a % i == 0) return false;
		}
		return true;
	}
}



Measured memory_bytes: 27824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, from, to) for (int i = from; i < to; i++)
int main()
{
  int N;
  cin >> N;
  if (N == 7 || N == 5 || N == 3)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int n,m;
    cin>>n>>m;
    ll p[n+1];
    rep(i,n+1) {
        p[i] = 0;
    }
    p[0] = 1;
    p[1] = 1;
    rep(i,m) {
        int tmp;
        cin >> tmp;
        p[tmp] = -1;
    }
    for(int i = 2;i <= n;i++) {
        if (p[i-2] != -1 && p[i] != -1) p[i] += p[i-2];
        p[i] = p[i]%MOD;
        if (p[i-1] != -1 && p[i] != -1) p[i] += p[i-1];
        p[i] = p[i]%MOD;
    }
    cout << p[n];
}

Measured memory_bytes: 1024
n = int(input())
dictionary = {}
for i in range(n) :
    new_word = input()
    if new_word in dictionary.keys() :
        dictionary[new_word] += 1
    else :
        dictionary[new_word] = 1

max_val = max(dictionary.values())
keys_of_max_val = [key for key in dictionary if dictionary[key] == max_val]

keys_of_max_val.sort()

for word in keys_of_max_val :
    print(word)

Measured memory_bytes: 32220
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i, n) {
        ll tmp_a;
        cin >> tmp_a;
        sum += tmp_a;
        if ( i == 0 ) a[i] = tmp_a;
        else          a[i] = tmp_a + a[i-1];
    }
    ll min_num = 1e18;
    rep(i, n) min_num = min(min_num, abs(sum - a[i] - a[i]));
    cout << min_num << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int main() {

  int sx, sy, tx, ty;
  cin>>sx>>sy>>tx>>ty;

  int dy = ty - sy, dx = tx - sx;

  //cout<<"dx:"<<dx<<" "<<"dy:"<<dy<<endl;

  for(int i=0; i<dx; i++)cout<<"R";
  for(int i=0; i<dy; i++)cout<<"U";
  for(int i=0; i<dx; i++)cout<<"L";
  for(int i=0; i<dy; i++)cout<<"D";
  cout<<"L";
  for(int i=0; i<dy+1; i++)cout<<"U";
  for(int i=0; i<dx+1; i++)cout<<"R";
  cout<<"DR";
  for(int i=0; i<dy+1; i++)cout<<"D";
  for(int i=0; i<dx+1; i++)cout<<"L";
  cout<<"U"<<endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ca = cb = 0
for i in range(n):
    if a[i] > b[i]:
        ca += a[i] - b[i]
    elif a[i] < b[i]:
        cb += (b[i] - a[i])//2
if cb >= ca:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 4596
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    System.out.println(n/3);
  }
}

Measured memory_bytes: 32380
#include <bits/stdc++.h>

using namespace std;

const int N = 0.3 * 1000 + 17;
//const int MOD = 1000 * 1000 * 1000 + 7;
const int MOD = 998244353;

int n;
int a[N];
long long dp[N][N * N];

bool read() {
    if (!(cin >> n))
        return false;

    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    return true;
}

void solve() {
    auto sum = accumulate(a, a + n + 1, 0ll);
    dp[0][0] = 1;

    for (int i = 0; i < n; ++i) {
        for (int s = 0; s <= sum; ++s) {
            dp[i + 1][s] = (dp[i + 1][s] + 2 * dp[i][s]) % MOD;

            if (s + a[i + 1] <= sum)
                dp[i + 1][s + a[i + 1]] = (dp[i + 1][s + a[i + 1]] + dp[i][s]) % MOD;
        }
    }

    auto ans = 1ll;

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

    for (int s = (sum + 1) / 2; s <= sum; ++s) {
        ans -= 3 * dp[n][s];
        ans = (MOD + ans % MOD) % MOD;
    }

    if (sum % 2 == 0) {
        for (int i = 0; i <= n; ++i)
            for (int s = 0; s <= sum; ++s)
                dp[i][s] = 0;

        dp[0][0] = 1;

        for (int i = 0; i < n; ++i) {
            for (int s = 0; s <= sum; ++s) {
                dp[i + 1][s] = (dp[i + 1][s] + dp[i][s]) % MOD;

                if (s + a[i + 1] <= sum)
                    dp[i + 1][s + a[i + 1]] = (dp[i + 1][s + a[i + 1]] + dp[i][s]) % MOD;
            }
        }

        ans += 3 * dp[n][sum / 2];
    }

    cout << ans % MOD << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 237696
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int a = N/10;
  int b = a/10;
    if(N%10==7){
      cout << "Yes" << endl;
    }
    else if(a%10==7){
      cout << "Yes" << endl;
    }
    else if(b%10==7){
      cout << "Yes" << endl;
    }
      else{
       cout << "No" << endl;
      }
      return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, sum = 0, a[22], b[22], c[22];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        sum += b[i];
    }
    for (int i = 0; i < n - 1; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < n - 1; i++) {
        if (a[i] + 1 == a[i + 1]) {
            sum += c[a[i] - 1];
        }
    }
    cout << sum << endl;
}



Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	if(n % 2){
		cout << "No";
	} else{
		if(s.substr(0, n/2) == s.substr(n/2))
			cout << "Yes";
		else
			cout << "No";
	}
	
	return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = n.times.map{gets.to_i}
sorted = a.sort.reverse
max_val = a.max
max_only = a.count(max_val) == 1

a.each do |i|
  if i == max_val && max_only
    puts sorted[1]
  else
    puts max_val
  end
end

Measured memory_bytes: 7416
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 2e5 + 77;
const ll mod = (int)1e9 + 7;
const ll inf = (int)1e9 + 77;

int main()
{
  ll n, k, a[105];
  scanf("%lld%lld", &n, &k);
  for (int i = 1; i <= n; i++)
    scanf("%lld", a + i);
  vector<ll> dp(k + 1, 0);
  vector<ll> sum(k + 1, 0);
  dp[0] = 1, sum[0] = 1;
  for (int i = 1; i <= k; i++)
    sum[i] = sum[i - 1] + dp[i];
  for (int child = 1; child <= n; child++)
  {
    vector<ll> new_sum(k + 1, 0);
    new_sum[0] = 1;
    for (int candies = 1; candies <= k; candies++)
    {
      int left = candies - a[child] - 1;
      dp[candies] = sum[candies] - (left < 0 ? 0 : sum[left]) + mod;
      dp[candies] %= mod;
      new_sum[candies] = new_sum[candies - 1] + dp[candies];
      new_sum[candies] %= mod;
    }
    sum = new_sum;
  }
  printf("%lld", dp[k]);
  return 0;
}

Measured memory_bytes: 2560
long d[2<<17],*p,m=1e9+7;j;
main(a,k)
{
	scanf("%*d%d",&k);
	p=d+k;
	for(*p=1;~scanf("%d",&a);)
	{
		//for(;d-p--;)*p+=p[1];for(;p++-d<k;*p%=m)*p-=p[a+1];
		j=0;for(;j?p++-d<k:d-p--||(j=1);*p%=m)*p+=j?-p[a+1]:p[1];
	}
	printf("%ld",(*d+m)%m);
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
 
#define ar array 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,a,b) for(int i = a; i < b; i++)
#define deb(x) cout << #x << "=" << x << endl
#define PI 3.1415926535897932384626
#define endl '\n'
 
using namespace std;
 
typedef long long ll; 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
 
 
const  int mxN = 1e5+5;
const  long long INF= 1e18;
const long long mod= 1e9+7;


void solve() {
  int n;
  cin >> n;
  vi v(n);

  rep(i, 0, n) {
    cin >> v[i];
  }

  sort(rall(v));

  priority_queue<int> q;

  ll ans = 0;
  q.push(v[0]);

  rep(i, 1, n) {
    int x = q.top();
    q.pop();
    ans += x;
    q.push(v[i]);
    q.push(v[i]);
  }
  cout << ans;
  

}

int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
  #endif

int t = 1;
//cin >> t;
while(t--) {
solve();
}
}



Measured memory_bytes: 5056
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {

		 BufferedReader br = new BufferedReader(new
		 InputStreamReader(System.in));
		//BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
		StringBuilder moji = new StringBuilder(br.readLine());
		int x = Integer.parseInt(br.readLine());
		for (int i = 0; i < x; i++) {

			Scanner sc = new Scanner(br.readLine());
			String com = sc.next();
			int start = sc.nextInt();
			int end = sc.nextInt();
			if (com.equals("print"))
				System.out.println(moji.substring(start, end + 1));
			else if (com.equals("replace")) {
				String rep=sc.next();
				moji.replace(start, end+1, rep);
				}
			else {
				StringBuilder stb=new StringBuilder(moji.substring(start, end+1).toString());
				stb.reverse();
				moji.replace(start, end+1, stb.toString());
			}
			sc.close();
		}

	}

}

Measured memory_bytes: 33672
import java.io.BufferedReader; 
import java.io.*;
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
import java.math.*;
public class Main 
{ 
    static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader()
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next()
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine();
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
   public static void main(String args[])
    {
        FastReader sc=new FastReader();
        PrintWriter pw=new PrintWriter(System.out);
        int t=1;//sc.nextInt();
        long mod=1000000007;
        while(t-->0)
        {
 int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt(),k=sc.nextInt(),ans=0;
          while(b<=a && k>0)
          {
              b*=2;
              k--;
          }
          while(c<=b && k>0)
          {
            c*=2;k--;
          }
          if(b<=a||c<=b)pw.println("No");
          else pw.println("Yes");
        }
           pw.close();
    }
    static int gcd(int a,int b)
    {
        if(b==0) return a;
        return gcd(b,a%b);
    }
}
  

Measured memory_bytes: 32988
import kotlin.math.max

//

fun main() {
    abc172c()
}

fun abc172c() {
    val (n, m, k) = readLine()!!.split(" ").map { it.toLong() }
    val a = readLine()!!.split(" ").map { it.toLong() }
    val b = readLine()!!.split(" ").map { it.toLong() }
    var max_count = 0
    // REの理由はメモリの限界を超えてるから
    val times = LongArray((m + 1).toInt()) { 0L }
    val ni = n.toInt()
    val mi = m.toInt()
    var max_j = 0
    for (j in 0 until mi) {
        times[j + 1] = times[j] + b[j]
        if (times[j + 1] <= k) {
            max_count = max(max_count, j + 1)
            max_j = j + 1
        } else {
            break
        }
    }
    var ai = 0L
    for (i in 1..ni) {
        ai += a[i - 1]
        for (j in max_j downTo 0) {
            if (times[j] + ai <= k) {
                max_count = max(max_count, i + j)
                break
            } else {
                max_j = j
            }
        }
    }
    println(max_count)
}


Measured memory_bytes: 83424
#include<iostream>
using namespace std;
 long int knapSack(long int W,long  int wt[],long int val[],long int n)
{ 
  long int i, w; 
   long int K[n+1][W+1]; 
  
   // Build table K[][] in bottom up manner 
   for (i = 0; i <= n; i++) 
   { 
       for (w = 0; w <= W; w++) 
       { 
           if (i==0 || w==0) 
               K[i][w] = 0; 
           else if (wt[i-1] <= w) 
                 K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
           else
                 K[i][w] = K[i-1][w]; 
       } 
   } 
  
   return K[n][W]; 
}
int main()
{
 long int n,W,i;
  cin>>n>>W;
  long int wt[n],val[n];
  for(i=0;i<n;i++)
  {
    cin>>wt[i]>>val[i];
  }
  cout<<knapSack(W,wt,val,n);
      return 0;
}

Measured memory_bytes: 79104
x, n = gets.chomp.split().map(&:to_i)
if n == 0
  print(x)
  exit 0
else
  arr = gets.chomp.split().map(&:to_i).sort!
end

i = arr.find_index(x)

if i.nil?
  print(x)
  exit 0
end

j = 1
while true do
  row = i - j
  high = i + j
  if arr[row] != x - j
    print(x - j)
    break
  elsif arr[high] != x + j
    print(x + j)
    break
  end
  j += 1
end


Measured memory_bytes: 14324
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------






int N, A[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];

    map<int, int> cnt;
    rep(i, 0, N) cnt[A[i]]++;

    int ans = 0;
    fore(p, cnt) {
        if (p.first == p.second) continue;
        if (p.first < p.second) ans += p.second - p.first;
        else ans += p.second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#include <iostream>
#define ll long long

using namespace std;

int main() {
    double d,t,s; cin>>d>>t>>s;
    double at = (d/s);
    if(at<=t){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    int n,k;
    cin>>n>>k;
    if (!k) {
    	cout << 1ll * n * n << '\n';
    	return 0;
    }
    ll ans = 0;
    for (int i = k;i <= n;++i) {
    	int t = (n + 1) / i;
    	ans += 1ll * (i - k) * t;
    	int l = i * t + k;
    	int r = n;
    	ans += max(0,r - l + 1);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int h, w, n; cin >> h >> w >> n;
  vector<set<int>> P(w);
  rep(i, n) {
    int x, y; cin >> x >> y;
    x--; y--;
    P[y].insert(x);
  }
  int mn = inf;
  int lb = 0;
  rep(i, w) {
    P[i].insert(h);
    if(lb+1 > h) break;
    mn = min(*lower_bound(all(P[i]), lb+1), mn);
    if(i != w-1) while(lb+1<=h && P[i+1].count(lb+1)) lb++;
    lb++;
  }
  cout << mn << endk;
  return 0;
}


Measured memory_bytes: 29180
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <vector>
using namespace std;
#define FOR(__I,__N) for (int __I = 0; __I < __N; ++__I)

typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64, int64> pll;
typedef double db;
typedef long double ldb;

const int INF = 0x3f3f3f3f;
const int64 INF64 = 0x3f3f3f3f3f3f3f3fLL;

const int MOD = 1000000007;


bool solve(int X, int Y){
	int b = (Y-2*X)/2;
	int a = X-b;
	if(a < 0 || a > X)	return false;
	if(b < 0 || b > X)	return false;
	if(2*a+4*b != Y)	return false;

	return true;
}


int main(){
	int X,Y; cin >> X >> Y;

    bool ans = solve(X,Y);
	if(ans)	puts("Yes");
	else	puts("No");
}





Measured memory_bytes: 3620
#include <stdio.h>
#include <cmath>

int main(void) {
  int a, b, x;
  scanf("%d %d %d", &a, &b, &x);
  if (2*x <= a*a*b) {
    printf("%.10f\n", std::atan(a*b*b/2.0/x) * 180 / M_PI);
  } else {
    printf("%.10f\n", std::atan(2.0*(a*a*b-x)/(a*a*a)) * 180 / M_PI);
  }
  return 0;
}


Measured memory_bytes: 384
n = int(input())
import math
coordinates = [list(map(int, input().split())) for i in range(n)]
dis = []
for i in range(n-1):
    for j in range(i+1,n):
        d = math.sqrt((coordinates[i][0]-coordinates[j][0])**2 + (coordinates[i][1]-coordinates[j][1])**2)
        dis.append(d)
        dis.append(d)
print(sum(dis)/n)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x < k - x) sum += 2 * x;
        else sum += 2 * (k - x);
    }
    cout << sum << endl;
}


Measured memory_bytes: 256