akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
 
int main(){
    int i, j, k, l=-1;
    int N,count,M=0;
    char c[24] = {0};
    char s[24]  = {0};
    
    gets(c);
    scanf("\n%d\n",&N);
    for(i=0;i<20;i++){
        if(c[i]==0){
            count = i;
            break;
        }
    }
    //printf("%d\n",N);
    /*for(i=0;i<count;i++){
        c[i]=c[i+count];
    }*/
    for(i=0;i<N;i++){
        memset(s,0,sizeof(s));
        gets(s);
        for(j=0;j<10;j++){
            //printf("%c : %d\n",s[j],s[j]);
            s[j+10]=s[j];
        }
        for(j=0;j<10;j++){
            //printf("if %d = %d\n",s[j],c[0]);
            if(l==i){
                break;
                
            }
            //printf("%d\n",l);
            
            else if(s[j]==c[0]){
                M++;
                l=i;
                //printf("M=%d\n",M);
                for(k=1;k<count;k++){
                    if(s[j+k]!=c[k]){
                        M--;
                        l=-1;
                        break;
                    }
                }
            }
        
        }
    }
    printf("%d\n",M);
    return 0;
}

Measured memory_bytes: 1020
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    ll n=in();
    map<ll,ll>m;
    for(int i=0;i<n-1;++i)++m[in()];
    for(int i=1;i<=n;++i)cout<<m[i]<<endl;
}


Measured memory_bytes: 16132
n, k = map(int, input().split())
d = {}
for i in range(n):
  a, b = map(int, input().split())
  d[a] = d[a] + b if a in d else b
 
a = 0
for i in range(1, 10**5+1):
  if i in d and k <= d[i]:
    a = i
    break
  k -= d[i] if i in d else 0
 
print(a)

Measured memory_bytes: 49880
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())

A = list()
A.extend(A_1)
A.extend(A_2)
A.extend(A_3)

card = [0]*9

for _ in range(N):
    b_i = int(input())
    for i in range(9):
        if b_i == A[i]:
            card[i] = 1


bingo = list()
bingo.append(card[0]+card[1]+card[2])
bingo.append(card[3]+card[4]+card[5])
bingo.append(card[6]+card[7]+card[8])

bingo.append(card[0]+card[3]+card[6])
bingo.append(card[1]+card[4]+card[7])
bingo.append(card[2]+card[5]+card[8])

bingo.append(card[0]+card[4]+card[8])
bingo.append(card[2]+card[4]+card[6])

get_bingo = 0
for i in range(8):
    if bingo[i] == 3:
        get_bingo += 1

if get_bingo == 0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3192
#include <iostream>
#include <string>

using namespace std;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int main()
{

    int n, h, m=0;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> h;
        if(h<m)
        {
            cout<<"No";
            return 0;
        }
        m=max(m,h-1);
    }
    cout<<"Yes";
}


Measured memory_bytes: 256
fun main(args:Array<String>) {
  val n = readLine()!!
  val ls = (1..2).map {
    readLine()!!.split(" ").map(String::toInt)
  }
  val width = ls.first().size
  (0..width-1).map {
    ls[0].slice(0..it).sum() + ls[1].slice(it..width-1).sum()
  }.max()!!.let(::println)
}

Measured memory_bytes: 36076
n = int(input())
restrans = []
for i in range(n):
    city, p = input().split()
    p = int(p)
    restrans.append((city, p,i+1))
restrans.sort(key=lambda x:x[1],reverse=True)
restrans.sort(key=lambda x:x[0])
for restran in restrans:
    print(restran[2])


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String input = br.readLine();
		
		String[] tmpArray = input.split(" ");
		
		long array[] = new long[n];
		
		for(int i = 0; i < n; i++){
			array[i] = Long.parseLong(tmpArray[i]);
		}
		
		long result = 0;
		
		result = solve(array);
		
		System.out.println(result);
		
	}
	
	static long solve(long[] array){
		int n = array.length;
		long result = 0;

		long tmpXor = array[0];
		long tmpSum = array[0];
		int left = 0;
		int right = 0;
		int count[] = new int[n];

		while(left < n){
//			System.out.println("left "+left+" right "+right+" sum "+tmpSum);
			if(right < n - 1 && (long)(tmpXor^array[right + 1]) == tmpSum+array[right + 1]){
				tmpXor ^= array[right + 1];
				tmpSum += array[right + 1];
				right++;
			}
			
			else {
				count[left] = right - left + 1;
				tmpSum -= array[left];
				tmpXor = tmpSum;
				if(left < n - 1 && left == right){
					right = left + 1;
					tmpXor = array[left + 1];
					tmpSum = array[left + 1];
				}
				
				left++;
			}
		}
		
		for(int i = 0; i < n; i++){
//			System.out.print(count[i]+" ");
			result += count[i];
		}
		return result;
		
	}

}


