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

Fixed submission:
if __name__ == '__main__':
    S = list(input())
    n = 0
    for i in S:
        if i == '+':
            n = n + 1
        else:
            n = n - 1

    print(n)

Buggy submission (verdict: Runtime Error):
#/usr/bin/env python3

import math

if __name__ == '__main__':
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    print(max(1, math.ceil((len(A) - K) / (K-1)) + 1))
Problem p03774 (python)

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

a = []
b = []
c = []
d = []

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

for j in range(M):
    x, y = map(int, input().split())
    c.append(x)
    d.append(y)

for i in range(N):
    ans = 0
    minDist = 10**8 * 2
    for j in range(M):
        dist = abs(c[j]-a[i]) + abs(d[j]-b[i]) 
        if dist < minDist:
            minDist = dist
            ans = j
        
    print(ans+1)

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

a = []
b = []
c = []
d = []

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

for j in range(M):
    x, y = map(int, input().split())
    c.append(x)
    d.append(y)

for i in range(N):
    minDist = 10**8 * 2
    for j in range(M):
        dist = abs(c[j]-a[i]) + abs(d[j]-b[i]) 
        if dist < minDist:
            minDist = dist
            ans = j
        
    print(ans+1)
Problem p03775 (python)

Fixed submission:
import math
N = int(input())
for i in range(1, int(math.sqrt(N))+1):
    if N % i == 0:
        ans = len(str(N//i))
        
print(ans)

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

Soinsuu = [1]

for i in range(2, N+1):
    while N % i == 0:
        Soinsuu.append(i)
        N = N // i
    else:
        if N == 1:
            break

Soinsuu.sort(reverse=True)

a = Soinsuu[0]
b = Soinsuu[1]

for i in Soinsuu[2:]:
    if a > b:
        b *= i
    else:
        a *= i
        
print(max(len(str(a)), len(str(b))))
Problem p03072 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split(" ")))
result = 1

for i in range(n):
  viewable = False
  for j in range(i):
    if h[j] > h[i]:
      break
    elif j == i - 1:
      viewable = True
      
  if viewable == True:
    result += 1

print("{}".format(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split(" "))
result = 1

for i in range(n):
  viewable = False
  for j in range(i):
    if h[j] > h[i]:
      break
    else if j == i - 1:
      viewable = True
  
  if viewable == True:
    result += 1
    
print("{}".format(result))
Problem p03127 (python)

Fixed submission:
from sys import stdin
from functools import reduce
import fractions
#input = stdin.readline
N = int(input())
A = list(set(map(int,input().split())))
answer = reduce(fractions.gcd, A)
print(answer)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
def gcd(number):
    return reduce(math.gcd,number)
print(gcd(A))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
N = int(input())
A = [int(i) for i in input().split()]
def gcd(number):
    return reduce(math.gcd,number)
print(gcd(A))

Buggy submission (verdict: Runtime Error):
n = int(input())
2.b = list(map(int,input().split()))
3.b.sort()
4.     
5.d = b[0] + 0
6. 
7.while len(b) > 1 :
8.    for i in range(1,len(b)) :
9.        b[i] = b[i] % b[0]
10.    if b.count(0) == len(b)-1 :
11.        d = b[0]
12.        break
13.    else :
14.        b.sort()
15.        for j in range(b.count(0)) :
16.            b.remove(0)
17.print(d)
Problem p03221 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]
p = [0 for i in range(m)]
y = [0 for i in range(m)]

out = [[0, 0] for i in range(m)]
hash = [[] for i in range(10**5+10)]
for i in range(m):
    p[i], y[i] = [int(i) for i in input().split()]
    hash[p[i]].append([y[i], i])

for i in range(len(hash)):
    hash[i] = sorted(hash[i])
    for j in range(len(hash[i])):
        out[hash[i][j][1]] = i, j+1
for i in range(len(out)):
    print("{}{}".format(str(out[i][0]).zfill(6), str(out[i][1]).zfill(6)))

