Harryxun/stf_run huggingface dataset:
import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(1000000)


def factorial(n):
    w = 10**9 + 7
    table = [1]*(n+1)
    for i in range(1, n+1):
        table[i] = table[i-1]*i % w
    return table


def modinv(a, m):
    b = m
    u = 1
    v = 0

    while b > 0:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


def moddiv(x, y, m=10**9+7):
    y_inv = modinv(y, m)
    return x * y_inv % m


def perm(N1, N2):
    table = factorial(N1+N2)
    s = table[N1+N2]
    a = table[N1]
    b = table[N2]
    return moddiv(moddiv(s, a), b)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))

    x, y = map(int, input().split())
    diff = abs(x-y)

    if diff == 0:
        if x % 3 != 0:
            print(0)
            return
        cnt = x // 3
        ret = perm(cnt, cnt)
    else:
        if (min(x, y)-diff) % 3 != 0:
            print(0)
            return
        cnt = (min(x, y) - diff) // 3
        ret = perm(cnt, cnt+diff)

    print(ret)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(1000000)


def factorial(n):
    w = 10**9 + 7
    table = [1]*(n+1)
    for i in range(1, n+1):
        table[i] = table[i-1]*i % w
    return table


def modinv(a, m):
    b = m
    u = 1
    v = 0

    while b > 0:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


def moddiv(x, y, m=10**9+7):
    y_inv = modinv(y, m)
    return x * y_inv % m


def perm(N1, N2):
    table = factorial(N1+N2)
    s = table[N1+N2]
    a = table[N1]
    b = table[N2]
    return moddiv(moddiv(s, a), b)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))

    x, y = map(int, input().split())
    diff = abs(x-y)

    if diff == 0:
        if x % 3 != 0:
            print(0)
            return
        cnt = x // 3
        ret = perm(cnt, cnt)
    else:
        if (min(x, y)-diff) % 3 != 0 or min(x, y) - diff < 0:
            print(0)
            return
        cnt = (min(x, y) - diff) // 3
        ret = perm(cnt, cnt+diff)

    print(ret)


if __name__ == "__main__":
    main()
a,b,c,d,e,k = int(input()) for i in range(6)
print("Yay!" if (e - a <= k) else ":(")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if( e - a > k):
	print(":(")
else:
	print("Yay!")
