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:
def main():
    N = int(input())
    ans = sum(range(1, N + 1)) - N
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n = int(input())
a = np.array(range(1,n+1))
b = np.array([a[(i+1)%n] for i in range(n)])
print(sum(a%b))

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
sys.setrecursionlimit(10**9)

n = int(input())
def num(n):
    if n == 1:
        return 1
    return n + num(n-1)
print(num(n-1))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(answer)

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:
a = int(input())
sum=0
for i in range(1,a):
    sum+=i
print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import copy

n = int(input())
l = [i for i in range(1,n+1)]
m = copy.copy(l)

l.append(1)
del l[0]

cnt = 0
for a,b in zip(l,m):
	cnt += b%a
	
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
s=input()
a=int(s)
b=0
if a==1:
  print(0)
else:
  for i in range(a):
    b+=i
  print(b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

#単入力
n=int(input())

l=[i for i in range(1,n+1)]
ll=l
ans=0
for i in range(len(l)):
    if i==n-1:
        break
    ans+=ll[i]%l[i+1]
    #if i==0:
        #del ans[0]

print(ans)

Submission status: Time Limit Exceeded

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

#単入力
n=int(input())

l=[i for i in range(1,n+1)]
ll=l
ans=[]
for i in range(len(l)):
    if i==n-1:
        break
    ans.append(ll[i]%l[i+1])
    #if i==0:
        #del ans[0]

print(sum(ans))

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    p = [i for i in range(1, n+1)]

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    p = [i for i in range(1, n+1)]

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from itertools import accumulate


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())
count=0
for i in range(1,n):
    count+=i
print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

p = [i + 2 for i in range(n-1)]
p = p + [1]

m = 0

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

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

ans = [i for i in range(N)]
print(sum(ans))

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:
a=int(input())
b=0
for i in range(a):
    b+=i
print(b)

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 = [i for i in range(1, N)]
print(sum(P))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = N
sum = 0
for i in range(N):
    if i == 0:
        sum = 0
    else:
        sum = sum + ((i)%(i+1))

print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if N>2:
    ans=0

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

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())
p_lst = [e for e in range(1,n+1)]
first, last = 1, n-1
res = (n-1)*(first+last)/2
print(int(res))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p_lst = [e for e in range(1,n+1)]
lst = [p_lst[-1]] + p_lst[0:-1]
res = 0
for i, e in enumerate(lst):
  r = e%(i+1)
  res += r
print(res)

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
num = []
for i in range(1,a+1):
  num.append(i)
ans = sum(num) - max(num)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

N = int(input())
tempM = 0
M = []

for i in range(N):
    for p in range(i+1):
        temp = p % (i+1)
        if temp > tempM:
            tempM = temp
    M.append(tempM)

print(sum(M))

Submission status: Time Limit Exceeded

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

N = int(input())
tempM = 0
M = []

for i in range(N):
    for p in range(N):
        temp = p % (i+1)
        if temp > tempM:
            tempM = temp
    M.append(tempM)

print(sum(M))

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:
s = 0
for i in range(int(input())):
    s += i
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

def calc(n):
    r = 0
    for i in range(1, n):
        r += i
    return r


n = int(input())
r = calc(n)
print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

answer = sum([i for i in range(n)])

print(answer)

Submission status: Time Limit Exceeded

Solution code:
#Nを受け取って１～Nまでのリストにする
i_list = [n for n in range(1,int(input())+1)]
#逆順のリスト生成
i_list_rev = list(reversed(i_list))
#print(i_list_rev)
#最大値格納用
M = 0
#i_listの最後から2番目の要素から順にi%i+1していく
for i,i_r in enumerate(i_list_rev[1:]):
    M += i_r%i_list_rev[i]

print(M)

#print(i_list)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(c)

Submission status: Time Limit Exceeded

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

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())
l = []
for i in range(N):
    l.append(i+1)
print(sum(l)-N)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
nums = [x for x in range(1, N+1)]
nums2 = nums[1:]
nums2.append(nums[0])

div_list = [num % num2 for num, num2 in zip(nums, nums2)]
print(sum(div_list))

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

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

print(sum(int(i) for i in range(N)))

Submission status: Time Limit Exceeded

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

# import itertools

num = int(input())

