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:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

print(A - N)

Submission status: Accepted

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

import math
A_=list(set(A))

def lcm(a,b):
    gcd_= math.gcd(a,b)
    return int(a*b//gcd_)

lcm_ = A_[0]

for a_idx in range(1,len(A_)):
    lcm_ = lcm(lcm_,A_[a_idx])
    
lcm_ = lcm_-1
lcm_

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

Submission status: Accepted

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


m = 1
for i in a_lst:
	m *= i
m -=1



print(sum([m % i for i in a_lst]))

Submission status: Accepted

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

t = a[0]
for i in range(1,n):
  t = t*a[i]//gcd(t,a[i])
  
ans = 0
for i in a:
  ans += (t-1)%i
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()))

print(sum(a)-n)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
 
ans = [a - 1 for a in A]
print(sum(ans))

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    a = in_nl()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

resolve()

Submission status: Accepted

Solution code:

def solve():
    print(sum(a) - N)

if __name__ == "__main__":
    N = int(input())
    a = list(map(int, input().split()))
    solve()

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())
lst = list(map(int, input().split()))
print(sum(lst) - 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:
# C - Modulo Summation

N = int(input())
A = list(int(a) for a in input().split())

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

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:
def resolve():
    import math
    N = int(input())
    A = [int(i) for i in input().split()]
    lcm = A[0]
    for i in range(1, N):
        lcm = lcm * A[i] // math.gcd(lcm, A[i])
    lcm -= 1
    sumA = 0
    for a in A:
        sumA += lcm % a
    print(sumA)


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = readInts()

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

Submission status: Accepted

Solution code:
from collections import defaultdict
def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = readInts()

ma = max(a)
ans = 0
seki = 1
for i in a:
  seki*=i

for i in a:
  ans += (seki-1)%i

print(ans)

Submission status: Accepted

Solution code:
n, aa = [list(map(lambda x:int(x), s.split())) for s in open(0)]

print(sum(a-1 for a in aa))

Submission status: Accepted

Solution code:
import math


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


def main():
    n = int(input())
    As = list(map(int, input().split()))

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

    ans = 0
    for i in range(n):
        ans += (lcm_num-1) % As[i]
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np
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:
from math import gcd

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

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

l = lcm(A[0], A[1])
for i in range(2,n):
    l = lcm(l, A[i])

ans = 0
for a in A:
    ans += (l-1)%a
    
print(ans)

Submission status: Accepted

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

print(sum(a)-n)

Submission status: Accepted

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

total = 1
for a in A:
    total *= a

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[5]:


import math
from functools import reduce


# In[19]:


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


# In[20]:


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

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


# In[21]:


f = 0
m = lcm_list(a)-1
for i in range(N):
    f += m%a[i]
print(f)


# In[ ]:

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def f(m, num_list):
    return_num = 0
    for num in num_list:
        return_num += m % num
    return return_num

def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    n = i_input()
    num_list = i_list()

    lcm_num = lcm_list(num_list)

    print(f(lcm_num-1,num_list))
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
from functools import reduce

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

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

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

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

k = (lcm_list(l))-1

ans = [0]*n
for i in range(n):
    ans[i] = k%l[i]

print(sum(ans))

Submission status: Accepted

Solution code:
N = int(input())

As = map(int, input().split())

rlt = 0
for a in As:
  rlt += a - 1
  
print(rlt)

Submission status: Accepted

Solution code:
_ = input()
As = list(map(int, input().split()))

print(sum(As)-len(As))

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

print(sum(As)-len(As))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from functools import reduce
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

val = lcm_list(A)-1
res = 0
for a in A:
    res += val%a

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

def ii():
    return int(input())

def main():
    N = ii()
    a = list(mi())
    print(sum(a[i]-1 for i in range(N)))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = sum([v-1 for v in nums])

print(ans)

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    print(sum(a_list)-n)

if __name__ == "__main__":
    main()

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())
l=list(map(int,input().split()))
print(sum(l)-len(l))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int, readline().split()))
ans = 0
for v in a:
    ans += v-1

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()))


S=0
for k in range(N):
        S+=a[k]-1
print(S)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
l = 1
for i in range(N):
    l *= a[i]
l -= 1
ans = 0
for i in range(N):
    ans += l%a[i]
print(ans)

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:
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = int(input())
a = LI()
f = sum(a) - N

print(f)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce
def lcm_base(x,y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
    
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
    
N = int(input())
a = [int(i) for i in input().split(" ")]

x = lcm_list(a)-1
Sum = 0
for a_ in a:
    Sum += x%a_
print(Sum)

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

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())

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

# a1, a2, a3..で割られた際一番余りの大きい数はそれぞれ a1-1, a2-1, a3-1..なのでそれらの合計が答え

print(sum(a_list)-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) - 1 for i in input().split()]
print(sum(a))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
ans = [A[i]-1 for i in range(len(A))]

print(sum(ans))

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:
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()))
print(sum(x-1 for x in a))

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 = list(map(int,input().split()))
K = lcm_list(A)
L = K - 1
ans = 0
for i in range(N):
  ans += L % A[i]
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())
a = list(map(int, input().split()))

# hoge % 3 の最大値は2(3で割ったあまりなので,,)
# hoge % 3, hoge % 4, hoge % 5ならそれぞれ2,3,4が最大なのでその和の9が最大となるんじゃないかと

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

# 証明?
# m = a1*a2...anとした時に m mod ai = 0,
# (m-1) mod ai = ai - 1
# このmが明らかに存在するので、上のやり方で良いとわかる

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum([a[i]-1 for i in range(n)]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())
a = [(int(i)-1) for i in input().split()]

