akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();

    let v: Vec<(usize, usize)> = (0..m).map(|_| (read(), read())).collect();
    let mut ans: Vec<i32> = vec![-1; n];
    for (s, c) in v {
        if ans[n-s] == -1 || ans[n-s] == c as i32{
            ans[n-s] = c as i32;
        } else {
            println!("-1");
            return;
        }
    }

    let mut a = 0;
    let mut ten = 1;
    for (i, &k) in ans.iter().enumerate() {
        if i == n-1 && k == 0 && n != 1{
            println!("-1");
            return;
        }
        if k==-1{
            a += 0;
        } else {
            a += ten*k
        }
        ten *= 10;
    }

    if a < 10_i32.pow((n-1) as u32) && n > 1{
        a += 10_i32.pow((n-1) as u32);
    }

    println!("{}", a);
}


Measured memory_bytes: 4352
sx, sy, tx, ty = gets.split.map(&:to_i)

(ty - sy).times { print('U') }
(tx - sx).times { print('R') }
(ty - sy).times { print('D') }
(tx - sx).times { print('L') }

print('L')
(ty - sy + 1).times { print('U') }
(tx - sx + 1).times { print('R') }
print('D')
print('R')
(ty - sy + 1).times { print('D') }
(tx - sx + 1).times { print('L') }
print('U')


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long int n;
	cin>>n;
	long long int a[n][3];
	
	for(int i=0;i<n;i++)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	int dp[n][3];
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	
	for(int i=1;i<n;i++)
	{
		
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
		dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];
	}
	
	cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	
}

Measured memory_bytes: 3712
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
#include <utility>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*///map < string, ll> s;

/*i++ずつずらす
a[0] a[1] a[2]//a[1] a[2] a[3]
a[0] a[2] a[4]//a[1] a[3] a[5]
/*if (N % 2 != 0)a = N / 2;
else a = N / 2 - 1;
for (int i = 1;i <= a;i++) {
	for (int j = 0;j < N - (i * 2);j++) {
		if (S[j] != S[j + i] && S[j + i * 2] != S[j] && S[j + i] != S[j + i * 2]) sum--;
		if (sum == 0)break;
	}
}*/

//mapの使い方
/*map<int, int> mp;
for (int i = 0; i < N; i++)
	mp[a[i]]++;

int ans = 0;
for (auto p : mp) {
	int x = p.first;
	int n = p.second;
	if (n < x) ans += n;
	else ans += n - x;
}*/

int main() {
	vector<ll> v(3);
	cin >> v[0] >> v[1] >> v[2];
	sort(all(v));
	cout << v[0] + v[1] << endl;
}

Measured memory_bytes: 256
def solve():
    mod = 10 ** 9 + 7
    fac, finv, inv = COMinit(10 ** 6, mod)

    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        return
    
    ans = 0
    for one_cnt in range(10 ** 6):
        x1 = one_cnt * 2
        y1 = one_cnt * 1
        remain_x = X - x1
        remain_y = Y - y1
        if remain_x * 2 != remain_y or remain_x < 0 or remain_y < 0:
            continue
        two_cnt = remain_x
        ans += COM(one_cnt+two_cnt, one_cnt,mod,fac,finv,inv)
    
    print(ans)

def n_combination(n, r, mod):
    numer_sum = 1
    denom_sum = 1
    for i in range(r):
        numer_sum *= n - i
        numer_sum % mod
        denom_sum *= r - i
        numer_sum % mod
    
    return numer_sum * modinv(denom_sum, mod) % mod

def modinv(a, mod):
    return pow(a, mod-2, mod)
    
def COMinit(N, mod):
    fac = [0] * N
    finv = [0] * N
    inv = [0] * N

    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, N):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    
    return fac, finv, inv

def COM(n, r, mod, fac, finv, inv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod

if __name__ == '__main__':
    solve()

Measured memory_bytes: 63088
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define REP(i,l,r) for(ll i=l;i<(ll)(r);i++) //ll
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}

const ll MOD = 1000000007;
#define madd(l,r) ((l+r>=MOD)?(l+r-MOD):l+r)
#define mdif(l,r) ((l-r<0)?(l-r+MOD):l-r)
#define mmul(l,r) ((l*r>=MOD)?((l*r)%MOD):(l*r))

const int INF = (1<<30);
const ll LINF = (1LL<<60);
int upcmpii(const void *a, const void *b){return(*(int*)a==*(int*)b?0:(*(int*)a>*(int*)b?1:-1));}
void sort_ui(int*a, int n){qsort(a,n,sizeof(int),upcmpii);}
int upcmpll(const void *a, const void *b){return(*(ll*)a==*(ll*)b?0:(*(ll*)a>*(ll*)b?1:-1));}
void sort_u(ll*a, ll n){qsort(a,n,sizeof(ll),upcmpll);}

