Problem:


Score : 400 points

Problem Statement

For an integer N, we will choose a permutation \{P_1, P_2, ..., P_N\} of \{1, 2, ..., N\}.

Then, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.

Find the maximum possible value of M_1 + M_2 + \cdots + M_N.

Constraints

N is an integer satisfying 1 \leq N \leq 10^9.

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum possible value of M_1 + M_2 + \cdots + M_N.

Sample Input 1

2

Sample Output 1

1

When the permutation \{P_1, P_2\} = \{2, 1\} is chosen, M_1 + M_2 = 1 + 0 = 1.

Sample Input 2

13

Sample Output 2

78

Sample Input 3

1

Sample Output 3

0



Sample input:
2


Sample output:
1

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans=0
for i in range(n):
    if i==n-1:
        break
    else:
        ans+=i+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input().split()[0])

n_list = [i for i in range(1, N+1)]
p_list = n_list[1:] + [1]

ans_1 = sum(n_list[:-1])
if (N - 1) % 2 == 0:
    ans = int(N * ((N - 1) / 2))
else:
    mean_v = math.floor((N - 1) / 2) + 1
    ans = int(N * math.floor((N - 1) / 2))
    ans += mean_v

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
n1=[x+1 for x in range(N)]
n2=n1[1:]+[n1[0]]
s=0
for x,y in zip(n1,n2):
    s+=x%y
print(s)

Submission status: Time Limit Exceeded

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
sum = 0
for i in range(1, N+1):
    sum += i
