Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

A_i_max = max(A_i)

for i in range(N):
    if A_i_max == A_i[i] and A_i.count(A_i[i]) == 1:
        A_i_copy = A_i[:]
        A_i_copy.pop(i)
        print(max(A_i_copy))
    else:
        print(A_i_max)

Fixed submission:
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

A_i_sord = sorted(A_i)
A_i_max_first = A_i_sord[N - 1]
A_i_max_second = A_i_sord[N - 2]

for i in range(N):
    if A_i_max_first == A_i[i]:
        print(A_i_max_second)
    else:
        print(A_i_max_first)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

for i in range(N):
    A_i_copy = []
    if i == 0:
        A_i_copy = sorted(A_i[1:N])
    elif i == N - 1:
        A_i_copy = sorted(A_i[0:N-1])
    else:
        A_i_copy = sorted(A_i[0:i] + A_i[i+1:N])

    print(A_i_copy[N - 2])

Fixed submission:
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

A_i_sord = sorted(A_i)
A_i_max_first = A_i_sord[N - 1]
A_i_max_second = A_i_sord[N - 2]

for i in range(N):
    if A_i_max_first == A_i[i]:
        print(A_i_max_second)
    else:
        print(A_i_max_first)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

for i in range(N):
    A_i_copy = A_i[:]
    A_i_copy.pop(i)
    print(max(A_i_copy))

Fixed submission:
N = int(input())

A_i = []
for i in range(N):
    A_i.append(int(input()))

A_i_sord = sorted(A_i)
A_i_max_first = A_i_sord[N - 1]
A_i_max_second = A_i_sord[N - 2]

for i in range(N):
    if A_i_max_first == A_i[i]:
        print(A_i_max_second)
    else:
        print(A_i_max_first)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())

mod = []
if 2019 <= R - L:
    print(0)
else:
    for i in range(L, R):
        j = i + 1
        mod.append((i * j % 2019))

print(min(mod))

Fixed submission:
L, R = map(int, input().split())
 
if 2019 <= R - L:
    print(0)
else:
    a=min([(i*j)%2019 for i in range(L,R+1) for j in range(i+1,R+1)])
    print(a)
Buggy python submission (verdict: Runtime Error):
abc = raw_input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if b - a == c - b:
    print("YES")
else:
    print("NO")


Fixed submission:
abc = raw_input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if b - a == c - b:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
#coding:utf-8

AB = raw_input().split()
A = int(AB[0])
B = int(AB[1])

if A+B > 24:
    print (A+B)%24
elif A+B = 24:
    print 0
else:
    print A+B


Fixed submission:
#coding:utf-8

AB = raw_input().split()
A = int(AB[0])
B = int(AB[1])

if A+B > 24:
    print (A+B)%24
elif A+B == 24:
    print 0
else:
    print A+B
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def resolve():
    k = int(input())

    sum = 0
    for a in range(1, k+1):
        for b in range(1, k+1):
            for c in range(1,k+1):
                sum += gcd(gcd(a,b), c)
    
    print(sum)
    
resolve()

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def resolve():
    k = int(input())

    tmp = []
    for a in range(1, k+1):
        for b in range(1, k+1):
            tmp.append(gcd(a,b))

    ans = 0
    for c in range(1,k+1):
        for i in tmp:
            ans += gcd(i, c)
    
    print(ans)
    
resolve()

Buggy python submission (verdict: Runtime Error):
k = int(input())

sum = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1,k+1):
            sum += gcd(gcd(a,b), c)

print(sum)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def resolve():
    k = int(input())

    tmp = []
    for a in range(1, k+1):
        for b in range(1, k+1):
            tmp.append(gcd(a,b))

    ans = 0
    for c in range(1,k+1):
        for i in tmp:
            ans += gcd(i, c)
    
    print(ans)
    
resolve()
Buggy python submission (verdict: Runtime Error):
str = input()
n = len(str)
str_list = list(str)