ll a[202020];
int n;

ll solve(){
    ll ans = 0;
    ll sum = 0;
    rep(i,n) {
        sum = madd(sum,a[i]);
    }
    rep(i,n-1){
        sum = mdif(sum,a[i]);
        ans = madd(ans,mmul(a[i],sum));
    }
    return ans;
}

int main(){
    scanf("%d", &n);
    rep(i, n) scanf("%lld", a+i);
    printf("%lld\n", solve());
}

Measured memory_bytes: 3292
#include <stdio.h>
#include <unistd.h>
 
int main(void)
{
  int i = 0;
  int j;
  char str[27] = {0};
  
  read(0, str, 26);
  while (str[i])
  {
    j = i + 1;
    while (str[j])
    {
      if (str[j] == str[i])
      {
        printf("no");
        return (0);
      }
      j++;
    }
    i++;
  }
  printf("yes");
  return (0);
}

Measured memory_bytes: 1600
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

n = input_n
p = input_a
q = input_a

per = [*(1..n)].to_a.permutation(n).to_a
a = 0
b = 0
per.each_with_index do |array, i|
  a = i if p == array
  b = i if q == array
end
puts (a - b).abs

Measured memory_bytes: 6780
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;

template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a, T b) { return a<b?(a=b,true):false; }
#define forn(i,x,y) for(int i=(x);i<(int)(y);i++)
#define rep(i,y) for(int i=0;i<(int)(y);i++)
#define repb(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)

template<class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << " ";
    os << *it;
  }
  return os;
}

int N,H,W;
int cnt;
int a,b;
int main() {
  cin>>N>>H>>W;
  rep(i,N) {
    cin >> a >> b;
    if (a >= H && b >= W) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	
	int res = -1;
	for (int i = 1; i < 10000000 /* <-適当 */; i++) {
		if (n <= ((i * (i - 1)) / 2)) {
			res = i - 1;
			break;
		}
	}
	
	printf("%d", res);
	
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
    int L,R,d,count = 0;

    scanf("%d %d %d",&L,&R,&d);

    for(int i = (L > d?L:d);i <= R;i += d)
        count++;

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

    return 0;
}

Measured memory_bytes: 1724
def xor(n):
  if n % 2:
    t = (n+1) // 2
    if t % 2:
      return 1
    else:
      return 0
  else:
    t = n // 2
    if t % 2:
      return n+1
    else:
      return n
a,b = map(int, input().split())
c = xor(a-1)
d = xor(b)
print(c^d)

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}
  
  scanner := bufio.NewReader(fp)

	var n int
	var a [][]int
	fmt.Fscan(fp, &n)
	bits := 1 << uint(n)
	dp := make([]int, bits)
	dp[0] = 1

	for i := 0; i < n; i++ {
		a = append(a, make([]int, n))
      	as := strings.Split(getNextLine(scanner), " ")
		for j := 0; j < n; j++ {
          a[i][j], _ = strconv.Atoi(as[j])
		}
	}

	for i := 0; i < bits; i++ {
		c := 0
		for cnt := 0; cnt < n; cnt++ {
			if (i>>uint(cnt))&1 == 1 {
				c++
			}
		}
		for j := 0; j < n; j++ {
			if (i>>uint(j))&1 == 0 && a[c][j] == 1 {
				dp[i|1<<uint(j)] += dp[i]
				dp[i|1<<uint(j)] %= 1000000007
			}
		}
	}

	fmt.Println(dp[bits-1])
}


Measured memory_bytes: 17664
def 解():
    iN = int(input())
    iC = 0
    d = {}
    for a in reversed(sorted([int(_) for _ in input().split()])):
        if a in d:
            if d[a] == 3:
                print(a*a)
                exit()
            elif iC and iC != a:
                print(iC * a)
                exit()
            else:
                iC = a
                d[a] += 1
        else:
            d[a] = 1
    print(0)
解()


Measured memory_bytes: 14480
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, l; cin >> n >> l;
    int del;
    if (l+n-1 < 0) del = l+n-1;
    else if (l > 0) del = l;
    else del = 0;

    int ans = -del;
    rep(i, n) ans += l+i;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

