Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import bisect

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_left(l, a + b)
        ans += max(idx - e - 1,)
print(ans)


Fixed submission:
import bisect

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_left(l, a + b)
        ans += max(idx - e - 1, 0)
print(ans)

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

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_right(l, a + b)
        for c in l[e+1:idx]:
            if not c < a + b:
                break
            ans += 1
print(ans)


Fixed submission:
import bisect

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_left(l, a + b)
        ans += max(idx - e - 1, 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
c = 0
l = [''.join(sorted(input())) for _ in range(n)]
c = 0
for i in range(n):
    for j in range(i+1, n):
        if l[i] == l[j]:
            c += 1
print(c)

Fixed submission:
n = int(input())
c = 0
d = {}
for _ in range(n):
    i = ''.join(sorted(input()))
    if i in d:
        c += d[i]
        d[i] += 1
    else:
        d[i] = 1
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = sum(map(abs, a))
if m % 2 == 0 or a in 0:
    print(s)
else:
    print(s - 2 * min(a))


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = [abs(i) for i in a]
if m % 2 == 0 or 0 in a:
    print(sum(s))
else:
    print(sum(s) - 2 * min(s))
Buggy python submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]
th = []
i = 1
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])


Fixed submission:
A, B, K = [int(i) for i in input().split()]
th = []
i = 0
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ans = 0
while True:
    a = s.count('01')
    ans += 2*a
    s = s.replace('01', '')
    
    b = s.count('10')
    ans += 2*b
    s = s.replace('10', '')

    if not a and not b:
        break
print(ans)


Fixed submission:
from collections import Counter
c = Counter(input())
print(2 * min((c['0'], c['1'])))
Buggy python submission (verdict: Runtime Error):
import math

input()
a = sorted((map(int, input().split())))
ans = a[0]
for i in range(1, len(a)):
    ans = math.gcd(ans, a[i])
print(ans)


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

input()
a = sorted((map(int, input().split())))
ans = a[0]
for i in range(1, len(a)):
    ans = gcd(ans, a[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = sorted(int, input().split())
print(int(a*b/2))

Fixed submission:
a,b,c = sorted(map(int, input().split()))
print(int(a*b/2))
Buggy python submission (verdict: Runtime Error):
n = int(input())
t,a = map(int, input().split())
h = [int(i) for i in input().split()]
candidates = list(map(lambda x: abs(a - t - x * 0.006), h))
print(candidates.index(min(candidates)) + 1)


Fixed submission:
a,b= map(int, input().split())
print(a + int(b/2))
Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = max([*map(int, input().split())])
y = min([*map(int, input().split())])
print('No War' if any([ X < z <= Y and x < z and z <= y for z in range(X+1, Y+1)]) else 'War')


Fixed submission:
N, M, X, Y = map(int, input().split())
x = max(map(int, input().split()))
y = min(map(int, input().split()))
print('No War' if any([ X < z <= Y and x < z <= y for z in range(X+1, Y+1)]) else 'War')

Buggy python submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = max([*map(int, input().split())])
y = min([*map(int, input().split())])
print('No War' if any([ X < z <= Y and x < z and z <= y for z in range(X+1, Y+1)]) else 'War')


Fixed submission:
N, M, X, Y = map(int, input().split())
x = max(map(int, input().split()))
y = min(map(int, input().split()))
print('No War' if any([ X < z <= Y and x < z <= y for z in range(X+1, Y+1)]) else 'War')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print((k/2)*((k+1)/2))

Fixed submission:
k = int(input())
print(k//2 * (k - k//2))
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))


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

Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = sorted([int(i) for i in input().split()])
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))


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

Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = [int(i) for i in input().split()]
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a) - n)
Buggy python submission (verdict: Runtime Error):
n=input()
if n%2 == 0:
 print(n)
else:
 print(n*2)

Fixed submission:
n = int(input())
if n % 2 == 0:
  print(n)
else:
  print(n*2)
Buggy python submission (verdict: Runtime Error):
input()
n=sorted(list(map(int,input().split())))
print(n［-1］- n［0］)

Fixed submission:
input()
n = sorted([int(i) for i in input().split()])
print(n[-1] - n[0])
Buggy python submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(0,100)]
elif d == 1:
    l = [i for i in range(0, 10000, 100)]
