Problem:


Score : 300 points

Problem Statement

You are given N positive integers a_1, a_2, ..., a_N.

For a non-negative integer m, let f(m) = (m\ mod\ a_1) + (m\ mod\ a_2) + ... + (m\ mod\ a_N).

Here, X\ mod\ Y denotes the remainder of the division of X by Y.

Find the maximum value of f.

Constraints

All values in input are integers.

2 \leq N \leq 3000

2 \leq a_i \leq 10^5

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

Print the maximum value of f.

Sample Input 1

3
3 4 6

Sample Output 1

10

f(11) = (11\ mod\ 3) + (11\ mod\ 4) + (11\ mod\ 6) = 10 is the maximum value of f.

Sample Input 2

5
7 46 11 20 11

Sample Output 2

90

Sample Input 3

7
994 518 941 851 647 2 581

Sample Output 3

4527



Sample input:
3
3 4 6


Sample output:
10

Submission status: Accepted

Solution code:
N = int(input())
line = input().split()
r = 0
for i in range(N):
    r += int(line[i]) - 1
print(r)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

N = input()
N = int(N)
a = list(map(int,input().split()))
m = lcm(*a)
x = 0
for j in range(N):
  x += (m-1) % a[j]
print(x)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split(" ")))
a = list(map(lambda x: x-1,a))
print(sum(a))

Submission status: Accepted

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
print(sum(A)-N)

Submission status: Accepted

Solution code:
import functools
import fractions

def blcm(x, y):
	return (x*y)//fractions.gcd(x, y)

def slcm(numbers):
	return functools.reduce(blcm, numbers)
	
input()
numbers=list(map(int, input().split()))
num=slcm(numbers)-1
nums=[num%i for i in numbers]
print(sum(nums))

Submission status: Accepted

Solution code:
a=int(input())
print(sum(list(map(int,input().split())))-a)

Submission status: Accepted

Solution code:
n = input()
arr = map(int,raw_input().split())
print sum(arr)-n

Submission status: Accepted

Solution code:
n = int(input())

arr = [int(a) - 1 for a in input().split()]

print(sum(arr))

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
out = sum(map(lambda x: x - 1, a))
print(out)

Submission status: Accepted

Solution code:
n = input()
m = map(int, input().split())
ans = 0
for i in m:
    ans += i - 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
print(sum(map(int,input().split()))-n)

Submission status: Accepted

Solution code:
N = int(input())
a =  list(map(int, input().split()))

Total = 1
for i in range(len(a)):
    Total *= a[i]

ans = 0
for i in range(N):
    ans += (Total - 1) % int(a[i])
  

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

m = input().split()
sum = 1
for i in range(N):
	sum *= int(m[i])
ans = 0
for i in range(N):
	ans += (sum - 1) % int(m[i])
print(ans)

Submission status: Accepted

Solution code:
N = input()
l = map(int, raw_input().split())
print (sum(l) - N)

Submission status: Accepted

Solution code:
def main():
    input()
    lcm = 1
    num_list = [int(i) for i in input().split()]
    for i in range(len(num_list)):
        lcm = num_list[i] * lcm
    lcm -= 1

    counter = 0
    for i in num_list:
        counter += (lcm % i)
    
    print(counter)

main()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]

ans = sum(a) - n

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]
print(sum([(ai-1)%ai for ai in a]))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))

lcm=a[0]
for ai in a[1:]:
    gcd=lcm
    lcm*=ai
    if ai<lcm:
        gcd,ai=ai,gcd
    while ai%gcd!=0:
        gcd,ai=ai%gcd,gcd
    lcm//=gcd

s=0    
for ai in a:
    s+=(lcm-1)%ai
print(s)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(_) for _ in input().split()]

print(sum(a) - N)

Submission status: Accepted

Solution code:
n = int(input())
an = list(map(int, input().split()))

ans = 0
for a in an:
    ans += (a - 1)
print(ans)

Submission status: Accepted

Solution code:
size,ans = int(input()),list(map(int,input().split()))
print(sum(ans)-size)

Submission status: Accepted

