akhauriyash/Code-Regression huggingface dataset:
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize,
        k:i64,
        hs:[i64;n]
    }

    let ans = hs.iter().filter(|x| **x >= k).collect::<Vec<_>>().len();
    println!("{}", ans);
}


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

int main(){
    int x,y;
    char s[4];
    scanf("%s",s);
    x=(s[0]-'0')*10+s[1]-'0';
    y=(s[2]-'0')*10+s[3]-'0';
    if (x>0 && x<13 && y>0 && y<13)    printf("AMBIGUOUS\n");
    else if (x>0 && x<13)    printf("MMYY\n");
    else if (y>0 && y<13)    printf("YYMM\n");
    else printf("NA\n");
    return 0;
}


Measured memory_bytes: 3724
h,w=map(int,input().split())
s=[list(map(int,input().split()))for i in range(h)]
p=True
q=[0,0]
d=[]
for i in range(h):
    for j in range((w-1)*(i%2),(-1 if i%2==1 else w),(-1 if i%2==1 else 1)):
        if p:
            if s[i][j]%2==1:
                q=[i,j]
                p=False
        else:
            d.append([q[0]+1,q[1]+1,i+1,j+1])
            q=[i,j]
            if s[i][j]%2==1:
                p=True
print(len(d))
for i in d:
    print(i[0],i[1],i[2],i[3])

Measured memory_bytes: 30228
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	if (s < t) { cout << "Yes" << endl;}
	else { cout << "No" << endl; }
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n, m;
    int *t, *p, *x;

    // N
    {
        cin >> n;
    }

    // T[i]
    {
        t = (int *)malloc(sizeof(int) * n);
        for (int i = 0; i < n; i++)
            cin >> t[i];
    }

    // M
    {
        cin >> m;
    }

    // P[i], X[i]
    {
        p = (int *)malloc(sizeof(int) * m);
        x = (int *)malloc(sizeof(int) * m);
        for (int i = 0; i < m; i++) {
            cin >> p[i] >> x[i];
            p[i]--;
        }
    }

    for (int i = 0; i < m; i++)
    {
        int total = 0;
        for (int j = 0; j < n; j++)
            total += (p[i] == j) ? x[i] : t[j];
        cout << total << endl;
    }

    free(t);
    free(p);
    free(x);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, m;
    cin >> n >> m;
    out((n-1)*(m-1));
    re0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define ref(i,x,y)for(int i=x;i<=y;++i)
const int N=4010,mod=1e9+7;
int n,m,K,ans,f[N],g[N];
int main(){
	scanf("%d%d%d",&n,&m,&K);
	int md=(n+m-1)/(K-1);
	ref(i,1,K-1)f[i]=1;
	ref(i,2,md+1){
		int ms=(i-1)*(K-1)+1;
		int np=(ms-n>1)?(ms-n):1;
		int mp=(m<ms-1)?m:(ms-1);
		ref(j,np,mp)if(f[j]&&(m-j)%(K-1)==0)
			(ans+=f[j])%=mod;
		if(i>md)break;
		memset(g,0,sizeof g);
		ref(j,0,ms)if(f[j])
			ref(k,0,K-1)(g[j+k]+=f[j])%=mod;
		memcpy(f,g,sizeof g);
	}
	printf("%d\n",ans);
}

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

int X(char a){
    if (a=='A')
    return 'a';
    else if (a=='B')
    return 'b';
    else if (a=='C')
    return 'c';
}

int main(){
    int N,K;
    string S;
    cin >> N >> K >> S;
    S.at(K-1)=X(S.at(K-1));
    cout << S << endl;
}



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

int a[3500];

int main()
{
  int N;
  cin >> N;
  for(int i=0;i<N;i++)
  {
    cin >> a[i];
  }
  int res=0;
  for(int i=0;i<N;i++)
  {
    res += a[i]-1;
  }
  cout << res << endl;
}


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

int main(){
  int N,A,B;  cin >> N >> A >> B;

  int ans = 0;

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

    string s = to_string(i);
    int sum = 0;

    for(int j = 0;j < s.size();j++){
      string sub = s.substr(j,1);
      sum += stoi(sub);
    }

    if(sum >= A and sum <= B)ans += i;


  }

  cout << ans << endl;


}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int a[100][100],b[100],n,m,temp;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(int i=0;i<m;i++){
        scanf("%d",&b[i]);
    }
    for(int i=0;i<n;i++){
        temp=0;
        for(int j=0;j<m;j++){
            temp+=a[i][j]*b[j];
        }
        printf("%d\n",temp);
    }
}

