Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#%%
import itertools

D, G = map(int, input().split())
p = [0] * D
c = [0] * D
com = [0] * D
for i in range(D):
    p[i], c[i] = map(int, input().split())
    com[i] = [100 * (i+1) * p[i] + c[i], p[i]]

l = list(itertools.product(range(2), repeat=D))
score_list = []
for i in range(len(l)):
    tmp1 = 0
    tmp2 = []
    tmp3 = -1
    tmp5 = 0
    for j in range(D):
        if l[i][j] == 0:
            tmp2.append(j)
            pass
        else:
            tmp1 += com[j][0]
            tmp5 += com[j][1]
    if len(tmp2) != 0:
        tmp3 = tmp2[-1]
    if tmp3 != -1:
        tmp4 = tmp1 + (tmp3+1) * 100 * (p[tmp3]-1)
    else:
        tmp4 = tmp1
    
    score_list.append([tmp1, tmp3, tmp4, tmp5])

#print(score_list)

ans_list = []

for i in range(len(score_list)):
    if score_list[i][2] != -1:
        if score_list[i][0]<= G and score_list[i][2] >= G:
            tmp = (G - score_list[i][0]) // ((score_list[i][1]+1)*100)
            ans = score_list[i][3] + tmp
            ans_list.append(ans)
#            print(score_list[i][3], ans)
    else:
        if score_list[i][0]>= G:
            ans_list.append(score_list[i][3])

#print(ans_list)
print(min(ans_list))



Fixed submission:
import itertools
D, G = map(int, input().split())
p = [0] * D
c = [0] * D
pc = [0] * D
for i in range(D):
    p[i], c[i] = map(int, input().split())

l = list(itertools.product(range(2), repeat=D))

comp = []
for i in range(len(l)-1):
    score = 0
    count = 0
    m = -100
    for j in range(D):
        if l[i][j] == 1:
            score += (j+1) * 100 * p[j] + c[j]
            count += p[j]
        elif l[i][j] == 0:
            m = max(m, j)
    tmp = [score, count]
    comp.append(tmp)
    for j in range(p[m]-1):
        score += (m+1) * 100 * 1
        count += 1
        tmp = [score, count]
        comp.append(tmp)

score = 0
count = 0
for i in range(D):
    score += (i+1) * 100 * p[i] + c[i]
    count += p[i]
tmp = [score, count]
comp.append(tmp)    

#print(comp)

ans = []
for i in range(len(comp)):
    if comp[i][0] >= G:
        ans.append(comp[i][1])

