TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
input()
a=input().split(' ')
sum=0
for i in a:
    sum+=i-1
print(sum)


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


Verdicts: Runtime Error

Accepted
Problem: 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.

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

sum(a-1 for a in aa)

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
sal
n = int(input())
a = list(map(int, input().split()))
print(sum(a)-len(a))


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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = 0
x = [s += int(i) for i in input().split()]
print(s - n)


n = int(input())
x = [int(i) for i in input().split()]
print(sum(x) - n)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(a[i],l)
s=0
l-=1
for i in range(n):
    s+=l%a[i]
print(s)

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

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

n=int(input())
a=[int(i) for i in input().split()]
l=1
for i in range(n):
    l=lcm(l,a[i])
s=0
l-=1
for i in range(n):
    s+=(l%a[i])
print(int(s))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=input()
a=list(map(int,input().split()))
print(sum(a)-n)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
l = list(map(int,input().split()))
ans = 0

for i in range(10000, 10000000)[::-1]:
    x = 0
    for j in l:
        x += i%j
    if x > ans:
        ans = x

print(ans)

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

print(sum(li)-n)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split())
print(sum(a)-n)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
*a, = map(int, input().split())
print(sum(a[1:])-a[0])


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N=input()
print(sum(map(int, input().split()))-N)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = list()
print(sum(a) - n)


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=input()
A=list(map(int,input.split()))
t=sum(A)-1
ans=0
for a in A:
    ans += t % a
print(ans)


n=input()
A=list(map(int,input().split()))
t=sum(A)-1
ans=0
for a in A:
    ans += t % a
print(ans)


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

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())

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

ans = -1

for i in range(max(a) * 2):
    tmp = 0
    for j in a:
        tmp += i % j
    ans = max(ans, tmp)
    print('i, ans: ', i, ans)
print(ans)

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

ans = sum(a) - n

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
I = int(input())
B = 0
for i in range(I):
	A = input()
    B = A - 1 + B
print(str(B))

I = int(input())
B = 0
for i in range(I):
	A = input()
    B = A - 1 + B
print(B)

I = int(input())
B = 0
for i in range(I):
	A = input()
	B = A - 1 + B
print(str(B))

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
sum=0
for i in range(n):
    sum += int(input())
print(sum-n)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
i = 0
Mb = B[0]
while Mb > Ma:
  i += 1
  if i == N:
    Mb = 0
    B = B[:i]
  else:
    Mb = B[i]
