Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def prime_pair(n):
        pairs = {}
        tmp = n
        for i in range(2, n):
            if i * i > n:
                break
            if tmp % i != 0:
                continue
            ex = 0
            while tmp % i == 0:
                ex += 1
                tmp /= i
            pairs[i] = ex
        if tmp != 1:
            pairs[int(tmp)] = 1
        return pairs

    N = int(input())
    a_list = list(map(int, input().split()))
    a_pp_list = []
    MOD = 10**9 + 7

    a_lcm = {}
    key_set = set()
    for a in a_list:
        a_pp = prime_pair(a)
        a_pp_list.append(a_pp)
        for k in a_pp.keys():
            if k not in key_set:
                key_set.add(k)
                a_lcm[k] = a_pp[k]
            else:
                a_lcm[k] = max(a_lcm[k], a_pp[k])

    a_l = 1
    for k in a_lcm.keys():
        a_l *= k ** a_lcm[k]

    res = 0
    for a in a_list:
        res +=  a_l // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def prime_pair(n):
        pairs = {}
        tmp = n
        for i in range(2, n):
            if i * i > n:
                break
            if tmp % i != 0:
                continue
            ex = 0
            while tmp % i == 0:
                ex += 1
                tmp /= i
            pairs[i] = ex
        if tmp != 1:
            pairs[int(tmp)] = 1
        return pairs

    N = int(input())
    a_list = list(map(int, input().split()))
    a_pp_list = []
    MOD = 10**9 + 7

    a_lcm = {}
    key_set = set()
    for a in a_list:
        a_pp = prime_pair(a)
        a_pp_list.append(a_pp)
        for k in a_pp.keys():
            if k not in key_set:
                key_set.add(k)
                a_lcm[k] = a_pp[k]
            else:
                a_lcm[k] = max(a_lcm[k], a_pp[k])

    a_l = 1
    for k in a_lcm.keys():
        a_l *= k ** a_lcm[k]

    res = 0
    for a in a_list:
        res +=  a_l // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
        res %= MOD
    print(res)

if __name__ == "__main__":
    main()

Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a_lcm, a)

    res = 0
    for a in a_list:
        res += a_lcm // a
        res %= MOD
    print(res)

if __name__ == "__main__":
    main()

Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def prime_pair(n):
        pairs = {}
        tmp = n
        for i in range(2, n):
            if i * i > n:
                break
            if tmp % i != 0:
                continue
            ex = 0
            while tmp % i == 0:
                ex += 1
                tmp /= i
            pairs[i] = ex
        if tmp != 1:
            pairs[int(tmp)] = 1
        return pairs

    N = int(input())
    a_list = list(map(int, input().split()))
    a_pp_list = []
    MOD = 10**9 + 7

    a_lcm = {}
    key_set = set()
    for a in a_list:
        a_pp = prime_pair(a)
        a_pp_list.append(a_pp)
        for k in a_pp.keys():
            if k not in key_set:
                key_set.add(k)
                a_lcm[k] = a_pp[k]
            else:
                a_lcm[k] = max(a_lcm[k], a_pp[k])

    a_l = 1
    for k in a_lcm.keys():
        a_l *= k ** a_lcm[k]

    res = 0
    for a in a_list:
        res = (res + a_l // a) % MOD
    print(res)

if __name__ == "__main__":
    main()


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def gcd(v1, v2):
        while v2 > 0:
            v1,v2 = v2, v1%v2
        return v1

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a_lcm, a)

    res = 0
    for a in a_list:
        res = (res + a_lcm // a) % MOD
    print(res)

if __name__ == "__main__":
    main()


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def gcd(v1, v2):
        # if v2 == 0:
        #     return v1
        # return gcd(v2, v1%v2)
        
        while v2 > 0:
            tmp = v1
            v1 = v2
            v2 = tmp%v1
        return v1


    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a_lcm, a)

    res = 0
    for a in a_list:
        res = (res + a_lcm // a) % MOD
    print(res)

if __name__ == "__main__":
    main()


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def gcd(v1, v2):
        if v2 == 0:
            return v1
        return gcd(v2, v1%v2)

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a_lcm, a)

    res = 0
    for a in a_list:
        res = (res + a_lcm // a) % MOD
    print(res)

if __name__ == "__main__":
    main()


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    def gcd(v1, v2):
        if v2 == 0:
            return v1
        return gcd(v2, v1%v2)

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a_lcm, a)

    res = 0
    for a in a_list:
        res = (res + a_lcm // a) % MOD
    print(res)

if __name__ == "__main__":
    main()


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

def gcd(v1, v2):
    if v2 == 0:
        return v1
    return gcd(v2, v1%v2)

N = int(input())
a_list = list(map(int, input().split()))

MOD = 10**9 + 7

a_lcm = a_list[0]
for a in a_list[1:]:
    a_lcm *= a // gcd(a_lcm, a)

res = 0
for a in a_list:
    res = (res + a_lcm // a) % MOD
print(res)


Fixed submission:

from fractions import gcd
def main():

    N = int(input())
    a_list = list(map(int, input().split()))

    MOD = 10**9 + 7

    a_lcm = a_list[0]
    for a in a_list[1:]:
        a_lcm *= a // gcd(a,a_lcm)

    res = 0
    for a in a_list:
        res += a_lcm // a
    print(res%MOD)

if __name__ == "__main__":
    main()