Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

def check_t(num):
    i = 1
    while(True):
        if num < 2**i:
            return 2**i
        else:
            i += 1


from collections import defaultdict
n = getN()
nums = getlist()
numhash = defaultdict(int)
for i in nums:
    numhash[i] += 1
ans = 0
for num in sorted(numhash.keys(), key=lambda x: -x):
    while(numhash[num] != 0):
        target  = (check_t(num)) - num
        if numhash[target]:
            if target == num:
                if numhash[target] >= 2:
                    ans += 1
                    numhash[target] -= 2
                else:
                    numhash[num] = 0
            else:
                if numhash[target] >= 1:
                    ans += 1
                    numhash[target] -= 1
                    numhash[num] -= 1
                else:
                    numhash[num] = 0
        else:
            numhash[num] = 0


print(ans)


Fixed submission:
import sys
import math
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

def check_t(num):
    t = math.log(num,2)
    return 2**(int(t)+1)



from collections import defaultdict
n = getN()
nums = getlist()
numhash = defaultdict(int)
for i in nums:
    numhash[i] += 1
ans = 0
for num in sorted(numhash.keys(), key=lambda x: -x):
    while(numhash[num] != 0):
        target = (check_t(num)) - num
        if numhash[target]:

            if target == num:
                if numhash[target] >= 2:
                    ans += 1
                    numhash[target] -= 2
                else:
                    numhash[num] = 0
            else:
                if numhash[target] >= 1:
                    ans += 1
                    numhash[target] -= 1
                    numhash[num] -= 1
                else:
                    numhash[num] = 0
        else:
            numhash[num] = 0


print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
# input = sys.stdin.buffer.readline
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getlist():
    return list(map(int, input().split()))
import heapq
import bisect
import copy
import math
# import math
def warshall_floyd(d, N):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i * N +j] = min(d[i * N +j], d[i * N + k] + d[k * N + j])
    return d

MOD = 10**9 + 7

def main():
    n, k = getlist()
    nums = getlist()
    acc = [0]
    tmp = 0
    for num in nums:
        tmp += num
        acc.append(tmp)

    poss = []
    for r in range(n+1):
        for l in range(r):
            poss.append(acc[r] - acc[l])

    poss.sort()
    # print(poss)
    lborder, rborder = 0, (n * (n+1)) // 2

    ans, digit = 0, math.floor(math.log2(poss[-1])) + 1
    # print(digit)
    tmp = 0

    while(digit >= 0):
        tmp += 2 ** (digit - 1)
        mid = bisect.bisect_left(poss, tmp)
        if rborder - mid >= k:
            lborder = mid
        elif mid - lborder >= k:
            rborder = mid
            tmp -= 2 ** (digit - 1)
        else:
            print(tmp - 2 ** (digit - 1))
            return

        digit -= 1

    print(tmp)


if __name__ == '__main__':
    main()



Fixed submission:
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

class BIT():
    # A1 ... AnのBIT(1-indexed)
    def __init__(self, n):
        self.n = n
        self.BIT = [0] * (n + 2)

    # A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    # Ai += x O(logN)
    def update(self, idx, x):
        # print(idx)
        while idx <= self.n:
            # print(idx)
            self.BIT[idx] += x
            idx += idx & (-idx)
        return

    def show(self):
        print(self.BIT)


def solve():
    n, k = getList()
    lis = [0] + getList()
    for i in range(n):
        lis[i+1] += lis[i]

    ka = []
    for i in range(n):
        for j in range(i+1, n+1):
            ka.append(lis[j]-lis[i])

    ans = 0
    for rui in range(50, -1, -1):
        ok = []
        tgt = pow(2, rui)
        for kaka in ka:
            if kaka & tgt == tgt:
                ok.append(kaka)
        if len(ok) >= k:
            ans += tgt
            ka = ok

    print(ans)





def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
Buggy python submission (verdict: Runtime Error):
import  math
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = []


for i in range(n):
  nums.append(getN())

half = int(math.floor(n/2))
nums.sort()
nums1 = nums[:half]
nums2 = nums[half:]
nums2[1], nums2[-1] = nums2[-1], nums2[1]

