akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iostream>
#include <string>
#include <vector>

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

int main(){
    std::string a;
    int flag = 0;

    // 入力
    std::cin >> a;

    for(int i=0; i<a.size()-1;i+=2){
        if(a.size()%2 == 1) break;
        if(flag == 2) flag = 0;
        if((flag == 0)&&(a[i] == 'h')){
            flag = 1;
        }else if((flag == 0)&&(a[i] != 'h')){
            flag = 0;
            break;
        }
        if((flag == 1)&&(a[i+1] == 'i')){
            flag = 2;
        }else if((flag == 1)&&(a[i+i] != 'i')){
            flag = 0;
            break;
        }
    }

    if(flag == 2) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;


    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
void read(int &a){
	a=0;
	char c=getchar();
	while(c<'0'||c>'9'){
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		a=(a<<1)+(a<<3)+(c^48);
		c=getchar();
	}
}
int abs(int a){
	return a<0?-a:a;
}
int min(int a,int b){
	return a<b?a:b;
}
const int Maxn=500000;
int n,q,D;
int d[Maxn+5];
int f[Maxn+5];
bool g[Maxn+5];
int main(){
	read(n),read(D);
	for(int i=1;i<=n;i++){
		read(d[i]);
	}
	f[n+1]=1;
	for(int i=n;i>0;i--){
		if((f[i+1]<<1)<=d[i]){
			f[i]=f[i+1];
		}
		else{
			f[i]=f[i+1]+d[i];
		}
	}
	int pos=D;
	for(int i=1;i<=n;i++){
		if(pos>=f[i+1]){
			g[i]=1;
		}
		pos=min(pos,abs(pos-d[i]));
	}
	read(q);
	for(int i=1;i<=q;i++){
		int u;
		read(u);
		if(g[u]){
			puts("YES");
		}
		else{
			puts("NO");
		}
	}
	return 0;
}


Measured memory_bytes: 6428
import Data.List ( sort )
import qualified Data.Vector.Unboxed as U

import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

getParm
  :: IO [Int]
getParm = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,x] <- getParm
  as    <- getParm
  print $ f n x as

f :: Int -> Int -> [Int] -> Int
f n x as
  | t < x     = n-1
  | k <= n    = k   
  | otherwise = 0
  where
    ai = U.head as'
    t = U.last sums

    lengthUpto x = U.length . U.takeWhile (<= x) 
    k = lengthUpto x sums
    sums = U.scanl1 (+) as'
    as' = U.fromList $ sort as

Measured memory_bytes: 508
#include <stdio.h>

#define max_order 500001
#define max_str 100

typedef struct _NODE{
  int key;
  struct _NODE *right;
  struct _NODE *left;
} NODE;

NODE node_pool[max_order];
int node_count;
NODE *root;

void insert(NODE **root,int k);
void print(NODE *root);
void print_inorder(NODE *node);
void print_preorder(NODE *node);

int main(){
  int i;
  int n,k;
  char buf[max_str];

  node_count = 0;
  root = NULL;

  scanf("%d%*c",&n);
  for(i=0;i<n;i++){
    fgets(buf,max_str,stdin);
    if(buf[0]=='i'){
      
      sscanf(buf,"%*s %d",&k);
      insert(&root,k);
    }else{
      
      print(root);
    }
  }

  return 0;
}


void insert(NODE **root,int k){
  NODE *y = NULL; 
  NODE *x = *root;
  NODE *z = &node_pool[node_count];
  node_count++;
  z->key = k;
  z->right = NULL;
  z->left = NULL;

  while( x != NULL ){
    y = x; 
    if( z->key < x->key ){
      x = x->left; 
    }else{
      x = x->right; 
    }
  }
  if( y == NULL){ 
    *root = z;
  }else if( z->key < y->key){
    y->left = z; 
  }else{
    y->right = z; 
  }
}

void print(NODE *root){
  print_inorder(root);
  printf("\n");
  print_preorder(root);
  printf("\n");
}

void print_inorder(NODE *node){
  if(node==NULL) return;
  print_inorder(node->left);
  printf(" %d",node->key);
  print_inorder(node->right);
}

void print_preorder(NODE *node){
  if(node==NULL) return;
  printf(" %d",node->key);
  print_preorder(node->left);
  print_preorder(node->right);
}



