akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<queue>
#include<cassert>
#include<cmath>
using namespace std;
#define rep(i, n) for ( int i = 0; i < n; i++)
#define mp(a, b) make_pair(a, b)
typedef pair<pair<int, int>, int> State;

static const int MAX = 60;
static const int N =  2*MAX+1;
static const int dx[6] = {1, 1, 0, -1, -1, 0};
static const int dy[6] = {0, 1, 1, 0, -1, -1};
main(){
  bool O[N][N];
  int t, n, x, y, sx, sy;
  while(1){
    cin >> t >> n;
    assert( t <= 30 );

    if ( t == 0 && n == 0 ) break;
    rep(i, N) rep(j, N) O[i][j] = false;
    rep(i, n){
      cin >> x >> y;
      O[x+MAX][y+MAX] = true;
      assert( abs(x) <= 30 );
      assert( abs(y) <= 30 );
    }
    cin >> sx >> sy;
    sx += MAX;
    sy += MAX;
    queue<State> Q;
    State u;
    Q.push(mp(mp(sx, sy), 0));
    O[sx][sy] = true;
    int cnt = 0;
    while(!Q.empty()){
      u = Q.front(); Q.pop();

      cnt++;
      for ( int r = 0; r < 6; r++ ){
	int nx = u.first.first + dx[r];
	int ny = u.first.second + dy[r];
	if ( O[nx][ny] || u.second+1 > t) continue;
	O[nx][ny] = true;
	Q.push(mp(mp(nx, ny), u.second+1));
      }
    }
    cout << cnt << endl;
  }

}

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

namespace abc072
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            for(int i = 0; i < str.Length; i++)
            {
                Console.Write(str[i]);
                i++;
            }
            Console.WriteLine();
        }
    }
}


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

int main() {

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

    // i番目のマスに降り立ったときに移動可能な回数を格納
    vector<int> can(N, 0);

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

        if (i >= 1) {
            if (H[i] <= H[i-1]) continue;
        }

        int j = 0;
        while(H[i+j] >= H[i+j+1]) {
            can[i] += 1;
            j++;
            if (i + j == N-1) break;
        }

    }

    sort(can.begin(), can.end(), greater<int>());

    cout << can[0] << endl;

}

Measured memory_bytes: 1024
import math
A, B = map(int,input().split())
LA = []
LB = []