else:
    l = [i for i in range(0, 1000000, 10000)]
print(l[n])


Fixed submission:
d,n = map(int, input().split())
r = 100 ** d
l = [i for i in range(0, r*100, r)]
if n == 100:
    print(100 ** (d + 1) + 100 ** d)
else:
    print(l[n])

Buggy python submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(0,100)]
elif d == 1:
    l = [i for i in range(100, 10000, 100)]
else:
    l = [i for i in range(10000, 1000000, 10000)]
print(l[n])


Fixed submission:
d,n = map(int, input().split())
r = 100 ** d
l = [i for i in range(0, r*100, r)]
if n == 100:
    print(100 ** (d + 1) + 100 ** d)
else:
    print(l[n])

Buggy python submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(1,100)]
elif d == 1:
    l = [i for i in range(100, 10000, 100)]
else:
    l = [i for i in range(10000, 1000000, 10000)]
print(l[n])

Fixed submission:
d,n = map(int, input().split())
r = 100 ** d
l = [i for i in range(0, r*100, r)]
if n == 100:
    print(100 ** (d + 1) + 100 ** d)
else:
    print(l[n])
Buggy python submission (verdict: Time Limit Exceeded):
input()
n = [int(i) for i in input().split()]
index = 0
count = 0
while any([i % 2 == 0 for i in n]):
    if n[index] % 2 == 0:
        n[index] /= 2
        n[index] = int(n[index])
        count += 1
    else:
        index += 1

print(count)

Fixed submission:
input()
n = [int(i) for i in input().split()]
index = 0
count = 0
while index < len(n):
    if n[index] % 2 == 0:
        n[index] /= 2
        n[index] = int(n[index])
        count += 1
    else:
        index += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
subs = []

for i in range(len(s)):
    for j in range(len(s)):
        subs.append(s[i:i+j+1])

subs = sorted(list(set(subs)))
print(subs[k-1])


Fixed submission:
s = input()
k = int(input())
subs = []

for i in range(len(s)):
    for j in range(k):
        subs.append(s[i:i+j+1])

subs = sorted(list(set(subs)))
print(subs[k-1])
Buggy python submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = sorted([int(i) for i in input().split()])
start = A.index(X)
a = 0
b = 0
paying_area = range(1, M+1)
for i in range(start, -1, -1):
    if i in paying_area and not i in [0, X, N]:
        a += 1

for i in range(start, N+1):
    if i in paying_area and not i in [0, X, N]:
        b += 1

print(min((a,b)))


Fixed submission:
N, M, X = map(int, input().split())
a = {int(i) for i in input().split()}
l = set(range(0, X+1))
r = set(range(X, N+1))
print(min([len(a.intersection(l)) , len(a.intersection(r))]))
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
print(*(l[:k] + l[-k if k < len(l)/2 else - (len(l) - k):]), sep='\n')

Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
c = list(range(a, b + 1))
print(*c if a+2*k >= b else list(dict.fromkeys(c[:k] + c[-k:])), sep='\n')


Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
a = list(range(a, b+1))
print(*dict.fromkeys(a[:k] + a[-k:]), sep='\n')


Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
a = list(range(a, b+1))
print(*set(a[:k] + a[-k:]), sep='\n')


Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d= {}
for _ in range(n):
    i = input()
    if i in d:
        d[i] += 1
    else: d[i] = 1

for _ in range(int(input())):
    i = input()
    if i in d:
        d[i] -= 1

print(max(*d.values(), 0))


Fixed submission:
n = int(input())
d= {}
for _ in range(n):
    i = input()
    if i in d:
        d[i] += 1
    else: d[i] = 1

for _ in range(int(input())):
    i = input()
    if i in d:
        d[i] -= 1

print(max(max(d.values()), 0))
Buggy python submission (verdict: Runtime Error):
from math import sqrt
a = [i ** 2 for i in range(3, sqrt(100100)+1)]
b, c = input().split()
print(int(b+c) in a and 'Yes' or 'No')


Fixed submission:
a = [i**2 for i in range(4, 334)]
b,c = input().split()
print(int(b+c) in a and 'Yes' or 'No')