H -= sum(B)
print(i+int(-(-H//Ma)))

N,H = map(int,input().split())
Ma = 1
B = []
for i in range(N):
    a,b = map(int,input().split())
    B.append(b)
    if a > Ma:
        Ma = a
B.sort()
B.reverse()
C = 0
i = 0
while i < len(B) and B[i] > Ma:
  i += 1
H -= sum(B[:i])
print(i+int(-(-H//Ma)))

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math

input = sys.stdin.readline

N=int(input().strip())
inf=1000000007

ans=0
for i in range(1,N+1):
    ans+=(i**10-(i-1)**10)*(math.floor(N/i)**10)
print(ans%inf)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
print(-int(input())+sum(int(i) for i in input().split())))

print(-int(input())+sum(int(i) for i in input().split()))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())

X=list(map(int,input()))

print(sum(X)-n)

n=int(input())

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

print(sum(X)-n)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import time
start = time.time()
N = int(input())
A = list(map(int, input().split()))
maxval = 0
m = 0
while True:
    if m % 1000 == 0:
        if time.time() - start > 1.9:
            break
    print(maxval)
    funcval = 0
    for n in range(N):
        funcval += m % A[n]
    if maxval < funcval:
        maxval = funcval
    m += 1
print(maxval)

import time
start = time.time()
N = int(input())
A = list(map(int, input().split()))
maxval = 0
m = 0
while True:
    if m % 1000 == 0:
        if time.time() - start > 1.9:
            break
    funcval = 0
    for n in range(N):
        funcval += m % A[n]
    if maxval < funcval:
        maxval = funcval
    m += 1
print(maxval)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

import math
n = int(input())
ans = list(map(int,input().split()))
lcm = ans[0]
for k in ans:
    gcd = math.gcd(lcm, k)
    lcm = round(lcm*k/gcd)
    print(lcm)


an =0
for k in ans:
    an += (lcm-1)%k
        
print(an)

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

print(sum(ans)-n)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
A = list(map(int, input()))

print(sum(A) - N)

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

print(sum(A) - N)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
l = list(map(int, input().split()))
print(sum(l) = n)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#AtCoder
N = int(input())
a = list(map(int, input()))

print(sum(a)-N)

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

print(sum(a)-N)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N=input()
print(sum([int(a) for a in input().split()])-N)

input()
print(sum([int(a)-1 for a in input().split()]))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
import functools
N = int(input())
a = list(map(int, input().split()))

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

def lcm_list(lst):
    return functools.reduce(lcm,lst)

lcma = lcm_list(a)-1
res = 0
for i in a:
    res += lcma%i
print(int(res))

from functools import reduce
N = int(input())
a = list(map(int, input().split()))

def gcd_impl(n,m):
    K = 5
    for _ in range(80):
        t = n - m
        s = n - m*K
        q = t < m
        p = t < m*K
        if q:
            n = m
        else:
            n = t
        if q:
            m = t
        else:
            m = m
        if m == 0:
            return n
        if p:
            n = n
        else:
            n = s
    return gcd_impl(m, n%m)

def gcd_pre(n,m):
    for _ in range(4):
        t = n - m
        q = t < m
        if q:
            n = m
        else:
            n = t
        if q:
            m = t
        else:
            m = m
        if m == 0:
            return n
    return gcd_impl(n,m)

def gcd(n,m):
    if n > m:
        return gcd_pre(n,m)
    else:
        return gcd_pre(m,n)

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

def lcm_list(lst):
    return reduce(lcm, lst)

M = lcm_list(a) - 1

res = 0
for i in a:
    res += M%i
print(res)

Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = []
for i in range(n):
  a.append(int(input())-1)
  
print(sum(a))

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

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

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	if (t % A[i]):
		continue
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))



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

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	if (t % A[i])
		continue
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))



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

N = int(input())
A = list(map(int, input().split()))
#N = 3
#A = [3,4,6]

t = A[0]
for i in range(1,N):
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
#print(t)
for i in range(N):
	sum += t % A[i]
print(sum)


n = int(input())
lst = list(map(int, input().split()))
print(sum(lst) - n)


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = map(int, input().split())
print(sum(a)-len(a))


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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
print(sum(map(int,input.split()))-N)

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


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








#for i,name in enumerate(list)




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)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from fractions import gcd
def lcm(a):
    len_a = len(a)
    ret = a[0]
    for i in range(1, len_a):
        ret = (ret * a[i]) // gcd(ret, a[i])
    return ret
n = int(input())
a = [int(i) for i in input().split()]

def f(m):
    sum = 0
    for i in range(n):
        sum += m % a[i]
    return sum

print(max(f(i) for i in range(lcm(a))))

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

Verdicts: Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
l=list(map(int,input().split()))
lcm=l[0]
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a

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

print(lcm-1)


N=int(input())
l=list(map(int,input().split()))
g=l[0]
lcm=l[0]
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a

for i in range(1,N):
  g=gcd(g,l[i])

for i in range(1,N):
  lcm*=l[i]//g
  
print(lcm-1)

N=int(input())
l=list(map(int,input().split()))
lcm=l[0]
ans=0
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import math

# N = int(input())


N =5
a =7, 46, 11, 20, 11

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

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

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

f = [0 for i in range(koubai)]

for i in range(len(f)):
    for j in range(N):
        f[i] += i % a[j]

print(max(f))

import math

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

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

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

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

# f = [0 for i in range(koubai)]


#     for j in range(N):


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

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a=int(input())
print(sum(list(map(int,input())))-a)

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n, k = map(int, input().split())
a = (list)(map(int, input().split()))

