Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
H = [int(i) for i in input().split()]
high = H[0]
for i in range(1,n):
    tmp = H[i]-high
    if 0<=tmp<=1:
        pass
    elif tmp = -1:
        high -= 1
    elif tmp > 1:
        high = H[i]
    else:
        print('No')
        exit()
print('Yes')


Fixed submission:
n = int(input())
H = [int(i) for i in input().split()]
high = H[0]
for i in range(1,n):
    tmp = H[i]-high
    if -1<=tmp<=1:
        pass
    elif tmp > 1:
        high = H[i]
    else:
        print('No')
        exit()
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())
mod = 2019
if l-r >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)


Fixed submission:
l,r = (int(i) for i in input().split())
mod = 2019
if r-l >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l,r = (int(i) for i in input().split())
mod = 2019
if l-r >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)


Fixed submission:
l,r = (int(i) for i in input().split())
mod = 2019
if r-l >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)

Buggy python submission (verdict: Runtime Error):
l,r = (int(i) for i in input().split())
mod = 2019
if l-r >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i,r+1):
            ans = (ans,i*j%mod)
        print(ans)


Fixed submission:
l,r = (int(i) for i in input().split())
mod = 2019
if r-l >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)

Buggy python submission (verdict: Runtime Error):
l,r = (int(i) for i in input().split())
mod = 2019
t,i = 0,1
lim = 10**9
while t<=lim:
    t = mod*i
    if l<=mod<=r:
        print(0)
        exit()
    i+=1
print(min(l*(l+1)%mod,r*(r-1)%mod)


Fixed submission:
l,r = (int(i) for i in input().split())
mod = 2019
if r-l >=2019:
    print(0)
else:
    ans = float('inf')
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%mod)
    print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while ruiseki[i] <= x and i < n+1:
    i += 1
print(i)


Fixed submission:
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while i < len(ruiseki) and ruiseki[i] <= x:
    i += 1
print(i)

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
i = 0
while ruiseki[i] <= x and i < n+1:
    i += 1
print(i+1)


Fixed submission:
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while i < len(ruiseki) and ruiseki[i] <= x:
    i += 1
print(i)

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
i = 0
while ruiseki[i] <= x:
    i += 1
print(i+1)


Fixed submission:
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while i < len(ruiseki) and ruiseki[i] <= x:
    i += 1
print(i)

Buggy python submission (verdict: Runtime Error):
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
d = 0
i = 0
while d<=x:
    d += l[i]
    i += 1
print(i)


Fixed submission:
from itertools import accumulate
n,x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]
ruiseki = list(accumulate(l))
ruiseki.insert(0,0)
i = 0
#print(ruiseki)
while i < len(ruiseki) and ruiseki[i] <= x:
    i += 1
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
a = [int(input()) for i in range(m)]
oks = [True if not i in a else False for i in range(n+1)]
mod = 1000000007
dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1 if not 1 in a else 0
for i in range(2,n+1):
    if oks[i] is True:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[n])


Fixed submission:
n,m = (int(i) for i in input().split())
a = [int(input()) for i in range(m)]
mod = 1000000007
oks = [True for _ in range(n+1)]
for i in a:
    oks[i] = False
dp = [1,0]
dp[1] = 1 if oks[1] is True else 0
for i in range(2,n+1):
    if oks[i] is True:
        dp.append((dp[i-1]+dp[i-2])%mod)
    else:
        dp.append(0)
print(dp[n])

Buggy python submission (verdict: Time Limit Exceeded):
n,m = (int(i) for i in input().split())
a = [int(input()) for i in range(m)]
oks = [True if not i in a else False for i in range(n+1)]
mod = 1000000007
dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1 if not 1 in a else 0
for i in range(2,n+1):
    if oks[i] is True:
        dp[i] = (dp[i-1]+dp[i-2])%mod
print(dp[n])


Fixed submission:
n,m = (int(i) for i in input().split())
a = [int(input()) for i in range(m)]
mod = 1000000007
oks = [True for _ in range(n+1)]
for i in a:
    oks[i] = False
dp = [1,0]
dp[1] = 1 if oks[1] is True else 0
for i in range(2,n+1):
    if oks[i] is True:
        dp.append((dp[i-1]+dp[i-2])%mod)
    else:
        dp.append(0)
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
accum = list(itertools.accumulate(A))
e = []
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    for _ in range(k):
        e.append(v)