Buggy submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
p = [0 for i in range(m)]
y = [0 for i in range(m)]

out = [[0, 0] for i in range(m)]
hash = [[] for i in range(10**5)]
for i in range(m):
    p[i], y[i] = [int(i) for i in input().split()]
    hash[p[i]].append([y[i], i])

for i in range(len(hash)):
    hash[i] = sorted(hash[i])
    for j in range(len(hash[i])):
        out[hash[i][j][1]] = i, j+1
for i in range(len(out)):
    print("{}{}".format(str(out[i][0]).zfill(6), str(out[i][1]).zfill(6)))
Problem p03242 (python)

Fixed submission:
n = str(input())
lis = ""
for i in range(len(n)):
    if n[i] == "1":
        lis += "9"
    else:
        lis += "1"
print(lis)

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(n):
  if n[i] == "1":
    n[i] = "9"
  else:
    n[i] = "1"
print(n)
Problem p03329 (python)

Fixed submission:
n = int(input())
paySix = []
payNine = []
i = 0
while 6**i <= n:
   paySix.append(6**i)
   i += 1
i = 0
while 9**i <= n:
   payNine.append(9**i)
   i += 1

maxCount = n
sum = 0
for j in range(n+1):
    count = 0
    count6 = 0
    count9 = 0
    nine = j
    six = n - j
    for i in reversed(range(len(payNine))):
        count9 += int(nine/payNine[i])
        nine -= int(nine/payNine[i])*payNine[i]
    # print("\ndiv target:{} 9Count:{}".format(j, count9))
    for i in reversed(range(len(paySix))):
        count6 += int(six/paySix[i])
        six -= int(six/paySix[i])*paySix[i]
    # print("div target:{} 6Count:{}".format(n-j, count6))
    maxCount = min(maxCount, count9+count6)
print(maxCount)
"""
pay = [1]
i = 1
while 6**i <= n:
   pay.append(6**i)
   i += 1
i = 1
while 9**i <= n:
   pay.append(9**i)
print(i)
pay = sorted(pay)
print(len(pay))
count = 0
for i in reversed(range(len(pay))):
    # print(i)
    count += int(n/pay[i])
    n -= int(n/pay[i])*pay[i]
    if n == 0:
        print(count)
"""
""""
for i in range(1, 100000):
    if 9 ** i < n:
        nine.append(9 ** i)
    else:
        break
for i in range(1, 100000):
    if 6 ** i < n:
        six.append(6 ** i)
    else:
        break

count = 0
last = n
while last >= 9:
    if nine:
        while nine[-1] > last:
            nine.pop()
    if six:
        while six[-1] > last:
            six.pop()

    if nine:
        tmp9 = nine[-1]
        num9 = int(last / tmp9)
    if six:
        tmp6 = six[-1]
        num6 = int(last / tmp6)

    if num9 < num6:
        count += num9
        last %= tmp9
        nine.pop()
    elif num9 == num6 and last % tmp9 <= last % tmp6:
        count += num9
        last %= tmp9
        nine.pop()
    else:
        count += num6
        last %= tmp6
        six.pop()


count += int(last / 6)
last %= 6
print(count + last)
"""

Buggy submission (verdict: Runtime Error):
n = int(input())
nine = []
six = []
i = 0
for i in range(1, 100000):
    if 9 ** i < n:
        nine.append(9 ** i)
    else:
        break
for i in range(1, 100000):
    if 6 ** i < n:
        six.append(6 ** i)
    else:
        break

count = 0
last = n
while last >= 9:
    if nine:
        while nine[-1] > last:
            nine.pop()
    if six:
        while six[-1] > last:
            six.pop()

    if nine:
        tmp9 = nine[-1]
        num9 = int(last / tmp9)
    if six:
        tmp6 = six[-1]
        num6 = int(last / tmp6)

    if num9 < num6:
        count += num9
        last %= tmp9
        nine.pop()
    elif num9 == num6 and last % tmp9 <= last % tmp6:
        count += num9
        last %= tmp9
        nine.pop()
    else:
        count += num6
        last %= tmp6
        six.pop()