Measured memory_bytes: 52312
#include<bits/stdc++.h>
using namespace std;
#define nl cout<<'\n';
#define ll long long
int arr[100005];
ll dp[100005];
int main()
{

	int n,k;
	cin>>n>>k;
	for(int i=1; i<=n; i++)
	{
		cin>>arr[i];
	}
	memset(dp,0,sizeof(dp));
	dp[1]=0;
	for(int i=2;i<=n; i++)
	{
		dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
		for(int j=2; j<=k; j++)
		{
			if(i-j>=1)
				dp[i]=min(dp[i-j]+abs(arr[i]-arr[i-j]),dp[i]);
		}
		
	}
	
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    if(n<=999){
        cout<<"ABC"<<endl;
    }else{
        cout<<"ABD"<<endl;
    }
	return 0;
}


Measured memory_bytes: 256
#ABC158
a,b = map(int,input().split())

for i in range(1,10000):
    if int(i*0.08) == a and int(i*0.1) == b:
        print(i)
        break
    elif i*0.08 > a and i*0.1 > b:
        print('-1')
        break

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      int i = Int32.Parse(Console.ReadLine());
      Console.Write(8 - ((i - 400) / 200));
      i = 0;
    }
  }
	class list{
		public int juni;
		public int old;
		public list(int juni, int old){
			this.juni = juni;
			this.old = old;
		}
	}
}


Measured memory_bytes: 27476
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printInt(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printdbl(a) printf("%lf\n", a)
#define printYes() printf("Yes\n")
#define printNo() printf("No\n")
#define scanll(a) scanf("%lld", &a)
#define scanInt(a) scanf("%d", &a)
#define scan2Int(a, b) scanf("%d %d", &a, &b)
#define scan3Int(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scan4Int(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
typedef long long ll;
const int INF = 1001001001;
using namespace std;
void swap(int *a, int *b) {
    int tmp = *a;
    *a = *b;
    *b = tmp;
    return;
}
int gdc(int a, int b) {
    int r;
    if (a < b)
        swap(&a, &b);
    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main() {
    vector<string> weather = {
        "Sunny", "Cloudy", "Rainy", "Sunny"
    };
    char s[7];
    rep(i, 7) s[i] = '\0';
    scanf("%s", s);
    int count = 0;
    while (s != weather[count++])
        ;
    printf("%s\n", weather[count].c_str());
    return 0;
}

Measured memory_bytes: 3508
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=1e5+5;
int ans=1e9,n,x[N],sum,ji;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x[i];
		sum+=x[i];
	}
	for(int i=0;i<n;i++)
	{
		ans=min(ans,abs(sum-ji));
		ji+=x[i];
		sum-=x[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from math import ceil
n = int(input())

ret = ""

while n!=0:
    r = ceil(n/-2)
    if n!=r*-2:
        ret += "1"
    else:
        ret += "0"
    n = r

if ret=="":
    print("0")
else:
    print(ret[::-1])


Measured memory_bytes: 2940
#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.at(i);
  }
  
  int alice = 0, bob = 0;
  int b = 0, c;
  
  for (int i = 0; i < n; i++) {
    
    //最も大きいカードの数字をbに、そのカードのa(n)の中での位置をcに代入
    for (int j = 0; j < n; j++) {
      if (b < a.at(j)) {
        b = a.at(j);
        c = j;
      }
    }
    
    //iが偶数のときalice, 奇数の時bob
    if (i % 2 == 0) {
      alice += b;
    }
    else {
      bob += b;
    }
    
    //引いたカードの数字を0にする
    a.at(c) = 0;
    b = 0;
    
  }
  
  cout <<  alice - bob << endl;
  
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(){
	double a[100]={};
	double b[100]={};
	int i=0;
	while(scanf("%lf", &a[i])!=EOF){
		scanf("%lf", &b[i]);
		i++;
	}
	int n=i;
	for(i=0;i<n;i++){
		if(a[i]<35.5 && b[i]<71){
			puts("AAA");
		}else if(a[i]<37.5 && b[i]<77){
			puts("AA");
		}else if(a[i]<40 && b[i]<83){
			puts("A");
		}else if(a[i]<43 && b[i]<89){
			puts("B");
		}else if(a[i]<50 && b[i]<105){
			puts("C");
		}else if(a[i]<55 && b[i]<116){
			puts("D");
		}else if(a[i]<70 && b[i]<148){
			puts("E");
		}else{
			puts("NA");
		}
	}
	return 0;
}

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

using namespace std;

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

    n = n % 10;

    if(n == 3)
    {
        cout << "bon\n";
        return ;
    }

    if(n == 0 || n == 1 || n == 6 || n == 8)
    {
        cout << "pon\n";
    }
    else
    {
        cout << "hon\n";
    }
}

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

    int t;
    t = 1;

    //cin >> t;

    for(; t; --t)
        solve();
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	cout<<(s=="ABC"?"ARC":"ABC")<<endl;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define int long long
#define ve vector<int>
#define mod 1000000007
#define eb emplace_back
#define inf ((long long) 1e18 )
#define all(x) (x).begin(),(x).end()
#define debug(x) cout << '>' << #x << ':' << x << '\n';
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug2(x,y) cout << '>' << #x <<" = "<< x <<" & "<< #y <<" = "<< y << '\n';
#define fileIO freopen("input.txt", "r", stdin); freopen("output1.txt", "w", stdout);
using namespace std;
const int N = 2e5 + 7;

int32_t main() {
	IOS
#ifndef ONLINE_JUDGE
	fileIO
#endif
	auto start = std::chrono::high_resolution_clock::now();
	int test;
	test = 1;
	// cin >> test;
	while (test--) {
		int n;
		cin >> n;
		vector<int> a(n);
		for (auto &i : a)
			cin >> i;
		int mx = a[0];
		int ans = 0;
		for (int i = 1 ; i < n ; i++) {
			mx = max(mx, a[i]);
			ans += (mx - a[i]);
		}
		cout << ans << endl;

	}

	auto stop = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start);

	cerr << "Time taken : " << ((long double)duration.count()) / ((long double) 1e9) << "s " << endl;

	return 0;
}