# 実は[5,1,2,3,4]のようにずらしたのが一番でかくなるのでは？
# ということは1～4までの和がそのまま返り値になる
rtn = 0
for v in range(num)[1:]:
  rtn += v

print(rtn)


# 実は[5,1,2,3,4]のようにずらしたのが一番でかくなるのでは？
# これはすなおにそのリストを作っている
# tgt_list = list(range(num+1))[1:-1]
# tgt_list.insert(0, num) # [1,2,3,4] -> [4,1,2,3]
# print(tgt_list)
# ここからModを計算...
# 

# 下記は全通りを調べるが、処理が長すぎてエラーになるのでボツ。
# for v_list in itertools.permutations(range(num+1)[1:]):
#   tmp = 0
#   for i, v in enumerate(v_list):
#     tmp += v % (i+1)
#   rtn = max(rtn, tmp)
#   if (rtn == tmp):
#     print(v_list)
#     print(tmp)   
# print(rtn)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
'''
ls = []
ls_re = []
for i in range(1,n+1):
    ls.append(i)
for i in reversed(ls):
    ls_re.append(i)

ans = 0
for i in range(n):
    ans += (ls[i]%ls_re[i])
    #print(ls[i]%ls_re[i],end=" ")
'''
c = 0
for i in range(1,n):
    c += i
    
print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ls = []
ls_re = []
for i in range(1,n+1):
    ls.append(i)
for i in reversed(ls):
    ls_re.append(i)

ans = 0
for i in range(n):
    ans += (ls[i]%ls_re[i])
    #print(ls[i]%ls_re[i],end=" ")

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

Submission status: Time Limit Exceeded

Solution code:

import math
N = int(input())

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

print(sum)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
result = 0
for x in range(num):
  result = result + x
print(result)

Submission status: Time Limit Exceeded

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

for i in range(N):
    max += i

print(max)

Submission status: Time Limit Exceeded

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

for n in range(1,N):
    if n == N:
        m += 0
    else:
        m += n % (n+1)
print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
m = (N - 1)
n = 0
while m > 0:
    n = n + (m % N)
    N = m
    m = m - 1