X = math.ceil(A / 0.08)
Y = math.ceil(B / 0.1)
N = int((A+1) // 0.08)
M = int((B+1) // 0.1)

for i in range(X, N+1):
    LA.append(i)
for i in range(Y, M+1):
    LB.append(i)

ans = set(LA) & set(LB)
ans_list = list(ans)
if not ans_list:
    print(-1)
else:
    print(min(ans_list))

Measured memory_bytes: 9196
#!/usr/bin/env python3

class Bit:
    # Binary Indexed Tree
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def __iter__(self):
        psum = 0
        for i in range(self.size):
            csum = self.sum(i + 1)
            yield csum - psum
            psum = csum
        raise StopIteration()

    def __str__(self):  # O(nlogn)
        return str(list(self))

    def sum(self, i):
        # [0, i) の要素の総和を返す
        if not (0 <= i <= self.size): raise ValueError("error!")
        s = 0
        while i>0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        if not (0 <= i < self.size): raise ValueError("error!")
        i += 1
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

    def __getitem__(self, key):
        if not (0 <= key < self.size): raise IndexError("error!")
        return self.sum(key+1) - self.sum(key)

    def __setitem__(self, key, value):
        # 足し算と引き算にはaddを使うべき
        if not (0 <= key < self.size): raise IndexError("error!")
        self.add(key, value - self[key])

(n,), (s,), _, *q = map(str.split, open(0))
*s, = s
BIT = [Bit(int(n)) for _ in [0] * 26]
for e, t in enumerate(s):
    BIT[ord(t) - 97].add(e, 1)
for a, b, c in q:
    if a == "1":
        i = int(b)
        BIT[ord(s[i - 1]) - 97].add(i - 1, -1)
        s[i - 1] = c
        BIT[ord(c) - 97].add(i - 1, 1)
    else:
        l, r = int(b), int(c)
        print(sum(BIT[i].sum(r) - BIT[i].sum(l - 1) > 0 for i in range(26)))


Measured memory_bytes: 229324
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    int n; std::cin >> n;
    std::vector<int> s(n,0);
    for(int i=0; i<n; i++){
        std::cin >> s[i];
    }

    std::sort(s.begin(),s.end());

    int ans = std::accumulate(s.begin(),s.end(),0);
    if(ans%10==0){
        for(int i=0; i<n; i++){
            if(s[i]%10!=0){
                std::cout << ans-s[i] << "\n";
                return 0;
            }
        }
    }else{
        std::cout << ans << "\n";
        return 0;
    }
    std::cout << 0 << "\n";
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

void solve()
{
  lli a,b,c,k,op=0;
  cin>>a>>b>>c>>k; 
  while(b<=a)
  {
    b=b*2;
    op++;
  } 
  while(c<=b)
  {
    c=c*2;
    op++;
  } 

  if(op<=k)
    cout<<"Yes";
else
    cout<<"No";


}
int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputb.txt", "r", stdin);
     freopen("outputb.txt", "w", stdout);
    #endif    
    
    // test
    {
        solve();
        nl
    }
}
//a+b=a?b+2?(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";




Measured memory_bytes: 3608
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN=40;
int n;
struct card {
	char letter;
	int num;
} c[MAXN],d[MAXN];
void bs () {
	int pos=0;
	bool flag=true;
	while (flag) {
		flag=false;
		for (int i=n-1;i>pos;i--) {
			if (c[i].num<c[i-1].num) {
				swap(c[i],c[i-1]);
				flag=true;
			}
		}
		pos++;
	}
}
void ss () {
	for (int i=0;i<n;i++) {
		int mn=i;
		for (int j=i+1;j<n;j++) {
			if (d[j].num<d[mn].num) mn=j;
		}
		if (mn!=i) swap (d[mn],d[i]);
	}
}
int main () {
	scanf ("%d",&n);
	getchar();
	scanf ("%c%d",&c[0].letter,&c[0].num);
	d[0]=c[0];
	for (int i=1;i<n;i++) {
		scanf (" %c%d",&c[i].letter,&c[i].num);
		d[i]=c[i];
	}
	bs();
	ss();
	printf ("%c%d",c[0].letter,c[0].num);
	for (int i=1;i<n;i++) {
		printf (" %c%d",c[i].letter,c[i].num);
	}
	printf ("\nStable\n");
	bool flag=true;
	printf ("%c%d",d[0].letter,d[0].num);
	if (d[0].letter!=c[0].letter) flag=false;
	for (int i=1;i<n;i++) {
		printf (" %c%d",d[i].letter,d[i].num);
		if (d[i].letter!=c[i].letter) flag=false;
	}
	if (flag) printf ("\nStable\n");
	else printf ("\nNot stable\n");
    return 0;
}


Measured memory_bytes: 2760
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
using namespace std;

const int MaxN = 800;
const int MaxM = 800;

const int INF = 0x3f3f3f3f;

const int NDir = 4;
const int DirX[NDir] = {0, 0, 1, -1};
const int DirY[NDir] = {1, -1, 0, 0};

int n, m, nK;
char map[MaxN + 1][MaxM + 2];

struct point
{
	int x, y;
	point() {}
	point(const int &_x, const int &_y)
		: x(_x), y(_y) {}
};
queue<point> q;

int lev[MaxN + 1][MaxM + 1];

void bfs(int sx, int sy)
{
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			lev[i][j] = INF;
	lev[sx][sy] = 0;

	q.emplace(sx, sy);
	while (!q.empty())
	{
		point p = q.front();
		q.pop();

		for (int d = 0; d < NDir; ++d)
		{
			int x = p.x + DirX[d];
			int y = p.y + DirY[d];
			if (x < 1 || x > n || y < 1 || y > m)
				continue;
			if (map[x][y] != '#' && lev[x][y] == INF)
			{
				lev[x][y] = lev[p.x][p.y] + 1;
				q.emplace(x, y);
			}
		}
	}
}

int main()
{

	cin >> n >> m >> nK;
	for (int i = 1; i <= n; ++i)
		scanf("%s", map[i] + 1);

	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (map[i][j] == 'S')
				bfs(i, j);

	int res = INF;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (lev[i][j] <= nK)
			{
				int l = 1;
				if (i > 1 && i < n && j > 1 && j < m)
					l += (min(min(i - 1, n - i), min(j - 1, m - j)) - 1) / nK + 1;
				res = min(res, l);
			}

	cout << res << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int get(int x) {
  return (x * (x - 1)) / 2;
}

bool isok(string s) {
  string p = s;
  reverse(p.begin(), p.end());
  return p == s;
}

int main() {
  string s; cin >> s;
  int n = s.length();
  s = "#" + s + "#";
  string cur = "";
  for(int i = 1; i <= (n - 1) / 2; i++) {
    cur += s[i];
  }
  string curr = "";
  for(int i = (n + 3) / 2; i <= n; i++) {
    curr += s[i];
  }
  if(isok(s) and isok(cur) and isok(curr)) {
    puts("Yes");
  }
  else {
    puts("No");
  }
  return 0;
}

Measured memory_bytes: 256
# Problem D - Gathering Children

import re

# input
S = input()

# initialization
rl_list = re.findall(r'R+L+', S)
ans_list = []

# count
for rl in rl_list:
    right_count = 0
    left_count = 0

    right = re.findall(r'R+', rl)[0]
    left = re.findall(r'L+', rl)[0]

    # right count
    for i in range(1, len(right)+1):
        if i%2==0:
            left_count += 1
        else:
            right_count += 1

    # left count
    for i in range(1, len(left)+1):
        if i%2==0:
            right_count += 1
        else:
            left_count += 1

    # answer decision
    for i in range(len(right)-1):
        ans_list.append(0)
    ans_list.append(right_count)
    ans_list.append(left_count)
    for i in range(len(left)-1):
        ans_list.append(0)

# output
ans_list = list(map(str, ans_list))
print(" ".join(ans_list))


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

int main()
{
	int n;
	cin >> n;
	long a[n];
	long s[n];
	long sum = 0;
	rep(i, n)
	{
		cin >> a[i];
		sum += a[i];
		s[i] = sum;
	}
	long ans = labs(sum - a[0] * 2);
	rep(i, n-1)
	{
		// cout << s[i] << endl;
		ans = min(ans, labs(sum - s[i]*2));
	}
	cout << ans;
	return (0);
}


Measured memory_bytes: 3328
N=int(input())
A=[[i,int(input())] for i in range(N)]
A.sort(key=lambda x:x[1],reverse=True)
j=A[0][0]
b1=A[0][1]
b2=A[1][1]
for i in range(N):
  print(b2 if i==j else b1)

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

struct Card {
    char suit, value;
};

void bubbleSort(Card c[], int n) {
    bool flag = true;
    for (int i = 0; flag; i++) {
        flag = false;
        for (int j = n - 1; j > i; j--) {
            if (c[j].value < c[j-1].value) {
                swap(c[j], c[j-1]);
                flag = true;
            }
        }
    }
}

void selectionSort(Card c[], int n) {
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            if (c[j].value < c[minj].value) {
                minj = j;
            }
        }
        if (minj != i) {
            swap(c[i], c[minj]);
        }
    }
}