Measured memory_bytes: 4804
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int k = scan.nextInt();
		int ans = 0;
		for(;0<k;k--) {
			if(a>0) {
				a--;ans++;
			}else if(b>0) {
				b--;
			}else {
				ans--;
			}
		}
		System.out.println(ans);
	}
}

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

int stoi(string a,int n){
  reverse(a.begin(),a.end());
  int i=0,b=1,res=0;
  while(a[i]){
    int num=0;
    if('0'<=a[i]&&a[i]<='9') num=a[i]-'0';
    if('A'<=a[i]&&a[i]<='Z') num=a[i]-'A'+11;
    if('a'<=a[i]&&a[i]<='z') num=a[i]-'a'+36;
    res += num*b;
    i++,b*=n;
  }
  return res;
}


int main(){
  int n;
  cin>>n;
  int flg3=0,cnt=0;

  while(n--){
    int a;
    string str;
    cin>>a>>str;
    int num=stoi(str,a);
    int f=0;
    while(1){
      if(num%2) f++;
      else{
	if(f>=3) flg3=1;
	if(f)cnt++;
	f=0;
      }
      if(!num)break;
      num/=2;
    }
  }
  if(flg3||cnt%2) cout <<"win"<<endl;
  else cout <<"lose"<<endl;
  return 0;
}

Measured memory_bytes: 1212
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

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

        int n = sc.nextInt();
        int m = sc.nextInt();
        // boolean[][] isFriend = new boolean[n][n]; // 100000 * 100000 大丈夫? -> いいえ
        @SuppressWarnings("unchecked")
        ArrayList<Integer>[] g = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            g[i] = new ArrayList<Integer>();
        }

        for (int i = 0; i < m; i++) {
            int f1 = sc.nextInt();
            int f2 = sc.nextInt();
            g[f1].add(f2);
            g[f2].add(f1);
        }

        // Connected Component Number 
        int[] ccNum = makeCCNum(g, n);
//        UArr.printArr(ccNum);
        
        int q = sc.nextInt();
        for (int i = 0; i < q; i++) {
            int f1 = sc.nextInt();
            int f2 = sc.nextInt();
            System.out.println(ccNum[f1] == ccNum[f2] ? "yes" : "no");
        }
    }

    // 1つの連結成分につき1つ番号を与える。同じ連結成分を構成する点は同じ番号をもつ。
    static int[] makeCCNum(ArrayList<Integer>[] g, int n) {
        int[] ccNum = new int[n];
        int num = 1;
        boolean[] v = new boolean[n]; // visited?
        for (int i = 0; i < n; i++) {
            if (v[i])
                continue;

            // 未到達の点から連結成分を作成
            Queue<Integer> q = new LinkedList<Integer>();
            q.add(i);
            
            while (!q.isEmpty()) {
                int top = q.poll();
                v[top] = true;
                ccNum[top] = num;

                for (int adj : g[top]) {
                    if (!v[adj]) {
                        v[adj] = true;
                        q.add(adj);
                        ccNum[adj] = num;
                    }
                }
            }

            // 次の連結成分には別の番号をつける
            num++;
        }
        return ccNum;
    }
}