const int mod = 1e9 + 7;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    string s[2];
    rep(i, 2) cin >> s[i];
    int x = 0;
    ll ans = 3;
    
    if ((x < (n - 1)) && (s[0][x] == s[0][x + 1]) && (s[1][x] == s[1][x + 1])) {
        ans = 6;
    }
    
    while(x < (n - 1)) {
        if ((x < (n - 1)) && (s[0][x] == s[1][x]) && (s[0][x + 1] == s[1][x + 1])) {
            if (x == 0) {
                ans = 6;
            }
            else {
                ans = ans * 2 % mod;
            }
            
            x++;
        }
        else if ((x < (n - 2)) && (s[0][x] == s[0][x + 1]) && (s[1][x] == s[1][x + 1]) && (s[0][x + 2] == s[1][x + 2])) {
            if (x == 0) {
                ans = 6;
            }
            
            x += 2;
        }
        else if ((x < (n - 2)) && (s[0][x] == s[1][x]) && (s[0][x + 1] == s[0][x + 2]) && (s[1][x + 1] == s[1][x + 2])) {
            if (x == 0) {
                ans = 6;
            }
            else {
                ans = ans * 2 % mod;
            }
            
            x++;
        }
        else if ((x < (n - 3)) && (s[0][x] == s[0][x + 1]) && (s[1][x] == s[1][x + 1]) && (s[0][x + 2] == s[0][x + 3]) && (s[1][x + 2] == s[1][x + 3])) {
            if (x == 0) {
                ans = 18;
            }
            else{
                ans = ans * 3 % mod;
            }
            
            x += 2;
        }
        else {
            x += 2;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

//ashishgup

const int N = 2e5+5;

ll n, ans=0;
ll a[N];
map<ll,ll>m;

void solve()
{
       cin>>n;
       rep(i,1,n+1) { cin>>a[i]; m[a[i]]++; }
       //sort(a+1, a+1+n);
       for(ll i=32; i>=0; i--)
       {
              for(auto &it:m)
              {
                     ll other = (1LL<<i)-it.F;
                     if(other == it.F)
                     {
                            ll take = it.S/2;
                            it.S%=2;
                            ans+=take;
                            continue;
                     }
                     if(m.find(other)!=m.end())
                     {
                            ll take = min(it.S, m[other]);
                            ans += take;
                            it.S -= take;
                            m[other] -= take;
                     }
              }
       }
       cout<<ans;
}


int main()
{
    speed_up
    ll T=1;
    //cin>>T;
    while(T--)
        solve();
    return 0;
}


Measured memory_bytes: 14336
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main(){
    long A[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>A[i][j];
        }
    }
    long N;
    cin>>N;
    long b[N];
    for(long i=0;i<N;i++){
        cin>>b[i];
    }
    bool bingo[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            bingo[i][j]=false;
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(A[j][k]==b[i])bingo[j][k]=true;
            }
        }
    }
    for(int i=0;i<3;i++){
        if(bingo[i][0]&&bingo[i][1]&&bingo[i][2])goto END;
    }
    for(int i=0;i<3;i++){
        if(bingo[0][i]&&bingo[1][i]&&bingo[2][i])goto END;
    }
    if(bingo[0][0]&&bingo[1][1]&&bingo[2][2])goto END;
    if(bingo[2][0]&&bingo[1][1]&&bingo[0][2])goto END;
    cout<<"No"<<endl;
    return 0;
    END:
    cout<<"Yes"<<endl;

}



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

class Student
{
public:
	int m, f, r;
	Student() : m(), f(), r() { }
	Student(int m, int f, int r) : m(m), f(f), r(r) { }

	char grade() const {
		if(m==-1 || f==-1) return 'F';
		int total = m + f;
		if(total >= 80) return 'A';
		if(total >= 65) return 'B';
		if(total >= 50 || r >= 50) return 'C';
		if(total >= 30) return 'D';
		return 'F';
	}
};

int main()
{
	int m, f, r;
	vector<Student> student;

	while(cin >> m >> f >> r && !(m==-1 && f==-1 && r==-1))
		student.emplace_back(m, f, r);

	for(const auto &s : student)
		cout << s.grade() << '\n';

	return 0;
}



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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    priority_queue<ll> que;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        que.push(a[i]);
    }
    vector<P> v;
    for (int i = 0; i < m; i++)
    {
        ll b, c;
        cin >> b >> c;
        v.push_back(P(c, b));
    }
    sort(v.rbegin(), v.rend());
    ll cnt = 0;
    for (int i = 0; i < m; i++)
    {
        ll c = v[i].first, b = v[i].second;
        for (int j = 0; j < b; j++)
        {
            if (cnt >= n)
                break;
            que.push(c);
            cnt++;
        }
    }
    ll ret = 0;
    cnt = 0;
    while (cnt < n)
    {
        ret += que.top();
        que.pop();
        cnt++;
    }
    cout << ret << endl;
}