tmp = nums2[0]
diff = 0
diff2 = 0
for i in range(half):
    num = nums2[i]
    diff += abs(tmp-num)
    tmp = num

    num = nums1[i]
    diff += abs(tmp - num)
    tmp = num

if n%2 == 1:
    diff += abs(tmp-nums2[-1])

if n%2 == 1:
    nums1 = nums[:half+1]
    nums2 = nums[half+1:]
    nums1[0], nums1[-2] = nums1[-2], nums1[0]

    tmp = nums1[0]
    for i in range(half):
        num = nums1[i]
        diff2 += abs(tmp - num)
        tmp = num

        num = nums2[i]
        diff2 += abs(tmp - num)
        tmp = num

    diff2 += abs(tmp-nums1[-1])

#print(nums1)
#print(nums2)
print(max(diff, diff2))
"""
3 4 5 9
1 1 3
"""


Fixed submission:
import  math
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n = getN()
nums = []


for i in range(n):
  nums.append(getN())

if n == 2:
    print(abs(nums[0]-nums[1]))

if n > 2:
    half = int(math.floor(n/2))
    nums.sort()
    nums1 = nums[:half]
    nums2 = nums[half:]
    nums2[1], nums2[-1] = nums2[-1], nums2[1]

    tmp = nums2[0]
    diff = 0
    diff2 = 0
    for i in range(half):
        num = nums2[i]
        diff += abs(tmp-num)
        tmp = num

        num = nums1[i]
        diff += abs(tmp - num)
        tmp = num

    if n%2 == 1:
        diff += abs(tmp-nums2[-1])

    if n%2 == 1:
        nums1 = nums[:half+1]
        nums2 = nums[half+1:]
        nums1[0], nums1[-2] = nums1[-2], nums1[0]

        tmp = nums1[0]
        for i in range(half):
            num = nums1[i]
            diff2 += abs(tmp - num)
            tmp = num

            num = nums2[i]
            diff2 += abs(tmp - num)
            tmp = num

        diff2 += abs(tmp-nums1[-1])

    #print(nums1)
    #print(nums2)
    print(max(diff, diff2))
"""
3 4 5 9
1 1 3
"""
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))

big = max([a,b,c])

print(sum[a,b,c] + 9*big)

Fixed submission:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

a,b,c = getlist()
m = max([a,b,c])
print(10*m + a+ b+ c -m)
Buggy python submission (verdict: Time Limit Exceeded):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

s = input()
n = len(s)
dp = [[0 for j in range(4)] for i in range(n+1)]
dp[0][0] = 1

for i,c in enumerate(s):
    if c == "?":
        dp[i+1][0] = dp[i][0] * 3
        dp[i + 1][1] = dp[i][0] + dp[i][1] * 3
        dp[i + 1][2] = dp[i][1] + dp[i][2] * 3
        dp[i + 1][3] = dp[i][2] + dp[i][3] * 3

    elif c == "A":
        dp[i + 1][0] = dp[i][0]
        dp[i + 1][1] = dp[i][0] + dp[i][1]
        dp[i + 1][2] = dp[i][2]
        dp[i + 1][3] = dp[i][3]


    elif c == "B":
        dp[i + 1][0] = dp[i][0]
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][2] = dp[i][1] + dp[i][2]
        dp[i + 1][3] = dp[i][3]

    else:
        dp[i + 1][0] = dp[i][0]
        dp[i + 1][1] = dp[i][1]
        dp[i + 1][2] = dp[i][2]
        dp[i + 1][3] = dp[i][2] + dp[i][3]

print(dp[n][3] % 1000000007)



Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

s = input()
n = len(s)
xc, yc, zc, wc = 1,0,0,0

for c in s:
    if c == "?":
        x = xc*3
        y = xc + yc * 3
        z = yc + zc * 3
        w = zc + wc * 3

    elif c == "A":
        x = xc
        y= yc + xc
        z = zc
        w = wc

    elif c == "B":
        x = xc
        y = yc
        z = zc + yc
        w = wc

    else:
        x = xc
        y = yc
        z = zc
        w = wc + zc

    xc,yc,zc,wc = [cur%1000000007 for cur in [x,y,z,w]]