print(sum-N)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
print(sum(range(1,N)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
total = 0
for i in range(1, N):
  total += i
  
print(total)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
sum = 0
n1 = n
for i in range(n-1,0,-1):
  sum+=i%n1
  n1-=1
print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(1,n):
    ans +=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
mod=0
N=int(input())
for i in range(1,N):
	mod=mod+i
print(mod)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
l=[]

for i in range(N):
    l.append(i)
    
print(sum(l))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = 0
for i in range(n-1):
    m += (i+1)
print(m)

Submission status: Time Limit Exceeded

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = [i for i in range(1,N+1)]
B = [0 for i in range(N-1)]
for i in range(N-1):
    B[i] = A[i+1]
B.append(A[0])
sum = 0
for i in range(N):
    sum += (i+1)%B[i]
print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(0, N):
    # print(i)
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
nums = [i for i in range(1,N+1)]
new = nums[1:] + nums[:1]
ans = 0
for x,y in zip(nums,new):
    ans += x % y
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sum = 0
for i in range(1,N):
  sum += i

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [i + 1 for i in range(n)]
p = a[1:] + [a[0]]
print(sum([a[i] % p[i] for i in range(n)]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
data = [i for i in range(1, n)]
print(sum(data))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

Q = [i for i in range(1, N+1)]
P = sum(Q) - Q[-1]
print(P)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
list1=[]
list2=[]
ans=[]
for i in range(n):
    list1.append(i+1)
#print(list1)
for i in range(n-1):
    list2.append(list1[i+1])
list2.append(1)

for i in range(n):
    ans.append(list1[i]%list2[i])
    #print(ans)
print(sum(ans))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for n in range(1, N):
    ans += n
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = [i + 1 for i in range(N)]
print(sum(n) - max(n))

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    n = int(input())
    s = 0
    for i in range(n):
        s += i
    print(s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0
if n==0:
    print(count)
    exit()
else:
    for i in range(n-1):
        count += i+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = [i for i in range(n)]
print(sum(m))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
answer = 0
for i in range(1, N):
  answer +=  i % (i + 1)
  
print(answer)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

intSum = 0
for i in range(N):
    intSum = intSum + i

print(intSum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

if N <= 1:
    print("0")
    exit()

cnt = 0
for i in range(2,N+1):
    cnt += (i-1)

print(cnt)

Submission status: Time Limit Exceeded

Solution code:


n = int(input())

# i = np.array([i+1 for i in range(n)])
#
# ps = [i+1 for i in range(1, n)] + [1]
#
# ps = np.array(ps)
#
# ms = i % ps

print(sum([i+1 for i in range(0, n-1)]))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
x=0
for i in range(N):
    x=x+i
print(x)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = []

for i in range(1, N):
    P.append(i)
    
print(sum(P))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=[i+1 for i in range(n)]
ans=sum(p)-p[n-1]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

output = 0
for i in range(n):
    output += i
print(output)

Submission status: Time Limit Exceeded

Solution code:
def f_d():
    import numpy as np
    n = int(input())
    if n == 1:
        print(0)
    else:
        print(np.cumsum(range(1, n))[-1])

if __name__ == "__main__":
    f_d()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
tmp = 0
max = 0
for i in range(n):
    max = max + i
print(max)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
M=0
for i in range(1,N+1):
    j=(i+1)%(N+1)
    if j==0:
        j=1
    # print(i,j,i%j)
    M+=i%j
print(M)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    n = int(input())
    s = 0
    for i in range(n+1):
        s += i
    s -= n
    print(s)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

arr = [i+1 for i in range(N)]

print(sum(arr)-arr[-1])

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
print(sum(set(range(N))))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
sm = 0
while (n > 1):
    sm += (n-1)%(n)
    n -= 1
print(sm)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [i%(i+1) for i in range(1,N)]
print(sum(P))

Submission status: Time Limit Exceeded

Solution code:
N = input()
N = int(N)

sum = 0
for i in range(N):
    sum = sum +i

print(sum)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n = int(input())

i = np.array([i+1 for i in range(n)])

ps = [i+1 for i in range(1, n)] + [1]

ps = np.array(ps)

ms = i % ps

print(np.sum(ms))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
"""
a = list(range(1,N+1))
b = list(range(2,N+2))
"""
a = []
b = []
for i in range(N-1):
	a.append(i+1)
	b.append(i+2)
a.append(N)
b.append(1)

sum = 0
for i in range(N):
	sum += a[i]%b[i]
print(sum)

Submission status: Time Limit Exceeded

Solution code:
import sys


def input(): return sys.stdin.readline().strip()


def solve():
    pass


def main():
    N = int(input())
    I = [x for x in range(1, N+1)]
    P = [x for x in range(1, N+1)]
    P = P[1:] + [P[0]]

    for i in range(N):
        I[i] %= P[i]

    print(sum(I))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
M = range(1,N+1)

ans = 0
ans = sum(range(1,N))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
print(sum(range(n+1)) - n)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ret = int(N * (N - 1) / 2)

zantei = 0

for i in range(1, N + 1):
	if N % i > i - 1:
		zantei = max(zantei, N % i - (i - 1))
		
print(zantei + ret)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n == 1:
    print(0)
else:
    a = sum([i for i in range(n)])
    print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0

for i in range(1,N):
    ans += i % (i+1)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = [i + 1 for i in range(N)]
p = [i + 1 for i in range(N)]
p.append(1)
del(p[0])
ans = 0
for i in range(N):
    ans = ans + (n[i] % p[i])
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

for i in range(1,n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

res = 0
for i in range(N):
    res += i

print(res)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
x=0
for i in range(1,N):
    x+=i

print(x)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
    ans += i
print(ans-N)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())

cnt = 0
for i in range(n):
    cnt = cnt + (i+1)
cnt = cnt - n
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
ans = range(1, N)
print(sum(ans))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8

N = int(input())

l = [i for i in range(1, N + 1)]
print(sum(l[:N - 1]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
N_array = [x for x in range(1, N + 1, 1)]
N_array.pop(N - 1)
print(sum(N_array))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
M = range(1,N+1)

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

Submission status: Time Limit Exceeded

Solution code:
n = input()
n = int(n)

ret = 0

for i in range(n-1):
    ret += (i+1)

print(ret)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lst = [i for i in range(2, N + 1)] + [1]

val = 0
for i in range(N):
    val += (i + 1) % lst[i]

print(val)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
m = 0


for i in range(n):
    t = i + 1
    if t == n:
        m += 0
    else:
        m += t % (t + 1)


print(m)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = [i for i in range(1, n)]
print(int(sum(arr)))

Submission status: Time Limit Exceeded

Solution code:
def f_d():
    n = int(input())
    c = 0
    for i in range(1, n):
        c += i
    print(c)

if __name__ == "__main__":
    f_d()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
c = 0
for i in range(N):
    c += i
print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
r = 0
for i in range(n):
    r += i
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

print(sum([i for i in range(n)]))

Submission status: Time Limit Exceeded

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

n = int(input())
s = n - 1

ans = 0
for i in range(s+1):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

answer = sum(range(1, n))
print(answer)

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(sys.stdin.readline())
total = 0
for i in range(1, n):
    total +=i
print(total)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    not_n = (int(i) for i in range(1,n))
    print(sum(not_n))
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
if N == 1:
    print(0)
    exit()

M = 1
for i in range(2, N):
    m = i % (i+1)
    M += m
print(M)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
ans = 0
for i in range(1,N):
	ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = []

ans = 0
for i in range(n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#import sys
N = int(input())
ans = sum(range(1,N))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
s=N
ans=0
m=N
for i in range(N-1,0,-1):
    if i%s<m%s:
        ans+=m%s
        m=s-1
        s-=1
    else:
        ans+=i%s
        s-=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [int(i) for i in range(1,N+1)]
ans = 0
for i in range(1,N):
    ans += i%P[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
ans = 0
for i in range(a-1):
    ans += i+1
    # print(i)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n = int(input())
ans = 0
for i in range(1,n):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

print(sum(range(n)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[i+1 for i in range(n)]
b=[i+1 for i in range(n)]
c=b[-1]
b.insert(0,c)
del b[-1]
ans=0
for i in range(n):
  ans+=b[i]%a[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
b = int(input())
a = [i for i in range(b)]
if b % 2 == 1:
    print((b-1) * ((b-1) // 2) + ((b-1) // 2))
else:
    print((b - 1) * ((b-1) // 2 + 1))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
if N ==1:
    pass
else:
    for i in range(1, N):
        ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
I = [i for i in range(1,N)]
print(sum(I))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

p = []

for i in range(n-1):
  ans += (i+1) % (i+2)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
result = 0

for i in range(1, n):
    result += i
print(result)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
n = np.array([i + 1 for i in range(N)])
ans = 0

print(N * (N - 1) // 2)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
not_n = (int(i) for i in range(1,n))
print(sum(not_n))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

ans=0
for i in range(1,N):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:

N=int(input())

s=0
for i in range(1,N):
    s+=i

print(s)

Submission status: Time Limit Exceeded

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

# a, b = MAP()
# n = INT()
# a, b, c = MAP()
count = 0
N = INT()
for i in range(1,N):
    # print(i)
    count += i
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

sum = 0

for i in range(n):
    sum += i
    
print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = []
#p.append(n)

for i in range(2, n+1):
    p.append(i)
p.append(1)

#print(p)
ans = 0

for i in range(1, n+1):
    # print("\n #i: " + str(i))
    # print("#p[i-1]: " + str(p[i-1]))
#    print(i % p[i-1])
    ans += i % p[i-1]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
print(sum(range(n)))

Submission status: Time Limit Exceeded

Solution code:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
print(sum(range(1,n)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(1,n):
  ans += i%(i+1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:

a = int(input())
alist = [i+1 for i in range(a)]
# blist = []
current = 2
blist = [i+2 for i in range(a-1)]
blist.append(1)
#
ans = 0
for i in range(a):
    ans += alist[i] % blist[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

sum = 0
for i in range(N):
    sum += i

print(sum)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    n = [x for x in range(1,N)]
    print(sum(n))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans=0
for i in range(N):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

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


def solve(N: int):
    print(sum([i for i in range(1,N)]))

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
S = int(input())
total=0
for i in range(1,S):
    total+=i

print(total)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
I = [i for i in range(1,N+1)]
P = [i for i in range(1,N+1)]
P.remove(1)
P.append(1)

ans = 0

for i in range(len(I)):
    ans += I[i] % P[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

ans=0
for i in range(1,N):
    ans+=i%(i+1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2019/09/01
# AtCoder Beginner Contest 139 - D

# Input
n = int(input())

# Make List
p = n
asum = n % 1
lim = n + 1

for i in range(2, lim):
    p = i - 1
    asum = asum + p % i

# Output
print(asum)

Submission status: Time Limit Exceeded

Solution code:
# 2019/09/01

n=int(input())
cnt=0
for i in range(1,n):
    cnt+=i
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

p = []

for i in range(n-1):
  p.append(i+2)
p.append(1)

for i in range(n):
  ans += (i+1) % p[i]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

a = int(input())

print(np.array(range(a)).sum())

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

a = [i for i in range(1, N+1)]
p = a.copy()
p = p[1:] + [p[0]]

print(sum([ai%pi for ai, pi in zip(a, p)]))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=0
for i in range(n):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
print(sum([i for i in range(N)]))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
score=0
if N!=1:
    for i in range(N):
        score+=i
else:
    score=0
print(score)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    count = 0
    for x in range(1, N):
        count += x
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
mod_list = [i for i in range(1, N)]
output = (N - 1) / 2 * (1 + N - 1)

print(int(output))

Submission status: Time Limit Exceeded

Solution code:
import itertools

N = int(input())
O = range(1, N+1)
MODS = range(1, N+1)
ans = 0

for i in range(N):
    M = O[i] % MODS[(i+1) % N]
    ans += M

print(ans)

Submission status: Time Limit Exceeded

Solution code:

a = int(input())
alist = []
for i in range(a):
    alist.append(i+1)
# blist = [13,12,11,10,9,8,7,6,5,4,3,2,1]
# blist = [2,3,4,5,6,7,8,9,10,11,12,13,1]
blist = []
current = 2
for i in range(a-1):
    blist.append(current)
    current += 1
blist.append(1)

ans = 0
for i in range(a):
    # print(alist[i]%blist[i])
    ans += alist[i] % blist[i]
# print(ans,alist,blist)
# print(12%13)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2019/09/01
# AtCoder Beginner Contest 139 - D

# Input
n = int(input())
plist = list()
mlist = list()

# Make List
p = n
asum = n % 1
plist.append(p)
plist.append(asum)

for i in range(2, n + 1):
    p = i - 1
    plist.append(p)
    mlist.append(p % i)
    asum = asum + p % i

# Output
print(asum)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

print(sum(range(1,N)))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=[i for i in range(N)]
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
num = int(input())

arr = [i for i in range(1,num+1)]

print(sum(arr[:-1]))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0
for i in range(N):
    count += i
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    M = [x for x in range(1, N)]
    return sum(M)


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = sum([x for x in range(N)])
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def solve(N):
    answer = 0
    for i in range(N):
        answer += i
    return answer


if __name__ == '__main__':
    N = int(input())

    answer = solve(N)
    print(answer)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
mod_list = [i for i in range(1, N)]

print(sum(mod_list))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = sum(range(1, n))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys

stdin = sys.stdin

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

n = ni()
print(sum([i for i in range(1, n)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
print( sum(range(1,N)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
r=0
for i in range(n):
  r+=i+1
print(r-n)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

s = 0
for i in range(N):
    s += i

print(s)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    n_list = [i+1 for i in range(n-1)]
    ans = sum(n_list)
    print(ans)

main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
print(sum(x for x in range(n)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

s=0
for i in range(n):
    s += i
    
print(s)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
if (N == 1):
  print(0)
else:
  print(sum(range(1,N)))

Submission status: Time Limit Exceeded

Solution code:
a = [i for i in range(int(input()))]
print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

for i in range(1, N + 1):
    if i == N:
        continue
    else:
        ans += i % (i+1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

# input = sys.stdin.readline


def main():
    n = int(input())

    ans = 0

    for i in range(1, n):
        ans += i

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=0
for i in range(N):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
#-------------------------------------
n = int(input())
v = n
ammount = 0
for i in range(v):
    ammount += v
    v -= 1

print(ammount-n)

Submission status: Time Limit Exceeded

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

N = int(input())

ans = 0
for i in range(1, N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

for i in range(1, n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N= int(input())
ans=0
for i in range(N-1):
    ans+=i+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n1 = int(input())

r1 = 0
for i1 in range(n1):
    r1 += i1

print(r1)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(1,N):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#https://atcoder.jp/contests/abc139/tasks/abc139_d

n = int(input())

a = 0
for i in range(1,n):
    a+=i

print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

c = 0
for i in range(N):
    c += i
print(c)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
N=int(input())
ans=0
for i in range(N):
    ans=ans+i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = 0
for i in range(n-1):
  s += i + 1
print(s)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=0

if n==1:
    print(0)
    exit()
    
for i in range(n):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for a,b in zip(range(1,n),range(2,n+1)):
    ans += a % b
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n == 1:
    print(0)
else:
    a=[i for i in range(1,n+1)]
    b=[i for i in range(2,n+1)]+[1]
    print(sum([a[i] % b[i] for i in range(n)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

for i in range(N-1):
    ans += i+1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
m = 0
for i in range(1, N):
    m = m + i
print(m)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())


print(sum(range(N)))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n = int(input())

k = np.array(range(n))
print(sum(k))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

M = 0

for i in range(1, N+1):
    M += i

M = M - N

print(M)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0
for i in range(n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

print(sum(range(1, N)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

result = 0
for i in range(N):
    result += i
print(result)

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
#-------------------------------------
v = int(input())
n = [i+1 for i in range(v)]
p = n[::-1]

ammount = 0
for i in range(v):
    ammount += n[i]

print(ammount-v)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
numl = [i for i in range(2,a+1)] + [1]
ans = 0
for i in range(a):
    ans += (i+1) % numl[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
if N !=1:
    result = sum(range(1,N))
else:
    result = 0
print(result)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(0, n):
  ans += i 
print(ans)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input()) # 数字を変数に格納

result = 0

for i in range(N-1):
    result += (i+1)

print(result)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
modl = [i for i in range(1,a+1)]
numl = [i for i in range(2,a+1)] + [1]
ans = 0
for i in range(a):
    ans += modl[i] % numl[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = [int(_) for _ in range(1, N)]
print(sum(n))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

ans=0

for i in range(n):
    ans=ans+i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0

for i in range(1, N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# しらんけど
n = int(input())
print(sum(range(n)))

Submission status: Time Limit Exceeded

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
r = 0
for i in range(1,N+1):
    r += i%N
    
print(r)

Submission status: Time Limit Exceeded

Solution code:
# d
n = int(input())
print(sum(i%(i%n+1) for i in range(1, n+1)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans=0
for i in range(n):
    ans+=i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def solve(S):
    print(sum(S[i] % (i+1) for i in range(N)))

N = int(input())
solve([N]+[i-1 for i in range(2, N+1)])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0
for i in range(1, n):
    ans += i % (i+1)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
sum = 0
for i in range (n):
  sum += i
print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(1, N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for n in range(N):
    ans += n
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for i in range(1,n):
    ans += i
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

# {1, 2, ..., N}
# {P1, P2, ..., Pn}　として {2, 3, ..., N, 1} を選べる

count = 0
for i in range(N):
  count += i
  
print(count)