Solution code:
n = int(input())
seq = list(map(int,input().split()))

seq.sort()

print(sum(seq)-n)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
MAX = max(a)
ans = 0
for i in range(N):
	ans += a[i] - 1
print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 
n=int(input())
A=list(map(int,input().split()))
ans=1
for x in A:
    ans=ans*x//gcd(ans,x)
ans-=1
t=0
for x in A:
    t+=ans%x
print(t)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

ans = sum(a) - len(a)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))

print(sum(l) - n)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
    ans += a[i]-1
print(ans)

Submission status: Accepted

Solution code:
import sys
import fractions

dp = None
A = []

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

def f(m):
    ans = 0
    for a in A:
        ans += m % a
    return ans

def main():
    global A

    N = int(input())
    A = [int(_) for _ in input().split()]

    lcmtemp = 1

    for a in A:
        lcmtemp = lcm(lcmtemp, a)

    print(f(lcmtemp-1))

main()

Submission status: Accepted

Solution code:
import numpy as np
import collections as col
import math
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += A[i] - 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=sum(list(map(int,input().split())))
print(s-n)

Submission status: Accepted

Solution code:
n = int(input().strip())
data = list(map(int, input().split()))

print (sum(data) - n)

Submission status: Accepted

Solution code:
#a = int(input())
#b,c = map(int,input().split())
#s = input()
#list_s = list(input())
#list_int = list(map(int,input().split()))

#list = [0 for i in range(n)]
#dp = [[0 for i in range(A)] for j in range(B)]

#list_int 並べて出力 print (' '.join(map(str,ans_li)))
#list_str 並べて出力 print (' '.join(list))

# 2進数 format(10, 'b') # '1010'

# aa=[int(input()) for i in range(n)]

#for i,name in enumerate(list)

''' 二次元配列を一列ずつ
for i in ans:
	print(*i)
'''
''' heapq
queue = []
heapq.heapify(queue) #heapqの作成
heapq.heappush(queue,num) #numのpush(値の追加)
pop = heapq.heappop(queue) #numのpop(最小値の出力)
pop = heapq.heappushpop(queue,num) #push -> pop

'''

from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7

#最大公約数
def gcd(a,b):
	while b:
		a,b = b, a%b
	return a

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

N = int(input())
aa = list_int = list(map(int,input().split()))

mod = 1

for i in range(N):
	mod = lcm(aa[i],mod)

mod -= 1
ans = 0
for i in range(N):
	ans += mod%aa[i]

print(ans)

Submission status: Accepted

Solution code:
N = input()
a = list(map(int,input().split()))
ans = 0
for x in a:
    ans += (x -1)
print(ans)

Submission status: Accepted

Solution code:
import math


class Sieve:
    """Sieve of Eratosthenes.

    List primes up to n.
    """

    def __init__(self, n):
        self.__prime = []
        self.__is_prime = [i >= 2 for i in range(n + 1)]

        for i in range(2, int(math.sqrt(n)) + 1):
            if self.__is_prime[i]:
                for j in range(i * i, n + 1, i):
                    self.__is_prime[j] = False

        for i in range(2, n + 1):
            if self.__is_prime[i]:
                self.__prime.append(i)

    def prime(self):
        return self.__prime

    def is_prime(self, n):
        return self.__is_prime[n]


def bf(N, a):
    p = Sieve(max(a) + 1).prime()  # len <= 9952

    prime_to_power = {}
    for prime in p:
        prime_to_power[prime] = 0

    for i in range(N):
        ai = a[i]
        for prime in p:
            power = 0
            while ai % prime == 0:
                ai //= prime
                power += 1
            prime_to_power[prime] = max(prime_to_power[prime], power)
    lcm = 1
    for prime in prime_to_power:
        lcm *= prime ** prime_to_power[prime]
    m = lcm - 1
    ans = 0
    for ai in a:
        ans += m % ai
    return ans


def al(N, a):
    return sum(a) - len(a)


if __name__ == '__main__':
    N = int(input())  # 2 <= N <= 3000
    a = list(map(int, input().split()))  # 2 <= ai <= 100000
    # print(bf(N, a))
    print(al(N, a))

