akhauriyash/Code-Regression huggingface dataset:
import sys
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

N,K = na()
A = na()

bit = [0]*41
for a in A:
    for j in range(41):
        if a & (1<<j):
            bit[j]+=1
ans = 0
iam = 0
for i in range(40,-1,-1):
    #print(iam)
    if iam + (1<<i) > K:
        #print("lll")
        ans += (1<<i)*bit[i]
        continue
    if N//2 >= bit[i]:
        ans += (1<<i)*(N-bit[i])
        iam += 1<<i
    else:
        ans += (1<<i)*bit[i]
print(ans)
#print(bit)

Measured memory_bytes: 14620
S=input()
S1=int(S[0:2])
S2=int(S[2:4])
if (S1==0 or S1>12) and (S2==0 or S2>12):print("NA");exit()
if (S1==0 or S1>12):print("YYMM");exit()
if (S2==0 or S2>12):print("MMYY");exit()
print("AMBIGUOUS")

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

li=[]
for i in range(1, m+1):
    s=list(map(int, input().split()))
    s.pop(0)
    li.append(s)

if m==1:
    p = [int(input())]
else:
    p = list(map(int, input().split()))
#print(li)
#print(p)

def check(g,en):
    stack = ["1", "0"]
    candi = []
    while stack:
        cur = stack.pop()
        if len(cur) == en:
            candi.append(cur)
            continue
        for i in g[len(cur)+1]:
            tmp = cur+i
            stack.append(tmp)
    return candi

g={}
for i in range(0,n+1):
    g[i]=["1", "0"]

ans = 0
#print(check(g,n))
for i in check(g,n):
    flag=0
    for j in range(m):
        tmp=0
        for k in range(0,len(li[j])):
            tmp += int(i[li[j][k]-1])
        if tmp % 2 != p[j]:
            flag=1
            break
    if flag==0:
        #print(i)
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define M        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];

    for(ll i=0; i<n; i++) cin>>a[i];
    
    ll c=a[0];
    ll count=1;
    ll change=0;
    
    for(ll i=1; i<n; i++){
        if(a[i]==c) count++;
        else{
            change += count/2;
            count=1;
        }
        c=a[i];
    }
    change += count/2;
    
    cout<<change;
    
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, k: usize,
        v:[i64;n]
    }
    let mut ret = 0i64;
    for l in 0..n+1 {
        for r in (0..).take_while(|&r| r + l <= k) {
            if l + r > n {break;}
            let mut sum = 0;
            let mut vdeq = v.clone().into_iter().collect::<std::collections::VecDeque<_>>();
            let mut z = vec![];
            for _ in 0..l {
                if let Some(src) = vdeq.pop_front() {
                    sum += src;
                    if src < 0 {
                        z.push(src);
                    }
                }
            }
            for _ in 0..r {
                if let Some(src) = vdeq.pop_back() {
                    sum += src;
                    if src < 0 {
                        z.push(src);
                    }
                }
            }
            z.sort();
            for i in 0..std::cmp::min(k - l - r, z.len()) {
                sum -= z[i];
            }
            chmax!(ret, sum);
        }
    }
    println!("{}", ret);
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    cout << c << endl;
  } else if (a == c) {
    cout << b << endl;
  } else {
    cout << a << endl;
  }
}


Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = sr()[-1]

if N == '3':
    answer = 'bon'
elif N in '0168':
    answer = 'pon'
else:
    answer = 'hon'

print(answer)


Measured memory_bytes: 9052
#include<stdio.h>

int main(void){
    int i, j;

    int d;//何日開催するのか
    scanf("%d", &d);

    int c[26];//各コンテストのペナルティ値
    for(i=0;i<26;i++) scanf("%d", &c[i]);

    int s[d][26];//コンテストiをD日目に開催したときの得点
    for(i=0;i<d;i++) for(j=0;j<26;j++) scanf("%d", &s[i][j]);

    int last[26] = {};//各コンテストを最後に開催したのは何日目か

    //初期解
    int max_i, max_sum, tmp;
    for(i=0;i<d;i++){//今日=i、今日の終わり=i+1
        max_i = 0;
        max_sum = 0;
        for(j=0;j<26;j++){
            tmp = s[i][j] + c[j] * ( i+1 - last[j] );
            if( max_sum < tmp ){
                max_sum = tmp;
                max_i = j;
            }
        }
        last[max_i] = i+1;
        printf("%d\n", max_i + 1 );
    }
    
    return 0;
}