Measured memory_bytes: 13516
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; 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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
long long int dp[100040] = {};
int main() {
	int n;
	cin >> n;
	string s1;
	string s2;
	cin >> s1;
	cin >> s2;
	long long int ans = 1;
	int back = 0;
	for (int i = 0; i < s1.size(); i++) {
		if (s1[i] != s2[i]) {
			if (i == 0) {
				ans = ans * 6;
			}
			else if(back == 1) {
				ans = ans * 2;
			}
			else {
				ans = ans * 3;
			}
			back = 2;
			i = i + 1;
		}
		else {
			if (i == 0) {
				ans = ans * 3;
			}
			else if (back == 1) {
				ans = ans * 2;
			}
			back = 1;
		}
		ans = ans % MOD;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#define FILE_NAME "a"

const int MAXN = 100 + 10;
const int MAXK = 10;

int n;
int s[MAXN];

bool read() {
	if  (scanf("%d", &n) < 1) {
		return 0;
	}
	forn(i, n) {
		scanf("%d", &s[i]);
	}
	return 1;
}

int dp[MAXN][MAXK];

void remax(int& x, int y) {
	if  (x < y) {
		x = y;
	}
}

int solve() {
	memset (dp, -1, sizeof dp);
	dp[0][0] = 0;
	forn(i, n) {
		forn(have, MAXK) {
			int cur_dp = dp[i][have];
			if  (cur_dp == -1) {
				continue;
			}
			remax(dp[i + 1][have], cur_dp);
			remax(dp[i + 1][(have + s[i]) % MAXK], cur_dp + s[i]);
		}
	}

	int ans = 0;
	for (int r = 1; r < MAXK; ++r) {
		remax(ans, dp[n][r]);
	}
	return ans;
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		printf("%d\n", solve());
	}

#ifdef LOCAL
	cerr.precision(5);
	cerr << "Time: " << fixed << (double) clock() / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,c,x;
	char b;
	scanf("%d %c %d",&a,&b,&c);
	if(b=='-'){
		x=a-c;
	}
	else{
		x=a+c;
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n;
    cin>>n;

    if(n&1){
        int num = n/2 + 1;
        cout<<setprecision(10)<<fixed<<(double)num/n;
    }
    else{
        cout<<"0.50000000";
    }
} 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int sum = 0, sumB = 0;
    for (int i=0; i<n; i++) {
        if (s[i] == 'a') {
            if (sum < a+b) {
                sum++;
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else if (s[i] == 'b') {
            if (sum < a+b) {
                if (sumB < b) {
                    sum++;
                    sumB++;
                    cout << "Yes" << endl;
                } else {
                    cout << "No" << endl;
                }
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 3656
program main
  implicit none
  integer i,N,fin,pin,ans,j,con
  integer,allocatable :: A(:,:),B(:),tired(:)
  read(*, *) N
  allocate(A(N,N))
  allocate(B(N))
  allocate(tired(N))
  do j= 1,N
    read(*, *) (A(j,i), i = 1,N-1)
    A(j,N) = 0
  end do
  B = 1
  tired = 0
  pin = 0
  fin = 1
  ans = 1
  do
    do i = 1,N
      con = A(i,B(i))
      if (con > 0) then
        if (A(con,B(con)) == i .and. tired(con) == 0 .and. tired(i) == 0) then
          B(i) = B(i) + 1
          B(con) = B(con) + 1
          tired(con) = 1
          tired(i) = 1
          pin = 1
        end if
      end if
    end do
    if (pin == 0) then
      ans = -1
      exit
    elseif (sum(B) == N**2) then
      exit
    else
      ans = ans + 1
      tired = 0
      pin = 0
    end if
  end do
    
  write(*, *) ans
end program main


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while(0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll N,ans=1;
vector<ll> a,v;
vector<ll> p = {1,0,0};

signed main() {
  cin >> N;
  a.resize(N);
  v.resize(N);
  rep(i,N)
    cin>>a[i];

  if (a[0] != 0) {
    cout << 0 << endl;
    return 0;
  }
  v[0]=3;
  for(ll i=1;i<N;i++){
    ll t = 0, k = -1;
    rep(j,3){
      if (p[j] == a[i]) {
        t++;
        k = j;
      }
    }
    if (k == -1) {
      cout << 0 << endl;
      return 0;
    }
    v[i] = t;
    p[k]++;
  }
  rep(i,N){
    // cout<<v[i]<<" ";
    (ans *= v[i]) %= 1000000007;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    kind = set()
    for _ in range(N):
        s = input()
        kind.add(s)
    print(len(kind))


if __name__ == '__main__':
    solve()


Measured memory_bytes: 30984
use std::io;

fn main() {
    let n = input_ways_count();
    let ways = input_ways(n);

    let mut current_time = 0;
    let mut current_place = (0, 0);
    for way in ways.iter() {
        let time_diff = way.0 - current_time;

        let x = (way.1 - current_place.0).abs();
        let y = (way.2 - current_place.1).abs();
        let distance = x + y;

        if time_diff < distance {
            println!("No");
            return;
        }

        if time_diff % 2 != distance % 2 {
            println!("No");
            return;
        }

        current_time = way.0;
        current_place = (way.1, way.2);
    }

    println!("Yes")
}


fn input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("panic read line");
    s
}

fn input_ways_count() -> i32 {
    let n = input();
    let n: i32 = n.trim().parse().expect("panic parse");
    n
}

fn input_ways(count: i32) -> Vec<(i32, i32, i32)> {
    let mut ways: Vec<(i32, i32, i32)> = Vec::new();
    for _ in 0..count {
        ways.push(input_way())
    }

    ways
}

fn input_way() -> (i32, i32, i32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("panic read line");
    let way: Vec<i32> = s.split_whitespace()
                    .map(|s| s.parse().expect("panic parse"))
                    .collect();

    (way[0], way[1], way[2])
}

Measured memory_bytes: 3088
n=int(input())
s=input()

w=0
b=0
for i in range(n):
    if s[i]=='.':
        w+=1
    else:
        b+=1

dp=w
min=w
for i in range(n):
    if s[i]=='.':
        dp-=1
    else:
        dp+=1
    if dp<min:
        min=dp
print(min)

Measured memory_bytes: 3500
#include<stdio.h>
int main(void){
    int a,b,c,k,i,sum;
    scanf("%d%d%d%d",&a,&b,&c,&k);
    int max=a>b?a:b;
    max=max>c?max:c;
    int ans=a+b+c-max;
    for(i=0;k>i;++i)
    max*=2;
    printf("%d",ans+max);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin>>n;
  char x=n[n.size()-1];
  if(x=='2'||x=='4'||x=='5'||x=='7'||x=='9') cout<<"hon"<<endl;
else if(x=='0'||x=='1'||x=='6'||x=='8') cout<<"pon"<<endl;
else if(x=='3') cout<<"bon"<<endl;
return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        string s; cin >> s;
        if(s[1] == 'B') s[1] = 'R';
        else s[1] = 'B';
        cout << s << '\n';
    }  
    return 0;
}

Measured memory_bytes: 3548
#include<cstdio>
#include<map>
using namespace std;
typedef pair<int, int> P;

map<P, int> m;
map<P, int> nm;
int n, t, f;

int d[6][4] = {{2, 4, 5, 3}, {1, 3, 6, 4}, {1, 5, 6, 2},
               {1, 2, 6, 5}, {1, 4, 6, 3}, {2, 3, 5, 4}}; // down 0 / left 1 / up 2 / right 3
int dx[4] = {0, -1, 0, 1};
int dy[4] = {-1, 0, 1, 0};

void put(int x, int y, int t, int f) {
  int start = 0;
  while (f != d[t - 1][start]) start++;
  bool flag = true;
  int ansnum = -1, anst, ansf, ansx, ansy;
  for (int j = 0; j < 4; j++) {
    int num = d[t - 1][(j + start) % 4];
    int nx = x + dx[j], ny = y + dy[j];
    if (num >= 4 && nm[P(nx, ny)] < nm[P(x, y)]) {
      flag = false;
      int newt = 7 - num, newf = 0;
      while (d[newt - 1][newf] != t) newf++;
      newf = d[newt - 1][(newf + 4 - j) % 4];
      if (num > ansnum) {
        ansnum = num;
        anst = newt;
        ansf = newf;
        ansx = nx;
        ansy = ny;
      }
    }
  }
  if (flag) {
    m[P(x, y)] = t;
    nm[P(x, y)]++;
  } else {
    put(ansx, ansy, anst, ansf);
  }
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &t, &f);
      put(0, 0, t, f);
    }
    int ans[6] = {0, 0, 0, 0, 0, 0};
    for (map<P, int>::iterator ite = m.begin(); ite != m.end(); ite++) ans[ite->second - 1]++;
    for (int i = 0; i < 6; i++) printf("%d%c", ans[i], i==5 ? '\n' : ' ');
    m.clear();
    nm.clear();
  }
}



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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

typedef pair<int,int> pi;
typedef pair<int,pi> edge;

struct UF{
    int n;
    //??£?????£????????????????????????,????????£???????????§??£?????????????????°
    vector<int> d;
    UF() {}
    UF(int N):n(N), d(N,-1){}
    int root(int v){
        if(d[v]<0) return v;
        return d[v]=root(d[v]);
    }
    bool unite(int X,int Y){
        X=root(X); Y=root(Y);
        if(X==Y) return false;
        if(size(X) < size(Y)) swap(X,Y);
        d[X]+=d[Y];
        d[Y]=X;
        return true;
    }
    int size(int v){ return -d[root(v)]; }
    bool same(int X,int Y){ return root(X)==root(Y); }
};

int main()
{
    int n,m;
    while(scanf(" %d %d", &n, &m),n)
    {
        vector<edge> e(m);
        rep(i,m)
        {
            int s,t,c;
            scanf(" %d %d %d", &s, &t, &c);
            --s;
            --t;
            e[i] = edge(c,pi(s,t));
        }

        sort(all(e));

        UF uf(n);
        vector<int> used;
        rep(i,m)
        {
            int a=e[i].se.fi, b=e[i].se.se;
            if(!uf.same(a,b))
            {
                uf.unite(a,b);
                used.pb(e[i].fi);
            }
        }

        printf("%d\n", used[n/2-1]);
    }
    return 0;
}

Measured memory_bytes: 3348
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int a[100000];
int main() {
	int n; scanf("%d", &n);
	map<int, int>mp;
	rep(i, n) {
		scanf("%d", &a[i]);
		mp[a[i]]++;
	}
	int cnt = 0, ans = 0;
	for (auto p : mp) {
		if (p.second % 2 == 0)cnt++;
		else ans++;
	}
	ans += cnt;
	if (cnt % 2 != 0)ans--;
	cout << ans << endl;
}

Measured memory_bytes: 5376
#include <iostream>

using namespace std;

#define MAX 2000000
#define AMAX 10000

int main(){

	int n;
	int A[MAX],cnt[AMAX+1];

	int *B;
	cin >> n;

	B=new int[n];

	for(int i=0;i<n;i++) cin >>A[i];

	for(int i=0;i<=AMAX;i++) cnt[i]=0;

	for(int k=0;k<n;k++) cnt[A[k]]++;

	for(int j=1;j<AMAX;j++) cnt[j]=cnt[j]+cnt[j-1];


	for(int k=n-1;k>=0;k--){
		B[cnt[A[k]]-1]=A[k];
		cnt[A[k]]--;
	}
	for(int i=0;i<n;i++){ 
		if(i) cout<<" ";
		cout << B[i];
	}
	cout<<endl;

	delete[] B;
	return 0;
}



Measured memory_bytes: 18404
#include <iostream>
#include <iomanip>
#include <vector>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    
    int n, x;
    cin >> n >> x;
    
    vector<long long> v(n+1);
    v[0] = x;
    for (int i = 1; i < n+1; i++)
    {
        cin >> v[i];
    }

    sort(v.begin(), v.end());
    long long c = abs(v[1]-v[0]);
    for (int i = 2; i < n+1; i++) {
        c = __gcd(c, v[i]-v[i-1]);
    }

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

Measured memory_bytes: 1024
#
# m_solutions2020 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """7 2 5
3"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7 4 2
3"""
        output = """No"""
        self.assertIO(input, output)


def resolve():
    A, B, C = map(int, input().split())
    K = int(input())

    for i in range(K):
        if A >= B:
            B *= 2
        elif B >= C:
            C *= 2
        if A < B < C:
            print("Yes")
            break
    else:
        print("No")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16232
N, M=map(int, input().split())
info=[]
for _ in range(N):
  a, b=map(int, input().split())
  info.append([a,b])

info.sort(key=lambda x:x[0])
ans=0
for a, b in info:
  if M>=b:
    ans+=a*b
    M-=b
  elif M<b and M>0:
    ans+=a*M
    break
  else:
    break
print(ans)

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

ll dp[101][101010];
ll w[101], v[101];

int main() {
    int N, W;
    cin >> N >> W;
    rep(i, N) {
        cin >> w[i] >> v[i];
    }

    for (int i = 1; i <= N; ++i) {
        for (int j = 0; j<=W; ++j) {
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if (j - w[i-1] >= 0) {
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]] + v[i-1]);
            }
        }
    }

    cout << dp[N][W] << endl;
}


Measured memory_bytes: 82072
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;

// int dp[100100][3] = {0};
/*----------------------------------------------------------------*/
signed main(){

	int n,k,r,s,p;
    string t;
	cin >> n >> k >> r >> s >> p >> t;

    int ans = 0;
    for(int i = 0;i < k;i++){
        int a = i;
        int b = i + k;
        int f = 0;
        while(1){
            if(a >= n)break;
            if(b >= n){
                if(t[a] == 'r')ans += p;
                if(t[a] == 's')ans += r;
                if(t[a] == 'p')ans += s;
                f = 1;
                break;
            }
            if(t[a] == t[b]){
                if(t[a] == 'r')ans += p;
                if(t[a] == 's')ans += r;
                if(t[a] == 'p')ans += s;
                a += 2*k;
                b += 2*k;
            }else{
                if(t[a] == 'r')ans += p;
                if(t[a] == 's')ans += r;
                if(t[a] == 'p')ans += s;
                a += k;
                b += k;
            }
        }
    }
    cout << ans << endl;

    // int n,m;
    // cin >> n >> m;
    // vll a(n);
    // rep(i,n)cin >> a[i];



	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2020-qual.contest.atcoder.jp/tasks/ddcc2020_qual_b
// rm -r -f test;oj dl https://abc149.contest.atcoder.jp/tasks/abc149_b

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include<vector>

using namespace std;
int main() {
	int n, k, d,x;
	cin >> n >> k;
	int sunuke[n];
	for (int i = 0; i < n; i++) {
		sunuke[i] = 0;
	}
	//int okashi[k];
	for (int i = 0; i < k; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> x;
			sunuke[x - 1] += 1;
		}
	}
	int ans=0;
	
	for (int i = 0; i < n; i++) {
		if (sunuke[i] == 0) {
			ans += 1;
		}
	}

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

Measured memory_bytes: 3640
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;



public class Main {
	final int N = 60;
	final int[][] ofs = {
			{1, 0}, {1, 1}, {0, 1}, {-1, 0}, {-1,-1}, {0, -1}
	};
	boolean[][] visited;
	int[][] d;
	
	int bfs(int sx, int sy, int t){
		int c = 1;
		visited[sy+N][sx+N] = true;
		
		Queue<int[]> q = new LinkedList<int[]>();
		int[] ne = {sx, sy};
		q.offer(ne);
		while(true){
			if(q.isEmpty()){ break; };
			ne = q.poll();
			if(d[ne[1]+N][ne[0]+N] >= t){ continue; };
			
			for(int i=0; i<ofs.length; ++i){
				final int[] e = {
						ne[0] + ofs[i][0], ne[1] + ofs[i][1]
				};
				if(-N<=e[0] && e[0]<=N && -N<=e[1] && e[1]<=N){
					if(!visited[e[1]+N][e[0]+N]){
						visited[e[1]+N][e[0]+N] = true;
						c++;
						q.offer(e);
						d[e[1]+N][e[0]+N] = d[ne[1]+N][ne[0]+N] + 1;
					}
				}
			}
		}
		
		return c;
	}
	
	
	
	void io(){
		Scanner sc = new Scanner(System.in);
		while(true){
			visited = new boolean[N*2+1][N*2+1];	//filled false
			d = new int[N*2+1][N*2+1];	//filled 0
			
			final int t = sc.nextInt();  final int n = sc.nextInt();
			if(t==0 && n==0){ return; }
			for(int i=0; i<n; ++i){
				final int x = sc.nextInt();  final int y = sc.nextInt();
				visited[y+N][x+N] = true;
			}
			final int sx = sc.nextInt();  final int sy = sc.nextInt();
			
			System.out.println(bfs(sx, sy, t));
		}
	}
	
	public static void main(String[] args) {
		new Main().io();
	}
}

Measured memory_bytes: 14000
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
     cout << fixed << setprecision(10);
	double r;
	cin>>r;
	cout << r * r * M_PI <<" "<< 2 * r * M_PI << endl;
}



Measured memory_bytes: 3220
package main

import (
	"fmt"
)

func main() {
  var s_1, s_2, s_3 int
  fmt.Scanf("%d %d %d", &s_1, &s_2, &s_3)
  var sum = s_1+s_2+s_3
  if sum == 17 {
    if s_1 != 5 && s_1 != 7 {
       fmt.Println("NO")
    } else if s_2 != 5 && s_2 != 7 {
       fmt.Println("NO")
    } else if s_3 != 5 && s_3 != 7 {
      fmt.Println("NO")
    }
    fmt.Println("YES")
  } else { //並び替えてもダメ
    fmt.Println("NO")
  }
}

Measured memory_bytes: 512
import sys
from math import factorial
input = sys.stdin.readline

n, m = map(int, input().split())

if n == 1 and m == 1:
    print(0)
    exit()

# 偶数＆偶数
if n > 2:
    ans1 = factorial(n) / factorial(2) / factorial(n - 2)
elif n == 2:
    ans1 = 1
elif n <= 1:
    ans1 = 0

# 奇数 & 奇数
if m > 2:
    ans2 = factorial(m) / factorial(2) / factorial(m - 2)
elif m == 2:
    ans2 = 1
elif m <= 1:
    ans2 = 0

print(int(ans1 + ans2))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define maxn 200010

using namespace std;

int q[maxn],l,a[maxn],n;

int main() {
	int i,x;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1;i<=n/2;i++) 
		swap(a[n-i+1],a[i]);
	for (i=1;i<=n;i++) {
		if (a[i]>=q[l]) q[++l]=a[i];
		else {
			x=upper_bound(q+1,q+l+1,a[i])-q;
			q[x]=a[i];
		}
	}
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    new Main().run();
  }
  public void run() {

    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {
      String[] lines = in.readLine().split(" ");
      // int n = Integer.parseInt(lines[0]);
      int k = Integer.parseInt(lines[1]);
      String s = in.readLine();

      char[] as =s.toCharArray();
      as[k-1] = Character.toLowerCase(as[k-1]);

      String ans = new String(as);
      System.out.println(ans);
    }
    catch(IOException e) {

      System.err.println(e);
    }
  }
}

Measured memory_bytes: 21204
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		int n,m;
		Scanner scan = new Scanner(System.in);
		n=scan.nextInt();
		m=scan.nextInt();
		int[][] a = new int[n][m];
		int[] b = new int[m];
		int[] p = new int[n];
		
		for(int i=0;i<n;i++)
			p[i]=0;
		
		for(int i=0;i<n;i++)
			for(int j=0;j<m;j++)
				a[i][j]=scan.nextInt();
		
		for(int i=0;i<m;i++){
			b[i]=scan.nextInt();
		}
		
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				p[i]+=a[i][j]*b[j];
			}
		}
		
		for(int i=0;i<n;i++)
			System.out.println(p[i]);
	}
}


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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int mod = 1e9+7;
const int inf = (1<<28);
const ll infl = (1LL<<60);

int main() {
  int A, B, M; cin >> A >> B >> M;
  vl a(A), b(B); ina(a,A); ina(b,B);
  int ans = *min_element(all(a)) + *min_element(all(b));
  rep(i,M) {
    int x, y, c; cin >> x >> y >> c;
    int sum = a[x-1] + b[y-1] - c;
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


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

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

  int n;
  cin >> n;
  unordered_map<string, int> s;
  for (int i = 0; i < n; ++i) {
    string p;
    cin >> p;
    s[p]++;
  }
  int m;
  cin >> m;
  unordered_map<string, int> t;
  for (int i = 0; i < m; ++i) {
    string p;
    cin >> p;
    t[p]++;
  }
  int ans = 0;
  for (auto& d : s) {
    ans = max(ans, d.second - t[d.first]);
  }
  cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  double X,A,B;
  A=100;
  cin >> X;
  for (int i=1; i<3780; i++) {
    B=floor(A*101/100);
    A=B;
    if (A>=X) {
      cout << i << endl;
      break;
    }
  }
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for (auto& e : l) cin >> e;
    sort(begin(l), end(l), greater<>());
    cout << accumulate(begin(l), begin(l) + k, 0) << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

// Using while loop to solve this time

int main(int argc, char const *argv[])
{
    long long base = 100;
    // Other people don't include this interest variable
    float interest = 0.01;
    long long years = 0;

    long long target; //103
    cin >> target;

    // How many years it take to get to or above target;

    while (true)
    {
        if (base >= target)
        {
            cout << years << "\n";
            return 0;
        }
        base += base * .01;
        ++years;
    }
    return 0;
}


Measured memory_bytes: 3164
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<ll> a(n);
	for (ll i = 0; i < n-1; i++)
	{
		ll x;
		cin >> x;

		a[x - 1] ++;
	}

	for (ll i : a)
	{
		println(i);
	}
}

Measured memory_bytes: 4840
import sys
import math
import bisect

def main():
    A = []
    for i in range(1, 33):
        for j in range(2, 11):
            val = i ** j
            if val <= 1200:
                A.append(val)
            else:
                break
    A.sort()
    x = int(input())
    p = bisect.bisect_right(A, x)
    print(A[p-1])


if __name__ == "__main__":
    main()


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

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}

int main(){
	std::string s, t;
	std::string ans;
	std::cin >> s >> t;
	bool flag = 0;
	if(s.size() < t.size()){
		std::cout << "UNRESTORABLE" << std::endl;
		return 0;
	}
	for(unsigned i = 0; i <= s.size() - t.size(); i++){
		std::string tmp = s;
		for(unsigned j = 0; j < t.size(); j++){
			if(tmp[i + j] == '?'){
				tmp[i + j] = t[j];
			}if(tmp[i + j] != t[j]){
				goto Hoge;
			}
		}
		for(unsigned j = 0; j < s.size(); j++){
			if(tmp[j] == '?') tmp[j] = 'a';
		}
		if(!flag){
			ans = tmp;
			flag = true;
		}else{
			if(ans > tmp) ans = tmp;
		}
Hoge:;
	}
	if(flag) std::cout << ans << std::endl;
	else std::cout << "UNRESTORABLE" << std::endl;
}


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



#define pi acos(-1)
typedef  long long ll;
typedef  unsigned long long ull;
typedef  unsigned un;

//defined taking input;
#define sf           scanf
#define si(a)        sf("%d",&a)
#define sc(a)        sf("%c",&a)
#define sii(a,b)     sf("%d %d",&a,&b)
#define siii(a,b,c)  sf("%d %d %d",&a,&b,&c)
#define sl(a)        sf("%lld",&a)
#define sll(a,b)     sf("%lld %lld",&a,&b);
#define slll(a,b,c)  sf("%lld %lld %lld",&a,&b,&c);

#define pf           printf
#define pfi(a)       pf("%d\n",a)
#define pfl(a)       pf("%ld\n",a)
#define pfn          pf("\n")
#define pfyes        pf("YES\n")
#define pfno         pf("NO\n")
#define pfYes        pf("Yes\n")
#define pfNo         pf("No\n")

#define wh            while
#define wht(t)        while(t--)


int main()
{
    //freopen("input","r",stdin);
    string a;
    cin>>a;
    if(a=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;


    return 0;
}


Measured memory_bytes: 3584
object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toInt)
    val datA_ = readLine.split(" ")
    val datA = datA_.map(_.toLong)

    if (datA.exists(_ == 0)) {
      println(0)
      return
    }

    val border = math.pow(10, 18).toLong
    var mul = 1L
    for (i <- 0 until datA.length) {
      if (mul >= 0) {
        if(math.log10(mul) + math.log10(datA(i)) > 18) {
          mul = -1
        } else {
          mul = mul * datA(i)
        }
        mul = if (mul > border) -1 else mul
      }
    }
    println(mul)
  }
}


Measured memory_bytes: 73600
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/21/20 20:55:02
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  char c; cin>>c;
  if (c >= 'a' and c <= 'z') {
    cout << 'a' << endl;
  } else {
    cout << 'A' << endl;
  }

  return 0;
}


Measured memory_bytes: 3648
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
#include<string>
using namespace std;
int  q,x,n;
string s;
int main()
{
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='I')
			x++;
		else
			x--;
		q=max(q,x);
	}
	cout<<q<<"\n";

	return 0;
}



Measured memory_bytes: 3600
from math import ceil, floor, sqrt
s = int(input())
x1 = 1000000000
y1 = 1
y2 = (s + x1 - 1) // x1
x2 = x1 * y2 - s
# print(s, x1 * y2 - x2 * y1)
print(0, 0, x1, y1, x2, y2)

Measured memory_bytes: 3064
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n==1) printf("1");
    else if(n>=2 && n<4) printf("2");
    else if(n>=4 && n<8) printf("4");
    else if(n>=8 && n<16) printf("8");
    else if(n>=16 && n<32) printf("16");
    else if(n>=32 && n<64) printf("32");
    else if(n>=64 && n<128) printf("64");
    return 0;
}


Measured memory_bytes: 128
import sys
import math

input = sys.stdin.readline

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(4+max(math.ceil(n/a), math.ceil(n/b), math.ceil(n/c), math.ceil(n/d), math.ceil(n/e)))


Measured memory_bytes: 3060
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	vvll dp(n+1,vll(2,0)) ;
	dp.at(1).at(0) = dp.at(2).at(0) = 0 ;
	dp.at(1).at(1) = a.at(0) ;
	dp.at(2).at(1) = max(a.at(0),a.at(1)) ;
	for(int i=2;i<n;i++){
		if(i&1){
			dp.at(i+1).at(0) = max(dp.at(i).at(0),dp.at(i-1).at(0)+a.at(i)) ;
			dp.at(i+1).at(1) = max(dp.at(i).at(1),dp.at(i-1).at(1)+a.at(i)) ;
		}else{
			dp.at(i+1).at(0) = max(dp.at(i).at(1),dp.at(i-1).at(0)+a.at(i)) ;
			dp.at(i+1).at(1) = dp.at(i-1).at(1)+a.at(i) ;
		}
	}
	cout << dp.at(n).at((n+1)&1) << endl ;
}


Measured memory_bytes: 15600
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n, k, s; cin >> n >> k >> s;
	
	int d = 1;
	if (s == (1e9)) {
		d = -1;
	}

	if (k == 0) {
		for (int i = 0; i < n; i++) {
			cout << s + d << endl;
		}
	}
	else {
		for (int i = 0; i < k; i++) {
			cout << s << endl;
		}

		for (int i = 0; i < n-k; i++) {
			cout << s + d << endl;
		}
	}



	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mk make_pair
#define pb push_back
#define vi vector<int>
#define x first
#define y second
#define ms(a,b)  memset(a, b, sizeof(a))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define M 1000005
int dp[101][M],pre[M];
signed main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n],MOD = 1000000007;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<=k;i++)dp[0][i]=0;
    for(int i=0;i<=n;i++)dp[i][0]=1;
    for(int i=0;i<=k;i++)pre[i]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=k;j++){
            dp[i][j]=pre[j]%MOD;
            if(a[i-1]<j)
                dp[i][j]=( (dp[i][j]%MOD - pre[j-a[i-1]-1]%MOD) + MOD)%MOD;
            // for(int l=0;l<=min(j,a[i-1]);l++)
            //     dp[i][j]+=dp[i-1][j-l];
        }
        for(int j=1;j<=k;j++)
            pre[j]=(pre[j-1]%MOD+dp[i][j]%MOD)%MOD;
    }
    cout<<dp[n][k]<<endl;
    return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> v(100010);
	for(int i = 0; i < n; ++i){
		int a, b;
		cin >> a >> b;
		v[a-1]++;
		v[b]--;
	}
	int ans = v[0];
	for(int i = 0; i <= n; ++i){
		v[i+1] += v[i];
		if(v[i+1] >= i+1) ans = i+1;
	}
	cout << ans << endl;
	return 0;
}


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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    int N, M, K;
    scanf("%d %d %d", &N, &M, &K);
    REP(int,i,0,M+1){
        REP(int,j,0,N+1){
            int BlackNum = (N - j) * i + ( M - i ) * j;
            if ( K == BlackNum ){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int x = 0;

    for (int i = 1; i < 10; i++) {
      for (int j = 1; j < 10; j++) {
        if(i * j == n) {
          x = 1;
        }
      }
    }

    if (x == 1) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }

}


Measured memory_bytes: 23636
import sys
from collections import defaultdict


def input():
    return sys.stdin.readline().strip()


class UnionFind:
    def __init__(self, n_nodes):
        self.n_nodes = n_nodes
        self.parent = [i for i in range(n_nodes)]
        self.rank = [1] * n_nodes
        self.size = [1] * n_nodes

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

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] > self.rank[y]:
            self.parent[y] = x
            self.size[x] += self.size[y]
        else:
            self.parent[x] = y
            self.size[y] += self.size[x]
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1

    def check(self, x, y):
        return self.find(x) == self.find(y)

    def get_parent_list(self):
        return [i for i in range(self.n_nodes) if self.find(i) == i]

    def get_n_groups(self):
        return len(self.get_parent_list())

    def get_members(self, x):
        parent = self.find(x)
        return [i for i in range(self.n_nodes) if self.find(i) == parent]

    def get_members_dict(self):
        return {par: self.get_members(par) for par in self.get_parent_list()}


def main():
    N, M = map(int, input().split())
    UF = UnionFind(N)
    for _ in range(M):
        X, Y, Z = map(int, input().split())
        UF.unite(X - 1, Y - 1)
    print(UF.get_n_groups())


if __name__ == "__main__":
    main()


Measured memory_bytes: 12924
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {
    vector<pair<int,int>>odd(100005);
    vector<pair<int,int>>even(100005);
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        int x; cin >> x;
        if(i%2 == 0){
            even[x].first++;
            even[x].second=x;
        }else {
            odd[x].first++;
            odd[x].second = x;
        }
    }
    sort(odd.begin(),odd.end());
    reverse(odd.begin(),odd.end());
    sort(even.begin(),even.end());
    reverse(even.begin(),even.end());

    if(odd[0].second == even[0].second){
        if(odd[1].first + even[0].first > even[1].first+odd[0].first) cout << N-odd[1].first-even[0].first;
        else cout << N-even[1].first-odd[0].first;
    } else cout << N-odd[0].first-even[0].first;


    return 0;
}


Measured memory_bytes: 4652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int k;
    cin >> k;
    ll ans = 0;
    for (ll a = 1; a <= k; a++) {
        for (ll b = 1; b <= k; b++) {
            for (ll c = 1; c <= k; c++) {
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    cout << ans << endl;
}


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

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int hour = 0;

    hour = h2 * 60 + m2 - (h1 * 60 + m1);

    cout << hour - k;
}

Measured memory_bytes: 3676
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int a,b,c;
    string s;
    //cin >> s;
    cin >> a >> b;
    cout << 6-a-b << endl;

}


Measured memory_bytes: 888