Submission status: Accepted

Solution code:
n=int(input())
a = list(map(int, input().split()))
sum=0
for i in range(n):
    sum=sum+a[i]-1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

print(str(sum(a) - n))

Submission status: Accepted

Solution code:
n = int(input())
a = input().split()
sum = 0

for i in range(0,n):
  sum += int(a[i])-1

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
A = [int(i) for i in input().split()]


ans = 0
for i in range(0, n):
    ans = ans + A[i] - 1

print (ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

f = 0
for a in A:
    f += a-1
print(f)

Submission status: Accepted

Solution code:
from functools import reduce
import math

n = int(input())
a_list = [int(a) for a in input().split()]
maxv = sum([a-1 for a in a_list])
print(maxv)

Submission status: Accepted

Solution code:
NUM_MAX = 10**5
is_prime = [True] * NUM_MAX
is_prime[0] = False
is_prime[1] = False
primes = []
for i in range(2, NUM_MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(2*i, NUM_MAX, i):
            is_prime[j] = False

def solve(n, a):
    def f(m):
        return sum([m % p for p in a])
    D = {}
    for v in a:
        d = {}
        for prime in primes:
            while v % prime == 0:
                v /= prime
                if not prime in d:
                    d[prime] = 0
                d[prime] += 1
        for prime, num in d.items():
            if not prime in D:
                D[prime] = 0
            D[prime] = max(D[prime], num)
    m = 1
    for prime, num in D.items():
        for i in range(num):
            m *= prime
    return f(m-1)

assert solve(3, [3,4,6]) == 10
assert solve(5, [7,46,11,20,11]) == 90
assert solve(7, [994,518,941,851,647,2,581]) == 4527

n = input()
a = map(int, raw_input().split())
print solve(n, a)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
m=1
ans=0
for i in range(n):
  m *= a[i]
  ans +=(m-1)%a[i] 
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [int(i) - 1 for i in input().split()]
print(sum(L))

Submission status: Accepted

Solution code:
N = int(input())
nums = list(map(int, input().split()))
ans = 0
for i in nums:
    ans += i-1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input().split()
a=[None]*n
for i in range(n):
    a[i]=int(s[i])-1
print(sum(a))

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
a = list(map(int,input().split()))
print (np.sum(a)-len(a))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
ans=sum(a)-n
print(ans)

Submission status: Accepted

Solution code:
def c_modulo_summation(N, A):
    return sum(a-1 for a in A)

N = int(input())
A = [int(i) for i in input().split()]
print(c_modulo_summation(N, A))

Submission status: Accepted

Solution code:
input()
a=list(map(int,input().split(' ')))
sum=0
for i in a:
    sum+=i-1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

ans=sum(a) - n
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
array = [int(x) for x in input().split()]

res = 0
for i in array:
    res += i-1
print(res)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    print(sum(a) - n)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
res = 0;
for i in range(N):
    res += a[i]-1
    
print (res)

Submission status: Accepted

Solution code:
n=int(input())
a=map(int,input().split())
print(sum(a)-n)

Submission status: Accepted

Solution code:
input()
print(sum(list(map(lambda x: int(x)-1, input().split()))))

Submission status: Accepted

Solution code:
input()
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
li  = list(map(int,input().split(" ")))
s  = lcm(li[0],li[1])
for i in range(len(li)-2):
    s = lcm (s,li[i+2])
def f(m):
    r = 0
    for i  in li:
        r += m%i
    return r
print(f(s-1))

Submission status: Accepted

Solution code:
n = int(input())
a=list(map(int, input().split()))
print(sum(a) - len(a))

Submission status: Accepted

Solution code:
import sys
import functools

def na(): return map(int,sys.stdin.readline().split())
def ns(): return sys.stdin.readline().strip()


n,=na()
a=list(na())

print(functools.reduce(lambda x,y: x+y-1,a)-1)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
  ans += a[i]-1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
	ans+=(a[i]-1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [int(i) for i in input().split()]
print(sum(L) - N)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

A1 = [a - 1 for a in A]

print(sum(A1))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
def gcd(b,c):
    while c!=0:
        b,c=c,b%c
    return b
def lcm(b,c):
    return b*c//gcd(b,c)
temp=a[0]
for i in range(n):
    temp=lcm(a[i],temp)
ans=temp-1
total=0
for i in range(n):
    total+=ans%a[i]
print(total)

Submission status: Accepted

Solution code:
from sys import stdin
from fractions import gcd

N =  [int(i) for i in input().split()]
nums =[int(i) for i in input().split()]
print(sum(nums)-N[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

print(sum(aN)-N)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

a_sum = 0
for i in range(n):
    a_sum += a[i]

print(a_sum - n)

Submission status: Accepted

Solution code:

import fractions

n = int(input().strip())
an = list(map(int, input().strip().split(' ')))


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


temp = an[0]
for i in range(len(an)):
    temp = lcm(temp, an[i])

m = temp - 1

ret = 0
for a in an:
    ret += m % a

print(ret)

Submission status: Accepted

Solution code:
N = int(input())
t = [int(i) for i in input().split()]
print(sum(t)-N)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
print(sum(A)-N)

Submission status: Accepted

Solution code:
N = int(input())
print(sum(list(map(int, input().split(" "))))-N)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    ans += a[i]-1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
# num=[]
num = list(int(i) for i in input().split())

f = sum(num)-n
print(f)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    strs = input()
    As = sorted([int(num) for num in strs.split()], reverse=True)
    print(sum([a - 1 for a in As]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

_ = input()
A = map(int, raw_input().split())
sz = len(A)

print sum(A) - sz

Submission status: Accepted

Solution code:
# def gcd(a, b):
# 	while b:
# 		a, b = b, a % b
# 	return a

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

# def f(m, input):
#   r = 0
#   for i in input:
#     r += m % i
#   return r

N = map(int, input())
a_n = list(map(int, input().split(" ")))
# a_n = sorted(a_n)

max = 0
for x in a_n:
  max += x
 
# result = []
# for m in range(max):
  # out = f(m, a_n)
  # result.append(out)
# re = sorted(result)
#print(re[-1])
#print(max) #994 518 941 851 647 2 581 -> 4534
print(max - len(a_n))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
print(sum(A) - N)

Submission status: Accepted

Solution code:
N = input()
a = list(map(int, input().split()))

summ2 = sum(a) - int(N)

print(summ2)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

print(sum(a) - len(a))

Submission status: Accepted

Solution code:
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))

Submission status: Accepted

Solution code:
n = int(input())
a = [int(m) for m in input().split(" ")]

print(sum(a)-len(a))

Submission status: Accepted

Solution code:
N=input();print(sum(map(int,input().split()))-int(N))

Submission status: Accepted

Solution code:
N=input();print(sum(list(map(int,input().split())))-int(N))

Submission status: Accepted

Solution code:
from sys import stdin                                                                                                                                                                                       
N = int(stdin.readline().rstrip())                                                                                                                                                                          
a = [int(x) for x in stdin.readline().rstrip().split()]                                                                                                                                                     
ans = 0                                                                                                                                                                                                     
for x in a:                                                                                                                                                                                                 
    ans += x -1                                                                                                                                                                                             
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(int(i) for i in input().split())

print(sum(a)-n)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
import re
import math
import itertools
import collections
import bisect
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.1415926535897932
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b//gcd(a,b)
def eucl(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0
#def pscl(num,l=[1]):
#    for i in range(num):
#        l = map(lambda x,y:x+y,[0]+l,l+[0])
#    return l

# "!/usr/bin/env pypy3
# pscl 要修正

def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1


n=int(input())
a=[int(i) for i in input().split()]
tmp=a[0]
ans=chk=0
for i in range(1,n):
    tmp=lcm(tmp,a[i])
if n%2!=0: tmp=lcm(tmp,a[-1])
y=tmp-1
p=0
for i in a:
   p+=y%i
print(p)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] -= 1
print(sum(a))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(30000)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

def lcm_list(li):
    if len(li) == 2:
        return lcm(li[0], li[1])

    else:
        li = [lcm(li[0], li[1])] + li[2:]
        return lcm_list(li)

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


i = max(lcm_list(a) - 1, 1)
print(sum([i % j for j in a]))

Submission status: Accepted

Solution code:
N = int(input())

a = list(map(int,input().split()))

sum =0
for i in a:
    sum+=i-1
print(sum)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
Answer = 0
while N > 0:
  Answer += A[N-1]-1
  N -= 1
print(Answer)

Submission status: Accepted

Solution code:
print((lambda a,b:sum(b)-int(a))(input(),list(map(int,input().split()))))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
sum = 0
for a_i in a:
    sum += a_i-1
print(sum)

Submission status: Accepted

Solution code:
import fractions
from functools import reduce

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

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

# gcd = functools.reduce(math.gcd, values)
m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

Submission status: Accepted

Solution code:
from functools import reduce
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


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

def lcm(nums):
    return reduce(lcm_base, nums, 1)

n, a = input(), list(map(int, input().split()))
l = lcm(a)
sum = 0
for aa in a:
    sum += (l-1) % aa
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a)-n)

Submission status: Accepted

Solution code:
N = int(input())
Nlist = list(map(int, input().split()))
ans = 0
for x in Nlist:
    ans += x-1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

from functools import reduce

def gcd(a, b):
    while b:
      a, b = b, a % b
    return a

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

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

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

m = lcm(a_list) - 1
fm = 0

for i in a_list:
    fm = fm+(m % i)

print(fm)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
def main():
	N = int(input())
	a = list(map(int, input().split()))
	SUM = 0
	for i in a:
		SUM += i
	print(SUM - N)


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(raw_input())
# スペース区切りの整数の入力
l = map(int, raw_input().split())

ret= sum([(a-1) for a in l])
print ret

Submission status: Accepted

Solution code:
def gcd(a,b):
	if a==0:
		return b
	return gcd(b%a,a)

def find_lcm(num1, num2):
    if(num1>num2):
        b = num1
        a = num2
    else:
        b = num2
        a = num1
    G = gcd(a,b)
    lcm = (num1*num2)//G
    return lcm
     
N=int(input())
A=list(map(int,input().split()))
lcm = find_lcm(A[0],A[1])
for I in range(2, N):
    lcm = find_lcm(lcm, A[I])
Ans=0
lcm-=1
for I in range(N):
	Ans+=(lcm%A[I])
print(Ans)

Submission status: Accepted

Solution code:
N = input()
list = list(map(int,input().split()))
ans = 0
for i in list:
 ans += i - 1
print(ans)

Submission status: Accepted

Solution code:
def spaceinput():
    return list(map(int,input().split(" ")))


N=int(input())
a=spaceinput()
print(sum(a)-N)

Submission status: Accepted

Solution code:
import fractions


def run(n, a):
    '''
    g = a[0]
    for j in range(1, len(a)):
        g = int(g * a[j] / fractions.gcd(g, a[j]))
    m = g
    tmp_f = 0
    f = 0
    for i in range(1, m+1):
        tmp_f = 0
        for j in range(len(a)):
            tmp_f += i % a[j]
        f = max(f, tmp_f)
    '''
    f = 0
    for i in range(len(a)):
        f += a[i] - 1
    return f


def read_line():
    n = int(input())
    a = list(map(int, input().split()))
    return (n, a)


def main():
    n, a = read_line()
    print(run(n, a))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Modulo Summation

def main():
    n = input()
    arr = input()
    nums = [int(c) for c in arr.split(" ")]

    print(sum([(n - 1) for n in nums]))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))

# lcm_num = lcm(a[0], a[1])
# 
# for i in range(2, n):
#     lcm_num = lcm(lcm_num, a[i])

ans = 0
for i in range(n):
    ans += a[i] - 1

print(int(ans))

Submission status: Accepted

Solution code:

N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
def lcm(x,y):
    return (x * y) // gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)

Submission status: Accepted

Solution code:
import fractions

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

N = int(input())
a = list(map(int, input().split()))
L = a[0]
f = 0

for i in range(N-1):
    L = lcm(L,a[i+1])

for i in range(N):
    f = f + (L-1)%a[i]

print(f)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
li = [0]
fmax = 0

for i in range(N):
  fmax += a[i]
print(fmax-N)

Submission status: Accepted

Solution code:
a = map(int, raw_input().split())
b = map(int, raw_input().split())

sum = 0
for i in range(len(b)):
  sum = sum + b[i]

ans = sum-len(b)
print ans

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split(" ")))
sum = 0

