Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x = int(inpt())
if(x >= 30):
    print("Yes")
else:
    print("No")


Fixed submission:
x = int(input())
if(x >= 30):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k = map(int, input().split())
l = np.zeros(n)
for i in range(k):
    d = int(input())
    a = map(int, input().split())
    for j in range(d):
        l[a[j]-1] = 1
ans = 0
for i in l:
    if(i == 0):
        ans += 1
print(ans)


Fixed submission:
import numpy as np
n,k = map(int, input().split())
l = [0 for i in range(n)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        l[j-1] = 1

print(l.count(0))
Buggy python submission (verdict: Runtime Error):
import math
x = int(raw_input())
now = 100
ans = 0
while(now < x):
    ans += 1
    now *= 1.01
    now = math.floor(now)
print(ans)


Fixed submission:
import math
x = int(input())
now = 100
ans = 0
while(now < x):
    ans += 1
    now += now//100
print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
if(w >= s):
    print("unsafe")
else:
    print("safe")


Fixed submission:
s,w = map(int,input().split())
if(w >= s):
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
s = int(input())
w = int(input())
if(w >= s):
    print("unsafe")
else:
    print("safe")    


Fixed submission:
s,w = map(int,input().split())
if(w >= s):
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
s = input()
if(s[2] == s[3] && s[4] == s[5]):
    print("Yes")
else:
    print("No")    


Fixed submission:
s = input()
if(s[2] == s[3] and s[4] == s[5]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,raw_input().split())
ans = 0
if(n >= 2):
    ans += n*(n-1)//2
    
if(m >= 2):
    ans += m*(m-1)//2
print(ans)


Fixed submission:
n,m = map(int,input().split())
ans = 0
if(n >= 2):
    ans += n*(n-1)//2
    
if(m >= 2):
    ans += m*(m-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
if(s == 'AAA' or s == 'BBB'):
    print("No")
else:
    print("Yes")    


Fixed submission:
s = input()
if(s == 'AAA' or s == 'BBB'):
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()

Sum = sum(A)

ans = 0
for i in range(N):
    ans += int(A[i])*(Sum-int(A[i]))

ans %= 1000000007

print(int(ans/2))


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

Sum = sum(A)

ans = 0
for i in range(N-1):
    Sum = Sum - A[i]
    ans += int(A[i])*Sum

ans %= 1000000007

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

if n >= 30:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())

if n >= 30:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

ans = -1
num7 = 7
if K%2 != 0:
    for i in range(100000):
        if (num7 % K) == 0:
            ans = i+1
            break
        else:
            num7 = num7*10+7
            i+=1

print(ans)

Fixed submission:
K = int(input())

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

print(ans)

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

ans = -1
num7 = 7;

for i in range(100000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = num7*10+7
        i+=1

print(ans)

Fixed submission:
K = int(input())

ans = -1
num7 = 7

for i in range(1000000):
    if (num7 % K) == 0:
        ans = i+1
        break
    else:
        num7 = (num7*10+7)%K
        i+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import queue
import numpy as np

H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]
dir4 = [[-1,0],[1,0],[0,-1],[0,1]]


def solveMaze(s, g):
    q = queue.Queue()
    q.put([s[0],s[1],0])
    times = [[999999999 for j in range(W)] for i in range(H)]

    while not q.empty():
        now = q.get()
        for i in range(4):
            nextH = now[0] + int(dir4[i][0])
            nextW = now[1] + int(dir4[i][1])
            time = now[2] + 1
            g0 = g[0]
            g1 = g[1]

            if nextH == g[0] and nextW == g[1]:
                return time

            if nextH < 0 or nextH >= H or nextW < 0 or nextW >=W or maze[nextH][nextW] == "#" or times[nextH][nextW] <= time:
                continue
            else:
                times[nextH][nextW] = time
                q.put([nextH, nextW, time])

    return -1


ans = 0

for sH in range(H):
    for sW in range(W):
        if maze[sH][sW] == ".":
            for gH in range(H):
                for gW in range(W):
                    if maze[gH][gW] == ".":
                        if sH != gH or sW != gW:
                            ans = max(ans, solveMaze([sH, sW], [gH, gW]))

print(ans)







Fixed submission:
import queue
import numpy as np

H, W = map(int, input().split())
maze = [list(input()) for _ in range(H)]
dir4 = [[-1,0],[1,0],[0,-1],[0,1]]


def solveMaze(s):
    q = queue.Queue()
    q.put([s[0],s[1],0])
    times = [[999999999 for j in range(W)] for i in range(H)]
    tmpAns = 0
    times[s[0]][s[1]] = 0
    while not q.empty():
        now = q.get()
        tmpAns = max(tmpAns, now[2])
        for i in range(4):
            nextH = now[0] + int(dir4[i][0])
            nextW = now[1] + int(dir4[i][1])
            nextTime = now[2] + 1

            if nextH < 0 or nextH >= H or nextW < 0 or nextW >=W or maze[nextH][nextW] == "#" or times[nextH][nextW] <= nextTime:
                continue
            else:
                times[nextH][nextW] = nextTime
                q.put([nextH, nextW, nextTime])

    return tmpAns


ans = 0

for sH in range(H):
    for sW in range(W):
        if maze[sH][sW] == ".":
            ans = max(ans, solveMaze([sH, sW]))

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

ans = 0

for i in range(60 + 1):
    count1 = 0
    for a in A:
        count1 += (a >> i) & 1

    count0 = len(A) - count1
    ans += count1*count0 * pow(2, i)
    ans%=1000000007

print(ans)

Fixed submission:
import queue
import numpy as np
import math

n = int(input())
A = list(map(int, input().split()))
A = np.array(A,np.int64)
ans = 0

for i in range(60 + 1):
    a = (A >> i) & 1
    count1 = np.count_nonzero(a)
    count0 = len(A) - count1
    ans += count1*count0 * pow(2, i)
    ans%=1000000007

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

x = []

for i in range(n):
	x.append(list(map(int,input().split())))
a = x[0][2]
b = 0
for i in range(101):
	for j in range(101):
		for k in range(a,a+201):
			for l in x:
				if l[2] == max(0,k-abs(i-l[0])-abs(j-l[1])):
					b += 1
			if b == n:
				print(i,j,k)
			b = 0


Fixed submission:
n = int(input())

x = []

for i in range(n):
	a,b,c = map(int,input().split())
	x.append([c,a,b])
x.sort()
x.reverse()
a = 0
b = 0
for i in range(101):
	for j in range(101):
		for k in range(n):
			if x[k][0] != 0:
				if k == 0:
					a = x[k][0] + abs(i-x[k][1]) + abs(j-x[k][2])
					b += 1
				else:
					if a == x[k][0] + abs(i-x[k][1]) + abs(j-x[k][2]):
						b += 1
			else:
				if a- abs(i-x[k][1]) - abs(j-x[k][2]) <= 0:
					b += 1
		if b == n:
			print(i,j,a)
		b = 0
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = 'Yes'

w = []

for i in range(n):
	a = input()
	if a in w:
		ans = 'No'
	else:
		w.append(a)

if n == 2:
	if w[0][-1] != w[1][0]:
		ans = 'No'
elif n == 3:
	if w[0][-1] != w[1][0]:
		ans = 'No'
	if w[1][-1] != w[2][0]:
		ans = 'No'
else:
	for i in range(1,n-2):
		print(i)
		if b[-1] == w[i][0]:
			b = w[i]
		else:
			ans = 'No'
print(ans)


Fixed submission:
n = int(input())

ans = 'Yes'

w = []

for i in range(n):
	a = input()
	if a in w:
		ans = 'No'
	else:
		w.append(a)
b = w[0]
c = w[1:]
for i in c:
	if i[0] == b[-1]:
		b = i
	else:
		ans = 'No'
		break
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())

