Harryxun/stf_run huggingface dataset:
from collections import deque as dq
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
ab = []
c = []
inf = 10 ** 10
for i in range(M):
  ab.append(list(map(int, input().split())))
  c.append(list(map(int, input().split())))
dp = [[inf] * M for _ in range(2 ** 12)]
cc = []
for i in range(M):
  temp = 0
  for k in range(ab[i][1]):
    t = 2 ** (c[i][k] - 1)
    temp = temp | t
  cc.append(temp)
def less(a, b):
  if a > b:
    return b
  else:
    return a
#print(ab, c)
Q = dq([])
Q.append((0, 0))
vis = set()
while len(Q):
  q = Q.popleft()
  i, j = q[0], q[1]
  if j >= M:
    continue
  if q in vis:
    continue
  vis.add(q)
  temp = i ^ 0
  temp2 = cc[j]
  if j > 0:
    #print(temp | temp2, j, ab[j][0])
    dp[temp | temp2][j] = less(dp[temp][j - 1] + ab[j][0], dp[temp | temp2][j])
    dp[temp][j] = less(dp[temp][j], dp[temp][j - 1])
    dp[temp2][j] = less(ab[j][0], dp[temp2][j])
    Q.append((temp | temp2, j + 1))
    Q.append((temp, j + 1))
    Q.append((temp2, j + 1))
  else:
    #print(temp | temp2, j, ab[j][0])
    dp[temp | temp2][j] = less(ab[j][0], dp[temp | temp2][j])
    Q.append((temp | temp2, j + 1))
if dp[2 ** N - 1][-1] == inf:
  print(-1)
else:
  print(dp[2 ** N - 1][-1])



### FIXED CODE ###

N = int(input())
print((N - N // 2) / N)
import numpy as np
import sys
sys.setrecursionlimit(100000)

directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])


def acinput():
    return list(map(int, input().split(" ")))


sys.setrecursionlimit(100000)


directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))


def acinput():
    return list(map(int, input().split(" ")))


N, K = acinput()
s = list(map(int, list(input())))

nums = [1]
for i in range(1, N):
    if s[i] == s[i-1]:
        nums[-1] += 1
    else:
        nums.append(1)

if s[0] != 1:
    nums.insert(0, 0)
nums_cs = np.cumsum(nums)

res = nums_cs[2*K]
# if len(nums_cs) > 1:
#     res = nums_cs[min(len(nums_cs)-1, 2*K-1)]
# else:
#     res = nums_cs[0]

for i in range(1,len(nums_cs)-2*K+1):
    if i % 2 == 0:
        print(i)
        res = max(res, nums_cs[min(i+2*K,len(nums_cs)-1)]-nums_cs[i-1])


print(res)

### FIXED CODE ###


import numpy as np
import sys
sys.setrecursionlimit(100000)

directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])


def acinput():
    return list(map(int, input().split(" ")))


sys.setrecursionlimit(100000)


directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))


def acinput():
    return list(map(int, input().split(" ")))


N, K = acinput()
s = list(map(int, list(input())))

nums = [1]
for i in range(1, N):
    if s[i] == s[i-1]:
        nums[-1] += 1
    else:
        nums.append(1)

if s[0] != 1:
    nums.insert(0, 0)
nums_cs = np.cumsum(nums)

res = nums_cs[min(len(nums_cs)-1,2*K)]
# if len(nums_cs) > 1:
#     res = nums_cs[min(len(nums_cs)-1, 2*K-1)]
# else:
#     res = nums_cs[0]

for i in range(1,len(nums_cs)-2*K+1):
    if i % 2 == 0:
        #print(i)
        res = max(res, nums_cs[min(i+2*K,len(nums_cs)-1)]-nums_cs[i-1])


print(res)
a = input()
a = a.split(" ")
for num in range(3):
    a[num] = int(a[num])
sum = sum(a)
if sum >= 22:
    print("bust")]
