Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02582 (python)

Fixed submission:
text = input()
if text[1] == "S":
    if text[0] == "R" or text[2] == "R":
        print(1)
    else:
        print(0)
else:
    if text[0] == "R" and text[2] == "R":
        print(3)
    elif text[0] == "R" or text[2] == "R":
        print(2)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
text = input()
if text[1] == "S":
	if text[0] == "R" or text[2] == "R":
    	print(1)
    else:
        print(0)
else:
    if text[0] == "R" and text[2] == "R":
    	print(3)
    elif text[0] == "R" or text[2] == "R":
        print(2)

Buggy submission (verdict: Runtime Error):
    text = input()
    if text[1] == "S":
        if text[0] == "R" or text[2] == "R":
            print(1)
        else:
            print(0)
    else:
        if text[0] == "R" and text[2] == "R":
            print(3)
        elif text[0] == "R" or text[2] == "R":
            print(2)
Problem p02767 (python)

Fixed submission:
n = int(input())

xs = list(map(int, input().split()))

l = min(xs)
r = max(xs)

costs = []
for i in range(1, 100):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))

Buggy submission (verdict: Runtime Error):
n = int(input())

xs = list(map(int, input().split()))

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))

Buggy submission (verdict: Runtime Error):
n = int(input())

xs = list(map(int, input().split()))

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)
    print(cost)

print(min(costs))

Buggy submission (verdict: Runtime Error):
n = int(input())

xs = list(map(int, input().split()))

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) ** 2
    costs.append(cost)

print(min(costs))
Problem p02684 (python)

Fixed submission:
import sys

N, K = map(int, input().split())
A = list(map(int, input().split()))

i = 1
l = [1] * N
s = set([1])
n = 1
while True:
    n = A[n-1]
    if n in s:
        l = l[:i]
        mod = i - l.index(n)
        init_len = l.index(n)
        break
    else:
        l[i] = n
        s.add(n)
        i += 1

if K < init_len:
    print(l[K])
else:
    rest = ((K-init_len) % mod)
    print(l[init_len+rest])

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.readlines()
N, M, X = map(int, lines[0].split())
A = []
C = []

for i in range(N):
    line = list(map(int, lines[i+1].split()))
    A.append(line[1:])
    C.append(line[0])

# return []
def full_search():
    costs = []
    for i in range(2**N):
        vals = [0] * M
        cost = 0

        # iを二進数に直して扱う。それぞれのビットがn冊目の本を買うかどうかに匹敵。
        for j in range(N):
            # ビットを移動しながらn冊目の本を買う際のコストと経験値を計算する
            if ((i >> j) & 1):
                # 現在の組み合わせに対して
                # 全てのアルゴリズム分を計算
                cost += C[j]

                # 全てのアルゴリズム(m)に対して経験値を求める
                for m in range(M):
                    vals[m] += A[j][m]

        combination_ok = True
        for m in range(M):
            if vals[m] >= X:
                continue
            else:
                combination_ok = False
                break

        if combination_ok:
            costs.append(cost)
    return costs

costs = full_search()
if len(costs) == 0:
    print(-1)
else:
    print(min(costs))
Problem p02713 (python)

Fixed submission:
import sys, os, math

def get_cd(n):
    cd = []
    for i in range(1, int(n/2)+1):
        if n % i == 0:
            cd.append(i)
        else:
            continue
    cd.append(n)
    return cd

def get_gcd(a, b, c, cd_d):
    if 1 in [a, b, c]:
        return 1
    else:
        cd = sorted(list(set(cd_d[a]) & set(cd_d[b]) & set(cd_d[c])))
        return cd[-1]

if __name__ == '__main__':
    k = int(input())
    cc_d = {}
    for i in range(1, k+1):
        cc_d[i] = get_cd(i)

    computed_d = {}
    s = 0
    for a in range(1, k+1):
        for b in range(a, k+1):
            for c in range(b, k+1):
                if a == b == c:
                    s += a
                else:
                    gcd = get_gcd(a, b, c, cc_d)
                    if a != b != c:
                        s += gcd*6
                    else:
                        s += gcd*3
    print(s)

