Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
"""素因数分解"""
def prime_decomposition(n):
    i = 2
    tank = []
    while i * i <= n:
        while n%i == 0:
            n /= i
            tank.append(i)
        i += 1
    if n > 1:
        tank.append(int(n))
    return dict(Counter(tank))

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9 + 7
    dct = {}
    for a in A:
        tmp = prime_decomposition(a)
        for k, v in tmp.items():
            if k not in dct.keys():
                dct[k] = v
            else:
                if v > dct[k]:
                    dct[k] = v
    l = 1
    for k,v in dct.items():
        l *= k**v
    res = 0
    for a in A:
        res += l//a
    print(res % mod)

if __name__ == '__main__':
    main()

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    for a in A:
        res += l//a
        res %= mod
    print(res%mod)

if __name__ == '__main__':
    main()

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

"""最大公約数"""
def gcd(a,b):
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f


def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = A[0]
    for i in range(1, n):
        l = lcm(l, A[i])
    res = 0
    
    for a in A:
        res += l//a
        res %= mod
    print(res%mod)

if __name__ == '__main__':
    main()

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):

import fractions

"""最大公約数"""
def gcd(a,b):
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f


def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = A[0]
    for i in range(1, n):
        l = lcm(l, A[i])
    res = 0
    
    for a in A:
        res += l//a
        res %= mod
    print(res%mod)

main()

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import fractions
"""最大公約数"""
def gcd(a,b):
    return fractions.gcd(a,b)
"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f
def m(nums):
    return functools.reduce(lcm, nums)

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
l = m(A)
res = 0
for a in A:
    res += l//a
    res %= mod
print(res%mod)

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
"""最大公約数"""
def gcd(a,b):
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
l = A[0]
for i in range(1, n):
    l = lcm(l, A[i])
res = 0
for a in A:
    res += l//a
    res %= mod
print(res%mod)

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
"""最大公約数"""
def gcd(a,b):
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
l = A[0]
for i in range(1, n):
    l = lcm(l, A[i])
res = 0
for a in A:
    res += l//a
    res %= mod
print(res%mod)

Fixed submission:
import functools
"""最大公約数"""
def gcd(a,b):
    import fractions
    return fractions.gcd(a,b)

"""最小公倍数"""
def lcm(a,b):
    f = gcd(a,b)
    return a*b//f

def m(nums):
    return functools.reduce(lcm, nums)

def main():
    n = int(input())
    A = list(map(int,input().split()))
    mod = 10**9+7
    l = m(A)
    res = 0
    print(sum(l// i for i in A) % mod)

if __name__ == '__main__':
    main()