print(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:
n=int(input())
ans=0
for i in range(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())
if n == 1:
  print(0)
  exit()
li = [i for i in range(n)]
ans = sum(li)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
print(sum(i for i in range(N)))

Submission status: Time Limit Exceeded

Solution code:
from sys import exit, stdin
N = int(stdin.readline().rstrip())
P = [i for i in range(N)]
P = P[:N//2] + P[N//2:]
print(sum(p%(i+1) for i, p in enumerate(P)))

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())
n_list = [i for i in range(1,n)]
print(sum(n_list))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

#1～nまでの数列
p = [i+1 for i in range(n)]
print(sum(p[:n-1]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
li = np.array([range(1, N)])
print("{:.0f}".format(np.sum(li)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
print(sum(i for i in range(int(input()))))

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

nrange = range(1, n)

res = sum(nrange)

print(res)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

res = 0

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

print(res)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

total_m = 0

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

Submission status: Time Limit Exceeded

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return

def gau(n):
    return n*(n+1)/2

def main():
    N = int(input())
    mods = [ i+1for i in range(N)]
    test = [mods[-1]]+mods[:-1]
    print(int(gau(N-1)))

if __name__ == "__main__":
    main()

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:
N = int(input())

NL = []
PL = []
ans = 0

for i in range(N):
  NL.append(i+1)
  PL.append(i+2)
PL[N-1] = 1
  

for i in range(N):
  ans += NL[i] % PL[i]

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

sum = 0

for i in range(N):
    if i == N-1:
        sum += 0
    else:
        sum += (i+1)%(i+2)

print(sum)


# りゅうせいの解答1　実行時間超過
#  N = int(input())
#
# P_list = []
# M_list = []
#
#
# for i in range(N):
#     if i == N-1:
#         P_list.append(1)
#
#     else:
#         P_list.append(i+2)
#
#
# for i in range(N):
#     M_list.append((i+1) % P_list[i])
#
# print(sum(M_list))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

P_list = []
M_list = []


for i in range(N):
    if i == N-1:
        P_list.append(1)

    else:
        P_list.append(i+2)


for i in range(N):
    M_list.append((i+1) % P_list[i])

print(sum(M_list))

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

ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = [i for i in range(1,n)]
print(n*(n-1)//2)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

l = [i for i in range(n)]

print(sum(l))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
#import logging
#logging.basicConfig(level=logging.DEBUG)
#logging.disable(logging.CRITICAL)


def main():
    N = int(input())
    # N % 1 == 0
    ans = 0
    for i in range(1, N):
#        logging.debug('%d %d' %(i, i+1))
#        logging.debug('adding to ans: %d' % (i % i+1))
        ans += (i % (i+1))

    return ans

if __name__ == '__main__':
    print(main())

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.DEBUG)
logging.disable(logging.CRITICAL)


def main():
    N = int(input())
    # N % 1 == 0
    ans = 0
    for i in range(1, N):
        logging.debug('%d %d' %(i, i+1))
        logging.debug('adding to ans: %d' % (i % i+1))
        ans += (i % (i+1))

    return ans

if __name__ == '__main__':
    print(main())

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:
a = int(input())
num  = 0
for i in range(1,a):
    num += i
print(num)

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(raw_input())
total = 0
for i in xrange(1, n+1):
  total += i % (i+1) if i < n else 0
print total

Submission status: Time Limit Exceeded

Solution code:
import sys

ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: [int(x) for x in ns().split()]
nall = lambda: [int(x) for x in sys.stdin.readlines()]


def main():
    n = ni()

    print(sum(range(n)))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

for i in range(m):
    c = c + i

print(c)

Submission status: Time Limit Exceeded

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

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())
sum = 0
for i in range(n):
    sum = sum + i;
print(sum)

Submission status: Time Limit Exceeded

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

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())
c=0
for i in range(1,n):
    c+=(i%n)
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
M = [x+1 for x in range(N)]
print(sum(set(M))-N)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[]
for i in range(1,n):
  a.append(i%n)
print(sum(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

print(sum(range(0,N)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
cnt = 0;

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

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

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())
print(sum([i for i in range(1,N)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
P = []
P.append(N)
for i in range(N-1):
    P.append(i+1)

for i in range(N):
    ans = ans + (P[i] % (i+1))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import copy
n = int(input())
n_list = []
ans = 0
for i in range(1,n):
    ans += i
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:
##
n1 = int(input())
if n1 == 1:
    print(0)
else:
    if n1 % 2 == 0:
        r1 = n1/2
        r2 = n1-1
    else:
        r1 = (n1-1)/2
        r2 = n1
    a1 = 0
    for _ in range(round(r1)):
        a1 += r2
    print(a1)

Submission status: Time Limit Exceeded

Solution code:
#d
import copy
n = int(input())
n_list = []
ans = 0
for i in range(1,n):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
array = [i for i in range(1, N+1)]
num = 0

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

print(num)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p2 = [ i + 1 for i in range(n-1)]
p2.append(0)
print(sum(p2))

Submission status: Time Limit Exceeded

Solution code:
#d
import copy
n = int(input())
n_list = []
ans = 0
for i in range(1,n+1):
    n_list.append(i)
m_list = copy.copy(n_list)
tmp = m_list.pop(n-1)

print(sum(m_list))

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
N = int(input())
arr = [i for i in range(1,N+1)]
if N == 1:
  print(0)
  exit()
if N == 2:
  print(1)
  exit()
maxv = 0
for Per in permutations(arr):
  v = 0
  for i, per in enumerate(Per):
    v += i % per
  maxv = max(v,maxv)
print(maxv)

Submission status: Time Limit Exceeded

Solution code:
import itertools

n=int(input())
ls=[]
for i in range(n):
  ls.append(i+1)
k=ls
k.pop(0)
k.append(1)

max=0
for l in ls:
  max+=l%k[l-1]
print(max)

Submission status: Time Limit Exceeded

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

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

print(sum(h[:n]))

Submission status: Time Limit Exceeded

Solution code:
import itertools

n=int(input())
ls=[]
k=[]
for i in range(n):
  ls.append(i+1)
  k.append(i+1)
k.pop(0)
k.append(1)

max=0
for l in ls:
  max+=l%k[l-1]
print(max)

Submission status: Time Limit Exceeded

Solution code:
import copy
n = int(input())
n_list = []
ans = 0
for i in range(1,n+1):
    n_list.append(i)
m_list = copy.copy(n_list)
tmp = m_list.pop(0)
m_list.insert(n-1,tmp)
for i in range(len(n_list)):
    ans += n_list[i] % m_list[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:
a = int(input())
 
ans = 0

  
print(sum(range(1,a)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
Mmax = 0
for i in range(N):
    Mmax += i
#a[0] = a[-1]

print(Mmax)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

N_np   = 0

N_list = np.arange(1, int(N/5))
N_np   = N_np + np.sum(N_list)

N_list = np.arange(int(N/5), int(2*N/5))
N_np   = N_np + np.sum(N_list)

N_list = np.arange(int(2*N/5), int(3*N/5))
N_np   = N_np + np.sum(N_list)

N_list = np.arange(int(3*N/5), int(4*N/5))
N_np   = N_np + np.sum(N_list)

N_list = np.arange(int(4*N/5), N)
N_np   = N_np + np.sum(N_list)


print(N_np)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
print(int(np.array(range(N)).sum()))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
if n == 1:
    print(0)
else:
    point = 0
    for i in range(1,n):
        point += i
    print(point)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
candi =int((N+1)/2*N -N)
if N%2 == 0:
    an = [ i for i in range(1,N+1)]
    an.reverse()
    nex_num = N
    count =0
    for i in an:
        if nex_num == i:
            nex_num = (i//2) + 1
            count += (i%nex_num) #next_numを割るところに使う
            nex_num = nex_num -1
        else:
            count += i #前の大きい数を使用する
else:
    an = [ i for i in range(1,N+1)]
    an.reverse()
    nex_num = N
    count =0
    for i in an:
        if nex_num == i:
            nex_num = (i+1)//2
            count += (i%nex_num) #next_numを割るところに使う
            nex_num = nex_num -1
        else:
            count += i #前の大きい数を使用する
if candi > count:
    print(candi)
else:
    print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
li = [i for i in range(1, int(input())+ 1)]
print(sum(li[:-1]))

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n = int(input())
#l = [ i+1 for i in range(n) ]
p = [i+1 for i in range(n)]
p.append(1)
p.pop(0)
p_array = np.array(p)
#print(sum(l % p_array))
print(sum(p_array - 1))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


print(result)

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:
from sys import stdin
from itertools import accumulate
n = int(stdin.readline().rstrip())
li = [p for p in range(1,n)]
if n == 1:
    print(0)
else:
    lin = list(accumulate(li))
    print(lin[-1])

Submission status: Time Limit Exceeded

Solution code:
import itertools

n=int(input())

p=list(i+1 for i in range(n))
max=0
now=0
p1=list(itertools.permutations(p))

for p2 in p1:
  c=0
  now=0
  for l in p2:
    c+=1
    now += c % l
  if max<now:
    max=now
print(max)

Submission status: Time Limit Exceeded

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

out = [i for i in range(n)]
out = sum(out)

print(out)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
A = int(input())

print(sum(range(1, A + 1)) - A)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
n = int(input())
l = [ i+1 for i in range(n) ]
p = [i+1 for i in range(n)]
p.append(1)
p.pop(0)
p_array = np.array(p)
print(sum(l % p_array))

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
from itertools import accumulate
n = int(stdin.readline().rstrip())
li = [p for p in range(1,n)]
if n == 1:
    print(0)
else:
    lin = list(accumulate(li))
    print(max(lin))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
print(sum(i for i in range(1, 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())
out=0
for i in range(n):
    out=out+i

print(out)

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:
sum = 0
N = int(input())
for n in range(N):
    sum += n
print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

mod = (N-1)*N/2
for i in range(1,N+1):
    if N%i == N:
        break

print(int(mod+N-i))

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [p for p in range(1,n)]
if n == 1:
    print(0)
else:
    print(sum(li))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n == 1:
    print(0)
else:
    import numpy as np
    lst = np.array([(elem + 1) for elem in range(n)])
    print(np.sum(lst[:-1]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

sum = ((n - 1) * n) / 2

max_mod = 0
iw = 0
for i in range(n):
  if i == 0:
    continue
  mod_i = n % i
  if mod_i > max_mod:
    max_mod = mod_i
    iw = i

if max_mod > iw:
  sum = (sum - iw) + max_mod

print(int(sum))

Submission status: Time Limit Exceeded

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

print(out)

Submission status: Time Limit Exceeded

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