count += int(last / 6)
last %= 6
print(count + last)
Problem p03426 (python)

Fixed submission:
import math
def func(h, w, d, a, query):
    imos = [0 for _ in range(h*w)]
    pos = [[0, 0] for _ in range(h*w)]
    for i in range(h):
        for j in range(w):
            pos[a[i][j]] = [i, j]
    for i in range(d):
        for j in range(math.ceil((h*w-i)/d)):
            if j == 0:
                continue
            else:
                imos[i + d * j] = imos[i + d * (j-1)]\
                                  + abs(pos[i + d * j][0] - pos[i + d * (j-1)][0])\
                                  + abs(pos[i + d * j][1] - pos[i + d * (j-1)][1])
    for i in range(len(query)):
        print(imos[query[i][1]] - imos[query[i][0]])
    return
h, w, d = [int(i) for i in input().split()]
a = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
    a[i] = [int(i) - 1 for i in input().split()]
q = int(input())
query = [[0, 0] for _ in range(q)]
for i in range(q):
    query[i] = [int(i) - 1 for i in input().split()]
func(h, w, d, a, query)
"""
func(3, 3, 2, [[0, 3, 2], [1, 4, 6], [7, 8, 5]], [[3, 7]])
print("ans: 5\n")
func(4, 2, 3, [[2, 6], [0, 3], [4, 1], [5, 7]], [[1, 1], [1, 1]])
print("ans: 0, 0\n")
func(5, 5, 4, [[12, 24, 6, 14, 16], [15, 21, 19, 1, 8], [13, 10, 11, 0, 18], [9, 5, 22, 7, 17], [2, 20, 4, 23, 3]], [[12, 12], [1, 9], [12, 12]])
print("ans: 0, 5, 0")
"""
# print("func({}, {}, {}, {}, {})".format(h, w, d, a, query))

Buggy submission (verdict: Runtime Error):
h, w, d = [int(i) for i in input().split()]
a = [[int(j)-1 for j in input().split()] for i in range(h)]

q = int(input())#moving num
l = [0 for i in range(q)]#start number
r = [0 for i in range(q)]#finish number

for i in range(q):
    tmp = input().split()
    l[i]=int(tmp[0])-1
    r[i]=int(tmp[1])-1
loc = [[0, 0] for i in range(h*w)]
for i in range(h):
    for j in range(w):
        loc[a[i][j]][0] = i
        loc[a[i][j]][1] = j
#print(loc)
cost = [0 for i in range(int((h*w)/d))]
#print(cost)
for i in range(1, len(cost)):
    cost[i] += abs(loc[(i+1)*d-1][0]-loc[i*d-1][0])
    cost[i] += abs(loc[(i+1)*d-1][1]-loc[i*d-1][1])
#print(cost)
for i in range(1, len(cost)):
    cost[i] += cost[i-1]
#print(cost)

for i in range(q):
    print(cost[int(r[i]/d)]-cost[int(l[i]/d)])

Buggy submission (verdict: Runtime Error):
h, w, d = [int(i) for i in input().split()]
a = [[int(j)-1 for j in input().split()] for i in range(h)]

q = int(input())#moving num
l = [0 for i in range(q)]#start number
r = [0 for i in range(q)]#finish number

for i in range(q):
    tmp = input().split()
    l[i]=int(tmp[0])-1
    r[i]=int(tmp[1])-1
loc = [[0, 0] for i in range(h*w)]
for i in range(h):
    for j in range(w):
        loc[a[i][j]][0] = i
        loc[a[i][j]][1] = j
#print(loc)
cost = [0 for i in range(int((h*w)/d))]
#print(cost)
for i in range(1, len(cost)):
    cost[i] += abs(loc[(i+1)*d-1][0]-loc[i*d-1][0])
    cost[i] += abs(loc[(i+1)*d-1][1]-loc[i*d-1][1])
#print(cost)
for i in range(1, len(cost)):
    cost[i] += cost[i-1]
