Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

def _lcm(a, b):
    _gcd = gcd(a, b)
    return int((a * b) / _gcd)

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from math import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
from fractions import gcd

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

n = int(input())

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

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    if t >= ans:
        ans = lcm(t, ans)
    else:
        ans = lcm(ans, t)
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    a = max(ans, t)
    b = min(ans, t)
    ans = lcm(a, b)
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

def lcm_mlt(a, num_list):
    if len(num_list) == 0:
        return a
    n = num_list.pop()
    a = max(a, n)
    b = min(a, n)
    return lcm_mlt(lcm(a, b), num_list)

n = int(input())
nl = [int(input()) for _ in range(n)]

print(lcm_mlt(1, nl))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    md = a % b
    if md == 0:
        return b
    return gcd(b, md)

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

def lcm_mlt(a, num_list):
    if len(num_list) == 0:
        return a
    n = num_list.pop()
    a = max(a, n)
    b = min(a, n)
    return lcm_mlt(lcm(a, b), num_list)

n = int(input())
nl = list(set([int(input()) for _ in range(n)]))

print(lcm_mlt(1, nl))