void print(Card c[], int n) {
    for (int i = 0; i < n; i++) {
        if (i > 0) cout << " ";
        cout << c[i].suit << c[i].value;
    }
    cout << "\n";
}

bool isStable(Card c1[], Card c2[], int n) {
    for (int i = 0; i < n; i++) {
        if (c1[i].suit != c2[i].suit) {
            return false;
        }
    }
    return true;
}

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

    int n;
    cin >> n;
    Card c1[n], c2[n];
    for (int i = 0; i < n; i++) {
        cin >> c1[i].suit >> c1[i].value;
    }
    for (int i = 0; i < n; i++) c2[i] = c1[i];

    bubbleSort(c1, n);
    print(c1, n);
    cout << "Stable\n";

    selectionSort(c2, n);
    print(c2, n);
    if (isStable(c1, c2, n)) {
        cout << "Stable\n";
    } else {
        cout << "Not stable\n";
    }
    return 0;
}


Measured memory_bytes: 3124
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  int n, k;
  cin >> n;
  k = log10(n);
  string s;
  s = to_string(n);
  int a[k+1];
  for (int i = 0; i <= k; i++) {
    a[i] = int(s[i] - '0');
  }


  int odd = 0;
  for (int i = 1; i <= k; i++) {
    if (i%2==0 && i!=k){//odd digit and not top
      odd += (10 * pow(10, i)) -  (1 * pow(10, i));
      //cout << i+1 << " " << odd << endl;
    }if (i%2==0 && i==k) {//odd digit and top
      odd+= n - pow(10, i) + 1;
    }
  }
  if (n >=10){
    odd+=9;
  } else{
    odd+=n;
  }
  cout << odd << endl;
  return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from fractions import gcd
def resolve():
    h,w,t=map(int,input().split())
    g1=gcd(h,t)
    g2=gcd(w,t)
    h=h//g1
    w=w//g2
    ans=pow(2,h,MOD)+pow(2,w,MOD)+pow(2,gcd(h,w),MOD)-3
    ans%=MOD
    print(pow(ans,g1*g2,MOD))
resolve()

Measured memory_bytes: 65900
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(b-a==c-b){
    puts("YES");
  }else{
    puts("NO");
  }
}

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