for i in range(len(a)):
  sum += a[i] - 1
  
print(sum)

Submission status: Accepted

Solution code:
import fractions

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

n = int(input())
inputs = list(map(int, input().split(' ')))
for i in range(len(inputs)):
    if i == 0:
        x = lcm(inputs[0], inputs[1])
        continue
    if i == 1:
        continue
    x = lcm(x, inputs[i])
x -= 1
s = 0
for i in inputs:
    s += x % i
print(s)

Submission status: Accepted

Solution code:
N=int(input())
s=list(map(int,input().split(' ')))
ans=0
for i in range(N):
    ans+=s[i]-1
print(ans)

Submission status: Accepted

Solution code:
input()
ip = input().split()
data = []
ans = 0
for i in ip:
    ans += int(i) - 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n):
    ans = ans + a[i]-1
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split(" ")))
print(sum(a) - N)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = np.array(list(map(int,input().split())))-1
print(a.sum())

Submission status: Accepted

Solution code:
import numpy as np
N = int(raw_input())
a = map(int, raw_input().split())
print (np.sum(a) - N)

Submission status: Accepted

Solution code:
n = int(input())
a = [ int(x) for x in input().split(" ") ]

s = 0
for i in a:
    s += i - 1
print(s)

Submission status: Accepted

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