else:
    print(win)

### FIXED CODE ###

a = input()
a = a.split(" ")
sum = 0
for num in a:
    sum += int(num)
if sum >= 22:
    print("bust")
else:
    print("win")
N=input()
N=int(N)
S=input()
count=0
for i in range(N):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    count=count+1
print(count)
    

### FIXED CODE ###

N=input()
N=int(N)
S=input()
count=0
for i in range(N-2):
  if S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
    count=count+1
print(count)
N =input()
A =list(map(input().split()))
l =[0*N]
for i in A:
  A[i]+=1
print(l, sep ="\n")


### FIXED CODE ###

N =int(input())
A =list(map(int,input().split()))
l =[0]*N
for i in A:
  l[i-1]+=1
print(*l,sep="\n")
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ai = -1
bi = -1
answer = 0
t_sum = 0
if sum(a) + sum(b) <= k:
    print(n + m)
elif sum(a) <= k:
    t_sum = sum(a)
    ai = n-1
    while True:
        bi += 1
        if t_sum + b[bi] > k:
            break
        t_sum += b[bi] 
    bi -= 1
    answer = ai + bi + 2
    while ai >= 0:
        t_sum -= a[ai]
        ai -= 1
        while bi <= m:
            bi += 1
            if t_sum + b[bi] > k:
                break
            t_sum += b[bi]
        bi -= 1
        if ai + bi +2 > answer:
            answer = ai + bi +2
    print(answer)
else:
    while True:
        ai += 1
        if t_sum + a[ai] > k:
            break
        t_sum += a[ai] 
    ai -= 1
    while True:
        bi += 1
        if t_sum + b[bi] > k:
            break
        t_sum += b[bi] 
    bi -= 1
    answer = ai + bi + 2
    while ai >= 0:
        t_sum -= a[ai]
        ai -= 1
        while bi <= m:
            bi += 1
            if t_sum + b[bi] > k:
                break
            t_sum += b[bi]
        bi -= 1
        if ai + bi +2 > answer:
            answer = ai + bi +2
    print(answer)

### FIXED CODE ###

n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ai = -1
bi = -1
answer = 0
t_sum = 0
if sum(a) + sum(b) <= k:
    print(n + m)
elif sum(a) <= k:
    t_sum = sum(a)
    ai = n-1
    while True:
        bi += 1
        if bi == m:
            break
        if t_sum + b[bi] > k:
            break
        t_sum += b[bi] 
    bi -= 1
    answer = ai + bi + 2
    while ai >= 0:
        t_sum -= a[ai]
        ai -= 1
        while bi <= m-1:
            bi += 1
            if bi == m:
                break
            if t_sum + b[bi] > k:
                break
            t_sum += b[bi]
        bi -= 1
        if ai + bi +2 > answer:
            answer = ai + bi +2
    print(answer)
else:
    while True:
        ai += 1
        if t_sum + a[ai] > k:
            break
        t_sum += a[ai]
    ai -= 1
    while True:
        bi += 1
        if bi == m:
            break
        if t_sum + b[bi] > k:
            break
        t_sum += b[bi]
    bi -= 1
    answer = ai + bi + 2
    while ai >= 0:
        t_sum -= a[ai]
        ai -= 1
        while bi <= m-1:
            bi += 1
            if bi == m:
                break
            if t_sum + b[bi] > k:
                break
            t_sum += b[bi]
        bi -= 1
        if ai + bi +2 > answer:
            answer = ai + bi +2
    print(answer)
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
x,y=[(a[0]-b[0])*t[0],(a[1]-b[1])*t[1]]
#print(x,y,abs(x)<abs(y))
#exit()
if x+y==0:
    print("infinity")
elif (x<0 and y<0) or (x>0 and y>0):
    print(0)
elif (x<0 and x+(x+y)>0) or (x>0 and x+(x+y)<0):
    print(1)