a = []
for i in range(h):
	b = list(map(int,input().split()))
	b = [i%2 for i in b]
	a.append(b)

ans = []
for i in range(h):
	for j in range(w-1):
		if a[i][j] == 1:
			a[i][j+1] += 1
			ans.append([i+1,j+1,i+1,j+2])
if w != 2:
	for i in range(h-1):
		if a[i][-1] == 1:
			a[i+1][j] += 1
			ans.append([i+1,w,i+2,w])


print(len(ans))

for i in ans:
	print(i[0],i[1],i[2],i[3])

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

a = []

for i in range(h):
	a.append(list(map(int,input().split())))
ans = []
for i in range(h):
	for j in range(w-1):
		if a[i][j] % 2 == 1:
			a[i][j+1] += 1
			ans.append([i+1,j+1,i+1,j+2])

for k in range(h-1):
	if a[k][w-1] % 2 == 1:
		a[k+1][w-1] += 1
		ans.append([k+1,w,k+2,w])
print(len(ans))
for i in ans:
	print(i[0],i[1],i[2],i[3])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())

x = list(map(int,input().split()))
ans = 100000000000000


for i in range(n-k+1):
	if x[i+k-1] <= 0:
		ans = min(ans,-x[i])
	elif x[i] >= 0:
		ans = min(x[i+k-1],ans)
	else:
		ans = min(x[i+k-1]-x[i]+min(abs(x[i]),x[i+k-1]))