# print(-(-(n-1)//(k-1)))
print((n+1 + (k - 2)) // (k-1))


from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


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


def calcMod(a, m):
  return sum([m % v for v in a])


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


def lcm_list(l):
  g = reduce(lcm, l)
  return g


print("ans", calcMod(a, (int)(lcm_list(a)-1)))


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


def calcMod(a, m):
  return sum([v % m for v in a])


print(max([calcMod(a, m) for m in range(1, max(a))]))


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


def calcMod(a, m):
  return sum([m % v for v in a])


print(max([calcMod(a, m) for m in range(1, max(a))]))


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

# print(-(-(n-1)//(k-1)))
print((n + (k - 1)) / k)


from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))
from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


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


def calcMod(a, m):
  return sum([m % v for v in a])


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


def lcm_list(l):
  g = reduce(lcm, l)
  return g


print(calcMod(a, (int)(lcm_list(a)-1)))


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

# print(-(-(n-1)//(k-1)))
print((n + (k - 1)) / k


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

# print(-(-(n-1)//(k-1)))
print((n + (k - 1)) // k)


from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b


#print(calcMod(a, reduce(mul, a)-1))
print(sum(a)-N)


from functools import reduce
n = (int)(input())
a = (list)(map(int, input().split()))


def calcMod(a, m):
  return sum([m % v for v in a])


def mul(a, b):
  return a*b


#print(calcMod(a, reduce(mul, a)-1))
print(sum(a)-n)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import fractions

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

lcm = a[0]
for i in a:
    lcm = lcm * i / fractions.gcd(lcm, i)

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

import fractions

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

lcm = a[0]
for i in a:
    lcm = lcm * i / fractions.gcd(lcm, i)

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


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

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

Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
import math
from functools import reduce

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

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

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


import math
from functools import reduce

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

def lcm_list(a):
    return reduce(lcm_base, a)

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

import math
from functools import reduce

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

def lcm_list(a):
    return reduce(lcm_base, a)
if __name__ == '__main__':
	N = int(input())
	a = list(map(int, input().split()))
	ans = 0
	num = lcm_list(a) - 1
	print(num)
	for i in range(len(a)):
		ans += num % a[i]
	print(ans)

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

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
a = input().split(" ")
a = [int(i) for i in a]
list = []
print(a)
for i in range(1000000):
    temp = 0
    for j in range(N):
        temp += i % a[j]
    #print(temp)
    list.append(temp)
#print(max(list))
#print(list)

N = int(input())
a = input().split(" ")
a = [int(i) for i in a]
list = []
x = 1
for i in range(N):
  x *= a[i]
#print(x)
i = x-1
#print(a)
while True:
    temp = 0
    for j in range(N):
        temp += i % a[j]
    #print(temp)
    list.append(temp)
    #print(list)
    if i >= 3:
        if list[i-(x-1)] == 0:
            print(list[i-1-(x-1)])
            break
    i += 1


#print(max(list))
#print(list)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = list(input())
t = list(input())
ans = 0
for i in range(len(s)):
    if s == t:
        ans = 1
        break
    a = s[0]

    for j in range(len(s)-1):
        s[j] = s[j+1]

    s[-1] = a

if ans == 0:
    print('No')
else:
    print('Yes')

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
i = input;i();print(sum([x-1 for x in i().split()]))

n,a=open(0);print(sum(map(int,a.split()))-int(n))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
r=sorted(map(int,input().split()))[::-1]
print(r)



int(input())
print(-1*int(input())+sum(list(map(int,input().split()))))


print(-int(input())+sum(list(map(int,input().split()))))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input().split())
AN = map(int, input().split())

print(sum(AN)-N)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())

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

b = a

ans = 0

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(l):
    for i in range(len(l)):
        if i == len(l) - 1:
            break
        l[i+1] = lcm(l[i], l[i+1])
    return l[len(l) - 1]

for i in range(len(a)):
    ans += (lcm_list(a) - 1) % b[i]
    
print(ans)

N = int(input())

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

ans = 0

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(l):
    for i in range(len(l)):
        if i == len(l) - 1:
            break
        l[i+1] = lcm(l[i], l[i+1])
    return l[len(l) - 1]

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
lcm = a[0]
for i in a:
    lcm = int(lcm * i / fractions.gcd(lcm, i))
