Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

def main():
    n = int(input())
    a = list(map(int,input().split()))
    for k in range(n):
        a_ = a[0:k]+a[k+1:]
        c = Counter(a_)
        s = 0
        for k in c.keys():
            cnt = c[k]
            if cnt>1:
                s+=cnt*(cnt-1)//2
        print(s)
            
if __name__ == "__main__":
    main()

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
import collections
C = collections.Counter(a)
S = 0
for i in C.keys():
    S += C[i]*(C[i]-1)//2

for i in range(n):
    A = a[i]
    print(S-C[A]+1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
import collections
for i in range(n):
    A = a[0:i]+a[i+1:n]
    c = collections.Counter(A)
    s = 0
    for j in c.keys():
        s += c[j]*(c[j]-1)//2
    print(s)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
import collections
C = collections.Counter(a)
S = 0
for i in C.keys():
    S += C[i]*(C[i]-1)//2

for i in range(n):
    A = a[i]
    print(S-C[A]+1)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = list(map(int,input().split()))

def su(n):
  return n*(n+1)/2

maxind=0
for i in range(n-k):
  if p[i+k] > p[i]:
    maxind = i
s = 0
for i in range(k):
  s += su(p[maxind+1+i])/p[maxind+1+i]
print(s)

Fixed submission:
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))

    for i in range(n):
        p[i]=(p[i]+1)/2
    s = [0]
    for i in range(n):
        s.append(s[i]+p[i])
    m = 0
    for i in range(n-k+1):
        if m<s[i+k]-s[i]:
            m = s[i+k]-s[i]
    print(m)

if __name__ == "__main__":
    main()

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

def su(n):
  return n*(n+1)/2

maxx = 0
for i in range(n-k+1):
  m = 0
  m = sum(p[i:i+k])
  if m > maxx:
    maxx = m
    idx = i
s = 0
for i in range(k):
  s += su(p[idx+i])/p[idx+i]
print(s)


Fixed submission:
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))

    for i in range(n):
        p[i]=(p[i]+1)/2
    s = [0]
    for i in range(n):
        s.append(s[i]+p[i])
    m = 0
    for i in range(n-k+1):
        if m<s[i+k]-s[i]:
            m = s[i+k]-s[i]
    print(m)

if __name__ == "__main__":
    main()

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

def su(n):
  return n*(n+1)/2

maxx = 0
for i in range(n-k+1):
  m = 0
  for j in range(k):
    m += p[i+j]
  if m > maxx:
    maxx = m
    idx = i
s = 0
for i in range(k):
  s += su(p[idx+i])/p[idx+i]
print(s)

Fixed submission:
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))

    for i in range(n):
        p[i]=(p[i]+1)/2
    s = [0]
    for i in range(n):
        s.append(s[i]+p[i])
    m = 0
    for i in range(n-k+1):
        if m<s[i+k]-s[i]:
            m = s[i+k]-s[i]
    print(m)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int,input().split()))
    mod = 10**9+7
    A, B = [], {}
    for i in range(n):
        d = {}
        for j in range(2,int(a[i]**0.5)+1):
            if a[i]%j==0:
                cnt = 0
                while a[i]%j==0:
                    cnt += 1
                    a[i] = a[i]//j
                d[j] = cnt
                if B.get(j)==None:
                    B[j] = cnt
                else:
                    if B[j]<cnt:
                        B[j] = cnt
        if a[i]!=1:
            d[a[i]] = 1
            if B.get(a[i])==None:
                B[a[i]] = 1
        A.append(d)
    ans = 0
    for i in range(n):
        d = A[i]
        a = 1
        for k in B.keys():
            if d.get(k)!=None:
                a *= pow(k,B[k]-d[k],mod)
            else:
                a *= pow(k,B[k],mod)
            a = a%mod
        ans += a
        ans = ans % mod
    print(ans)

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    import copy
    n = int(input())
    a = list(map(int,input().split()))
    A = copy.deepcopy(a)
    mod = 10**9+7
    l = {}
    for i in range(n):
        for j in range(2,int(a[i]**0.5)+1):
            if a[i]%j==0:
                cnt = 0
                while a[i]%j==0:
                    cnt += 1
                    a[i] = a[i]//j
                if l.get(j)==None:
                    l[j] = cnt
                else:
                    l[j] = max(cnt,l[j])
        if a[i]!=1:
            if l.get(a[i])==None:
                l[a[i]] = 1
    L = 1
    for k in l.keys():
        L *= pow(k,l[k],mod)
    L = L%mod
    ans = 0
    for i in range(n):
        ans += L * pow(A[i],mod-2,mod) % mod
        ans = ans % mod
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))