print(sum(a)-len(a))

Submission status: Accepted

Solution code:
n = input()
a = list(map(int,input().split()))
ans = 0
for num in a:
	ans = ans + num -1
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from operator import mul

def gcd(a, b):
    m, n = a, b
    while m % n != 0:
        m, n = n, m%n
    return n


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


N = int(input())
A = map(int, input().split(' '))
A = list(A)

m = reduce(lcm, A, 1) - 1

fm = 0
for ai in A:
    fm += m % ai

print(fm)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0

# import math
# from functools import reduce
# def lcm_base(x, y):
#     return int((x * y) / math.gcd(x, y))
# def lcm_list(numbers):
#     ans = 0
#     for i in range(1,len(numbers)):
#         if(i == 1):
#             ans = lcm_base(numbers[0], numbers[1])
#         else:
#             ans = lcm_base(ans, numbers[i])
#     return ans
# min_bin= lcm_list(a)
num = 1
for i in a:
    num = num * i
num = num - 1
for i in a:
    ans += num % i
# for i in range(5000000):
#     tmp = 0
#     for j in a:
#         # print(j)
#         tmp += i % j
#     if(tmp > ans):
#         ans = tmp
print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

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

m = 1
for i in range(N):
	m = lcm(a[i], m)
m -= 1

ans = 0
for i in range(N):
	ans += m % a[i]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
num=list(map(int,input().split()))
print(sum(num)-N)

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

def gcd(x,y):
    if x > y:
        x , y = y , x
    while x>0:
        x, y = y%x , x
    return y
    
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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


m =  lcm_list(A) -1

B = 0

for j in range(len(A)):
    B += m%A[j]

print(B)

Submission status: Accepted

Solution code:
n = input()
a_li = list(map(int,input().split()))

f = 0
for i in range(len(a_li)) :
    f = f + a_li[i] - 1

print(f)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import fractions
from functools import reduce


def main():
    N = int(input().strip())
    A = [int(x) for x in input().strip().split()]
    lcm = lcm_list(A) - 1
    print(f(lcm, A))

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


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


def f(m, A):
    result = 0
    for i in A:
        result += m % i
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = input()
xs = [int(x) for x in input().split()]

print(sum(x-1 for x in xs))