Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
AB = []
for _ in range(M):
    AB.append(list(map(int, input().split())))

list = [0] * (N+1)

saitan = [1]
for _ in range(M):
    next = []
    for i in range(len(AB)):
        if AB[i][0] in saitan:
            if list[AB[i][1]] == 0:
                list[AB[i][1]] = AB[i][0]
                next.append(AB[i][1])
        if AB[i][1] in saitan:
            if list[AB[i][0]] == 0:
                list[AB[i][0]] = AB[i][1]
                next.append(AB[i][0])
    saitan.extend(next)


print("Yes")
for ele in list[2:]:
    print(ele)


Fixed submission:
from collections import deque

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

graph = [[] for _ in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

dist = [-1] * (N+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

ans = [0] * (N+1)
while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = dist[v]+1
        d.append(i)
        ans[i] = v

print("Yes")
print(*ans[2:], sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
AB = []
for _ in range(M):
    AB.append(list(map(int, input().split())))

list = [0] * (N+1)

saitan = [1]
for _ in range(M):
    next = []
    for i in range(len(AB)):
        if AB[i][0] in saitan:
            if list[AB[i][1]] == 0:
                list[AB[i][1]] = AB[i][0]
                next.append(AB[i][1])
        if AB[i][1] in saitan:
            if list[AB[i][0]] == 0:
                list[AB[i][0]] = AB[i][1]
                next.append(AB[i][0])
    saitan.extend(next)


print("Yes")
for ele in list[2:]:
    print(ele)


Fixed submission:
from collections import deque

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

graph = [[] for _ in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

dist = [-1] * (N+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

ans = [0] * (N+1)
while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = dist[v]+1
        d.append(i)
        ans[i] = v

print("Yes")
print(*ans[2:], sep='\n')
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
books = [list(map(int, input().split())) for _ in range(n)]

ans = []

for i in range( 2 ** n):
    total = [0] * (m + 1)
    for j in range(n):
        if (i >> j) & 1:
            total = [total[k] + books[j][k] for k in range(m+1)]

    over = True
    for j in range(1, m+1):
        if total[j] < x:
            over = False
    if over:
        ans.append(total[0])

if len(ans) > 0:
    print(min(ans))
else:
    print('-1')


Fixed submission:
s=input()
t=input()

print('Yes' if s==t[:-1] else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int,input().split()))

A.insert(0,-1)
root = [1]
next = A[1]
rf = 0

for _ in range(K):
    if next in root:
        rf = root.index(next)
        root = root[rf:]
        break
    root.append(next)
    next = A[next]

print(root[(K - rf) % len(root)])


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

A.insert(0,-1)
root = [1]

for _ in range(N-1):
    root.append(A[root[-1]])

if K > N:
    start = root.index(root[-1])
    index = (K - start) % (len(root) - start - 1) + start
    ans = root[index]
else:
    ans = root[K]

print(ans)

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

A.insert(0,-1)
root = [1]
next = A[1]
rf = 0

for _ in range(K):
    if next not in root:
        root.append(next)
        next = A[next]
    else:
        rf = root.index(next)
        root = root[rf:]
        break

print(root[(K - rf) % len(root)])


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

A.insert(0,-1)
root = [1]

for _ in range(N-1):
    root.append(A[root[-1]])

if K > N:
    start = root.index(root[-1])
    index = (K - start) % (len(root) - start - 1) + start
    ans = root[index]
else:
    ans = root[K]

print(ans)

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

A.insert(0,-1)
root = [1]
next = A[1]
rf = 0

for _ in range(K):
    if next not in root:
        root.append(next)
        next = A[next]
    else:
        rf = root.index(next)
        root = root[rf:]
        break

print(root[(K - rf) % len(root)])


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

A.insert(0,-1)
root = [1]

for _ in range(N-1):
    root.append(A[root[-1]])

if K > N:
    start = root.index(root[-1])
    index = (K - start) % (len(root) - start - 1) + start
    ans = root[index]
else:
    ans = root[K]

print(ans)

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

A.insert(0,-1)
root = [1]
next = A[1]
rf = 0

for _ in range(K):
    if next not in root:
        root.append(next)
        next = A[next]
    else:
        rf = root.index(next)
        roop = root[rf:]
        break


print(root[(K - rf - 1) % len(roop)])


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

A.insert(0,-1)
root = [1]

for _ in range(N-1):
    root.append(A[root[-1]])

if K > N:
    start = root.index(root[-1])
    index = (K - start) % (len(root) - start - 1) + start
    ans = root[index]
else:
    ans = root[K]

print(ans)
Buggy python submission (verdict: Runtime Error):
x = int(input())
for a in range(-118,119):
    for b in range(-119,118):
        if a**5 - b**5 == x:
            print(a,b)
            exit()


Fixed submission:
S = input()

if S[1] == "B":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
d1 = []
d2 = []
for i, ele in enumerate(a,1):
    d1.append(i + ele)
    d2.append(i - ele)

cnt = 0

for i in range(n):
    cnt += d2[i+1:].count(d1[i])

print(cnt)


Fixed submission:
from collections import defaultdict

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

cnt = 0
d = defaultdict(int)

for i in range(n):
    cnt += d[i-a[i]]
    d[i + a[i]] += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
d1 = []
d2 = []
for i, ele in enumerate(a,1):
    d1.append(i + ele)
    d2.append(i - ele)

cnt = 0

for i in range(n):
    cnt += d2[i+1:].count(d1[i])

print(cnt)


Fixed submission:
from collections import defaultdict

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

cnt = 0
d = defaultdict(int)

for i in range(n):
    cnt += d[i-a[i]]
    d[i + a[i]] += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
d = []
for i, ele in enumerate(a,1):
    d.append( [(i+ele),(i-ele)] )

cnt = 0

for i in range(n):
    for j in range(i+1,n):
        if d[i][0] == d[j][1]:
            cnt += 1

print(cnt)


Fixed submission:
from collections import defaultdict

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

cnt = 0
d = defaultdict(int)

for i in range(n):
    cnt += d[i-a[i]]
    d[i + a[i]] += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for x in range(1,n+1):
    print(a.index(x)+1, end=' ')


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

d = {}
for i in range(n):
    d[a[i]] = i+1

for i in range(1,n+1):
    print(d[i], end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
import functools

n = int(input())
xs = input().split()

def foldSum(acc, x):
    return acc*int(x)

if 0 in xs:
    print(0)
else:
    res = functools.reduce(foldSum, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)



Fixed submission:
import functools

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

def foldMulti(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldMulti, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)

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

n = int(input())
xs = input().split()

def foldSum(acc, x):
    return acc*int(x)

if 0 in res:
    print(0)
else:
    res = functools.reduce(foldSum, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)



Fixed submission:
import functools

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

def foldMulti(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldMulti, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import functools

n = int(input())
xs = input().split()

def foldSum(acc, x):
    return acc*int(x)

res = functools.reduce(foldSum, xs, 1)

if res > 1e18:
    print(-1)
else:
    print(res)



Fixed submission:
import functools

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

def foldMulti(acc, x):
    return acc*x

if 0 in xs:
    print(0)
elif len([x for x in xs if x > 1]) >= 60:
    print(-1)
else:
    res = functools.reduce(foldMulti, xs, 1)

    if res > 1e18:
        print(-1)
    else:
        print(res)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b = b*100
c = a*b
c = c/100

print(int(c))

Fixed submission:
import decimal

a, b = input().split()
a = int(a)
b = str(b).replace('.', '')

r = a*int(b[0])

if a >= 10 and len(b) > 1:
    r += decimal.Decimal(a * int(b[1])/10)

if a >= 100 and len(b) > 2:
    r += decimal.Decimal(a * int(b[2])/100)

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

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

ans = 1

for a in alis:
  	ans *= a
	if ans > 10**18:
		ans = -1
		break

print(ans)


Fixed submission:
n = int(input())

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

ans = 1

if 0 in alis:
  print(0)
  exit()

for a in alis:
	ans *= a
	if ans > 10**18:
		ans = -1
		break

print(ans)

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

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

ans = 1

for a in alis:
  ans *= a
  if ans > 10**18:
	ans = -1
	break

print(ans)


Fixed submission:
n = int(input())

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

ans = 1

if 0 in alis:
  print(0)
  exit()

for a in alis:
	ans *= a
	if ans > 10**18:
		ans = -1
		break

print(ans)

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

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

ans = 1

for a in alis:
  ans *= a
  if ans > 10**18:
  	ans = -1
    break

print(-1)


Fixed submission:
n = int(input())

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

ans = 1

if 0 in alis:
  print(0)
  exit()

for a in alis:
	ans *= a
	if ans > 10**18:
		ans = -1
		break

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n <= 10:
  minus = (10 - n) * 100
print(m - minus)

Fixed submission:
n, r = map(int, input().split())
if n > 10:
    print(r)
else:
    print(r+100*(10-n))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
# hlis.sort(reverse=True)

for i in range(0, k):
  cache = max(hlis)
  hlis.remove(cache)
print(sum(hlis))

Fixed submission:
h, a = map(int, input().split())
ans = 0
while h > 0:
    ans += 1
    h -= a
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
# hlis.sort(reverse=True)

for i in range(0, k):
  cache = max(hlis)
  hlis.remove(cache)
print(sum(hlis))


Fixed submission:
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
hlis.sort(reverse=True)

del hlis[0:k]
print(sum(hlis))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
# hlis.sort(reverse=True)

for i in range(0, k):
  cache = max(hlis)
  hlis.remove(cache)
print(sum(hlis))

Fixed submission:
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
hlis.sort(reverse=True)

del hlis[0:k]
print(sum(hlis))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
hlis.sort(reverse=True)
for i in range(0, k):
  del hlis[0]
print(sum(hlis))

Fixed submission:
n, k = map(int, input().split())
hlis = list(map(int, input().split()))
hlis.sort(reverse=True)

del hlis[0:k]
print(sum(hlis))
Buggy python submission (verdict: Runtime Error):
takahashi, aoki, count = map(input().split(), int)
k = count
if count - takahashi >= 0:
  takahashi -= count
else:
  takahashi = 0
  count -= takahashi
  if aoki - count > 0:
    aoki -= count
  else:
    aoki = 0
print(takahashi, aoki)

Fixed submission:
takahashi, aoki, count = map(int,input().split())
k = count
if takahashi - count >= 0:
  takahashi -= count
else:
  count -= takahashi
  takahashi = 0
  if aoki - count > 0:
    aoki -= count
  else:
    aoki = 0
print(takahashi, aoki)
Buggy python submission (verdict: Runtime Error):
x = int(input())
while True:
	xs = [n for i in range(x) if x % n == 0]
    if len(xs) > 2:
      break
	x += 1
print(x)

Fixed submission:
x = int(input())
while True:
  xs = [i for i in range(1, x + 1) if x % i == 0]
  if len(xs) == 2:
    break
  x += 1
print(x)

Buggy python submission (verdict: Runtime Error):
x = int(input())
while True:
	xs = [n for i in range(x) if x % n == 0]
    if len(xs) > 2:
      break
	x += 1
print(x)


Fixed submission:
x = int(input())
while True:
  xs = [i for i in range(1, x + 1) if x % i == 0]
  if len(xs) == 2:
    break
  x += 1
print(x)
Buggy python submission (verdict: Runtime Error):
a, b, c = ma@(int, input().split())
if a + b + c > 21:
  print("bust")
else:
  print("win")

Fixed submission:
a, b, c = map(int, input().split())
if a + b + c > 21:
  print("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
s = input()
l = len(s)
h = l // 2
lis1 = []
lis2 = []
for i in range(0, l + 1):
  lis1.append(s[i])
  lis2.append(s[-(i + 1)])
count = 0
for a, b in zip(lis1, lis2):
  if a != b:
    count += 1
print(count)

Fixed submission:
s = input()
l = len(s)
h = l // 2
lis1 = []
lis2 = []
for i in range(0, h):
  lis1.append(s[i])
  lis2.append(s[-(i + 1)])
count = 0
for a, b in zip(lis1, lis2):
  if a != b:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
# C
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N = int(input())
divisors = make_divisors(N)
memo = 0
maX = divisors[0] + divisors[len(divisors) - 1]
for (i, r) in zip(make_divisors, reversed(make_divisors)):
    maX = min(i + r, maX)
    memo = i
    if memo == r:
        break
print(maX)


Fixed submission:
# C
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N = int(input())
divisors = make_divisors(N)
memo = 0
maX = divisors[0] + divisors[len(divisors) - 1]
for (i, r) in zip(divisors, reversed(divisors)):
    maX = min(i + r, maX)
    memo = i
    if memo == r:
        break
print(maX - 2)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in h:
    if h >= k:
        ans += 1
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in h:
    if i >= k:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a in As:
  ans[a - 1] = As.index(a) + 1
print(*ans)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a, i in zip(As, range(1, n+1)):
  ans[a - 1] = i
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
As = list(map(int, input().split()))
ans = []
for i in range(n):
  ans.append(0)
for a in As:
  ans[a - 1] = As.index(a) + 1
print(*ans)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a, i in zip(As, range(1, n+1)):
  ans[a - 1] = i
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans_lis = np.ones(len(a))
ans_lis = np.array(ans_lis, dtype=int)
for i in range(len(a)):
    ans_lis[i] += a.index(i + 1)
print(*ans_lis)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a, i in zip(As, range(1, n+1)):
  ans[a - 1] = i
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans_lis = np.ones(len(a))
ans_lis = np.array(ans_lis, dtype=int)
for i in range(len(a)):
    ans_lis[i] += int(a.index(i + 1))
print(*ans_lis)


Fixed submission:
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a, i in zip(As, range(1, n+1)):
  ans[a - 1] = i
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int, input().split()))
ans_lis = np.zeros(len(a))
ans_lis = np.array(ans_lis, dtype=int)
for i in range(1, len(a) + 1):
    ans_lis[i - 1] = int(a.index(i) + 1)
print(*ans_lis)

Fixed submission:
n = int(input())
As = list(map(int, input().split()))
ans = [0] * n
for a, i in zip(As, range(1, n+1)):
  ans[a - 1] = i
print(*ans)
Buggy python submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
points = []
minus = []
for i in range(n):
    points.append(k)
    minus.append(-1)
for i in range(q):
    a = int(input())
    points = np.array(points) + np.array(minus)
    points[a - 1] += 1
for point in points:
    if point > 0:
        print("Yes")
    else:
        print("No")


Fixed submission:
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
d = 0
e = 0
for i in range(n):
    s = sorted(list(input()))
    a.append(s)
a.sort()
f = []
for b in a:
    if b in f:
        d += 1
    f.append(b)
print(d)

Fixed submission:
a, b = map(int, input().split())
c = a + b
d = a - b
e = a * b
if c >= d:
    if c >= e:
        print(c)
    else:
        print(e)
elif d >= e:
    print(d)
else:
    print(e)
Buggy python submission (verdict: Runtime Error):
k, x = map(int, input().split())
ans = [i - 1 for i in range(1, k)]
cache = [i + 1 for i in range(1, k)]
print(*sorted((ans + cache).append(x)))

Fixed submission:
k, x = map(int, input().split())
ans = [x]
for i in range(1, k):
    ans.append(x - i)
    ans.append(x + i)
print(*sorted(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ps = map(int, input().split())
p2 = ps[0] - 1
for p in ps:
    if p > p2:
        p2 = p

    else:
        print("NO")
if p2 == p[-1]:
    print("YES")

Fixed submission:
n = input()
n = int(n)
ps = list(map(int, input().split()))
pp = sorted(ps)
remaind = 2
pt = False
for s,p in zip(ps,pp):
    if s != p:
        remaind -= 1

if remaind >= 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = []
for i in range(n):
  nums.append(int(input()))
cache = sorted(nums)
maximum = nums[0]
second = nums[1]
if maximum == second:
  flag = True
else:
  flag = False
for i in nums:
  if i == maximum && !flag:
    print(second)
  else:
    print(maximum)

Fixed submission:
r = input()
print(int(r)**2 * 3)

Buggy python submission (verdict: Runtime Error):
n = int(input())
nums = []
for i in range(n):
    nums.insert(i,int(input()))
for i in range(n):
    print(max(max(nums[0:i],nums[i+1:n+1])))

Fixed submission:
r = input()
print(int(r)**2 * 3)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = 0
b = []
while m != 0:
    l, r = map(int, input().split())
    if not b:
        for a in range(1, n + 1):
            c = a
            print(b)
            while True:
                if a >= l:
                    if a <= r:
                        b.append(c)
                        break
                    else:
                        break
                else:
                    break
    elif m != 1:
        for a in b:
            print(b)
            c = a
            while True:
                if a >= l:
                    if a <= r:
                        ans += 1
                        break
                    else:
                        b.remove(c)
                        break
                else:
                    b.remove(c)
                    break
    else:
        for a in b:
            print(b)
            c = a
            while True:
                if a == n:
                    ans += 1
                    break
                if a >= l:
                    if a <= r:
                        a += 1
                    else:
                        break
                else:
                    break
    m -= 1

print(ans)

Fixed submission:
a, b = map(int, input().split())
if a <= 5:
    ans = 0
elif a <= 12:
    ans = b // 2
else:
    ans = b
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
sa = s[k: k + 1]
sl = len(s)
sli = list(s)
hey = []
for sli in sli:
    if sli == sa:
        hey.append(sli)
    else:
        hey.append("*")
hey = "".join(hey)
print(hey)

Fixed submission:
a, b, c = map(int, input().split())
if b > a:
    if b > c and a < c:
        print("Yes")
    else:
        print("No")
elif a > b:
    if a > c and b < c:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a >= 100:
    a1 = a % 10
else:
    a2 = a - 100
    a1 = a2 % 10
if b >= 100:
    b1 = b % 10
else:
    b2 = b - 100
    b1 = b2 % 10
if c >= 100:
    c1 = c % 10
else:
    c2 = c - 100
    c1 = c2 % 10
if d >= 100:
    d1 = d % 10
else:
    d2 = d - 100
    d1 = d2 % 10
if e >= 100:
    e1 = e % 10
else:
    e2 = e - 100
    e1 = e2 % 10
if a1 == 0:
    a1 = 9
if b1 == 0:
    b1 = 9
if c1 == 0:
    c1 = 9
if d1 == 0:
    a1 = 9
if e1 == 0:
    e1 = 9
lis = [a1,b1,c1,d1,e1]
if a1 == min(lis) :
    answer = math.ceil(b / 10) * 10 + math.ceil(c/ 10) * 10 + math.ceil(e/ 10* 10+ math.ceil(d/ 10 * 10 + a
if b1 == min(lis):
    answer = math.ceil(a/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + b
if c1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(a/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(d/ 10)* 10 + c
if d1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + d
if e1 == min(lis):
    answer = math.ceil(b/ 10)* 10 + math.ceil(c/ 10)* 10 + math.ceil(e/ 10)* 10 + math.ceil(a/ 10)* 10 + e
print(answer)

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