s = sum(a)
i = 0
b = 0
for i in range(N):
  if b<s/2:
    b += a[i]
  else:
    b = b-a[i-1]
    c = a[i-1]
    break
h = s-b-c
print(b,h,c)
if h>b:
  print(b+c-h)
elif b>h:
  print(h+c-b)
else:
  print(0)

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

if N == 2:
  print(abs(a[0]-a[1]))
else:
  s = sum(a)
  i = 0
  b = 0
  for i in range(N):
    if b<s/2:
      b += a[i]
    else:
      b = b-a[i-1]
      c = a[i-1]
      break
  h = s-b-c
  if h>b:
    print(b+c-h)
  elif b>h:
    print(h+c-b)
  else:
    if N%2==0:
      print(0)
    else:
      print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))

s = sum(a)
i = 0
b = 0
for i in range(N):
  if b<s/2:
    b += a[i]
  else:
    b = b-a[i-1]
    c = a[i-1]
    break
h = s-b-c
if h>b:
  print(abs(b+c)-h)
elif b>h:
  print(abs(h+c)-h)
else:
  print(0)

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

if N == 2:
  print(abs(a[0]-a[1]))
else:
  s = sum(a)
  i = 0
  b = 0
  for i in range(N):
    if b<s/2:
      b += a[i]
    else:
      b = b-a[i-1]
      c = a[i-1]
      break
  h = s-b-c
  if h>b:
    print(b+c-h)
  elif b>h:
    print(h+c-b)
  else:
    if N%2==0:
      print(0)
    else:
      print(c)
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input().split())

import math
if x > a**2 * b/2:
  tan = a/(2*b-2*x/a**2)
  t = math.atan(tan)
else:
  tan = 2 * x/(a * b**2)
  t = math.atan(tan)
  
print(90 - math.degrees(t))

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

import math
if 2*x > b * a**2:
  tan = 2*(b*a**2-x)/a**3
  t = math.atan(tan)
else:
  tan = (a * b**2)/x/2
  t = math.atan(tan)
  
print(math.degrees(t))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

come = [a.index(i)+1 for i in range(1,N+1)]
print(*come)

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

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

a = sorted(list(map(int,input().split())),reverse=True)
for i in range(m):
    a[0] = a[0]/2
    a = sorted(a,reverse=True)
print(sum(list(map(int,a))))

Fixed submission:
def main():
    import heapq
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    heap = []
    for i in range(n):
        heapq.heappush(heap,-1*a[i])
    for i in range(m):
        a = int(heapq.heappop(heap)/2)
        heapq.heappush(heap,a)
    print(-1*sum(heap))



if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
cnt = 0
moji = []
for i in range(n):
    s = sorted(list(input()))
    cnt += moji.count(s)
    moji.append(s)
print(cnt)