print(cost)

for i in range(q):
    print(cost[int(r[i]/d)]-cost[int(l[i]/d)])
Problem p03634 (python)

Fixed submission:
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
q, k = [int(i) for i in input().split()]

stack = [[k-1, 0]]
while True:
    size = len(stack)
    if size == 0:
        break
    now, cost = stack.pop()
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            stack.append([tree[now][i][0],
                          cost+tree[now][i][1]])

for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

Buggy submission (verdict: Runtime Error):
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
def depth(now, cost):
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            depth(tree[now][i][0], cost+tree[now][i][1])
    return
q, k = [int(i) for i in input().split()]
depth(k - 1, 0)
# print(visited)
for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

Buggy submission (verdict: Runtime Error):
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n)]
visited = [-1 for _ in range(n)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b-1, c])
    tree[b - 1].append([a - 1, c])
def depth(now, cost):
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            depth(tree[now][i][0], cost+tree[now][i][1])
    return
q, k = [int(i) for i in input().split()]
depth(k-1, 0)
# print(visited)
for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])
Problem p03075 (python)

Fixed submission:
n=[0]*5
for i in range(5):
  n[i]=int(input())
k=int(input())
mi=min(n)
ma=max(n)
if k >=ma-mi:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
n=[]
for i in range(5):
  n[i]=int(input())
k=int(input())
mi=min(n)
ma=max(n)
if k <= ma-mi:
  print("Yay!")
else:
  print(":(")
Problem p03250 (python)

Fixed submission:
abclist=input().split()
abclist_int=[int(i) for i in abclist]
abclist_int.sort()
ans=abclist_int[2]*10+abclist_int[1]+abclist_int[0]
print(ans)

Buggy submission (verdict: Runtime Error):
n_list=input().split()
n_list_int=[int(n) for n in n_list]
n_list_int.sort()
ans=n_list_sort[2]*10+n_list_sort[1]+n_list_sort[0]
print[ans]
Problem p03774 (python)

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

a_b = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    a_b.append(array)

c_d = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    c_d.append(array)

for n in range(N):
    mind = 1000000007
    for m in range(M):
        dist = abs(a_b[n][0] - c_d[m][0]) + abs(a_b[n][1] - c_d[m][1])
        if dist < mind:
            mind = dist
            checkpoint = m + 1
    print(checkpoint)

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

a_b = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    a_b.append(array)

c_d = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    c_d.append(array)

for n in range(N):
    mind = 200000001
    for m in range(M):
        dist = abs(a_b[n][0] - c_d[m][0]) + abs(a_b[n][1] - c_d[m][1])
        if dist < mind:
            mind = dist
            checkpoint = m + 1
    print(checkpoint)

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

a_b = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    a_b.append(array)

c_d = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    c_d.append(array)

for n in range(N):
    mind = 2 * 10^8 + 1
    for m in range(M):
        dist = abs(a_b[n][0] - c_d[m][0]) + abs(a_b[n][1] - c_d[m][1])
        if dist < mind:
            mind = dist
            checkpoint = m + 1
    print(checkpoint)
Problem p03705 (python)

Fixed submission:
N, A, B = map(int, input().split())
if A > B:
    print(0)
elif N == 1:
    if A == B:
        print(1)
    else:
        print(0)
else:
    print((A+(N-1)*B)-((N-1)*A+B)+1)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if A > B:
    print(0)
elif N = 1:
    if A = B:
        print(1)
    else:
        print(0)
else:
    print((A+(N-1)*B)-((N-1)*A+B)+1)
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A == 1:
    A = 14
if B == 1:
    B = 14

if A == B:
    print('Draw')
elif A > B:
    print('Alice')
else:
    print ('Bob')

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

if A == B:
    print('Draw')
elif A > B:
    print('Alice')
else:
    print ('Bob')
Problem p03317 (python)

Fixed submission:
import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
print(math.ceil((A-B)/(B-1))+1)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(math.ceil((A-B)/(B-1))+1)
Problem p03072 (python)

