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

Fixed submission:
N,X = map(int,input().split())

def f(a,b) :
    if a > b :
        a,b = b,a
    if b % a == 0 :
        return 2*(b//a-1)*a + a
    else :
        return 2*(b//a)*a + f(a,b%a)
        
ans = N + f(X,N-X)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

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

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif a > b :
        return 2*b + f(b,a-b)
    else :
        return a

ans = N + f(X,N-X)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**12+1)

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

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif a > b :
        a,b = b,a
        return 2*a + f(a,b-a)
    else :
        return a

ans = N + f(X,N-X)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

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

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif a > b :
        a,b = b,a
        return 2*a + f(a,b-a)
    else :
        return a

ans = N + f(X,N-X)

print(ans)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif a > b :
        a,b = b,a
        return 2*a + f(a,b-a)
    else :
        return a

ans = N + f(X,N-X)

print(ans)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif b == 0 :
        return 0
    else :
        return ((a//b)*2-1)*b

ans = N + f(X,N-X)

print(ans)
Problem p02811 (python)

Fixed submission:
k,x=list(map(int,(input().split())))
if 500*k >= x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
k,x=map(int.input().split())
if 500*k >= x:
  print('Yes')
else:
  print('No')
Problem p04030 (python)

Fixed submission:
s= input()
 
list=[]
for i in s:
  if i == '0':
    list.append('0')
  elif i == '1':
    list.append('1')
  elif i == 'B':
    if len(list) != 0:
      list.pop(-1)
print("".join(list))

Buggy submission (verdict: Runtime Error):
s= input()
 
list=[]
for i in s:
  if i == '0':
    list.append('0')
  elif i == '1':
    list.append('1')
  elif i == 'B':
    list.pop(-1)
print(list)

Buggy submission (verdict: Runtime Error):
s= input()

list=[]
for i in s:
  if i == '0':
    list.append('0')
  elif i == '1':
    list.append('1')
  elif i == 'B':
    list.remove(-1)
print(list)
Problem p02690 (python)

Fixed submission:
import sys
INF = 10**9
sys.setrecursionlimit(INF)
import math


def main():
    x, = map(int, open(0).read().split())

    """
    x=a^5-b^5=(a-b)(a^4+a^3b+a^2b^2+ab^3+b^4)
    x//(a-b)=int>0
    a-b>0
    x=O(a^4)
    """

    for i in range(-1000, 1000 + 1):
        for j in range(-i + 1, i):
            if i**5 - j**5 == x:
                a = i
                b = j
                break

    ans = f'{a} {b}'
    print(ans)
    return(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
INF = 10**9
sys.setrecursionlimit(INF)
import math


def main():
    x, = map(int, open(0).read().split())

    """
    x=a^5-b^5=(a-b)(a^4+a^3b+a^2b^2+ab^3+b^4)
    x//(a-b)=int>0
    a-b>0
    """

    tmp_a = round(x**(1 / 5))
    for i in range(-tmp_a * 2, tmp_a * 2 + 1):
        tmp_bbbbb = i**5 - x
        # print(i, i**5 - x, tmp_bbbbb)
        is_b_positive = True
        if tmp_bbbbb < 0:
            tmp_bbbbb *= -1
            is_b_positive = False
        tmp_b = tmp_bbbbb**(1 / 5)
        if tmp_b == int(tmp_b):
            a = i
            tmp_b = int(tmp_b)
            if is_b_positive:
                b = tmp_b
            else:
                b = -tmp_b
            break

    ans = f'{a} {b}'
    print(ans)
    return(ans)


if __name__ == '__main__':
    main()
Problem p02936 (python)

Fixed submission:
from collections import deque

n, q = [int(i) for i in input().split()]

tree = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = [int(i) for i in input().split()]
    tree[a].append(b)
    tree[b].append(a)

counter = [0] * (n+1)
for _ in range(q):
    p, x = [int(i) for i in input().split()]
    counter[p] += x

queue = deque([[0,1]])
while queue:
    parent, node = queue.popleft()
    for leaf in tree[node]:
        if leaf == parent:
            continue
        counter[leaf] += counter[node]
        queue.append([node, leaf])

print(*counter[1:])

Buggy submission (verdict: Runtime Error):

n, q = [int(i) for i in input().split()]

ab = []
for i in range(n-1):
    ab.append([int(i) for i in input().split()])

px = []
for i in range(q):
    px.append([int(i) for i in input().split()])

graph = [[] for _ in range(n+1)]
for a, b in ab:
    graph[a].append(b)
    graph[b].append(a)

counter = [0] * (n+1)

for p, x in px:
    counter[p] += x

def count(node, parent=0):
    for leaf in graph[node]:
        if leaf == parent:
            continue
        counter[leaf] += counter[node]
        count(leaf, node)

count(1)

for counter_i in counter[1:]:
    print(counter_i, end=" ")

Buggy submission (verdict: Runtime Error):


n, q = [int(i) for i in input().split()]

ab = []
for i in range(n-1):
    ab.append([int(i) for i in input().split()])

px = []
for i in range(q):
    px.append([int(i) for i in input().split()])

tree = {}
for a, b in ab:
    if a in tree.keys():
        tree[a].append(b)
    else:
        tree[a] = [b]

counter = [0] * (n+1)

for p, x in px:
    counter[p] += x

def count(node):
    if node in tree.keys():
        for leaf in tree[node]:
            counter[leaf] += counter[node]
            count(leaf)

count(1)

for counter_i in counter[1:]:
    print(counter_i, end=" ")

Buggy submission (verdict: Runtime Error):


n, q = [int(i) for i in input().split()]

ab = []
for i in range(n-1):
    ab.append([int(i) for i in input().split()])

px = []
for i in range(q):
    px.append([int(i) for i in input().split()])

tree = {}
for a, b in ab:
    if a in tree.keys():
        tree[a].append(b)
    else:
        tree[a] = [b]

counter = [0] * (n+1)

def count(p, x):
    counter[p] += x
    if p in tree.keys():
        for leaf in tree[p]:
            count(leaf, x)

for p, x in px:
    count(p, x)

for counter_i in counter[1:]:
    print(counter_i, end=" ")
Problem p02960 (python)

Fixed submission:
MOD = 10**9 + 7

def main():
    s = [int(in_i) if in_i != '?' else -1 for in_i in list(open(0).read())[:-1]]
    n = len(s)

    cnt = [0] * 13
    if s[0] == -1:
        for j in range(10):
           cnt[j] = 1
    else:
        cnt[s[0]] = 1

    for cur_s in s[1:]:
        dp = [0] * 26
        for i in range(13):
            dp[i*10%13] = cnt[i] % MOD
        dp[13:] = dp[:13]

        if cur_s == -1:
            for i in range(13):
                cnt[i] = sum(dp[i+4:i+14])
        else:
            for i in range(13):
                cnt[i] = dp[i+13-cur_s]

    ans = cnt[5] % MOD
    print(ans)
    return()

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7

def main():
    s = open(0).read()[:-1][::-1]
    n = len(s)

    prev = [0] * n
    if s[0] == '?':
        for j in range(10):
            prev[j] = 1
    else:
        prev[int(s[0])] = 1

    mod13 = [1, 10, 9, 12, 3, 4]
    for i, cur_s in enumerate(s[1:], start=1):
        next = [0] * n
        if cur_s == '?':
            for j in range(10):
                remain = j * mod13[i % 6] % 13
                for k in range(13):
                    next[(k + remain) % 13] += prev[k]
        else:
            remain = int(cur_s) * mod13[i % 6] % 13
            for k in range(13):
                next[(k + remain) % 13] += prev[k]
        prev = [cur_next % MOD for cur_next in next]

    ans = prev[5] % MOD
    print(ans)
    return()

if __name__ == '__main__':
    main()
Problem p03006 (python)

Fixed submission:
import sys
import collections

n = int(input())
xy = []
for _ in range(n):
    xy.append([int(i) for i in input().split()])
xy.sort()

if len(xy) == 1:
    print(1)
    sys.exit()

cost_list = []
for i in range(n):
    for j in range(i,n):
        if i == j:
            continue
        x_sub = xy[j][0] - xy[i][0]
        y_sub = xy[j][1] - xy[i][1]
        cost_list.append('{},{}'.format(x_sub, y_sub))

cost_dic = collections.Counter(cost_list)
#print(cost_dic)
zero_cost_num = max(cost_dic.values())
#print(zero_cost_num)
ans = n - zero_cost_num

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import collections

n = int(input())
xy = []
for _ in range(n):
    xy.append([int(i) for i in input().split()])
xy.sort()

cost_list = []
for i in range(n):
    for j in range(i,n):
        if i == j:
            continue
        x_sub = xy[j][0] - xy[i][0]
        y_sub = xy[j][1] - xy[i][1]
        cost_list.append('{},{}'.format(x_sub, y_sub))

cost_dic = collections.Counter(cost_list)
#print(cost_dic)
zero_cost_num = max(cost_dic.values())
#print(zero_cost_num)
ans = n - zero_cost_num

print(ans)
Problem p03007 (python)

Fixed submission:
import sys
import collections

n = int(input())
a = sorted([int(i) for i in input().split()])
# print(a)
top = a.pop(-1)

nega = sorted([i for i in a if i < 0])
posi = sorted([i for i in a if i >= 0])
#print(nega,posi)

if len(nega) == 0:
    nega.append(posi.pop(0))

process = []

for _ in range(len(posi)):
    x = nega.pop(0)
    y = posi.pop(0)
    nega.append(x - y)
    process.append([x, y])
x = top
y = nega.pop(0)
process.append([x, y])
x -= y
for _ in range(len(nega)):
    y = nega.pop(0)
    process.append([x, y])
    x -= y
ans = x

print(ans)
for i in range(len(process)):
    print('{} {}'.format(process[i][0], process[i][1]))

Buggy submission (verdict: Runtime Error):
import sys
import collections

n = int(input())
a = sorted([int(i) for i in input().split()])
# print(a)
top = a.pop(-1)

nega = sorted([i for i in a if i < 0])
posi = sorted([i for i in a if i > 0])
#print(nega,posi)

if len(nega) == 0:
    nega.append(posi.pop(0))

process = []

for _ in range(len(posi)):
    x = nega.pop(0)
    y = posi.pop(0)
    nega.append(x - y)
    process.append([x, y])
x = top
y = nega.pop(0)
process.append([x, y])
x -= y
for _ in range(len(nega)):
    y = nega.pop(0)
    process.append([x, y])
    x -= y
ans = x

print(ans)
for i in range(len(process)):
    print('{} {}'.format(process[i][0], process[i][1]))

Buggy submission (verdict: Runtime Error):
import sys
import collections

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

nega = sorted([i for i in a if i < 0])
posi = sorted([i for i in a if i > 0])
#print(nega,posi)

if len(posi) > 0:
    top = posi.pop(-1)
else:
    top = nega.pop(-1)
if len(nega) == 0:
    nega.append(posi.pop(0))

process = []

for _ in range(len(posi)):
    x = nega.pop(0)
    y = posi.pop(0)
    nega.append(x - y)
    process.append([x, y])
x = top
y = nega.pop(0)
process.append([x, y])
x -= y
for _ in range(len(nega)):
    y = nega.pop(0)
    process.append([x, y])
    x -= y
ans = x

print(ans)
for i in range(len(process)):
    print('{} {}'.format(process[i][0], process[i][1]))
Problem p03078 (python)

Fixed submission:
x,y,z,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)

d = []
for i in a:
  for j in b:
    d.append(i+j)
d.sort(reverse = True)
d = d[:k]

e = []
for i in c:
  for j in d:
    e.append(i+j)
e.sort(reverse = True)

e = e[:k]

for i in e:
  print(i)

Buggy submission (verdict: Runtime Error):
x,y,z,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

'''
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
'''

sum = []

for i in a:
  for j in b:
    for k in c:
      sum.append(i+j+k)
      
sum.sort(reverse=True)

for i in range(k):
  print(sum[i])
Problem p03087 (python)

Fixed submission:
n,q = [int(i) for i in input().split()]
s = input()
l = []
r = []
for i in range(q):
  l_tmp, r_tmp = [int(j) for j in input().split()]
  l.append(l_tmp-1)
  r.append(r_tmp-1)
  
ac_cnt = s.count('AC')
r_cnt = [ac_cnt]
l_cnt = [0]
for i in range(1,n):
  if s[i-1:i+1] == 'AC':
    r_cnt.append(r_cnt[i-1]-1)
    l_cnt.append(l_cnt[i-1]+1)
  else:
    r_cnt.append(r_cnt[i-1])
    l_cnt.append(l_cnt[i-1])
    
for i in range(q):
  ans = r_cnt[l[i]] + l_cnt[r[i]] - ac_cnt
  print(ans)

Buggy submission (verdict: Runtime Error):
n,q = [int(i) for i in input().split()]
s = input()
ac_loc = []
for i in range(n):
  if s[i] =='A':
    if s[i+1] == 'C':
      ac_loc.append(i)
      i+=1 

for i in range(q):
  l, r = [int(j) for j in input().split()]
  l -= 1
  r -= 1
  ans = sum((l<=j and j+1<=r) for j in ac_loc)
  print(ans)
Problem p03112 (python)

Fixed submission:
from bisect import bisect

a, b, q = [int(i) for i in input().split()]
s = []
for i in range(a):
	s.append(int(input()))
s = [-float('inf')] + s + [float('inf')]
t = []
for i in range(b):
	t.append(int(input()))
t = [-float('inf')] + t + [float('inf')]
x = []
for i in range(q):
	x.append(int(input()))

for xx in x:
  
  s_i = bisect(s,xx)
  s_r = abs(xx - s[s_i])
  s_l = abs(xx - s[s_i-1])
  t_i = bisect(t,xx)
  t_r = abs(xx - t[t_i])
  t_l = abs(xx - t[t_i-1])

  
  #print(s_l,s_r,t_l,t_r)
  
  #l = max(s_l,t_l)
  #r = max(s_r,t_r)
  if s_l <= t_l:
    l = t_l
    lr = s_l*2 + t_r
  else:
    l = s_l
    lr = t_l*2 + s_r
  if s_r <= t_r:
    r = t_r
    rl = s_r*2 + t_l
  else:
    r = s_r
    rl = t_r*2 + s_l
 
  ans = min(l,r,lr,rl)
  print(ans)

Buggy submission (verdict: Runtime Error):
def search(x,r):
  low = 0
  high = len(r)-1
  mid = (low+high)//2
  while low<=high:
    rr = r[mid]-x
    ll = r[mid+1]-x
    if rr*ll<=0:
      return(abs(rr),abs(ll))
    elif r[mid]-x > 0:
      high = mid
      mid = (low+high)//2
    else:
      low = mid
      mid = (low+high)//2
      

a, b, q = [int(i) for i in input().split()]
s = []
for i in range(a):
	s.append(int(input()))
t = []
for i in range(b):
	t.append(int(input()))
x = []
for i in range(q):
	x.append(int(input()))

for xx in x:

  s_l = float('inf')
  s_r = float('inf')
  if s[-1] - xx <= 0:
    s_l = abs(s[-1] - xx)
  elif s[0] - xx >= 0:
    s_r = abs(s[0] - xx)
  else:
  	s_l,s_r=search(xx,s)
  
  t_l = float('inf')
  t_r = float('inf')
  if t[-1] - xx <= 0:
    t_l = abs(t[-1] - xx)
  elif t[0] - xx >= 0:
    t_r = abs(t[0] - xx)
  else:
  	t_l,t_r=search(xx,t)
  
  #print(s_l,s_r,t_l,t_r)
  
  #l = max(s_l,t_l)
  #r = max(s_r,t_r)
  if s_l <= t_l:
    l = t_l
    lr = s_l*2 + t_r
  else:
    r = s_l
    lr = t_l*2 + s_r
  if s_r <= t_r:
    r = t_r
    rl = s_r*2 + t_l
  else:
    r = s_r
    rl = t_r*2 + s_l
 
  ans = min(l,r,lr,rl)
  print(ans)

Buggy submission (verdict: Runtime Error):
def search(x,r):
  low = 0
  high = len(r)-1
  mid = (low+high)//2
  while low<=high:
    rr = r[mid]-x
    ll = r[mid+1]-x
    if rr*ll<=0:
      return(abs(rr),abs(ll))
    elif r[mid]-x > 0:
      high = mid
      mid = (low+high)//2
    else:
      low = mid
      mid = (low+high)//2
      

a, b, q = [int(i) for i in input().split()]
s = []
for i in range(a):
	s.append(int(input()))
t = []
for i in range(b):
	t.append(int(input()))
x = []
for i in range(q):
	x.append(int(input()))

for xx in x:

  s_l = float('inf')
  s_r = float('inf')
  if s[-1] - xx <= 0:
    s_l = abs(s[-1] - xx)
  elif s[0] - xx >= 0:
    s_r = abs(s[0] - xx)
  else:
  	s_l,s_r=search(xx,s)
  
  t_l = float('inf')
  t_r = float('inf')
  if t[-1] - xx <= 0:
    t_l = abs(t[-1] - xx)
  elif t[0] - xx >= 0:
    t_r = abs(t[0] - xx)
  else:
  	t_l,t_r=search(xx,t)
  
  #print(s_l,s_r,t_l,t_r)
  
  #l = max(s_l,t_l)
  #r = max(s_r,t_r)
  if s_l <= t_l:
    l = t_l
    lr = s_l*2 + t_r
  else:
    r = s_l
    lr = t_l*2 + s_r
  if s_r <= t_r:
    r = t_r
    rl = s_r*2 + t_l
  else:
    r = s_r
    lr = t_r*2 + s_l
 
  ans = min(l,r,lr,rl)
  print(ans)
Problem p03192 (python)

Fixed submission:
N = input()

count = N.count('2')

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np

args = [int(i) for i in input().split()]
N = args[0]
P = args[1]

num = 1
i = 2

count = 0
while True:
    if P % i == 0:
        P /= i
        count += 1
    else:
        x = count // N
        num *= i**x
        break

i = 3
while True:
    count = 0
    while True:
        if P % i == 0:
            P /= i
            count += 1
        else:
            x = count // N
            num *= i**x
            i += 2
            break
    if i**N > P:
        break

print(num)
Problem p02677 (python)

Fixed submission:
import numpy as np
from math import cos, pi
a,b,h,m = map(int, input().split()) 

mangle = 2*pi * (m/60)
hangle = 2*pi * (h/12) + (1/6)*pi*(m/60)
dist = np.sqrt(a**2+b**2 - 2*a*b*cos(mangle- hangle))
print(dist)

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import cos, pi
a,b,h,m = map(int, input().split()) 

mangle = 2*pi * (m/60)
hangle = 2*pi * (h/12)
dist = np.sqrt(a**2+b**2 - 2*a*b*cos(magnle- hangle))
print(dist)
Problem p02675 (python)

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

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

if n in [2, 4, 5, 7, 9];
  print("hon")
elif n in [0, 1, 6, 8];
  print("pon")
else;
  print("bon")

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

if 0 < a < 10;
  a = a 
elif 9 < a < 100;
  a = a % 10
else;
  a = a % 100
  
if a = 3;
  print("bon")
elif a = 0 or a = 1 or a = 6 or a = 8;
  print("pon")
else;
  print("hon")
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
 
if (A + B)%2 == 0:
  k = (A + B)/2
  print(round(k))
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
N = int(input())
k = 0
lis = list(range(1, N+1))
for i in range(1, N+1):
  a = int(input())
  if a == lis[i-1]:
    k += 10
  else:
    k += 0
if k >= 10 * (N-2):
  print('YES')
else:
  print('NO')

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

if A > B:
  for i in range(A):
    k = abs(A-i)
    l = abs(B-i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')

if A < B:
  for in in range(B):
    k = abs(A-i)
    l = abs(B-i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
, B = map(int, input().split())
 
if A > B:
  for i in range(A):
    k = abs(A - i)
    l = abs(B - i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')
if A < B:
  for i in range(B):
    k = abs(A - i)
    l = abs(B - i)
    if k == l:
      print(i)
  else:
    print('IMPOSSIBLE')

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

if abs(A - K) == abs(B - K):
  print(K)
else:
  print('IMPOSSIBLE')
Problem p02969 (python)

Fixed submission:
i = int(input())
out = 3*i*i
print(out)

Buggy submission (verdict: Runtime Error):
i = input()
out = 3*i*i
print(out)
Problem p03493 (python)

Fixed submission:
a, b, c = map(int, input())
k = 0
for i in a, b, c:
  if i == 1:
      k += 1
  else:
      pass
print(k)

Buggy submission (verdict: Runtime Error):
string = list(int(input()))

if string[0] + string[1] + string[2] == 0:
  print(0)
elif string[0] + string[1] + string[2] == 1:
  print(1)
else:
  print(2)

Buggy submission (verdict: Runtime Error):
a, b, c = map(str, input())

if '1' * 1 in a, b, c:
  print('1')
elif '1' * 2 in a, b, c:
  print('2')
else:
  print('3')
Problem p03494 (python)

Fixed submission:
N = int(input())
lis = list(map(int, input().split()))

cnt = 0
while True:
  li_yojo = [a % 2 for a in lis]
  if li_yojo.count(0) != N:
    break
  else:
    lis = [ a / 2 for a in lis ]
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=input().split()
a2=[int(z) for z in a]
count=0
while True:
  sub=0
  for i in range(n):
    if a2[i]%2!=0:
      break
    else:
      sub+=1
  if sub==n:
    ount+=1
    a2=[int(a2[d]/2) for d in range(n)]
  else:
    break
print(count)
Problem p02675 (python)

Fixed submission:
h = [2,4,5,7,9]
p = [0,1,6,8]
b = [3]

n = int(input())

n = n % 10

if n in h:
  print('hon')
elif n in p:
  print('pon')
elif n in b:
  print('bon')

Buggy submission (verdict: Runtime Error):
h = [2,4,5,7,9]
p = [0,1,6,8]
b = [3]

n = input()

n = n % 10

if n in h:
  print 'hon'
elif n in p:
  print 'pon'
elif n in b:
  print 'bon'
Problem p02677 (python)

Fixed submission:
import math
s = input().split()
a = int(s[0])
b = int(s[1])
h = int(s[2])
m = int(s[3])
th = 30*h + m/2
tm = 6*m
#print(j)
j = math.cos(math.radians(abs(th-tm)))
#print(j)
x = a**2 + b**2 -(2*a*b*j)
x = math.sqrt(x)
print(x)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
a, b, h, m = input().split()
x = a**2 + b**2 -(2*a*b*cos(((m-5*h)/60)*math.pi))
x = np.sqrt(x)
print(x)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()

count = 0
for i in range(n-2):
  if s[i] == "A":
    if s[i+1] == "B":
      if s[i+2] == "C":
      	count += 1
print(count)

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

count = 0
for i in range(n):
  if s[i] == "A":
    if s[i+1] == "B":
      if s[i+2] == "C":
        count += 1
print(count)
Problem p02813 (python)

Fixed submission:
import itertools

n = int(input())
p_list = tuple(map(int, input().split()))
q_list = tuple(map(int, input().split()))

seq = [i for i in range(1,n+1)]
seq_list = list(itertools.permutations(seq))
sorted_seq = sorted(seq_list)

for i in range(len(sorted_seq)):
  if p_list == sorted_seq[i]:
    a = i
  if q_list == sorted_seq[i]:
    b = i
print(abs(a - b))

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
p_list = tuple(map(int, input().split()))
q_list = tuple(map(int, input().split()))

seq = [i for i in range(1,n+1)]
seq_list = list(itertools.permutations(seq))
sorted_seq = sorted(seq_list)

for i in range(1, len(sorted_seq)):
  if p_list == sorted_seq[i]:
    a = i
  if q_list == sorted_seq[i]:
    b = i
print(abs(a - b))

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
p_list = tuple(map(int, input().split()))
q_list = tuple(map(int, input().split()))

seq = [i for i in range(1,n+1)]
seq_list = list(itertools.permutations(seq))
sorted_seq = sorted(seq_list)

for i in range(1, len(sorted_seq)):
  if p_list == sorted_seq[i]:
    a = i
    print(a)
  if q_list == sorted_seq[i]:
    b = i
    print(b)
print(abs(a - b))
Problem p02817 (python)

Fixed submission:
s, t = input().split()

print("{}{}".format(t, s))

Buggy submission (verdict: Runtime Error):
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)
for i in range(k):
  if a >= 1:
    a -= 1
  elif b >= 1:
    b -= 1
  else:
    continue
    
print("{} {}".format(a, b))
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

one =  W * (H-y)
two = x * H
three = 0
same = 0
if x==0 and y==0:
  three = (W*H)/2
if x==W and y==H:
  three = (W*H)/2
if x==0 and y==H:
  three = (W*H)/2
if x==W and y==0:
  three = (W*H)/2

if W == H:
  if x==y:
    three = (W*H)/2
  elif x==(W+1)-y:
    three = (W*H)/2
  

if x == W/2 and y == H/2:
  same = 1

print(max(one, two, three), same)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
same=0
if x == W/2 and y == H/2:
  same = 1
print(W*H/2, same)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
if x == W/2 and y == H/2:
  same = 1
print(W*H/2, same)