Measured memory_bytes: 4848
import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    n, k = mi()
    s = input()
    a = [0]
    for i in range(1, n):
        if s[i]!= s[i-1]:
            a.append(i)
    a.append(n)
    ans = 0
    i, e = 0, 0
    m = len(a)
    for i in range(m):
        e = i+2*k
        if s[a[i]] == '1':
            e += 1
        e = min(e, m-1)
        ans = max(ans, a[e]-a[i])
        if e == m-1:
            break
    print(ans)
    



    
        
if __name__ == '__main__':
    main()

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> x(5);
    int num;
    for (int i = 0; i < 5; i++) {
        cin >> x[i];
        if (x[i] == 0) {
            num = i;
        }
    }
    cout << num + 1 << '\n';
    return 0;
}

Measured memory_bytes: 3604
l=int(input())
k=l
cnt=0
while k>1:
    k//=2
    cnt+=1
edge=[[] for _ in range(cnt)]
e=2*cnt
for i in range(cnt):
    edge[i].append((i+1,0))
    edge[i].append((i+1,2**i))
for i in reversed(range(cnt)):
    if l-2**i>=2**cnt:
        edge[i].append((cnt,l-2**i))
        l-=2**i
        e+=1
print(cnt+1,e)
for i in range(cnt):
    for j,d in edge[i]:
        print(i+1,j+1,d)

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int main(void){
  fast_io
  int n;cin>>n;
  ll a[n];
  ll sum=0;
  rep(i,n){
    cin>>a[i];
    sum += a[i];
  }
  double hoge = sum * 1.0 / n;
  int ans = -1;
  double ansd = LINF;
  rep(i,n){
    double dist = a[i]-hoge>0?a[i]-hoge:hoge-a[i];
    if(dist < ansd){
      ansd = dist;
      ans = i;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define pb push_back
#define sz(x)  ((int)x.size ())
#define all(x) (x).begin(), (x).end()
#define re return
#define mp make_pair
#define sqrt(x) sqrt (abs(x))
#define y0 y3451
#define y1 y4562
#define j0 j25624
#define j1 j45624
#define makeunique(x) sort(all(x)), (x).resize (unique(all(x)) - (x).begin())

typedef pair <int, int> ii;
typedef long long ll;
typedef unsigned long long ull;
typedef double D;
typedef long double ld;
typedef unsigned int uint;
typedef vector <string> vs;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <vi> vvi;

template <class T> using _tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> T abs (T x) { re x > 0 ? x : -x; }
template <class T> T sqr (T x) { re x * x; }
template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }
template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }

#define filename ""

const D pi = acos(-1.);
const int N = 2e6 + 20;
const int inf = 1e9 + 7;

int n, m;
ll h[N], C;
ll dp[N];

struct line {
	ll k, b;
	line (ll x = 0, ll y = 0) {
		k = x;
		b = y;
	}
	ll get(int x) {
		re k * x + b;
	}
} t[4 * N];

int vis[4 * N];

void add(int v, int tl, int tr, line x) {
	if (!vis[v]) { vis[v] = 1; t[v] = x; re; }
	if (t[v].get(tl) <= x.get(tl) && t[v].get(tr) <= x.get(tr)) re;
	if (t[v].get(tl) >= x.get(tl) && t[v].get(tr) >= x.get(tr)) { t[v] = x; re; }
	int c = (tl + tr) >> 1; 	
	if (x.get(tl) <= t[v].get(tl)) swap(t[v], x);
	if (t[v].get(c) >= x.get(c)) { swap(t[v], x); add(2 * v + 1, tl, c, x); }
	else add(2 * v + 2, c + 1, tr, x);
}

ll get(int v, int tl, int tr, int x) {
	if (!vis[v]) re inf;
	ll ans = t[v].get(x);
	if (tl == tr) re ans;
	int c = (tl + tr) >> 1;
	if (x > c) re min(ans, get(2 * v + 2, c + 1, tr, x));
	else re min(ans, get(2 * v + 1, tl, c, x)); 
}

int main() {
    cin >> n >> C;
    for (int i = 0; i < n; i++) scanf("%I64d", h + i);
	line cur = line(-2 * h[0], sqr(h[0]));
	add(0, 0, 1000000, cur);
	for (int i = 1; i < n; i++) {
//		printf("%d\n", i);
		auto x = get(0, 0, 1000000, h[i]);
//		printf("%I64d\n", x);

		dp[i] = x + C + sqr(h[i]);
		cur = line(-2 * h[i], sqr(h[i]) + dp[i]);
		add(0, 0, 1000000, cur);
	}
	cout << dp[n - 1];
	return 0;
}


Measured memory_bytes: 142336
#include<stdio.h>
#define N 1000000

int A[N],n;
void maxHeapify(int);
void buildMaxHeap(void);


int main(){

  int i;
  scanf("%d",&n);

  for(i=1 ; i<=n ; i++){
    scanf("%d",&A[i]);
  }

   buildMaxHeap();

  for(i=1 ; i<=n ; i++){
    printf(" %d",A[i]);
  }
    printf("\n");

    return 0;
  }

  void maxHeapify(int i){

    int left,right,large,tmp;

    left = 2*i;
    right = 2*i + 1;

    if(left <= n && (A[left]>A[i]) ){
      large = left;
    }
    else large = i;

    if(right <= n && (A[right]>A[large]) ){
      large = right;
    }

    if(large != i){
      tmp = A[i];
      A[i] = A[large];
      A[large] = tmp;
      maxHeapify(large);
    }
  }

  
void buildMaxHeap(void){

  int i;
  for(i = (n/2);i >=1;i--){
    maxHeapify(i);
  }
}

Measured memory_bytes: 2552
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
 
#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(){
    int a, b;
    cin >> a >> b;
    if(a==b)
        cout << "Draw" << endl;
    else if((b!=1 && a > b) || a==1)
        cout << "Alice" << endl;
    else
        cout << "Bob" << endl;
}


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