int main(){
	string str;
	while(cin >> str){
		int JOI = 0, IOI = 0;
		for(int i = 0; i < str.size()-2; i++){
			if(str[i] == 'J' && str[i+1] == 'O' && str[i+2] == 'I') JOI++;
			if(str[i] == 'I' && str[i+1] == 'O' && str[i+2] == 'I') IOI++;
		}
		cout << JOI << endl << IOI << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>
main(){
  int x,y;
  while(1){
    scanf("%d %d",&x,&y);
    if(x==0 && y==0){
      break;
    }
    if(x==y){
      printf("%d %d\n",x,y);
    }else if(x>y){
      printf("%d %d\n",y,x);
    }else if(x<y){
      printf("%d %d\n",x,y); 
    }
  }
  return 0;
}

Measured memory_bytes: 2592
#include<stdio.h>

int main(void){
  int N,K;
  
  scanf("%d%d",&N,&K);
  
  int h[N],count = 0;
  for(int i=0;i<N;i++){
    scanf("%d",&h[i]);
    if(h[i] >= K) count++;
  }
  
  printf("%d",count);
  
  return 0;
}
  

Measured memory_bytes: 512
n, m = map(int, input().split())
hyoko = list(map(int, input().split()))
result = {}

for i in range(1, n+1):
    result[i] = result.get(i, set())

for i in range(0, m):
    michi = list(map(int, input().split()))
    result[michi[0]].add(michi[1])
    result[michi[1]].add(michi[0])

count = 0

for key, value in result.items():
    flg = 0
    if len(value) == 0:
        count += 1
        continue
    for i in value:
        if hyoko[key-1] <= hyoko[i-1]:
            flg = 1
    
    if flg == 0:
        count += 1
        
print(count)

Measured memory_bytes: 53868
#include <iostream>
#include <functional>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <set>

using namespace std;

#define Get(ty,...) ty __VA_ARGS__;cins(__VA_ARGS__);
#define GetArray(ty,v,n) vector<ty> v(n);cin_arr(v,n);
#define ci cin
#define co cout
#define en endl;
#define Arr(f, arr,pred) f(arr.begin(),arr.end(),pred)
#define Arr2(f, arr) f(arr.begin(),arr.end())
#define ArrExpr(f, arr,expr) f(arr.begin(),arr.end(),[](auto x){return expr;})
#define Acc(init,arr,pred) accumulate(arr.begin(),arr.end(),init,pred)

void cins(){}

template<class Head,class... Tail>
void cins(Head& head,Tail&... tail) {
	cin >> head;
	cins(tail...);
}

template<class Arr>
void cin_arr(Arr& v,int n) {
	for (int i = 0; i < n; i++)
		cin >> v[i];
}

int main() {
	Get(string, s);
	string buf = "";
	Arr2(reverse, s);
	for (char c : s) {
		buf = c + buf;
		if (buf == "dream" || buf == "dreamer" || buf == "erase" || buf == "eraser") {
			buf = "";
		}
		if (buf.size() > 7) {
			co << "NO" << en;
			return 0;
		}
	}
	if (buf.size() == 0)
		co << "YES" << en
	else
		co << "NO" << en;

}




Measured memory_bytes: 512
import java.util.*;

public class Main {
	static final int edge = 1000000;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt(), x = sc.nextInt();
		sc.close();
		k--;
		int s = x - k;
		if (s < -edge)
			s = -edge;
		int end = x + k;
		if (end > edge)
			end = edge;
		for (int i = s; i <= end; ++i)
			System.out.print(i + " ");
		System.out.println();
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;

void solve(){
  cin >> n;
  int ans=0;
  int a;
  for(int i=0;i<n;i++){
    cin >> a;
    ans+=a;
  }
  if(ans%2==0)cout << "YES";
  else cout << "NO";
  cout << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = Array.new(n)
n.times do |i|
    a[i] = gets.to_i
end
flag = Array.new(n,false)
current = 1
c = 0

while true
    if current == 2
        puts c
        break
    end
    if flag[current-1]
        puts -1
        break
    else
        flag[current-1] = true
    end
    current = a[current-1]
    c += 1
end

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

typedef long long ll;

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

	sort(L.begin(),L.end());
	reverse(L.begin(),L.end());

	int Ma=L[0];
	int sum=0;
	for (int i = 1; i < N; i++) {
		sum += L[i];
	}
	cout << (Ma < sum ? "Yes":"No") << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (h, a) = readIntegerList()
    println((h + a - 1) / a)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 36020
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
    	
    	int start, goal, middle;
    	start = sc.nextInt();
    	goal = sc.nextInt();
    	middle = sc.nextInt();
    	
    	if ((start < middle && middle < goal) || (goal < middle && middle < start)) {
    		System.out.println("Yes");
    	} else {
    		System.out.println("No");
    	}
    	
    }

}

Measured memory_bytes: 21844
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
using namespace std;

#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vector<int>>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define itr(v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fd(i,n)         for(int i=n-1;i>=0;i--)
#define fir(i,a,b)      for(int i=a;i<b;i++)
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);
#define MAXZ            200005
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

bool cmp(int a,int b) {return a>b;}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

int a[200001],b[200001];

int32_t main()
{
    FIO
    int n; cin>>n;
    n=n%10;
    if(n==1 || n==0 || n==6 || n==8){
        cout<<"pon\n";
    }
    else if(n==2 || n==4 || n==5 || n==7 || n==9) {
        cout<<"hon\n";
    }
    else{
        cout<<"bon\n";
    }
    return 0;

}

Measured memory_bytes: 3652
while 1:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(0, H):
        for j in range(0, W):
            if (i + j) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()



Measured memory_bytes: 7004
n, m = map(int, input().split())
switches = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    all_on_flag = 1
    for j in range(m):
        switch = switches[j]
        cnt = 0
        for s in switch[1:]:
            if i & (1 << (s-1)):
                cnt += 1
        if cnt % 2 != p[j]:
            all_on_flag = 0
            break
    if all_on_flag:
        ans += 1
print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << pp(x)
#define dg2(x,y) debug() << pp(x) pp(y)
#define dg3(x,y,z) debug() << pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x) memset(x , 0 , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

class Binomial {
  private:
  const int Mod = 1e9 + 7;
  vector<int> fac, finv, inv;

  public:
  Binomial(int n) : fac(n, 1), finv(n, 1), inv(n, 1) {
    for(int i = 2; i < n; i++) {
      fac[i] = fac[i-1] * i % Mod;
      inv[i] = Mod - inv[Mod%i] * (Mod/i) % Mod;
      finv[i] = finv[i-1] * inv[i] % Mod;
    }
  }
  int C(int n, int r) {
    return (fac[n] * finv[r] % Mod * finv[n - r] ) % Mod;
  }
  int P(int n, int r) {
    return (fac[n] * finv[n - r]) % Mod;
  }
};
              
signed main(){
  ios::sync_with_stdio(false);cin.tie(0);
  int n , k;
  cin >> n >> k;
  Binomial F(n + 1);
  k = min(k , n - 1);
  int ans = 0;
  for(int i = 0; i <= k; i++) {
    ans += (F.C(n, i) * F.C(n - 1 , i) % Mod) % Mod;
    ans = ans % Mod;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 7876
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int
#define MOD 1000000007

LL kaizyo[200001];
LL inv[200001];


LL ruizyo(LL x,LL n){
    LL result = 1;
    while(n > 0){
        if(n&1 == 1){
            result = (result*x)%MOD;
        }
        n = n >> 1;
        x = (x*x) % MOD;
    }
    return result;
}

LL comb(LL n,LL r){
    return (((kaizyo[n]*inv[r])%MOD)*inv[n-r]%MOD);
}

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

    LL h,w,a,b;

    cin >> h >> w >> a >> b;


    kaizyo[0] = 1;
    for(LL l = 1; l < 200001; l++){
        kaizyo[l] = (kaizyo[l-1] * l)%MOD;
        inv[l] = ruizyo(kaizyo[l],MOD-2) % MOD;
    }
    inv[0] = ruizyo(1,MOD-2);

    LL result = 0;

    for(LL i = b+1; i <= w; i++){
        LL j = h - a - 1;
        LL k = i - 1;
        LL r;
        if(j < k){
            r = j;
        }else{
            r = k;
        }
        LL tmp = comb(j+k,r);

        if(w-i < a){
            r = w-i;
        }else{
            r = a-1;
        }
        tmp = (tmp*comb(a+w-i-1,r))%MOD;

        result = (result+tmp)%MOD;
    }

    cout << result << endl;
    
    return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#define ll long long
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
static const int MAX = 1000000007;
static const int MAXN = 100001;

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    
    swap(x,y);
    swap(x,z);

    cout << x << " " << y << " " << z << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	int n = sca.nextInt();
	String[] str = new String[n];
	int temp = 0;
	int max = 0;
	List<String> smallstr = new ArrayList<>();


	Map<String, Integer> map = new HashMap<>();
	for(int i = 0; i < n; i++) {
		str[i] = sca.next();

		if(i == 0) {
			map.put(str[i], 1);
		}

		if(map.containsKey(str[i]) == true && i > 0) {
			temp = map.get(str[i]);
			temp++;
			map.put(str[i], temp);
		}
		else if(map.containsKey(str[i]) != true && i > 0) {
			map.put(str[i], 1);
		}
	}

	for (int val : map.values()) {
		if(val > max) {
			max = val;
		}
	}

	for (String key : map.keySet()) {
		if(map.get(key) == max) {
			smallstr.add(key);
		}
	}

	Collections.sort(smallstr);
	for(String result : smallstr) {
		System.out.println(result);
	}
	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 88436
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    char c, ans;
    cin >> c;
    switch(c){
        case 'A':
            ans = 'T';
            break;
        case 'T':
            ans = 'A';
            break;
        case 'G':
            ans = 'C';
            break;
        case 'C':
            ans = 'G';
            break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
 
res = 0
for i in range(10):
    if str(i) in S:
        T = S[S.index(str(i))+1:]
        
        for j in range(10):
            if str(j) in T:
                U = T[T.index(str(j))+1:]
                
                for k in range(10):
                    if str(k) in U:
                        res += 1
                
print(res)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
// typename alias
template <class T> using vec = vector<T>;
template <class T, class U> using vep = vec<pair<T,U> >;
template <class T> using PQ = priority_queue<T>;
using ll = long long;
using vll = vec<ll>;
using pll = pair<ll, ll>;
using vpll = vec<pll>;
using str = string;
// あくまのちから
//#define int ll

// const
static const long long INF = 1LL<<59;
static const long long MOD = (ll)1e9+7;
static const double PI = 3.14159265358979323846;

// accelerate stdin, stdout
#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
// repeat macro
#define FOR(i, a, b) for(ll (i)=(a);(i)<=(b);i++)
#define rFOR(i, a, b) for(ll (i)=(b);(i)>=(a);i--)
#define REP(i, n) for(ll i=0;i<n;i++)
// vector macro
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort(WHOLE(v))
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse(WHOLE(v))
#define FOLDL(src, dst, lambda) partial_sum(WHOLE(src), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum(WHOLE(src), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate(WHOLE(v), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

// io helper
template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}
template <typename T>istream& operator>>(istream &is, vec<T> &v) {for(auto &a:v) is >> a; return is;}
template <typename T>ostream& operator<<(ostream &os, vec<T> &v) {os << "[";REP(i, v.size() - 1) os << v[i] <<", "; os << v[v.size()-1]<<"]";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")";return os;}
template <typename T, typename U>ostream& operator<<(ostream &os, map<T, U> &mp) {os << "{ ";for(auto &p:mp) os << p.first << ": " << p.second << ", "; os << "}";return os;}

void solve() {
    while(1) {
        ll b;
        cin >> b;
        if(b == 0) break;
        ll den, num;
        ll ans2 = 1, ans1 = b;
        FOR(L, 2, 100100){
            den = b - L * (L + 1LL) / 2LL;
            if(den < 0) break;
            num = L;
            if(den % num == 0) {
                ans1 = den / num + 1;
                ans2 = L;
            }
        }
        out(ans1, ans2);
    }
}

signed main() {
    fast_io;
    cout << setprecision(20) << fixed;
    solve();
    return 0;
}


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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long x;
	cin >> x;
	long long ans = 2*(x/11);
	x %= 11;
	if(x) ans += 1 + (x > 6);
	cout << ans << endl;
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N  = parseInt(arg[0].split(" ")[0]);
    let H  = parseInt(arg[0].split(" ")[1]);
    let ab = arg.slice(1, N + 1).map(n=>n.split(" ").map(l=>parseInt(l)));
    
    ab.sort((a,b)=>b[0] - a[0]);
    
    const aMax = ab[0][0];
    
    ab = ab.sort((a,b)=>b[1] - a[1]).filter(n=>n[1] > aMax);

    let damage = 0;
    let throwAttack = 0;
    
    for(let i in ab) {
        H -= ab[i][1];
        throwAttack++;
        
        if(H <= 0) {
            console.log(throwAttack);
            return;
        }
    }
    
    const directAttack = Math.ceil(H / aMax);
    
    console.log(throwAttack + directAttack);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 54820
import math
from functools import reduce
from itertools import *
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
 
K = int(input())
ans = 0
for i in product([i for i in range(1,K+1)], repeat = 3):
  ans += gcd(i[0],i[1],i[2])
print(ans)

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    vector<int> s(N);
    int sum = 0;
    for(int i = 0; i < N; i++) {
        cin >> s[i];
        sum += s[i];
    }
    if(sum % 10 != 0) cout << sum << endl;
    else {
        int M = 0;
        for(int i = 0; i < N; i++) {
            int sumo = sum - s[i];
            if(sumo % 10 == 0) sumo = 0;
            M = max(M, sumo);
        }
        cout << M << endl;
    }
    return 0;
}

Measured memory_bytes: 3548
#include <iostream>

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

using namespace std;

struct Dice{
    int face[6]; // top,bottom,left,right,front,back
    void Rotate(int a,int b,int c,int d){
        int temp=face[a]; 
        face[a]=face[b]; 
        face[b]=face[c]; 
        face[c]=face[d]; 
        face[d]=temp;
    }
    void TurnF(int n){rep(i,n)Rotate(0,2,1,3);} // x???????????¢?????¨??????????????????90n????????¢
    void TurnR(int n){rep(i,n)Rotate(0,4,1,5);} // y???????????¢?????¨??????????????????90n????????¢
    void TurnU(int n){rep(i,n)Rotate(4,3,5,2);} // z???????????¢?????¨??????????????????90n????????¢
    void TurnF(){TurnF(1);}
    void TurnR(){TurnR(1);}
    void TurnU(){TurnU(1);}
    void show() {
        cout<<"top    : "<<face[0]<<endl;
        cout<<"bottom : "<<face[1]<<endl;
        cout<<"left   : "<<face[2]<<endl;
        cout<<"right  : "<<face[3]<<endl;
        cout<<"front  : "<<face[4]<<endl;
        cout<<"back   : "<<face[5]<<endl;
    }
};
int n;
void solve() {
    Dice dice;
    dice.face[0]=1; dice.face[1]=6;
    dice.face[2]=4; dice.face[3]=3;
    dice.face[4]=2; dice.face[5]=5;

    int ans=1;
    rep(i,n) {
        string s; cin>>s;
        if(s=="North") dice.TurnR(1);
        else if(s=="South") dice.TurnR(3);
        else if(s=="East") dice.TurnF(1);
        else if(s=="West") dice.TurnF(3);
        else if(s=="Right") dice.TurnU(1);
        else if(s=="Left") dice.TurnU(3);
        ans+=dice.face[0];
    }
    cout<<ans<<endl;
}

int main() {
    while(cin>>n) {
        if(!n) break;
        solve();
    }
    return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>

int main(void)
{
    int x ,y ,m;

    while(1){
        
        scanf("%d %d",&x , &y);
        
        if (x ==0 && y==0)
            break;

        else if (x > y)
            printf("%d %d\n", y, x);
        
        else if (x < y)
            printf("%d %d\n",x, y);

        else 
            printf("%d %d\n", x, y);

    }

    return 0;

}


Measured memory_bytes: 1972
# -*- coding: utf-8 -*-

y,m,d = map(int, input().split("/"))

if y <= 2018:
    print("heisei")
elif y > 2020:
    print("TBD")
else: #y==2019
    if m <= 4:
        print("Heisei")
    else:
        print("TBD")
        

Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main(void)
{
    unsigned int height, width;
    
    while(height | width) {
        cin >> height >> width;
        if(height | width) {
            for(int i = 0; i < height; ++i) {
                for(int j = 0; j < width; ++j) {
                    cout << '#' << flush;
                }
                cout << endl;
            }
            cout << endl;
        } else {
            continue;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main() 
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  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 <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int sumA = 0, sumB = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			sumA += a[i];
		} else {
			sumB += a[i];
		}
	}
	cout << sumA - sumB << '\n';	
	
	return 0;
}


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

using namespace std;

const int maxN = 1e3 + 3, MOD = 1e9 + 7;

vector<int> dp(maxN, 0);
vector<vector<char> > a(maxN, vector<char>(maxN, '.'));

int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }
    dp[1] = 1;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(a[i][j] == '.') {
                dp[j] = ((a[i][j - 1] == '.' ? dp[j - 1] : 0) + (a[i - 1][j] == '.' ? dp[j] : 0)) % MOD;
            }
        }
    }
    cout << dp[m];
    return 0;
}