Measured memory_bytes: 1740
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n,t,a;
    cin >> n >> t >> a;
    vector<int> vec;
    for(int i=0; i<n; i++){
        int num;
        cin >> num;
        vec.push_back(num);
    }
    vector<double> vec2;
    for(int i=0; i<vec.size(); i++){ 
        vec2.push_back(t-(vec[i]*0.006));
    }
    double mn = abs(vec2[0]-a);
    int ind = 0; 
    for(int i=0; i<vec2.size(); i++){
        //cout << vec2[i] <<endl;
        if(abs(vec2[i]-a) < mn){
            mn = abs(vec2[i]-a);
            ind = i;
        }
    }
    cout << ind+1 <<endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef priority_queue<int> pqi;
typedef priority_queue<ll> pqll;
typedef priority_queue<vi> pqvi;
typedef priority_queue<vll> pqvll;
typedef priority_queue<int, vi, greater<int>> pqi_G;
typedef priority_queue<ll, vll, greater<ll>> pqll_G;
typedef priority_queue<vi, vvi, greater<vi>> pqvi_G;
typedef priority_queue<vll, vvll, greater<vll>> pqvll_G;

string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int n;
  cin >> n;
  vi a(n);
  int maxa = 0;
  for (int i = 0; i < n; i++) cin >> a.at(i);
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      maxa = max(maxa, max(a.at(i) - a.at(j), a.at(j) - a.at(i)));
    }
  }
  cout << maxa << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int A, B, C, D;
        cin >> A >> B >> C >> D;

        if ((abs(A - B) <= D && abs(B - C) <= D)||abs(A-C)<=D)
        {
                cout << "Yes" << endl;
        }
        else
        {
                cout << "No" << endl;
        }

        return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [[0,0,0]] + sorted([LI() for _ in range(n)])
    for i in range(n):
        t1,x1,y1 = a[i]
        t2,x2,y2 = a[i+1]
        sa = abs(x1-x2) + abs(y1-y2)
        ts = t2 - t1
        if ts < sa or (ts+sa) % 2 == 1:
            return 'No'

    return 'Yes'

print(main())




Measured memory_bytes: 24360
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static boolean solve() {
		int n = in.nextInt();
		if (n == 0) return false;

		boolean[][] f = new boolean[n][n];

		for (int i=0; i<n; i++) {
			int m = in.nextInt();
			for (int j=0; j<m; j++) {
				f[i][in.nextInt()-1] = true;
			}
		}

		int k = in.nextInt();
		int[] l = new int[k];
		for (int i=0; i<k; i++) {
			l[i] = in.nextInt() - 1;
		}
		Arrays.sort(l);

		int ans = -1;
		for (int i=0; i<n; i++) {
			boolean ff = true;
			for (int j=0; j<k; j++) {
				ff = ff && f[i][l[j]];
			}
			if (ff) {
				if (ans != -1) {
					out.println("-1");
					return true;
				}
				ans = i + 1;
			}
		}

		out.println(ans);

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 70288
#include <iostream>
#include <string>
#include <vector>
#include <cstdint>
using namespace std;

int main() {
	int n;
	int ans = 0;

	cin >> n;

	ans = n;
	if( (ans % 2) != 0 ) {
		ans *= 2;
	}

	cout << ans << "\n";
 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define WHITE 0
#define VISITED 1
#define CANDIDATE 2

int dks(vvi &a, vi &d, vi &s, vi &p) {
  int total = 0, n = (int)a.size();
  while (true) {
    int min_cost = INT_MAX, u;
    rep(i, n) {
      if (s[i] != VISITED && d[i] < min_cost) {
        min_cost = d[i];
        u = i;
      }
    }

    if (min_cost == INT_MAX) break;

    s[u] = VISITED;
    if (p[u] != -1) total += a[p[u]][u];

    rep(v, n) {
      if (s[v] != VISITED && a[u][v] != -1) {
        if (d[u] + a[u][v] < d[v]) {
          d[v] = d[u] + a[u][v];
          p[v] = u;
          s[v] = CANDIDATE;
        }
      }
    }
  }
  
  return total;
}

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

  vvi g(n, vi(n, -1));
  rep(i, n) {
    int u, k;
    cin >> u >> k;

    rep(j, k) {
      int v, c;
      cin >> v >> c;

      g[u][v] = c;
    }
  }
  
  vi d(n, INT_MAX), s(n, WHITE), p(n, -1);
  d[0] = 0;
  
  dks(g, d, s, p);
  
  rep(i, n) printf("%d %d\n", i, d[i]);
}



Measured memory_bytes: 3288
#include<iostream>
#include <algorithm>

using namespace std;

int main() {
	int ans;
	int N;
	cin >> N;
	int A[100];
	int i;
	for (i = 0;i < N;i++) {
		cin >> A[i];
	}
	sort(A, A + N);
	ans = (A[N-1] - A[0]);
	cout << ans << endl;

	return 0;
}

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

int main() {
    int n, sum = 0, minv = 1000000001;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i];
    }
    sort(x.begin(), x.end());
    for (int p = 0; p < 100; p++)
    {
        sum = 0;
        for (int i = 0; i < n; i++)
        {
            sum += pow(x[i] - p, 2);
        }
        minv = min(minv, sum);
    }
    
    cout << minv << endl;
    return 0;
}