Buggy python submission (verdict: Runtime Error):
a = [i ** 2 for i in range(3, sqrt(100100)+1)]
b, c = input().split()
print(int(b+c) in a and 'Yes' or 'No')


Fixed submission:
a = [i**2 for i in range(4, 334)]
b,c = input().split()
print(int(b+c) in a and 'Yes' or 'No')

Buggy python submission (verdict: Runtime Error):
import sys
a = [i**2 for i in range(0, 101)]
b,c = input().split()
if '00' b + c:
  print('No')
  sys.exit()
print(int(b+c) in a and 'Yes' or 'No')

Fixed submission:
a = [i**2 for i in range(4, 334)]
b,c = input().split()
print(int(b+c) in a and 'Yes' or 'No')
Buggy python submission (verdict: Runtime Error):
print('2018',sep='' ,input()[4:])

Fixed submission:
print('2018', input()[4:], sep='')
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum([v if c < v else v - c for k,v in c.items()]))


Fixed submission:
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(v if c < v else v - c for k,v in c.items()))


Fixed submission:
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c))
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = 0
for _ in n:
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)

Fixed submission:
n = int(input())
p = 0
for _ in range(n):
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = 0
for _ in n:
  i,j = [int(i) for i in input().split()]
  p += j-i+1
print(p)
  

Fixed submission:
n = int(input())
p = 0
for _ in range(n):
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  if i in a:
    a.remove(i)
  else:
    a.append(i)
print(len(a))


Fixed submission:
from collections import Counter
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  a.append(i)
col = Counter(a)
ans = 0
for c in col.values():
	if c % 2 == 1: ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  if i in a:
    a.remove(i)
  else:
    a.append(i)
print(len(a))

Fixed submission:
from collections import Counter
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  a.append(i)
col = Counter(a)
ans = 0
for c in col.values():
	if c % 2 == 1: ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for _ in n:
  i = int(input())
  if i in n:
    a.remove(i)
  else:
    a.append(i)
print(len(a))

Fixed submission:
from collections import Counter
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  a.append(i)
col = Counter(a)
ans = 0
for c in col.values():
	if c % 2 == 1: ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
input()
nums = [int(i)-1 for i in input().split()]
c = 0

for i, j in enumerate(nums):
	if i == j:
		nums[i], nums[i+1] = nums[i+1], nums[i]
		c += 1
print(c)



Fixed submission:
input()
nums = [int(i)-1 for i in input().split()]
c = 0

for i, j in enumerate(nums):
	if i == j and i != len(nums) - 1:
		nums[i], nums[i+1] = nums[i+1], nums[i]
		c += 1
	elif i == j and i == len(nums) - 1:
		nums[i], nums[0] = nums[0], nums[i]
		c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = [int(input()) for _ in range(int(input()))]
print(lcm(*n))


Fixed submission:
from functools import reduce

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

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = [int(input()) for _ in range(int(input()))]
print(lcm(*n))
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
odd = deque()
even = deque()
for i, v in enumerate(a):
    if (i + 1) % 2: odd.appendleft(v)
    else: even.appendleft(v)
print(*(odd + even) if n % 2 else (even + odd))

Fixed submission:
from collections import deque

n = int(input())
a = [int(i) for i in input().split()]
d = deque()
for i, v in enumerate(a):
    if i % 2: d.append(v)
    else: d.appendleft(v)
print(*d if n % 2 else reversed(d))
Buggy python submission (verdict: Time Limit Exceeded):
def factorial(n):
    p = 1
    for i in range(1, n+1):
        p *= i
    return p
n, m = map(int, input().split())
ans = 0
if abs(n-m) == 1:
    ans = factorial(n) * factorial(m)
elif n == m:
    ans = 2 * factorial(n) * factorial(m)
print(ans % (10 ** 9 + 7))


Fixed submission:
n, m = map(int, input().split())
ans = 0
d = [0] * (max([n,m])+1)
def factorial(n):
    global d
    d[0] = 1
    for i in range(1, n+1):
        d[i] = ((i+1) * d[i-1]) % (10** 9 +7)
factorial(max(m,n))
if abs(n-m) == 1:
    ans = d[n-1] * d[m-1]