Fixed submission:
n = int(input())
cnt = 0
moji = {}
for i in range(n):
    s = ''.join(sorted(list(input())))
    if not s in moji.keys():
        moji[s] = 0 
    cnt += moji[s]
    moji[s] += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,m = map(int,input().split())
    alb = {}
    for i in range(n):
        a,b = map(int,input().split())
        if a not in alb.keys():
            alb[a] = [b]
        else:
            alb[a] += [b]
    search = []
    s = 0
    for i in range(1,m+1):
        if i in alb.keys():
            for j in range(len(alb[i])):
                search.append(alb[i][j])
        if len(search)>0:
            m = search.pop(search.index(max(search)))
            s += m
    print(s)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    import heapq
    n,m = map(int,input().split())
    alb = {}
    for i in range(n):
        a,b = map(int,input().split())
        if a not in alb.keys():
            alb[a] = [b]
        else:
            alb[a] += [b]
    h = []
    s = 0
    for i in range(1,m+1):
        if i in alb.keys():
            for j in range(len(alb[i])):
                heapq.heappush(h, -1*alb[i][j])
        if len(h)>0:
            m = heapq.heappop(h)
            s += -1*m
    print(s)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = input()
    n = len(s)
    ans = [0 for i in range(n)]
    for i in range(n):
        p = i
        if s[i]=='R':
            while s[p]=='R':
                p += 1
            if (p-i)%2==0:
                ans[p] += 1
            else:
                ans[p-1] += 1
        else:
            while s[p]=='L':
                p -= 1
            if (i-p)%2==0:
                ans[p] += 1
            else:
                ans[p+1] += 1
    print(' '.join(list(map(str,ans))))

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    import bisect
    s = input()
    n = len(s)
    ans = [0 for i in range(n)]
    R = []
    L = []
    E = []
    for i in range(n):
        if s[i]=='R' and s[i+1]=='L':
            R.append(i)
        elif s[i]=='L' and s[i-1]=='R':
            L.append(i)
        else:
            E.append(i)
    for i in range(len(E)):
        if s[E[i]]=="R":
            p = bisect.bisect_left(L,E[i])
            if (L[p]-E[i])%2==0:
                ans[L[p]]+=1
            else:
                ans[L[p]-1]+=1
        else:
            p = bisect.bisect_right(R,E[i])
            if (E[i]-R[p-1])%2==0:
                ans[R[p-1]]+=1
            else:
                ans[R[p-1]+1]+=1
    for r in R:
        ans[r]+=1
    for l in L:
        ans[l]+=1
    print(' '.join(list(map(str,ans))))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    l = input()
    n = len(l)
    mod = 10**9+7
    ans = 1
    for i in range(n-1):
        ans = ans*3
        ans = ans%mod
    a = 2
    for i in range(1,n):
        if l[i] == '1':
            j = n-i
            break
    for i in range(j):
        a = a*3
        a = a%mod
    print((ans+a)%mod)
    
if __name__ == "__main__":
    main()