print(sum(a))

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 = [int(i) for i in input().split()]
print(sum(a)-n)

Submission status: Accepted

Solution code:
N = int(input())
a = list(input().split())
A = [int(a[i]) for i in range(N)]
print(sum([A[i] - 1 for i in range(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=int(input())
a=list(map(int,input().split()))
print(sum(a)-n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import fractions
from functools import reduce

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

#最小公倍数-1
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

MaxKoubai = lcm_list(a)
m = MaxKoubai - 1
result = 0

for i in range(N):
    result += m % a[i]
    
print(result)

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_ret_int(*numbers):
    return reduce(lcm_base, numbers, 1)

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

N = int(input())
*A, = map(int, input().split())
lcm_n = lcm_ret_int(*A) - 1
ans = 0
for i in range(N):
    ans += lcm_n % A[i]
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())
print(sum(map(int,input().split()))-n)

Submission status: Accepted

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

from fractions import gcd
from functools import reduce
def lcm(x,y):
  return x*y//gcd(x,y)

q=reduce(lcm,a)

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

Submission status: Accepted

Solution code:
from fractions import gcd
from functools import reduce


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


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

t = reduce(lcm, a, 1) - 1
print(sum(t % a[i] for i in range(N)))

Submission status: Accepted

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

point = 0

for i in a:
  point += i-1

print(point)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = (int(x) - 1 for x in input().split())
    print(sum(A))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
print(sum(a) - n)

Submission status: Accepted

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

Submission status: Accepted

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

def lcm(A):
  x = A[0]
  for i in range(1, len(a)):
    x = (x * A[i]) // gcd(x, A[i])
  return x
 
n = lcm(a) - 1
ans = 0
for v in a:
  ans += n % v
print(ans)

Submission status: Accepted

Solution code:
def gcd(x, y):
  if y != 0:
    return gcd(y, x % y)
  else:
    return x

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

def calc(a, m):
  ans = 0
  for x in a:
    ans += m % x
  return ans

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  m = 1
  for i in range(n):
    m = lcm(a[i], m)
  m -= 1
  ans = calc(a, m)
  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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:
import fractions
def lcm(a):
    LCM = a[0]
    for i in range(1, n):
        LCM = LCM * a[i] // fractions.gcd(LCM, a[i])
    return LCM

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

m = lcm(a) - 1
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

from fractions import gcd

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

tmp1 = A[0]
for a in A:
    tmp2 = gcd(tmp1, a)
    tmp1 = a * tmp1 // tmp2

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

print (ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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


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


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    L = 1
    for i in range(n):
        L = lcm(L, A[i])

    res = 0
    for i in range(n):
        res += (L - 1) % A[i]

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=lmp()
print(sum(a)-len(a))

Submission status: Accepted

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

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

    print(ans)

if __name__=="__main__":
    main()

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:
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=l[i]-1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()
a = inlist()
res = 0
for i in a:
    res += i-1
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

for x in lista:
  ans+= x
  
print(ans- N)

Submission status: Accepted

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

    print(sum(a)-N)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    n = int(readline())
    print(sum([int(i)-1 for i in readline().split()]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd


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


N = int(input())
A = list(map(int, input().split()))
LCM = A[0]
for i in range(1, N):
    LCM = lcm(LCM, A[i])
print(sum((LCM - 1) % a for a in A))

Submission status: Accepted

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

print(sum([i-1 for i in a]))

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 a in A:
    ans += a-1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

minus=[a-1 for a in al]

print(sum(minus))

Submission status: Accepted

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

ans = 0
for i in range(n):
    tmp = mod % a[i]
    ans += tmp
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())
li = list(map(int,input().split()))
print(sum(li)-n)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans-len(a))

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
# ans

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()))

import fractions
lcm = a[0]
for ai in a:
    lcm = lcm * ai // fractions.gcd(lcm, ai)
    #lcm =  fractions.gcd(lcm, ai)
ans = 0
for ai in a:
    ans += (lcm-1)%ai
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import gcd
n = int(input())
l = list(map(int,input().split()))
lcm = 1
for i in range(n):
    lcm = lcm*l[i]//gcd(l[i],lcm)
x = lcm-1
print(sum([x%i for i in l]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
arr=[int(i) for i in input().split()]
ans=0
for i in arr:
    ans+=(i-1)
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()))
f=0
for i in a:
    f+=i-1

print(f)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math
from functools import reduce
sys.setrecursionlimit(10**6)

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

b=1
for i in range(n):
    b*=a[i]

#def lcm_base(x,y):
#    return (x*y)//math.gcd(x,y)
#def lcm_list(numbers):
#    return reduce(lcm_base, numbers, 1)
#c=lcm_list(a)

#print(b)
#print(c)

ans=0
for j in range(n):
    ans+=(b-1)%a[j]
#    ans+=(c-1)%a[j]

#ans=0
##for i in range(b):
#for i in range(c):
#    f=0
#    for j in range(n):
#        f+=(i+1)%a[j]
#    ans=max(ans,f)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
print(sum([a - 1 for a 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:
## C - Modulo Summation
import fractions
N = int(input())
A = list(map(int, input().split()))

gcd = 0
for i in range(1, N):
    gcd = gcd * A[i] // fractions.gcd(gcd, A[i])
print( sum( [ (gcd - 1) % a for a in A] ) )

Submission status: Accepted

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

print(sum(map(lambda x: x - 1, A)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, fractions

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))

lcm = 1
for a in A:
    lcm = (lcm * a) // fractions.gcd(lcm, a)

lcm -= 1
res = 0
for a in A:
    res += lcm % a

print(res)

Submission status: Accepted

Solution code:
N=int(input())

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

print(sum(A)-N)