elif n == m:
    ans = 2 * d[n-1] * d[m-1]
print(ans % (10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
c = 0
while n > 0 and m > 2:
    n -= 1
    m -= 2
    c += 1

while m >= 4:
    m -= 4
    c += 1
print(c)


Fixed submission:
n, m = map(int, input().split())
if n <= m // 2:
    m -= n * 2
    print(n + m//4)
else:
    print(m//2)
Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
t = [int(x) for x in input().split()]
p = []
for _ in range(int(input())):
	p.append([int(x) for x in input().split()])

result = []
ori_t = copy.deepcopy(t)
for i,j in zip(t,p):
	t = copy.deepcopy(ori_t)
	t[j[0]-1] = j[1]
	result.append(sum(t))

print(result)


Fixed submission:
print(eval(input()))
Buggy python submission (verdict: Runtime Error):
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    flag = false
    if not mergin:
        mergin.append(0)
        flag = true
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            if flag:
                print('War')
            else:
                print('No War')
        else:
            if flag:
                print('No War')
            else:
                print('War')
    else:
        if flag:
            print('No War')
        else:
            print('War')

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            print('No War')
        else:
            print('War')
    else:
        print('War')

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    A, B = input().split()
    print((A - 1) * (B - 1))

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    A, B = map(int, input().split())
    print((A - 1) * (B - 1))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
nums = [x for x in input().split()]
a,b = int(nums[0]), float(nums[1])198 1.10

print(int(a*b))

Fixed submission:
nums = [x for x in input().split()]
a,b = int(nums[0]), float(nums[1])
b = round(b*100)
res = (a*b) // 100
print(res)
Buggy python submission (verdict: Runtime Error):
 = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
 
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[j-1] = snukes_snacks[j-1]
 
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)

Fixed submission:
n,k = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
    
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[snukes_snacks[j] - 1] = snukes_snacks[j]
    
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
seq = [x for x in input().split(' ')]

b = []

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

print(' '.join(b))

Fixed submission:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))

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

b = []

for i in range(n):
    b.append(seq[i])
    
    start = 0
    end = i

    while (start <= end):
        temp = b[end]
        b[end] = b[start]
        b[start] = temp
        start += 1
        end -= 1
    

print(' '.join(b))

Fixed submission:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))

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

b = []

for i in range(n):
    b.append(seq[i])
    c = []
    for j in range(i, -1, -1):
        c.append(b[j])
    
    b = c

print(' '.join(b))

Fixed submission:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))

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

b = []

for i in range(n):
    curr = seq[i]
    b.append(curr)
    c = b[i::-1]
    b = c

print(' '.join(b))

Fixed submission:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

if n % 2 == 0:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    for i in range(0, n, 2):
        b.append(seq[i])

else:
    for j in range(n-1, -1, -2):
        b.append(seq[j])
    
    for i in range(1, n, 2):
        b.append(seq[i])

print(' '.join(b))
Buggy python submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
costlst = []
scorelst = []
ans = float("inf")
for _ in range(m):
    cost,*score = map(int,input().split())
    costlst.append(cost)
    scorelst.append(score)
for i in range(2**n):
    cost = 0
    defaultscore = [0]*m
    for j in range(n):
        if (i>>j)&1:
            cost += costlst[j]
            for k in range(m):
                defaultscore[k] += scorelst[j][k]
        if all([defaultscore[p] >= x for p in range(m)]):
            ans = min(ans,cost)
        
            
                
                
                 
print(ans if ans != float("inf") else "-1")            
    

Fixed submission:
n,m,x = map(int,input().split())
costlst = []
scorelst = []
ans = float("inf")
for _ in range(n):
    cost,*score = map(int,input().split())
    costlst.append(cost)
    scorelst.append(score)
for i in range(2**n):
    cost = 0
    defaultscore = [0]*m
    for j in range(n):
        if (i>>j)&1:
            cost += costlst[j]
            for k in range(m):
                defaultscore[k] += scorelst[j][k]
    if all([defaultscore[p] >= x for p in range(m)]):
            ans = min(ans,cost)
        
            
                
                
                 
print(ans if ans != float("inf") else "-1")