print(ans)

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

x = list(map(int,input().split()))
ans = 100000000000000

a = 0
while a != n:
	if x[a] >= 0:
		break
	a += 1
for i in range(max(0,a-k),n-k+1):
	if x[i+k-1] <= 0:
		ans = min(ans,-x[i])
	elif x[i] >= 0:
		ans = min(x[i+k-1],ans)
	else:
		ans = min(x[i+k-1]-x[i]+min(-x[i],x[i+k-1]),ans)
print(ans)

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

x = list(map(int,input().split()))
ans = 100000000000000000000


for i in range(n-k+1):
	a = x[i:i+k]
	b = 0
	if a[-1] <= 0:
		b = -a[0]
	elif a[0] >= 0:
		b = a[-1]
	else:
		b = min(abs(a[0])*2+a[-1],a[-1]*2-a[0])
	ans = min(ans,b)
print(ans)

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

x = list(map(int,input().split()))
ans = 100000000000000

a = 0
while a != n:
	if x[a] >= 0:
		break
	a += 1
for i in range(max(0,a-k),n-k+1):
	if x[i+k-1] <= 0:
		ans = min(ans,-x[i])
	elif x[i] >= 0:
		ans = min(x[i+k-1],ans)
	else:
		ans = min(x[i+k-1]-x[i]+min(-x[i],x[i+k-1]),ans)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

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

b = [0 for i in range(n+1)]

for i in range(n):
	b[i+1] = b[i]+a[i]


ans = 0
for i in range(n):
	for j in range(1,n-i+1):
		if (b[i+j] - b[i]) % m == 0:
			ans += 1

print(ans)

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

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

b = [0 for i in range(n+1)]

for i in range(n):
	b[i+1] = (b[i]+a[i])%m

c = {}
for i in b:
	if i in c:
		c[i] += 1
	else:
		c[i] = 1

ans = 0