Measured memory_bytes: 117512
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

ll N;
ll A, B;
ll X[100005];
ll ans;

void solve() {
	for (int i = 0; i < N - 1; i++) {
		ll d = X[i+1] - X[i];
		ll x = min(d * A, B);
		ans += x;
	}
	cout << ans << endl;
}

int main() {
	cin >> N >> A >> B;
	for (int i = 0; i < N; i++) {
		cin >> X[i];
	}
	solve();
	return 0;
}




Measured memory_bytes: 1024
numList = input().split()
n = int(numList[0])
m = int(numList[1])
l = int(numList[2])

a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
        arrayList = input().split()
        for j in range(m):
                a[i][j] = int(arrayList[j])

for i in range(m):
        arrayList = input().split()
        for j in range(l):
                b[i][j] = int(arrayList[j])

for i in range(n):
        for j in range(l):
                for k in range(m):
                        c[i][j] += (a[i][k] * b[k][j])

for i in range(n):
        for j in range(l):
                if j < l - 1:
                        print(c[i][j], "", end = "")
                else:
                        print(c[i][j], end = "")
        print()


Measured memory_bytes: 7156
n,m = map(int,input().split())

c = list(map(int,input().split()))

dp = [float('inf') for i in range(n+1)]

dp[0] = 0
for j in range(m):
    dpp = dp[:]
    for i in range(n+1):
        if(i < c[j]): 
            dpp[i] = dp[i]
            continue
        dpp[i] = min(dpp[i-c[j]]+1,dp[i])
    dp = dpp[:]


print(dp[n])


Measured memory_bytes: 9816
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
#define debug(x) (cout << "#x = " << (x) << endl)
#define lowbit(x) (x & -x)
#define Set(x, i) memset(x, i, sizeof x)
#define R register
#define For( i, j, k ) for(R int i = (j); i <= (k); ++i)
#define Rep( i, j, k ) for(R int i = (j); i >= (k); --i)
#define Cross( i, j, k ) for(R int i = (j); i; i = (k))
typedef long long ll;
using namespace std;
const ll N = 100011;
const ll INF = 5e16;

namespace IO {

	#define dd ch = getchar()
	inline ll read() {
		ll x = 0; bool f = 0; char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write ( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write(x); putchar (' '); }

	inline void wln ( ll x ) { write(x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn(x); wln (y); }

}

using namespace IO;

namespace Cesare {
	
	int main() {
		ll n = read();
		if (n == 0) return puts("0"), 0;
		return wln(ceil(n / 2.0) - 1), 0;
	}
	
}

int main()
{
	return Cesare :: main();
}

/*

*/



Measured memory_bytes: 256
m = 10**9+7
n,a,b = map(int,input().split())
def c(k):
  v = 1
  w = 1
  for i in range(k):
    v = v*(n-i)%m #n*(n-1)*...*(n-k+1) 分子
    w = w*(i+1)%m #1*2*...*k 分母
  #pow(w,m-2,m)はmod mの世界でのwの逆元
  return (v*pow(w,m-2,m)%m)
print((pow(2,n,m)-1-c(a)-c(b))%m)

Measured memory_bytes: 8876
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		LinkedList<Integer> len = new LinkedList<Integer>();

		// input
		int num = scan.nextInt();
		for(int i = 0; i < num; i++){
			len.add(scan.nextInt());
		}

		// sort
		Collections.sort(len, Comparator.reverseOrder());
		int maxLen = len.poll();

		// sum & avg
		int sum = 0;
		while(len.size() > 0){
			sum += len.poll();
		}

		if(maxLen < sum){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}


	}
}


Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<cmath>

int sum(int n) {
  int sum = 0;
  std::string str = std::to_string(n);
  for (int i=0; i<str.size(); i++) {
    sum += int(str.at(i)-'0');
  }
  return sum;
}