Measured memory_bytes: 256
loop {
	e = m = gets.to_i
	break if e == 0
	loop.with_index { |_, z|
		break if z**3 > e
		y = Math.sqrt(e-z**3).to_i
		m = [m,e+y+z-y**2-z**3].min
	}
	puts m
}

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

struct CharNode{
    CharNode(char inputChar){
        c = inputChar;
    }
    char c;
    CharNode* next;
};

int main(int argc, char **argv)
{
	string target;
    getline(cin,target);
    
    CharNode* head;
    CharNode* cur;
    CharNode* pre;
    
    head = new CharNode(target[0]);
    cur = head;
    pre = head;
    
    for(int i =1;i<target.length();i++){
        cur = new CharNode(target[i]);
        pre->next = cur;
        pre = cur;
    }
    cur->next = head;
    cur = head;
    pre = cur;
    /*
    for(int i =0;i<target.length();i++){
        cout<<cur->c<<endl;
        cur=cur->next;
    }
     * */
     
    
    string s;
    getline(cin,s);
    bool hasMatched = false;
    // start comparison
    for(int i =0;i<target.length()&&!hasMatched;i++){
        int lengthMatched = 0;
            for(int j = 0;j<s.length();j++){
                //cout<<"Current: "<<cur->c<<endl;
                //cout<<"Compare char:"<<s[j]<<endl;
                int tempCur = cur->c;
                int tempCom = s[j];
                //cout<<"Value of TempCur"<<tempCur<<endl;
                //cout<<"Value of TempCom"<<tempCom<<endl;
                if(tempCur==tempCom){
                     lengthMatched++;
                     if(lengthMatched == s.length()){
                         hasMatched = true;
                         break;
                     }
                     cur = cur->next;
                 }else{
                     break;
                 }
                 
             }
             pre = pre->next;
             cur = pre;
     }
    
    if(hasMatched){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
	return 0;
}

Measured memory_bytes: 3220
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int p[110000];
long long rem[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<=a;i++){
		scanf("%d",p+i);
	}
	for(int i=a;i>=0;i--){
		rem[i]=rem[i+1]+p[i];
	}
	long long ret=0;
	long long cur=1;
	for(int i=0;i<=a;i++){
		ret+=cur;
		cur-=p[i];
		if(cur<0){
			printf("-1\n");return 0;
		}
		cur=min(cur*2,rem[i+1]);
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 2904
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string bar = "####################";
        int[] checklist = new int[120];
        for (int i = 0; i < n; i++)
        {
            string[] data = Console.ReadLine().Split(' ');
            int b = int.Parse(data[0]);
            int f = int.Parse(data[1]);
            int r = int.Parse(data[2]);
            int v = int.Parse(data[3]);
            int index = 0;
            index = (b - 1) * 30 + (f - 1) * 10 + r - 1;
            checklist[index] += v;
        }
        for (int i = 0; i < 12; i++)
        {
            string line = "";
            for (int j = i * 10; j < 10+i*10; j++)
            {
                line = line + " " + checklist[j];
            }
            Console.WriteLine(line);
            if(i != 11 && (i+1)%3 == 0){
                Console.WriteLine(bar);
            }
        }
    }
}

Measured memory_bytes: 19932
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long 
#define INF 1e9
#define LINF 1e18
 
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;
 