Measured memory_bytes: 4660
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <queue>
#include <cmath>
#include <cstdio>

using namespace std;

#define MOD 1000000007

int main(){
    int n, m; cin >> n >> m;
    vector<int> dp(n+1, -1);
    for(int i=0; i<m; ++i){
        int a; cin >> a;
        dp[a]=0;
    }
    dp[0]=1;
    for(int i=1; i<=n; ++i){
        if(dp[i]==0) continue;
        dp[i]=0;
        if(i-1>=0){
            dp[i]+=dp[i-1];
            dp[i]%=MOD;
        }
        if(i-2>=0){
            dp[i]+=dp[i-2];
            dp[i]%=MOD;
        }
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 640
N = int(input())

def divisor(n):
    div = set()
    i = 1
    while i ** 2 <= n:
        if n % i == 0:
            div.add(i)
            div.add(n // i)
        i += 1
    return len(div)

ans = 0
for i in range(1, N + 1, 2):
    if divisor(i) == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3060
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  (h, w) = InputLine.to_ia
  
  if ((h == 1) or (w == 1)) then
    puts '1'
    return
  end

  s = h * w
  t = s / 2
  t += 1 if s % 2 == 1
  puts t.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 1788
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
    map<string, int> m;
    m["A"] = 0;
    m["B"] = 0;
    m["AB"] = 0;
    m["O"] = 0;
    int a; char c; string s;
    while (cin >> a >> c >> s){
        m[s]++;
    }
    cout << m["A"] << "\n" << m["B"] << "\n" << m["AB"] << "\n" << m["O"] << endl;
}

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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c, d, n, sum, A[500010], B[500000], rui[500000], dp[5000];
str S, T, U; bool check = true;	vector<ll> v;
map<ll, ll> m;


int main() {
	//Code Line
	cin >> a >> b >> c >> n;
	while (n > 0) {
		if (a < b)break;
		b *= 2;
		n--;
	}

	while (n > 0) {
		if (b < c)break;
		c *= 2;
		n--;
	}
	if (a < b && b < c && n >= 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3616
H,W = map(int,input().split())
a = [list(input()) for i in range(H)]

ans = []
for i in a:
    if "#" in i:
        ans.append(i)

ans_T = list(zip(*ans))
ans = []

for i in ans_T:
    if "#" in i:
        ans.append(i)

ans = list(zip(*ans))

for i in ans:
    print("".join(i))


Measured memory_bytes: 3316
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
int main() {
	vector<int> P[500];bool S[500];
	int n,m,a,b;
	while(scanf("%d %d",&n,&m),n) {
		for(int i=0;i<500;i++)P[i].clear(),S[i]=0;
		for(int i=0;i<m;i++) {
			scanf("%d %d",&a,&b);
			P[a-1].push_back(b-1);
			P[b-1].push_back(a-1);
		}
		for(int i=0;i<P[0].size();i++) {
			S[P[0][i]]=true;
			for(int j=0;j<P[P[0][i]].size();j++) {
				S[P[P[0][i]][j]]=true;
			}
		}
		int num=0;
		for(int i=1;i<n;i++) {
			if(S[i])num++;
		}
		printf("%d\n",num);
	}
}

Measured memory_bytes: 1196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll N,K; cin>>N>>K;
    vector<ll>a(N);
    ll num=N-K+1;
    rep(i,N){
        cin>>a[i];
    }
    ll mn=mod;
    for(int j=0;j<num;j++){
            if(a[j]*a[j+K-1]>=0){
                ll M=max(abs(a[j]),abs(a[j+K-1]));
                mn=min(M,mn);
            }
            else{
                ll m=min(abs(a[j]),abs(a[j+K-1]));
                mn=min(mn,abs(a[j])+abs(a[j+K-1])+m);
            }
        }

    cout<<mn<<endl;
}




Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        var n = Console.ReadLine().Split().Select(x => double.Parse(x)).ToList();
        var length = n[0] - n[2];
        Console.WriteLine(Math.Floor(length / (n[1] + n[2])));
    }
}



Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;

int main() {
  int n;cin >> n;
  string s,t; cin >> s >> t ;
  if (s==t){
    cout << s.size() << endl;
  } else {
    string out;
    bool  found = false;
    for(int i=0;i<n;++i){
      auto subs = s.substr(n-1-i,i+1);
      auto subt = t.substr(0,i+1);
      if(subs==subt){
        out = s.substr(0,n-i-1) + t;
        found = true;
        break;
      }
    }
    if(!found) out = s+t;
    cout << out.size() << endl;
  }
  return 0;
}


Measured memory_bytes: 256
s=input()
r=s[0:(len(s)-1)//2]
q=s[(len(s)+1)//2:len(s)]
count = 0
zyoukyou = "Yes"
for i in range(len(s)):
	if s[i]!=s[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
count = 0
for i in range(len(r)):
	if r[i]!=r[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
count = 0
for i in range(len(q)):
	if q[i]!=q[-1-i]:
		count += 1
if count != 0:
	zyoukyou = "No"
print(zyoukyou)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int q,w,e;
  cin>>q>>w>>e;
  if(q==w && w==e) co("Yes");
  else co("No");
  
  return 0;
}

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

int main(){
	long double N, K;
	cin >> N >> K;
	long double ans = 0;
	for(int i=1; i<=N; i++){
		long double t = 1;
		int j = i;
		while(j < K){
			j = j * 2;
			t = t/2;
		}
		ans += t/N;
	}
	cout << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	int n = kbd.nextInt();
	int d = 100000;

	while(n>0) {
	    d = (int)(d*1.05);
	    if(d%1000 != 0){
		d = d/1000;
		d++;
		d = d*1000;
	    }
	    n--;
	}

	System.out.println(d);
    }   
}

Measured memory_bytes: 17356
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,ans,cnt,a[100010],s[100010],x[100010],y[100010];
map<int,int> mp;

inline void msort(int l,int r)
{
    if(l==r) return;
    int m=(l+r)>>1;
    msort(l,m);
    msort(m+1,r);
    
    int i=l,j=m+1;
    vector<int> v;
    while(i<=m&&j<=r)
    {
        if(a[i]<=a[j]) v.push_back(a[i++]),ans+=(j-m-1);
        else v.push_back(a[j++]);
    }
    
    while(i<=m) v.push_back(a[i++]),ans+=(j-m-1);
    while(j<=r) v.push_back(a[j++]);
    for(i=0;i<v.size();i++) a[l+i]=v[i];
}

bool check(int val){
	for(int i=1;i<=n;i++){
		if(s[i]<=val) y[i]=-1;
		else y[i]=1;
	}
	for(int i=1;i<=n;i++) a[i]=a[i-1]+y[i];
	ans=0;
	msort(1,n);
	int uu=0;
	for(int i=1;i<=n;i++){
		if(y[i]==-1) uu++;
		if(uu*2>i) ans++;
	}
	if(ans*2>n*(n+1)/2) return true;
	return false;
}

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++){cin>>s[i];if(mp[s[i]]==0) x[++cnt]=s[i];mp[s[i]]=1;}
	sort(x+1,x+cnt+1);
	int l=1,r=cnt;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(x[mid])){
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<x[l]<<endl;
	return 0;
}

Measured memory_bytes: 11500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    int n;
    cin >> n;
    vl a(n);
    rep(i,0,n) {
        cin >> a[i];
    }
    sort(all(a));
    vl psum(n);
    rep(i,0,n) {
        if(i==0) {
            psum[i] = a[i];
            continue;
        }
        psum[i] = psum[i-1] + a[i];
    }
    int j = n-1;
    per(i,0,n-1) {
        if(psum[i]*2 >= a[i+1]) {
            j--;
        } else {
            break;
        }
    }
    cout << n - j << endl;
    return 0;
}


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

#define int long long
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; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
    int k,n; cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int max=0;
    rep(i,n-1){
        chmax(max,-1*a[i]+a[i+1]);
    }
    chmax(max,k-a[n-1]+a[0]);
    cout<<k-max<<endl;
}

Measured memory_bytes: 1792