Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
if h == 1 or w ==1:
	print(1)
	exit()
elif w % 2 == 0:
	print(h * w // 2)
	exit()
elif w % 2 == 1:
	if h % 2 == 0:
		print(h * w // 2)
		exit()
	elif h % 2 == 1:
		print((h * w // 2) + 1)
		exit()

Fixed submission:
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())

print(s[k-1])

Buggy python submission (verdict: Runtime Error):
h , w = map(int, input().split())
c = 0
if h == 1 or w ==1:
	print(1)
	exit()
 
if w % 2 == 0:
	print(h * w // 2)
	exit()
elif w % 2 == 1:
	if h % 2 == 0:
		print(h * w // 2)
		exit()
	elif h % 2 == 1:
		print((h * w // 2) + 1)
		exit()

Fixed submission:
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())

print(s[k-1])
Buggy python submission (verdict: Runtime Error):
if h == 1 or w ==1:
	print(1)
	exit()
elif w % 2 == 0:
	print(h * w // 2)
	exit()
elif w % 2 == 1:
	if h % 2 == 0:
		print(h * w // 2)
		exit()
	elif h % 2 == 1:
		print((h * w // 2) + 1)
		exit()

Fixed submission:
h , w = map(int, input().split())


if h == 1 or w ==1:
	print(1)
	exit()
elif w % 2 == 0:
	print(h * w // 2)
	exit()
elif w % 2 == 1:
	if h % 2 == 0:
		print(h * w // 2)
		exit()
	elif h % 2 == 1:
		print((h * w // 2) + 1)
		exit()
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
v = n

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    eixt()


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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
v = n

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()


if n > a + b and n < a + a + b:
    print(a+(n - (a + b)))
    exit()

c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    eixt()


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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
v = n

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()


if n > a + b and n < a + a + b:
    print(a+(n - (a + b)))
    exit()

c = n % (a +b)
if n % (a +b) > a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    eixt()


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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()

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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()


while True:
    

    for i in range(a):
        
        if len(ans) == n:
            print(ans.count("b"))
            exit()
        ans.append("b")
        

    for j in range(b):
        if len(ans) == n:
            print(ans.count("b"))
            exit()
        ans.append("r")



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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

s = []
for i in range(m):
    s.append(list(map(int, input().split())))

if n == 1:
    a = [str(i) for i in range(10)]
elif n == 2:
    a = [str(i) for i in range(10:100)]
elif n == 3:
    a = [str(i) for i in range(100:1000)]

ans = []

for i in a:
    b = True
    for j in s:
        if int(i[j[0]-1]) != j[1]:
            b = False
            break
    if b:
        ans.append(i)

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



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

s = []
for i in range(m):
    s.append(list(map(int, input().split())))

if n == 1:
    a = [str(i) for i in range(10)]
elif n == 2:
    a = [str(i) for i in range(10,100)]
elif n == 3:
    a = [str(i) for i in range(100,1000)]

ans = []

for i in a:
    b = True
    for j in s:
        if int(i[j[0]-1]) != j[1]:
            b = False
            break
    if b:
        ans.append(i)

if len(ans) == 0:
    print(-1)
else:
    print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for _ in range(n)]
a = list(set(s))
ans = []

for i in range(len(a)):
	ans.append([s.count(a[i]),a[i]])

ans.sort(key=lambda x: x[1])
ans.sort(key=lambda x: x[0], reverse = True)

y = ans[0][0]

for i, j in ans:
	if y == i:
		print(j)




Fixed submission:
import collections

n = int(input())
s = [input() for _ in range(n)]
a = list(set(s))
ans = []

t = collections.Counter(s)
v = list(t.most_common())[0][1]

for i,j in list(t.most_common()):
	if v == j:
		ans.append(i)

for i in sorted(ans):
	print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted([int(i) for i in input().split()])


for i in range(n):
	if a.count(a[i]) > 1 or a.count(a[-i]) > 1:
		print("NO")
		exit()

print("YES")

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

if len(a) == len(set(a)):
	print("YES")
else:
	print("NO")

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

for i in range(n):
	if a.count(a[i]) > 1:
		print("NO")
		exit()

print("YES")

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

if len(a) == len(set(a)):
	print("YES")
else:
	print("NO")

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

for i in range(n):
	for j in range(n):
		if i < j:
			if a[i] == a[j]:
				print("NO")
				exit()

print("YES")

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

if len(a) == len(set(a)):
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Runtime Error):
from math import gcd
a, b = map(int, input().split())

print(a * b // gcd(a, b))

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())

print(a * b // gcd(a, b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

min = 2020202021

for i in range(1,len(a)):
    
    if min > abs(sum(a[:i]) - sum(a[i:])):
        min = abs(sum(a[:i]) - sum(a[i:]))

print(min)

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

len_f = sum(a)
sum_a = 0
min = 2020202021

for i in range(n):
    sum_a += a[i]
    len_f -= a[i]
    if min > abs(sum_a - len_f):
        min = abs(sum_a - len_f)

print(min)

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

min = 2020202021

for i in range(1,len(a)):
    
    if min > abs(sum(a[:i]) - sum(a[i:])):
        min = abs(sum(a[:i]) - sum(a[i:]))

print(min)

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

len_f = sum(a)
sum_a = 0
min = 2020202021

for i in range(n):
    sum_a += a[i]
    len_f -= a[i]
    if min > abs(sum_a - len_f):
        min = abs(sum_a - len_f)

print(min)

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

min = sum(a)

for i in range(1,len(a)):
    
    if min > abs(sum(a[:i]) - sum(a[i:])):
        min = abs(sum(a[:i]) - sum(a[i:]))

print(min)

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

len_f = sum(a)
sum_a = 0
min = 2020202021

for i in range(n):
    sum_a += a[i]
    len_f -= a[i]
    if min > abs(sum_a - len_f):
        min = abs(sum_a - len_f)

print(min)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
count = 0

for i in len(s):
	if s[i] == t[i]:
		count += 1

print(count)

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

for i in range(len(s)):
	if s[i] == t[i]:
		count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = []
tmp = 0

for i in range(1,len(h)):
    if h[i-1] - h[i] >= 0:
        tmp += 1
    else:
        tmp = 0
    ans.append(tmp)

print(max(ans))



Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
ans = []
tmp = 0
if len(h) == 1:
    print(0)
    exit()

for i in range(1,len(h)):
    if h[i-1] - h[i] >= 0:
        tmp += 1
    else:
        tmp = 0
    ans.append(tmp)

print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int , input().split())

for i in range(max(a, b)):
	if abs(a - i) == abs(b - i):
		print(i)
		exit()

print("IMPOSSIBLE")



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

if (a + b) % 2 == 0:
	print((a + b) // 2)
else:
	print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

for i in range(len(a)):
    tmp = a.pop(i)
    print(max(a))
    a.insert(i, tmp)



Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max1 = max(a)
max2 = sorted(a)[-2]

if a.count(max1) >= 2:
    for i in range(n):
        print(max1)
elif a.count(max1) == 1:
    for i in range(n):
        if a[i] == max1:
            print(max2)
        else:
            print(max1)

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

for i in range(len(a)):
    tmp = a.pop(i)
    print(max(a))
    a.insert(i, tmp)



Fixed submission:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

max1 = max(a)
max2 = sorted(a)[-2]

if a.count(max1) >= 2:
    for i in range(n):
        print(max1)
elif a.count(max1) == 1:
    for i in range(n):
        if a[i] == max1:
            print(max2)
        else:
            print(max1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = [int(i) for i in input().split()]

c = 0

for k in range(1,max(d)+1):
	arc = []
	abc = []
	for j in range(len(d)):
		if d[j] >= k:
			arc.append(d[j])
		else:
			abc.append(d[j])
	
	if len(abc) == len(arc):
		c += 1

print(c)

Fixed submission:
n = int(input())
d = [int(i) for i in input().split()]

d.sort()

ans = d[len(d)//2] - d[len(d)//2-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
 
print((a+b+c)-max(a,b,c))

Fixed submission:
a = [i for i in input().split()]
print(int(sorted(a)[0]) + int(sorted(a)[1]))

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
 
print( (a + b + c) - max(a, b, c)) 

Fixed submission:
a = [i for i in input().split()]
print(int(sorted(a)[0]) + int(sorted(a)[1]))

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

print( (a + b + c) - max(a, b, c)) 

Fixed submission:
a = [i for i in input().split()]
print(int(sorted(a)[0]) + int(sorted(a)[1]))
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b, n = map(int, input().split())
ans = 0

for i in range(n // r + 1):
  for j in range(n // g + 1):
    if (n - (i * r) - (j * g) )% b == 0 and 0 <= (n - (i * r) - (j * g) )//b<= n//b :
      ans += 1

      
print(ans)

Fixed submission:
r, g, b, n = map(int, input().split())
ans = 0

for i in range(n // r + 1):
  for j in range(n // g + 1):
    if (n - (i * r) - (j * g) )% b == 0 and 0 <= (n - (i * r) - (j * g) )//b<= n//b :
      ans += 1

      
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [i for i in input()]
k = int(input())
g = s[k]

for i in range(n):
	if s[i] != g:
		s[i] = "*"

print("".join(s))


Fixed submission:
n = int(input())
s = [i for i in input()]
k = int(input())
g = s[k-1]

for i in range(n):
	if s[i] != g:
		s[i] = "*"

print("".join(s))
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ans = []

for i in range(1, max(a,b)):
    if a % i == 0 and b % i == 0:
        ans.append(i)

print(ans[-k])

Fixed submission:
a, b, k = map(int, input().split())
ans = []

for i in range(1, max(a,b)+1):
	if a % i == 0 and b % i == 0:
		ans.append(i)

print(ans[-k])

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
ans = []

if a == 1 and b == 1 and k == 1:
	print(1)
	exit()

for i in range(1, max(a,b)):
	if a % i == 0 and b % i == 0:
		ans.append(i)

print(ans[k-1])

Fixed submission:
a, b, k = map(int, input().split())
ans = []

for i in range(1, max(a,b)+1):
	if a % i == 0 and b % i == 0:
		ans.append(i)

print(ans[-k])
Buggy python submission (verdict: Runtime Error):
import functools
import fructions

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

gcd = functools.reduce(fructions.gcd, a)
print(gcd)

Fixed submission:
import functools
import fractions

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

gcd = functools.reduce(fractions.gcd, a)
print(gcd)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0
for i in range(1,len(s)):
  if s[i] == "W":
    a = s[:i].count("W")
    b = len(s[:i+1])
    ans += b - a - 1

print(ans)

Fixed submission:
s = input()

ans = 0
for i in range(len(s)):
  if s[i] == "W":
    ans += i

a = 0
for i in range(s.count("W")):
  a += i

print(ans - a)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = []

for i in range(n):
  h.append(int(input()))
h.sort()

ans = []
for i in range(0,len(h)-k+1):
  ans.append(max(h[i: i+k]) - min(h[i: i+k]))

print(min(ans))
  

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

for i in range(n):
  h.append(int(input()))
h.sort()

ans = []
for i in range(0,len(h)-k+1):
  ans.append(h[i+k-1] - h[i])

print(min(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())

if n == 1:
	print("Hwllo World")
else:
	print( a + b)

Fixed submission:
n = int(input())

if n == 1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
import functools
import math

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

a.append(x)
a.sort()

for i in range(len(a)):
  a[i] = abs(a[i] - x)

gcd = functools.reduce(math.gcd, a)
print(gcd)

Fixed submission:
import functools
import fractions

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

a.append(x)
a.sort()

for i in range(len(a)):
  a[i] = abs(a[i] - x)

gcd = functools.reduce(fractions.gcd, a)
print(gcd)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
a = [int(i) for i in input().split()]

a.append(x)
a.sort()

if n == 1:
  print(max(a) - min(a))
  exit()


for i in range(1,len(a)):
  if a[i] == x:
    print(min(x-a[i-1] , a[i+1] - x))
    exit()



Fixed submission:
import functools
import fractions

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

a.append(x)
a.sort()

for i in range(len(a)):
  a[i] = abs(a[i] - x)

gcd = functools.reduce(fractions.gcd, a)
print(gcd)
Buggy python submission (verdict: Runtime Error):
n = input()
k = int(input())

if n.count("1") == len(k):
  print(1)
  exit()

for i in range(k):
  
  if n[i] != "1":
    print(n[i])
    exit()

    


Fixed submission:
n = input()
k = int(input())
ans = 1

for i in range(k):
  
  if n[i] != "1":
    ans = n[i]
    break

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

if (b - a)  < k * 2:
    for i in range(a, b+1):
        print(i)
    exit()
else:
    for i in range(a,a+k):
    print(i)
  for i in range(b-k+1,b+1):
    print(i)

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

if (b - a)  < k * 2:
    for i in range(a, b+1):
        print(i)
    exit()
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

if (b - a)  < k * 2:
    for i in range(a, b+1):
        print(i)
    exit()


ans = []
for i in range(a,b+1):
    ans.append(i)

for j in range(len(ans)):
    if k <= j < (len(ans) - k):
        pass
    else:
        print(ans[j])


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

if (b - a)  < k * 2:
    for i in range(a, b+1):
        print(i)
    exit()
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
Buggy python submission (verdict: Runtime Error):
a = [str(i) for i in input()]

if len(a) > 6:
	print("NO")
	exit()

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")

	

Fixed submission:
a = [str(i) for i in input()]

if len(a) > 10:
	print("NO")
	exit()

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")

Buggy python submission (verdict: Runtime Error):
a = [str(i) for i in input()]

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")

	

Fixed submission:
a = [str(i) for i in input()]

if len(a) > 10:
	print("NO")
	exit()

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
a = [str(i) for i in input()]

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")

	

Fixed submission:
a = [str(i) for i in input()]

if len(a) > 10:
	print("NO")
	exit()

for bit in range(2 ** (len(a)+1)):
	s = a.copy()

	for i in range(0,len(a)+1):
		if (bit >> i) & 1:
			s.insert(i*2, "A")
			
	if "".join(s) == "AKIHABARA":
		print("YES")
		exit()

print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []

for i in range(n):
  a.append(int(input()))

b = 0
for i in range(len(a)):
  if a.count(a[i]) % 2 == 0:
    b += 1

print(len(set(a)) - b//2)

Fixed submission:
from collections import defaultdict

n = int(input())
cnt = defaultdict(int)

for i in range(n):
  cnt[int(input())] += 1

ret = 0
for c in cnt.values():
  
  if c % 2 == 1:
    ret += 1

print(ret)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in input().split():
  a.append(i)
  a = a[::-1]

print(" ".join(list(map(str, a))))



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

b=[]
c=[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            c.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            c.append(a[i])
        else:
            b.append(a[i])
c=c[::-1]
print(" ".join(c)+" "+" ".join(b))

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

ans = []
for i in range(len(a)):
  ans.append(a[i])
  ans = ans[::-1]

print(" ".join(list(map(str, ans))))

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

b=[]
c=[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            c.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            c.append(a[i])
        else:
            b.append(a[i])
c=c[::-1]
print(" ".join(c)+" "+" ".join(b))

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

ans = []
for i in range(len(a)):
  ans.append(a[i])
  ans = ans[::-1]

print(" ".join(list(map(str, ans))))

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

b=[]
c=[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            c.append(a[i])
else:
    for i in range(n):
        if i%2==0:
            c.append(a[i])
        else:
            b.append(a[i])
c=c[::-1]
print(" ".join(c)+" "+" ".join(b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

p = 1

for i in range(1,n):
	p += p * i

print(p % (10**9 + 7))

Fixed submission:
n = int(input())

p = 1
mod = 10**9 + 7
for i in range(1,n+1):
	p *=  i
	p %= mod

print(p)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
ans = 0
k, s = map(int, input().split())
sa = [int(i) for i in range(k+1)]

c = itertools.product(sa,repeat=3)

for i in c:
  if i[0] + i[1] + i[2] == s:
      ans+=1

print(ans)

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

for i in range(k+1):
  for j in range(k+1):
    z = s - i - j
    if 0 <= z <= k:
      ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
ans = 0
k, s = map(int, input().split())
sa = [int(i) for i in range(k+1)]

c = itertools.product(sa,repeat=3)

for i in c:
  if i[0] + i[1] + i[2] == s:
      ans+=1

print(ans)

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

for i in range(k+1):
  for j in range(k+1):
    z = s - i - j
    if 0 <= z <= k:
      ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a, o, b = map(int, input().split())

if o == "+":
	print(a + b)
else:
	print(a - b)

Fixed submission:
a, o, b = map(str, input().split())

if o == "+":
	print(int(a) + int(b))
else:
	print(int(a) - int(b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ai = []
 
for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()
 
c = 0
for i in range(len(ai)):
    c += ai.count(ai[i])
 
print(c // 4)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

print(len(ai) - len(list(map(list,set(map(tuple, ai))))))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

c = 0
for i in range(len(ai)):
    c += ai.count(ai[i])

print(c // 4)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

print(len(ai) - len(list(map(list,set(map(tuple, ai))))))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

c = 0
for i in range(len(ai)):
    for j in range(len(ai)):
        if i < j and ai[i] == ai[j]:
            c += 1

print(c)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
ai = []

for i, j in enumerate(a):
    ai.append([i+1,j])
    ai[i].sort()

print(len(ai) - len(list(map(list,set(map(tuple, ai))))))