const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };
 
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int N, M;
int A[100001];

map<int, int> mp;

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

    cin >> N >> M;
    for(int i = 1; i <= N; ++i) cin >> A[i];
    ++mp[0];
    for(int i = 1; i <= N; ++i) {
        A[i] += A[i - 1];
        ++mp[A[i] % M];
    }
    int res = 0;
    for(auto it = mp.begin(); it != mp.end(); ++it) {
        res += it->second * (it->second - 1) / 2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 105

int L;
char buf[SIZE];

int main(){

	scanf("%d",&L);

	scanf("%s",buf);

	int ans = 0;
	int index,left,right;

	bool L_Black,R_Black;

	for(int i = 0; i < L; i++){
		if(buf[i] != '.')continue;

		L_Black = false;
		R_Black = false;

		buf[i] = 'W';

		//左方向を調べる
		for(index = i; index >= 0 && buf[index] == 'W'; index--);
		if(index >= 0 && buf[index] == 'B'){

			L_Black = true;
			left = index;
		}

		//右方向を調べる
		for(index = i; index <= L-1 && buf[index] == 'W'; index++);
		if(index <= L-1 && buf[index] == 'B'){

			R_Black = true;
			right = index;
		}

		if((L_Black && R_Black) || (!L_Black && !R_Black)){

			buf[i] = '.';
			continue;
		}

		if(L_Black){

			for(index = left; index >= 0 && buf[index] == 'B'; index--);
			if(index >= 0 && buf[index] == 'W'){

				ans = max(ans,left-index);
			}

		}else{ //R_Black == true

			for(index = right; index <= L-1 && buf[index] == 'B'; index++);
			if(index <= L-1 && buf[index] == 'W'){

				ans = max(ans,index-right);
			}
		}

		buf[i] = '.';
	}

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

	return 0;
}



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

int main()
{
	string s;
	while (getline(cin, s))
	{
		if (s == ".") return 0;
		vector<char> ary;
		for (int i = 0; i < s.size(); i++)
		{
			if (s[i] == '[') ary.push_back('[');
			if (s[i] == ']') ary.push_back(']');
			if (s[i] == '(') ary.push_back('(');
			if (s[i] == ')') ary.push_back(')');
		}
		int beforeSize = ary.size();
		while (true)
		{
			if (ary.size() == 0)
			{
				cout << "yes" << endl;
				break;
			}
			for (int i = 1; i < ary.size(); i++)
			{
				if ((ary[i - 1] == '[' && ary[i] == ']') ||
					ary[i - 1] == '(' && ary[i] == ')')
				{
					ary.erase(ary.begin() + i);
					ary.erase(ary.begin() + i - 1);
					i--;
				}
			}
			if (beforeSize == ary.size())
			{
				cout << "no" << endl;
				break;
			}
			beforeSize = ary.size();
		}
	}

	return 0;
} 

Measured memory_bytes: 3120
#include <utility>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B,C,X,Y;
  std::cin >> A >> B >> C >> X >> Y;
  int loopmax = std::max(X,Y);
  int t = 0;

  int cost = A*X + B*Y;

  while (loopmax >= t/2) {
    t += 2;
    cost = std::min(cost, A*std::max(0,(X-t/2)) + B*std::max(0,(Y-t/2)) + C*t);
  }
  std::cout << cost << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <tr1/unordered_map>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int a[22];
tr1 :: unordered_map <int, tr1 :: unordered_map <int, int> > mp[22][22];

LL Solve(int l, int r, int x, int y) {
  if (l + 1 == r) return 0;
  if (mp[l][r][x][y]) return mp[l][r][x][y];
  LL re = 0x7f7f7f7f7f7f7f7f;
  for (RI i = l + 1; i <= r - 1; ++i)
    re = min(re, Solve(l, i, x, x + y) + Solve(i, r, x + y, y) + a[i] * (x + y));
  mp[l][r][x][y] = re;
  return re;
}

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n; read(n);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  printf("%lld\n", Solve(1, n, 1, 1) + a[1] + a[n]);

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 14080
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factrial(int n){
//   if(n == 0) return 1;
//   return n*factrial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }


int p[1000];
int c[1000];


int main(){
  int D,G;
  cin >> D >> G;
  int ans = inf;
  rep(i,D) cin >> p[i] >> c[i];
  
  for(int bit = 0; bit <(1<<D); bit++){
    int pt = 0;
    int cnt = 0;
    rep(i,D){
      if(bit & 1<<i){
	pt+=p[i]*100*(i+1)+c[i];
	cnt+=p[i];
      }
    }
    //cout << "cnt" << cnt << ":pt" << pt << endl;
    if(pt >= G){
      ans = min(cnt,ans);
      // cout << ans << endl;
    } 
    else{
      for(int i = D-1; i>=0; i--){
	if(1<<i & bit) continue;
	for(int j = 0; j < p[i]; j++){
	  if(pt >= G) break;
	  else{
	    pt += (i+1)*100;
	    cnt++;
	    // cout << "cnt" << cnt << ":pt" << pt << endl;
	  }
	}
	
      }
      ans = min(ans,cnt);
    }
  }
  cout << ans << endl;
  
}
  





Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        ReadLine();
        var n = ReadLine().Split().Select(long.Parse).ToArray();
        Sort(n);
        if(n[0] == 0)
        {
            WriteLine("0");
            return;
        }
        long result = 1;
        for(int i = 0; i < n.Length; i++)
        {
            try
            {
                checked
                {
                    result *= n[i];
                    if(1000000000000000000L < result)
                    {
                        WriteLine("-1");
                        return;
                    }
                }
            }
            catch
            {
                WriteLine("-1");
                return;
            }
        }
        WriteLine($"{result}");
    }
}