Measured memory_bytes: 2736
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}


int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int n, k;
    sf(n);sf(k);
    if (k == 1) cout << 0 << endl;
    else {
         n -= k;
     cout << n << endl;
    }


    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char c[3];
    int count=0;
    scanf("%s", c);
        
        if(c[0] == 'R' && c[1] == 'R' && c[1] == 'R' && c[2] == 'R' && c[0] == 'R' && c[2] == 'R'){
            count = 3;
        } else if(c[0] == 'R' && c[1] == 'R' || c[1] == 'R' && c[2] == 'R'){
            count = 2;
        } else if(c[0] == 'R' || c[1] == 'R' || c[2] == 'R'){
            count = 1;
        }

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

}

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

typedef long long ll;

ll a, b, c, d;
map<ll, ll> ma[11];

ll f(ll n, int i1){
    if (ma[i1][n]) return ma[i1][n];
    ll pi=2e18;
    if (n<=2e9){
        pi=min(n*d, pi);
    }
    if (n==1){
        ma[i1][1]=d;
        return d;
    }
    for (ll i=0; i<=5; ++i){
        if ((n+i)%2==0 && ((n+i)/2)<n){
            pi=min(pi, f((n+i)/2, i1)+a+i*d);
        }
        if ((n+i)%3==0 && ((n+i)/3)<n){
            pi=min(pi, f((n+i)/3, i1)+b+i*d);
        }
        if ((n+i)%5==0 && ((n+i)/5)<n){
            pi=min(pi, f((n+i)/5, i1)+c+i*d);
        }
    }
    for (ll i=-1; i>=-5; --i){
        if ((n+i)>=1){
            if ((n+i)%2==0){
                pi=min(pi, f((n+i)/2,i1)+a-i*d);
            }
            if ((n+i)%3==0){
                pi=min(pi, f((n+i)/3, i1)+b-i*d);
            }
            if ((n+i)%5==0){
                pi=min(pi, f((n+i)/5, i1)+c-i*d);
            }
        }
    }
    ma[i1][n]=pi;
    return pi;
}

int main(){
    int t;
    cin >> t;
    for (int i1=1; i1<=t; ++i1){
        ll n;
        cin >> n >> a >> b >> c >> d;
        cout << f(n, i1) << "\n";
    }
}


Measured memory_bytes: 32188
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) (f?"Yes":"No")
#define YN(f) (f?"YES":"NO")

signed main(){
	cout<<fixed<<setprecision(7);
	
	
	int n;
	
	cin>>n;
	
	cout<<YN(n==7||n==5||n==3)<<endl;
	
	return 0;
}

Measured memory_bytes: 256
def yakusuu(i,m):
    _i=i
    while(i**2<=m):
        if(m%i==0):
            return i
        else:
            i+=1
    for j in range(_i-1,0,-1):
        if(m%j==0):
            break
    return m//j



def factoring(N,result):
    original_N=N
    tmp=2
    while(tmp<=N and (tmp-1)**2<=original_N):
        tmp=yakusuu(tmp,N)
        result.append(tmp)

        N//=tmp



N,start=map(int,input().split())
x=list(map(int,input().split()))
tmp_list=[]
factoring(abs(x[0]-start),tmp_list)
for i in range(N-1):
    now=abs(x[i]-x[i+1])
    new_list=[]
    for j in tmp_list:
        if(now%j==0):
            now//=j
            new_list.append(j)
    tmp_list=[new_list[i] for i in range(len(new_list))]

ans=1
for j in tmp_list:
    ans*=j
print(ans)