for i in range(0,n//2):
    if str_list[i] != str_list[n//2-i-1]:
        print('No')
        return

for j in range(n//2+1,n):
    if str_list[i] != str_list[-i-1]:
        print('No')
        return

print('Yes')

Fixed submission:
str = input()
n = len(str)
str_list = list(str)

ans = 'Yes'
for i in range(0,n//2):
    if str_list[i] != str_list[n//2-i-1]:
        ans = 'No'

for j in range(n//2+1,n):
    if str_list[i] != str_list[-i-1]:
        ans = 'No'

for i in range(n):
    if str_list[i] != str_list[-i-1]:
        ans = 'No'

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

def resolve():
    input = sys.stdin.readline
    A, B, M = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    grid=[list(map(int,input().split())) for i in range(M)]

    res = min(a) + min(b)

    for x, y, c in grid:
        res = min(res, a[x-1]+b[y-1]-c)

    print(res)
    
resolve()

Fixed submission:
import re

def resolve():
    str = input()
    if re.match('^(hi)+$', str):
        print("Yes")
    else:
        print("No")
        
resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    str = input()
    if re.match('(hi)+', str):
        print("Yes")
    else:
        print("No")

resolve()

Fixed submission:
import re

def resolve():
    str = input()
    if re.match('^(hi)+$', str):
        print("Yes")
    else:
        print("No")
        
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())
total = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            total += reduce(math.gcd, [a,b,c])

print(total)

Fixed submission:
import math
from functools import reduce
 
K = int(input())
total = 0
for a in range(1, K + 1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            total += reduce(math.gcd, [a,b,c])
 
print(total)
Buggy python submission (verdict: Runtime Error):
ABC = input().split()

if len(set(ABC)) == 2:
    print 'Yes'
else:
    print 'No'

Fixed submission:
ABC = input().split()

if len(set(ABC)) == 2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

l = []
ans = 0

for i, item in enumerate(P):
  if i==0:
    ans = 1
    l.append(item)
  else :
    if (item <= min(l)):
      ans += 1
    l.append(item)
      
print(ans)

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

m = -1
ans = 0

for i, item in enumerate(P):
  if i==0:
    m = item
    ans += 1
  else :
    if (m >= item):
      m = item
      ans += 1
      
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

# dp[i][w]: i番目の荷物で重さwの状態であるときの最大価値
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

# 配るDPで考える
for nimotsu in range(N):
    # 行取得
    w_weight, w_val = map(int, input().split())
    
    for w in range(W+1):
        # 品物を選ぶとき (上限超えなければ)
        sum_ = w + w_weight
        if sum_ <= W :
            dp[nimotsu+1][sum_] = max(dp[nimotsu+1][sum_], dp[nimotsu][w] + w_val)
            
        # 品物を選ばないとき
        dp[nimotsu+1][w] = max(dp[nimotsu+1][w] ,dp[nimotsu][w])

print(dp[N][W])

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

# dp[i][w]: i番目の荷物で重さwの状態であるときの最大価値
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

# 配るDPで考える
for nimotsu in range(N):
    # 行取得
    w_weight, w_val = map(int, input().split())
    
    for w in range(W+1):
        # 品物を選ぶとき (上限超えなければ)
        sum_ = w + w_weight
        if sum_ <= W :
            dp[nimotsu+1][sum_] = max(dp[nimotsu+1][sum_], dp[nimotsu][w] + w_val)
            
        # 品物を選ばないとき
        dp[nimotsu+1][w] = max(dp[nimotsu+1][w] ,dp[nimotsu][w])

print(dp[N][W])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = map(int, input().split())

# dp[i][w]: i番目の荷物で重さwの状態であるときの最大価値
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

# 配るDPで考える
for nimotsu in range(N):
    # 行取得
    w_weight, w_val = map(int, input().split())
    
    for w in range(W+1):
        # 品物を選ぶとき (上限超えなければ)
        sum_ = w + w_weight
        if sum_ <= W :
            dp[nimotsu+1][sum_] = max(dp[nimotsu+1][sum_], dp[nimotsu][w] + w_val)
            
        # 品物を選ばないとき
        dp[nimotsu+1][w] = max(dp[nimotsu+1][w] ,dp[nimotsu][w])

print(max(dp[N]))

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

# dp[i][w]: i番目の荷物で重さwの状態であるときの最大価値
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

# 配るDPで考える
for nimotsu in range(N):
    # 行取得
    w_weight, w_val = map(int, input().split())
    
    for w in range(W+1):
        # 品物を選ぶとき (上限超えなければ)
        sum_ = w + w_weight
        if sum_ <= W :
            dp[nimotsu+1][sum_] = max(dp[nimotsu+1][sum_], dp[nimotsu][w] + w_val)
            
        # 品物を選ばないとき
        dp[nimotsu+1][w] = max(dp[nimotsu+1][w] ,dp[nimotsu][w])

print(dp[N][W])
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = [input() for _ in range(L)]

ans = sorted(S)
print(''.join(ans))

Fixed submission:
N, L = map(int, input().split())
S = [input() for _ in range(N)]

print(''.join(sorted(S)))

Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = [input() for _ in range(L)]

print(''.join(sorted(S)))

Fixed submission:
N, L = map(int, input().split())
S = [input() for _ in range(N)]

print(''.join(sorted(S)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int,input().split()))
H.append(10**10)
tmp = 0
for i in range(0,N-2):
    new_tmp = 0
    j = i
    while H[j] >= H[j+1]:
        new_tmp += 1
        j += 1
    if new_tmp > tmp:tmp = new_tmp
print(tmp)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
tmp = 0
new_tmp = 0
i = N-1
while i >= 1:
    if H[i] <= H[i-1]:
        new_tmp += 1
        i -= 1
        if new_tmp > tmp:
            tmp = new_tmp
    else:
        if new_tmp > tmp:
            tmp = new_tmp
        new_tmp = 0
        i -= 1
print(tmp)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

a = int(A*100/8)
b = int(B*100/10)

x = int(a*0.10)
y = int(b*0.08)

if x == B and y == A:
    if a < b:
        print(a)
    else:
        print(b)
elif x == B:
    print(a)
elif y == A:
    print(b)
else:
    print(-1)


Fixed submission:
# -*- coding: utf-8 -*-

S = input()

if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
p = list(map(int, input().split()))
q = []
max = 0
for i in range(N):
    q.append(p[i]*(p[i]+1)/(2*p[i]))
for i in range(N-K+1):
    v = 0
    for j in range(K):
        v += q[i+j]
    if v > max:
        max = v
print(max)

Fixed submission:
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
p = list(map(int, input().split()))
q = [0]
for i in range(N):
    q.append(q[-1] + p[i]*(p[i]+1)/(2*p[i]))
print(max([q[i+K]-q[i] for i in range(N-K+1)]))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
for i in range(M):
    ans = int(A[0] / 2)
    A[0] = ans
    A = sorted(A, reverse=True)
sum = 0
for a in A:
    sum += a
print(sum)


Fixed submission:
# -*- coding: utf-8 -*-
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = 0
l = []
for i in A:
    heapq.heappush(l, i*-1)
for i in range(M):
    c = int(heapq.heappop(l)*-1/2)
    heapq.heappush(l, c*-1)
for a in l:
    sum += a*-1
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
N = int(input())
sum = 0
for i in range(N):
    sum += i
print(sum)


Fixed submission:
# -*- coding: utf-8 -*-
import math
N = int(input())-1
M = 0
x = int(math.ceil((N)/2))
if N%2 == 0:
    M = x*(N+1)
else:
    M = (x-1)*(N+1)+x
print(M)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(input().split())

if int(A) == int(B) == int(C):
  print("Yes")
else:
  print("No")

Fixed submission:
a = input().split()
if(len(set(a))==2):
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
flag=0

for i in range(N): 
        for i1 in range(N): 
            if i != i1: 
                if A[i] == A[i1]: 
                    break
                else:
                  flag+=1

if flag>0:
  print("YES")
else:
  print("NO")

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
S = set(A)
if len(S)==len(A):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = input().split()
total=0

if(K==len(H)):
  print(0)
else:
  temp = sorted(H)
  while K>0:
    temp=temp[:-1]
    K-=1
  for i in temp:
    total+=i
  print(total)
  

Fixed submission:
N, K = map(int, input().split())
Hs = map(int,input().split())
print(sum(sorted(Hs, reverse=True)[K::]))
Buggy python submission (verdict: Time Limit Exceeded):
T, A, time = map(int, input().split())

for i in range(time):
    if T>0:
        T-=1
    else:
        A-=1

print(str(T)+" "+str(A))


Fixed submission:
cookies = [int(x) for x in input().split()]
leftOver = cookies[0] - cookies[2]
takahashi = max(0, leftOver)
print(str(takahashi)+ ' ' + (str(cookies[1]) if takahashi > 0  else str(max(0,cookies[1] - abs(leftOver)))))
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())
if x > y:
    greater = x
else:
    greater = y
while(True):
    if((greater % x == 0) and (greater % y == 0)):
        lcm = greater
        break
    greater += 1
print(lcm)


Fixed submission:
def gcd(A,B): 
    if A == 0: 
        return B 
    return gcd(B % A, A) 
  
def lcm(A,B): 
    return (A*B) / gcd(A,B)

A,B = map(int,input().split())
print(int(lcm(A,B)))
Buggy python submission (verdict: Runtime Error):
N = input()
str = input()
new_str = ""

for x in str:
  temp = ord(x)+N
  if temp>90:
    str += chr((ord(x)+N) - 26)
  else:
    str += chr(ord(x)+N)

print(new_str)

Fixed submission:
N = int(input())
str = input()
new_str = ''
 
for x in str:
  temp = ord(x)+N
  if temp>90:
    new_str += chr(temp - 26)
  else:
    new_str += chr(temp)
 
print(new_str)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
count=0
 
while i in range(N):
  if h[i] >= K:
    count+=1
 
print(count)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
count=0
 
for i in range(N):
  if h[i] >= K:
    count+=1
 
print(count)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
count=0

while i in range(N):
  if(h[i] >= K):
    count+=1

print(count)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
count=0
 
for i in range(N):
  if h[i] >= K:
    count+=1
 
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

N = int(input())
s = 0

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

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

for i in range(1, N+1):
    for j in range(1, N+1):
        for k in range(1, N+1):
            s += gcd(i, j, k)


print(s)



Fixed submission:
'''
import math
from functools import reduce

N = int(input())
s = 0

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

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

for i in range(1, N+1):
    for j in range(1, N+1):
        for k in range(1, N+1):
            s += gcd(i, j, k)


print(s)
'''

import math
from functools import reduce
import itertools


N = int(input())
s = 0

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

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

seq = list(range(1, N+1))
comb = list(itertools.combinations_with_replacement(seq,3))

#print(seq)
#print(comb)

i = 1
for c in comb:
    if i == 1 or (c[0] == c[1] and c[1] == c[2]):
        s += gcd(c[0], c[1], c[2])
    elif c[0] != c[1] and c[1] != c[2] and c[0] != c[2]:
        s = s + gcd(c[0], c[1], c[2]) * 6
    else:
        s = s + gcd(c[0], c[1], c[2]) * 3
    i += 1

print(s)
Buggy python submission (verdict: Runtime Error):
import pandas as pd
n = int(input())
arr_ = [[str(i) for i in input().split()] for _ in range(n)]
arr = pd.DataFrame(arr_)
arr[2] = [i for i in range(n)]
num = arr.sort_values(by=1,ascending=False)
name = num.sort_values(by=0,ascending=True)
name.index = [i for i in range(n)]
for i in range(n):
    print(name[2][i]+1)


Fixed submission:
from operator import itemgetter
n = int(input())
arr_ = [[str(i) for i in input().split()] for _ in range(n)]
for i in range(n):
    arr_[i].append(i+1)
    arr_[i][1] = int(arr_[i][1])

arr_.sort(key=itemgetter(1), reverse=True)
arr_.sort(key=itemgetter(0))
for i in range(n):
    print(arr_[i][2])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B'
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))

Fixed submission:
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B'
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))

Fixed submission:
n, k = map(int, input().split())
s = list(input())

if s[k-1] == 'A':
    s[k-1] = 'a'
elif s[k-1] == 'B':
    s[k-1] = 'b'
else:
    s[k-1] = 'c'

print(''.join(s))
Buggy python submission (verdict: Runtime Error):
r, g, b, n = map(int, input().split())

ans = 0

for x in range(n+1):
    for y in range(n+1):
        if r*x + g*y >n:
            break
        for z in range(n+1):
            w = r*x + g*y + b*z
            if w>n:
                break
            if w == n:
                ans+=1
print(ans)


Fixed submission:
n, k = map(int, input().split())

ans = n - k +1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

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

flag = 0

if((e-a)=<k):
 print("Yay!")
 flag = 1
if(flag == 1):
  print(":(")
 

Fixed submission:
import sys

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

flag = 0

if((b-a)>k or (c-a)>k or (d-a)>k or (e-a)>k or (c-b)>k or (d-b)>k or (e-b)>k or (d-c)>k or (e-c)>k or (e-d)>k):
  print(":(")
else:
  print("Yay!")

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

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

flag = 0

if((e-d)=<k):
  if((d-c)=<k):
    if((c-b)=<k):
      if((b-a)=<k):
        print("Yay!")
        flag = 1
if(flag == 1):
  print(":(")
  

Fixed submission:
import sys

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

flag = 0

if((b-a)>k or (c-a)>k or (d-a)>k or (e-a)>k or (c-b)>k or (d-b)>k or (e-b)>k or (d-c)>k or (e-c)>k or (e-d)>k):
  print(":(")
else:
  print("Yay!")

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split)