Measured memory_bytes: 37168
import java.util.*;
import java.awt.Point;

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

		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0) break;

			HashMap<Integer,HashMap<Integer,Point>> map = new HashMap<Integer,HashMap<Integer,Point>>();

			for(int i=0;i<m;i++){
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1;
				Point cost = new Point(sc.nextInt(), sc.nextInt());

				if(!map.containsKey(a)) map.put(a,new HashMap<Integer,Point>());
				if(!map.containsKey(b)) map.put(b,new HashMap<Integer,Point>());
				map.get(a).put(b,cost);
				map.get(b).put(a,cost);
			}

			PriorityQueue<State> open = new PriorityQueue<State>();
			HashSet<State> closed = new HashSet<State>();
			open.add(new State(0,0,0,0));

			int rem = n;
			int[] minDists = new int[n];
			int[] minCosts = new int[n];
			Arrays.fill(minCosts,Integer.MAX_VALUE);

			while(!open.isEmpty()){
				State st = open.poll();
				int cost = Integer.MAX_VALUE;
				if(st.before != st.id) cost = map.get(st.before).get(st.id).y;
				if(minDists[st.id] == st.dist && minCosts[st.id] > cost) minCosts[st.id] = cost;
				if(closed.contains(st)) continue;
				closed.add(st);

				minDists[st.id] = st.dist;
				minCosts[st.id] = cost;

				if(!map.containsKey(st.id)) continue;
				for(int to : map.get(st.id).keySet()){
					Point p = map.get(st.id).get(to);
					open.add(new State(to,st.id,st.dist+p.x,st.cost+p.y));
				}
			}

			int ans = 0;
			for(int i=0;i<n;i++){
				if(minCosts[i] != Integer.MAX_VALUE){
					ans += minCosts[i];
				}
			}

			System.out.println(ans);
		}
	}
}
/*
class Edge implements Comparable<Edge>{
	int from,to,dist,cost;

	Edge(int from,int to,int dist,int cost){
		this.from = from;
		this.to = to;
		this.dist = dist;
		this.cost = cost;
	}
}
*/
class State implements Comparable<State>{
	int id,before,dist,cost;

	State(int id,int before,int dist,int cost){
		this.id = id;
		this.before = before;
		this.dist = dist;
		this.cost = cost;
	}

	public int compareTo(State st){
		if(dist != st.dist) return dist - st.dist;
		return cost - st.cost;
	}

	public boolean equals(Object o){
		State st = (State)o;
		return id == st.id;
	}

	public int hashCode(){
		return id;
	}
}

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

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

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

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

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

int main(){
    int n;
    long long l[100];
    cin>>n;
    l[0]=2;l[1]=1;
    for(int i=2;i<=n;i++){
        l[i]=l[i-1]+l[i-2];
    }
    cout << l[n] << endl;
}

Measured memory_bytes: 256
enum class Direction {
    UP,
    EVEN,
    DOWN
}

