akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int x;
  cin >> x;
  int amari = x % 100;
  int s5, s4, s3, s2, s1;
  s5 = amari / 5;
  amari = amari - s5 * 5;
  s4= amari / 4;
  amari = amari - s4 * 4;
  s3 = amari / 3;
  amari = amari - s3 * 3;
  s2 = amari / 2;
  amari = amari - s2 * 2;
  s1 = amari / 1;
  amari = amari - s2 * 2;
  if(s5 + s4 + s3 + s2 + s1 > x / 100){
    cout << 0;
  }else{
    cout << 1;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    lli n;
    cin>>n;
    lli a[n],b[n];
    for(lli i=0;i<n;i++)cin>>a[i];
    for(lli i=0;i<n;i++)cin>>b[i];
    lli sum=0;
	for(lli i=0;i<n;i++)
	{
		if(a[i]>b[i])sum+=a[i]-b[i];
	}
	cout<<sum;
   	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/*
 * abc153d.cpp
 * Copyright (C) 2020 itachi <itachi@itachi-Z510>
 *
 * Distributed under terms of the MIT license.
 */

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

unordered_map<long long,long long> mp;

long long find(long long x) {
    if (x==1) return 1;
    if (mp.find(x)==mp.end()) {
        mp[x] = 2*find(x/2) + 1;
    }
    return mp[x];
}

int main() {
    long long h;
    cin >> h;
    cout << find(h) << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace AOJ
{
	class Program
	{
		public static void Main(string[] args)
		{
			var a = Console.ReadLine().Split(' ').ToList();
			a.Sort((x,y)=>int.Parse(x)-int.Parse(y));
			Console.WriteLine(string.Join(" ",a.ToArray()));
		}
	}
}

Measured memory_bytes: 19864
from math import log2


def build():
    global parent
    dfs()
    pk0 = parent[0]
    for pk1 in parent[1:]:
        for v in range(n):
            pkv = pk0[v]
            pk1[v] = -1 if pkv < 0 else pk0[pkv]
        pk0 = pk1


def dfs():
    global depth, parent, tree
    stack = [(0, -1, 0)]
    while stack:
        v, p, d = stack.pop()
        parent[0][v] = p
        depth[v] = d
        stack.extend((child, v, d + 1) for child in tree[v])


def lca(u: int, v: int) -> int:
    global depth, parent
    du, dv = depth[u], depth[v]
    if du > dv:
        u, v = v, u
        du, dv = dv, du
    for k, pk in enumerate(parent):
        if (dv - du) >> k & 1:
            v = pk[v]
    if u == v:
        return u
    for pk in parent[logn - 1:None:-1]:
        pku, pkv = pk[u], pk[v]
        if pku != pkv:
            u, v = pku, pkv
    return parent[0][u]


if __name__ == "__main__":
    n = int(input())
    tree = []
    for _ in range(n):
        _, *children = map(lambda x: int(x), input().split())
        tree.append(set(children))

    logn = int(log2(n)) + 1
    parent = [[0] * n for _ in range(logn)]
    depth = [0] * n
    build()

    q = int(input())
    for _ in range(q):
        u, v = map(lambda x: int(x), input().split())
        print(lca(u, v))



Measured memory_bytes: 58280
S = input()
T = input()


def found(i):
    for j in range(len(T)):
        if S[i] == '?' or S[i] == T[j]:
            i += 1
        else:
            return False
    return True

ret = 'UNRESTORABLE'
for i in range(len(S) - len(T), -1, -1):
    if found(i):
        ret = S[:i] + T + S[i + len(T):]
        break
    else:
        i += 1

print(''.join('a' if x == '?' else x for x in ret))


Measured memory_bytes: 38256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;
int gcd(int a,int b){
    if(a < b){
        int c = a;
        a = b;
        b = c;
    }
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}
signed main(){

    int t;
    cin >> t;
    rep(i,t){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        if(a < b || d < b){
            cout << "No" << endl;
            continue;
        }else if(c+1 >= b){
            cout << "Yes" << endl;
            continue;
        }
        if(a%b > c){
            cout << "No" << endl;
            continue;
        }
        int x = gcd(d,b);
        if(b-c-1 >= x){
            cout << "No" << endl;
            continue;
        }
        if((a%b)%x + b - x > c && (a%b)%x + b - x < b){
            cout << "No" << endl;
            continue;
        }
        cout << "Yes" << endl;
    }
    

    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://agc026.contest.atcoder.jp/tasks/agc026_b


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

int main()
{
    int N;
    cin >> N;
    vector<long> A(N);
    for(int i = 0;i<N;i++)
    {
        cin >> A[i];
    }
    
    sort(A.begin(),A.end());
    
    
    long temp = 0;
    int ans = 0;
    for(int i=0;i<N;i++)
    {
        if(A[i] == temp)
        {
            ans--;
            temp = 0;
        }
        else
        {
            ans++;
            temp = A[i];
        }
    }
    
    
    
    cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 1024
#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)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if (a == 0 || b == 0)
    {
        ans = 0;
    }
    else if (a < 0 && b > 0)
    {
        ans = 0;
    }
    else if (a > 0)
    {
        ans = 1;
    }
    else
    {
        ans = (b - a + 1) % 2 == 0 ? 1 : -1;
    }

    if (ans == 0)
    {
        cout << "Zero" << endl;
    }
    else if (ans > 0)
    {
        cout << "Positive" << endl;
    }
    else
    {
        cout << "Negative" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    ll ans = LINF;
    rep(i, n - k + 1) {
        int l = i, r = i + k - 1;
        ll tot;
        if(x[r] < 0) tot = abs(x[l]);
        else if(x[l] > 0) tot = x[r];
        else tot = min(abs(x[l]) * 2 + x[r], abs(x[l]) + x[r] * 2);

        ans = min(ans, tot);
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
  int N,K;
  cin >> N >> K;
  string S;
  cin >> S;
  if(S[K-1] == 'A'){
    S[K-1] = 'a';
  }else if(S[K-1] == 'B'){
    S[K-1] = 'b';
  }else{
    S[K-1] = 'c';
  }
  
  cout << S;
  
  return 0;
}

Measured memory_bytes: 256
n=gets.chomp.to_s
h=gets.chomp.to_i
f=n.length
a=0
b=0
g=[]
while a<=f do
  while b<=f && b<=(a+4) do
   g<<(n.slice(a..b))
   b+=1
  end
  if n[a].to_s >= n[a+1].to_s
   a+=1
  else
     while n[a].to_s < n[a+1].to_s
     a+=1
     end
  end
   b=a
end
t=g.uniq.sort!
puts t[h]


Measured memory_bytes: 4472
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
    int n,A[15],X[15][15],Y[15][15];
    cin>>n;
    rep(i,n){
        cin>>A[i];
        rep(j,A[i]) cin>>X[i][j]>>Y[i][j];
    }
    int ans=0;
    rep(i,pow(2,n)){
        int B[16],p=i,q=0,z=1;
        rep(j,n) B[j+1]=p%2,q+=p%2,p=p/2;
        rep(j,n){
            if(B[j+1]){
                rep(k,A[j]) if(B[X[j][k]]!=Y[j][k]) z=0;
            }
            /*else{
                rep(k,A[j]) if(B[X[j][k]]==Y[j][k]) z=0;
            }*/
        }
        if(z) ans=max(ans,q);
    }
    cout<<ans;
}

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


int main(){
	int n; cin >> n;
	vector<int> card(n);
	rep(i,n) cin >> card.at(i);
	if(n%2!=0){
		n++;
		card.push_back(0);
	}
	sort(card.rbegin(),card.rend());
	int a = 0,b = 0;
	for(int i = 0; i < n;i+=2){
		a += card[i];
		b += card[i+1];
	}
	cout << a - b << endl;		
	return 0;

}


	







Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		for (int i = 1 ; i <= Math.sqrt(n) ; i++) {
			for (int k = 2 ; Math.pow(i, k) <= n ; k++) {
				int p = (int)Math.pow(i, k);
				if (i == 1 ) {
					a = 1;
					break;
				} else if (p <= n && p > a) {
					a = p;
				}
			}
		}
		System.out.println(a);
	}
}


Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

class UnionFind {
	vector<int> par;
	vector<int> rank;
public:
	UnionFind(int max_n) :par(max_n), rank(max_n){}
	void init(int n) {
		for (int i = 0; i<n; i++) {
			par[i] = i;
			rank[i] = 0;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (rank[x]<rank[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rank[x] == rank[y])rank[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};






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

	int N, K, L;
	cin >> N >> K >> L;
	UnionFind uf1(N), uf2(N);
	uf1.init(N);
	uf2.init(N);
	rep(i, K) {
		int p, q;
		cin >> p >> q;
		p--; q--;
		uf1.unite(p, q);
	}
	rep(i, L) {
		int r, s;
		cin >> r >> s;
		r--; s--;
		uf2.unite(r, s);
	}
	vector<unordered_map<int, int>> cnt(N);
	rep(i,N) {
		++cnt[uf1.find(i)][uf2.find(i)];
	}

	rep(i,N) {
		if (i)cout << ' ';
		cout << cnt[uf1.find(i)][uf2.find(i)];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 25600
#include <stdio.h>
#define INF (1<<28)

int MATRIX_CHAIN_ORDER(int p[], int n) {
  int i,j,k,l,q;
  int m[102][102];
  for(i = 1; i <= n; ++i)
    m[i][i] = 0;
  for(l = 2; l <= n; ++l) {
    for(i = 1; i <= n-l+1; ++i) {
      j = i+l-1;
      m[i][j] = INF;
      for(k = i; k <= j-1; ++k) {
        q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
        if(q < m[i][j]) {
          m[i][j] = q;
        }
      }
    }
  }
  return m[1][n];
}

int main() {
  int i;
  int n;
  int p[102];
  scanf("%d", &n);
  for(i = 1; i <= n; ++i) {
    scanf("%d %d", p+i-1, p+i);
  }
  printf("%d\n", MATRIX_CHAIN_ORDER(p,n));
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if ((A == 5 and B == 7 and C == 5) or
        (A == 5 and C == 7 and B == 5) or
        (B == 5 and A == 7 and C == 5) or
        (B == 5 and C == 7 and A == 5))
    {
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def solve():
    L, R = map(int, input().split())
    ans = 10 ** 10
    for i in range(L, min(L+2019, R)):
        for j in range(L+1, min(L+2019, R) + 1):
            ans = min(ans, i * j % 2019)
    return ans

print(solve())


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int fun(int ar[],int n)
{
	if(n==1)
		return 0;
	if(n==2)
		return abs(ar[n]-ar[n-1]);
	return min(abs(ar[n]-ar[n-1])+fun(ar,n-1),abs(ar[n]-ar[n-2])+fun(ar,n-2));
}
int main()
{
	int n,i,k;
	scanf("%d%d",&n,&k);
	int ar[n+1];
	for(i=1;i<=n;i++)
		scanf("%d",ar+i);
	int dp[n+1];
	for(i=1;i<=n;i++)
		dp[i]=INT_MAX;
	dp[1]=0;
	dp[2]=abs(ar[2]-ar[1]);
	for(i=3;i<=n;i++)
	{
		for(int j=1;j<=min(i-1,k);j++)
			dp[i]=min(dp[i],abs(ar[i]-ar[i-j])+dp[i-j]);
	}
//	for(i=1;i<=n;i++)
//		printf("%d ",dp[i]);
	printf("%d\n",dp[n]);
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String color = "";
            int n = ip(br);
            if (n == 0) {
                break;
            }
            Map<String, Integer> colorMap = new HashMap<>();
            String[] list = br.readLine().split(" ");
            if (n == 1) {
                color = list[0];
                System.out.println(color);
                continue;
            }
            for (String i : list) {
                if (colorMap.containsKey(i)) {
                    int count = colorMap.get(i) + 1;
                    if (count > n / 2) {
                        color = i;
                        break;
                    }
                    colorMap.put(i, count);
                } else {
                    colorMap.put(i, 1);
                }
            }
            System.out.println(color.equals("") ? "NO COLOR" : color);
        }
    }

    static boolean isNumber(String num) {
        return Pattern.compile("^\\-?[0-9]*\\.?[0-9]+$").matcher(num).find();
    }

    static int[] createListInt(BufferedReader br) throws IOException {
        String[] lines = br.readLine().split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static int ip(BufferedReader s) throws IOException {
        return Integer.parseInt(s.readLine());
    }
}

Measured memory_bytes: 244712
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;
using namespace std;

int main(){
    int N; cin >> N;
    vi a(N, 0);
    rep(i, 0, N){
        cin >> a[i];
    }
    vi val(100007, 0);
    vi dup;
    vi nondup;
    rep(i, 0, N){
        val[a[i]]++;
    }
    rep(i, 0, val.size()){
        int e = val[i];
        if(e == 1) nondup.push_back(e);
        else if(e > 1) dup.push_back(e);
        else;
    }
    int ans = 0;
    rep(i, 0, dup.size()){
        if(dup[i] == 1){
            ans++;
            continue;
        }
        while(dup[i] > 2){
            dup[i] -= 2; 
        }

        if(dup[i] == 1){
            ans++;
            continue;
        }
        
        int j = i+1;
        bool usenondup = true;
        bool removeddup = false;
        while(j < dup.size()){
            if(dup[j] == 1){
                j++;
                continue;
            }
            dup[j] -= 1;
            dup[i] -= 1;
            ans++;
            usenondup = false;
            break;
        }
        if(!usenondup) continue;
        rep(k, 0, nondup.size()){
            if(nondup[k] == 1) continue;
            nondup[k] -= 1;
            dup[i] -= 1;
            removeddup = true;
        }
        if(removeddup) ans++;
    }
    ans += nondup.size();
    cout << ans << endl;
    return 0;
}




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

using namespace std;
using ll = long long int;

int main(void) {
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);
ll n;
  cin>>n;
 set<string> s;
  while(n--) {
    string t;
    cin >> t;
    s.insert(t);
  }
  cout << s.size() << endl;
}


Measured memory_bytes: 19184
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

int main() {
  string S;
  cin >> S;
  while(true) {
    S.pop_back(); S.pop_back();
    bool flag = true;
    for(int i=0; i<S.size()/2; i++) {
      if(S[i] != S[i+S.size()/2]) {
        flag = false;
        break;
      }
    }
    if(flag) {
      cout << S.size() << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
def check(a, b, c):

    a2 = a ** 2
    b2 = b ** 2
    c2 = c ** 2

    if (a2 + b2) == c2:
        return True
    else:
        return False


n = int(input())

for c in range(n):
    line = input()
    datas = map(int, line.split())
    li = list(datas) 
    a = li[0]
    b = li[1]
    c = li[2]

    if check(a, b, c) or check(b, c, a) or check(c, a, b):
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 7624
import java.util.*;

class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N= sc.nextInt();
      Set<String> a = new HashSet<>();
      for (int i=0; i<N; i++) {
      	String di = sc.next();
        a.add(di);
      }
	  System.out.println(a.size());
    }
}

Measured memory_bytes: 76828
import sys
input = sys.stdin.readline


def read():
    S = input().strip()
    return S,


def solve(S):
    for z in "abcdefghijklmnopqrstuvwxyz":
        if z not in S:
            return z
    return "None"


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define N 200005
typedef long long ll;
using namespace std;

int a[N],b[N];
vector<int> v1,v2;

ll k;

bool check1(ll mid){
    ll num=0;
    for(int i=0;i<v1.size();i++){
        ll x=mid/v1[i];
        if(mid%v1[i]) x++;
        int p=lower_bound(v1.begin(),v1.end(),x)-v1.begin();
        p=max(i+1,p);
        num+=v1.size()-p;
    }
    //cout<<num<<endl;
    for(int i=0;i<v2.size();i++){
        ll x=mid/v2[i];
        if(mid%v2[i]) x++;
        int p=lower_bound(v2.begin(),v2.end(),x)-v2.begin();
        p=max(i+1,p);
        num+=v2.size()-p;

    }
    //cout<<num<<endl;
    return  (num>=k);
}

bool check2(ll mid){
    ll num=0;
    for(int i=0;i<v1.size();i++){
        ll x=mid/v1[i];
        if(mid%v1[i]) x++;
        int p=lower_bound(v2.begin(),v2.end(),x)-v2.begin();
        num+=v2.size()-p;
    }
    return (num>=k);
}

int main(){
    int n,m;
    scanf("%d%lld",&n,&k); k=1ll*(n-1)*n/2-k+1;
    //cout<<k<<endl;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    int a0=0;
    for(int i=1;i<=n;i++){
        if(a[i]>0){
            v1.push_back(a[i]);
        }else if(a[i]<0){
            v2.push_back(-a[i]);
        }else{
            a0++;
        }
    }

    ll sum0=1ll*a0*(n-a0)+1ll*a0*(a0-1)/2;
    ll sum1=1ll*(int)v1.size()*((int)v1.size()-1)/2+1ll*(int)v2.size()*((int)v2.size()-1)/2;
    ll sum2=1ll*(int)v2.size()*(int)v1.size();
    //cout<<sum1<<" "<<sum0<<" "<<sum2<<endl;
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());

    if(k<=sum1){
        //cout<<check1(10)<<endl;
        ll l=1,r=1e18,ans=1;
        while(l<=r){
            ll mid=(l+r)/2;
            if(check1(mid)) l=(ans=mid)+1;
            else r=mid-1;
        }
        printf("%lld\n",ans);
    }else if(k>sum1&&k<=sum0+sum1){
        puts("0");
    }else{
        k=sum0+sum1+sum2-k+1;
        ll l=-1e18,r=-1,ans=-1;
        while(l<=r){
            ll mid=(l+r)/2;
            if(check2(-mid)) r=(ans=mid)-1;
            else l=mid+1;
        }
        printf("%lld\n",ans);
    }
}
/*
3 3 3
2 3 4
4 5 6

3 3 7
-2 -3 -4
4 5 6
*/


Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

void Main(){
int a, b; cin >> a >> b;
int c = a - 2 * b;
if (c < 0)c = 0;
cout << c;

}


int main() {
	Main();

	return 0;
}

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

int main() {
  long long L[100];
  L[0] = 2;
  L[1] = 1;

  int n;
  cin >> n;

  for (int i = 2; i <= n; i++) {
    L[i] = L[i-1] + L[i-2];
  }

  cout << L[n] << endl;

  return 0;

}


Measured memory_bytes: 256
n, k = gets.split.map(&:to_i)
M = 10 ** 9 + 7

def pow(x, n)
    return 1 if n == 0
    (n.odd? ? x : 1) * pow(x ** 2 % M, n / 2) % M
end

fac = Array.new(n+1, 1)
n.times {|i| fac[i+1] = fac[i] * (i+1) % M}

rfac = Array.new(n+1, 1)
rfac[-1] = pow(fac[-1], M - 2)
(n-1).downto(0) {|i| rfac[i] = rfac[i+1] * (i+1) % M}

ans = 0
k = n - 1 if n <= k

(k+1).times do |i|
    ans += (fac[n] * rfac[i] * rfac[n-i] % M) * (fac[n-1] * rfac[i] * rfac[n-i-1] % M)
    ans %= M
end

puts ans

Measured memory_bytes: 6908
*ant, k = (int(input()) for _ in range(6))
flag = True
for i in range(5):
    for j in range(i+1,5):
        if ant[j] - ant[i] > k:
            print(":(")
            flag = False
            break
    if not(flag):
        break
else:
    print("Yay!")

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100010,M=31;
int n,k,a[N],b[N];
ll ans;
int f[M];
int main(){
	f[0]=1;
	for(int i=1;i<M;i++) f[i]=f[i-1]*2;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		if((a[i]&k)==a[i]) ans+= b[i];
	}
	int temp;
	ll tempans;
	for(int i=30;i>=0;i--){
		if(k&f[i]){
			temp=(k^f[i])|(f[i]-1),tempans=0;
			for(int j=1;j<=n;j++)
				if((temp&a[j])==a[j]) tempans+=b[j];
			ans=max(ans,tempans);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
N=int(input())
H=[int(x) for x in input().split()]
can_watch = 0
for i in range(N):
  if i > 0:
    if H[i] >= max(H[:i]):
      can_watch = can_watch + 1
    else:
      pass
  else:
    can_watch = can_watch + 1
print(can_watch)

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

int main() {
 
  int N;
  cin >> N;

  vector<int> a(N);

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

  int answer = 0;

  int current = 1;
  for (int i = 0; i < N; i++) {
    if (a[i] == current){
      current++;
    }else{
      answer++;
    }
  }

  if (answer == N) {
    cout << -1 << endl;
  } else {
    cout << answer << endl;
  }
  
}

Measured memory_bytes: 1152
from sys import stdin
from bisect import bisect_left, bisect_right
readline = stdin.readline

dp = [-float('inf')]

for ai in (int(readline()) for _ in range(int(readline()))):
    if dp[-1] < ai:dp.append(ai)
    for i in range(bisect_right(dp, ai), bisect_left(dp, ai) + 1):dp[i] = ai
print(len(dp) - 1)

Measured memory_bytes: 11012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a[i];
    }
    bool ch = true;
    if (a[0] != 0)
    {
        ch = false;
    }
    rep(i, n - 1)
    {
        if (a[i] + 1 < a[i + 1])
        {
            ch = false;
        }
    }
    ll ans = 0;
    ll now = 0;
    if (ch)
    {
        rep2(i, 1, n)
        {
            if (a[i - 1] >= a[i])
            {
                ans += a[i - 1];
            }
        }
        ans += a[n - 1];
        cout << ans << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 4848
using System;
using System.Collections;
using System.Linq;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        if (N % 2 != 0)
        {
            Console.WriteLine("No");
        }
        else
        {
            string s1 = S.Substring(0, N / 2);
            string s2 = S.Substring(N / 2);
            if (s1 == s2)
            {
                Console.WriteLine("Yes");
            }
            else
                Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 27484
import Foundation
//最大公約数を求める関数
func gcd(_ a: Int, _ b: Int) -> Int {
   let r = a % b
   if r != 0 {
       return gcd(b, r)
   } else {
       return b
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}


let rl = readLine()!.split(separator: " ").map({Int($0)!})
let N = rl[0]
let X = rl[1]
let xi = readLine()!.split(separator: " ").map({Int($0)!})

let absxi = xi.map({abs($0 - X)})

print(gcdArr(absxi))

Measured memory_bytes: 18972
from collections import deque
n , d , a = map(int,input().split())
mon = [tuple(map(int,input().split())) for i in range(n)]
mon.sort()
p = deque(mon)
baku = deque()
cou = 0
ans = 0
while p:
    nowx , nowh = p.popleft()
    while baku:
        bx , bh = baku.popleft()
        if bx >= nowx:
            baku.appendleft((bx,bh))
            break
        elif bx < nowx:
            cou -= bh
    if nowh <= cou:
        continue
    elif nowh > cou:
        k = -((-nowh+cou)//a)
        ans += k
        cou += a*k
        baku.append((nowx+2*d,a*k))
print(ans)

Measured memory_bytes: 51852
#include <stdio.h>
 
int main(){
	int i = 0, j, k, n, array[100];

	scanf("%d", &n);
	while(i < n)scanf("%d", &array[i++]);
	for(i = 0; i < n; i++){
		j = i;
		k = array[j];
		while(j > 0 && k < array[j-1]){
			array[j] = array[j-1];
			j--;
		}
		array[j] = k;
		
		for(j = 0; printf("%d", array[j]), j < n-1; j++)printf(" ");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1<<30;
using namespace std;

int dp[100010][3];

int main(){
	int n;
	cin >> n;
	vector<int> A(n+1),B(n+1),C(n+1);
	for (int i = 1; i <= n; i++) cin >> A[i] >> B[i] >> C[i];
	for (int i = 0; i < 100010; i++)for (int j = 0; j < 2; j++) dp[i][j] = 0;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + A[i];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + B[i];
		dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + C[i];
	}
	cout << max(dp[n][0],max(dp[n][1],dp[n][2])) << endl;
	return 0;
}


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

int dp[1000010][2];

int main()
{
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<=n;i++)
    {
        dp[i][0]=2*1e8;
        dp[i][1]=2*1e8;
    }
    dp[0][0]=0;
    for(int i=1;i<=n;i++)
    {
        dp[i][0]=min(dp[i-1][0]+(s[i-1]-'0'),dp[i-1][1]+(s[i-1]-'0'));
        dp[i][1]=min(dp[i-1][1]+9-(s[i-1]-'0'),dp[i-1][0]+11-(s[i-1]-'0'));
    }
    cout<<min(dp[n][0],dp[n][1])<<endl;
}


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

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

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    int N;
    cin >> N;

    vector<int> x(N), y(N);
    rep(i, N) cin >> x[i] >> y[i];

    ll a = 1;
    for (int i = 1; i <= N; ++i) {
        a *= i;
    }

    vector<P> v(N);
    rep(i, N) {
        v[i] = P(x[i], y[i]);
    }

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

    double sum = 0;
    do {
        rep(i, N - 1) {
            int x = v[i].first - v[i + 1].first;
            int y = v[i].second - v[i + 1].second;
            sum += sqrt( x * x + y * y );
        }
    } while (next_permutation(v.begin(), v.end()));

    cout << fixed << setprecision(20) << sum / a << endl;
}

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

struct point
{
    long long x,y;
};

bool compare(point a,point b)
{
    return a.x<=b.x;
}

int main()
{
    long long n,d,b,ans=0;
    cin>>n>>d>>b;
    point a[n];
    long long sum[n]={0};
    for(long long i=0; i<n; i++)
    {
        cin>>a[i].x>>a[i].y;
        if(a[i].y%b==0) a[i].y/=b;
        else a[i].y = 1 + a[i].y/b;
    }
    sort(a,a+n,compare);
    for(int i=0,j=0; i<n; i++)
    {
        long long g=a[i].x+2*d;
        while(j<n && a[j].x<=g)
            j++;
        if(i!=0) sum[i]+=sum[i-1];
        long long bomb = max(a[i].y-sum[i],0LL);
        ans+=bomb; sum[i]+=bomb;
        sum[j]-=bomb;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
n, x = map(int, input().split())
a = input().split()

original_number, min_number = 0, 0

for i in range(n):
  original_number += int(a[i])
  
if int(a[0]) > x:
  a[0] = x
for i in range(n - 1):
  if int(a[i]) + int(a[i + 1]) > x:
    a[i + 1] = x - int(a[i])

for i in range(n):
  min_number += int(a[i])
  
ans = original_number - min_number
print(ans)

Measured memory_bytes: 13760
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int a, b;
    cin >> a >> b;
    int ans = 0;
    repeat_from_to (i, a, b) {
        string s = to_string(i);
        string r = s;
        reverse(r.begin(), r.end());
        if (s == r) 
            ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
  while(true){
    int h, w;
    std::cin >> h;
    std::cin >> w;

    if(h == 0 && w == 0) break;

    std::string str_odd = "";
    std::string str_even = "";
    for(int i = 0; i < w; i++){
      if(i % 2 == 0){
	str_odd += "#";
	str_even += ".";
      }else{
	str_odd += ".";
	str_even += "#";
      }
    }

    for(int i = 0; i < h; i++){
      if(i % 2 == 0){
	std::cout << str_odd << std::endl;
      }else{
	std::cout << str_even << std::endl;
      }
    }
    std::cout << std::endl;
  }

  return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,w;
    cin >> n >> w;
    vi wei(n),v(n);
    rep(i,n) cin >> wei[i] >> v[i];
    vector<vector<ll>> dp(110,vector<ll>(100100,0));
    rep(i,n){
        rep(j,w+1){
            if(j - wei[i]>=0){
                dp[i+1][j] = max(dp[i+1][j],dp[i][j-wei[i]]+v[i]);
            }
            dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
        }
    }
    cout << dp[n][w] << endl;
}

Measured memory_bytes: 87296
#include<iostream>
#include<iomanip>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
#include<memory>
using namespace std;
using ll=long long;

using dbl = double;
using P = complex<dbl>;

const dbl EPS = 1e-10;
void solve(int n){
    vector<P> ps(n);
    for(int i=0;i<n;i++){
        dbl x,y;
        cin>>x>>y;
        ps[i] = {x,y};
    }

    if(n==1){
        cout<<1<<endl;
        return;
    }
    
    auto f=[&](P center){
        int res = 0;
        for(auto p:ps){
            if(abs(center-p)<=1+EPS) res++;
        }
        return res;
    };
    auto calc=[&](P a,P b){
        if(abs(a-b)>=2+EPS) return 0;
        P c = (a+b)/dbl(2);
        P d = (a-b)*P(0,1);
        dbl len = sqrt(max(1-abs(a-c)*abs(a-c),dbl(0)));
        d = d/abs(d)*len;
        return max(f(c+d),f(c-d));
    };
    int res = 1;
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            res = max(res,calc(ps[i],ps[j]));
        }
    }
    cout<<res<<endl;
    return;
}
int main(){
    int n;
    while(cin>>n,n){
        solve(n);
    }
    return 0;
}



Measured memory_bytes: 3204
#include <stdio.h>

int isPrime(int);

int main(){
  int n, i ,count, a, prime[1000000], tprime[1000000];

  tprime[0] = 0;
  for(i = 0 ; i < 1000000 ; i++){
    if(i == 0 || i == 1)
      prime[i] = 0;
    else if(isPrime(i) == 0)
      prime[i] = 0;
    else prime[i] = 1;
    if(prime[i] == 1)
      tprime[i] = tprime[i-1] + 1;
    else tprime[i] = tprime[i-1];
  }
  while(scanf("%d",&n) != EOF){
    printf("%d\n",tprime[n]);
  }
  return 0;
}
int isPrime(int x)
{
  int i;
  for(i = 2 ; i*i <= x ; i++){
    if(x % i == 0) return 0;
  }
  return 1;
}

Measured memory_bytes: 4500
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,i,c=0,l,a[200001],s[200001];
map<ll,ll>f;
int main()
{
    cin>>n;
    f[0]=1;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        s[i]=s[i-1]+a[i];
        c+=f[s[i]];
        f[s[i]]++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 15872
#include "bits/stdc++.h"
using namespace std;

#define all(x) (x).begin(),(x).end()
#define fastio ios_base::sync_with_stdio(false)

typedef double db;
typedef long long ll;
typedef unsigned long long ull;

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

const int maxn = 2e5 + 5;
vector < int > v[maxn];


int main() {
	fastio;
	int n; cin >> n;
	for(int i = 1; i < n; ++i) {
		int val; cin >> val;
		--val;
		v[val].push_back(i);	
	}
	for(int i = 0; i < n; ++i) {
		cout << v[i].size() << endl;
	}
	return 0;
}

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

int f(int x, int n){
    if(x == n){ return 1; }
    if(x > n){ return 0; }
    return f(x + 4, n) + f(x + 7, n);
}

int main(){
    int n; cin >> n;
    if(f(0,n)){
        put("Yes");
    }else{
        put("No");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define vi vector<int>
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define deb(x) cout << #x << " - " << x << endl;
const ll MOD = 1e9 + 7;
const ll INF = 1 << 29;
const ll MAX_N = 1e5 + 7;


using namespace std;

int main() {
    IOS
    int a,b; cin>>a>>b;
    cout << a*b ;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n,a,b;
	cin>>n>>a>>b;
	string s;
	cin>>s;
	int total,o_sea;
	total =o_sea=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='b'&&o_sea<b&&total<a+b){
			cout<<"Yes"<<"\n";
			o_sea++;
			total ++;
		}else if(s[i]=='a'&&total<a+b){
			cout<<"Yes"<<"\n";
			total++;
		}else{
			cout<<"No"<<"\n";
		}
		
	}
}


Measured memory_bytes: 896
//
// Created by tac on 2016/10/15.
//

#include <cstdlib>
#include <string>
#include <iostream>

namespace {

inline int ctoi(char c) {
    return c - '0';
}

}

int main() {
    std::string str;

    while (true) {
        getline(std::cin, str);
        if (str.size() == 1 && str[0] == '0') {
            break;
        }
        int sum = 0;
        for (auto c: str) {
            sum += ctoi(c);
        }
        std::cout << sum << std::endl;
    }

    return EXIT_SUCCESS;
}

Measured memory_bytes: 3136
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <algorithm>

int main() {
  int N;
  std::cin >> N;
  std::vector<long long> A(N);
  for (auto &i : A) { std::cin >> i; }
  for (long long i = 0ll; i < (long long) A.size(); ++i) {
    A[i] -= i + 1;
  }
  std::sort(A.begin(), A.end());
  auto mid = A[N / 2];
  long long ans = 0;
  for (const auto &i: A) { ans += std::abs(i - mid); }
  std::cout << ans << std::endl;
  return 0;
}

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

#define long long long int
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(6);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    cout << a[n / 2] - a[n / 2 - 1];

    return 0;
}

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

#define pb push_back
#define all(v) (v).begin(),(v).end()
#define ll long long int
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define sz(a) (ll)(a.size())
#define MOD 1000000007
#define fi first
#define se second
#define pii pair<ll,ll>

using namespace std;
const ll hell = (ll)(1e18+100LL);
const double pi = acos(-1.0);

int main(){
    ll t,i,j,k,m,n,x,y;
    t=1;
    //cin>>t;
    while(t--){
        ll flag=0,K;
        ll a,b,c;
        cin>>a>>b>>c;
        cin>>K;
        while(b<=a&&K>0){
            b*=2;
            K--;
        }
        while(c<=b&&K>0){
            c*=2;
            K--;
        }

        if(b>a&&c>b){
            cout<<"Yes";
        }else{
            cout<<"No";
        
        }
        
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main() {
  int five=0, seven=0;
  int A, B, C;
  
  scanf("%d %d %d", &A, &B, &C);
  if(A == 5) five++;
  else if(A == 7) seven++;
  if(B == 5) five++;
  else if(B == 7) seven++;
  if(C == 5) five++;
  else if(C == 7) seven++;
  
  if(five == 2 && seven == 1) printf("YES\n");
  else printf("NO\n");
  
  return 0;
}
  

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 2e5 + 10;
int64 F[N], G[N];

int64 comb(int n, int m) {
  return F[n] * G[m] % MOD * G[n - m] % MOD;
}

int64 power_mod(int64 a, int n) {
  int64 ret = 1;
  for (; n; n >>= 1) {
    if (n & 1) ret = ret * a % MOD;
    a = a * a % MOD;
  }
  return ret;
}

int main() {
  F[0] = G[0] = 1;
  for (int i = 1; i < N; ++i) {
    F[i] = F[i - 1] * i % MOD;
    G[i] = power_mod(F[i], MOD - 2);
  }
  int n, m;
  cin >> n >> m;
  vector<ii> f;
  for (int i = 2; i * i <= m; ++i) {
    if (m % i == 0) {
      int cnt = 0;
      while (m % i == 0) {
        m /= i;
        ++cnt;
      }
      f.emplace_back(i, cnt);
    }
  }
  if (m > 1) f.emplace_back(m, 1);
  int ret = 1;
  for (auto& it : f) {
    ret = ret * comb(it.second + n - 1, n - 1) % MOD;
  }
  printf("%d\n", ret);
  return 0;
}


Measured memory_bytes: 3328
#include<stdio.h>
#define NIL -1

typedef struct node{
  int right;
  int left;
  int parent;
}Node;

Node A[25];

void inorder(int u){
  if(A[u].left != NIL) inorder(A[u].left);
  printf(" %d",u);
  if(A[u].right != NIL) inorder(A[u].right);
}

void preorder(int u){
  printf(" %d",u);
  if(A[u].left != NIL) preorder(A[u].left);
  if(A[u].right != NIL) preorder(A[u].right);
}

void postorder(int u){
  if(A[u].left != NIL) postorder(A[u].left);
  if(A[u].right != NIL) postorder(A[u].right);
  printf(" %d",u);
}

int main(){
  int n,i,id,root,l,r;

  scanf("%d",&n);
  for(i = 0; i < n; i++) A[i].parent = NIL;
  for(i = 0; i < n; i++){
    scanf("%d %d %d",&id,&l,&r);
    A[id].left = l;
    A[id].right = r;
    if(A[id].left != NIL) A[A[id].left].parent = id;
    if(A[id].right != NIL) A[A[id].right].parent = id;
  }
 

  for(i = 0; i < n; i++){
    if(A[i].parent == NIL) root = i;
  }
  
  printf("Preorder\n");
  preorder(root);
  printf("\n");
  
  printf("Inorder\n");
  inorder(root);
  printf("\n");

  printf("Postorder\n");
  postorder(root);
  printf("\n");

  return 0;
  
}



Measured memory_bytes: 2104
#include<stdio.h>
int Partition(int *,int,int);
int main(){
  int len,i,j;
  scanf("%d",&len);
  int A[len];
  for(i=0; i<len; i++) scanf("%d",&A[i]);
  j = Partition(A,0,len-1);
  for(i=0; i<len; i++){
    if(i != 0)
      printf(" ");
    if(j == i)
      printf("[%d]",A[i]);
    else
      printf("%d",A[i]);
  }
  printf("\n");
  return 0;
}
 
int Partition(int *B,int y,int z){
  int temp,k,l,m;
  k=B[z];
  l=y-1;
  for(m=y; m<z; m++){
    if(B[m] <= k){
      l++;
      temp= B[m];
      B[m]= B[l];
      B[l]= temp;
    }
  }
  temp= B[z];
  B[z]= B[l+1];
  B[l+1]= temp;
 
  return l+1;
}

Measured memory_bytes: 992
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;

int main() {
	int N;
	cin>>N;
	//1-indexed
	vector<int> a(N+1);
	rep1(i,N+1)cin>>a[i];
	//print(a);
	vector<int> ans(N+1,0);
	//v[i]:iの約数の列挙（そんなに多くない）
	vector<vector<int>> v(N+1);
	for (int i = 1; i <= N; ++i){
		for (int x = 1; x*x <= i; ++x){
			if(i % x == 0){
				v[i].push_back(x);
				if(x * x != i){
					v[i].push_back(i/x);
				}
			}
		}
	}
/*	for (int i = 1; i <= N; ++i){
		print(v[i]);
 	}*/
	//iの倍数で何個入れたか
	map<int, int> map;
	for (int i = N; i >= 1; --i){
		if(map[i]%2 != a[i]){
				ans[i] = 1;
		}
		if(ans[i]){
			int NN = v[i].size();
			for (int j = 0; j < NN; ++j){
				map[v[i][j]]++;
			}
		}
	}/*
	for (int i = 1; i <= N; ++i){
		cerr<<i<<": "<<map[i]<<endl;
	}*/
	/*print(ans);*/
	int M = 0;
	for (int i = 1; i <= N; ++i){
		if(ans[i])M++;
	}
	cout<<M<<endl;
	for (int i = 1; i <= N; ++i){
		if(ans[i]){
			cout<<i;
			if(i == N)cout<<endl;
			else{
				cout<<" ";
			}
		}
	}
}

Measured memory_bytes: 31488
balls = input().split(" ")

n = int(balls[0])
b = int(balls[1])
r = int(balls[2])


if( b == 0 ):
  print( 0 )
else:
  
  step = b + r 
  cnt = n // step
  remain = n % step
  bcnt = cnt * b + min( remain, b)
  
  print( bcnt )

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  map<string,int> m;
  int n;
  cin>>n;
  int w=0;
  for(i=0;i<n;i++){
    string s;
    cin>>s;
    m[s]++;
    w=max(m[s],w);
  }
  for(auto it=m.begin();it!=m.end();++it){
    if(it->second>=w) cout<<it->first<<endl;
  }


  
}
  

Measured memory_bytes: 25344
NT = list(map(int, input().split()))
mini = -1
for i in range(NT[0]):
    route = list(map(int, input().split()))
    if route[1] <= NT[1]:
        if mini == -1:
            mini = route[0]
        elif mini > route[0]:
            mini = route[0]
if mini == -1:
    print('TLE')
else:
    print(mini)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
// #include <numeric> // gcdとかlcmとか C++17から
#include <time.h> // time_t timer; time(&timer); でtimerに現在時刻が代入される．
#include <unistd.h> // sleep関数．引数は秒単位．
using namespace std;

typedef long long ll;

ll my_gcd(ll a, ll b){
	return (b==0) ? a : my_gcd(b, a%b);
}

ll my_lcm(ll a, ll b){
	return a*b / my_gcd(a,b);
}

ll factorial(ll a){
	ll ans = 1;
	for(ll i=a; i>0; i--){
		ans *= i;
	}
	return ans;
}

ll pow(ll a, ll b) {
	ll a_powered = 1;
	for (int i=0; i<b; i++) { a_powered *= a;
	}
	return a_powered;
}


int main(int argc, char *argv[]){
	int N;
	cin >> N;

	struct series_ele {
		int A;
		int index;
	};

	vector<series_ele> A_i;

	for(int i=0; i<N; i++){
		series_ele A_i_temp;
		cin >> A_i_temp.A;
		A_i_temp.index = i;
		A_i.push_back(A_i_temp);
	}

	// Aをキーに降順でソート
	sort(
		A_i.begin(), A_i.end(), 
		[](const series_ele& x, const series_ele& y) { return x.A > y.A;}
	);

	for(int i=0; i<N; i++){
		if(A_i[0].index != i){
			cout << A_i[0].A << endl;
		} else {
			cout << A_i[1].A << endl;
		}
	}

}


Measured memory_bytes: 3824