for i in range(min(len(e),len(A))):
    if A[i]<e[i]:
        A[i]=e[i]
    else:
        break
print(sum(A))


Fixed submission:
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
e,p = [(0,0)],0
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    e.append((e[p][0]+k,v))
    p+=1

p = 1
for i in range(min(e[-1][0],len(A))):
    B,C = e[p]
    if A[i]<C:
        A[i]=C
    else:
        break
    if i == B-1:
        p+=1
print(sum(A))

Buggy python submission (verdict: Runtime Error):
import itertools
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
accum = list(itertools.accumulate(A))
e = []
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    e.append((k,v))
i = 0
for B,C in e:
    for _ in range(B):
        if A[i] < C:
            A[i] = C
            i+=1
        else:
            print(sum(A))
            exit()
print(sum(A))


Fixed submission:
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
e,p = [(0,0)],0
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    e.append((e[p][0]+k,v))
    p+=1

p = 1
for i in range(min(e[-1][0],len(A))):
    B,C = e[p]
    if A[i]<C:
        A[i]=C
    else:
        break
    if i == B-1:
        p+=1
print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
e = []
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    e.append((k,v))
for B,C in e:
    for j in range(B):
        if min(A) < C:
            A[A.index(min(A))] = C
        else:
            print(sum(A))
            exit()
print(sum(A))


Fixed submission:
N,M = (int(i) for i in input().split())
A = sorted([int(i) for i in input().split()])
e,p = [(0,0)],0
for k, v in sorted([[int(i) for i in input().split()] for i in range(M)], key=lambda x: -x[1]):
    e.append((e[p][0]+k,v))
    p+=1

p = 1
for i in range(min(e[-1][0],len(A))):
    B,C = e[p]
    if A[i]<C:
        A[i]=C
    else:
        break
    if i == B-1:
        p+=1
print(sum(A))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
min = (10**9,None)
for i in range(n-1):
    if a[i] < 0:
        a[i] *= (-1)
        a[i+1] *= (-1)
    if min[0] > abs(a[i]):
        min = (abs(a[i],i))
if a[-1] < 0:
    a[-1]**=(-1)
    a[min[1]]**=(-1)
print(sum(a))


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
m,ans = 10**9,0
for i in range(n-1):
    m = min(m,abs(a[i]))
    if a[i] < 0:
        a[i]*=(-1)
        a[i+1]*=(-1)
if a[-1] >= 0:
    print(sum(a))
