Harryxun/stf_run huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  dp=[0]*110

  dp[1]=0
  dp[2]=abs(l[0]-l[1])
  for i in range(2,n):
    dp[i+1]=min(dp[i]+abs(l[i]-l[i-1]),dp[i-1]+abs(l[i]-l[i-2]))

  return dp[n]

print(main())


### FIXED CODE ###

class struct:
  def __init__(self,a,b):
    self.a=a
    self.b=b

n=int(input())
l=list(map(int,input().split()))

l2=[struct(0,0) for _ in range(n)]
l2[0].a=l[0]
l2[1].a=l[1]
l2[1].b=abs(l[0]-l[1])

i=2
for x in l[2:]:
  l2[i].a=x
  l2[i].b=min(abs(l2[i-2].a-x)+l2[i-2].b,
    abs(l2[i-1].a-x)+l2[i-1].b)
  i+=1

print(l2[-1].b)
n,a,b=map(int,input().split())
    
if n==1:    
    if a==b:
        print(1)
    else:
        print(0)
elif n==2:
    if b<a:
        print(0)
    else:
        print(1)
else:
    if b<a:
        print(0)
    elif a==b:
        print(1)
    else:
        print(sum(list(range(b-a+2))[::-1][:n-2]))

### FIXED CODE ###

n,a,b=map(int,input().split())
if b<a:
    print(0)
elif n==1:
    if a==b:
        print(1)
    else:
        print(0)
else:
    print( a+b*(n-1) - (a*(n-1)+b) +1 )
def main():
    N = int(input())
    lst = [input().split()for i in range(N)]
    Y = 0

    for i in range(0, N):
        if str(lst[i][1]) == "JPY":
            Y += float(lst[i][0])
        else:
            Y += float(lst[i][0])*380000.0
    print(Y)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import datetime
    s = str(input())
    S = datetime.datetime.strptime(s, "%Y/%m/%d")
    if(S <= datetime.datetime(2019, 4, 30)):
        print("Heisei")
    else:
        print("TBD")


if __name__ == "__main__":
    main()
L,M=map(int,input().split())
import numpy as np
a=np.zeros((L,M))
count=0
for i in range(L):
    for j in range(M):
        syuui=0
        a=[[i-1,j-1],[i-1,j],[i-1,j+1],[i,j-1],[i,j],[i,j+1],[i+1,j-1],[i+1,j],[i+1,j+1]]
        for k in a:
            if 0<=k[0] and k[0]<L and k[1]>=0 and k[1]<M:
                syuui+=1
        if syuui%2==1:
            count+=1
print(count)

### FIXED CODE ###

L,M=map(int,input().split())
count=0
if L==1 and M==1:
    print(1)
elif L==1 or M==1:
    print(L+M-3)
if L==2 or M==2:
    print(0)
if L>=3 and M>=3:
    print((L-2)*(M-2))
s=input()
ans = 0
for c in s:
  if c=="1"
    ans+=1
print(ans)

### FIXED CODE ###

s=input()
ans = 0
for c in s:
  if c=="1":
    ans+=1
print(ans)
n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            h = 0
            same = True
            for p in points:
                h_p = abs(x - p[0]) + abs(y - p[1]) + p[2]
                if h != 0 and h != h_p:
                    same = False
                    break
                elif h == 0:
                    h = h_p
            if same:
                return x, y, h

ans = (0,0,0)
ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))

### FIXED CODE ###

n = int(input())
points = []
for i in range(n):
    x, y, h = map(int, input().split())
    points.append((x, y, h))
points.sort(key=lambda x:x[2], reverse=True)


def f(points):
    for x in range(0, 101):
        for y in range(0, 101):
            p = points[0]
            h = abs(x - p[0]) + abs(y - p[1]) + p[2]
            same = True
            for i in range(1, len(points)):
                p = points[i]
                h_p = max(0, h - abs(x - p[0]) - abs(y - p[1]))
                if h_p != p[2]:
                    same = False
                    break
            if same:
                return x, y, h
    return -1,-1,-1


ans = f(points)
print("{} {} {}".format(ans[0], ans[1], ans[2]))
j = [2,3,4,5,6,7,8,9,10,11,12,13,1]
a,b = [int(x) for x in input().split()]
if j.rindex(a) < j.rindex(b):
  print('Alice')
elif j.rindex(a) > j.rindex(b):
  print('Bob')
else:
  print('Draw')