fun main(args: Array<String>) {
    val n = readInteger()
    val aList = readIntegerList()
    var ans = 1
    var direction = Direction.EVEN
    var isFirst = true
    for (i in 0 until (aList.size - 1)) {
        val tmp = aList[i + 1] - aList[i]

        if (isFirst) {
            if (tmp == 0) {
                direction = Direction.EVEN
            } else if (tmp > 0) {
                direction = Direction.UP
                isFirst = false
            } else {
                direction = Direction.DOWN
                isFirst = false
            }
        } else {
            if (tmp > 0) {
                if (direction == Direction.DOWN) {
                    ans++
                    isFirst = true
                }
            } else if (tmp < 0) {
                if (direction == Direction.UP) {
                    ans++
                    isFirst = true
                }
            }
        }
    }

    println(ans)
}


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: 53528
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LLINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	ll n, m; cin >> n >> m;
	VI a(n); REP(i, n)cin >> a[i];
	ll k = a[0] / 2;
	REP(i, n) {
		ll l = a[i] / (ll)2;
		if (i != 0)
			k = k * l / __gcd(k, l);
		else
			k = l;
		if (k > m) {
			cout << 0;
			return 0;
		}
	}
	REP(i, n) {
		if (k % a[i] == 0) {
			cout << 0;
			return 0;
		}
	}
	cout << (ll)((m + k) / (k * 2));
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>

using namespace std;

char a[300010];
int count[300010];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",a+1);
	for(int i=1;i<=n;i++){
		if(a[i]=='W')count[i]=count[i-1]+1;
		else count[i]=count[i-1];
	}
	int ans=0;
	int minn=1<<30;
	for(int i=1;i<=n;i++){
		ans=0;
		ans=count[i-1]+(n-i-count[n]+count[i]);
		minn=min(minn,ans);
	}
	printf("%d",minn);
	return 0;
}


Measured memory_bytes: 1664
def check(x, y)
  if x < y
    1
  elsif x == y
    0
  else
    -1
  end
end

n = gets.to_i
a = gets.split.map(&:to_i)
ans = 1
increment = 0
1.upto(n - 1) do |i|
  cmp = check(a[i - 1], a[i])
  if increment == 0
    increment = cmp
  elsif cmp * increment == -1
    increment = 0
    ans += 1
  end
end
puts ans


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