using namespace std;

string s;
int K;

string cbest[5];

void update (string C)
{
    for (int i = 0; i < 5; i++)
    {
        if (C < cbest[i])
        {
            for (int j = 4; j > i; j--)
                cbest[j] = cbest[j-1];
            cbest[i] = C;
            break;
        }
        else if (C == cbest[i])
            break;
    }
}

int main()
{
    cin >> s >> K;
    for (int i = 0; i < 5; i++)
    {
        cbest[i] = "zzzzzz";
    }

    int N = s.length();
    string t;
    for (int i = 0; i < N; i++)
    {
        t = "";
        for (int j = i; j < min (N, i + 5); j++)
        {
            t += s[j];
            update (t);
        }
    }

    cout << cbest[K-1] << "\n";
}

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

int main() {
	string s;
	cin >> s;
	bool c = false;
	for(int i = 0; i < s.length(); i++) {
		if(i == 0 && s[i] != 'A') {
			cout << "WA" << endl;
			return 0;
		}
		if((i >= 2 && i <= s.length() - 2) && s[i] == 'C') {
			if(c) {
				cout << "WA" << endl;
				return 0;
			}
			c = true;
		} else {
			// cout << s[i] << endl;
			if(i != 0 && (s[i] < 'a' || s[i] > 'z')) {
				cout << "WA" << endl;
				return 0;
			}
		}
	}
	if(!c) {
		cout << "WA" << endl;
		return 0;
	}
	cout << "AC" << endl;
	return 0;
}


Measured memory_bytes: 256
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let s = read_line () |> split_string
let q = Scanf.sscanf (read_line ()) "%d" @@ fun q -> q
let qq = Array.init q @@ fun _ -> read_line () |> split_string ~pattern:" "

let (s, t) = Array.fold_left (fun (s, t) -> function
  | "1" :: [] -> (t, s)
  | "2" :: f :: c :: [] -> if f = "1" then (c :: s, t) else (s, c :: t)
  | _ -> failwith ""
) (s, []) qq

let () =
  List.iter print_string s; 
  List.iter print_string (List.rev t); 
  print_newline ()

Measured memory_bytes: 41980
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

S = str(input())
weather = ["Sunny","Cloudy","Rainy"]
print(weather[(weather.index(S)+1) % len(weather)])