for i in c:
	ans += (c[i]*(c[i]-1)//2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

a = []
for i in range(n):
    a.append(list(map(int,input().split())))
ans = 0
b = []
for i in itertools.combinations(a,m):
    i0 = 0
    i1 = 0
    i2 = 0
    for j in i:
        i0 += j[0]
        i1 += j[1]
        i2 += j[2]
    ans = max(ans,abs(i0)+abs(i1)+abs(i2))
print(ans)

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

a = []
b = []
c = []
d = []
e = []
f = []
g = []
h = []
for i in range(n):
    j = list(map(int,input().split()))
    a.append(j[0]+j[1]+j[2])
    b.append(-j[0]+j[1]+j[2])
    c.append(j[0]-j[1]+j[2])
    d.append(j[0]+j[1]-j[2])
    e.append(-j[0]-j[1]+j[2])
    f.append(-j[0]+j[1]-j[2])
    g.append(j[0]-j[1]-j[2])
    h.append(-j[0]-j[1]-j[2])
a.sort()
a.reverse()
b.sort()
b.reverse()
c.sort()
c.reverse()
d.sort()
d.reverse()
e.sort()
e.reverse()
f.sort()
f.reverse()
g.sort()
g.reverse()
h.sort()
h.reverse()

print(max(sum(a[:m]),sum(b[:m]),sum(c[:m]),sum(d[:m]),sum(e[:m]),sum(f[:m]),sum(g[:m]),sum(h[:m])))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = n
for i in range(1,n):
    a = s[:i-1]
    b = s[i:]
    ans = min(ans,a.count('W')+b.count('E'))
print(ans)

Fixed submission:
n = int(input())
s = input()
ans = n
c = s[1:]
d = c.count('E')
ans = d
count = d
for i in range(1,n):
    a = s[i-1]
    b = s[i]
    if a == 'W' and b == 'W':
        count += 1
    elif a == 'E' and b == 'E':
        count -= 1
    ans = min(ans,count)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

n = len(s)
a = []
for i in range(n+1):
    for j in range(n-i+1):
        if len(s[i:i+j]) >=1:
            if not s[i:i+j] in a:
                a.append(s[i:i+j])
a.sort()
print(a[k-1])

Fixed submission:
s = input()
k = int(input())

n = len(s)
a = []
for i in range(n+1):
    for j in range(6):
        if len(s[i:i+j]) >=1:
            if not s[i:i+j] in a:
                a.append(s[i:i+j])
a.sort()
print(a[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = [0]
for i in range(n):
    b.append(a[i]+b[i])
ans = 0
for i in range(n+1):
    ans += b.count(b[0])-1
    b = b[1:]
print(ans)



Fixed submission:

n = int(input())
a = list(map(int,input().split()))
b = {0:0}
c = 0
for i in range(n):
    c = c+a[i]
    if c in b:
        b[c] += 1
    else:
        b[c] = 0
d = list(b.values())
ans = 0
for i in d:
    ans+= ((i+1)*i)//2
print(ans)

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

Fixed submission:

n = int(input())
a = list(map(int,input().split()))
b = {0:0}
c = 0
for i in range(n):
    c = c+a[i]
    if c in b:
        b[c] += 1
    else:
        b[c] = 0
d = list(b.values())
ans = 0
for i in d:
    ans+= ((i+1)*i)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(1,n+1):
    for j in range(n-i+1):
        if sum(a[j:j+i]) == 0:
            count += 1
print(count)

Fixed submission:

n = int(input())
a = list(map(int,input().split()))
b = {0:0}
c = 0
for i in range(n):
    c = c+a[i]
    if c in b:
        b[c] += 1
    else:
        b[c] = 0
d = list(b.values())
ans = 0
for i in d:
    ans+= ((i+1)*i)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)+1] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    b = a[0:i]+a[i+1:n]
    c = sorted(b)
    d = int(n/2 - 1)
    e = int(c[d])
    print(e)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    print(int(np.median(a[0:i]+a[i+1:n])))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())

a = list(map(int,input().split()))
d = int(n/2)+1
for i in range(n):
    b = a[0:i]+a[i+1:n]
    median = np.median(b)
    print(int(median))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = sorted(a)
for i in range(n):
    if b[int(n/2)] <= a[i]:
        print(b[int(n/2)-1])
    else:
        print(b[int(n/2)])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a.append(0)