### FIXED CODE ###

a,b = [int(x) for x in input().split()]
j = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if j.index(a) > j.index(b):
  print('Alice')
elif j.index(a) < j.index(b):
  print('Bob')
else:
  print('Draw')
import math
N, M = list(map(int, input().split()))
S = input()
T = input()
d = math.gcd(N,M)
n = N//d
m = M//d
for i in range(d):
    if S[i*n] != T[i*m]:
        flag = False
        break
    else:
        flag = True
if flag:
  print((N*M)//d)
else:
  print(-1)

### FIXED CODE ###

import fractions
N, M = list(map(int, input().split()))
S = input()
T = input()
d = fractions.gcd(N,M)
n = N//d
m = M//d
for i in range(d):
    if S[i*n] != T[i*m]:
        flag = False
        break
    else:
        flag = True
if flag:
  print((N*M)//d)
else:
  print(-1)
import math

def getMax(arr):
    maxValue = max(list(arr))
    maxIndex = list(arr).index(maxValue)

    return maxIndex,maxValue


def getSum(arr):
    return sum(list(arr))

def calculate(arr,n):
    if n == 0:
        return getSum(arr)
    else:
        index,value = getMax(arr)
        if value == 0:
            return value
        n -= 1
        arr[index] = math.floor(value/2)
        return calculate(arr,n)

S = input().split(' ')
m = int(S[0])
n = int(S[1])

T = input().split(' ')
arr = list(map(int, list(T)))


result = calculate(arr,n)
print(result)

### FIXED CODE ###

import heapq

S = input().split(" ")
N = int(S[0])
M = int(S[1])
S = input()

arr = [-int(s) for s in S.split(" ")]

heapq.heapify(arr)

for i in range(M):
    maxValue = -heapq.heappop(arr)
    heapq.heappush(arr,-(maxValue//2))

print(-sum(arr))
s = list(input())
N = len(s)
c=0
for i in range(N-1):
  if s[i] != s[N-1-i]:
    c+=1

for i in range(N-1):
  if s[i] != s[(N-1)/2-1-i]:
    c+=1
    
for i in range(N-1):
  if s[(N+3)/2-1+i] != s[N-1-i]:
    c+=1

if c == 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

s = list(input())
n = (len(s)+1)//2
if s[:n-1] == s[len(s):n-1:-1] == s[n-2::-1]:
  print("Yes")
else:
  print("No")
a, b = input().split(' ')
print (a * b)

### FIXED CODE ###

arr = input().split(' ')
a = int(arr[0])
b = int(arr[1])
print (a * b)
N = int(input())
A = list[int(input().split()) for i in range(N)]
dif = 0
sum = 0

for i in range(N - 1):
  if A[i] > A[i +1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
  else:
    
print(sum)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
dif = 0
sum = 0

for i in range(N - 1):
  if A[i] > A[i + 1]:
    dif = A[i] - A[i + 1]
    sum += dif
    A[i +1] = A[i + 1] + dif
    
print(sum)
w, h, n = map(int,input().split())

y_min = 0
y_max = h

x_min = 0
x_max = w

for i in range(n):
  x, y, a = map(int,input().split())

  if a == 1:
    x_min = max(x_min, x)

  if a == 2:
    x_max = min(x_max, x)

  if a == 3:
    y_min = max(y_min, y)

  if a == 4:
    y_max = min(y_max, y)

white = (y_max - y_min) * (x_max - x_min)
if (y_max - y_min)>=0 and (x_max - x_min)>=0:
  print(max(white, 0))
else:
  print(0)

### FIXED CODE ###

s=input()

ans=0
bef=s[0]
for i in s[1:]:
  if bef!=i:
    ans+=1
  bef=i
print(ans)
print(int(r*r))

### FIXED CODE ###

x = int(input())
print(x**2)
import numpy as np

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

N, M, C = getInt()
B = list(getInt())
ans = 0
for i in range(N):
  A = list(getInt())
  if sum([a*b for a,b in zip(A,B)]) + C > 0:
    ans += 1
print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

res = (H-h)*(W-w)

print(res)
import sys

def plus_and_check(lines):
c, d = lines.split()
number = c + d
return len(str(number))

a = []
for line in sys.stdin:
    a.append(int(line))

answer = []
for i in range(len(a)):
    answer = plus_and_check(a[i])

for i in range(len(answer)):
    print answer[i]

### FIXED CODE ###

import sys

a = []
answer_array = []
for line in sys.stdin:
    a.append(map(int, line.strip().split()))
    #except StopIteration:
        #break

for i in range(len(a)):
    sum_up = a[i][0] + a[i][1]

    answer = len(str(sum_up))

    answer_array.append(answer)

for j in range(len(answer_array)):
    print answer_array[j]
cnt = 0
def s(start, end):
    global cnt
    if(start==len(S)-1):
        return 
    numS = int(S[start:end+1])
    if(numS%2019==0):
        cnt += 1
    if(end==len(S)-1):
        end = start+2
        s(start+1, end)
        return
    s(start, end+1)

if __name__ == '__main__':
    S = input()
    s(0, 1)
    print(cnt)

### FIXED CODE ###

S = list(map(int, list(input())))[::-1]
N = len(S)
CNT = [0]*2019
CNT[0] = 1
num = 0
d = 0
for i in range(N):
    num += S[i]*pow(10, d, 2019)
    num %= 2019
    CNT[num] += 1
    d += 1
ans = 0 
for cnt in CNT:
    ans += (cnt*(cnt - 1)) // 2
print(ans)
n=int(input())
dat = list(map(int, input().split()))
dan = []
for e in dat:
    e = str(bin(e))
    e=e[2:]
       
for i in range(n):
      j = -1
     while j > -len(dat[i]):
          if dat[i][j]=='1':
               dan.append(-j-1)
               break
          else:
               j = j - 1
           
print(min(das))



### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
X = input().split(" ")
print(f"{X[2]} {X[0]} {X[1]}")

### FIXED CODE ###

a, b, c = input().split()
print(c, a, b)
try: 
	x,y=map(int,input().split())
except Exception:
 	exit(100)
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+4Ω00000)
else:
	print(fun(x)+fun(y))

### FIXED CODE ###

x,y=map(int,input().split())
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+400000)
else:
	print(fun(x)+fun(y))
n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
aa = a.copy()
bb = b.copy()

aa = [sum(a[:s+1]) for s in range(n)]
bb = [sum(b[:s+1]) for s in range(m)]
      
temp, ans = 0, 0
j = m - 1

for i in range(n):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    temp = i+1 + j+1
    if temp > ans:
        ans = temp
        
print(ans)


### FIXED CODE ###

n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
aa = [0]
bb = [0]

for s in range(n):
    aa.append(aa[s] + a[s])
for s in range(m):
    bb.append(bb[s] + b[s])      
ans = 0
j = m

for i in range(n+1):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)  

### FIXED CODE ###

n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  i = -1
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

k = 8000
def foo(fe,x,ev):
    n = len(fe)
    d = [ [False]*(2*k+1) for i in range(n+1) ]
    d[0][k] = True
    d[1][fe[0]+k] = True
    if not ev:
        d[1][-fe[0]+k] = True
    for i in range(1,n):
        for j in range(-k,k+1):
            if d[i][j+k]:
                d[i+1][j+fe[i]+k] = True
                d[i+1][j-fe[i]+k] = True
    return d[n][x+k]

s = ins()
x,y = inm()
f = [ [], [] ]
strk = 0
turn = 0
n = len(s)
for i in range(n):
    if s[i]=='T':
        f[turn].append(strk)
        turn = 1 - turn
        strk = 0
    else:
        strk += 1
f[turn].append(strk)
if foo(f[0],x,True) and foo(f[1],y,False):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def foo(fe,x,ev):
    k = sum(fe)+1
    n = len(fe)
    d = [ [False]*(2*k+1) for i in range(n+1) ]
    d[0][k] = True
    if len(fe)>0:
        d[1][fe[0]+k] = True
        if not ev:
            d[1][-fe[0]+k] = True
    for i in range(1,n):
        for j in range(-k,k+1):
            if d[i][j+k]:
                d[i+1][j+fe[i]+k] = True
                d[i+1][j-fe[i]+k] = True
    return -k<=x<=k and d[n][x+k]

s = ins()
x,y = inm()
f = [ [], [] ]
strk = 0
turn = 0
n = len(s)
for i in range(n):
    if s[i]=='T':
        f[turn].append(strk)
        turn = 1 - turn
        strk = 0
    else:
        strk += 1
f[turn].append(strk)
if foo(f[0],x,True) and foo(f[1],y,False):
    print('Yes')
else:
    print('No')
x = int(input())
p = 2
list_prob = []
ind = 0
i = 1
while p < 11:
    ind = i ** p
    while ind < 1001:
        list_prob.append(int(i ** p))
        i += 1
        ind = i ** p
    i = 1
    p += 1
list_prob.sort()
while i < len(list_prob):
    if list_prob[i] <= x and list_prob[i+1] > x:
        print(list_prob[i])
        break
    i += 1

### FIXED CODE ###

x = int(input())
p = 2
list_prob = []
ind = 0
i = 1
while p < 11:
    ind = i ** p
    while ind < 1001:
        list_prob.append(int(i ** p))
        i += 1
        ind = i ** p
    i = 1
    p += 1
list_prob.append(1001)
list_prob.sort()
while i < len(list_prob):
    if list_prob[i] <= x and list_prob[i+1] > x:
        print(list_prob[i])
        break
    i += 1
s=input()
print("yes" if len(s)==len(set(s) else "no")

### FIXED CODE ###

s=input()
print("yes" if len(s)==len(set(s)) else "no")
A,B,C,D = map(int,input().split())
if C >= B or D <= A:
    print(0)
elif A <= C <= D <= B:
    print(D-C)
elif C <= A <= B <= D:
    print(B-A)
elif C <= B:
    print(B-C)
else:
    print(D-A)


### FIXED CODE ###

N = input()
NN = list(N)
checker = ""
for i in range(len(NN)):
    checker += NN[-i-1]
if N == checker:
    print("Yes")
else:
    print("No")
N, M = map(int,input().split())

v = list(range(1,M+1))
edges = [[] for _ in range(M+1)]
for _ in range(M):
  a, b = map(int,input().split())
  edges[a] += [b]
  edges[b] += [a]

def f(v, e):
  for x in v:
    if(len(e[x]) == 1):
      t = e[x][0]
      e[x] = []
      e[t].remove(x)
      v.remove(x)
      return f(v, e)+1
  return 0

print(dfs(v, edges))

### FIXED CODE ###

N, M = map(int,input().split())

v = [i for i in range(1,N+1)]
e = [[]]*(N+1)
for i in range(M):
  a, b = map(int,input().split())
  e[a] = e[a] + [b]
  e[b] = e[b] + [a]

def dfs(v, e):
  for num in v:
    if(len(e[num]) == 1):
      tmp_num = e[num][0]
      v.remove(num)
      e[num] = []
      e[tmp_num].remove(num)
      #print(e,v)
      return dfs(v, e)+1
  return 0
print(dfs(v, e))
import numpy as np
N = int(input())

x = np.arange(N)

print(np.sum(x))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    ans = (N+1)*(N//2)
    ans -= N
    print(ans)
else:
    x = (N+1)//2
    ans = x + x * ((N-1)//2) * 2
    ans -= N
    print(ans)
a,b,k = map(int,input().split())
lst = []
for i in range(1,101):
  if a%i==0 and b%i==0:
    lst.append(i)
print(sorted(lst)[len(lst)-k])

### FIXED CODE ###

a,b,c = map(int,input().split())
if b//a >= c:
  print(c)
else:
  print(b//a)
"""
考え方:
    頂点 n までの最大パスを, y = n である有向パスのすべての x の最大パス n' + 1 の中で最大のものから求める.
    x の最大パスが計算されていない場合は先に x の最大パスを同じ方法で求める.
    y = n となる有効パスが存在しない場合, n の最大パスは 0 とする. 有効閉路は存在しないのでループは発生しない.
    計算量は O(N + M) = O(2n) = O(n) .
    
"""


N, M = map(int, input().split())
Y = [[] for _ in range(N + 1)]
for _ in range(M):
    x, y = map(int, input().split())
    Y[y].append(x)

dp = [-1] * (N + 1)

def solve(num):
    re = 0
    if dp[num] != -1:
        # すでに計算済みのパスは再計算しない.
        re = dp[num]
    else:
        for x in Y[num]:
            if dp[x] == -1:
                dp[x] = solve(x)
            re = max(re, dp[x] + 1)
    return re

for n in range(1, N + 1):
    dp[n] = solve(n)
    print(dp)

print(max(dp))


### FIXED CODE ###

"""
考え方:
    頂点 n までの最大パスを, y = n である有向パスのすべての x の最大パス n' + 1 の中で最大のものから求める.
    x の最大パスが計算されていない場合は先に x の最大パスを同じ方法で求める.
    y = n となる有効パスが存在しない場合, n の最大パスは 0 とする. 有効閉路は存在しないのでループは発生しない.
    計算量は O(N + M) = O(2n) = O(n) .

提出1回目の反省:
    debug 用の print 外し忘れてた

提出2回目の反省:
    なぜ RE になるんじゃぁ
    -> python の最大再帰回数の問題である可能性. あんまりよくない気もするけど設定変更してみよう.
    
提出3回目の反省:
    10000 に設定してみたけどケース1_01ではじかれる. どうも設定値 - 1回目の呼び出しでエラーになるようだ.
    少し余裕をもって10020と設定.

提出4回目の反省:
    それでもケース1_01がダメ. なぜ...
    
"""

import sys
sys.setrecursionlimit(10 ** 6)


N, M = map(int, input().split())
Y = [[] for _ in range(N + 1)]
# print(len(Y), Y)
for _ in range(M):
    x, y = map(int, input().split())
    Y[y].append(x)

dp = [-1] * (N + 1)

def solve(num):
    re = 0
    if dp[num] != -1:
        # すでに計算済みのパスは再計算しない.
        re = dp[num]
    else:
        for x in Y[num]:
            if dp[x] == -1:
                dp[x] = solve(x)
            re = max(re, dp[x] + 1)
    return re

for n in range(1, N + 1):
    dp[n] = solve(n)

print(max(dp))
import sys
 
if __name__ == ‘__main__’:
    args = sys.argv
    prices = map(int, args[1:])
    min = prices[1]

    max_profit = 0
    for price in prices:
        if min > price:
            min = price
        max_profit = price - min

    return max_profit


### FIXED CODE ###

n = input()
prices = list()
for idx in range(int(n)):
    tmp = input()
    prices.append(int(tmp))

minp = prices[0]
maxv = prices[1] - prices[0]

for price in prices[1:]:
    maxv = max(maxv, price - minp)
    minp = min(minp, price)

print(maxv)
n,x,=map(int, input().split())
w_list = list(map(int, input().split()))

d=0
for i in range(n+1):
   d=d+w_list[i]
   if(d>x):
       break
print(i+1)

### FIXED CODE ###

n,x = map(int,input().split())
li = list(map(int,input().split()))
 
ans = 1
now = 0
 
for i in li:
    now += i
    if now <= x:
        ans += 1
    else:
        break
 
print(ans)
import itertools
N = int(input())
P  = list(map(int,input().split()))
Q  = list(map(int,input().split()))
per_list = [list(i) for i in itertools.permutations(range(1,N + 1))]

print(abs(per_list.index(P) - per_list(Q)))

### FIXED CODE ###

import itertools
N = int(input())
P  = list(map(int,input().split()))
Q  = list(map(int,input().split()))
per_list = [list(i) for i in itertools.permutations(range(1,N + 1))]

print(abs(per_list.index(P) - per_list.index(Q)))
S = int(input())
ls = list(str(S))
if ls[0] == ls[1] or ls[1] == ls[2] or ls[2] == ls[3]:
  print('Bad')
else:
  print('Good')

### FIXED CODE ###

#数字でも文字列として扱える。intにすると左一桁目から0がある場合存在しないものとなるので注意
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print('Bad')
else:
  print('Good')
n=input()
l=len(n)
a=[2,4,5,7,9]
b=[0,1,6,8]
if n[l-1] in a:
  print('hon')
else n[l-1] in b:
  print('pon')
else:
  print('bon')

### FIXED CODE ###

n=input()
l=len(n)
a=[2,4,5,7,9]
b=[0,1,6,8]
k=int(n[l-1])
if k in a:
  print('hon')
elif k in b:
  print('pon')
else:
  print('bon')
D,N=map(int,input().split())
print(N*(100**D)

### FIXED CODE ###

D,N=map(int,input().split())
if N==100:
  print((N+1)*(100**D))
else:
  print(N*(100**D))
import sys
import math
input = sys.stdin.readline

def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)

MOD=10**9+7
N, K = map(int, input().split())
anssub=[]
for i in range(K):
  a = C(N-K+1,i+1)%MOD
  b = C(K-1,i)%MOD
  c = a * b % MOD
  anssub.append(c)
anssub = map(str,anssub)
print('\n'.join(anssub))

#print(ans)

### FIXED CODE ###

import sys
import math
input = sys.stdin.readline

MOD=10**9+7

fac = [0] * 2001
ifac = [0] * 2001
fac[0] = 1
ifac[0] = 1

def mpow(x, n):
  ans = 1
  while n != 0:
    if n&1:
      ans = ans*x % MOD
    x = x*x % MOD
    n = n >> 1
  return ans

def comb(a, b):
  if a == 0 and b == 0:
    return 1
  if a < b or a < 0:
    return 0
  tmp = ifac[a-b]* ifac[b] % MOD
  return tmp * fac[a] % MOD


for i in range(2000):
  fac[i+1] = fac[i]*(i+1) % MOD
  ifac[i+1] = ifac[i]*mpow(i+1, MOD-2) % MOD

N, K = map(int, input().split())
anssub=[]
for i in range(K):
  a = comb(N-K+1,i+1)%MOD
  b = comb(K-1,i)%MOD
  c = a * b % MOD
  anssub.append(c)
anssub = map(str,anssub)
print('\n'.join(anssub))

#print(ans)
n, m = map(int, input().split())
t = [-1] * n
for _ in range(m):
    s, c = map(int, input().split())
    s -= 1
    if t[s] != c and t[s] != -1:
        print(-1)
        exit()
    t[s] = c

if n != 1:
    if t[0] == 0:
        print(-1)
        exit()
    for i in range(m):
        if t[i] == -1:
            t[i] = 0
    else:
        if t[0] == -1:
            t[0] = 0

print(''.join(map(str, t)))

### FIXED CODE ###

n, m = map(int, input().split())
t = [-1] * n
for _ in range(m):
    s, c = map(int, input().split())
    s -= 1
    if t[s] != -1 and t[s] != c:
        print(-1)
        exit()
    t[s] = c

if n != 1:
    if t[0] == 0:
        print(-1)
        exit()
    if t[0] == -1:
        t[0] = 1
    for i in range(n):
        if t[i] == -1:
            t[i] = 0
else:
    if t[0] == -1:
        t[0] = 0
    
print(''.join(map(str, t)))
N, M = map(int, input().split())

ac = 0
wr = 0
list = []

for _ in range(M):
    tmp = 0
    p, s = list(map(str, input().split()))
    if not(tmp == int(p)) and s == 'AC' and not int(p) in list:
      tmp = int(p)
      list.append(int(p))
      ac += 1
    elif s == 'WA' and not int(p) in list and tmp == 1:
      wr += 1

print(ac, wr)

### FIXED CODE ###

N, M = map(int, input().split())

wa = [0] * N
pnt = [0] * N
ac = [False] * N

for _ in range(M):
    p, s = list(map(str, input().split()))
    if s == 'WA':
      wa[int(p) - 1] += 1
    elif s == 'AC' and not (ac[int(p) - 1]):
      ac[int(p) - 1] = not (ac[int(p) - 1])
      pnt[int(p) - 1] += wa[int(p) - 1]

print(ac.count(True), sum(pnt))
a=int(input())
b=int(input())
if(0<=a<=9 and 0<=b<=9):
  print(a*b)
else:
  print(-1)
  

### FIXED CODE ###


a,b = list(map(int, input().split()))
  
if(1<=a<=9 and 1<=b<=9):
    print(a*b)

else:
    print(-1)
s=input()
x,y,l=0,5,len(s)
for _ in range(10**5):
  if s[x:y]=='erase':
    x=y+1 if s[y]=='r' else y
    y=x+5
  elif s[x:y]=='dream':
    x=y+2 if s[x:y+2]=='er' else y
    y=x+5
  else:
    print('NO')
    eixt()
  if y>=l:
    if y==l:
       break
    else:
      if x<l:
        print('NO')
        exit()
      else:
        break
print('YES')

### FIXED CODE ###

s=input()
x,y,l=0,5,len(s)
for _ in range(10**5):
  if x>=l-7:
    if x==l-7 and s[x:l]=='dreamer':
      print('YES')
    elif x==l-6 and s[x:l]=='eraser':
      print('YES')
    elif x==l-5 and (s[x:l]=='dream' or s[x:l]=='erase'):
      print('YES')
    else:
      print('NO')
    exit()
    
  if s[x:y]=='erase':
    x=y+1 if s[y]=='r' else y
    y=x+5
  elif s[x:y]=='dream':
    x=y if s[y:y+3]=='era' else (y+2 if s[y:y+2]=='er' else y) 
    y=x+5
  else:
    print('NO')
    exit()