Measured memory_bytes: 5460
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
const int d5=100000;
vector<string> s;
int n;
vector<char> ch;
void dfs(string t){
    int sz=t.size();
    if(sz==n)s.emplace_back(t);
    else{
        for(int i=0;i<=sz;i++){
            dfs(t+ch[i]);
        }
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    bool are=false;
    s.reserve(d5);
    for(char c='a';c<='m';c++){
        ch.push_back(c);
    }
    if(n==10){
        are=true;
        n--;
    }
    string start="a";
    dfs(start);
    set<string> res;
    for(auto it:s){
        map<char,char> D;
        int cnt=0;
        for(int i=0;i<n;i++){
            if(D[it[i]]){
                it[i]=D[it[i]];
            }else{
                it[i]=ch[cnt];
                D[it[i]]=ch[cnt];
                cnt++;
            }
        }
        res.emplace(it);
    }
    if(are){
        set<string> RES;
        for(auto it:res){
            for(int i=0;i<10;i++){
                RES.insert(it+ch[i]);
            }
        }
        res.clear();
        for(auto it:RES){
            map<char,char> D;
            int cnt=0;
            for(int i=0;i<10;i++){
                if(D[it[i]]){
                    it[i]=D[it[i]];
                }else{
                    it[i]=ch[cnt];
                    D[it[i]]=ch[cnt];
                    cnt++;
                }
            }
            res.emplace(it);
        }
    }
    for(auto it:res)cout<<it<<' ';
    cout<<endl;
}

Measured memory_bytes: 61012
#include<iostream>
using namespace std;
#include<cstdio>
#include<complex>

typedef double type_n;
typedef complex<type_n> point;

void ccw(const point &a, const point &c, const point &z)
{
    point w;
    w = conj(c) * (z - a);
    if(w.imag() > 0){ printf("COUNTER_CLOCKWISE\n"); return; }
	if(w.imag() < 0){ printf("CLOCKWISE\n"); return; }
    if(w.real() < 0){ printf("ONLINE_BACK\n"); return; }
    if(w.real() > norm(c)){ printf("ONLINE_FRONT\n"); return; }
    printf("ON_SEGMENT\n");
    return;
}

int main()
{
    point a, b, c, z;
    int i, q;
    type_n a1, a2, b1, b2, z1, z2;
    scanf("%lf %lf %lf %lf", &a1, &a2, &b1, &b2);
    a.real(a1), a.imag(a2), b.real(b1), b.imag(b2);
    c = b - a;

    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%lf %lf", &z1, &z2);
        z.real(z1), z.imag(z2);
        ccw(a, c, z);
    }
    return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

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

        while (scanner.hasNext()) {
            final int a = scanner.nextInt();
            final int b = scanner.nextInt();

            final int gcd = GetGcd(a, b);
            final int lcm = GetLcm(a, b, gcd);

            System.out.println(gcd + " " + lcm);
        }
    }

    static int GetGcd(int left, int right) {
        while (right > 0) {
            final int tmp = left % right;
            left = right;
            right = tmp;
        }

        return left;
    }

    static int GetLcm(int left, int right) {
        return left / GetGcd(left, right) * right;
    }

    static int GetLcm(int left, int right, int gcd) {
        return left / gcd * right;
    }

}

Measured memory_bytes: 26372
#include<cstdio>
#include<algorithm>
#define rep(i, a, b) for (register int i=(a); i<=(b); ++i)
#define per(i, a, b) for (register int i=(a); i>=(b); --i)
using namespace std;
const int N=200005;
int pre[N], suf[N], ans=N; char s[N];

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