print(wc)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n, m, d = getList()
    if d == 0:
        each = n
    else:
        each = (n - d) * 2
    igai = pow(n, m-2)
    all = each * igai * (m-1)
    ans = all/pow(n,m)

    print(ans)
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Fixed submission:
import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n, m, d = getList()
    if d == 0:
        each = n
    else:
        each = (n - d) * 2
    # igai = pow(n, m-2)
    all = each * (m-1) / (n * n)
    ans = all

    print(ans)
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
for n,m in zip(nums2[:-1],nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
  value = m

answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)

Fixed submission:
N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
if length == 1:
  value = nums2[0]
 
for n,m in zip(nums2[:-1],nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
  value = m
 
answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
for n,m in zip(nums2,nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)

Fixed submission:
N = int(input())
nums = input().split(" ")
nums2 = [int(x)-i-1 for i,x in enumerate(nums)]
nums2.sort()
length = len(nums2)
numpre = 0
same = 1
if length == 1:
  value = nums2[0]
 
for n,m in zip(nums2[:-1],nums2[1:]):
  if n == m:
    same += 1
  else:
    impact = same + numpre
    if impact > length-impact:
      value = n
      break
    numpre += same
    same = 1
  value = m
 
answer = 0
for i in nums2:
  answer += abs(i-value)
print(answer)
Buggy python submission (verdict: Runtime Error):
import math
from typing import List, Any

N: int = int(input())

def nsin(N, base):
    if N == 0: return [0]
    Nsin: List[Any] = []
    for i in range((int(math.log(N,base)//1)+1)):
        ithdigit = N%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin

ans = N
for i in range(N):
    coins: int = sum(nsin(i,6)) + sum(nsin(N-i,9))
    if coins < ans: ans = coins

print(ans)

Fixed submission:
import math
N = int(input())
 
def Nsinpou(x, base):
    #配列を返す Nsin[0]が上位桁
    if x == 0: return [0]
    Nsin = []
    for i in range((round(math.log(x,base))+1)):
        ithdigit = x%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin
 
ans = N
for i in range(N+1):
    coins = sum(Nsinpou(i,6)) + sum(Nsinpou(N-i,9))
    if coins < ans:
        ans = coins
    
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
from typing import List, Any

N: int = 44852

def nsin(N, base):
    if N == 0: return [0]
    Nsin: List[Any] = []
    for i in range((int(math.log(N,base)//1)+1)):
        ithdigit = N%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin

ans = N
for i in range(N):
    coins: int = sum(nsin(i,6)) + sum(nsin(N-i,9))
    if coins < ans: ans = coins

print(ans)

Fixed submission:
import math
N = int(input())
 
def Nsinpou(x, base):
    #配列を返す Nsin[0]が上位桁
    if x == 0: return [0]
    Nsin = []
    for i in range((round(math.log(x,base))+1)):
        ithdigit = x%(base**(i+1)) // (base ** i)
        Nsin.append(ithdigit)
    Nsin.reverse()
    return Nsin
 
ans = N
for i in range(N+1):
    coins = sum(Nsinpou(i,6)) + sum(Nsinpou(N-i,9))
    if coins < ans:
        ans = coins
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
s= input()

D = N
for i in range(N):
    L,R = s[:i],s[i+1:]
    n1,n2 = Counter(L),Counter(R)
    num = n1["W"] + n2["E"]
    if num < D:
        D = num
print(D)

Fixed submission:
from collections import Counter
N = int(input())
s= input()

D = Counter(s[1:])["E"]
nums = [D]
for i in range (1,N):
    temp = nums[-1]
    if s[i-1] == "W":
        temp += 1
    if s[i] == "E":
        temp -= 1
    nums.append(temp)

print(min(nums))

Buggy python submission (verdict: Runtime Error):
rom collections import Counter
N = int(input())
s= input()

D = N
for i in range(N):
    L,R = s[:i],s[i+1:]
    n1,n2 = Counter(L),Counter(R)
    num = n1["W"] + n2["E"]
    if num < D:
        D = num
print(D)

Fixed submission:
from collections import Counter
N = int(input())
s= input()

D = Counter(s[1:])["E"]
nums = [D]
for i in range (1,N):
    temp = nums[-1]
    if s[i-1] == "W":
        temp += 1
    if s[i] == "E":
        temp -= 1
    nums.append(temp)

print(min(nums))

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

D = N
for i in range(N):
    temp = 0
    for j in range (N):
        if (i < j) and (s[j] == "E" ) or  (i > j) and (s[j] == "W" ) :
            temp += 1
    if temp < D:
        D = temp
print(D)

Fixed submission:
from collections import Counter
N = int(input())
s= input()

D = Counter(s[1:])["E"]
nums = [D]
for i in range (1,N):
    temp = nums[-1]
    if s[i-1] == "W":
        temp += 1
    if s[i] == "E":
        temp -= 1
    nums.append(temp)

print(min(nums))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
s= input()
s = s.replace("E", "0")
s = s.replace("W", "1")

D = N
for i in range(N):
    temp = 0
    for j in range (N):
        if (i < j) and (s[j] == "0" ):
            temp += 1
        if (i > j) and (s[j] == "1" ):
            temp += 1 
    if temp < D:
        D = temp
print(D)

Fixed submission:
from collections import Counter
N = int(input())
s= input()

D = Counter(s[1:])["E"]
nums = [D]
for i in range (1,N):
    temp = nums[-1]
    if s[i-1] == "W":
        temp += 1
    if s[i] == "E":
        temp -= 1
    nums.append(temp)

print(min(nums))
Buggy python submission (verdict: Time Limit Exceeded):
N, HP = map(int, input().split())

hit = 0
throw = []
for i in range(N):
    h, t = map(int, input().split())
    if h > hit:
        hit = h
    throw.append(t)

throw.sort()


ans = 0
for t in throw[::-1]:
    if t < hit:
        break
    else:
        ans += 1
        HP -= t
        if HP <= 0:
            break

while HP > 0:
    ans += 1
    HP -= hit
print(ans)

Fixed submission:
import math

N, HP = map(int, input().split())

hit = 0
throw = []
for i in range(N):
    h, t = map(int, input().split())
    if h > hit:
        hit = h
    throw.append(t)

throw.sort()

ans = 0
for t in throw[::-1]:
    if t < hit:
        break
    else:
        ans += 1
        HP -= t
        if HP <= 0:
            break
if HP > 0:
    ans += HP // hit
    if HP % hit != 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
rom collections import Counter

s = input().strip()
c = Counter(s)
v = list(c.values())
if max(v) - min(v) > 1: 
  print("NO")
else:
  print("YES")

Fixed submission:
from collections import Counter

s = input().strip() + "abc"
c = Counter(s)
v = list(c.values())
if max(v) - min(v) > 1: 
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Runtime Error):
n = input().split()
nums = list(map(int, input.split()))

flag = 0
ans = 0
for i, num in enumerate(nums):
  if i == num:
    if flag:
      ans += 1 
      flag = 0
    else:
      flag = 1
  else:
    if flag == 1:
      ans += 1
      flag = 0
      
if flag == 1:
  ans += 1
  
print(ans)

Fixed submission:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
ans = 0
N = getN()
list = getList()
bind = []
for i, x in enumerate(list):
    if x == i+1:
        bind.append(x)
p = 0
l = len(bind)
while p<l:
    ans += 1
    if p == l-1:
        p += 1
    elif bind[p] + 1 == bind[p+1]:
        p += 2
    else:
        p += 1


print(ans)
Buggy python submission (verdict: Runtime Error):
getList = lambda: list(map(int, input().split()))
a,b,x = getList()
if abs(a - x) < abs(b = x):
  print("A")
else:
  print("B")

Fixed submission:
getList = lambda: list(map(int, input().split()))
x,a,b = getList()
if abs(a - x) < abs(b - x):
  print("A")
else:
  print("B")
Buggy python submission (verdict: Runtime Error):
N = int(input())
upper = list(input())
lower = list(input())
ans = 0

def count(upper, lower, state):
    global ans
    if upper[0] == lower[0]:
        if state == 1:
            ans *= 2
            try:
                count(upper[1:],lower[1:],state=1)
            except:
                return ans
        if state == 2:
            try:
                count(upper[1:], lower[1:], state=1)
            except:
                return ans
    else:
        if state == 1:
            ans *= 2
            try:
                count(upper[2:], lower[2:], state=2)
            except:
                return ans
        if state == 2:
            ans *= 3
            try:
                count(upper[2:], lower[2:], state=2)
            except:
                return ans

if upper[0] == lower[0]:
    ans = 3
    count(upper[1:], lower[1:], state=1)
else:
    ans = 6
    count(upper[2:], lower[2:], state=2)

print(ans%1000000007)

Fixed submission:
N = int(input())
upper = list(input())
lower = list(input())
ans = 0

def count(upper, lower, state):
    global ans
    if upper[0] == lower[0]:
        if state == 1:
            ans *= 2
            try:
                count(upper[1:],lower[1:],state=1)
            except:
                return ans
        if state == 2:
            try:
                count(upper[1:], lower[1:], state=1)
            except:
                return ans
    else:
        if state == 1:
            ans *= 2
            try:
                count(upper[2:], lower[2:], state=2)
            except:
                return ans
        if state == 2:
            ans *= 3
            try:
                count(upper[2:], lower[2:], state=2)
            except:
                return ans

if upper[0] == lower[0]:
    ans = 3
    try:
        count(upper[1:], lower[1:], state=1)
    except:
        pass
else:
    ans = 6
    try:
        count(upper[2:], lower[2:], state=2)
    except:
        pass

print(ans%1000000007)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return math.gcd(x, y)
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

Fixed submission:
from fractions import gcd

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

def getN():
    return int(input())
# print(lcm(10, 20))

n = getN()
ans = 1
for i in range(n):
    t = getN()
    ans = lcm(ans, t)

print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
 
n = int(input())
ans = int(input())
for i in range(n-1):
  tmp = int(input())
  ans = lcm(ans,tmp)
  
print(ans)

Fixed submission:
from fractions import gcd

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

def getN():
    return int(input())
# print(lcm(10, 20))

n = getN()
ans = 1
for i in range(n):
    t = getN()
    ans = lcm(ans, t)

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input)
ans = int(input)
for i in range(n-1):
  tmp = int(input)
  ans = lcm(ans,tmp)
  
print(ans)

Fixed submission:
from fractions import gcd

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

def getN():
    return int(input())
# print(lcm(10, 20))

n = getN()
ans = 1
for i in range(n):
    t = getN()
    ans = lcm(ans, t)

print(ans)

Buggy python submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input)
ans = int(input)
for i in range(n-1):
  tmp = int(input)
  ans = lcm(ans,tmp)
  
print(ans)

Fixed submission:
from fractions import gcd

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

def getN():
    return int(input())
# print(lcm(10, 20))

n = getN()
ans = 1
for i in range(n):
    t = getN()
    ans = lcm(ans, t)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
N, M = map(int, input().split())
dep = []
arr = []
ans = "IMPOSSIBLE"

for i in range(M):
  a,b = map(int ,input().split())
  if a == 1: dep.append(b-1)
  if b == N: arr.append(a-1)
 
for i in (arr):
  if i in dep:
    ans = "POSSIBLE"
    break
print(ans)

Fixed submission:
from collections import defaultdict
N, M = map(int, input().split())

shima = []
ans = "IMPOSSIBLE"

for i in range(M):
  a,b = map(int ,input().split())
  if a == 1: shima.append(b-1)
  if b == N: shima.append(a-1)
    
shima.sort()
for s,t in zip(shima[:-1],shima[1:]):
  if s == t:
    ans = "POSSIBLE"
    break
 
print(ans)