Buggy python submission (verdict: Runtime Error):
import math
import fraction
from functools import reduce


def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = [int(i) for i in input().split()]

ans1 = 0

lcm = lcm_list(a)

for num in a:
    ans1 += (lcm - 1) % num

print(ans1)


Fixed submission:
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

Buggy python submission (verdict: Runtime Error):
import math
import fraction
from functools import reduce


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = [int(i) for i in input().split()]

ans1 = 0

lcm = lcm_list(a)

for num in a:
    ans1 += (lcm - 1) % num

print(ans1)


Fixed submission:
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = [int(i) for i in input().split()]

ans1 = 0

lcm = lcm_list(a)

for num in a:
    ans1 += (lcm - 1) % num

print(ans1)


Fixed submission:
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

ans1 = ans2 = 0
li_ans = []


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


lcm = lcm_list(a)

for num in a:
    ans1 += (lcm - 1) % num
    ans2 += (lcm + 1) % num

print(max(ans1, ans2))


Fixed submission:
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
li_ans = []

primeN = []
tmp = 2
for i in range(2, 100000):
    if primeN:
        for j in range(len(primeN)):
            if i % primeN[j] == 0:
                break
            else:
                if j == len(primeN) - 1:
                    primeN.append(i)
    else:
        if 100000 > tmp:
            primeN.append(i)

for i in primeN:
    for num in a:
        ans += i % num
    else:
        li_ans.append(ans)
        ans = 0
else:
    print(max(li_ans))


Fixed submission:
import fractions
from functools import reduce
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
 
n = int(input())
a = [int(i) for i in input().split()]
 
ans1 = 0
 
lcm = lcm_list(a)
 
for num in a:
    ans1 += (lcm - 1) % num
 
print(ans1)