int main(void) {
    string s;
    int64_t Q;
    int64_t T;
    int64_t F;
    string C;
    string fix[2];
    int64_t rcnt = 0;
    cin >> s >> Q;
    for(int i=0;i<Q;i++) {
        cin >> T;
        if(T == 1) {
            rcnt++;
        } else {
            cin >> F >> C;
            fix[(F-1+rcnt)%2] =C + fix[(F-1+rcnt)%2];
        }
    }
    if(rcnt % 2){
        reverse(s.begin(), s.end());
        reverse(fix[0].begin(), fix[0].end());
        cout << fix[1] << s << fix[0] << "\n";
    } else {
        reverse(fix[1].begin(), fix[1].end());
        cout << fix[0] << s << fix[1] << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 1140
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	char	str[256];
	
	scanf("%s", str);
	n = strlen(str);
	
	
	for(i=0;i<n/2;i++) {
		if (str[i] != str[n-1-i]) ans++;
	}
	printf("%d\n",ans);


	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
bool pal(string s){
  int n=s.size();
  bool b=true;
  for(int i=0; i<n/2; i++){
    if(s[i]!=s[n-1-i]) {b=false; break;}
  }
  return b;
}
int main(){
  string s; cin >> s;
  int n=s.size();
  string s2=s.substr(1-1, (n-1)/2);
  string s3=s.substr((n+3)/2-1);
  if(pal(s) && pal(s2) && pal(s3)) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//







int main(void) {
    
    string s; cin >> s;
    int n = s.size();

    bool keyence = false;
    if (s == "keyence") keyence = true;
    for (int l = 0; l < n; ++l) {
        for (int r = l; r < n; ++r) {
            string tmp = "";
            for (int i = 0; i < n; ++i) {
                if (l <= i && i <= r) continue;
                tmp += s[i];
            }
            if (tmp == "keyence") {
                keyence = true;
            }
        }
    }

    string ans = keyence ? "YES" : "NO";
    out(ans);

    
    return 0;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
    ll a, b, n;
	cin >> a >> b >> n;
    ll ans = min((a * (b-1) / b), (a * n / b));
    cout << ans << endl;
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define N 9

int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}

bool is_set(int a, int b, int c) {
  if (a == b && b == c) return true;
  int array[] = {a, b, c};
  qsort(array, 3, sizeof(int), cmpfunc);
  if (array[2] - array[1] == 1 && array[1] - array[0] == 1) return true;
  return false;
}

void array_remove3(int old_array[], int new_array[], int old_length, int a, int b, int c) {
  int i, new_index = 0;
  bool a_set = false, b_set = false, c_set = false;
  int old_array_copy[old_length];

  for (i = 0; i < old_length; i++) {
    old_array_copy[i] = old_array[i];
  }

  for (i = 0; i < old_length; i++) {
    if (!a_set && old_array[i] == a) {
      a_set = true;
      continue;
    }
    if (!b_set && old_array[i] == b) {
      b_set = true;
      continue;
    }
    if (!c_set && old_array[i] == c) {
      c_set = true;
      continue;
    }
    new_array[new_index] = old_array[i];
    new_index++;
  } 
}

bool solve_backtrack(int array[], int array_length, bool reset) {
  int i, j, k, l;
  static bool solved = false;
  if (reset) solved = false;
  if (array_length == 0) {
    solved = true;
    return true;
  }
  
  for (i = 0; i < array_length; i++) {
    for (j = i+1; j < array_length; j++) {
      for (k = j+1; k < array_length; k++) {
	if (is_set(array[i], array[j], array[k])) {
	  //printf("set: i is %d, j is %d, k is %d\n", array[i], array[j], array[k]);
	  int new_length = array_length - 3;
	  if (new_length == 0) {
	    solved = true;
	    return true;
	  }
	  int new_array[new_length];
	  array_remove3(array, new_array, array_length, array[i], array[j], array[k]);  
	
	  solve_backtrack(new_array, new_length, false);
	  
	}
      }
    }
  }
  return solved;
}
	 
int main(int argc, char *argv[])
{
  int entries;
  int i, j;

  fscanf(stdin, "%d", &entries);

  for (i = 0; i < entries; i++) {
    int array[N], red[N], blue[N], green[N];
    int red_n = 0, blue_n = 0, green_n = 0;
    for (j = 0; j < N; j++) {
      fscanf(stdin, "%d", &array[j]);
    }
    char color;
    for (j = 0; j < N; j++) {
      fscanf(stdin, " %c", &color);
      if (color == 'R') {
	red[red_n] = array[j];
	red_n++;
      } else if (color == 'B') {
	blue[blue_n] = array[j];
	blue_n++;
      } else if (color == 'G') {
	green[green_n] = array[j];
	green_n++;
      }
    }
    
    if (red_n % 3 != 0 || blue_n % 3 != 0 || green_n % 3 != 0) {
      printf("0\n");
    } else if (solve_backtrack(red, red_n, true) && solve_backtrack(blue, blue_n, true) && solve_backtrack(green, green_n, true)) {
      printf("1\n");
    } else {
      printf("0\n");
    }
  }
  return 0;
}

Measured memory_bytes: 588
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string.h>
#include<cmath>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int m;
    m=n%10;
  if(m==2||m==5||m==4||m==7||m==9){
      printf("hon\n");

  }
  else if(m==0||m==6||m==1||m==8){
      printf("pon");
  }
  else if(m==3){
      printf("bon");
  }
}
     


 

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

int main() {
  int N, K;
  cin >> N >> K;
  int total = 1;
  for (int i = 0; i < N; i++) {
    if (total <= K) {
      total = total * 2;
    }
   else if (total > K) {
     total = total + K;
   }
  }
  cout << total << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int H, W;
char s[100][100];
int score[100][100];

int dfs(int h, int w)
{
    if (h == H - 1 && w == W - 1) {
        score[h][w] = 0;
        return 0;
    }
    else if (score[h][w] != -1) {
        return score[h][w];
    }
    else {
        int s1 = 100000, s2 = 100000;
        if (h < H - 1) {
            if (s[h][w] == '.' && s[h + 1][w] == '#') s1 = 1;
            else s1 = 0;
            s1 += dfs(h + 1, w);
        }
        if (w < W - 1) {
            if (s[h][w] == '.' && s[h][w + 1] == '#') s2 = 1;
            else s2 = 0;
            s2 += dfs(h, w + 1);
        }
        score[h][w] = min(s1, s2);
        return score[h][w];
    }
}

int main(int argc, char **argv)
{
    cin >> H >> W;
    REP(i, H) REP(j, W) cin >> s[i][j];

    REP(i, H) REP(j, W) score[i][j] = -1;

    int a = (s[0][0] == '.')? 0 : 1;
    cout << a + dfs(0, 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const long double PI=3.14159265358979;
int main(){
    double a,b,h,m; cin>>a>>b>>h>>m;
    cout<<fixed<<setprecision(11);
    long double ans=a*a+b*b-2.0*a*b*cos((60*h+m)*PI*11.0/360.0);
    ans=sqrt(ans);
    cout<<ans<<endl;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

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

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    REP(i, S.length()) {
        if (S[i] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

#define int long long

int n;
string num;
int k;
int res = 0;
int C[123][4];
int dp[123][4];

int dfs(int pos, int left) {
    if (left == 0) return 1;
    if (pos > n) return 0;
    int ss = 0;
    for (int i = 0; i < num[pos - 1] - '0'; i++) {
        if (i == 0) ss += dp[n - pos][left];
        else ss += dp[n - pos][left - 1];
    }
    if (num[pos - 1] > '0') return ss + dfs(pos + 1, left - 1);
    else return ss + dfs(pos + 1, left);
}

signed main() {
    C[0][0] = 1;
    for (int i = 1; i <= 122; i++) {
        C[i][0] = 1;
        C[i][1] = i;
    }
    for (int i = 2; i <= 122; i++) {
        for (int j = 2; j <= min(3ll, i); j++) {
            C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
        }
    }
    ios::sync_with_stdio(false);
    cin >> num >> k;
    n = num.length();
    for (int i = 1; i < n; i++) {
        if (i < k) continue;
        res += 9 * C[i - 1][k - 1];
    }
    for (int i = 0; i <= 122; i++) {
        dp[i][0] = 1;
    }
    for (int i = 1; i <= 122; i++) {
        dp[i][1] = 9ll * C[i][1];
        if (i >= 2) dp[i][2] = 9ll * 9ll * C[i][2];
        if (i >= 3) dp[i][3] = 9ll * 9ll * 9ll * C[i][3];
    }
    cout << dfs(1, k) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int n,a,b;cin>>n>>a>>b;
    if((a-b)%2==0)cout<<"Alice"<<endl;
    else cout<<"Borys"<<endl;
    return 0;
}

Measured memory_bytes: 256
d = int(input())
cl = list(map(int, input().split()))
sl = []
for _ in range(d):
    sl.append(list(map(int, input().split())))

tl = []
# for _ in range(d):
#     tl.append(int(input()))

last_di = [-1]*26
ans = 0
for day in range(d):
    best_t = 0
    best_t_val = -999999999999
    for t in range(26):
        curr_val = sl[day][t]*1
        for i in range(26):
            if i == t: continue
            curr_val -= (day-last_di[i])*cl[i]*4.5
        if curr_val >= best_t_val:
            best_t = t
            best_t_val = curr_val
    tl.append(best_t+1)
    last_di[best_t] = day
    ans += best_t_val
    # print(ans)
    # print('-- {}---'.format(day))
    # print(best_t)
    # print(last_di)

for t in tl:
    print(t)

# for day, t in enumerate(tl):
#     ans += sl[day][t-1]
#     last_di[t-1] = day
#     for ld, c in zip(last_di, cl):
#         # if ld == -1: continue
#         ans -= (day-ld)*c
#     print(ans)

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

int main(){
int n=0;
int x=0;

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

cout<<a[0];
for(int i=1;i<n;i++){
cout<<" "<<a[i];
}
return 0;

}


Measured memory_bytes: 3924
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <list>
#include <vector>

using namespace std;

inline int int_abs(int value) {
    return (value < 0) ? -value : value;
}

signed main() {
    int n, k, center;
    cin >> n >> k;
    bool isEven = (n % 2) == 0;
    center = n / 2;
    for (int i = 0; i < k; ++i) {
        int x, y, tx, ty;
        cin >> x >> y;
        if (center < x) {
            tx = n - x + 1;
        } else {
            tx = x;
        }

        if (center < y) {
            ty = n - y + 1;
        } else {
            ty = y;
        }

        int min = (tx < ty) ? tx : ty;
        int temp = min % 3;
        cout << ((temp == 0) ? 3 : temp) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160