flag = 0

if((e-d)>f or (d-c)>f or (c-b)>f or (b-a)>f):
  print(':(')
else:
  print('Yay!')

Fixed submission:
import sys

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

flag = 0

if((b-a)>k or (c-a)>k or (d-a)>k or (e-a)>k or (c-b)>k or (d-b)>k or (e-b)>k or (d-c)>k or (e-c)>k or (e-d)>k):
  print(":(")
else:
  print("Yay!")

Buggy python submission (verdict: Runtime Error):
str1 = input()
str2 = input()
str3 = input()
str4 = input()
str5 = input()
str6 = input()

flag = 0

if((str5-str4)>str6 or (str4-str3)>str6 or (str3-str2)>str6 or (str2-str1)>str6):
  print(':(')
else:
  print('Yay!')

Fixed submission:
import sys

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

flag = 0

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

g = []
g.append(a)
g.append(b)
g.append(c)
g.append(d)
g.append(e)

G = []

A=a%10
B=b%10
C=c%10
D=d%10
E=e%10

G.append(A)
G.append(B)
G.append(C)
G.append(D)
G.append(E)

min_except0 = G

for i in range(4):
  min_except0.remove(0)

x = G.index(min(min_except0))

loop = [0,1,2,3,4]
loop.remove(x)

