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:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
a = IL()
P(sum(a)-N)

Submission status: Accepted

Solution code:
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
tmp=1
for f in a:
    tmp*=f
gcd=functools.reduce(fractions.gcd, a)
lcm=tmp//gcd
lcm-=1
ans=0
for f in a:
    ans+=lcm%f
print(ans)

Submission status: Accepted

Solution code:
import fractions
n=int(input())
A=list(map(int,input().split()))
gd=1
tmp=A[0]
for i in range(n-1):
    gd=fractions.gcd(A[i+1],A[i])
    tmp*=A[i+1]
lcm=tmp//gd
lcm-=1
ans=0
for a in A:
    ans+=lcm%a

print(ans)

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())
s = list(map(int,input().split()))

ans = 0
for i in s:
    ans += i-1

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = np.array(lr())
A -= 1
answer = A.sum()
print(answer)

Submission status: Accepted

Solution code:
n = int(input())

a = tuple(map(int,input().split()))
print(sum(a)-n)

Submission status: Accepted

Solution code:
n = int(input())

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

buff = 1
for i in ls:
    buff *= i

buff -= 1

ans = 0

for i in ls:
    ans += buff % i

print(ans)

Submission status: Accepted

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

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())
a = map(int,input().split())
print(sum(a)-n)

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
an = list(map(int, input().split()))


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


temp = lcm(an[0], an[1])
for i in range(2, N):
    temp = lcm(temp, an[i])
ans = 0
for a in an:
    ans += (temp-1) % a
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n = I()
A = LI()
def lcm(a, b):
    g = gcd(a, b)
    return a*b//g
l = reduce(lcm, A) - 1
ans = 0
for a in A:
    ans += l % a
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))
    ans = sum(a -1 for a in A)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import collections

sys.setrecursionlimit(10 ** 7)

# 1 ✕ 1 (int)
N = int(input().rstrip())

# 1 ✕ N
A = list(map(int, input().rstrip().split()))

print(sum(A) - N)

Submission status: Accepted

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

Submission status: Accepted

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

def gcd(c, b):
    if b == 0:
        return c
    return gcd(b,c%b)

for i in range(n-1):
    ans = ans*a[i+1] // gcd(ans,a[i+1])
sum = 0
for i in range(n):
    sum += (ans-1)%a[i]
print(sum)

Submission status: Accepted

Solution code:
from fractions import gcd
N = int(input())
A = tuple(map(int, input().split()))

l = A[0]
for i in range(1, N):
    l = l * A[i] // gcd(l, A[i])
l = l - 1

f = 0 
for a in A:
    f += l % a
print(f)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd  # if python3.5~, use math.gcd


def f(x, a):
    return sum([x % aa for aa in a])


def main():
    N = int(input())
    a = list(map(int, input().split(' ')))
    gcd_a = a[0]
    for i in range(1, N):
        gcd_a = gcd(gcd_a, a[i])
    lcm_a = a[0]
    for i in range(1, N):
        lcm_a *= a[i] // gcd_a
    print(f(lcm_a - 1, a))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions
n=int(input())
a=list(map(int, input().split()))
ans=a[0]
for i in range(1,n):
    ans=ans*a[i]//fractions.gcd(ans, a[i])