x = lcm - 1
x = np.ones(n) * x
print(int(np.sum(x % a)))

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
L = [int(i) for i in input().split()]
print(sum(L - N) )

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def main():
        run()

def run():
        n = int(input())
        data = [int(x) for x in input().split(" ")]

        max_sum = -1
        max_m = max(data)
        for m in range(max_m):
                max_sum = max(max_sum, calc(m, data))
        print(max_sum)


def calc(m, numbers):
        sum_ = 0
        for num in numbers:
                sum_ += m % num  
        return sum_

if __name__ == "__main__":
        main()

def main():
        run()

def run():
        n = int(input())
        data = [int(x) for x in input().split(" ")]

        max_sum = 0 
        max_m = max(data)

        for num in data:
                max_sum += num - 1
        print(max_sum)



if __name__ == "__main__":
        main()



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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
print(m)

B = 0

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

print(B)

import math
from fractions import Fraction
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_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)

import math
from fractions import Fraction
from functools import reduce

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


def lcm_base(x, y):
    return (x * y) // Fraction.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)

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)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a=input()
b=input()
z=len(a)
for i in range(0,z):
  if a==b[i:]+b[:i] : 
    print("Yes")
    exit(0)
print("No")

n=input()
print(sum([int(j) for j in input().split()])-n)

n=int(input())
print(sum([int(j) for j in input().split()])-n)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
from functools import reduce

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

print(lcm(*A)-1)

#ABC 103
import math
from functools import reduce

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
N=int(input())
A = [int(j) for j in input().split()]

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

#ABC 103
import functools
import operator

N=int(input())
A = [int(j) for j in input().split()]
result = functools.reduce(operator.mul, A)
ans = 0
for a in A:
    ans+=(result-1)%a
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-

import functools
import fractions 

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

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
answer = sum([max_under_lcm % n for n in numbers])

print(answer)

# -*- coding: utf-8 -*-

import functools
import fractions

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

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

max_under_lcm = functools.reduce(lambda x, y: int((x * y) / fractions.gcd(x,y)), numbers) - 1
sum = 0
for n in numbers:
    sum += max_under_lcm % n
answer = sum

print(answer)
~             

import functools
import fractions

N = int(input())
numbers = list(map(int, input().split()))
answer = sum([n - 1 for n in numbers])

print(answer)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
print(sum(a) - len(a))

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

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from functools import reduce
n = int(input())
a = list(map(int, input().split()))

def gcd(x, y):
    try:
    if y == 0:
        return x
    return gcd(y, x % y)
    

def gcd2(number):
    return reduce(gcd, number)

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

m = lcm2(a) - 1
#print(m)
ans = 0
for i in range(n):
    ans += m % a[i]
print(ans)

from functools import reduce
n = int(input())
a = list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)
    

def gcd2(number):
    return reduce(gcd, number)

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

m = lcm2(a) - 1
#print(m)
ans = 0
for i in range(n):
    ans += m % a[i]
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import functools

def gcd(a,b):
    while b > 0:
        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()))
assert(len(a) == N)

lcmVal = int(functools.reduce(lcm, a))
print(lcmVal)
print(sum(map(lambda x: (lcmVal-1) % x, a)))


import functools

def gcd(a,b):
    while b > 0:
        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()))

lcmVal = int(functools.reduce(lcm, a, 0))
print(sum(map(lambda x: (lcmVal-1) % x, a)))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = input()
lst = list(map(int, input().split()))
print(len(lst)+sum(lst))


n = input()
lst = list(map(int, input().split()))
print(sum(lst) - len(lst))


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
l=list(map(int,input().split()))
nm=max(l)
l1=[]
for i in range(1,nm+1):
  s=0
  for j in l:
    s+=i%j
  l1.append(s)
print(max(l1))
  
  

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import fractions
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
def gcd(*numbers):
  return reduce(fractions.gcd,numbers)
g=gcd(*a)
m=1
for i in range(n):
  m*=a[i]