count = 0
for i in range(n):
    b = a[i]
    del a[i]
    for j in range(n-1):
        count += abs(a[j]-a[j+1])
    print(count + abs(a[0]))
    count = 0
    a.insert(i,b)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.insert(0,0)
b = 0
for i in range(n+1):
    b += abs(a[i]-a[i+1])
for i in range(1,n+1):
    c = b + abs(a[i-1]-a[i+1]) - abs(a[i]-a[i+1])-abs(a[i]-a[i-1])
    print(c)
Buggy python submission (verdict: Runtime Error):
a =input()

b = [x for x in list(a)]
if len(a) == 1:
    print(int(a))
elif len(a) == a[1:].count('9') + 1:
    print(sum(b))
else:
    print(int(b[0])-1+(len(a)-1)*9)


Fixed submission:
a =input()

b = [int(x) for x in list(a)]
if len(a) == 1:
    print(int(a))
elif len(a) == a[1:].count('9') + 1:
    print(sum(b))
else:
    print(int(b[0])-1+(len(a)-1)*9)
Buggy python submission (verdict: Runtime Error):
a = []
b = []
for i in range(n):
    a.append(int(input()))

for i in range(n):
    if a[i] in b:
        continue
    else:
        b.append(a[i])
print(len(b))

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

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

a = ['+','-']

b = ''
ans = ''
for i in a:
    b += n[0]+i
    for j in a:
        b += n[1]+j
        for k in a:
            b += n[2]+k+n[3]
            if eval(b) == 7:
                ans = b+'=7'
            else:
                b = ''
print(ans)

Fixed submission:
n = input()

a = ['+','-']
b = ''
for i in a:
    for j in a:
        for k in a:
            if eval(n[0]+i+n[1]+j+n[2]+k+n[3]) == 7:
                b =n[0]+i+n[1]+j+n[2]+k+n[3]+'=7'
                break
print(b)
Buggy python submission (verdict: Runtime Error):
n = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()

d = 0
e = 0
ans = 0
for i in b:
    while i > a[min(d,n-1)] and d <= n-1:
        d += 1
    while i >= c[e] and e < n:
        e += 1
    ans += d*(n-e)

print(ans)

Fixed submission:
n = int(input())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()

d = 0
e = 0
ans = 0
for i in b:
    while i > a[min(d,n-1)] and d <= n-1:
        d += 1
    while i >= c[min(e,n-1)] and e < n:
        e += 1
    ans += d*(n-e)

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