Measured memory_bytes: 14480
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
j=99
ans=0
for i in a:
    ans+=b[i-1]
    if i==j+1:ans+=c[i-2]
    j=i
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e6;
int n, a[N]; 

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
	}
	int ans = 0x3f3f3f3f;
	for(int i = 1; i <= 100; i++) {
		int tmp = 0;
		for(int j = 1; j <= n; j++) {
			tmp += (a[j] - i) * (a[j] - i);
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
} 

Measured memory_bytes: 3232
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0521

int main() {
    int coins[] = {500, 100, 50, 10, 5, 1};
    int price;
    while(true) {
        cin >> price;
        if (price == 0) break;

        int change = 1000 - price;
        int cnt = 0;
        for (int c : coins) {
            int v = change / c;
            cnt += v;
            change -= v * c;
        }

        cout << cnt << "\n";
    }

    return 0;
}



Measured memory_bytes: 3048
package main

import "fmt"

func main() {
	// Code for B - Golden Coins
	var X int
	fmt.Scanf("%d", &X)

	var result int
	result = 1000 * (X / 500)
	X = X % 500
	result = result + 5*(X/5)

	fmt.Println(result)
}


Measured memory_bytes: 1832
import numpy as np
h,w = map(int,raw_input().split())

ans = float("inf")

def div(h,w):
	def yokoyoko(a,b):
		if a != 0 and a != h and b != 0 and b!= h:
			global ans
			c = h-a-b
			ans = min(ans,max(abs(a*w-b*w),abs(a*w-c*w),abs(c*w-b*w)))

	def yokotate(a,b):
		if a != 0 and a!= h and b!= 0 and b != w:
			global ans
			tate = h-a
			ans = min(ans,max(abs(a*w-tate*b),abs(a*w-tate*(w-b)),abs(tate*b-tate*(w-b))))

	a1 = np.floor(h/3.0)

	byoko1 = np.floor((h-a1)/2.0)
	yokoyoko(a1,byoko1)

	byoko2 = np.ceil((h-a1)/2.0)
	yokoyoko(a1,byoko2)

	btate1 = np.floor(w/2.0)
	yokotate(a1,btate1)

	btate2 = np.ceil(w/2.0)
	yokotate(a1,btate2)


	a2 = np.ceil(h/3.0)

	byoko1 = np.floor((h-a2)/2.0)
	yokoyoko(a2,byoko1)

	byoko2 = np.ceil((h-a2)/2.0)
	yokoyoko(a2,byoko2)

	yokotate(a2,btate1)
	yokotate(a1,btate2)
	
div(h,w)
div(w,h)

print int(ans)

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

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

int main(){
int n;
cin>>n;
int t[n+1],x[n+1],y[n+1];
rep(i,n)
cin>>t[i]>>x[i]>>y[i];
t[0]=0;
x[0]=0;
y[0]=0;
bool flag=true;
for(int i=1;i<n+1;i++){
int a=t[i]-t[i-1],b=abs(x[i]-x[i-1]+y[i]-y[i-1]);
if(a<b||(a-b)%2!=0)
flag=false;

}
if(flag)
cout<<"Yes"<<endl;
else
{
  cout<<"No"<<endl;
}



  return 0;
}


Measured memory_bytes: 1408
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

s = ns()
n = len(s)

ans = True
while len(s) > 0:
    if s.endswith("dreamer"):
        s = s[:-7]
    elif s.endswith("dream"):
        s = s[:-5]
    elif s.endswith("eraser"):
        s = s[:-6]
    elif s.endswith("erase"):
        s = s[:-5]
    else:
        ans = False
        break

print("YES" if ans else "NO")

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  char c;
  cin >> c;
  c = c + 1;

  cout << c << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;

using namespace std;

struct PrimeList
{
	PrimeList()
	{
		prime.clear();
	};
	~PrimeList() {};

	void init(int n)
	{
		std::vector<bool> isComposite(n + 1);
		for (int i = 2; i <= n; ++i)
		{
			if (isComposite[i])continue;
			prime.push_back(i);
			for (int j = i; j <= n; j += i)
			{
				isComposite[j] = true;
			}
		}
	}

	std::vector<int> prime;
};


int main()
{

	int N;
	cin >> N;
	PrimeList prime;
	prime.init(55555);

	vector<int> ans;
	REP(i, prime.prime.size())
	{
		if (prime.prime[i] % 10 == 1)ans.push_back(prime.prime[i]);
		if (ans.size() == N)break;
	}

	REP(i, N)
	{
		cout << ans[i] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;


class Main {
    private static Scanner sc;


    public static void main(final String[] args) {
        sc = new Scanner(System.in);
        String ans = sc.next();
        for (int i = 0; i < ans.length(); i+=2) {
            System.out.print(ans.substring(i, i + 1));
        }
    }
}





Measured memory_bytes: 29480
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>

using namespace std;
using ll = long long;

int main()
{
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++)
		cin >> v[i];
	sort(v.begin(), v.end());
	int sum = 0;
	for (int i = 0; i < N-1; i++)
		sum += v[i];
	if (sum > v[N-1])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#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()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin >> n;
	int ans = inf;
	auto keta = [&](ll a) {
		int res = 0;
		while (a) res++, a /= 10;
		return res;
	};
	for (ll i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			mins(ans, max(keta(i), keta(n / i)));
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
ld x[51];
ld y[51];
ld c_x;
ld c_y;
ld eps = 1e-10;

int main(){
  cin >> n;
  for(ll i = 0;i < n;i++) cin >> x[i] >> y[i];

  if(n%2 != 0){
    cout << "NA" << endl;
    exit(0);
  }
  c_x = (*min_element(x,x+n)+*max_element(x,x+n))/2;
  c_y = (*min_element(y,y+n)+*max_element(y,y+n))/2;
  // cerr << c_x << " " << c_y << endl;
  for(ll i = 0;i < n;i++){
    // cerr << i << " ";
    // cerr << x[i] << " " ;
    // cerr << (x[i]-c_x) << " " << (c_x-x[(i+n/2)%n]) << endl;
    if(abs((x[i]-c_x) - (c_x-x[(i+n/2)%n])) < eps && abs((y[i]-c_y)-(c_y-y[(i+n/2)%n])) < eps){

    }else{
      cout << "NA" << endl;
      exit(0);
    }
  }
  cout << setprecision(17);
  cout << c_x << " " << c_y << endl;
}



Measured memory_bytes: 3292
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 1000000000

#define MOD 1000000007

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void swap2(double* a, double* b)
{
	double tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int gcd(int a, int b)  //最大公約数
{
	if (a < b)
		swap(&a, &b);

	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

long power(long x, int n) { //x^n 計算量O(logn)
	long ans = 1;
	while (n > 0) {
		if ((n & 1) == 1) {
			ans = ans * x;
		}
		x = x * x; //一周する度にx, x^2, x^4, x^8となる
		n >>= 1; //桁をずらす n = n >> 1
	}
	return ans;
}

int choose(int n, int k) {
	return k == 0 ? 1 : (long long)choose(n - 1, k - 1) * n % MOD * power(k, MOD - 2) % MOD;
}

void bubble_sort(int a[], int n)
{
	int i, j, tmp;

	for (i = 0; i < n; i++)
	{
		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (j = n - 1; j > i; j--)
		{
			if (a[j - 1] > a[j])
			{
				tmp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = tmp;
			}
		}
		printf("\n");
	}
}

void selection_sort(int a[], int n)
{
	int i, j, tmp, min, key;

	for (i = 0; i < n - 1; i++)
	{
		min = i;
		key = a[i];

		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (j = i + 1; j < n; j++)
		{
			if (a[j] < a[min])
			{
				min = j;
				key = a[j];
			}
		}

		tmp = a[i];
		a[i] = a[min];
		a[min] = tmp;

		printf("\n");
	}

	for (int k = 0; k < n; k++)
		printf("%d ", a[k]);
}

void insertion_sort(int a[], int n)
{
	int i, j, tmp;

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

		while (j >= 1 && a[j - 1] > a[j])
		{
			tmp = a[j];
			a[j] = a[j - 1];
			a[j - 1] = tmp;
			j--;
		}
	}
}

void shell_sort(int a[], int n)
{
	int h, i, j;

	for (h = 1; h < n / 9; h = h * 3 + 1)
		;

	for (; h > 0; h /= 3)
	{
		for (int k = 0; k < n; k++)
			printf("%d ", a[k]);

		for (i = h; i < n; i++)
		{
			j = i;
			while (j >= h && a[j - h] > a[j])
			{
				swap(&a[j - h], &a[j]);
				j -= h;
			}
		}
		printf("\n");
	}

	for (int k = 0; k < n; k++)
		printf("%d ", a[k]);
}

int partition(int a[], int l, int r)
{
	int i, j, pivot;

	i = l - 1;
	j = r;
	pivot = a[r];

	for (;;)
	{
		while (a[++i] < pivot)
			;
		while (i < j-- && pivot < a[j])
			;

		if (i >= j)
			break;

		swap(&a[i], &a[j]);
	}

	swap(&a[i], &a[r]);
	return i;
}

void quick_sort1(int a[], int l, int r)
{
	int v;

	if (l >= r)
		return;

	v = partition(a, l, r);

	quick_sort1(a, l, v - 1);
	quick_sort1(a, v + 1, r);
}

void quick_sort(int a[], int n)
{
	quick_sort1(a, 0, n - 1);
}

int keta(int a, int n)
{
	if (n == 1)
		return a % 10;

	for (int i = 0; i < n - 1; i++)
		a /= 10;

	return a % 10;
}

int main()
{
	int N;
	int W[100];
	int sum=0;
	int min = INF, ans = 0;

	scanf("%d", &N);

	for (int i = 0; i < N; i++)
	{
		scanf("%d", &W[i]);
		sum += W[i];
	}

	for (int i = 0; i < N; i++)
	{
		ans += W[i];

		if (ABS((sum-ans)-ans) < min)
		{
			min = ABS((sum - ans) - ans);
		}
	}
	printf("%d\n", min);

}


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

ll divisor=1e9+7;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	//(c+b-1)/b;//高橋
	//(a+d-1)/d;//青木
	if((c+b-1)/b<=(a+d-1)/d){
		puts("Yes");
	}else{
		puts("No");
	}
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vector<ll> a(n);
	rep(i,n){
		cin>>a[i];
	}
	auto solve=[&](ll x){
		ll cnt=0;
		rep(i,n){
			cnt+=(a[i]+x-1)/x-1;
		}
		//cout<<x<<' '<<cnt<<endl;
		return cnt<=k;
	};
	ll ng=0,ok=*max_element(begin(a),end(a)),mid;
	while(ok-ng>1){
		mid=(ok+ng)/2;
		if(solve(mid)) ok=mid;
		else ng=mid;
	}
	cout<<ok<<endl;
}

Measured memory_bytes: 4740
#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 = 0; i < (int)n; i++)
typedef long long ll;

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

    map<string, int>m;

    rep(i,N){
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        m[s]++;
    }
    ll ans =0;
    for (auto& p:m){
        int q = p.second;
        ans+=(ll)q*(q-1)/2;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 11136
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int h, a;
  cin >> h >> a;

  int r = h / a;
  if (h % a) r++;
  cout << r;
}
#endif


Measured memory_bytes: 256
#include<stdio.h>

void insertionSort(int *,int);
int main(){
  int a[100],i,j,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(j=0;j<n;j++){
      printf("%d",a[j]);
      if(j!=n-1){
	printf(" ");
      }
    }
  printf("\n");
  insertionSort(a,n);
}

void insertionSort(int *A,int N){
  int i,j,v;
  for(i=1;i<=N-1;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(j=0;j<N;j++){
      printf("%d",A[j]);
      if(j!=N-1){
	printf(" ");
      }
    }
    printf("\n");
  }
}
    
  
  



Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    ll A,B,C;
    cin >> A >> B >> C;

    ll oldA = A;
    ll oldB = B;
    ll oldC = C;

    int cnt = 0;
    while ( A % 2 == 0 && B %2 == 0 && C % 2 == 0) {
        ll newA = B/2 + C/2;
        ll newB = A/2 + C/2;
        ll newC = A/2 + B/2;

        A = newA;
        B = newB;
        C = newC;

        if ( oldA == A && oldB == B && oldC == C) {
            cout << -1 << endl;
            return 0;
        }
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define INF (1 << 30)
using namespace std;

int V, E, cost[100][100][2], d[100], done[100];

int dj(int s, int k)
{
  fill(d, d + 100, INF);
  fill(done, done + 100, 0);
  d[s] = 0;

  while(1)
  {
    int v = -1;
    for(int i = 0; i < V; i++)
      if(!done[i] && (v == -1 || d[i] < d[v]))
        v = i;
    if(v == -1)
      break;
    done[v] = 1;
    for(int i = 0; i < V; i++)
      d[i] = min(d[i], d[v] + cost[v][i][k]);
  }
}

int main()
{
loop:
  fill((int*)cost, (int*)cost + 20000, INF);
  cin >> E >> V;
  if(!E)
    return 0;

  for(int i = 0; i < E; i++)
  {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    a--; b--;
    cost[a][b][0] = cost[b][a][0] = c;
    cost[a][b][1] = cost[b][a][1] = d;
  }
  int k;
  cin >> k;
  for(int i = 0; i < k; i++)
  {
    int p, q, r;
    cin >> p >> q >> r;
    p--; q--;
    dj(p, r);
    cout << d[q] << endl;
  }
  goto loop;
}

Measured memory_bytes: 1240
import sys
input = sys.stdin.readline
from collections import *

def bfs():
    q = deque([0])
    pre = [-1]*N
    pre[0] = 0
    
    while q:
        v = q.popleft()
        
        for nv in G[v]:
            if pre[nv]==-1:
                pre[nv] = v
                q.append(nv)
    
    return pre

N, M = map(int, input().split())
G = [[] for _ in range(N)]

for _ in range(M):
    A, B = map(int, input().split())
    G[A-1].append(B-1)
    G[B-1].append(A-1)

pre = bfs()
print('Yes')

for pre_i in pre[1:]:
    print(pre_i+1)

Measured memory_bytes: 90724
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf pop_front()
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define inf 100000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define vll vector<lli>
#define eps 0.000001
#define endl '\n'
#define mo 998244353
 
using namespace std ;
 
#define MAXN 300005
 
typedef tree<lli,null_type,less<lli>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
 
int main()
{
/////////////////
    fastio;
///////////////////////////////////////////
 
    lld n,k;
    cin>>n>>k;
 
    lld ans=0;
 
    for(lld i=1;i<=n ;i++)
    {
        if(i>=k)
            ans += (1/n) ;
 
        else
        {
            lld oo = 1/n ;
            lli o = k/i ;
            
            lli b = k;
            lli c = i;

            if(b%c != 0) o++;

            lli m = log2(o);
 
            if(abs(o - pow(2,m)) >= eps) m++;
            oo = oo/pow(2,m);
 
            ans+=oo;
            
        }
    }
 
    cout<<fixed<<setprecision(17)<<ans<<endl;
 
 
}

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

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

	vector<int> d( N );
	for( int i = 0; i < N; ++i ) {
		cin >> d.at( i );
	}

	sort( begin(d), end(d), greater<int>() );

	int count = 1;
	int size = d.at( 0 );

	for( int i = 1; i < N; ++i ) {
		if( d.at( i ) < size ) {
			size = d.at( i );

			count++;
		}
	}

	cout << count << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n + 1];
		int[] y = new int[n + 1];
		for(int i = 0 ; i < n ; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		double sum = 0;
		for(int i = 0 ; i < n ; i++) {
			for(int j = i + 1 ; j < n ; j++) {
				double disX = x[i] - x[j];
				double disY = y[i] - y[j];
				double dis_dis = disX * disX + disY * disY;
				sum += Math.sqrt(dis_dis);
			}
		}
		System.out.println(sum * 2 / (double)n );

	}
}



Measured memory_bytes: 35720
from sys import stdin, setrecursionlimit

WEATHERS = [
    "Sunny",
    "Cloudy",
    "Rainy"
]


def main():
    input = stdin.buffer.readline
    s = input()[:-1].decode()
    print(WEATHERS[(WEATHERS.index(s) + 1) % 3])


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <tuple>
#include <list>
#include <deque>
#include <stack>
#include <complex>
#include <functional>
#include <regex>
#include <map>

using namespace std;

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

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

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const int PI = acos(-1);
const int INF = numeric_limits<int>::infinity() / 2;
const ll INFLL = numeric_limits<ll>::infinity() / 2;

int N, M;
vector<vector<int>> G;
vector<int> a;
vector<int> color;
vector<priority_queue<int, vector<int>, greater<int>>> ques;

void dfs(int n, int c) {
  color[n] = c;
  ques[c].push(a[n]);
  for (auto nn : G[n]) {
    if (color[nn] != -1) continue;
    dfs(nn, c);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;

  G.resize(N);
  a.resize(N);

  rep(i, N) cin >> a[i];
  rep(i, M) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }

  if (M == N - 1) {
    cout << 0 << endl;
    return 0;
  }

  if (N < 2 * (N - M - 1)) {
    cout << "Impossible" << endl;
    return 0;
  }

  color.assign(N, -1);
  ques.resize(N);

  int cnt = 0;
  ll ans = 0;
  rep(i, N) {
    if (color[i] != -1) continue;
    dfs(i, cnt);
    ans += ques[cnt].top(); ques[cnt].pop();
    cnt++;
  }

  vector<int> v;
  ques.resize(cnt);
  rep(i, cnt) {
    while (!ques[i].empty()) {
      v.push_back(ques[i].top());
      ques[i].pop();
    }
  }

  sort(v.begin(), v.end());
  rep(i, 2 * (N - M - 1) - cnt) ans += v[i];

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 10876
#include<iostream>
#include<cstdio>

using namespace std;

#define MAX 500000

int H,A[MAX+1];

void maxHeapify(int i){
	int l,r,largest;
	l=2*i;
	r=2*i+1;
	if(l<=H&&A[l]>A[i])
	largest=l;
	else
	largest=i;
	
	if(r<=H&&A[r]>A[largest])
	largest=r;
	
	if(largest!=i){
		swap(A[i],A[largest]);
		maxHeapify(largest);
	}
}

void buildMaxHeap(){
	for(int i=H/2;i>=1;i--)
	maxHeapify(i);
}

int main(){
	scanf("%d",&H);
	for(int i=1;i<=H;i++) scanf("%d",&A[i]);
	buildMaxHeap();
	for(int i=1;i<=H;i++) printf(" %d",A[i]);
	printf("\n");
}

Measured memory_bytes: 5136
#include <bits/stdc++.h>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    ll x, y, a, b ,c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> ar(a);
    vector<ll> br(b);
    vector<ll> cr(c);
    rep(i,a){
        cin >> ar[i];
    }
    rep(i,b){
        cin >> br[i];
    }
    rep(i,c){
        cin >> cr[i];
    }
    vector<ll> ab(x+y+c);
    sort(ar.begin(),ar.end());
    sort(br.begin(),br.end());   
    sort(cr.begin(),cr.end());
    vector<ll> aa(x);
    vector<ll> bb(y);
    rep(i,x){
        aa[i] = ar[a-1-i];
    }
    rep(i,y){
        bb[i] = br[b-1-i];
    }
    rep(i,x){
        ab[i] = aa[i];
    }
    rep(i,y){
        ab[i+x] = bb[i];
    }
    rep(i,c){
        ab[i+x+y] = cr[i];
    }
    sort(ab.begin(),ab.end());
    ll ans = 0;
    rep(i,x+y){
        ans += ab[x+y+c-1-i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll a,b,c,k,ans=0;
       cin>>a>>b>>c>>k;
       while(b<=a)
        b*=2,ans++;
       while(c<=b)
        c*=2,ans++; 
       cout<<(ans<=k?"Yes":"No");  
   }
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(b);i>=(long long int)(a);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define b begin()
#define e end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
//double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

    	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000],a,bi;

	int ara[n_size],ara2[n_size];

	cin>>a>>bi;

	if(a=='H') {
        if(bi=='H') cout<<"H"<<endl;
        if(bi=='D') cout<<"D"<<endl;
	}
	else if(a=='D') {
        if(bi=='H') cout<<"D"<<endl;
        if(bi=='D') cout<<"H"<<endl;
	}


}


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

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename P, typename Q>
P CeilDiv(P _dividend, Q _divider) {
    return static_cast<P>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data
constexpr int MAXN = 1000000;

int min_div[MAXN + 1];
int cnt[MAXN + 1];
bool prime[MAXN + 1];

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    iota(min_div, min_div + MAXN + 1, 0);
    fill(prime, prime + MAXN + 1, true);
    for (int i = 2; i * i <= MAXN; ++i) {
        if (prime[i]) {
            for (int j = i * i; j <= MAXN; j += i) {
                prime[j] = false;
                min_div[j] = i;
            }
        }
    }
    int n;
    cin >> n;
    int g = 0;
    loop(n) {
        int x;
        cin >> x;
        g = gcd(g, x);
        while (x > 1) {
            int d = min_div[x];
            ++cnt[d];
            while (x % d == 0) {
                x /= d;
            }
        }
    }
    if (g != 1) {
        RET("not coprime");
    }
    for (int i = 2; i <= MAXN; ++i) {
        if (cnt[i] > 1) {
            RET("setwise coprime");
        }
    }
    cout << "pairwise coprime" endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 12408
#include<bits/stdc++.h>
#define MAXN 233
using namespace std;

int n,x;
int main()
{
	cin>>n;
	for(int i = 1;i<=n;i++){
		cin>>x;
		if(x%2==0&&(x%3!=0&&x%5!=0)){
			cout<<"DENIED";
			return 0;
		}
	}
	cout<<"APPROVED";
	return 0;	
}

Measured memory_bytes: 256
//W H x y r
#include <stdio.h>

int main()
{
    int W, H, x, y, r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if((W<(x+r)) || ((x-r)<0) || (H<(y+r)) || ((y-r)<0)) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }

    return 0;
}

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

using namespace std;

#define rep(i, a, n) for (int i = a, _n = n; i <= _n; ++i)
#define drep(i, a, n) for (int i = a, _n = n; i >= _n; --i)
#define debug(x) cout << #x << " = " << x << endl

const int Mod = 1e9 + 7;

int n, k, x, y;

struct node {
	int x, y;
};

vector<int> V;

long long dp[105][70000];

int main () {
	scanf ("%d%d", &n, &k);
	x = 1;
	while (x <= n) {
		int t = n / x;
		y = n / t;
		V.push_back(y - x + 1);
		x = y + 1;
	}

	dp[0][0] = 1;

	rep(i, 1, k) {
		long long sum = 0;
		drep(j, V.size() - 1, 0) {
			sum += dp[i - 1][V.size() - 1 - j];
			sum %= Mod;
			dp[i][j] = sum * V[j] % Mod;
		}
	}

	long long ans = 0;

	rep(i, 0, V.size() - 1) ans += dp[k][i], ans %= Mod;

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

	return 0;
}


Measured memory_bytes: 55292
D, N = map(int, input().split())

n = 100**D
count = 0
while True:
    target = n
    count_div = 0
    while True:
        if target % 100 == 0:
            count_div += 1
            target //= 100
        else:
            break
    if count_div == D:
        count += 1

    if count == N:
        print(n)
        exit()

    n += 100**D


Measured memory_bytes: 3060
X = int(input())
A = int(input())
B = int(input())

#ケーキを買った後の残金
X_A=(X-A)

#ドーナツはいくつ買えるか
Donat =((X_A)//B) 

Nedan = (Donat*B)

print((X_A) - (Nedan))

Measured memory_bytes: 3060
class UnionFind:
  def __init__(self,n):
    self.nodes=n
    self.parents=[i for i in range(n)]
    self.sizes=[1]*n
    self.rank=[0]*n

  def find(self,x):
    if self.parents[x]==x:
      return x
    else:
      self.parents[x]=self.find(self.parents[x])
      return self.parents[x]

  def unite(self,x,y):
    x=self.find(x)
    y=self.find(y)
    if x!=y:
      if self.rank[x]<self.rank[y]:
        self.sizes[y]+=self.sizes[x]
        self.parents[x]=y
      else:
        self.sizes[x]+=self.sizes[y]
        self.parents[y]=x
        if self.rank[x]==self.rank[y]:
          self.rank[x]+=1
  def same(self,x,y):
    return self.find(x)==self.find(y)

  def get_parents(self):
    for n in range(self.nodes):
      self.find(n)
    return self.parents

adj = []
N, M = map(int,input().split())
for m in range(M):
  a,b = map(int,input().split())
  adj.append([a-1,b-1])

ans=0
for i in range(M):
  uf = UnionFind(N)
  for j in range(M):
    if i==j:
      continue
    uf.unite(*adj[j])  
  if len(set(uf.get_parents()))!=1:
    ans += 1
print(ans)

Measured memory_bytes: 9136
N = int(input())
m = pow(10,9)+7

A = [1]*(N+1)
for n in range(2,N+1):
    k = n
    for i in range(2,n+1):
        if k%i==0:
            while k>1:
                k//=i
                A[i]+=1
                if k%i!=0:break
ans = 1
for a in A:ans*=a
print(ans%m)

Measured memory_bytes: 3064
import statistics
N = int(input())
A = list(map(int,input().split()))
A2 = sorted([A[i]-i-1 for i in range(N)])
med = int(statistics.median(A2))
med2 = med+1
sum1 = 0
sum2 = 0
for i in range(N):
    sum1 += abs(A2[i]-med)
    sum2 += abs(A2[i]-med2)
print(min(sum1,sum2))

Measured memory_bytes: 27244
#include <stdio.h>

int main(void){
    int i=0, x,y;

   while(1){
        scanf("%d %d", &x,&y);
        if (x == 0 && y == 0)break;
        if (x > y){
            int tmp;
            tmp = x;
            x = y;
            y = tmp;
        }
        printf("%d %d\n", x, y);
    }

    return 0;
}

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

map<string, int> W;
int pos;
string s;

int Nolecule(), Atom(), Number();

int Molecule() {
  int res = 0;
  while(s[pos] == '(' || isalpha(s[pos])) {
    if(s[pos] == '(') {
      ++pos;
      int x = Molecule();
      ++pos;
      x *= Number();
      res += x;
    } else {
      int x = Atom();
      if(isdigit(s[pos])) {
        x *= Number();
      }
      res += x;
    }
  }
  return res;
}

int Atom() {
  string name; name += s[pos++];
  if(islower(s[pos])) name += s[pos++];
  if(!W.count(name)) throw 0;
  return W[name];
}

int Number() {
  string num; num += s[pos++];
  if(isdigit(s[pos])) num += s[pos++];
  return atoi(num.c_str());
}

int main() {
  for(string name; cin >> name && name != "END_OF_FIRST_PART"; ) {
    cin >> W[name];
  }
  while(cin >> s && s != "0") {
    s += '$';
    pos = 0;
    try {
      int res = Molecule();
      cout << res << endl;
    } catch(...) {
      cout << "UNKNOWN" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1300