elif x<0 and x+y>0:
    print((abs(x)//(x+y))*2+[0,1][abs(x)%(x+y)>1])
elif x<0 and x+y<0:
    print((y//abs(x+y))*2)
elif x<0 and x+y<0:
    print((y//abs(x+y))*2)
elif x>0 and x+y<0:
    print((x//abs(x+y))*2+[0,1][x%abs(x+y)>0])
else:
    print(hhh)

### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
x=int(input())
if x==0:
  print('1')
  else:
    print('0')

### FIXED CODE ###

x=int(input())
if x==0:
  print('1')
else:
  print('0')
import math

N = int(input())
l = [int(x) for x in list(str(N))]

if X%sum(l) == 0:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

import math

N = int(input())
l = [int(x) for x in list(str(N))]

if N%sum(l) == 0:
    print('Yes')
else:
    print('No')
import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
tb = [[0]*mc]*mc
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [m.start() for m in re.finditer(b[0], a[ai])]
  for i in ind:
    if(ans):
      break
    for bi in range(1, mc):
      if(a[ai+bi][i:i+mc] != b[bi]):
        break
      if(bi==mc-1):
        ans = True
if(ans):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import re
n,m = map(int, input().split())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(m)]

mc = n-m+1
ans = False
for ai in range(0, mc):
  if(ans):
    break
  ind = [x.start() for x in re.finditer(b[0], a[ai])]
  if(m==1)and(len(ind)>0):
    ans=True
    break  
  for i in ind:
    if(ans):
      break
    for bi in range(1, m):
      if(a[ai+bi][i:i+m] != b[bi]):
        break
      if(bi==m-1):
        ans = True
        break
if(ans):
  print('Yes')
else:
  print('No')
import math

r=int(input())

s=r*r*math.pi
l=2*r*math.pi

print(s,l,sep=" ")



### FIXED CODE ###

import math

r=float(input())

s=r*r*math.pi
l=2*r*math.pi

print(s,l,sep=" ")
input = sys.stdin.readline




def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())



mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact



def serch(x, count):
    #print("top", x, count)
            

    for d in directions:
        nx = d+x
        #print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1 
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)  
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)    
                 
    return count

N=II()

t=acinput()
a=acinput()

st = [[] for i in range(N)]
st[0]=[t[0],t[0]]
for i in range(1,N):
    if t[i-1]<t[i]:
        st[i]=[t[i],t[i]]
    else:
        st[i]=[1,st[i-1][1]]
        

sa = [[] for i in range(N)]
sa[N-1] = [a[N-1], a[N-1]]
for i in reversed(range(N-1)):
    if a[i] > a[i+1]:
        sa[i] = [a[i], a[i]]
    else:
        sa[i] = [1,sa[i+1][1]]

def diff(x):
    return x[1]-x[0]
res=1
for i in range(N):
    
    x=max(sa[i])-min(st[i])+1
    y=max(st[i])-min(sa[i])+1
    #print(x,y,np.diff(sa))
    if x<=0 or y<=0:
        res=0
        break
    res=res* min(x,y,diff(sa[i])+1,diff(st[i])+1)
    res=res%mod
    
print(res%mod)

#print(st)
#print(sa)


### FIXED CODE ###

import sys


input = sys.stdin.readline




def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())



mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact



def serch(x, count):
    #print("top", x, count)
            

    for d in directions:
        nx = d+x
        #print(nx)
        if np.all(0 <= nx) and np.all(nx < (H, W)):
            if field[nx[0]][nx[1]] == "E":
                count += 1 
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)  
                continue
            if field[nx[0]][nx[1]] == "#":
                field[nx[0]][nx[1]] = "V"
                count = serch(nx, count)    
                 
    return count

N=II()

t=acinput()
a=acinput()

st = [[] for i in range(N)]
st[0]=[t[0],t[0]]
for i in range(1,N):
    if t[i-1]<t[i]:
        st[i]=[t[i],t[i]]
    else:
        st[i]=[1,st[i-1][1]]
        

sa = [[] for i in range(N)]
sa[N-1] = [a[N-1], a[N-1]]
for i in reversed(range(N-1)):
    if a[i] > a[i+1]:
        sa[i] = [a[i], a[i]]
    else:
        sa[i] = [1,sa[i+1][1]]

def diff(x):
    return x[1]-x[0]
res=1
for i in range(N):
    
    x=max(sa[i])-min(st[i])+1
    y=max(st[i])-min(sa[i])+1
    #print(x,y,np.diff(sa))
    if x<=0 or y<=0:
        res=0
        break
    res=res* min(x,y,diff(sa[i])+1,diff(st[i])+1)
    res=res%mod
    
print(res%mod)

#print(st)
#print(sa)
s=input()
print(max(s.index("Z"))-min(s.index('A')))

### FIXED CODE ###

s=input()
print(s.rfind("Z")-s.find("A")+1)
K = int(input())
if K % 2 == 0:
    print(int((K / 2) ** 2))
else:
    print(int11((K // 2) * (K // 2 + 1)))


### FIXED CODE ###

K = int(input())
if K % 2 == 0:
    print(int((K / 2) ** 2))
else:
    print(int((K // 2) * (K // 2 + 1)))
def check(lis,k,mid):
	for i in lis:
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=0,max(lis)
ans=b
while(a<=b):
	mid=(a+b)//2
	if(check(lis,k,mid)):
		ans=mid
		b=mid-1
	else:
		a=mid+1
print(ans)



### FIXED CODE ###

def check(lis,k,mid):
	for i in lis:
		if(i%mid==0):
			k+=1
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=1,max(lis)
ans=b
while(a<=b):
	mid=(a+b)//2
	if(check(lis,k,mid)):
		ans=mid
		b=mid-1
	else:
		a=mid+1
print(ans)
h, n = input().split;
h = int(h);
n = int(n);

A = list(map(int, input().split()));

if sum(A) > h:
  print("No");
else:
  print("Yes");

### FIXED CODE ###

h, n = input().split();
h = int(h);
n = int(n);

A = list(map(int, input().split()));

if sum(A) >= h:
  print("Yes");
else:
  print("No");
from scipy.special import comb

x, y = map(int,input().split())

if not((x + y) % 3 == 0):
    print(0)
elif (x > 2*y) or (y > 2 * x):
    print(0)
else:
    k = (x + y) // 3
    i = x - k
    print(comb(k, i, exact=True) % (10 ** 9 + 7))


### FIXED CODE ###


# Python3 function to  
# calculate nCr % p 
def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 


x, y = map(int,input().split())

if not((x + y) % 3 == 0):
    print(0)
elif (x > 2*y) or (y > 2 * x):
    print(0)
else:
    k = (x + y) // 3
    i = x - k
    print(ncr(k, i, 10 ** 9 + 7))
import sys
from collections import deque
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    con = [[] for i in range(N)]
    ans = [0] * N

    for _ in range(N - 1):
        p, c = map(int, input().split())
        con[p-1].append(c-1)
        con[c-1].append(p-1)

    for _ in range(Q):
        p, v = map(int, input().split())
        ans[p-1] += v

    stacks = deque()
    stacks.append((0, -1))

    while stacks:
        stack = stacks.pop()
        node, parent = stack[0], stack[1]

        children = con[node]
        for child in children:
            if child == parent:
                continue
            ans[child] += ans[node]
            stacks.append((child, node))

    print(*ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

n = int(input())
s = input()

if n >= 3200:
  print(s)
else:
  print('red')
a,b,h=map(int,input().split())
print(int((a+b)*h/2))



### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
N=input()
T,A=map(int,raw_input().split())
H=map(int,raw_input().split())

temp=[[abs(T-H[i]*0.006-A),i+1] for i in range(N)]
temp.sort()
print temp[0][2]


### FIXED CODE ###

N=input()
T,A=map(int,raw_input().split())
H=map(int,raw_input().split())

temp=[[abs(T-H[i]*0.006-A),i+1] for i in range(N)]
temp.sort()
print temp[0][1]
def num_2n(i):
    count = 0
    while(i % 2 == 0):
        i = i / 2
        count += 1
    return count



def main():
    num_ans = int(input())
    ans_list = list(map(int, input().split()))
    num_2n_list =[]
    for i in ans_list:
        num_2n_list.append(num_2n(i))
    num_2n_list.sort()
    num_2n_list.reverse()
    print(num_2n_list)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    ans_list = list(str(input().split()))
    print(ans_list.count("1"))


if __name__ == '__main__':
    main()
import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    H = math.ceil(N/4)
    for h in range(H, 10000):
        if flag == True:
            break
        
        N_ = math.ceil((N*h)/(h*4-N)) 
        for n in range(N_, 10000):
            if flag == True:
                break
            
            if (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
            

### FIXED CODE ###

import math

N = int(input())

if N%2 == 0:
    print(N, N, N//2)
    
else:
    flag = False
    
    for h in range(1, 3501):
        if flag == True:
            break
        
        for n in range(1, 3501):
            if flag == True:
                break
            
            if ((n*(h*4-N)-N*h) > 0) and (N*h*n)%(n*(h*4-N)-N*h) == 0:
                print(h, n, (N*h*n)//(n*(h*4-N)-N*h))
                flag = True
import sys
a,b,c=map(float,input().split())/100
a=int(a*100)
ans=[0]*b
if c>b-2:
    for i in range(int(b*100)):
        d=(0.01*i+0.01)*b-0.01
        ans[i]=int((a*d)/b)-a*(int(d/b))
        if c<d:
            break
else :
    for i in range(int(c*100)):
        ans[i]=int((a*(i+1))/b*100)-a*(int((i+1)/b*100))
print(max(ans))

### FIXED CODE ###


import math
 
def f(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)
 
A,B,N = map(int,input().split())
 
if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
 
if a!=3 && b!=3:
  c = 3
elif a!=2 && b!=2:
  c = 2
elif a!=1 && b!=1:
  c = 1
  
print("{}".format(c))

### FIXED CODE ###

c = [1,2,3]

a = int(input())
b = int(input())

c.remove(a)
c.remove(b)

print(c[0])
while tmp > 0:
    sum += tmp % 10
    tmp /= 10

if n % sum == 0:
    print "Yes"
else:
    print "No"

### FIXED CODE ###

n =int(input())

s=eval("+".join(str(n)))
if n % s ==0:
  print('Yes')
else:
  print('No')
#d-even relation
#ふかさ優先探索の実装
#再起関数の実装を行う
n=int(input())
visitedlist=[-1 for  i in range(n)]
lists=[tuple(map(int,input().split())) for i in range(n-1)]
kilist=[[] for i in range(n)]
for i in lists:
    kilist[i[0]-1].append([i[1],i[2]])
    kilist[i[1]-1].append([i[0],i[2]])   
anslist=[0 for i in range(n)]
#開始地点1のところは0を基準としている
#1には初めに訪れる
def search(i):
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        if flag>0:    
            for k in kilist[i-1]:
              search(k[0])   	
        else:
            pass

search(3)
for i in anslist:
  print(i%2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(2)
for i in anslist:
    print(i%2)
import sys
def f(j):
  if j==0:return 0
  if j<0: return 100000
  if dp[j]!=-1:return dp[j]
  f_k=[f(j-l-1)+abs(h[j]-h[j-l-1]) for l in range(k)]
  dp[j]=min(f_k)
  return dp[j]
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[-1]*n
sys.setrecursionlimit(1000000000000)
print(f(n-1))


### FIXED CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
from functools import lru_cache
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())


n,k = inpl()
h = inpl()
dp = [INF] * (n)
dp[0] = 0
for i in range(min(n,k)):
    dp[i] = abs(h[i] - h[0])
for i in range(n - k):
    option=[dp[i+j]+abs(h[i+k]-h[i+j]) for j in range(k)]
    dp[i + k] = min(option)
print(dp[n - 1])
a,b,c=input().split()
if max(a,b,c)=7 and mean(a,b,c)=5 and min(a,b,c)=5:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

A = list(map(int, input().split()))
A =sorted(A)
if A[0]==5 and A[1]==5 and A[2]==7:
  print("YES")
else:
  print("NO")
import sys
import  math
import fractions
from collections import defaultdict
import copy
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

K=int(input())
mod_l=[0]*(K*10)
mod_l[0]=7%K
mod_k=7%K
ans=1
for i in range(10*K):
    if(mod_l[i]==0):
        print(ans)
        sys.exit(0)
    mod_k=(mod_k*10)%K   
    if(mod_k==0):
        print("-1")
        sys.exit(0)
    mod_l[i+1]=(mod_l[i]+mod_k)%K
    ans+=1

print(ans)

### FIXED CODE ###

import sys
import  math
import fractions
from collections import defaultdict
import copy
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

K=int(input())
mod_l=[0]*(K*10)
mod_l[0]=7%K
mod_k=7%K
ans=1
for i in range(10*K-1):
    if(mod_l[i]==0):
        print(ans)
        sys.exit(0)
    mod_k=(mod_k*10)%K  
    if(mod_k==0):
        print("-1")
        sys.exit(0)
    mod_l[i+1]=(mod_l[i]+mod_k)%K
    ans+=1

print("-1")
import numpy as np

hyou = [0]*100001
keisuu = np.array(list(range(0,100001)))

N =  int(input())
a_data = [int(x) for x in input().split()]
Q = int(input())
b_data = [[int(x) for x in input().split()] for _ in range(Q)]

# 数列を分類
for x in a_data:
    hyou[x] += 1
# 操作と合計
for before_value,after_value in b_data:
    # 数値の入れ替え
    hyou[after_value] = hyou[before_value] + hyou[after_value] 
    hyou[before_value] = 0

    # 合計を求めて出力
    hyou_array = np.array(hyou)
    total = np.dot(hyou_array,keisuu)




### FIXED CODE ###

hyou = [0]*100001

N =  int(input())
a_data = [int(x) for x in input().split()]
Q = int(input())
b_data = [[int(x) for x in input().split()] for _ in range(Q)]

# 数列を分類
for x in a_data:
    hyou[x] += 1
# 現段階の合計を求める。
total = 0
for i,x in enumerate(hyou):
    total += i*x

# 操作と合計
for before_value,after_value in b_data:
    total += (after_value - before_value) * hyou[before_value] 
    # 数値の入れ替え
    hyou[after_value] = hyou[before_value] + hyou[after_value] 
    hyou[before_value] = 0

    # 合計を出力
    print(total)
l,r=map(int,input().split())
c=r-l
if c>=2018:
    print(0)
else:
    for i in range(l,r-1):
        for k in range(l+1,n):
            c=2018
            if (i*k)%2019<c:
                c=(i*k)&2019
    print(c)

### FIXED CODE ###

##C
l,r=map(int,input().split())
c=(r-l)
d=2018
if c>=2018:
    print(0)
else:
    for i in range(l,r):
        for k in range(l+1,r+1):
            
            if (i*k)%2019<d:
                d=(i*k)%2019
    print(d)
n = input()
i = n % 10
if(i == 3):
  print("bon")
elif(i == 0 or i == 1 or i == 6 or i == 8):
  print("pon")
else:
  print("hon")

### FIXED CODE ###

n = int(input())
i = n % 10
if(i == 3):
  print("bon")
elif(i == 0 or i == 1 or i == 6 or i == 8):
  print("pon")
else:
  print("hon")