Fixed submission:
a= int(input())
b= int(input())
print(2*b-a)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
a =[]
for i in range(len(s)-len(t)+1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
    if f == True:
        a.append(i)

s = s.replace('?','a')

print(s[:a[-1]]+t+s[a[-1]+len(t):])


Fixed submission:
s = input()
t = input()
a =[]
for i in range(len(s)-len(t)+1):
    f = True
    for j in range(len(t)):
        if s[i+j] != '?' and s[i+j] != t[j]:
            f = False
    if f == True:
        a.append(i)

s = s.replace('?','a')
if len(a) !=0:
    print(s[:a[-1]]+t+s[a[-1]+len(t):])
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

b ={i:0 for i in range(min(a)-1,max(a)+10)}

for i in a:
    b[i] += 1

c = 0
for i in range(1,len(b)-3):
    c = max(c,b[i]+b[i+1]+b[i+2])
print(c)

Fixed submission:
n = int(input())

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

b ={i:0 for i in range(min(min(a),-1),max(a)+10)}
for i in a:
    b[i] += 1


c = 0
for i in range(len(b)-3):
    c = max(c,b[i]+b[i+1]+b[i+2])
print(c)
Buggy python submission (verdict: Runtime Error):
def gcd(x,y):
	while y != 0:
		x , y = y , x % y
	return x

def lcm(x,y):
    return int(x*y/gcd(x,y))


n = int(input())

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

for i in range(n-1):
    a[i+1] = lcm(a[i],a[i+1])
print(a[-1])

Fixed submission:
def gcd(x,y):
	while y != 0:
		x , y = y , x % y
	return x

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


n = int(input())

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

for i in range(n-1):
    a[i+1] = lcm(a[i],a[i+1])
print(a[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))

a = []
b = []
for i in range(m):
    aa,bb = list(map(int,input().split()))
    a.append(aa)
    b.append(bb)
c = []
d = []
for i in range(m):
    if a[i] == 1:
        c.append(b[i])
    elif a[i] == n:
        d.append(b[i])
    elif b[i] == n:
        d.append(a[i])

ans = 'IMPOSSIBLE'

for i in c:
    if i in d:
        ans = 'POSSIBLE'
print(ans)

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

a = []
b = []
for i in range(m):
    aa,bb = list(map(int,input().split()))
    a.append(aa)
    b.append(bb)
c = []
d = []
for i in range(m):
    if a[i] == 1:
        c.append(b[i])
    elif a[i] == n:
        d.append(b[i])
    elif b[i] == n:
        d.append(a[i])

ans = 'IMPOSSIBLE'
c = set(c)
d = set(d)

if len(c&d) >= 1:
    ans = 'POSSIBLE'
print(ans)

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

a = []
b = []
for i in range(m):
    aa,bb = list(map(int,input().split()))
    a.append(aa)
    b.append(bb)
c = []
for i in range(m):
    if a[i] == 1:
        c.append(b[i])

ans = 'IMPOSSIBLE'
for i in range(m):
    if a[i] in c and b[i] == n:
        ans = 'POSSIBLE'
    elif b[i] in c and a[i] == n:
        ans = 'POSSIBLE'
print(ans)

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

a = []
b = []
for i in range(m):
    aa,bb = list(map(int,input().split()))
    a.append(aa)
    b.append(bb)
c = []
d = []
for i in range(m):
    if a[i] == 1:
        c.append(b[i])
    elif a[i] == n:
        d.append(b[i])
    elif b[i] == n:
        d.append(a[i])

ans = 'IMPOSSIBLE'
c = set(c)
d = set(d)

if len(c&d) >= 1:
    ans = 'POSSIBLE'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
if n % 2 == 1:
    b = []
    for i in range(n//2):
        b = [a[2*i]]+b
        b.append(a[2*i+1])
    b = [a[-1]]+b
    print(' '.join(map(str,b)))
else:
    b = []
    for i in range(n//2):
        b.append(a[2*i])
        b = [a[2*i+1]]+b
    print(' '.join(map(str,b)))

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

if n % 2 == 1:
    b = a[::2]
    c = a[1::2]
    b.reverse()
    d = b+c
    print(' '.join(map(str,d)))
else:
    b = a[::2]
    c = a[1::2]
    c.reverse()
    d = c+b
    print(' '.join(map(str,d)))

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

b = []

for i in a:
    b.append(i)
    b.reverse()
print(' '.join(map(str,b)))

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

if n % 2 == 1:
    b = a[::2]
    c = a[1::2]
    b.reverse()
    d = b+c
    print(' '.join(map(str,d)))
else:
    b = a[::2]
    c = a[1::2]
    c.reverse()
    d = c+b
    print(' '.join(map(str,d)))
Buggy python submission (verdict: Runtime Error):
for i in range(n):
    b.append(a[i]//400)
for i in range(13):
    if b.count(i) >=1:
        if i<= 7:
            countmax +=1
            countmin +=1
        else:
            countmax += b.count(i)
print(countmin,countmax)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b =[]
countmax = 0
countmin = 0

for i in range(n):
    b.append(a[i]//400)
for i in range(13):
    if b.count(i) >=1:
        if i<= 7:
            countmax +=1
            countmin +=1
        else:
            countmax += b.count(i)
print(max(1,countmin),countmax)