answer = 0
for i in loop:
  answer += g[i]
  answer += 10-G[i]
answer += g[x]

print(answer)

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

g = []
g.append(a)
g.append(b)
g.append(c)
g.append(d)
g.append(e)

G = []

A=a%10
B=b%10
C=c%10
D=d%10
E=e%10

G.append(A)
G.append(B)
G.append(C)
G.append(D)
G.append(E)

min_except0 = G[:]

for i in range(4):
    try:
        min_except0.remove(0)
    except:
        pass
x = G.index(min(min_except0))

loop = [0,1,2,3,4]
loop.remove(x)

answer = 0
for i in loop:
  answer += g[i]
  answer += 10-G[i]
answer += g[x]

minas = 10*(5 - len(min_except0))

answer -= minas

print(answer)
Buggy python submission (verdict: Runtime Error):
def check():
    for k in range(0,n):
        if h[k]!=0:
            break
    for i in range(0,101):
        for j in range(0,101):
            flag=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(k+1,n):
                if h[l]!=max(h1-abs(i-x[l])-abs(j-y[l]),0)
                    flag=False
                    break
            if flag==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Fixed submission:
def check():
    for k in range(0,n):
        if h[k]!=0:
            break
    for i in range(0,101):
        for j in range(0,101):
            flag=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(0,n):
                if h[l]!=max(h1-abs(i-x[l])-abs(j-y[l]),0):
                    flag=False
                    break
            if flag==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()
Buggy python submission (verdict: Runtime Error):
a,b=input().split("\n")
n,k=a.split(" ")
x=b.split(" ")
t=0
tmin=2*(x[n-1]-x[0])
for i in range (0,n-k+1):
    if x[i]>=0:
        t=x[i+k-1]
    else:
        if x[i+k-1]<=0:
            t=abs(x[i])
        else:
            if -1*x[i]<x[i+k-1]:
                t=-2*x[i]+x[i+k-1]
            else:
                t=-1*x[i]+2*x[i+k-1]
    if t<tmin:
        tmin=t
print(tmin)

Fixed submission:
n,k=list(map(int, input().split()))
x=list(map(int, input().split()))
t=0
tmin=2*(x[n-1]-x[0])
for i in range (0,n-k+1):
    if x[i]>=0:
        t=x[i+k-1]
    else:
        if x[i+k-1]<=0:
            t=abs(x[i])
        else:
            if -1*x[i]<x[i+k-1]:
                t=-2*x[i]+x[i+k-1]
            else:
                t=-1*x[i]+2*x[i+k-1]
    if t<tmin:
        tmin=t
print(tmin)