l=m//g
print(l+1)
  


import numpy as np
n=int(input())
a=list(map(int,input().split()))
A=np.array(a)
g=np.gcd.reduce(A)
m=1
for i in range(n):
  m*=a[i]
l=m//g
print(l+1)
  


import fractions
n=int(input())
a=list(map(int,input().split()))
g=fractions.gcd(*a)
m=1
for i in range(n):
  m*=a[i]
l=m//g
print(l+1)
  


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

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

print(m-1)
  


import numpy
n=int(input())
a=list(map(int,input().split()))
A=np.array(a)
g=np.gcd.reduce(A)
m=1
for i in range(n):
  m*=a[i]
l=m//g
print(l+1)
  


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

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

print(m)
  


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = np.abs(np.prod(a))
sum = 0
max = np.sum(a)-len(a)
n = a[0]-1
while True:
    st = np.sum(n%a)
    if sum < st:
        sum = st
    if sum == max:
        break
    ind = np.where(a - n%a == 1)[0]
    print (ind)
    c = a[ind]
    n += np.prod(c)
    if n > MAX:
        break
    #print (sum)
print (sum)


import numpy as np
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
MAX = np.abs(np.prod(a))
print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if sum < st:
        sum = st
    if sum == max:
        break
    ind = np.where(a - n%a == 1)[0]
    #print (ind)
    c = a[ind]
    n += np.prod(c)
    if n > MAX:
        break
    #print (sum)
print (sum)


import numpy as np
N = int(input())
a = list(map(int,input().split()))
a = np.array(a)
a = np.sort(a)[::-1]
print (a)
MAX = np.abs(np.prod(a))
print (MAX)
Flag = True
q = 0
add = a[0]
sum = 0
max = np.sum(a)-len(a)
n = a[0]*q+a[0]-1
while True:
    st = np.sum(n%a)
    if st == max:
        sum = st
        break
    if st > MAX:
        break
    ind = np.where(a - n%a == 1)[0]
    print (ind)
    c = a[ind]
    n += np.prod(c)
    #print (sum)
print (sum)

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys

stdin = sys.stdin

mod = 1000000007

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)

def lcm(m, n):
	return m * n // gcd(m, n)

n = ni()
a = na()

l = a[0]
for i in range(n):
	l = lcm(l, a[i])

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

print(ans

import sys

stdin = sys.stdin

mod = 1000000007

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

def gcd(m, n):
	if n == 0:
		return m
	return gcd(n, m % n)

def lcm(m, n):
	return m * n // gcd(m, n)

n = ni()
a = na()

l = a[0]
for i in range(n):
	l = lcm(l, a[i])

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

print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
a = list(map(int, input().split()))

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
number_int = input()
list_int = list(map(int,input().split()))

print(sum(list_int)-number_int)


number_int = input()
list_int = list(map(int,input().split()))

print(str(sum(list_int) - int(number_int)))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
print((lambda a,b:sum(b)-a)(input(),list(map(int,input().split()))))

print(-int(input())+sum(list(map(int,input().split()))))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math

line = input()
words = line.split()
num_list = []
for word in words:
    num_list.append(int(word))
ans = 0
temp = 0

for i, num in enumerate(num_list):
    if i+1 < len(num_list) -1:
        break
    temp = math.gcd(num, num_list[i + 1])


for num in num_list:
    ans += (temp-1) % num

print(ans)

line = input()
words = line.split()
num_list = []
for word in words:
    num_list.append(int(word))
ans = 0
for num in num_list:
    ans += num-1

print(ans)

line = input()
words = line.split()
num_list = []
for word in words:
    num_list.append(int(word))
ans = 0
for num in num_list:
    ans += num-1

print(ans)

line = input()
line= input()
words = line.split()
num_list = []
for word in words:
    num_list.append(int(word))
ans = 0
for num in num_list:
    ans = ans + (num-1)

print(ans)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = [int(input()) - 1 for _ in range(n)]
print(sum(a))

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

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


Verdicts: Runtime Error

Wrong Answer

Accepted