ans = min(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
l = list(map(int,input().split()))
l.sort()
ans = []
for i in range(N-1):
  ans.append(l[i+1] - l[i])
print(sum(ans))

Fixed submission:
l = list(map(int,input().split()))
l.sort()
ans = []
for i in range(len(l)-1):
  ans.append(l[i+1] - l[i])
print(sum(ans))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
if a+b == 15:
  print('+')
if a*b == 15:
  print('*')
else:
  print('x')

Fixed submission:
a, b = map(int, input().split())
if a+b == 15:
  print('+')
elif a*b == 15:
  print('*')
else:
  print('x')
Buggy python submission (verdict: Runtime Error):
S = list(input())
a = list.count('+')
b = list.count('-')
print(int(a) - int(b))


Fixed submission:
S = list(input())
a = S.count('+')
b = S.count('-')
print(int(a) - int(b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = []

for i in range(1,N-1):
    tmp1 = list(str(i))
    tmp2 = list(str(N-i))
    s1 = 0
    s2 = 0
    for j in range(len(tmp1)):
        s1 += int(tmp1[j])
    for j in range(len(tmp2)):
        s2 += int(tmp2[j])
    tmp3 = abs(s1+s2)
    l.append(tmp3)

ans = min(l)
print(ans)



Fixed submission:
N = int(input())
l = []

for i in range(1,N):
    tmp1 = list(str(i))
    tmp2 = list(str(N-i))
    s1 = 0
    s2 = 0
    for j in range(len(tmp1)):
        s1 += int(tmp1[j])
    for j in range(len(tmp2)):
        s2 += int(tmp2[j])
    tmp3 = abs(s1+s2)
    l.append(tmp3)

ans = min(l)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
l = ['zzzzzzzzzzzzzzz','zzzzzzzzzzzzzzz','zzzzzzzzzzzzz','zzzzzzzzzzzz','zzzzzzzzz']
N = len(s)

for i in range(N):
    for j in range(N-i):
        tmp = s[j:j+i+1]
        if tmp not in l:
            l.append(tmp)
        l.sort()
        l = l[0:5]


l.sort()
#print(l)


ans = l[K-1]
print(ans)



Fixed submission:
s = input()
K = int(input())
l = ['zzzzzzzzzzzzzzz','zzzzzzzzzzzzzzz','zzzzzzzzzzzzz','zzzzzzzzzzzz','zzzzzzzzz']
N = len(s)

for i in range(K+1):
    for j in range(N-i):
        tmp = s[j:j+i+1]
        if tmp not in l:
            l.append(tmp)
        l.sort()
        l = l[0:5]


l.sort()
#print(l)


ans = l[K-1]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
K = int(input())
l = []
N = len(s)

for i in range(N):
    for j in range(N-i):
        tmp = s[j:j+i+1]
        l.append(''.join(tmp))

l = list(set(l))
l.sort()
#print(l)


ans = l[K-1]
print(ans)



Fixed submission:
s = input()
K = int(input())
l = ['zzzzzzzzzzzzzzz','zzzzzzzzzzzzzzz','zzzzzzzzzzzzz','zzzzzzzzzzzz','zzzzzzzzz']
N = len(s)

for i in range(K+1):
    for j in range(N-i):
        tmp = s[j:j+i+1]
        if tmp not in l:
            l.append(tmp)
        l.sort()
        l = l[0:5]


l.sort()
#print(l)


ans = l[K-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [[] for _ in range(H)]
for i in range(H):
    S[i] = list(input())

count = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            count[i][j] = 10**7
        else:
            count[i][j] = 0

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            if j != W-1 and S[i][j+1] == '#':
                count[i][j] += 1
            if j != 0 and S[i][j-1] == '#':
                count[i][j] += 1
            if i != W-1 and S[i+1][j] == '#':
                count[i][j] += 1
            if i != 0 and S[i-1][j] == '#':
                count[i][j] += 1

check = 0
for i in range(H):
    for j in range(W):
        if count[i][j] < 1:
            check = 1

if check == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
H, W = map(int, input().split())
S = [[] for _ in range(H)]
for i in range(H):
    S[i] = list(input())

count = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            count[i][j] = 10**7
        else:
            count[i][j] = 0

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            if j != W-1: 
                if S[i][j+1] == '#':
                    count[i][j] += 1
            if j != 0: 
                if S[i][j-1] == '#':
                    count[i][j] += 1
            if i != H-1: 
                if S[i+1][j] == '#':
                    count[i][j] += 1
            if i != 0: 
                if S[i-1][j] == '#':
                    count[i][j] += 1

check = 0
for i in range(H):
    for j in range(W):
        if count[i][j] < 1:
            check = 1

if check == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
a = [0] * (N+1)

for i in range(1,N+1):
    a[i] = a[i-1] + A[i-1]

a.sort()
#print(a)

b = list(set(a))

count = []

for i in range(len(b)):
    tmp = a.count(b[i])
    if tmp >= 2:
        count.append(tmp)

#print(count)

ans = 0

for i in range(len(count)):
    tmp = count[i]*(count[i]-1) //2
    ans += tmp

print(ans) 



Fixed submission:
N = int(input())
A = list(map(int, input().split()))
a = [0] * (N+1)

for i in range(1,N+1):
    a[i] = a[i-1] + A[i-1]

a.sort()
#print(a)

ans = 0
s = 0

for i in range(N+1):
    if i == 0:
        s += 1
    elif 1 <= i <= N -1:
        if a[i] == a[i-1]:
            s += 1
        else:
            if s >= 2:
                tmp = s*(s-1) //2
                ans += tmp
            s = 1
    elif i == N :
        if a[i] == a[i-1]:
            s += 1
            if s >= 2:
                tmp = s*(s-1) //2
                ans += tmp
        else:
            if s >= 2:
                tmp = s*(s-1) //2
                ans += tmp
            s = 1
#    print(ans, s)






print(ans)
Buggy python submission (verdict: Runtime Error):
S = list(input())
S_unique = list(set(S))

alpha = list("abcdefghijklmnopqrstuvwxyz")


if len(S_unique) != 26:
    for i in range(len(alpha)):
        if alpha[i] not in S_unique:
            ans = alpha[i]
            break

a = ''.join(S) + ans
print(a)


Fixed submission:
#%%
alpha2num = lambda c: ord(c) - ord('a') + 1
num2alpha = lambda c: chr(c+64)
S = list(input())

S = S[::-1]
alpha = 'abcdefghijklmnopqrstuvwxyz'
alpha = list(alpha)

a = 0

if len(S) != 26:
    for i in range(len(alpha)):
        if alpha[i] not in S:
            b = alpha[i]
            break
    ans = ''.join(S)[::-1] + b
else:
    for i in range(1,len(S)):
        if S[i] < S[i-1]:
            a = i
            break
    if a == 0:
        ans = -1
    else:
        for i in range(len(alpha)):
            if alpha[i] not in S[a+1:] and alpha[i] > S[a]:
                c = alpha[i]
                break
        ans = (c + ''.join(S[a+1:]))[::-1]

print(ans)

#%%
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int, input().split())
if A+B >= C:
  print('Yes')
else:
  print('No)

Fixed submission:
A,B,C = map(int, input().split())
if A+B >= C:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
#%%
h, w, d = map(int, input().split())
a = [0] * h
for i in range(h):
    a[i] = list(map(int, input().split()))
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

pos = [[0] for _ in range(h*w+1)]
for i in range(h):
    for j in range(w):
        pos[a[i][j]] = [i+1, j+1]
#print(pos)

cost = [[0]*(h*w+1) for i in range(h*w+1)]
#print(cost)

for i in range(1, len(cost)):
    for j in range(i, len(cost)):
        pos1 = pos[i]
        pos2 = pos[j]
        dist = abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
        cost[i][j] = dist

##print(np.array(cost))


for i in range(q):
    tmp = 0
    while l[i] != r[i]:
        tmp += cost[l[i]][l[i]+d]
        l[i] += d
    print(tmp)


Fixed submission:
#%%
h, w, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

reach = [0] * (w * h)
for i in range(h):
    for j in range(w):
        reach[a[i][j] - 1] = [i, j]
#print(reach)

count = [0] * (w * h)
for i in range((w * h)):
    if i - d < 0 : 
        pass
    else:
        count[i] = count[i - d] + (abs(reach[i][0] - reach[i - d][0]) + abs(reach[i][1] - reach[i - d][1]))
#print(count)

for i in range(q):
    print(count[r[i] - 1] - count[l[i] - 1])

Buggy python submission (verdict: Time Limit Exceeded):
#%%
h, w, d = map(int, input().split())
a = [0] * h
for i in range(h):
    a[i] = list(map(int, input().split()))
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

pos = [[0] for _ in range(h*w+1)]
for i in range(h):
    for j in range(w):
        pos[a[i][j]] = [i+1, j+1]
#print(pos)

cost = [[0]*(h*w+1) for i in range(h*w+1)]
#print(cost)

for i in range(1, len(cost)):
    for j in range(i, len(cost)):
        pos1 = pos[i]
        pos2 = pos[j]
        dist = abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
        cost[i][j] = dist

import numpy as np
##print(np.array(cost))


for i in range(q):
    tmp = 0
    while l[i] != r[i]:
        tmp += cost[l[i]][l[i]+d]
        l[i] += d
    print(tmp)


Fixed submission:
#%%
h, w, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

reach = [0] * (w * h)
for i in range(h):
    for j in range(w):
        reach[a[i][j] - 1] = [i, j]
#print(reach)

count = [0] * (w * h)
for i in range((w * h)):
    if i - d < 0 : 
        pass
    else:
        count[i] = count[i - d] + (abs(reach[i][0] - reach[i - d][0]) + abs(reach[i][1] - reach[i - d][1]))
#print(count)

for i in range(q):
    print(count[r[i] - 1] - count[l[i] - 1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
N_500 = N%500
if A >= N_500 :
  print('Yes')
else :
  pritn('No')

Fixed submission:
N = int(input())
A = int(input())
N_500 = N%500
if A >= N_500 :
  print('Yes')
else :
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
#%%
def search(x, y, z):
    return [[x-1, y, z+1], [x, y-1, z+1], [x, y+1, z+1], [x+1, y, z+1]]
    
h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())

sharp = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            sharp += 1

check = [[0] * w for _ in range(h)]
que = [[0,0,1]]
check[0][0] == 1
flag = False

while len(que) > 0:
    tmp = que.pop(-1)
   #print(tmp)
    for i in search(tmp[0], tmp[1], tmp[2]):
        if 0 <= i[0] <= h-1 and 0 <= i[1] <= w-1 and s[i[0]][i[1]] == '.':
            if check[i[0]][i[1]] == 0:
                que.append(i)
                check[i[0]][i[1]] == 1
    if tmp[0] == h-1 and tmp[1] == w-1:
        key = tmp[2]
        flag = True
        break
#print(key)

if flag:
    print(h*w - sharp - key)
else:
    print(-1)
                



Fixed submission:
#%%
def search(x, y, z):
    return [[x-1, y, z+1], [x, y-1, z+1], [x, y+1, z+1], [x+1, y, z+1]]
    
h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())

sharp = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            sharp += 1

check = [[0] * w for _ in range(h)]
que = [[0,0,1]]
check[0][0] == 1
flag = False

while len(que) > 0:
    tmp = que.pop(0)
    #print(tmp)
    for i in search(tmp[0], tmp[1], tmp[2]):
        if 0 <= i[0] <= h-1 and 0 <= i[1] <= w-1 and s[i[0]][i[1]] == '.':
            if check[i[0]][i[1]] == 0:
                que.append(i)
                check[i[0]][i[1]] = 1
    if tmp[0] == h-1 and tmp[1] == w-1:
        key = tmp[2]
        flag = True
        break
#print(key)

if check[0][0] =='#':
    flag = False

if flag:
    print(h*w - sharp - key)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
if : a % 2 = 0　and b % 2 =0
  print("even")
elif 
  

Fixed submission:
a, b = map(int, input().split())
if a*b%2 == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
print('Draw')n, a, b = map(int, input().split())

if (b-a)  % 2 == 0:
    ans = 'Alice'
else:
    ans = 'Borys'

print(ans)

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

if (b-a)  % 2 == 0:
    ans = 'Alice'
else:
    ans = 'Borys'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, k = map(int, input().split())
S = list(map(int, input().split()))
S_unique = list(set(S))
S_unique_count = []

for i in range(len(S_unique)):
    tmp = S.count(S_unique[i])
    S_unique_count.append(tmp)

S_unique_count.sort()

ans = sum(S_unique_count[0:len(S_unique_count)-k])
print(ans)

Fixed submission:
import collections

N, k = map(int, input().split())
S = list(map(int, input().split()))
S_unique_count = list(collections.Counter(S).values())

S_unique_count.sort()

ans = sum(S_unique_count[0:len(S_unique_count)-k])
print(ans)
Buggy python submission (verdict: Runtime Error):
#%%
import copy 

H, W = map(int, input().split())
c = [[int(_) for _ in input().split()] for _ in range(10)]
A = [[int(_) for _ in input().split()] for _ in range(H)]

d = copy.deepcopy(c)

for i in range(10):
    for j in range(10):
        for k in range(10):
            d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 0
#for i in range(H):
#    for j in range(W):
#        if A[i][j] == 0 or A[i][j] >= 2:
#            ans += d[A[i][j]][1]


for i in a:
    for j in i:
        if j > 1 or j == 0:
            ans += d[j][1]

print(ans)

Fixed submission:
#%%
import copy 

H, W = map(int, input().split())
c = [[int(_) for _ in input().split()] for _ in range(10)]
A = [[int(_) for _ in input().split()] for _ in range(H)]

d = copy.deepcopy(c)

for k in range(10):
    for i in range(10):
        for j in range(10):
            d[i][j] = min(d[i][j], d[i][k]+d[k][j])


ans = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == 0 or A[i][j] >= 2:
            ans += d[A[i][j]][1]


print(ans)
Buggy python submission (verdict: Runtime Error):
print(list(input).count(1))

Fixed submission:
print(list(input()).count('1'))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

check = [0] * 100000000

ans = []
for i in range(n):
  if check[a[i]-1] == 0:
    check[a[i]-1] = 1
  else:
    check[a[i]-1] = 0

ans = check.count(1)
print(ans)

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
A.sort()

#print(A)

check = [0]
for i in range(1, N):
    if A[i] != A[i-1]:
        check.append(i)
check.append(N)

l = []
for i in range(1, len(check)):
    tmp = check[i] - check[i-1]
    l.append(tmp)

#print(l)

ans = 0
for i in range(len(l)):
    if l[i] % 2 == 1:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

ans = []
for i in range(n):
  count = a.count(a[i])
  if count %2 == 1 and a[i] not in ans :
    ans.append(a[i])

print(len(ans))

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
A.sort()

#print(A)

check = [0]
for i in range(1, N):
    if A[i] != A[i-1]:
        check.append(i)
check.append(N)

l = []
for i in range(1, len(check)):
    tmp = check[i] - check[i-1]
    l.append(tmp)

#print(l)

ans = 0
for i in range(len(l)):
    if l[i] % 2 == 1:
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

ans = []
for i in range(n):
  count = a.count(a[i])
  if count %2 == 1 :
    ans.append(a[i])

ans = list(set(ans))
print(len(ans))

Fixed submission:
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
A.sort()

#print(A)

check = [0]
for i in range(1, N):
    if A[i] != A[i-1]:
        check.append(i)
check.append(N)

l = []
for i in range(1, len(check)):
    tmp = check[i] - check[i-1]
    l.append(tmp)

#print(l)

ans = 0
for i in range(len(l)):
    if l[i] % 2 == 1:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#%%
import itertools

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d

n, m, R = map(int, input().split())
r = list(map(lambda x: int(x)-1,input().split()))
dist = [[float("inf")] * n for _ in range(n)]
for i in range(n):
    dist[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    dist[a][b] = c
    dist[b][a] = c
dist = warshall_floyd(dist)

l = list(itertools.permutations(r))
ans = float("inf")
for i in range(len(l)):
    tmp = 0
    for j in range(len(r)-1):
        tmp += dist[l[i][j]][l[i][j+1]]
    ans = min(ans, tmp)
print(ans)

Fixed submission:
#%%
import itertools

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d

n, m, R = map(int, input().split())
r = list(map(lambda x: int(x)-1,input().split()))
dist = [[float("inf")] * n for _ in range(n)]
for i in range(n):
    dist[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    dist[a][b] = c
    dist[b][a] = c
dist = warshall_floyd(dist)

l = list(itertools.permutations(r))
ans = float("inf")
for i in range(len(l)):
    tmp = 0
    for j in range(len(r)-1):
        tmp += dist[l[i][j]][l[i][j+1]]
    ans = min(ans, tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections

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

c = list(collections.Counter(A).items())
c.sort(reverse=True)

a = 0

for i in range(N):
    if c[i][1] >= 4:
        a = c[i][0]
        b = c[i][0]
        break
    elif c[i][1] >= 2:
        a = c[i][0]
        e = i
        break

b = 0

if a == 0:
    print(0)
else:
    for i in range(e+1, N):
        if c[i][1] >= 2:
            b = c[i][0]
            break
    if b == 0:
        print(0)
    else:
        print(a*b)




Fixed submission:
import collections

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

c = list(collections.Counter(A).items())
c.sort(reverse=True)

a = 0
b = 0
e = -1

for i in range(N):
    if c[i][1] >= 4:
        a = c[i][0]
        b = c[i][0]
        break
    elif c[i][1] >= 2:
        a = c[i][0]
        e = i
        break

if a == 0:
    print(0)
elif e !=-1:
    for i in range(e+1, N):
        if c[i][1] >= 2:
            b = c[i][0]
            break
    if b == 0:
        print(0)
    else:
        print(a*b)
else:
    print(a*b)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = a+b
if c%3 == 0:
  print('Possible')
else:
  print('Impossible
')

Fixed submission:
a,b = map(int,input().split())
c = a+b
if c%3 == 0 or a%3 ==0 or b%3 == 0:
  print('Possible')
else:
  print('Impossible')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = []
c = []

for i in range(n):
    if i%2 == 0:
        b.appendleft(str(a[i]))
    else:
        b.append(str(a[i]))

if n%2 == 0:
    ans = b[::-1]
else:
    ans = b

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

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


if n%2 == 0:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(0, n, 2):
        print(a[i], end=' ')
    
elif n%2 == 1:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(1, n, 2):
        print(a[i], end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []
c = []

for i in range(n):
    if i%2 == 0:
        b.insert(0, str(a[i]))
    else:
        b.append(str(a[i]))

if n%2 == 0:
    ans = b[::-1]
else:
    ans = b

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

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


if n%2 == 0:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(0, n, 2):
        print(a[i], end=' ')
    
elif n%2 == 1:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(1, n, 2):
        print(a[i], end=' ')

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

for i in range(n):
    if i%2 == 0:
        b.insert(0, str(a[i]))
    else:
        b.append(str(a[i]))

if n%2 == 0:
    ans = b[::-1]
else:
    ans = b

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

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


if n%2 == 0:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(0, n, 2):
        print(a[i], end=' ')
    
elif n%2 == 1:
    for i in range(n-1,-1,-2):
        print(a[i], end=' ')
    for i in range(1, n, 2):
        print(a[i], end=' ')