int main() {
  int N;
  int temp_min;
  std::cin >> N;
  for (int i=1; i<N; i++) {
    if (i==1) {
      temp_min = sum(i)+sum(N-i);
    }
    else {
      temp_min = std::min(temp_min, sum(i)+sum(N-i));
    }
  }
  std::cout << temp_min << std::endl;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;

int main() {
	int r, D, x;
	scanf("%d %d %d", &r, &D, &x);
	
	for(int i = 0; i < 10; i++) {
		x = r * x - D;
		printf("%d\n", x);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int digit_sum(int);

int main(){
  int N;
  scanf("%d", &N);

  int A, B;
  int cnt=100;

  for(int i=1; i<=N/2; i++){
    A=i;
    B=N-i;
    int S=digit_sum(A)+digit_sum(B);
    // printf("(%d %d) S=%d\n", A, B, S);
    if(cnt>S) cnt=S;
  }

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

  return 0;
}

int digit_sum(int N){
  int num=N;
  int sum=0;
  
  for(int i=0; i<10; i++){
    sum+=num%10;
    num/=10;
    if(num==0) break;
  }

  return sum;
}

Measured memory_bytes: 128
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	a = zeros(Int,n)
	k = 0
	for i in 1:n
		x = readline() |> parseInt
		if x==0
			a[i] = 0
		elseif x%2==0
			a[i] = 2
			k += (x-1)>>1
		else
			a[i] = 1
			k += x>>1
		end
		k
	end
	for i in 1:n-1
		if a[i]==1&&a[i+1]>=1
			a[i] -= 1
			a[i+1] -= 1
			k += 1
		elseif a[i] == 2
			k += 1
		end
	end
	if a[n] == 2
		k += 1
	end
	println(k)
end
main()

Measured memory_bytes: 123652
n = int(input())
def prime_factorize(n):
	import math
	m = math.sqrt(n)+1
	i = 2
	prime = {}
	while n != 1 and i < m:
		if n % i == 0:
			if i in prime:
				prime[i] += 1
			else:
				prime[i] = 1 
			n //= i
		else:
			i += 1
	if n != 1:
		prime[n] = 1
	return prime

dic = prime_factorize(n)
for key in dic.keys():
	n *= (1 - (1/key))

print(int(n))





Measured memory_bytes: 5668
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
const long long INF = 1LL << 60;

int main() {
	int N, X;
	cin >> N >> X;
	vector<int> L(N);
	REP(i, N) {
		cin >> L[i];
	}

	int d = 0;
	int ans = 1;
	REP(i, N) {
		d += L[i];
		if (d <= X) {
			ans++;
		}
		else {
			break;
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

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

	map<char, int> mp;
	ll n; cin >> n;
	rep(i, n) {
		char c;
		cin >> c;
		mp[c]++;
	}
	if(mp.size() == 3) cout << "Three" << endl;
	else if(mp.size() == 4) cout << "Four" << endl;

}

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

using ll = long long;

int main() {
  ll A, B, K;
  cin >> A >> B >> K;
  if (A + B < K) {
    cout << 0LL << " " << 0LL << endl;
  } else if (A >= K) {
    cout << A - K << " " << B << endl;
  } else if (A < K) {
    cout << 0LL << " " << B - (K - A) << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main()
{
    int N;
    cin >> N;
    vector<int> a(N+1);
    for (int i = 1; i < N + 1; ++i) cin >> a[i];
    int ans = 0;
    for (int i = 1; i < N + 1; i += 2)
    {
        if (a[i] % 2 == 1) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
 
int main(){
	int a, b, i, count = 0, s = 0;
	while(scanf("%d %d", &a, &b) != 0){
		if(a == 0 || b == 0) break;
		if(s == 1) printf("\n");
		for(i = a; i <= b; i++){
			if(i % 400 == 0){
				printf("%d\n", i);
				count = 1;
			}else if(i % 100 == 0) continue;
			else if(i % 4 == 0){
				printf("%d\n", i);
				count = 1;
			}
		}
		if(count == 0) printf("NA\n");
		count = 0;
		s = 1;
	}
	return 0;
}

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

int main() {
    int R,B,G,N;
    cin>>R>>B>>G>>N;
    
    int k;
    int match = 0;
    for(int i =0;i<N+1;i++){
        for(int j=0; j<N-i+1;j++){
            k = N - i - j;
            if((i%R == 0) && (j%B == 0) && (k%G== 0)){
                match++;
            }
        }
    }
    cout<<match<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;


int main()
{
    int n; cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; i++) cin >> p[i];

    int ans = 0;
    for(int i = 1; i < n - 1; i++){
        if((p[i] > p[i-1] && p[i] < p[i+1]) || (p[i] < p[i-1] && p[i] > p[i+1])) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

int main(){
	
	int n;
	int a[110][110];
	int ans = -inf;
	int sum = 0;
	cin >> n;

	rep(i, 2) rep(j, n) cin >> a[i][j];

	sum = a[0][0];
	for (int i = 0; i < n; i++) sum += a[1][i];

	chmax(ans,sum);
	sum = 0;

	for (int i = 0; i < n; i++) sum += a[0][i];
	sum += a[1][n-1];
	chmax(ans, sum);
	sum = 0;
	
	sum = a[0][0] + a[0][1];
	for (int i = 1; i < n; i++)sum += a[1][i];

	for (int i = 2; i < n - 1;i++) {
			sum += a[0][i]- a[1][i-1];
			chmax(ans, sum);
	}

	pr(ans);

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;

  if(a==1)
  {
    if(b==3||b==1)
    cout<<"Yes";
    else
    {
      cout<<"No";
    }
  }
  else if(a==3)
  {
    if(b==3||b==1)
    cout<<"Yes";
    else
    {
      cout<<"No";
    }
  }
  else
  {
    cout<<"No";
  }

  cout<<endl;

  return 0;
}


Measured memory_bytes: 384
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}

long long int N, M, K, Q, W, H;
long long int ans;

int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> N >> s >> M;
	if (s == "+")cout << N + M << endl;
	else cout << N - M << endl;
	return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define pb push_back
# define ll long long
# define fi first
# define se second
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define mkp make_pair
//# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

ll q , w , e , z ;


int main()
{
	speed;

    int a , b , x ;
    cin >> a >> b >> x ;
    if(x-a<=b && x-a>-1){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }

	time;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {


	public static void main(String[] args) {

//		long ans = 0;
//		double ans = 0.0;
		int ans = 0;
//		String ans = "";

		Scanner sc = new Scanner(System.in);
//		double waru = 1000000007;


//		long n = sc.nextLong();
//		long m = sc.nextLong();
//		long k = sc.nextLong();

//		int n = sc.nextInt();
//		int m = sc.nextInt();
//		int k = sc.nextInt();
//		int v = sc.nextInt();
//		String s = sc.next();


		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);

		String[] strArray = string.split("");

		boolean f = false;

//		String[] s = new String[n];

//		int[] a = new int[n];
//		int[] b = new int[n];
//		long[] a = new long[n];
//		int[][] a = new int[n][m];

//		ArrayList<Long> list = new ArrayList<>();

//		for (int i = 0; i < n; i++) {
//			a[i]= sc.nextInt();
//		}
//		for (int i = 0; i < h; i++) {
//			for(int j = 0; j < w; j++) {
//				a[i][j] = sc.nextInt();
//			}
//		}

		if(strArray[2].equals(strArray[3]) && strArray[4].equals(strArray[5])) {

			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}

Measured memory_bytes: 22996
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int A, B, C;
    cin >> A >> B >> C;

    bool ans = false;
    for (int n = 1; n <= B; ++n) {
        if ((n * A) % B == C) {
            ans = true;
        }
    }
    cout << (ans ? "YES" : "NO") << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

typedef long long ll;
const int mod=1000000007;

inline ll qpow(ll a,ll n){
    ll res=1;
    while(n){
        if(n&1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int n,k;
char s[1000005];
ll f[2000005],inv[2000005];

inline ll C(const ll &n,const ll &r){
    return f[n]*inv[n-r]%mod*inv[r]%mod;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    f[0]=inv[0]=1;
    for(int i=1;i<=2e6;i++){
        f[i]=f[i-1]*i%mod;
        inv[i]=qpow(f[i],mod-2);
    }
    cin>>k>>s+1;
    n=strlen(s+1);
    ll ans=0;
    for(int i=0;i<=k;i++){
        ans+=C(i+n-1,n-1)*qpow(26,k-i)%mod*qpow(25,i)%mod;
    }
    cout<<ans%mod<<endl;

    return 0;
}

Measured memory_bytes: 35884
#include <bits/stdc++.h>
using namespace std;
int main(){
    long ans = 0;
    string s;
    cin >> s;
    string t;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='B'&&s[i+1]=='C'){
            t += 'T';
            i++;
        }
        else t += s[i]; 
    }
    for(int i=0;i<t.size();i++){
        int j = i;
        vector<char> m;
        while(t[j]=='A'||t[j]=='T'){
            m.push_back(t[j]);
            j++;
        }
        int numt = 0;
        for(int k=0;k<m.size();k++){
            if(m[k]=='T'){
                numt++;
                ans+=(k-numt+1);
            } 
        }
        i = j;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1032
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
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 long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >> n;
    ll a=0,b=0,l[n];
    for (ll i=0;i<n;i++){
        cin >> l[i];
    }
    sort(l,l+n);
    for (ll i=0;i<n;i++){
        if (i%2==0){
            a+=l[n-1-i];
        }else{
            b+=l[n-1-i];
        }
    }
    cout << a-b << endl;
    return 0;
}


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

int main() {
  long long a,b,n=0;
  cin>>a>>b>>n;
  if(b-1>n){
    cout<<a*n/b;
  }else{
    cout<<a*(b-1)/b;
  }
}

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

int main()
{
    int h,w;
    cin >> h >> w;
    int a[h][w];
   for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
        {
        char s;
        cin >> s;
        if(s=='.')a[i][j] =1;
        else a[i][j] = 2;
        }
    int ans=0;

    for(int i=0;i<h;i++)
    {
    int cnt=0;
        for(int j=0;j<w;j++)
        {
        if(a[i][j]==1)cnt++;
        if(cnt == w)
            {
            for(int k=0;k<w;k++)
                {
                a[i][k] = 3;
                }
            }
        }
    }

for(int i=0;i<w;i++)
    {
    int cnt=0;
        for(int j=0;j<h;j++)
        {
        if(a[j][i]==1 || a[j][i] == 3)cnt++;
        if(cnt == h)
            {
            for(int k=0;k<h;k++)
                {
                a[k][i] = 3;
                }
            }
        }
    }

for(int i=0;i<h;i++)
{
    int cnt=0;
    for(int j=0;j<w;j++)
    {
    /*
    cout << a[i][j];
    */
    if(a[i][j]==3)continue;
    else if(a[i][j]==1)
        {
        cout << ".";
        cnt++;
        } 
        else 
        {
        cout << "#";
        cnt++;
        }
    }
    if(cnt !=0)cout << endl;
    cnt = 0;
}
return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<math.h>
using namespace std;

int main() {
	int N;
	cin >> N;
	int a[100];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);
	int sum = 0;
	int i = 0;
	for (i = N-1; i >= 1; i -= 2) {
		sum += a[i] - a[i - 1];
	}
	if (i == 0)cout << sum + a[0];
	else cout << sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int a,b,c,d, k;
  cin >> a >> b >> c >> d >> k;
  int time;
  time = (c-a)*60 + (d-b);
  time = time - k;
  cout << time << endl;
}

Measured memory_bytes: 3592
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
    n, m, x = map(int, input().split())
    c, a = [0]*n, [[] for i in range(n)]
    for i in range(n):
        hoge = list(map(int, input().split()))
        c[i], a[i] = hoge[0], hoge[1:m+1]
    hoge = list(range(n))
    cost = []
    kumi = []
    for i in range(2,n+1):
        kumi += list(itertools.combinations(hoge,i))
    for i in range(n):
        bit = 0
        for j in range(m):
            if a[i][j] < x:
                bit = 1
                break
        if bit == 0:
            cost.append(c[i])
    for i in range(len(kumi)):
        for j in range(m):
            huga = 0
            hoge = 0
            bit = 0
            for k in kumi[i]:
                huga += a[k][j]
                hoge += c[k]
            if huga < x:
                bit = 1
                break
        if bit == 0:
            cost.append(hoge)
    if len(cost) == 0:
        print(-1)
    else:
        print(min(cost))

    return 0

if __name__ == "__main__":
    solve()


Measured memory_bytes: 31244
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int MAX=1e5+9;
int arr[MAX];
int main(){
	int n;
	cin>>n;
	int tot=0;
	int mx=-1;
	int x;
	for(int i=0;i<n;i++){
		cin>>x;
		tot=tot+x;
		mx=max(mx, x);
	}
	if(tot-mx>mx){
		cout<<"Yes";
	}
	else
		cout<<"No";
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int n;
  cin>>n;
  int a[n+1];
  int d=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]%2==0 && (a[i]%3!=0 && a[i]%5!=0))
      d++;
  }
  if(d==0)
    cout<<"APPROVED";
  else 
    cout<<"DENIED";
}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// #define MULTIPLE_TEST_CASES
void solve() {
  int a, b, k;

  cin >> a >> b >> k;

  cout << ((a + b - 1) / b) * k << endl;
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  cout << a[0] + a[1] << endl;
  
  return 0;
}

Measured memory_bytes: 256
def op(a, op, b):
    if op == "+":
        return a+b
    else:
        return a-b

def main():
    n = input()
    A,B,C,D = map(int, [n[0],n[1],n[2],n[3]])

    for op1 in ["+","-"]:
        for op2 in ["+","-"]:
            for op3 in ["+","-"]:
                ans = op(A, op1, B)
                ans = op(ans, op2, C)
                ans = op(ans, op3, D)
                if ans == 7:
                    return str(A)+op1+str(B)+op2+str(C)+op3+str(D)+"=7"



print(main())


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws InterruptedException {
		FastScanner fs=new FastScanner();
		int[] a=fs.readArray(3);
		int k=fs.nextInt();
		while (a[1]<=a[0]) {
			a[1]<<=1;
			k--;
		}
		while (a[2]<=a[1]) {
			a[2]<<=1;
			k--;
		}
		System.out.println(k>=0?"Yes":"No");
	}
	
	void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}
	
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		
		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
		
		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


Measured memory_bytes: 32768
while True:
    n=int(input())
    if n==0:
        break
    else:
        A=[0]*(n+10)
        A[0]=1
        A[1]=1
        A[2]=2
        if n==1:
            print(1)
        elif n==2:
            print(1)
        else:
            for i in range(3,(n+1)):
                A[i]=A[i-1]+A[i-2]+A[i-3]
            print((A[n])//3650+1)


Measured memory_bytes: 5600
ni,no,nt,nj,nl,ns,nz=map(int,input().split())
ans=0
ans+=no
c=0
c+=ni%2
c+=nl%2
c+=nj%2
# c:奇数の個数
if c==3 or c==0:
  ans+=ni+nj+nl
elif c==1:
  ans+=ni+nj+nl-1
elif ni>0 and nj>0 and nl>0:
  ans+=ni+nj+nl-1
else:
  ans+=ni+nj+nl-2
print(ans)


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

const int N = 1e5 + 7;
int n , a[N] , b[N] , c[N] , f[N][5];

int main()
{
    cin >> n;
    for(int i = 1 ; i <= n; ++i)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    f[0][1] = 0;
    f[0][2] = 0;
    f[0][3] = 0;
    for(int i = 1 ; i <= n; ++i)
    {
        f[i][1] = max(f[i-1][2] , f[i-1][3]) + a[i];
        f[i][2] = max(f[i-1][1] , f[i-1][3]) + b[i];
        f[i][3] = max(f[i-1][1] , f[i-1][2]) + c[i];
        //cout << f[i][1] << " " << f[i][2] << " " << f[i][3] << endl;
    }
    cout << max(f[n][1] , max(f[n][2] , f[n][3]));
    return 0;
}


Measured memory_bytes: 6692
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int A, B, Q;
	cin >> A >> B >> Q;
	vector<ll> a(A), b(B);
	forn(i, A) cin >> a[i];
	forn(i, B) cin >> b[i];
	a.push_back(1e11);
	b.push_back(1e11);
	a.push_back(-1e11);
	b.push_back(-1e11);
	sort(allele(a));
	sort(allele(b));
	forn(i, Q)
	{
		ll q;
		cin >> q;
		ll ans = LLONG_MAX;
		ll r1, r2;
		r1 = *(upper_bound(allele(a), q) - 1);
		r2 = *(upper_bound(allele(b), r1) - 1);
		ans = min(ans, q - r2);
		r1 = *(upper_bound(allele(a), q) - 1);
		r2 = *lower_bound(allele(b), r1);
		ans = min(ans, q - r1 + r2 - r1);
		r1 = *lower_bound(allele(a), q);
		r2 = *lower_bound(allele(b), r1);
		ans = min(ans, r2 - q);
		r1 = *lower_bound(allele(a), q);
		r2 = *(upper_bound(allele(b), r1) - 1);
		ans = min(ans, r1 - q + r1 - r2);
		r1 = *(upper_bound(allele(b), q) - 1);
		r2 = *(upper_bound(allele(a), r1) - 1);
		ans = min(ans, q - r2);
		r1 = *(upper_bound(allele(b), q) - 1);
		r2 = *lower_bound(allele(a), r1);
		ans = min(ans, q - r1 + r2 - r1);
		r1 = *lower_bound(allele(b), q);
		r2 = *lower_bound(allele(a), r1);
		ans = min(ans, r2 - q);
		r1 = *lower_bound(allele(b), q);
		r2 = *(upper_bound(allele(a), r1) - 1);
		ans = min(ans, r1 - q + r1 - r2);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2912
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

struct mint {
  LL x; 
  mint(LL x=0):x((x%mod+mod)%mod){}
  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;
  }
};

int N;
LL C[200000];

mint ans = 0;
 
void solve(){
	if(N==1){
		ans = mint(C[0])*mint(2);
		return;
	}
	sort(C,C+N,greater<LL>());
	mint pow2 = mint(2).pow(N-1);
	mint pow2_diff = mint(2).pow(N-2);
	for(int i=0;i<N;i++){
		ans += (mint(C[i])*pow2);
		pow2 += pow2_diff;
	}
	ans *= mint(2).pow(N);
}
 
int main(){
    cin >> N;
    for(int i=0;i<N;i++) cin >> C[i];
 
    solve();
 
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 1792