else:
    a[-1] *= (-1)
    m = min(m,abs(a[i+1]))
    print(sum(a)-m*2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = input()

w,b = 0,0

for i in range(len(S)):
    if S[i] != '.':
        break

for e in range(len(S)-1,0,-1):
    if S[e] != '#':
        break

for s in range(i,len(S)-e+1):
    if S[s] == '.':
        w += 1
    else:
        b += 1

if b > w:
    print(w)
else:
    print(b)


Fixed submission:
n = int(input())
S = [s for s in input()]
w,b = [0],[0]
for i in range(n):
    if S[i] is '#': w.append(w[i]+1)
    else:   w.append(w[i])
    if S[n-i-1] is '.': b.append(b[i]+1)
    else:   b.append(b[i])
b = b[::-1]
#print(w,b)
ans = float('inf')
for i in range(n+1):
    ans = min(ans, w[i]+b[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = input()
c = S[::-1]
w,b = 0,0

for i in range(len(S)):
    if S[i] != '.':
        break

for e in range(len(c)):
    if c[e] != '#':
        break

for s in range(i,len(S)-e+1):
    if S[s] == '.':
        w += 1
    else:
        b += 1

if b > w:
    print(w)
else:
    print(b)


Fixed submission:
n = int(input())
S = [s for s in input()]
w,b = [0],[0]
for i in range(n):
    if S[i] is '#': w.append(w[i]+1)
    else:   w.append(w[i])
    if S[n-i-1] is '.': b.append(b[i]+1)
    else:   b.append(b[i])
b = b[::-1]
#print(w,b)
ans = float('inf')
for i in range(n+1):
    ans = min(ans, w[i]+b[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = input()
c = S[::-1]
w,b = 0,0

for i in range(len(S)):
    if S[i] != '.':
        break

for e in range(len(c)):
    if c[e] != '#':
        break

for s in range(d,len(S)-e+1):
    if S[s] == '.':
        w += 1
    else:
        b += 1

if b > w:
    print(w)
else:
    print(b)


Fixed submission:
n = int(input())
S = [s for s in input()]
w,b = [0],[0]
for i in range(n):
    if S[i] is '#': w.append(w[i]+1)
    else:   w.append(w[i])
    if S[n-i-1] is '.': b.append(b[i]+1)
    else:   b.append(b[i])
b = b[::-1]
#print(w,b)
ans = float('inf')
for i in range(n+1):
    ans = min(ans, w[i]+b[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = (int(i) for i in input().split())
K += 2 #とれる範囲
S = input()
S = [s for s in S]
cnt = []
last = S[0]
c = 0

for s in S:
    if s == last:
        c += 1
    else:
        cnt.append(c)
        c = 1
        last = s

cnt.append(c)
cnt.extend([0,0,0])
hold = sum([cnt[n] for n in range(K+1)])
ans = [hold]
for i in range(1,len(cnt)-K):
    #right => cnt[i-1]
    #left => cnt[i+K]
    ans.append(hold-cnt[i-1]+cnt[i+K])
    hold = sum([cnt[n+i] for n in range(K+1)])
print(max(ans))


Fixed submission:
a,b = (int(i) for i in input().split())
h = 0

if a > b:
  h = a
  a = a-1
else:
  h = b
  b = b-1

if a > b:
  print(h+a)
else:
  print(h+b)
Buggy python submission (verdict: Runtime Error):
from itertools import product
n = int(input())

ans = 0

for i in range(3,len(str(n))+1):
    for p in product('753',repeat=i):
        if n >= int(''.join(list(p))) and all(list(p).count(c) > 0 for c in '753': ans += 1

print(ans)

Fixed submission:
from itertools import product
n = int(input())

ans = 0

for i in range(3,len(str(n))+1):
    for p in product('753',repeat=i):
        if n >= int(''.join(list(p))) and all(list(p).count(c) > 0 for c in '753'): ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = [s for s in input()]
ans = float('inf')
for i in range(n):
    #print(S[:i],S[i+1:])
    ans = min(ans,S[:i].count('W')+S[i+1:].count('E'))
print(ans)


Fixed submission:
n = int(input())
S = [s for s in input()]
e,w = [0],[0]
for i in range(n):
    if S[i] is 'W': e.append(e[i]+1)
    else:   e.append(e[i])
    if S[n-i-1] is 'E': w.append(w[i]+1)
    else:   w.append(w[i])
w = w[::-1]
ans = float('inf')
for i in range(n+1):
    ans = min(ans,e[i]+w[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
li = []
for i in range(1,len(s)+1):
    j = 0
    while i+j <= len(s):
        li.append(s[j:j+i])
        j += 1
ans = sorted(list(set(li)))
print(ans[k-1])


Fixed submission:
s = input()
k = int(input())
li = []
for i in range(1,k+1):
    j = 0
    while i+j <= len(s):
        li.append(s[j:j+i])
        j += 1
ans = sorted(list(set(li)))
print(ans[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [int(i) for i in input().split()]
sortedx = sorted(x)
dict = {k:sortedx[:i]+sortedx[i+1:] for i,k in enumerate(sortedx)}
med = (n-1)//2
for i in x:
    print(dict[i][med])


Fixed submission:
n = int(input())
X = [int(i) for i in input().split()]
sX = sorted(X)
r,l = sX[n//2],sX[n//2-1]
if r != l:
    for x in X:
        if x<=l: print(r)
        else: print(l)
else:
    for _ in range(n): print(l)

Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median
n = int(input())
x = [int(i) for i in input().split()]
sortedx = sorted(x)
med = (n-1)//2
for i in x:
    tmp = sortedx[:]
    tmp.remove(i)
    print(tmp[med])


Fixed submission:
n = int(input())
X = [int(i) for i in input().split()]
sX = sorted(X)
r,l = sX[n//2],sX[n//2-1]
if r != l:
    for x in X:
        if x<=l: print(r)
        else: print(l)
else:
    for _ in range(n): print(l)

Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median
n = int(input())
x = [int(i) for i in input().split()]
#med = (n-1)//2
#print(med)
for i in range(n):
    tmp = x[:i]+x[i+1:]
    print(median(tmp))


Fixed submission:
n = int(input())
X = [int(i) for i in input().split()]
sX = sorted(X)
r,l = sX[n//2],sX[n//2-1]
if r != l:
    for x in X:
        if x<=l: print(r)
        else: print(l)
else:
    for _ in range(n): print(l)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0)
tmp = [abs(a[i-1]-a[i]) for i in range(1,len(a))]
tmp.append(abs(a[-1]-0))
a.append(0)
for i in range(1,len(a)-1):
    print(sum(tmp[:i-1])+abs(a[i-1]-a[i+1])+sum(tmp[i+1:]))


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0),a.append(0)
k,sum = [],0
for i in range(1,len(a)):
    k.append(abs(a[i-1]-a[i]))
    sum += abs(a[i-1]-a[i])
#print(k,sum)
for i in range(1,N+1):
    if a[i-1]>=a[i]>=a[i+1] or a[i-1]<=a[i]<=a[i+1]:
        print(sum)
    else:
        print(sum-(k[i-1]+k[i])+abs(a[i-1]-a[i+1]))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0)
tmp = [abs(a[i-1]-a[i]) for i in range(1,len(a))]
tmp.append(abs(a[-1]-0))
a.append(0)
for i in range(1,len(a)-1):
    print(sum(tmp[:i-1])+abs(a[i-1]-a[i+1])+sum(tmp[i+1:]))


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
a.insert(0,0),a.append(0)
k,sum = [],0
for i in range(1,len(a)):
    k.append(abs(a[i-1]-a[i]))
    sum += abs(a[i-1]-a[i])
#print(k,sum)
for i in range(1,N+1):
    if a[i-1]>=a[i]>=a[i+1] or a[i-1]<=a[i]<=a[i+1]:
        print(sum)
    else:
        print(sum-(k[i-1]+k[i])+abs(a[i-1]-a[i+1]))
Buggy python submission (verdict: Runtime Error):
n,h = (int(i) for i in input().split())
A,B = [],[]
for _ in range(n):
    a,b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
a_max = max(A)
B.sort()[::-1]
power,ans = 0,0
for b in B:
    if a_max <= b:
        power += b
        ans += 1
        if power>=h: break
if power>=h:
    print(ans)
else:
    h -= power
    ans += h//a_max
    if h%a_max == 0: print(ans)
    else: print(ans+1)


Fixed submission:
n,h = (int(i) for i in input().split())
A,B = [],[]
for _ in range(n):
    a,b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
a_max = max(A)
B.sort(reverse=True)
power,ans = 0,0
for b in B:
    if a_max <= b:
        power += b
        ans += 1
        if power>=h: break
if power>=h:
    print(ans)
else:
    h -= power
    ans += h//a_max
    if h%a_max == 0: print(ans)
    else: print(ans+1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
d = [a for a in Counter(A).values()]
tmp = 0
for i in range(min(K,len(d)+1)):
    tmp += max(d)
    d.remove(max(d))
print(len(A)-tmp)


Fixed submission:
from collections import Counter
N,K = (int(i) for i in input().split())
d = Counter([int(i) for i in input().split()])
if len(d) <= K:
    print(0)
    exit()

tmp = 0
for _,p in d.most_common(K):
    tmp += p
print(N-tmp)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
d = [a for a in Counter(A).values()]
tmp = 0
for i in range(min(K,len(set(d))+1)):
    tmp += max(d)
    d.remove(max(d))
print(len(A)-tmp)


Fixed submission:
from collections import Counter
N,K = (int(i) for i in input().split())
d = Counter([int(i) for i in input().split()])
if len(d) <= K:
    print(0)
    exit()

tmp = 0
for _,p in d.most_common(K):
    tmp += p
print(N-tmp)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
if len(set(A)) <= K:
    print(0)
    exit()

d = [a for a in Counter(A).values()]
tmp = 0
for i in range(K):
    tmp += max(d)
    d.remove(max(d))
print(len(A)-tmp)


Fixed submission:
from collections import Counter
N,K = (int(i) for i in input().split())
d = Counter([int(i) for i in input().split()])
if len(d) <= K:
    print(0)
    exit()

tmp = 0
for _,p in d.most_common(K):
    tmp += p
print(N-tmp)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N,K = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
if len(set(A)) <= K:
    print(0)
    exit()

d = [a for a in Counter(A).values()]
tmp = 0
for i in range(K):
    tmp += max(d)
    d.remove(max(d))
print(len(A)-tmp)


Fixed submission:
from collections import Counter
N,K = (int(i) for i in input().split())
d = Counter([int(i) for i in input().split()])
if len(d) <= K:
    print(0)
    exit()

tmp = 0
for _,p in d.most_common(K):
    tmp += p
print(N-tmp)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        wb = (4*h*n-N*n-N*h)
        if wb > 0:
            w = (N*h*n)/wb
            if w.is_integer() is True:
                print(h,n,int(w))
                exit()


Fixed submission:
N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        wb = (4*h*n-N*n-N*h)
        if wb > 0:
            w = (N*h*n)/wb
            if w.is_integer() is True:
                print(h,n,int(w))
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        if (4*h*n-N*n-N*h) != 0:
            w = (N*h*n)/(4*h*n-N*n-N*h)
            if w.is_integer() is True and w > 1:
                print(h,n,int(w))
                exit()


Fixed submission:
N = int(input())
for i in range(1,3501):
    h = i
    for j in range(1,3501):
        n = j
        wb = (4*h*n-N*n-N*h)
        if wb > 0:
            w = (N*h*n)/wb
            if w.is_integer() is True:
                print(h,n,int(w))
                exit()
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
T = [int(input()) for _ in range(n)]

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

T.sort()
ans = T.pop(0)
for t in T:
    ans = lcm(ans,t)
print(ans)


Fixed submission:
import fractions
n = int(input())
T = [int(input()) for _ in range(n)]

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

T.sort()
ans = T.pop(0)
for t in T:
    ans = lcm(ans,t)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = []
for i,a in enumerate([int(i) for i in input().split()]):
    if (n%2 == 0 and (i+1)%2 == 0) or (n%2 == 1 and (i+1)%2 == 1):
        ans.insert(0,str(a))
    else:
        ans.append(str(a))
print(' '.join(ans))


Fixed submission:
n = int(input())
l,r = [],[]
for i,a in enumerate([int(i) for i in input().split()]):
    if (n%2 == 0 and (i+1)%2 == 0) or (n%2 == 1 and (i+1)%2 == 1):
        l.append(str(a))
    else:
        r.append(str(a))
for a in l[::-1]:
    print(a,end=' ')
for b in r:
    print(b,end=' ')
print()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = []
for i,a in enumerate([int(i) for i in input().split()]):
    a = str(a)
    #if i%2 == 0:
    ans.append(a)
    ans = ans[::-1]
    #else:
    #    ans.insert(0,a)
print(' '.join(ans))


Fixed submission:
n = int(input())
l,r = [],[]
for i,a in enumerate([int(i) for i in input().split()]):
    if (n%2 == 0 and (i+1)%2 == 0) or (n%2 == 1 and (i+1)%2 == 1):
        l.append(str(a))
    else:
        r.append(str(a))
for a in l[::-1]:
    print(a,end=' ')
for b in r:
    print(b,end=' ')
print()
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
t = [input() for _ in range(n)]
init = ''.join(['a' for _ in range(50)])
for s in t:
    if len(init) > len(s):  init = s

t.remove(init)
init = {k:v for k,v in Counter([s for s in sorted(list(init))]).items()}

for s in t:
    for k,v in init.items():
        if s.count(k) < v:  init[k] = s.count(k)
ans = ''
for k,v in init.items():
    for i in range(v):  ans += k
print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())
s_list = []
for i in range(N):
    s_list.append(input().strip())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

for c in alphabets:
    min_count = float('inf')
    for s in s_list:
        count = s.count(c)

        if count < min_count:
            min_count = count
    print(c * min_count, end='')
print()

Buggy python submission (verdict: Runtime Error):
from collections import Counter
from itertools import permutations
n = int(input())
t = [input() for _ in range(n)]
init = ''.join(['a' for _ in range(50)])
for s in t:
    if len(init) > len(s):  init = s

t.remove(init)
init = {k:v for k,v in Counter([s for s in init]).items()}

for s in t:
    for k,v in init.items():
        if s.count(k) < v:  init[k] = s.count(k)
s = ''
for k,v in init.items():
    for i in range(v):  s += k
ans = sorted([''.join(list(a)) for a in permutations(s,len(s))])
print(ans[0])


Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math


N = int(input())
s_list = []
for i in range(N):
    s_list.append(input().strip())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

for c in alphabets:
    min_count = float('inf')
    for s in s_list:
        count = s.count(c)

        if count < min_count:
            min_count = count
    print(c * min_count, end='')
print()