print(sum([(ans-1)%a[j] for j in range(n)]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N = int(input())
S = list(map(int ,input().split()))
lcm_1 = lcm(S)-1
max_sum = 0
for i in range(N):
    max_sum += lcm_1%S[i]

print(max_sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
numbers = tuple(map(int, input().split(' ')))
print(sum([n - 1 for n in numbers]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
a  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
for a_ in a:
    ans += a_ -1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#import math
import fractions

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

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

g = A[0]
for i in range(1,N):
    g = lcm(g,A[i])
g -= 1

ans = 0
for a in A:
    ans += g % a
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    print(sum(l)-n)
    
resolve()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 16:46:20 2020

@author: shinba
"""

n = int(input())

ans = 0

for i in map(int,input().split()):
    ans += i

print(ans-n)

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())
li = list(map(int,input().split()))

print(sum(li)-n)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

print(sum(a)-N)

Submission status: Accepted

Solution code:
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod=10**9+7

n=I()
nums=LI()
print(sum(nums)-n)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    N,=pin()
    A=lispin()
    temp=A[0]
    for i in range(1,N):
        temp=(temp*A[i])//(gcd(temp,A[i]))
    x=(temp-1)
    ans=0
    for a in A:
        ans+=x%a
    print(ans)
#%%submit!
resolve()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
#def input():
#    return sys.stdin.readline()[:-1]

'''
n=int(input())
for i in range(n):
    a[i]=int(input())
    a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())

'''

test_data1 = '''\
A??C
'''

test_data2 = '''\
ACACAC
'''

test_data3 = '''\
7
994 518 941 851 647 2 581
'''

test_data4 = '''\
?AC?AC
'''
td_num=3

def GetTestData(index):
    if index==1:
        return test_data1
    if index==2:
        return test_data2
    if index==3:
        return test_data3
    if index==4:
        return test_data4
    
if False:
    with open("../test.txt", mode='w') as f:
        f.write(GetTestData(td_num))
    with open("../test.txt") as f:
        # Start Input code ---------------------------------------
        n=int(f.readline())
        a=[int(x) for x in f.readline().split()]
        # End Input code ---------------------------------------
else:
    # Start Input code ---------------------------------------
    n=int(input())
    a=[int(x) for x in input().split()]
    # End Input code ---------------------------------------
#print(n,a,sum(a)-n)
print(sum(a)-n)

Submission status: Accepted

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

print(sum(l)-len(l))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def I(): return int(sys.stdin.readline().rstrip())
N = I()
a = LI()
print(sum(a)-len(a))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
A = LI()
print(sum(A)-N)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

for i in a:
    ans += i-1

print(ans)

Submission status: Accepted

Solution code:
import fractions
N = int(input())
a = list(map(int, input().split()))
res = a[0]
for i in range(1,N):
    res = res*a[i]//fractions.gcd(res,a[i])
res -= 1
ans = 0
for i in range(N):
    ans += res%a[i]
print(ans)

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 sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum(n - 1 for n in A))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

lcm_A = lcm(A[0], A[1])
for a in A[2:]:
    lcm_A = lcm(lcm_A, a)

for a in A:
    ans += (lcm_A-1) % a

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
*a, = map(int, open(0).read().split())
print(sum(a[1:])-a[0])

Submission status: Accepted

Solution code:
def main():
    *a, = map(int, open(0).read().split())
    print(sum(a[1:])-a[0])
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n, *a = map(int, open(0).read().split())
    ans = sum(a) - n
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    N, *a = map(int, open(0).read().split())

    print(sum(a) - N)


main()

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    q = 0
    for a in A:
        q += a - 1

    print(q)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    q = 1
    for a in A:
        q *= a

    print(sum((q-1) % a for a in A))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    L = lmi()
    print(sum(L) - n)    


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
n = int(input())
a_inputs = list(map(int,input().split()))

print(sum(a_inputs)-len(a_inputs))

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 num in a:
    ans+=num-1

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

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

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

Submission status: Accepted

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

ans = sum(nums) - N

print(ans)

Submission status: Accepted

Solution code:
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
m = 1
for i in range(N):
    m *= a[i]

m-=1
for A in a:
    ans += m % A

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(int, input().split()))
ans = 0
m = 1
for num in arr:
    m *= num

for num in arr:
    ans += (m - 1) % num

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc103
# 11:25-


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

    ans = sum([a-1 for a in A])

    return ans


print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#template
def inputlist(): return [int(k) for k in input().split()]
#template
N = int(input())
A = inputlist()
print(sum(A)-N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
#from collections import deque
# from math import factorial
# import collections
import sys
sys.setrecursionlimit(2000000)
# import itertools
# import statistics
# import numpy as np
n = input()
#n, m = list(map(int, input().split()))
a = list(map(int, input().split()))


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


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


b = lcm_list(a)-1
f = 0
for i in a:
    f += b % i

print(f)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

print(sum(a-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:
N = int(input())
list_a = map(int,input().split())
print(sum(list_a)-N)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))

    res=0
    for i in range(N):
        res+=A[i]-1
    
    print(res)
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

ans = 0
for i in range(len(a)):
  ans += a[i]

print(ans - n)

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:
import sys
input=sys.stdin.buffer.readline
n=int(input())
L=list(map(int,input().split()))
print(sum(L)-n)

Submission status: Accepted

Solution code:
def main():
    ans = 0
    n = int(input())
    l = list(map(int, input().split()))
    ans = sum(l)-n
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#nY-1 mod Yで最大値、Y-1になる。

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

f = 1
p = 0

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

Submission status: Accepted

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

asum=0
for ai in a:
    asum+=(ai-1)
print(asum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import fractions
from functools import reduce


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

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)

sum_a = (lcm_list(a)-1)

ans = 0
for i in a:
    ans = (sum_a % i) + ans

print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    s = 0
    for i in range(N):
        s += A[i] - 1
    print(s)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, a: "List[int]"):
    print(sum(a) - N)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(A)-n)

Submission status: Accepted

Solution code:
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()
a = list(mapint_inp())

ans = 0 
for a_i in a:
    ans += a_i-1

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    print(sum(A)-N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# solution

data = int(input())
array = list(map(int, input().split()))
result = sum(array) - data

print(result)