akhauriyash/Code-Regression huggingface dataset:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

a,b = myinput()
ans =0 
if a>=b:
    ans += a
    a -= 1
else:
    ans += b
    b -= 1

if a>=b:
    ans += a
    a -= 1
else:
    ans += b
    b -= 1

print(ans)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007;
int main()
{
    long long n,i,ans = 1;;
    cin>>n;
    for(i = 1; i <= n; i++)
    {
        ans = (ans*i)%M;
    }
    cout<<ans<<endl;
    return 0;
}

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

int ans;
string s;
int main()
{
    cin >> s;
    if (s[0] == '1')
        ans++;
    if (s[1] == '1')
        ans++;
    if (s[2] == '1')
        ans++;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
#define NMAX 100010
using namespace std;
ll MOD = 1e9+7;

ll dfs(int K,const vector<vector<int>>&graph,int now,int from){//from はさっきいたとこ。dfsでもどっていかないようにしてる.いつもやってるusedでもおｋ！
	int can_use_color;
	if(from==-1){
		can_use_color = K-1; //頂点をのぞいた他色
	}else{
		can_use_color = K-2; //のこりの他色
	}
	if(K<graph[now].size()){ //nowから通ってるpathに対して色が足りない
		return 0;
	}else{
		ll case_num=1;
		for(auto e : graph[now]){ //C++でも範囲ループできるらしい！初耳
			if(e==from)continue;
			case_num*=can_use_color;
			can_use_color--; //一色消費したため
			case_num%=MOD;
		}
		for(auto e : graph[now]){
			if(e==from)continue;
			case_num *= dfs(K,graph,e,now);
			case_num %= MOD;
		}
		return case_num;
	}
}

int main(){
	int N,K;
	cin >> N >> K;
	vector<vector<int>> graph(N);
	rep(i,0,N-1){
		int tmp,tmp1;
		cin >> tmp >> tmp1;
		graph[tmp-1].push_back(tmp1-1);
		graph[tmp1-1].push_back(tmp-1);
	}
	ll answer = K * dfs(K,graph,0,-1);
	answer %= MOD;
	cout << answer << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  
  bool flag = true;
  int ans1 = 0;
  int ans2 = 0;
  
  if (N < 3){
    if (N == 2) ans1 = 1;
  }
  else {
    ans1 = N * (N-1) / 2;
  }
  
  if (M < 3){
    if (M == 2) ans2 = 1;
  }
  else {
    ans2 = M * (M-1) / 2;
  }
  
  cout << ans1 + ans2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    cout << counter << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

from fractions import gcd

L = A[0]
for i in range(1,N):
  L=(L*A[i])//gcd(L,A[i])

ans = 0

for i in range(N):
  ans += (L // A[i])

print(ans % mod)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

const int MAX_A = 300005;
int op(int a, int b) { return max(a,b);}
int e() { return 0;}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    segtree<int,op,e> dp(MAX_A);
    rep(i,n) {
        int x = a[i];
        int l = max(x-k,0), r = min(x+k+1,MAX_A);
        int now = dp.prod(l,r)+1;
        dp.set(x, now);
    }
    int ans = dp.prod(0,MAX_A);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9628
#include <iostream>

using namespace std;

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

	int kyu;
	if( X < 600)
		// cout << "8" << endl;
		kyu =8;
	else if(X < 800)
		kyu = 7;
	else if(X < 1000)
		kyu = 6;
	else if (X < 1200)
		kyu = 5;
	else if (X < 1400)
		kyu = 4;
	else if (X < 1600)
		kyu = 3;
	else if (X < 1800)
		kyu = 2;
	else
		kyu = 1;
	cout << kyu << endl;
	return 0;
}

Measured memory_bytes: 3632
n=int(input())
al=[0]+[list(map(int,input().split())) for _ in range(n)]
dp=[[0,0,0] for _ in range(n+1)]
for day in range(1,n+1):
  for i in range(3):
    for j in range(3):
      if i==j:continue
      dp[day][i]=max(dp[day-1][j]+al[day][i],dp[day][i])
print(max(dp[-1]))

Measured memory_bytes: 47188
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define int long long

signed main(){
    int n, a, b;
    cin >> n >> a >> b;
    int c = a - b;

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

    sort(v.begin(), v.end());

    vector<int> tmp(n);
    int ok = v[n - 1];
    int ng = 0;
    int mid;
    int count;

    while(ok - ng > 1){
        mid = (ok + ng) / 2;
        count = 0;

        for(int i = 0; i < n; i++){
            tmp[i] = v[i] - b * mid;
            if(tmp[i] > 0){
                count += (tmp[i] + c - 1) / c;
            }
        }
        if(count <= mid){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;
}

Measured memory_bytes: 1792
from heapq import heapify, heappush, heappop
n = input()
ps = [(int(raw_input()), i<n) for i in xrange(2*n)]
ps.sort()

MOD = 10**9+7
cnt = 0
ans = 1
for p, v in ps:
    if v == 0:
        if cnt > 0:
            ans *= cnt
            ans %= MOD
        cnt -= 1
    else:
        if cnt < 0:
            ans *= -cnt
            ans %= MOD
        cnt += 1
print ans


Measured memory_bytes: 24240
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {

        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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


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

fn main() {
    input! {
        x: u64,
        y: u64,
    }
    let mut cnt = 1;
    let mut last = x;
    while last * 2 <= y {
        cnt += 1;
        last *= 2;
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
N = int(input())
 
amalist = []
 
while True:
    N -= 1
    num = N % 26
    amalist.append(num)
    N = N // 26
    if N == 0:
        break
 
amalist.reverse()
 
alphalist = [chr(i) for i in range(97,97+26)]
 
result = []
for i in amalist:
    result.append(alphalist[i])
 
print(''.join(result))

Measured memory_bytes: 9188
import java.util.Scanner;

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

		month = sc.nextInt();
		while (month != 0) {
			day = sc.nextInt();

			count = 0;
			if ( 2 <= month) count += 31;
			if ( 3 <= month) count += 29;
			if ( 4 <= month) count += 31;
			if ( 5 <= month) count += 30;
			if ( 6 <= month) count += 31;
			if ( 7 <= month) count += 30;
			if ( 8 <= month) count += 31;
			if ( 9 <= month) count += 31;
			if (10 <= month) count += 30;
			if (11 <= month) count += 31;
			if (12 <= month) count += 30;
			count += day;
			
			if (count % 7 == 0) System.out.println("Wednesday");
			if (count % 7 == 1) System.out.println("Thursday");
			if (count % 7 == 2) System.out.println("Friday");
			if (count % 7 == 3) System.out.println("Saturday");
			if (count % 7 == 4) System.out.println("Sunday");
			if (count % 7 == 5) System.out.println("Monday");
			if (count % 7 == 6) System.out.println("Tuesday");
			
			month = sc.nextInt();
		}
	}
}

Measured memory_bytes: 12000
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

type work struct{ a, b int }
type works []work

func (w works) Len() int           { return len(w) }
func (w works) Swap(i, j int)      { w[i], w[j] = w[j], w[i] }
func (w works) Less(i, j int) bool { return w[i].b < w[j].b }

func main() {
	n := scanInt()
	w := works(make([]work, n))
	for i := range w {
		w[i].a, w[i].b = scanInt(), scanInt()
	}

	sort.Sort(w)
	sum := 0
	for _, v := range w {
		sum += v.a
		if sum > v.b {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 6272
n=int(input())
t=list(map(int, input().strip().split()))
m=int(input())
px = []
for i in range(m):
    array = list(map(int, input().strip().split()))
    px.append(array)
wa=0
for i in range(n):
    wa+=t[i]

for i in range(m):
    print(wa-t[px[i][0]-1]+px[i][1])

Measured memory_bytes: 9148
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;


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

	cin >> N;
	vector<long double>v(N);
	for (auto &i : v)cin >> i;
	vector<long double>r(N);
	r[0] = v[0];
	for (int i = 1; i < N; i++) {
		r[i] = v[i];
		for (int j = 0; j < i; j++) {
			r[i] = max(r[i], r[j] + sqrt((v[i] + v[j])*(v[i] + v[j]) - (v[i] - v[j])*(v[i] - v[j])));
		}
	}
	long double ans = 0;
	for (int i = 0; i < N; i++) {
		ans = max(ans, r[i] + v[i]);
	}
	cout <<setprecision(20)<< ans << endl;
}


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

int main()
{
    int N;
    cin >> N;
    for(int k=0;k<N;k++)
    {
        string word1,word2;
        cin >> word1;
        cin >> word2;
        int L[2000][2000];
        for(int i=0;i<word1.size();i++)
           for(int j=0;j<word2.size();j++)
           {
               if(i<0 || j<0 )
                 L[i][j]=0;
               else if(word1[i]==word2[j])
                 L[i][j]=1+L[i-1][j-1];
               else
                 L[i][j]=max(L[i-1][j],L[i][j-1]);
           }
        cout << L[word1.size()-1][word2.size()-1] << endl;
    }
}


Measured memory_bytes: 10840
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ri register int
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define db double
#define pdd pair<db,db>
using namespace std;
const int N=105;
int n;db x,y,mx;
vector<pdd> v;
#define fi first
#define se second
int main(){
	cin>>n;
	rep(i,1,n) cin>>x>>y,v.pb(mp(x,y));
	rep(i,0,359){
		db tarx=cos(i),tary=sin(i),tx=0,ty=0;
		rep(j,0,n-1)
			if((tarx*v[j].fi+tary*v[j].se)>0){
				tx+=v[j].fi;ty+=v[j].se;
			}
		db tans=sqrt(tx*tx+ty*ty);
		if(tans>mx) mx=tans;
	}
	printf("%.12lf",mx);
	return 0; 
}

Measured memory_bytes: 256
from collections import deque
N = int(input())

A = []
for _ in range(N):
    temp = list(map(int, input().split()))
    temp = [val - 1 for val in temp]
    A.append(deque(temp))


match_q = set([])
for i in range(N):
    a = A[i][0] #iの先頭
    b = A[a][0] #aの先頭
    if i == b:
        if i > a:
            i, a = a, i
        
        match_q.add((i, a))


def check(pair):
    i, j = pair
    if i > j:
        i, j = j, i
    if len(A[i]) == 0:
        return
    if len(A[j]) == 0:
        return
    
    A[i].popleft()
    A[j].popleft()

    for idx in [i, j]:
        if len(A[idx]) != 0:
            a = A[idx][0] # iの先頭
            b = A[a][0] # aの先頭
            if idx == b:
                if idx > a:
                    idx, a = a, idx
                match_q.add((idx, a))
    return


count = 0
while(len(match_q) != 0):
    count += 1
    old_q = match_q
    match_q = set([])
    for pair in old_q:
        check(pair)


if any(len(pair) != 0 for pair in A):
    print(-1)
else:
    print(count)


Measured memory_bytes: 36088
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int x;
  cin >> x;
  long long int k=x/11;
  if(x%11 > 0 && x%11<=6){
    cout << 2*k+1 << endl;
    return 0;
  }
  if(x%11 > 6){
    cout << 2*k+2 << endl;
    return 0;
  }
  if(x%11 == 0){
    cout << 2*k << endl;
    return 0;
  }
}

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

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll dp[1010];
ll F[1010], FI[1010];
ll n, a, b, c, d;

ll pow(ll a, ll b) { return b? pow(a * a % mod, b >> 1) * (b & 1? a : 1) % mod : 1; }

int main()
{
	ll i, j, k;
	
	scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
	
	F[0] = FI[0] = 1;
	
	for(i=1; i<=n; i++){
		F[i] = F[i - 1] * i % mod;
		FI[i] = pow(F[i], mod - 2);
	}
	
	dp[0] = 1;
	
	for(i=a; i<=b; i++){
		for(j=n; j>=0; j--){
			for(k=c; k<=d && j-k*i>=0; k++){
				dp[j] = (dp[j] + dp[j - k * i] * pow(FI[i], k) % mod * FI[k]) % mod;
			}
		}
	}
	
	printf("%lld\n", dp[n] * F[n] % mod);
	
	return 0;
}
///////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int N, M, Q, L[200005], R[200005], x[505][505], c[505][505];

int main(void){
    cin >> N >> M >> Q;
    for(int i=1; i<=M; i++){
        cin >> L[i] >> R[i]; x[L[i]][R[i]]++;
    }

    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            c[i][j] = c[i][j-1] + x[i][j];
        }
    }

    for(int i=1; i<=Q; i++){
        int p, q; cin >> p >> q;
        int sum = 0;
        for(int j=p; j<=q; j++) sum += c[j][q];
        cout << sum << endl;
    }
}

Measured memory_bytes: 4480
"use strict";

function main(input) {
  input = input.split(/\n/);
  const n = input[0];
  input = input[1].split(" ");

  let ans = "Three";
  for (let v in input) {
    if (input[v] == "Y") {
      ans = "Four";
      break;
    }
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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






#define pf                  printf
#define sf(a)               scanf("%d",&a)
#define sfl(a)              scanf("%lld",&a)
#define sff(a,b)            scanf("%d %d",&a,&b)
#define sffl(a,b)           scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)         scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)        scanf("%lld %lld %lld",&a,&b,&c)
#define sffff(a,b,c,d)      scanf("%d %d %d %d",&a,&b,&c,&d)
#define sffffl(a,b,c,d)     scanf("%lld %lld %lld %lld",&a,&b,&c,&d)
#define sfffff(a,b,c,d,e)   scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
#define sfffffl(a,b,c,d,e)  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e)
#define sfc(a)              scanf("%c",&a)
#define pii                 pair<int,int>
#define ms(a,b)             memset(a,b,sizeof(a))
#define pb(a)               push_back(a)
#define pbp(a,b)            push_back({a,b})
#define db                  double
#define ft                  float
#define ll                  long long
#define ull                 unsigned long long
#define pii                 pair<int,int>
#define ff                  first
#define ss                  second
#define sz(x)               x.size()
#define all(x)              x.begin(),x.end()
#define CIN                 ios_base::sync_with_stdio(0); cin.tie(0)
#define max3(a, b, c)       max(a, b) > max(b, c) ? max(a, b) : max(b, c)
#define min3(a, b, c)       min(a, b) < min(b, c) ? min(a, b) : min(b, c)
#define for0(i,n)           for(int i=0;i<n;i++)
#define for1(i,n)           for(int i=1;i<=n;i++)
#define forrev(i,n)         for(int i=n-1; i>=0; i--)
#define forab(i,a,b)        for(int i=a;i<=b;i++)
#define forba(i,b,a)        for(int i=b;i>=a;i--)
#define stlloop(x)          for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define case1(z)            cout<<"Case "<<z<<": "
#define case2(z)            printf("Case %d: ",z)
#define PI                  acos(-1) //3.14159265358979323846264338328
#define valid(tx,ty)        tx>=0 && tx<row && ty>=0 && ty<col
#define intlim              2147483648
#define N                   200005
#define inf                 100000008
#define mod                 1000000007

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll v[N];

int main()
{
    ll n,m,i,j,k;
    cin>>n>>m;
    if(n<m)
    {
        for(i=0;i<m;i++)
            cout<<n;
        cout<<endl;
    }
    else
    {
        for(i=0;i<n;i++)
            cout<<m;
        cout<<endl;
    }
    //main();
    return 0;
}
































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

int main(){
  int x;
  cin >> x;
  vector<bool> flag(x + 1);
  flag[1] = 1;
  for(int i = 2; i <= x; i++){
    int v = i * i;
    while(v <= x){
      flag[v] = true;
      v *= i;
    }
  }
  for(int i = x; i >= 1; i--){
    if(flag[i]){
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    double a;
    string s;
    int n;
    double sum=0;
    cin>>n;
    rep(i,n){
        cin>>a;
        cin>>s;
        if(s=="JPY") sum+=a;
        else sum+=a*380000.0;
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 256
import collections

n=int(input())
v=list(map(int,input().split()))
count=0
vo=[]
ve=[]
for i in range(n):
    if i%2==0:
        ve.append(v[i])
    else:
        vo.append(v[i])
e=collections.Counter(ve)
o=collections.Counter(vo)

emax=e.most_common()[0][0]
omax=o.most_common()[0][0]

if emax==omax:
    if e.most_common()[0][1]==len(ve) and o.most_common()[0][1]==len(vo):
        count=n//2
    else:
        omax2 = o.most_common()[1][0]
        emax2 = e.most_common()[1][0]
        tempe = 0
        tempo = 0
        for i in range(n // 2):
            if ve[i] != emax2:
                tempe += 1
        for i in range(n // 2):
            if vo[i] != omax:
                tempe += 1
        for i in range(n // 2):
            if ve[i] != emax:
                tempo += 1
        for i in range(n // 2):
            if vo[i] != omax2:
                tempo += 1
        count = min(tempe, tempo)
else:
    for i in range(n // 2):
        if ve[i] != emax:
            count += 1
    for i in range(n // 2):
        if vo[i] != omax:
            count += 1

print(count)
print()



Measured memory_bytes: 75012
#include <bits/stdc++.h>
using namespace std;
#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 pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b; cin >> a >> b;
    cout << (a+b+1)/2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,dis1=0,dis2=0,m,k;
    cin>>n>>k;
    int arra[n]={9};
    fill(arra,arra+n,999999999);
    arra[0]=0;
    vector<int> vec;
    for(int i=0;i<n;i++){
            cin>>m;
    vec.push_back(m);
    }
   // cout<<arra[4]<<endl;
    for(int j=0;j<(n-1);j++)
    {
        if(n-j<k)
        {
             k=n-j;
        }
        for(int f=j;f<j+k;f++){
            dis1=arra[j]+abs(vec[j]-vec[f+1]);
            //dis2=arra[j]+abs(vec[j]-vec[+2])
            if(arra[f+1]>dis1){
            arra[f+1]=dis1;
            //cout<<j+1<<" "<<arra[j+1]<<endl;
            }
//            if(arra[j+2]>dis2){
//            arra[j+2]=dis2;
  //cout<<arra[j+2]<<" "<<j+2<<endl;
  }
        }

    cout<<arra[n-1]<<endl;
}


Measured memory_bytes: 1276
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yosiiii
 */

#include <iostream>
#include <fstream>

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

class ADividingAString {
public:
	void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        string t="";
        int ans=0;
        int i=0;
        while(i<s.size()){
            string tt="";
            tt+=s[i];
            if(i==(int)s.size()-1&&tt==t){
                i++;
                continue;
            }
            while(tt==t&&i<s.size()){
                i++;
                tt+=s[i];
            }
            t=tt;
            ans++;
            i++;
        }
        out << ans << endl;
	}
};


int main() {
	ADividingAString solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using LL = long long;
const int MAXN = 110;
const int MAXK = 1e5+10;
const int MOD = 1e9+7;
int N, K;
int dp[MAXK];

void add_self(int& a, int b) {
    a+=b;
    if(a>=MOD){
       a-=MOD;
    }
}
void sub_self(int& a, int b) {
    a-=b;
    if(a<0){
       a+=MOD;
    }
}
int main() {
    int upto;
    cin >> N >> K;

    memset(dp, 0, sizeof(dp));
    dp[0] = 1;

    for(int child=1; child<=N; child++) {
        cin >> upto;
        vector<int> fake(K+1);
        for(int used=K; used>=0; used--) {
            int tmp = dp[used];
            int L = used+1;
            int R = used+min(upto, K-used);
            if(L<=R) {
                add_self(fake[L], tmp);
                if(R+1<=K) {
                    sub_self(fake[R+1], tmp);
                } 
            }
        }
        int prefix = 0;
        for(int i=1; i<=K; i++) {
            add_self(prefix, fake[i]);
            add_self(dp[i], prefix);
        }
    }
    
    cout << dp[K] << endl;
	return 0;
}

Measured memory_bytes: 4400
import fractions
a,b,c=map(int,input().split())

#とりあえずコーナーケース考える
if b==0:
    print("NO")
elif a==0 and c!=0:
    prnt("NO")
elif a==1 or c==0:
    print("YES")
elif a==c:#c<bだからa<bがいえる
    print("YES")
elif a==b and c!=0:
    print("NO")
elif a==b and c==0:
    print("YES")
    
else:
    #a,bの最大公約数を求める
    kouyaku=fractions.gcd(a,b)
    #cがとりうる値を列挙
    c_l=[]
    for i in range(int(b/kouyaku)):
        c_l.append(i*kouyaku)
    if c in c_l:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 5076
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
const int N=1e5+5;
ll cnt[N];
ll n,k,ans;
ll pow(ll num)
{
	ll res=1,m=n;
	while(m>0){
	    if(m&1)
	    res=res*num%mod;
	    num=num*num%mod;
	    m>>=1;
	}
	return res;
}
int main()
{
	cin>>n>>k;
	for(ll i=k;i>=1;i--)
	{
	    cnt[i]=pow(k/i);
	    for(ll j=2;j*i<=k;j++)
		{
	        cnt[i]-=cnt[j*i];
	    }
	    ans+=(mod+(cnt[i]*i)%mod)%mod;
	    ans=(ans+mod)%mod;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1);
    vector<int> B(N);
    for (int i = 0; i < N+1; i++){
        int a;
        cin >> a;
        A.at(i) = a;
    }
    for (int i = 0; i < N; i++){
        int b;
        cin >> b;
        B.at(i) = b;
    }
    int64_t ans = 0;
    
    int next = 0;
    for (int i = 0; i < N; i++){
        int before = min(next,A.at(i));
        ans += min(next + B.at(i), A.at(i));
        next = max(0, B.at(i) - (A.at(i) - before));       
    }
    ans += min(A.at(N), next);
    

   /*/int same = min(A.at(0), B.at(0));
   ans += same;
   for (int i = 0; i < N-1; i++){
       int other;
       other = min(A.at(i+1), B.at(i) - same);
       same = min(A.at(i+1) - other, B.at(i+1));
       ans += other + same;
   }
   ans += min(A.at(N), B.at(N-1) - same);
   */
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	int n;
	string s;
	cin >> n >> s;
	
	int w_cnt = 0,e_cnt = 0,w_memo = 0,e_memo = 0,ans = 10000000;
	
	rep(i,0,n){
		if(s[i] == 'E'){
			e_cnt++;
		}
		else{
			w_cnt++;
		}
	}
	
	rep(i,0,n){
		if(s[i] == 'W'){
			ans = min(ans,(n-i-1)-(w_cnt - w_memo-1)+(w_memo));
			w_memo++;
		}
		else{
			ans = min(ans,(n-i-1)-(w_cnt - w_memo)+(w_memo));
			e_memo++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 900
#include<iostream>
using namespace std;
int main(void)
{
    int H,W;
    while(true)
    {
        cin>>H>>W;
        if(H==0&&W==0)
           break;
        for(int i=0;i<H;++i)
        {
            for(int j=0;j<W;++j)
            {
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3124
import numpy as np
n,m = [int(i) for i in input().split()]

h = [int(i) for i in input().split()]

l = [[int(i)-1 for i in input().split()] for _ in range(m)]

ans = np.array([1 for _ in range(n)])

for x,y in l:
    if h[x]>h[y]:
        ans[y] = 0
    elif h[x] < h[y]:
        ans[x] = 0
    else:
        ans[x] = 0
        ans[y] = 0
        
print(np.count_nonzero(ans))

Measured memory_bytes: 49656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, -1, sizeof(mat))
#define N 100001
ll n,ans=0;
ll a[N],wa[N];
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    FOR(i,0,n)cin>>a[i];
    sort(a,a+n);
    wa[0]=a[0];
    FOR(i,1,n){
    	wa[i]=wa[i-1]+a[i];
    }
    ans=1;
    FOR(i,1,n){
    	if(wa[n-1-i]*2>=a[n-i])ans++;
    	else break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {  
	public static void main(String[] args) {  
		/*1231231231 ---> There can be at most one leftover
		 * 13213
		 * Cases:
		 * All same frequency---> Good
		 * One is bigger by 1 --> Good
		 * Two is bigger by 1 --> Good
		 * */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		String S = I.next();
		int N = S.length();
		boolean good=true;
		int[] cnts = new int[3];
		for (int i = 0; i < N; i++) {
			cnts[S.charAt(i)-'a']++;
		}
		Arrays.sort(cnts);
		if (cnts[2]-cnts[0]>=2) good=false;
		O.pln(good?"YES":"NO");
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 28400
A,B= list(input().split())
a = int(B[0])
b = int(B[2])
c = int(B[3])
if int(A) > 1000:
   e = int(A[-2])
   f = int(A[-1])
   d = int((int(A)- 10 * e - f)/100)
   error = 10 * (c * e + b * f) + c * f
   error = int(error/100)
   ans = int(A) * a + 10 * d * b + e * b + c * d + error
   print(int(ans))
else:
   print(int(int(A)*float(B)))

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

void area(int x,int y);
void primeter(int x,int y);

int main(){
    int R,x,y;
    cin>>x>>y;
    area(x,y);
    cout<<" ";
    primeter(x,y);

    return 0;
}

void area(int x,int y){
    int R;
    R=x*y;
    cout<<R;
}

void primeter(int x,int y){
    int P;
    P=2*x+2*y;
    cout<<P<<endl;
}


Measured memory_bytes: 3008
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<utility>
#include<deque>
using namespace std;
#define MOD 1000000007
typedef long long ll;

int main(){
    ll n,k,a[2000],ans=0;
    scanf("%lld %lld",&n,&k);
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
    }
    for(int i=0;i<n;i++){
        ll cnt=0LL;
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j]){
                cnt++;
            }
        }
        ans+=k*cnt;
        ans%=MOD;
        for(int j=0;j<=i;j++){
            if(a[i]>a[j]){
                cnt++;
            }
        }
        ll sum=cnt;
        if(k%2==0){
            sum*=k/2LL;
            sum%=MOD;
            sum*=(k-1);
            sum%=MOD;
        }
        else{
            sum*=k;
            sum%=MOD;
            sum*=(k-1)/2LL;
            sum%=MOD;
        }
        ans+=sum;
        ans%=MOD;
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double

int main() {
    ll n,k,x;
    cin>>n>>k;
    ll a[n],dp[n]={0};
    for(int i=0;i<n;i++) cin>>a[i];
    dp[n-1]=0;
    for(int i=n-2;i>=0;i--){
        x=INT_MAX;
        for(int j=1;(i+j)<n && j<=k;j++){
            x=min(x,abs(a[i]-a[i+j])+dp[i+j]);
        }
        dp[i]=x;
    }
    cout<<dp[0]<<"\n";
}

Measured memory_bytes: 5116
#include <stdio.h>
#include <stdlib.h>

#define K 1000000000

int search(int A[],int n, int key){
  int i=0;
  A[n] = key;
  while(A[i] != key)i++;
  return i!=n  ;
  
}

int main(){
 
  int N,i,*A,*B,M,count=0;
  
  scanf("%d",&N);
  A = (int *)malloc(N * sizeof(int));
  for(i=0;i<N;i++)
  scanf(" %d",&A[i]);
  
  scanf("%d",&M);
  B = (int *)malloc(M * sizeof(int));
  for(i=0;i<M;i++){
  scanf("%d",&B[i]);
  if(search(A,N,B[i])) count++;
  }

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



  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<stdio.h>
#include<math.h>
#include<stdio.h>
#include<complex>
using namespace std;

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

typedef long long ll;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;

const ll INF = ll(1e18) + 1;
const int intINF = 1e9 * 2 + 3;
//--------------------------------------------------
ulli powN(ulli num,ulli i) {
	return (i > 1) ? num : powN(num * 9, i - 1);
}

ulli gcd(ulli a, ulli b) {return (b <= 0) ? a : gcd(b, a % b);}
ulli lcm(ulli a, ulli b) {return a * b / gcd(a, b);}

bool isPrime(int n)
{
	if (n <= 3)return n > 1;
	if (n % 2 == 0)return false;
	if (n % 3 == 0)return false;
	for (int i = 5; i * i < n; i += 6) {
		if (n % i == 0 || n % (i + 2) == 0) { return false; }
	}
	return true;
}
//---------------------------------------------------


ulli func(int num) {
	if (num < 2) {
		return 1;
	}
	else if (num >= 2) {
		return num * func(num - 2);
	}
}

void Main()
{
	int n;
	cin >> n; // n <= 200
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			int temp = gcd(i, j);
			if (temp == 1) {
				sum += n;
			}
			else {
				for (int k = 1; k <= n; k++) {
					sum += gcd(temp, k);
				}
			}
		}
	}
	cout << sum << endl;

}


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

Measured memory_bytes: 3624
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iomanip>
#include <sstream>

int64_t v = std::pow(10, 10);
 
int main(void)
{
    int64_t n, k;
    std::cin >> n >> k;

    auto GetCount = [&](int64_t i){
        int64_t count = 0;
        int64_t value = i;
        while(value < k) {
            value <<= 1;
            count++;
        }
        return std::pow(2, count);
    };

    double p = 0;
    for (int64_t i = 1; i <= n; ++i) {
        p += (1.0 * v) / (n * GetCount(i));
    }

    double prob = (1.0 * p) / v; 
    std::cout << std::setprecision(24) << prob << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	bool remains[100];
	for(int i = 0; i < 100; i++)
	{
		remains[i] = false;
	}
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	for(int i = (c + a - 1) / a;; i++)
	{
		if((a * i - c) % b == 0)
		{
			printf("YES\n");
			return 0;
		}
		else
		{
			if(remains[(a * i - c) % b])
			{
				break;
			}
			else
			{
				remains[(a * i - c) % b] = true;
			}
		}
	}
	printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
// ?
#include<iostream>
using namespace std;
typedef long long ll;

int main(){
    ll t1, t2, a1, a2, b1, b2;
    cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;
    
    ll ax = t1*a1+t2*a2;
    ll bx = t1*b1+t2*b2;
    if(ax==bx){
        cout << "infinity" << endl;
        return 0;
    }

    if(ax > bx){
        swap(a1, b1);
        swap(a2, b2);
        swap(ax, bx);
    }

    if(a1 < b1){
        cout << 0 << endl;
        return 0;
    }

    ll tmpa = t1*a1-t1*b1;
    ll tmpb = t2*b2-t2*a2;

    ll ans = 1;
    ll tmp = tmpb-tmpa;

    ans += (tmpa-tmp+tmp-1)/tmp*2;
    ans += (tmpa-tmp)%tmp==0;
    
    cout << ans << endl;
    
    return 0;
}

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

int n;
int C[10000];

int CountingSort(int A[],int B[],int k){
    for (int i=0; i<k+1; i++) {
        C[i]=0;
    }
    for (int j=1; j<n+1; j++) {
        C[A[j]]++;
    }
    for (int i=1; i<k+1; i++) {
        C[i]=C[i]+C[i-1];
    }
    for (int j=n; j>0; j--) {
        B[C[A[j]]]=A[j];
        C[A[j]]--;
    }
    return 0;
}

int main(){
    cin>>n;
    int A[n];
    int B[n];
    int k=0;
    for (int i=1; i<n+1; i++) {
        cin>>A[i];
        B[i]=A[i];
        k=max(k, A[i]);
    }
    CountingSort(A, B, k);
    for (int i=1; i<n; i++) {
        cout<<B[i]<<" ";
    }
    cout<<B[n]<<endl;
}


Measured memory_bytes: 18768
#include <cstdio>
#include <set>

int main() {
  int N;
  scanf("%d", &N);

  std::set<int> set;
  for (int i=0; i<N; ++i) {
    int A;
    scanf("%d", &A);

    if (set.count(A)) {
      set.erase(A);
    } else {
      set.insert(A);
    }
  }

  printf("%zu\n", set.size());
  return 0;
}


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

vector<bool> digit(10, false);

bool check(int N) {
  bool res = true;
  while(N > 0) {
    int x = N % 10;
    
    if (digit[x]) {
      res = false;
      break;
    }
    N /= 10;
  }
  
  return res;
    
}

int main() {
  int N, K;
  cin >> N >> K;
  
  for (int i = 0; i < K; i++) {
    int x;
    cin >> x;
    digit[x] = true;
  }
  
  while(true) {
    if (check(N)) {
      cout << N << endl;
      return 0;
    }
   
    N++;
  }
  
}

Measured memory_bytes: 3584
import itertools
import bisect
n,m,v,p=map(int, input().split())
A=list(map(int, input().split()))

A.sort()
Cumsum=list(itertools.accumulate(A))
Kijun=A[n-p]
Ans=n
for i in range(n):
   L=0
   if A[i]+m>=Kijun:
       b1=min(bisect.bisect_left(A, A[i]+m),n-p)
       b2=min(bisect.bisect_right(A, A[i]+m),n-p) 
       L=m*(i+1)+(A[i]+m)*(b1-i)-(Cumsum[b1]-Cumsum[i])+m*(n-b2-1)
       if L>=m*v:
            break

print(n-i)

Measured memory_bytes: 63640
#include<bits/stdc++.h>
#include<bits/stdc++.h>
#include <vector>
#define ll long long int
#define ve vector<int>
#define vell vector<ll>
#define ve_pa vector<pair<ll,ll> >
#define pb push_back
#define mod 1000000007
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s,t;
cin>>s>>t;
if(s.size()<t.size())
{
	int cn=0;
	for(int  i=0;i<s.size();i++)
	{
			if(s[i]!=t[i])
			{
				cn=-1;
				break;
			}
	}
	if(cn==-1)
	{
	cout<<"No";
	return 0;
	}
	else
	cout<<"Yes";

}
else
cout<<"No";






}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long int
#define M 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
const double pi = acos(-1.0);
#define F  first
#define S  second
#define endl '\n'
using namespace std;
using namespace __gnu_pbds;
const int INF = 1e18L+5;
const int LG = 20;
const int N = 1e5+9;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int power(int x,int y){if(x==0)return 0;int res=1;while(y>0){if(y%2==1)res=(res*x)%M;x=(x*x)%M;y=y/2;}return res;}
bool isvowel(char c){if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U')return true;return false;}
int32_t main()
{
	//cout.precision(15);
	//cout.setf(ios::fixed,ios::floatfield);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int T=1;
	//cin>>T;
	while(T--)
	{
		int n,l;
		cin>>n;
		l=n%10;
		if(l==3)
		cout<<"bon"<<endl;
		else if(l==0||l==1||l==6||l==8)
		cout<<"pon"<<endl;
		else
		cout<<"hon"<<endl;
	}
}



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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr ll MOD = 1000000007;

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

ll memo[2005][2005];

ll comb(int i, int j) {
  if (memo[i][j] > 0) return memo[i][j];

  ll l = (i > 0 && i > j) ? comb(i - 1, j) : 0;
  ll r = (i > 0 && j > 0) ? comb(i - 1, j - 1) : 0;

  return memo[i][j] = (l + r) % MOD;
}

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);

  memo[0][0] = 1;

  rep(i, 1, K + 1) {
    ll ans = (comb(N - K + 1, i) * comb(K - 1, i - 1)) % MOD;
    put(ans);
  }

  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


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

using namespace std;

#define int long long

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

const int mod = 1e9 + 7;

int N, C;
int A[405], B[405];
int Sum[405][405];

int dp[405][405];

inline int modpow(int a, int x, int m)
{
    int res = 1;

    while (x > 0) {
        if (x & 1) (res *= a) %= m;

        (a *= a) %= m;
        x /= 2;
    }

    return res;
}

signed main()
{
    cin >> N >> C;

    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];

    int v = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= C; ++j) {
            for (int k = A[i]; k <= B[i]; ++k) {
                (Sum[i][j] += modpow(k, j, mod)) %= mod;
            }
        }
    }

    for (int i = 0; i <= C; ++i) {
        for (int l = A[0]; l <= B[0]; ++l) {
            (dp[0][i] += modpow(l, i, mod)) %= mod;
        }
    }

    for (int i = 1; i < N; ++i) {
        for (int j = 0; j <= C; ++j) {
            for (int k = 0; k <= C - j; ++k) {
                (dp[i][j + k] += dp[i - 1][j] * Sum[i][k]) %= mod;
            }
        }
    }

    cout << dp[N - 1][C] << endl;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll X,Y,Z;
    cin>>X>>Y>>Z;
    cout<< Z SP X SP Y<<"\n";

}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int INF=(int)1e9;
const int MOD=(int)1e9+7;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};



int main(){
  string s,a,b,c;
  cin>>s;
  a=s.substr(0,5);
  b=s.substr(6,7);
  c=s.substr(14,5);

  cout<<a<<" "<<b<<" "<<c<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char str[100000+5];
int main() {
    scanf("%s",str);
    int len=strlen(str);
 
    int num=len-2;
    if(str[0]!=str[len-1]){
        if(num%2)
            printf("First\n");
        else
            printf("Second\n");
    }
    else{
        if(num%2)
            printf("Second\n");
        else
            printf("First\n");
    }
 
    return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	char a;
    cin>>a;
    if('A'<=a&&a<='Z')cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
    long long int i,j,k,n,m,p,x,a[1000],sum;
    scanf("%lld",&n);
    for(i=0; i<n; i++)
    {
        scanf("%lld",&a[i]);
    }
    scanf("%lld",&m);
    for(j=0; j<m; j++)
    {
        scanf("%lld%lld",&p,&x);
        sum=0;
        for(k=0; k<n; k++)
        {
            sum=sum+a[k];
        }
        sum=sum-a[p-1]+x;
        printf("%lld\n",sum);

    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x==0) cout<<(n/x)*t;
    else cout<<((n/x)+1)*t;
}

Measured memory_bytes: 3636