import sys
input=sys.stdin.readline
n,a,b=map(int,input().split())
INF=10**9+7
def modcomb(n,k,m):
    fac=[0]*(n+1)
    finv=[0]*(n+1)
    inv=[0]*(n+1)
    fac[0]=fac[1]=1
    finv[0]=finv[1]=1
    inv[1]=1
    for i in range(2,n+1):
        fac[i]=fac[i-1]*i%m
        inv[i]=m-inv[m%i]*(m//i)%m
        finv[i]=finv[i-1]*inv[i]%m
    return fac[n]*(finv[k]*finv[n-k]%m)%m
ans=0
ans=(ans-modcomb(n,a,INF)-modcomb(n,b,INF))%INF
ans=(ans+pow(2,n,INF)-1)%INF
print(ans)





### FIXED CODE ###

import sys
input=sys.stdin.readline
n,a,b=map(int,input().split())
INF=10**9+7
def modinv(a,m):
    b=m
    (x,lastx)=(0,1)
    (y,lasty)=(1,0)
    while not b==0:
        q=a//b
        (a,b)=(b,a%b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx%m
ans=0
ans=(ans+pow(2,n,INF)-1)%INF
bunsi=1
bunbo=1
for i in range(a):
    bunsi=(bunsi*(n-i))%INF
    bunbo=(bunbo*(i+1))%INF
x=(bunsi*modinv(bunbo,INF))%INF
bunsi=1
bunbo=1
for i in range(b):
    bunsi=(bunsi*(n-i))%INF
    bunbo=(bunbo*(i+1))%INF
y=(bunsi*modinv(bunbo,INF))%INF
ans=(ans-x-y)%INF
print(ans)
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//L
else:
  L = 9*K
  
t = 1
ans = 0
for i in range(1,L,1):
  t = t*10
  if t % L == 1:
    ans = i
    break
  t = t % L
print(ans)

### FIXED CODE ###

K = int(input())

if K%7 == 0:
  L = 9*K/7
else:
  L = 9*K
s = 1

for i in range(1, 9*(10**6)+1):
  s = s*10%L
  if s == 1:
    print(i)
    exit()

print("-1")
N,K = map(int,input().split())
A = [[0 for j in range(N)]for i in range(N)]
B = [0 for j in range(N)]
S = 0
for i in range(K):
    d = int(input())
    A[i] = list(map(int,input().split()))
for i in range(len(A)):
    for j in range(len(A[i])):
        for k in range(N):
            if A[i][j] == k+1:
                B[k] = 1
for i in range(N):
    if B[i] != 1:
        S += 1
print (S)

### FIXED CODE ###

N,K = map(int,input().split())
A = [[0 for j in range(K)]for i in range(K)]
B = [0 for j in range(N)]
S = 0
for i in range(K):
    d = int(input())
    A[i] = list(map(int,input().split()))
for i in range(K):
    for j in range(len(A[i])):
        for k in range(N):
            if A[i][j] == k+1:
                B[k] = 1
for i in range(N):
    if B[i] != 1:
        S += 1
print (S)
= int[int(i) for i in input().split()]

if a < b:
    print(a < b)
elif a > b:
    print(a > b)
    else:
        print(a == b)

### FIXED CODE ###

a, b = [int(i) for i in input().split()]

if a < b:
    print("a < b")

elif a > b:
    print("a > b")

else:
    print("a == b")
s = list(input())
for i in range(3):
  	if(s[i] == s[i+1]):
  		print('Bad')
 		exit()
else:
  print('Good')


### FIXED CODE ###

S = list(input())
for i in range(3):
    if(S[i]==S[i+1]):
        print('Bad')
        exit()
else:
    print('Good')
print(sum(a!=b for a,b in zip(input(),input()))


### FIXED CODE ###

print(sum(a!=b for a,b in zip(input(),input())))
import math
def gcd(x,y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    if  x % y == 0:
        return y
    else:
        return gcd(y, x%y)

def f(n):
    li = []
    m = n
    while True:
        for i in range(2, n + 1):
            if m % i == 0:
                if not i in li:
                    li.append(i)
                    n = n // i
                    break
                else:
                    n = n // i
                    continue
        else:
            break
    return li

a, b = list(map(int, input().split()))
d = gcd(a, b)
print(len(set(f(d))) + 1)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
li = [0 for i in range(n)]
for i in range(n):
    x = a[i]
    li[x-1] = i + 1
for i in range(n):
    print(li[i], end=" ")
import math
S = int(input())
L = 10**9

def search():
    p = int(math.sqrt(S))
    q = p
    i = 0
    while p*q < S:
        if i % 2 == 0 or q == L-1: p += 1
        if i % 2 == 1 or p == L-1: q += 1
        i += 1
    assert p <= L and q <= L
    target = p*q - S
    divisor = 1
    #assert target < L
    return (0, 0, p, divisor, target, q)

print(*search())

### FIXED CODE ###

import math
S = int(input())
L = 10**9

def search():
    p = int(math.sqrt(S))
    q = p
    i = 0
    while p*q < S:
        if i % 2 == 0 or q == L: p += 1
        if i % 2 == 1 or p == L: q += 1
        i += 1
    assert p <= L and q <= L
    target = p*q - S
    divisor = 1
    #assert target < L
    return (0, 0, p, divisor, target, q)

print(*search())
n = int(input())
arr = np.array(list(map(int, input().split())))


@njit
def solve(arr):
    for i in range(arr.shape[0] - 1):
        if np.gcd(arr[i], arr[i + 1]) != 1:
            ans1 = False
            break
    else:
        ans = True
    return ans


ans1 = solve(arr)
ans2 = np.gcd.reduce(arr) == 1

if ans1 and ans2:
    print("pairwise coprime")
elif ans2:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")
s=input()
print(sorted(list(set([s[i:j] for i in range(len(s)) for j in range(i+1,len(s)+1)])))[int(input())-1])

### FIXED CODE ###

s=input()
n=len(s)
k=int(input())
l=[]
for i in range(1,6):
    if n>=i:l=l+[s[j:j+i] for j in range(n-i+1)]
print(sorted(list(set(l)))[k-1])
N = int(input())
S = []
for n in range(N):
    S.append(input())
dic = {}


for n in range(N):
    if S[n] not in dic:
        dic[S[n]] = 1
    else:
        dic[S[n]] += 1

max = max(dic.values())
out = []

for key,val in dic.items():
    if val == max:
        out.append(val)
out.sorted()
for val in range(len(out)):
    print(val)

### FIXED CODE ###

N = int(input())
S = []
for n in range(N):
    S.append(input())
dic = {}


for n in range(N):
    if S[n] not in dic:
        dic[S[n]] = 1
    else:
        dic[S[n]] += 1

max = max(dic.values())
out = []

for key,val in dic.items():
    if val == max:
        out.append(key)

out.sort()
for key in out:
    print(key)
N = input( )

N_100 = N // 100
N = N - 100 * N_100
N_10 = N // 10
N = N - 10 * N_10
N_1 = N

if  N_100 == N_1:
    print ('Yes')
else :
    print ('No')

### FIXED CODE ###

N = int (input( ))

N_100 = N // 100
N = N - 100 * N_100
N_10 = N // 10
N = N - 10 * N_10
N_1 = N

if  N_100 == N_1:
    print ('Yes')
else :
    print ('No')
MOD = 10**9 + 7
 
N,K = [int(s) for s in input().split()]
 
comb = [[1]]
for i in range(N + 1):
    comb.append([1])
    for j in range(i):
        comb[-1].append((comb[-2][j] + comb[-2][j + 1]))
    comb[-1].append(1)
 
 
for i in range(1,K+1):
  print(comb[N-i+1][i] * comb[K-1][i]) if i != K else print(comb[N-i+1][i])

### FIXED CODE ###

MOD = 10**9 + 7
 
N,K = [int(s) for s in input().split()]
 
comb = [[1]]
for i in range(N + 1):
    comb.append([1])
    for j in range(i):
        comb[-1].append((comb[-2][j] + comb[-2][j + 1]) % MOD)
    comb[-1].append(1)
    
def combi(n,k):
  return comb[n][k] if n >= k else 1

for i in range(1,K+1):
  if i <= N-K+1:
    print((combi(N-K+1,i) * combi(K-1,i-1)) % MOD)
  else:
    print(0)
N = int(input())
A = list(map(int,input().split()))
for i in A:
    sum += 1/i
print(1/sum)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in A:
    sum += 1/i
print(1/sum)
N=int(input())
MAXN=N+5
MAXV=N*(N-1)//2

a=[[0 for j in range(N-1)] for i in range(N)]
for i in range(N):
  line=list(map(int,input().split()))
  for j in range(N-1):
    a[i][j]=line[j]-1

id=[[0 for j in range(MAXN)] for i in range(MAXN)]
v=0
for i in range(N-1):
  for j in range(i+1,N):
    id[i][j]=v
    v+=1

def toId(i,j):
  if i>j:
    i,j=j,i
  return id[i][j]

to=[[] for i in range(MAXV)]
for i in range(N):
  for j in range(N-1):
    a[i][j]=toId(i,a[i][j])
  for j in range(N-2):
    to[a[i][j+1]].append(a[i][j])
    
visited=[False for i in range(MAXV)]
calculated=[False for i in range(MAXV)]
dp=[0 for i in range(MAXV)]

def dfs(v):
  if visited[v]:
    if not calculated[v]:
      return -1
    return dp[v]
  visited[v]=True
  for u in to[v]:
    val=dfs(u)
    if val==-1:
      return -1
    if val+1>dp[v]:
      dp[v]=val+1
  calculated[v]=True
  return dp[v]
    
ans=0
for i in range(MAXV):
  res=dfs(i)
  if res==-1:
    print(-1)
    break
  if ans<res:
    ans=res
else:
  print(ans+1)

### FIXED CODE ###

N=int(input())
a=[[0 for j in range(N-1)] for i in range(N)]
for i in range(N):
  line=list(map(int,input().split()))
  for j in range(N-1):
    a[i][j]=line[j]-1
  a[i]=a[i][::-1]
    
q=[]

#seen=[[False for j in range(N)] for i in range(N)]

# 選手nが試合できるならqueに入れる
def check(i):
  if len(a[i])==0:
    return False
  j=a[i][-1]
  if a[j][-1]==i:
    q.append([i,j])
  
for i in range(N):
  check(i)
  
from collections import defaultdict

day=0
while q:
  day+=1
 # q=sorted(q)
  prevQ=q.copy()
  q=[]
  matched=defaultdict(list)
  for p in prevQ:
    i=p[0]
    j=p[1]
    if i>j:
      i,j=j,i
    if matched[i]:
      continue
    a[i].pop()
    a[j].pop()
    check(i)
    check(j)
    matched[i].append(j)
    
for i in range(N):
  if len(a[i])!=0:
    print(-1)
    break
else:
  print(day)
pow(x,3)



### FIXED CODE ###

x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)
a, b, h = map(int, input().split())

S = int((a + b) * h /2)

print(S)

### FIXED CODE ###

a,b,h=map(int,open(0));print((a+b)*h//2)
n = int(input())
h = [None] + list(map(int, input().split('')))

dp = [None for _ in range(n+1)]
for k in range(1,n+1):
  if k == 1:
    dp[k] = 0
  elif k ==2:
    dp[k] = abs(h[2] - h[1])
  else:
    dp[k] = min(
      dp[k-1] + abs(h[k] - h[k-1]),
      dp[k-2] + abs(h[k] - h[k-2])
    )
print(dp[k])

### FIXED CODE ###

n = int(input())
h = [None] + list(map(int, input().split()))

dp = [None for _ in range(n+1)]
for k in range(1,n+1):
  if k == 1:
    dp[k] = 0
  elif k == 2:
    dp[k] = abs(h[2] - h[1])
  else:
    dp[k] = min(
      dp[k-1] + abs(h[k] - h[k-1]),
      dp[k-2] + abs(h[k] - h[k-2])
    )
print(dp[k])
import sys
std = sys.stdin.read()
std_arr = std.split('\n')
persons = int(std_arr[0])
li = std_arr[1].split()
day = int(li[0])
mod = int(li[1])
patici = {}
p = 0
for i in range(2, len(std_arr)): 
    patici[p] =  int(std_arr[i])
    p += 1

if p != persons:
    print('lack of argument!!!')
    exit()

choko = 0
for i in patici.keys():
    for x in range(0, 100):   
        if (x + 1) * patici[i] + 1 < day :
            print((x + 1) * patici[i] + 1 )
            choko += 1

print(choko + mod)

### FIXED CODE ###

import sys

def _calc(Ai, j):
    if j != 0:
        return j * Ai + 1
    if j == 0:
        return 1

def main(inp_list):
    # return inp_list
     N = inp_list[0]
     D = inp_list[1][0]
     X = inp_list[1][1]
     A = inp_list[2:]
     #return type(A[0][0])
     results =[ _calc(per[0], i) for per in A  for i in range(0,100) if _calc(per[0], i) < D + 1]
     return len(list(results)) + X

def init(MODE):
    if MODE == 0:
        while True:
            try:
                result = int(input())
                yield result
            except:
                break

    if MODE == 1:
        while True:
            try:
                li=list(map(int,input().split()))
                yield li
            except:
                break
if __name__ == '__main__':
    """ MODE: 0 縦, 1 縦横, 2 横 """
    MODE = 1
    inp_list = init(MODE)
    print(main(list(inp_list)))
a, b, c = map(int, input().split())
res = min(n * a, b)
print(res)

### FIXED CODE ###

n, a, b = map(int, input().split())
print(min(n * a, b))
N = int(input())

result_list = [
    ["a"],
    ["aa", "ab"],
    ["aaa", "aab", "aba", "abb", "abc"]
]

for s in result_list[N - 1]:
    print(s)

### FIXED CODE ###

N = int(input())
#N = 4
def to_str(n):
    s = [chr(i + 97) for i in reversed(n)]
    s = "".join(s)
    return s
n = [0] * N
n_max = list(reversed(list(range(N))))

s = to_str(n)
print(s)
while True:
    for j in range(N-1):
        #if n[j] < n[j+1]+1:
        if n[j] < max(n[j+1:]) + 1:
            n[j] += 1
            for k in range(j):
                n[k] = 0
            s = to_str(n)
            print(s)
            break
    if n == n_max:
        break
num = int(input())
div_sum = defaultdict(int)

p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31]

for j in range(1, num + 1):

    div_num = defaultdict(int)

    for i in p:
        n = j
        while n % i == 0:
            div_num[i] += 1
            n //= i

    for k, v in div_num.items():
        div_sum[k] += v

ans = 1
for k, v in div_sum.items():
    ans *= (v + 1)
print(ans % (10**9 + 7))


### FIXED CODE ###

import math
from collections import defaultdict


def make_prime_list(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num+1, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]


num = int(input())
div_sum = defaultdict(int)

p = make_prime_list(num)
for j in range(2, num+1):

    div_num = defaultdict(int)

    for i in p:
        n = j
        while n % i == 0:
            div_num[i] += 1
            n //= i

    for k, v in div_num.items():
        div_sum[k] += v

ans = 1
for k, v in div_sum.items():
    ans *= (v + 1)
print(ans % (10**9 + 7))
import fractions
import bisect
import math

mod=1000000007
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
A.sort(key=lambda x: x[1])


A,B=map(int,input().split())

for i in range(N):
    A,B=map(int,input().split())
    B.append([A,B])

for i in reversed(range(N)):
print(B[i], end="")

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

math.ceil()   #切り上げ
math.floor()  #切り捨て

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

bisect.bisect_left(a,x)



### FIXED CODE ###

A,B=map(int,input().split())
if A<=B*2:
    print(0)
else:
    print(A-B*2)
# @oj:atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-04-20 10:31
# @url:https://atcoder.jp/contests/dp/tasks/dp_b
import sys
from numba import jit
def input():
    return sys.stdin.readline().strip()

def main():
    nk=list(map(int,input().split()))
    h=list(map(int,input().split()))
    n=nk[0]
    k=nk[1]
    dp=[10**9]*n
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
    #     dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i))
        for j in range(max(0,i-k),i):
            dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i])

    print (dp[-1])

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys


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


def main():
    size, jumps = map(int, input().split())
    array = list(map(int, input().split()))
    dp = [999999999] * size
    dp[0]= 0
    dp[1] = abs(array[0]- array[1])
    for i in range(2,size):
        dp[i] = min(abs(array[i] - array[j]) + dp[j] for j in range(max(0, i - jumps), i))
    print(dp[size-1])

if __name__ == "__main__":
    main()
n = int(input())
S = map(int, input().split())
q = int(input())
T = map(int, input().split())
print(len(S & T))

### FIXED CODE ###

n = int(input())
S = set(map(int, input().split()))
q = int(input())
T = set(map(int, input().split()))
print(len(S & T))
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

tL = []
for i in range(D):
    tL.append(int(input()))

def cal():
    score = 0
    his = [0] * len(C)
    for i in range(D):
        t = tL[i]
        t -= 1
        his[t] = i + 1
        sat = 0
        for j in range(len(C)):
            sat += C[j] * (i - his[j] + 1)
        score += S[i][t] - sat
    return score

def search():
    d, q = map(int, input().split())
    tL[d - 1] = q
    return cal()
    
M = int(input())
for _ in range(M):
    print(search())

### FIXED CODE ###

D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

tL = []
for i in range(D):
    tL.append(S[i].index(max(S[i])) + 1)

for t in tL:
    print(t)
k = int(input()) 
 
 lunlun = [i for i in range(1, 10)]
 
 p = 0 

 def generate_lunlun(p):
     last = p % 10
     if last - 1 >= 0:
         yield p * 10 + last - 1
    yield p * 10 + last
    if last + 1 <= 9:
        yield p * 10 + last + 1 

while len(lunlun) < k:
    for new_lunlun in generate_lunlun(lunlun[p]):
        lunlun.append(new_lunlun)
    p += 1

print(lunlun[k-1])

### FIXED CODE ###

k = int(input()) 
 
lunlun = [i for i in range(1, 10)]
 
p = 0 

def generate_lunlun(p):
    last = p % 10
    if last - 1 >= 0:
        yield p * 10 + last - 1
    yield p * 10 + last
    if last + 1 <= 9:
        yield p * 10 + last + 1 

while len(lunlun) < k:
    for new_lunlun in generate_lunlun(lunlun[p]):
        lunlun.append(new_lunlun)
    p += 1

print(lunlun[k-1])
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

d = [
        [
            [
                [
                    [None] * 2 for _ in range(2)
                ] for _ in range(2)
            ] for _ in range(m+1)
        ] for _ in range(n)
    ]

def rec(i, j, p):
    if i >= n or j <= 0:
        return 0

    if d[i][j][p[0]][p[1]][p[2]]:
        return d[i][j][p[0]][p[1]][p[2]]

    res1 = rec(i+1, j, p)
    res2 = rec(i+1, j-1, p)
    res2 += a[i][0] * (-1 if p[0] else 1)
    res2 += a[i][1] * (-1 if p[1] else 1)
    res2 += a[i][2] * (-1 if p[2] else 1)

    res = max(res1, res2)
    d[i][j][p[0]][p[1]][p[2]] = res
    return res

results = []

for p0 in range(2):
    for p1 in range(2):
        for p2 in range(2):
            results.append(rec(0, m, [p0, p1, p2]))
print(max(results))


### FIXED CODE ###

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

r = [[0]*n for _ in range(8)]
for i in range(n):
    x, y, z = map(int, input().split())
    r[0][i] = x+y+z
    r[1][i] = x+y-z
    r[2][i] = x-y+z
    r[3][i] = x-y-z
    r[4][i] = -x+y+z
    r[5][i] = -x+y-z
    r[6][i] = -x-y+z
    r[7][i] = -x-y-z

print(max(sum(sorted(r[i])[-m:]) for i in range(8)) if m != 0 else 0)
a=int(input())
s=input()
s=s.count(R)
if a-s<s:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a=int(input())
s=list(input())
x=s.count("R")
y=a-x
if x>y:
    print("Yes")
else:
    print("No")
def dist(a, b):
    res = 0
    for i in range(D):
        res += (a[i] - b[i])**2
    res = res ** 0.5
    return res

N, D = map(int,input().split())
x = [list(map(int, input().split()) for _ in range(N))]
ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        if dist(x[i], x[i]).is_integer():
            ans += 1

print(ans)

### FIXED CODE ###

def dist(a, b):
	res = 0
	for i in range(D):
		res += (a[i] - b[i]) ** 2
	res = res ** 0.5
	return res


N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N - 1):
	for j in range(i + 1, N):
		if dist(X[i], X[j]).is_integer():
			ans += 1
print(ans)
A, B, H, M = list(map(int, input().split()))

import math
A_x = A * math.cos(2 * math.pi * (H + M / 60.) / 12.)
A_y = A * math.sin(2 * math.pi * (H + M / 60.) / 12.)
B_x = B * math.cos(2 * math.pi * M / 60.)
B_y = B * math.sin(2 * math.pi * M / 60.)

print('{:.15f}'.format(math.sqrt((A_x - B_x) ** 2 + (A_y - B_y) ** 2)))

### FIXED CODE ###

N = int(input())
n = N % 10

if n == 3:
    print('bon')
elif n in [0, 1, 6, 8]:
    print('pon')
else:
    print('hon')