Fixed submission:
def main():
    l = input()
    n = len(l)
    mod = 10**9+7
    dp1 = [0 for i in range(n)]
    dp2 = [0 for i in range(n)]
    dp1[0] = 1
    dp2[0] = 2
    for i in range(1,n):
        if l[i] == '1':
            dp2[i] = (2 * dp2[i-1])%mod
            dp1[i] = (3 * dp1[i-1] + dp2[i-1])%mod
        else:
            dp2[i] = dp2[i-1]
            dp1[i] = (3 * dp1[i-1]) % mod
    print((dp1[-1]+dp2[-1])%mod)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import heapq
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    h = []
    for i in range(n):
        heapq.heappush(h,a[i])
    for i in range(m):
        b,c = map(int,input().split())
        while h[0]<c and b>0:
            b = b-1
            heapq.heappop(h)
            heapq.heappush(h,c)
    print(sum(h))
        


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    import bisect
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    cnt = {}
    for i in range(n):
        if a[i] not in cnt.keys():
            cnt[a[i]] = 1
        else:
            cnt[a[i]] += 1
    for _ in range(m):
        b,c = map(int,input().split())
        if c not in cnt.keys():
            cnt[c] = b
        else:
            cnt[c] += b
    sumed = 0
    s = 0
    for key in sorted(cnt.keys(),reverse=True):
        if n-sumed-cnt[key]>0:
            sumed += cnt[key]
            s += key*cnt[key]
        else:
            s+=key*(n-sumed)
            break
    print(s)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    import numpy as np
    n = int(input())
    graph = np.ones((n,n))*-1
    come = np.ones(n)*-1
    for i in range(n-1):
        u,v,w = map(int,input().split())
        graph[u-1][v-1] = graph[v-1][u-1] = w%2
    que = [0]
    come[0] = 0
    while len(que)>0:
        s = que.pop(0)
        for i,nv in enumerate(graph[s]):
            if nv!=-1:
                if come[i]!=-1:
                    continue
                if nv==0:
                    come[i]=come[s]
                else:
                    come[i]=(come[s]+1)%2
                que.append(i)
    for i in range(n):
        print(str(int(come[i])))
            
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    ki = {}
    for i in range(1,n+1):
        ki[i] = []
    for i in range(n-1):
        u,v,w = map(int,input().split())
        ki[u] += [[v,w%2]]
        ki[v] += [[u,w%2]]
    cl = [-1 for i in range(n)]
    cl[0] = 0
    que = [0]
    while len(que)>0:
        q = que.pop(0)
        for v in ki[q+1]:
            if cl[v[0]-1] != -1:
                continue
            if v[1]==1:
                cl[v[0]-1] = (cl[q]+1)%2
                que.append(v[0]-1)
            else:
                cl[v[0]-1] = cl[q]
                que.append(v[0]-1)
    for i in range(n):
        print(cl[i])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    import numpy as np
    n = int(input())
    graph = np.zeros((n,n))
    come = np.ones(n)*-1
    for i in range(n-1):
        u,v,w = map(int,input().split())
        graph[u-1][v-1] = graph[v-1][u-1] = w
    que = [0]
    come[0] = 0
    while len(que)>0:
        s = que.pop(0)
        for i,nv in enumerate(graph[s]):
            if nv!=0:
                if come[i]!=-1:
                    continue
                if nv%2==0:
                    come[i]=come[s]
                else:
                    come[i]=(come[s]+1)%2
                que.append(i)
    for i in range(n):
        print(int(come[i]))
            
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    ki = {}
    for i in range(1,n+1):
        ki[i] = []
    for i in range(n-1):
        u,v,w = map(int,input().split())
        ki[u] += [[v,w%2]]
        ki[v] += [[u,w%2]]
    cl = [-1 for i in range(n)]
    cl[0] = 0
    que = [0]
    while len(que)>0:
        q = que.pop(0)
        for v in ki[q+1]:
            if cl[v[0]-1] != -1:
                continue
            if v[1]==1:
                cl[v[0]-1] = (cl[q]+1)%2
                que.append(v[0]-1)
            else:
                cl[v[0]-1] = cl[q]
                que.append(v[0]-1)
    for i in range(n):
        print(cl[i])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    a,b = map(int,input().split())
    s = a
    for i in range(a+1,b+1):
        s = s ^ i
    print(s)

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    a,b = map(int,input().split())
    def f(n):
        if n%4==0:
            return n
        if n%4==1:
            return 1
        if n%4==2:
            return n + 1
        if n%4==3:
            return 0
    print(f(b)^f(a-1))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [float('inf') for i in range(n)]
    dp[0] = 0
    for i in range(1,n):
        for j in range(1,k+1):
            if i-j<0:
                break
            m = dp[i-j] + abs(h[i]-h[i-j])
            if dp[i]>m:
                dp[i] = m
    print(dp[n-1])
    

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [float('inf') for i in range(n)]
    dp[0] = 0
    for i in range(1,n):
        for j in range(1,min(i+1,k+1)):
            m = dp[i-j] + abs(h[i]-h[i-j])
            if dp[i]>m:
                dp[i] = m
    print(dp[n-1])
    

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [0 for i in range(n)]
    dp[1] = abs(h[1]-h[0])
    for i in range(2,n):
        m = float('inf')
        for j in range(1,k+1):
            if i-j<0:
                break
            m_ = dp[i-j] + abs(h[i]-h[i-j])
            if m>m_:
                m = m_
        dp[i] = m
    print(dp[n-1])
    

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [float('inf') for i in range(n)]
    dp[0] = 0
    for i in range(1,n):
        for j in range(1,min(i+1,k+1)):
            m = dp[i-j] + abs(h[i]-h[i-j])
            if dp[i]>m:
                dp[i] = m
    print(dp[n-1])
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