int main()
{
	int n=read(); scanf("%s", s+1);
	rep(i, 1, n) pre[i]=pre[i-1]+(s[i]=='#');
	per(i, n, 1) suf[i]=suf[i+1]+(s[i]=='.');
	rep(i, 1, n) ans=min(ans, pre[i-1]+suf[i+1]);
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1920
a, b, k = map(int, input().split())
for i in range(a, a + k):
    if i > 0 and i <= b:
        print(i)
for i in range(b - k + 1, b + 1):
    if b - k + 1 != a + k - 1 and i > 0 and i > a + k and i <= b:
        print(i)
    elif i > 0 and i <= b and i > a + k - 1:
        print(i)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool PN(T x)
{
  if (x <= 1)
    return false;
  if (x == 2)
    return true;
  for (int i = 2; i < sqrt(x) + 1; i++)
    if (x % i == 0)
      return false;
  return true;
}

void solve()
{
  string o, e; cin >> o >> e;
  int no, ne;
  no = o.size();
  ne = e.size();
  string ans;
  for(int i =0; i < no; i++){
    ans += o[i];
    if( ne != i) ans+= e[i];
  }
  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int s[n*2];
    for(int i=0;i<n*2;i++){
        cin>>s[i];
    }
    sort(s,s+n*2);
    int ans=0;
    for(int i=0;i<n*2;i+=2){
        ans+=s[i];
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp[2];
    rep(i, n) {
        mp[i&1][a[i]]++;
    }
    int ans = 0;
    vector<pii> v;
    for(auto&& p : mp[0]) {
        v.push_back(p);
    }
    sort(all(v), [&](pii a, pii b){return a.se > b.se;});
    int sz = min(2, (int)v.size());
    for(auto&& p : mp[1]) {
        rep(j, sz) {
            if(v[j].fi == p.fi) ans = max({ans, v[j].se, p.se});
            else chmax(ans, v[j].se + p.se); 
        }
    }
    ans = n - ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6012
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll n, a, b; cin >> n >> a >> b;
    ll c = a + b;
    ll ans = n / c * a;
    ans += min(n % c, a);
    cout << ans << "\n";
}

Measured memory_bytes: 256
import sys
import math

ALPHABET = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
result = []

def alphabet_decimal(v):
    quotient = math.floor(v / len(ALPHABET))
    surplus = v % len(ALPHABET)
    quotient -= 1 if surplus == 0 else 0
    surplus = len(ALPHABET) if surplus == 0 else surplus
    result.append(surplus)
    if len(ALPHABET) < quotient:
        alphabet_decimal(quotient)
    elif len(ALPHABET) < v:
        result.append(quotient)
    return "".join([ALPHABET[i - 1] for i in reversed(result)])

x=int(input())
print(alphabet_decimal(x))


Measured memory_bytes: 9216
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	s;

	cin >> a >> b >> c >> k;

	if (a>=k) {
		ans = k;
	} else if (a+b>=k) {
		ans = a;
	} else {
		ans = a - (k-(a+b));
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN
    ll a,b,c;cin>>a>>b>>c;
    ll k;cin>>k;
    REP(i,k){
        if (a >= b) {b *= 2; continue;}
        if (b >= c) {c *= 2; continue;}
        if (a<b && b<c) break;
    }
    if (a<b && b<c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

int main()
{
	string x="abcdefghijklmnopqrstuvwxyz";
	char moji,moji2;

	cin >> moji;

	for (int i = 0; i < 26; i++) {
		if (moji == x[i]) {
			moji2 = x[i + 1];
		}
	}

	cout << moji2 << endl;
	cin.get();
    cin.get();
    return 0;
}

Measured memory_bytes: 256
// AFTER CONTEST, WIP

//
// Default setup for C++
//

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

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
template<typename T> struct is_container {
template<typename C> static char test(typename C::const_iterator*); template<typename> static int test(...);
static bool const value = sizeof(test<T>(nullptr)) == sizeof(char) && !std::is_same<std::string, T>::value;
};
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
istream& operator>>(istream& i, T& x) { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#ifndef DEBUG
#define DEBUG 0
#endif
#define dbg(X) do { if (DEBUG) { cout << #X ": " << (X) << endl << flush; } } while (0)
#define dbg2(X) do { if (DEBUG) { cout << #X ":" << endl; for (auto& __x : (X)) { cout << __x << endl << flush; } } } while (0)
#define dbgv(...) do { if (DEBUG) { cout << "(" #__VA_ARGS__ "): " << make_tuple(__VA_ARGS__) << endl << flush; } } while (0)
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
ostream& operator<<(ostream& o, const T& x) { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Main
void mainCase() {
  int n, m; // <= 10^5
  cin >> n >> m;
  vector<tuple<int, int>> edges(m, {0, 0}); // connected
  cin >> edges;

  vector<vector<int>> adj(n);
  for (auto [x, y] : edges) {
    x--; y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }

  // BFS
  vector<int> parent(n, -1);
  deque<int> q;
  q.push_back(0);
  while (!q.empty()) {
    int v = q.front(); q.pop_front();
    for (auto u : adj[v]) {
      if (parent[u] == -1) {
        parent[u] = v;
        q.push_back(u);
      }
    }
  }

  cout << "Yes" << endl;
  FOR(v, 1, n) {
    cout << (parent[v] + 1)<< endl;
  }
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  // [ Single case ]
  mainCase();
  return 0;
  // [ Multiple cases ]
  // int t;
  // cin >> t;
  // FOR(i, 0, t) { mainCase(); }
  // return 0;
}

/*
python misc/run.py atcoder/abc168/d/main_v2.cpp --check

%%%% begin
4 4
1 2
2 3
3 4
4 2
%%%%
Yes
1
2
2
%%%% end
*/


Measured memory_bytes: 11704
import java.util.Scanner;

public class Main {
	static boolean isPrime[] = new boolean[50001];
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	for(int i = 1 ; i <= 50000 ; i++){
    		isPrime[i] = isPrime(i);
    	}
    	while(input.hasNext()){
    		int a = input.nextInt();
    		if(a == 0)break;
    		System.out.println(gold(a));
    	}
    }
    
    public static int gold(int a){
    	int count = 0;
    	for(int i = 2 ; i <= a/2 ; i++){
    		if(isPrime[i] && isPrime[a-i])count++;
    	}
    	return count;
    }
    
    public static boolean isPrime(int n){
    	if(n == 2)return true;
    	if(n % 2 == 0)return false;
    	for(int i = 3 ; i <= Math.sqrt(n) ; i++){
    		if(n % i == 0)return false;
    	}
    	return true;
    }
}

Measured memory_bytes: 33076
#include <cstdio>
#include <cctype>

int main(){
  char c;

  while (1) {
    scanf("%c", &c);
    if (isalpha(c)) {
      if (islower(c)) {
        c = toupper(c);
      }
      else {
        c = tolower(c);
      }
    }
    printf("%c", c);
    if (c == '\n') {
      break;
    }
  }

  return 0;
}


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
        x2-=x1;
        x3-=x1;
        xp-=x1;
        y2-=y1;
        y3-=y1;
        yp-=y1;
        double m=(x3*y2-x2*y3);
        double p=(x3*yp-xp*y3)/m;
        double q=(xp*y2-x2*yp)/m;
        cout<<((p>=0&&q>=0&&p+q<=1)?"YES\n":"NO\n");
    }
    return 0;
}

Measured memory_bytes: 3132
#include <iostream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;



int main() {
    int h, n;
    cin >> h >> n;
    int ans = 0;
    rep(i,n) {
        int a;
        cin >> a;
        ans += a;
    }
    if(ans >= h) puts("Yes");
    else puts("No");

    return 0;
}


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

int main(){
 int a,b,n=0; 
 cin >> a >> b;
 for(int i=0;i<2;i++){
   if(a>b){
     n += a;
     a--;
   }
   else{
     n += b;
     b--;
   }
 }
  cout << n << endl;
  
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back
typedef long double T;

const double pi = acos(-1);

struct pt {
	T x, y;
	pt operator-(pt q) const {
		return {x - q.x, y - q.y};
	}
};

pt rot(pt p, double ang) {
	return {p.x * cos(ang) - p.y * sin(ang), p.x * sin(ang) + p.y * cos(ang)};
}

double toRad(double degAng) {
	return pi * degAng / 180;
}

T abs(pt p) {
	return hypot(p.x, p.y);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cout << setprecision(18) << fixed;
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	pt A, B;
	A.x = 0;
	A.y = a;
	B.x = 0;
	B.y = b;
	double aAng = toRad((double)360 / 12) * ((double)m / 60 + h);
	double bAng = toRad((double)360 / 60) * m;
	A = rot(A, aAng);
	B = rot(B, bAng);
	cout << abs(A - B);
	return 0;
}


Measured memory_bytes: 4060
N = int(input())
A = list(map(int,input().split()))

from collections import Counter

C = Counter(A)

K = list(C.keys())

D = [0]*(10**6 + 1)

for k in K:
    l = 2*k
    while l <= 10**6:
        D[l] = 1
        l+=k
count = 0
for k in K:
    if C[k]==1 and D[k]==0:
        count+=1
print(count)

Measured memory_bytes: 131060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int H, W; cin >> H >> W;
    vector<vector<char>> m(H, vector<char>(W));    
    for (int i = 0; i < H; i++)
    {
        string s; cin >> s;
        for (int j = 0; j < W; j++)
        {
            m[i][j] = s[j];
        }
    }
    
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if(m[i][j]=='#') continue;
            int cnt = 0;
            if(i>0 && m[i-1][j]=='#') cnt++;
            if(i<H-1 && m[i+1][j]=='#') cnt++;
            if(j>0 && m[i][j-1]=='#') cnt++;
            if(j<W-1 && m[i][j+1]=='#') cnt++;
            if(i>0 && j>0 && m[i-1][j-1]=='#') cnt++;
            if(i<H-1 && j>0 && m[i+1][j-1]=='#') cnt++;
            if(i>0 && j<W-1 && m[i-1][j+1]=='#') cnt++;
            if(i<H-1 && j<W-1 && m[i+1][j+1]=='#') cnt++;
            m[i][j] = cnt + '0';
        }
    }
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            cout << m[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

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

  int cnt = 0;
  for(int i = 0; i < n-2; i++) {
    if (p[i] < p[i+1]) {
      if (p[i+1] < p[i+2]) {
        cnt++;
      }
    } else if (p[i] > p[i+1]) {
      if (p[i+1] > p[i+2]) {
        cnt++;
      }
    }
  }

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


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

int main(){
    int age;
    int A,B;

    cin >>age;
    if(age==1){
        cout << "Hello World" <<endl;
    }else{
        cin >>A>>B;
        cout << A+B <<endl;
    }
    return 0;
}


Measured memory_bytes: 256