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: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print((n - 1 + 1) * (n - 1) / 2)

Submission status: Wrong Answer

Solution code:
n = int(input())

print(int((n - 1 + 1) * (n - 1) / 2))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

sum_mod = (N-1)*N / 2
print(int(sum_mod))

Submission status: Wrong Answer

Solution code:
N = int(input())

sum_mod = ((N-1) * N) / 2
print(int(sum_mod))

Submission status: Wrong Answer

Solution code:
N = int(input())

sum_mod = (N-1) * N / 2
print(int(sum_mod))

Submission status: Wrong Answer

Solution code:
n = int(input())
n = n * (n - 1) / 2
print (n)

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int((n * (n - 1)) / 2))

Submission status: Wrong Answer

Solution code:
a = int(input())
print(int((a-1)*a/2))

Submission status: Wrong Answer

Solution code:
a = int(input())
print(round((a-1)*a/2))

Submission status: Wrong Answer

Solution code:
a = int(input())
print((a+1)*a/2)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 2 == 0:
	print(int((n+1)*(n/2)-n))
else:
	print((n+1)*(n//2)+(n//2+1)-n)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n % 2 == 0:
	print((n+1)*(n/2)-n)
else:
	print((n+1)*(n//2)+(n//2+1)-n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = int(n * (n-1) / 2)

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

ans=n*(n-1)/2

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
a=int(s)
b=0
if a==1:
  print(0)
else:
  b=(a-1)*a
  b=b/2
  b=int(b)
  print(b)

Submission status: Wrong Answer

Solution code:
s=input()
a=int(s)
b=0
if a==1:
  print(0)
else:
  b=((a-1)*a)/2
  b=int(b)
  print(b)

Submission status: Wrong Answer

Solution code:
s=input()
a=int(s)
b=0
if a==1:
  print(0)
else:
  b=((a-1)*a)/2
  print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
    print(0)
else:
    if n%2==1:
        print(n**2//2)
    else:
        print((n**2-n)//2)

Submission status: Wrong Answer

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())

print(int(n*(n-1)/2))

Submission status: Wrong Answer

Solution code:
n=int(input())

print(int(n*(n+1)/2-n))

Submission status: Wrong Answer

Solution code:
n=int(input())

print(n*(n+1)/2-n)

Submission status: Wrong Answer

Solution code:
n = int(input())
print((n-1)*n/2)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 1:
    print(0)
elif N == 2:
    print(1)
else:
    print((N-2)*(2+N-1)//2+N%2)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

n = int(input())
print(Decimal(n * (n-1) / 2).quantize(Decimal("0")))

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int(round(n * (n-1) /2)))

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int(n * (n-1) /2))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

m = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N = int(input())
a = int(N*(N-1)/2)
print (a)

Submission status: Wrong Answer

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

N = int(input())
print (int((N**2-N)/2))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 0:
    print(1)
else:
    print(int(N * (N - 1) / 2))

Submission status: Wrong Answer

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

if N == 0:
    print(1)
else:
    print(int(N * (N + 1) / 2))

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int(n*(n-1)*(1/2)))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
print(int(((n-1)*n/2)))

Submission status: Wrong Answer

Solution code:
a=int(input())
b=(a-1)*a/2
b=int(b)
print(b)

Submission status: Wrong Answer

Solution code:
a=int(input())
b=(a-1)*a/2
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N % 2 == 0:
  print(int((N + 1) * N / 2 - N))
elif N == 1:
  print(0)
else:
  print(int(N * (N - 1) / 2))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())


if N % 2 == 0:

    if N == 2:

        print(1%2)

    else:

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


elif N % 2 == 1:

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

Submission status: Wrong Answer

Solution code:
N = int(input())


if N % 2 == 0:
    if N == 2:
        print(1%2)

    else:
        print( int( (( (N-1) + 1 ) / 2 ) * (N-1) ) - 1 )

elif N % 2 == 1:
    print( int( (( (N-1) + 1 ) / 2 ) * (N-1) )     )

Submission status: Wrong Answer

Solution code:
a=int(input())
print(int(a*(a-1)/2))

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 0:
  print(0)
else:  
  print(int(N*(N-1)/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
nsum = N * (N+1) /2
print(int(nsum-N))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N-1) % 2 == 0:
    print(int(N * (N-1)/2))
else:
    print(int(N * (N-2)/2 + N/2))

Submission status: Wrong Answer

Solution code:
N = int(input())

if (N-1) % 2 == 0:
    print(int(N * (N-1)/2))
else:
    print(int(N * (N-1)/2 + N/2))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N=int(input())
if N <= 20002:
    print(int(N/2*(N-1)))
    exit()
upper = int((N-1)/10000)
lower = (N-1) - int((N-1)/10000)*10000
N = int(N/2)
upper2 = int(N/10000)
lower2 = N - int(N/10000)*10000
if N%2==1:
    upper = int(N/10000)
    lower = N - int(N/10000)*10000
    N = int((N-1)/2)
    upper2 = int(N/10000)
    lower2 = N - int(N/10000)*10000
s1 = lower * lower2
s2 = upper * lower2
s3 = upper2 * lower
s4 = upper * upper2
t1 = s1 - int(s1/10000)*10000
t2 = int(s1/10000) + s2 - int(s2/10000)*10000 + s3 - int(s3/10000)*10000
t3 = int(s2/10000) + int(s3/10000) + s4 - int(s4/10000)*10000
t4 = int(s4/10000)
u1 = t1 + t2*10000
u2 = t3 + t4*10000
ls = [str(u2), str(u1).zfill(8)]
#ls = [str(t4),str(t3).zfill(4),str(t2).zfill(4),str(t1).zfill(4)]
print(''.join(ls))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N % 2 == 0:
    print(int(((N+1)*N/2)-N))
else:
    print(int(((N+1)*((N-1)/2))+(((N-1)/2)+1) - N))

Submission status: Wrong Answer

Solution code:
N = int(input())
if N % 2 == 0:
    print(int(((N+1)*N/2)-N))
else:
    print(int(((N+1)*(N-1)/2)+(((N-1)/2)+1) - N))

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int((n * (n - 1) / 2) % (10 ** 9)))

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int(n * (n - 1) / 2) % 10 ** 9)

Submission status: Wrong Answer

Solution code:
num = int(input())
print(int(num*(num-1)/2))

Submission status: Wrong Answer

Solution code:
n = int(input())
first, last = 1, n-1
res = (n-1)*n/2
print(int(res))

Submission status: Wrong Answer

Solution code:
n = int(input())
first, last = 1, n-1
res = (n-1)*(first+last)/2
print(int(res))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# 1,2,...n-1の総和がmax
result=int(n*(n-1)/2)
print(result)

Submission status: Wrong Answer

Solution code:
# N = 5
#[1, 2, 3, 4, 5]  P = [2, 3, 4, 5, 1] M = [1, 2, 3, 4, 0] -> 10
# = 1 から　N - 1　までの　和

N = int(input())
ans = (N - 1) / 2 * N
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

print(int((n-1)*n /2))

Submission status: Wrong Answer

Solution code:
N = int(input())
N -= 1
print(int(0.5*N*(N+1)))

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, getcontext
getcontext().prec = 55

a = float(input())
s = a * (a - 1) // 2
#s = "{:.55f}".format(Decimal(Decimal(str(a)) * Decimal(str(a-1)) / Decimal(str(2))))
print(int(s))

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, getcontext
getcontext().prec = 55

a = int(input())
s = "{:.55f}".format(Decimal(Decimal(str(a)) * Decimal(str(a-1)) / Decimal(str(2))))
print(s)

Submission status: Wrong Answer

Solution code:
a = float(input())
s = a*(a-1)//2
print(int(s))

Submission status: Wrong Answer

Solution code:
a = float(input())
s = a*(a-1)/2
print(int(s))

Submission status: Wrong Answer

Solution code:
a = float(input())
s = (a-1)/2
s*=a
print(int(s))

Submission status: Wrong Answer

Solution code:
a = int(input())
ans = a*(a-1)/2
print(int(ans))

Submission status: Wrong Answer

Solution code:
a = int(input())
ans = a*(a+1)/2 - a
print(int(ans))

Submission status: Wrong Answer

Solution code:
a = int(input())
if a == 1:
  print("1")
  exit(0)
else:
  ans = a*(a+1)/2 - a
  print(int(ans))

Submission status: Wrong Answer

Solution code:
a = int(input())
if a == 1:
  print(1)
  exit(0)
else:
  ans = a*(a+1)/2 - a
  print(int(ans))

Submission status: Wrong Answer

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

print(math.floor((n-1)*n/2))

Submission status: Wrong Answer

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

print(math.ceil((n-1)*n/2))

Submission status: Wrong Answer

Solution code:
# D - ModSum

_input = int(input())
print((1 + _input) // 2)

Submission status: Wrong Answer

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

print(int((1+n)*n/2))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if 1 <= N <= 1000000000:
    print(int((N*(N-1))/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = int((n*(n-1))//2)
print('{:.18g}'.format(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = int((n*(n-1))/2)
print('{:.18g}'.format(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = int(n*(n-1)/2)
print('{:.18g}'.format(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = int(n*(n-1)/2)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = n*(n-1)/2

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = int((1+N-1)*(N-1)/2)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

if (n % 2) == 0:
  ans = n / 2 * (n-1)
else:
  ans = (n-1) / 2 * n

print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

print(int((n-1) * n / 2))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = n * (n-1)/2
print(int(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = n * (n-1)/2
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
def total2(x):
    return int(x*(x+1)/2)
print(total2(n-1))

Submission status: Wrong Answer

Solution code:
n = int(input())

def total(x):
  return x*(x+1)/2

print(total(n-1))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        N = int(input())
        print(N*(N-1)/2)
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
print("{:.0f}".format((1 + (N - 1)) * (N - 1) / 2))

Submission status: Wrong Answer

Solution code:
while True:
    try:
        N = int(input())
        print(int(N*(N-1)/2))
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
a = int(input())

print(int(a*(a-1)/2))

Submission status: Wrong Answer

Solution code:
a = int(input())-1

print(int(a*(a+1)/2))

Submission status: Wrong Answer

Solution code:
a = int(input())

print(a*(a+1)/2)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 2:
    print(1)

elif n%2:
    print(n*(n-1)//2)
else:
    print(n*(n-1)//2 - 1)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n%2:
  print(n*(n-1)//2)
else:
  print(n*(n-1)//2 - 1)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = int((N*(N-1))/2)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input()) - 1
print(int(n*(n+1)/2))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 1:
  print(0)
else:
  print((N*(N+1))/2)

Submission status: Wrong Answer

Solution code:
n = int(input())

answer = n * (n - 1) /2

print(int(answer))

Submission status: Wrong Answer

Solution code:
N=int(input())

if N==1:
  print(0)
elif N==2:
  print(1)
elif N%2==1:
  sum=N*(N+1)/2 -N
  print(int(sum))
else:
  sum=N*(N+1)/2 -N 
  print(int(sum))

Submission status: Wrong Answer

Solution code:
N=int(input())

if N==1:
  print(0)
elif N==2:
  print(1)
elif N%2==1:
  sum=N*(N+1)/2 -N
  print(int(sum))
else:
  sum=N*(N+1)/2 -N +1
  print(int(sum))

Submission status: Wrong Answer

Solution code:
N=int(input())

if N==1:
  print(0)
elif N==2:
  print(1)
else:
  sum=N*(N+1)/2 -(N+1) +N%2
  print(int(sum))

Submission status: Wrong Answer

Solution code:
n = int(input())
sum([x for x in range(1, n-1)])

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
if N == 1:
    print(0)
elif N % 2 == 0:
    print(int(N * (N/2-1) + N/2))
else:
    print(int(N * math.floor(N/2)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N=int(input())
m=0
if N==1:
  m=0
elif N==2:
  m=1
elif N>=3:
  m=(1+(N-1))*(N-1)/2
print(m)

Submission status: Wrong Answer

Solution code:
N=int(input())
m=0
if N==1:
  m=0
elif N==2:
  m=1
elif N>=3:
  m=((1+(N-1))*(N-1))/2
print(m)

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int((1+n-1)*((n-1)/2)))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

if n%2==0:
  ans = int(n/2)
  ans = ans*(n-1)
else:
  ans = int((n-1)/2)
  ans = ans*n
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n%2==0:
  ans = n/2
  ans = ans*(n-1)
else:
  ans = (n-1)/2
  ans = ans*n
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = n * (n-1) / 2
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

if(N%2==1):
    print(N*(N-1)/2)
else:
    print(N*(N/2-1)+N/2)

Submission status: Wrong Answer

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

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

sum_N = int(((1 + N) * (N/2)) - N)

print(sum_N)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = n*(n-1)/2

print(ans)

Submission status: Wrong Answer

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

# import itertools

num = int(input())

# イテレーションせずに求めます
rtn = num * (num-1) /2
print(rtn)

Submission status: Wrong Answer

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

# import itertools

num = int(input())

# イテレーションせずに求めます
rtn = 0
rtn = num * (num-1) /2
print(int(rtn))

# 実は[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: Wrong Answer

Solution code:
n = int(input())
c = 0    
an = (n-1)*n/2
print(round(an))

Submission status: Wrong Answer

Solution code:
n = int(input())
c = 0    
an = (n-1)//(2*(2+(n-2)))
print(round(an))

Submission status: Wrong Answer

Solution code:
n = int(input())
c = 0    
an = (n-1)//2*(2+(n-2))
print(round(an))

Submission status: Wrong Answer

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

# import itertools

num = int(input())

# イテレーションせずに求めます
rtn = 0
if (num%2 == 0):
  rtn = num * (num-2)/2 + num/2
else:
  rtn = num * (num-1)/2
print(int(rtn))

# 実は[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: Wrong Answer

Solution code:
import math
n = int(input())
c = 0    
an = (n-1)/2*(2+(n-2))
print(math.ceil(an))

Submission status: Wrong Answer

Solution code:
N = int(input())

# 最大値はN(N - 1) / 2で求められる
print("{}".format(int((N * (N - 1)) / 2)))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
c = 0    
an = (n-1)/2*(2+(n-2))
print(math.floor(an))

Submission status: Wrong Answer

Solution code:
n = int(input())
c = 0    
an = (n-1)/2*(2+(n-2))
print(round(an))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = (n + 1) * n / 2 - n
print(int(a))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:

import math
N = int(input())
print(int(N * (N - 1) / 2))

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
print(N * (N - 1) / 2)

Submission status: Wrong Answer

Solution code:
num = int(input())
result = num * (num - 1) / 2
##  初項0, 公差1, 項数numの等差数列の和= num(2a + (num - 1)d)/2
print(int(result))

Submission status: Wrong Answer

Solution code:
N = int(input())
num = 0
j = N

for i in range(1, N+1):
  num += i % j
  j -= 1
print(num)

Submission status: Wrong Answer

Solution code:
num = int(input())
result = (num - 1) * (2 + (num - 2)) / 2
##  初項0, 公差1, 項数numの等差数列の和= num(2a + (num - 1)d)/2
print(int(result))

Submission status: Wrong Answer

Solution code:
num = int(input())
result = num * (num - 1) / 2
##  初項0, 公差1, 項数numの等差数列の和= n(a + a+num)/2
print(int(result))

Submission status: Wrong Answer

Solution code:
n = int(input()) - 1
print(int(((n+1)*n)/2))

Submission status: Wrong Answer

Solution code:
n = int(input()) - 1
print(int((n+1)*n/2))

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
import itertools
def calc_seq(m):
    ls = []
    for i in range(m):
        ls.append(i+1)
    return(ls)
def calc_mod_seq(seq, ori):
    ret = []
    for i in range(len(seq)):
        ls = []
        for j in range(len(seq[i])):
            ls.append(ori[j] % seq[i][j])
        ret.append(ls)
    return(ret)
def print_maxmod(mod_seq):
    maxmod = 0
    for i in range(len(mod_seq)):
        if maxmod < sum(mod_seq[i]):
            maxmod = sum(mod_seq[i])
    print(maxmod)
max_value = int(input())
seq = calc_seq(max_value)
all_seq = list(itertools.permutations(seq))
print(all_seq)
mod_seq = calc_mod_seq(all_seq, seq)
print_maxmod(mod_seq)

Submission status: Wrong Answer

Solution code:
N = int(input())

print(int((N-1)*0.5*N))

Submission status: Wrong Answer

Solution code:
N = int(input())

print(int(N*(N-1)*0.5))

Submission status: Wrong Answer

Solution code:
def check():
    N = int(input())
    if N == 1:
        print(1)
    else:
        print(int(N*(N-1)*0.5))
check()

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int(n * (n-1) / 2))

Submission status: Wrong Answer

Solution code:
N = int(input())
print( (N  * (N + 1)) // 2)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
count = (n - 1) * n / 2
print("{}".format(count))

Submission status: Wrong Answer

Solution code:
N = int(input())
modsum = N * (N - 1) / 2
print("%d" % modsum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    print((lambda x: int((x*(x-1))/2))(int(input())))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = n*(n-1)/2
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = N - 1
print(int((M * (M + 1)) / 2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())
answer = a*(a-1)/2

print(int(answer))

Submission status: Wrong Answer

Solution code:
import numpy as np

a = int(input())
answer = a*(a-1)/2

print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
#なぜかｗA
#ans = (((N+1)*N) / 2) - N
#ans = (((N-1)*N) / 2)
ans = (N-1) * N
ans = ans / 2
ans = int(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
#なぜかｗA
#ans = (((N+1)*N) / 2) - N
ans = (((N-1)*N) / 2)
ans = int(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = (((N+1)*N) / 2) - N
ans = int(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0.5 * n * (n - 1)
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = (n * (n - 1)) / 2
print(int(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=int(0.5+(n**2-n)/2)
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from math import floor, ceil

N = int(input())
 
print(int(N*(N-1)/2) if (N-1) % 2 == 0 else int(N*ceil((N-1)/2) + floor((N-1)/2)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from math import floor, ceil

N = int(input())
 
print(int(N*(N+1)/2 - N) if N % 2 == 0 else (N+1)*floor(N/2)+ceil(N/2) - N)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from math import floor, ceil

N = int(input())

print((N*(N+1))/2 if N % 2 == 0 else (N+1)*floor(N/2)+ceil(N/2) - N)

Submission status: Wrong Answer

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

print(result)

Submission status: Wrong Answer

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

print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
print((int((n*(n-1))/2)))

Submission status: Wrong Answer

Solution code:
def main():
  n = int(input())
  print(int(n * (n-1) / 2))
 

main()

Submission status: Wrong Answer

Solution code:
n = (int)(input())
print(n*(n-1)/2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = round(n * (n - 1) / 2)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = n * (n - 1) / 2
ans = int(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = int(n * (n -1) / 2)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans = n*(n-1)/2
print(int(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
  print(0)
else:
  print(int((n-1)*n/2))

Submission status: Wrong Answer

Solution code:
n=int(input())
print(str(int(n*(n-1)/2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())
print(int((n - 1) * n / 2))

Submission status: Wrong Answer

Solution code:
n = int(input().strip())
print(((n-1)*n)/2)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
ans = (pow(n,2) - n) / 2
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

print((int)(n*(n-1)/2))

Submission status: Wrong Answer

Solution code:
n= int(input())
m =int( n * (n-1) *0.5)
print(m)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

N = int(input())
print(int(N*(N-1) / 2))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

N = int(input())
print(N*(N-1) / 2)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = 0
b = round(a * (a-1) /2)
print(b)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = 0
b = round(a * (a+1) /2)
print(b)

Submission status: Wrong Answer

Solution code:
n=int(input())

#1～n-1までの数列の和
print((1//2*(n-1)*n))

Submission status: Wrong Answer

Solution code:
n = int(input())
answer = int((n*(n-1))/2) 
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
answer = int((n*(n-1))/2) - n
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
answer = int((n * (n-1)) / 2)
print(answer)

Submission status: Wrong Answer

Solution code:
n = int(input())
answer = n*(n-1) / 2

print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
print(N * (N+1) /2)

Submission status: Wrong Answer

Solution code:
n=int(input())

#1～nまでの数列の和
print(int(1/2*(n-1)*n))

Submission status: Wrong Answer

Solution code:
N = int(input())
print('{:.0f}'.format((N)*(N-1)/2))

Submission status: Wrong Answer

Solution code:
S=float(input())
#N=list(map(int,input().split()))
ans=(S-1)*S/2
print(int(ans))

Submission status: Wrong Answer

Solution code:
S=int(input())
#N=list(map(int,input().split()))
ans=(S-1)*S/2
print(int(ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
    print(0)
else:
    print(int((n-1)*n/2))

Submission status: Wrong Answer

Solution code:
import sys
def solve(matrix):
    N = len(matrix)
    #print  matrix
    day = 0
    worst = N * (N-1) / 2
    remaining = worst
    while remaining:
        prev = remaining
        day+=1
        #print "day %d" % day
        #print "matrix: %r" % matrix
        #print "remaining:%d" % remaining
        match = {}
        for i, order in enumerate(matrix):
            me = i+1
            if match.get(me) and order and order[0] in match[me]:
                x = matrix[order[0]-1].pop(0)
                y = order.pop(0)
                remaining -= 1
                #print "%d and %d" % (x, y)
                #print "matrix: %r" % matrix
            elif order:
                if match.get(order[0]):
                    match[order[0]].append(me)
                else:
                    match[order[0]] = [me]
                #print 'match: %r' % match
        if remaining  == prev:
            print -1
            sys.exit(0)
    print day

Submission status: Wrong Answer

Solution code:
N = int(input())
li = range(1, N)
if len(li) == 0:
    print(0)
else:
    print("{:.0f}".format((li[0] + li[-1]) * len(li) / 2))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = n*(n-1)/2
print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())

N -= 1
ans = N * (N + 1) / 2
print("{:.0f}".format(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

if(n == 2):
    print(1)
elif(n == 1):
    print(0)
else:
    print(int((n - 1) * n / 2))

Submission status: Wrong Answer

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

if N != 1:

    for i in range(N):
        k=i+1
    
        if k == N:
            count += N%2
            break

        if k != 1:
            count += k%(k+1)

print(count)

Submission status: Wrong Answer

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

ans=int((S-1)*S/2)

print(ans)