Buggy submission (verdict: Runtime Error):
    import sys, os, math
     
    def get_cd(n):
        cd = []
        for i in range(1, int(n/2)+1):
            if n % i == 0:
                cd.append(i)
            else:
                continue
        cd.append(n)
        return cd
     
    def get_gcd(a, b, c, cd_d):
        if 1 in [a, b, c]:
            return 1
        else:
            cd = sorted(list(set(cd_d[a]) & set(cd_d[b]) & set(cd_d[c])))
            return cd[-1]
     
    if __name__ == '__main__':
        k = int(input())
        cc_d = {}
        for i in range(1, k+1):
            cc_d[i] = get_cd(i)
     
        computed_d = {}
        s = 0
        for a in range(1, k+1):
            for b in range(a, k+1):
                for c in range(b, k+1):
                    if a == b == c:
                        s += a
                    else:
                        gcd = get_gcd(a, b, c, cc_d)
                        if a != b != c:
                            s += gcd*6
                        else:
                            s += gcd*3
        print(s)
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:k]))

Buggy submission (verdict: Runtime Error):
a=input();print(sum(list(map(int,input().split()))[:int(a[2])]))
Problem p02719 (python)

Fixed submission:
n,k=map(int,input().split())
a=n-k*(-((k-n)//k))
print(min(a,abs(a-k)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=n-k*(-((k-n)//k))
print(min(a,abs(a-k))
Problem p02755 (python)

Fixed submission:
def main():
  a,b=map(int, input().split())
  for i in range(1251):
    if int(i*0.08)==a and int(i*0.1)==b:
      return i
  return -1
  
if __name__ == '__main__':
  print(main())

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for _ in range(q):
  t = input()
  if t[0]=='1':
    s = s[::-1]
  else:
    if t[2]=='1':
      s = t[4:] + s
    else:
      s = s + t[4:]
print(s)
Problem p02911 (python)

Fixed submission:
N, K, Q = map(int, input().split())
points = [K] * N
for _ in range(Q):
    a = int(input())
    points[a-1] +=1

for point in points:
    if point > Q:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
points = [K] * N
for _ in range(Q):
    a = int(input())
    points[a] +=1

for point in points:
    if point > Q:
        print('Yes')
    else:
        print('No')
Problem p02983 (python)

Fixed submission:
# ume 20/03/18

def main():
  l,r=map(int,input().split())
  if r-l>2018:
    return 0
  else:
    c=2019
    for i in range(l,r):
      for j in range(i+1,r+1):
        c=min(c,i*j%2019)
        if c==0: return c
    return c

if __name__ == '__main__':
  print(main())

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
s=range(l,r+1)[:2019]
print(min(i*j%2019for i in s for j in s if i<j
Problem p03043 (python)

Fixed submission:
import math
e=0
n, k = map(int, input().split())
for i in range(1,n+1):
  m = math.ceil(math.log2(k/i))
  e += 1*(m<1) or 2**-m
print(e/n)

Buggy submission (verdict: Runtime Error):
from math import *
n,k=map(int,input().split())
e=0
for i in range(1,n+1):
  t=ceil(log2(k/i))
  e+=1*(m<1)or 2**-t
print(e/n)
Problem p03071 (python)

Fixed submission:
a, b = map(int, input().split())
print(max(a,b)+max(max(a,b)-1, min(a,b)))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split.())
print(max(a,b)+max(max(a,b)-1, min(a,b)))
Problem p03110 (python)

Fixed submission:
otosidama=0.0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama)

Buggy submission (verdict: Runtime Error):
otosidama=0
for i in range(int(input())):
  x, u = input().split()
  otosidama += float(x) if u=='JPY' else float(x)*380000.0
  
print(otosidama
Problem p03136 (python)

Fixed submission:
_,*l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])

Buggy submission (verdict: Runtime Error):
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[sum(l[:-1])<=l[-1]::2])

Buggy submission (verdict: Runtime Error):
_,l=map(int,open(0).read().split())
l.sort()
print("YNeos"[::sum(l[:-1])<=l[-1]])
Problem p03160 (python)

Fixed submission:
# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(hs[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
# 検証のためのACの人のパクリですごめんなさい
N = int(input())
hs = [i for i in map(int, input().split())]

INF = 10*12
dp = [INF]*N

dp[0] = 0
dp[1] = abs(ha[0]-hs[1])
for i in range(2, N):
  dp[i] = min(dp[i-1] +abs(hs[i]-hs[i-1]), dp[i-2] +abs(hs[i]-hs[i-2]))
print(dp[-1])
Problem p03210 (python)

Fixed submission:
print("YNEOS"[~(input()in"357")%2::2])

Buggy submission (verdict: Runtime Error):
print("YNEOS"[~input()in"357"%2::2]
Problem p03212 (python)

Fixed submission:
N = int(input())

def dfs(s, res):
  if int(s) > N:
    return 0
  res = +all((t in s)for t in '753')
  for i in '753':
    res += dfs(s+i, res)
  return res

print(dfs('0', 0))

Buggy submission (verdict: Runtime Error):
N = int(input())

def dfs(s, res):
  if int(s) > N:
    return
  res = +all((t in s)for t in '753')
  for i in '753':
    res += dfs(s+i, res)
  return res

print(dfs('0', 0))
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = int(input())
print((n-1)*(m-1))
Problem p02658 (python)

Fixed submission:
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  res = 0
  print(res)
  sys.exit()
  
res = 1
for i in range(n):
  if(res > pow(10,18)):
    break
  else:
    res = res * a[i]
if(res > pow(10,18)):
   res = -1
print(res)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(res)
  sys.exit()
res = 1

for i in range(n):
  if(res > pow(10,18)):
    res = -1
    break
  else:
    res = res * a[i]
print(res)

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
a = list(map(int,input().split()))
if 0 in a:
  print(res)
  sys.exit()
res = 1
for i in range(n):
  res = res * a[i]
  if(res > pow(10,18)):
    res = -1
print(res)
Problem p02687 (python)

Fixed submission:
a = input()
if(a == "ABC"):
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
a = input()
if(a == "ABC"):
  input("ARC")
else:
  input("ABC")
Problem p02705 (python)

Fixed submission:
import math
r = int(input())
h = 2 * r * math.pi
print(h)

Buggy submission (verdict: Runtime Error):
import math

r = int(input())

h = R * R * math.pi

print(h)
Problem p02742 (python)

Fixed submission:
import math
h,w = map(int,input().split())
w1 = int(w/2)
h1 = int(h/2)
w2 = int(w/2)
h2 = int(h/2)
if ( w % 2 != 0 ):
  w1 += 1
if ( h % 2 != 0 ):
  h1 += 1
res = h1 * w1 + h2 * w2
if (h == 1 or w == 1):
  print(1)
else:
  print(res)

Buggy submission (verdict: Runtime Error):
import numpy as np
h,w = map(int,input().split())
bi = np.zeros((h, w))
for i in range(h):
  if(i % 2 != 0 ):
    for j in range(w):
      if(j % 2 != 0):
        bi[i][j] = 1
      else:
        bi[i][j] = 0
  else:
    for k in range(w):
      if(k % 2 == 0):
        bi[i][k] = 1
      else:
        bi[i][k] = 0
print(np.count_nonzero(bi))
Problem p02600 (python)

Fixed submission:
x = int(input())

if x>= 400 and x<=599:
    print('8')
    
elif x>= 600 and x<= 799:
    print('7')
    
elif x>= 800 and x<= 999:
    print('6')
    
elif x>= 1000 and x<= 1199:
    print('5')
    
elif x>= 1200 and x<= 1399:
    print('4')
    
elif x>= 1400 and x<= 1599:
    print('3')
    
elif x>= 1600 and x<= 1799:
    print('2')

elif x>= 1800 and x<= 1999:
    print('1')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if B <= A:
       
        B *= 2
        
    elif C <= B:
       
        C *= 2
        
    else:
       
        C *= 2
        
if A < B and B < C:
    print('Yes')
    
else:
    print('No')
Problem p02582 (python)

Fixed submission:
def A(S):
    answer = 0

    if S[1] == 'R':
        answer += 1
        if S[0] == 'R':
            answer += 1
        if S[2] == 'R':
            answer += 1
    elif S[0] == 'R' or S[2] == 'R':
        answer = 1

    return answer

  
S = input()
print(A(S))

Buggy submission (verdict: Runtime Error):
def A(S):
    answer = 0

    if S[1] == 'R':
        answer += 1
        if S[0] == 'R':
            answer += 1
        if S[2] == 'R':
            answer += 1
    elif S[0] == 'R' or S[2] == 'R':
        answer = 1

    return answer

  
 print(A(input()))
Problem p02784 (python)

Fixed submission:
import sys
 
 
hp, length = [int(v) for v in input().split(' ')]
damages = sorted([int(d) for d in input().split(' ')])
 
 
for d in reversed(damages):
    hp -= d
    if hp <= 0:
        print('Yes')
        sys.exit(0)

print('No')

Buggy submission (verdict: Runtime Error):
import math


hp, length = [int(v) for v in input().split(' ')]
damages = sorted([int(d) for d in input().split(' ')])


if damages[-1] + damages[-2] >= hp:
    print('yes')
else:
    print('no')
Problem p02755 (python)

Fixed submission:
A,B = map(int,input().split())
i=1
while i<=10000:
  if (int(i * 0.08) == A) & (int(i * 0.10) == B):
    print(i)
    exit()
  i+=1
print(-1)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
while i<=10000:
  if (int((i*0.08)==A)) and (int((i*0.1)==B)):
    print(i)
    exit()
  i+=1
print(-1)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())

i=0
while i<10000:
  if A*0.08==i and B*0.1==i:
    print(i)
    quit()
print(-1)
Problem p02995 (python)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())
l = C * D // gcd(C, D)
x = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // l
y = B - B // C - B // D + B // l
print(y - x)

Buggy submission (verdict: Runtime Error):
import math

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

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

LCM=lcm(C,D)

Cwari=(B//C)-((A-1)//C)
Dwari=(B//D)-((A-1)//D)
CDwari=(B//LCM)-(A//LCM)

print((B-A+1)-(Cwari+Dwari-CDwari))
Problem p03000 (python)

Fixed submission:
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
bow=0
cnt=1
for i in range(0,N):
    bow+=List[i]
    if bow>X:
        break
    else:
        cnt+=1

print(cnt)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
i=0
bow=0
while bow<=X:
    bow+=List[i]
    i+=1
print(i)
Problem p03035 (python)

Fixed submission:
# coding: utf-8
# Your code here!
A, B = map(int, input().split())

if A>=13:
    print(B)
elif A<=5:
    print(0)
else:
    print(B//2)

Buggy submission (verdict: Runtime Error):
A,B=map(int, input().split())
if A<5:
    print(0)
elif A<12:
    print(B/2)
else:
    print(B
Problem p02628 (python)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
    exit()

if n==k and k==len(p):
        print(sum(p))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
else:
    if n==k and k==len(p):
        print(sum(p))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
elif n==k:
    print(sum(p))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
    exit()

if n==k:
    print(sum(p))
Problem p02658 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)#小さい順に計算することで処理時間短縮
f=A[0]
for i in range(1,N):
    f*=A[i]
    if f>10**18:
        print(-1)
        exit()
            
print(f)

Buggy submission (verdict: Runtime Error):
N=int(input())
s=input().split()

if s[0]*s[1]>10**18:
    print(s[0]*s[1])
else:
    print("-1")
Problem p02963 (python)

Fixed submission:
s=int(input());l=10**9;n=0--s//l;print(0,0,1,l,n,n*l-s)

Buggy submission (verdict: Runtime Error):
import sys
S=sys.stdin.readline().strip()
A=["0","0"]
if int(S)<=10**9:
    A.extend([S,"0","0","1"])
    print(" ".join(A))
else:
    for i in range(2,10**9):
        for j in range(2,10**9):
            T=S-i*j
            if T==0:
               A.extend([str(i),"0","0",str(j)])
               print(" ".join(A))
               exit()
Problem p02584 (python)

Fixed submission:
[X,K,D]=list(map(int, input().split()))
abx=round(abs(X))
n=round(abx//D)
if n>K:
    ans=abx-K*D
else:
    x2=abx-n*D
    x1=(n+1)*D-abx
    if x2>=x1:
        if (K-n-1)%2==0:
            ans=x1
        else:
            ans=x2
    else:
        if (K-n)%2==0:
            ans=x2
        else:
            ans=x1
print(ans)

Buggy submission (verdict: Runtime Error):
[X,K,D]=list(map(int, input().split()))
abx=int(abs(X))
n=abx//D
if n>K:
    if X>0:
        ans=X-K*D
    else:
        ans=X+K*D
else:
    x2=abx-n*D
    x1=(n+1)*D-abx
    if x2>=x1:
        if n+1<=K:
            if (K-n-1)%2==0:
                ans=x1
            else:
                ans=x2
    else:
        if (K-n)%2==0:
            ans=x2
        else:
            ans=x1
print(ans)

Buggy submission (verdict: Runtime Error):
[X,K,D]=list(map(int, input().split()))
n=abs(X)//D
abx=abs(X)
if n>K:
    if X>0:
        ans=X-K*D
    else:
        ans=X+K*D
else:
    x2=abx-n*D
    x1=(n+1)*D-abx
    if x2>=x1:
        if n+1<=K:
            if (K-n-1)%2==0:
                ans=x1
            else:
                ans=x2
    else:
        if (K-n)%2==0:
            ans=x2
        else:
            ans=x1
print(ans)
Problem p02608 (python)

Fixed submission:
import math as m
N=int(input())
ans=[0]*N
if N>5:
    for x in range(1,int(m.sqrt(N-5))+1):
        for y in range(1,x+1):
            if x**2+y**2+x*y+x+y+1>N:
                break
            for z in range(1,y+1):
                if x**2+y**2+x*y+x*z+y*z+z**2>N:
                    break
                if len(list(set([x,y,z])))==3:
                    ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=6
                elif len(list(set([x,y,z])))==2:
                    ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=3
                elif len(list(set([x,y,z])))==1:
                    ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=1

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
import math as m
import time
N=int(input())
ans=[0]*N
for x in range(1,int(m.sqrt(N-5))+1):
    for y in range(1,x+1):
        if x**2+y**2+x*y+x+y+1>N:
            break
        for z in range(1,y+1):
            if x**2+y**2+x*y+x*z+y*z+z**2>N:
                break
            if len(list(set([x,y,z])))==3:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=6
            elif len(list(set([x,y,z])))==2:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=3
            elif len(list(set([x,y,z])))==1:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=1

for a in ans:
    print(a)

Buggy submission (verdict: Runtime Error):
import math as m
import time
N=int(input())
ans=[0]*N
for x in range(1,int(m.sqrt(N-5))+1):
    for y in range(1,x+1):
        if x**2+y**2+x*y+x+y+1>N:
            break
        for z in range(1,y+1):
            if x**2+y**2+x*y+x*z+y*z+z**2>N:
                break
            if len(list(set([x,y,z])))==3:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=6
            elif len(list(set([x,y,z])))==2:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=3
            elif len(list(set([x,y,z])))==1:
                ans[x**2+y**2+x*y+x*z+y*z+z**2-1]+=1

for a in ans:
    print(a)
Problem p02639 (python)

Fixed submission:
xlist=list(map(int, input().split()))
i=xlist.index(0)
print(i+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
alist=list(map(int, input().split()))

alist.sort()
#print(alist)
ans=0
for i in range(1,N):
    a=alist[i]
    aaa=[a]*i
    x=np.array(aaa)
    y=np.array(alist[0:i])
    amari=x%y
    if list(amari).count(0)==1:
        ans+=1
print(ans)
Problem p02675 (python)

Fixed submission:
n=int(input())
m=n%10
if m in [2, 4,5,7,9]:
    print('hon')
elif m in [0,1,6,8]:
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
abhm=tuple(map(float, input().split()))
a=abhm[0]
b=abhm[1]
h=abhm[2]
m=abhm[3]

import math as mt

pi=mt.pi
print(pi)

c=pi*(h+m/60)/6
d=pi*m/30

print(mt.sqrt((a*mt.cos(c)-b*mt.cos(d))**2+(a*mt.sin(c)-b*mt.sin(d))**2))
Problem p02813 (python)

Fixed submission:
import itertools as itool
N=int(input())
plist=list(map(int, input().split()))
qlist=list(map(int, input().split()))
mylist=list(itool.permutations(range(1,N+1)))

print(abs(mylist.index(tuple(plist))-mylist.index(tuple(qlist))))

Buggy submission (verdict: Runtime Error):
import itertools as itool
N=int(input())
plist=list(map(int, input().split()))
qlist=list(map(int, input().split()))
mylist=list(itool.permutations(range(1,n+1)))
print(abs(mylist.index(p)-mylist.index(q)))
Problem p02784 (python)

Fixed submission:
H,N=map(int,input().split())
A=list(map(int,input().split()))
a=sum(A)
if H<=a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=[map(int,input().split())]
a=sum(A)
if H<=a:
  print("Yes")
else:
  print("No")
Problem p02946 (python)

Fixed submission:
k,x=map(int,input().split())
a=x-k+1
b=x+k-1
a=max(a,-1000000)
b=min(b,1000000)
c=[k for k in range(a,b+1)]
for i in c:
  print('%d '%i),

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
a=x-k+1
b=x+k-1
a=max(a,-1000000)
b=min(b,1000000)
c=[k for k in range(a,b+1)]
c=' '.join(c)
print(c)

Buggy submission (verdict: Runtime Error):
k,x=map(int,input().split())
a=x-k+1
b=x+k-1
a=min(a,-1000000)
b=max(b,1000000)
c=range(a,b+1)
c=' '.join(c)
print(c)
Problem p02995 (python)

Fixed submission:
def gcd(x,y):
	x, y = max(x,y), min(x,y)
	while(y):
		x, y = y, x%y
	return x
A,B,C,D = map(int,input().split())
A -= 1
CD = C*D // gcd(C,D)
a = A - (A//C + A//D - A//CD)
b = B - (B//C + B//D - B//CD)
print(b-a)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
A -= 1
CD = C*D // math.gcd(C,D)
a = A - (A//C + A//D - A//CD)
b = B - (B//C + B//D - B//CD)
print(b-a)
Problem p02999 (python)

Fixed submission:
x, a = map(int,input().split())
if x < a:
	print(0)
else:
	print(10)

Buggy submission (verdict: Runtime Error):
x,a = int(input.split())
if x < a:
	print(0)
else:
	print(10)