Fixed submission:


def problem():
    N = int(input())
    H = list(map(int, input().split()))
    print(algorithm(N,H))


def algorithm(N: int, H):
  currentMax = H[0]
  counter = 1
  for i in range(1, N):
    if currentMax <= H[i]:
      counter += 1
      currentMax = H[i]
    
  return counter

problem()

Buggy submission (verdict: Runtime Error):

def problem():
    N = int(input())
    H = map(int, input().split())
    print(algorithm(N,H))

def algorithm(N: int, H):
  currentMax = H[0]
  counter = 1
  for i in range(1, N):
    if currentMax <= H[i]:
      counter += 1
      currentMax = H[i]
    
  return counter

problem()
Problem p03250 (python)

Fixed submission:
suuji = list(map(int, input().split()))
saidai = max(suuji)
suuji.remove(saidai)
print(saidai*10+suuji[0]+suuji[1])

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
a = 10*A + B
b = 10*B + C
c = 10*C + A
d = 10*A + C
e = 10*B + A
f = 10*C +B
print(max([a+C ,b+A, c+B, d+B, e+C, f+A]))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
a = 10*A + B
b = 10*B + C
print(max([a+C ,A+b]))
Problem p03072 (python)

Fixed submission:
N = input()
H = list(map(int,input().split()))
count = 0
max = 0
for h in H:
  if max<=h:
    count+=1
    max=h
    
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
H = list(map(int,input().split()))
count = 0
max = 0
for h in H:
  if max<=h:
    count++
    max=h
    
print(count)
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a<=k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a<=k:
  print('Yay!')
  else
  print(':(')

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a<k:
  print('Yay!')
  else
  print(':(')

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a>k:
  print('Yay!')
  else
  print(':(')
Problem p03327 (python)

Fixed submission:
a= int(input())

if (a >= 1000):
    print ("ABD")
else:
    print("ABC")

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

if (a >= 1000):
    print ("ABD")
else:
    print("ABC")
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a <= k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a, e = map(int, input().split())

if e - a <= k:
  print('Yay!')
else:
  print(':(')
Problem p03307 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
  print(n)
else:
  print(n * 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 == 0:
  print(n)
elif:
  print(n * 2)
Problem p03315 (python)

Fixed submission:
s = input()
print(s.count('+') - s.count('-'))

Buggy submission (verdict: Runtime Error):
s = row_input()
print(s.count('+') - s.count('-'))
Problem p03835 (python)

Fixed submission:
k,s = map(int,input().split())
counter = 0

for x in range(k+1):
    if s-x > 2*k:
        continue
    for y in range(k+1):
        if s-x-y > k or s-x-y < 0:
            continue
        else:
            counter += 1
            
print(counter)

Buggy submission (verdict: Runtime Error):
k = int(input())
s = int(input())
counter = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if s == x+y+z:
                counter += 1
                
print(counter)
Problem p03075 (python)

Fixed submission:
List=[int(input()) for i in range(5)]
k=int(input())
if List[-1]-List[0]>k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
List=[a,b,c,d,e]
for i j in range(5):
  if List[i]-List[j]>k:
    print("Yay!")
    break
  else:
    print(":(")
Problem p03075 (python)

Fixed submission:
a,b,c,d,e,k=[int(input()) for i in range(6)]
if e-a<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=[input() for i in range(6)]
if e-a<=k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=map(int,input().split())
if e-a<=k:
    print("Yay!")
else:
    print(":(")
Problem p03077 (python)

Fixed submission:
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e18
idx = 0
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 10
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cities = [a, b, c, d, e]
min_val = 1e6
for i, x in enumerate(cities):
    if x < min_val:
        min_val = x
        idx = i

ans = 0 if idx == 0 else idx

ans += math.ceil(n / min_val)
ans = ans + 4 - idx
print(ans)
Problem p03127 (python)

Fixed submission:
from functools import reduce


def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def gcd_list(numbers):
    return reduce(gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
print(gcd_list(a))