def cntchg(s,i):
  cnt = 0
  for j in range(0,i):
    if s[j] == 'W':
      cnt += 1
  for j in range(i+1,len(s)):
    if s[j] == 'E':
      cnt += 1
  return cnt
low = n
for i in range(n):
  if low > cntchg(s,i):
    low = cntchg(s,i)
print(low)

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

cnt = s[1:].count('E')
low = cnt
for i in range(n-1):
  if s[i] == 'W':
    cnt += 1
  if s[i+1] == 'E':
    cnt -= 1
  if cnt < low:
    low = cnt
print(low)
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    p = []
    for _ in range(n):
        p.append(int(input()))
    ans = 0
    add = []
    for i in range(n//2+1):
        if p[i] > n//2:
            ans += 1
            add.append(p[i])
            p[i] = 0
    p += sorted(add)
    P = []
    for p_ in p:
        if p_>0:
            P.append(p_)
    B = P[0:n//2]
    P = P[n//2:]
    m = B[0]
    c = 0
    for i in range(len(B)):
        if B[i]>m:
            m = B[i]
        elif B[i]<m:
            if B[i]>c:
                c = B[i]
    ans += c
    m = P[-1]
    c = 0
    for i in range(len(P)):
        if P[-1-i]<m:
            m = P[-1-i]
        elif P[-1-i]>m:
            if n-P[-1-i]+1>c:
                c = n-P[-1-i]+1
    ans += c
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    p = []
    for _ in range(n):
        p.append(int(input()))
    q = [0 for i in range(n)]
    for i in range(n):
        q[p[i]-1] = i
    m,cnt = 1,1
    for i in range(1,n):
        if q[i]>q[i-1]:
            cnt += 1
            if cnt > m:
                m = cnt
        else:
            cnt = 1
    print(n-m)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = [i for i in range(a[-1])]
    ans = a[-1]
    for i in range(1,n):
        if len(x)==0:
            x = [i for i in range(a[-1-i])]
        e = x.pop(-1)
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = [i for i in range(a[-1-i])]
            ans += a[-1-i]
    if len(x)==0:
        print(ans) 
    else:
        print(-1) 

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = a[-1]
    ans = a[-1]
    for i in range(1,n):
        if x==0:
            x = a[-1-i]
        e = x-1
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = a[-1-i]
            ans += a[-1-i]
        else:
            x -= 1
    if x==0:
        print(ans)
    else:
        print(-1) 

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    a,b,c,d,e,f = map(int,input().split())
    ans = []
    for i in range(f//a//100+1):
        for j in range((f-100*a*i)//b//100+1):
            if a*i*100+b*j*100 < f:
                ans.append([i,j])
    ans = ans[1:]
    D = 0
    for an in ans:
        m = a*100*an[0] + b*100*an[1]
        slv = e*m//100
        M = 0
        for i in range(min(f-m,slv)//c+1):
            for j in range((min(f-m,slv)-c*i)//d+1):
                if i*c+d*j <= min(slv,f-m):
                    if M < i*c+d*j:
                        M = i*c+d*j
        den = M/(m+M)
        if den>D:
            D = den
            A = [m+M,M]
    print(' '.join([str(a) for a in A]))

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    a,b,c,d,e,f = map(int,input().split())
    ans = []
    for i in range(f//a//100+1):
        for j in range((f-100*a*i)//b//100+1):
            if a*i*100+b*j*100 < f:
                ans.append([i,j])
    ans = ans[1:]
    D = 0
    A = [0,0]
    for an in ans:
        m = a*100*an[0] + b*100*an[1]
        slv = e*m//100
        M = 0
        for i in range(min(f-m,slv)//c+1):
            for j in range((min(f-m,slv)-c*i)//d+1):
                if i*c+d*j <= min(slv,f-m):
                    if M < i*c+d*j:
                        M = i*c+d*j
        den = M/(m+M)
        if den>=D:
            D = den
            A = [m+M,M]
    print(' '.join([str(a) for a in A]))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
import math
def main():
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//math.gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()

Fixed submission:
from fractions import gcd
def main():
    n = int(input())
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()