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:
import numpy as np

N = int(input())

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

N_np   = np.sum(np.array(N_list))

print(N_np)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n1 = int(input())
if n1 == 1:
    print(0)
else:
    a1 = n1*(n1-1)
    a2 = a1*0.5
    print(round(a2))

Submission status: Wrong Answer

Solution code:
N = int(input())
if N == 1:
    print("0")
elif N == 2:
    print("1")
else :
    print(int(N* (N - 1) * 0.5))

Submission status: Wrong Answer

Solution code:
N=int(input())-1
print(int(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())
ans=(N-1)/2*N
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

if __name__ == '__main__':
    N = int(input())
    S = 0
    last = N
    if N == 1:
        print(0)
        exit(0)
    if N == 2:
        print(1)
        exit()

    while True:
        save = 0
        num = 0
        for n in range(1,last+1):
            val = last % n
            #print(val)
            if val > save:
                save = val
                num = n

        else:
            S = S + save + np.sum(np.arange(num,last))
            last = num-1
            if num == 2:
                break

    print(S+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
a=int(input())
b=int((a-1)*a/2)
c=[]
c.append(b)
for i in range(1,int(math.sqrt(a/2))):
    if i<a%(i+1):
        c.append(b+(a%(i+1)-i))
print(max(c)+1)

Submission status: Wrong Answer

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

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
"""
考え方

N-1までの値を合計した値が答え
"""

N = int(input())


if N < 10**5:
  ans = 0
  for i in range(1,N):
    ans += i
elif (N >= 10**5) and (N < 10**6):
  ans = 4999950000
  for i in range(10**5, 10**6):
     ans += i
elif (N >= 10**6) and (N < 10**7):
  ans = 499999500000
  for i in range(10**6, 10**7):
     ans += i
elif (N >= 10**7) and (N < 5*(10**7)):
  ans = 49999995000000
  start = 10**7
  end = 5*(10**7)
  for i in range(start, end):
     ans += i

elif (N >= 5*(10**7)) and (N < 10**8):
  ans = 1249999975000000
  start = 5*(10**7)
  end = 10**8
  for i in range(start, end):
     ans += i


## 10**8は計算量が多いので分割する
elif (N >= 10**8) and (N < int(1.5*(10**8))):
  ans = 4999999950000000
  start = 10**8
  end = int(1.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(1.5*(10**8)))  and (N < 2*(10**8)):
  ans = 11249999925000000
  start = int(1.5*(10**8))
  end = 2*(10**8)
  for i in range(start, end):
     ans += i


elif (N >= 2*(10**8)) and (N < int(2.5*(10**8))):
  ans = 19999999900000000
  start = 2*(10**8)
  end = int(2.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(2.5*(10**8))) and (N < 3*(10**8)):
  ans = 31249999875000000
  start = int(2.5*(10**8))
  end = 3*(10**8)
  for i in range(start, end):
     ans += i  
      
elif (N >= 3*(10**8)) and (N < int(3.5*(10**8))):
  ans = 44999999850000000
  start = 3*(10**8)
  end = int(3.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(3.5*(10**8))) and (N < 4*(10**8)):
  ans = 61249999825000000
  start = int(3.5*(10**8))
  end = 4*(10**8)
  for i in range(start, end):
     ans += i
      
elif (N >= 4*(10**8)) and (N < int(4.5*(10**8))):
  ans = 79999999800000000
  start = 4*(10**8)
  end = int(4.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(4.5*(10**8))) and (N < 5*(10**8)):
  ans = 101249999775000000
  start = int(4.5*(10**8))
  end = 5*(10**8)
  for i in range(start, end):
     ans += i      

elif (N >= 5*(10**8)) and (N < int(5.5*(10**8))):
  ans = 124999999750000000
  for i in range(5*(10**8), int(5.5*(10**9))):
     ans += i 

elif (N >= int(5.5*(10**8))) and (N < 6*(10**8)):
  ans = 151249999725000000
  start = int(5.5*(10**8))
  end = 6*(10**8)
  for i in range(start, end):
     ans += i           
      
elif (N >= 6*(10**8)) and (N < int(6.5*(10**8))):
  ans = 179999999700000000
  start = 6*(10**8)
  end = int(6.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(6.5*(10**8))) and (N < 7*(10**8)):
  ans = 211249999675000000
  start = int(6.5*(10**8))
  end = 7*(10**8)
  for i in range(start, end):
     ans += i     
      
elif (N >= 7*(10**8)) and (N < int(7.5*(10**8))):
  ans = 244999999650000000
  start = 7*(10**8)
  end = int(7.5*(10**8))
  for i in range(start, end):
     ans += i
       
elif (N >= int(7.5*(10**8))) and (N < 8*(10**8)):
  ans = 281249999625000000
  start = int(7.5*(10**8))
  end = 8*(10**8)
  for i in range(start, end):
     ans += i     
      
elif (N >= 8*(10**8)) and (N < int(8.5*(10**8))):
  ans = 319999999600000000
  start = 8*(10**8)
  end = int(8.5*(10**8))
  for i in range(start, end):
     ans += i
 
elif (N >= int(8.5*(10**8))) and (N < 9*(10**8)):
  ans = 361249999575000000
  start = int(8.5*(10**8))
  end = 9*(10**8)
  for i in range(start, end):
     ans += i           
      
elif (N >= 9*(10**8)) and (N < int(9.5*(10**8))):
  ans = 404999999550000000
  start = 9*(10**8)
  end = int(9.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(9.5*(10**8))) and (N < 10**9):
  ans = 451249999525000000
  start = int(9.5*(10**8))
  end = 10**9
  for i in range(start, end):
     ans += i

else:
  ans = 499999999500000000

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(n_sum-n)

Submission status: Wrong Answer

Solution code:

N = int(input())
if N == 1:
    print("0")
    exit()
ans = ((N-1) * N) / 2
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

N = int(input())

calc = int(0.5 * (N-1) * (N))

print(calc)

Submission status: Wrong Answer

Solution code:
N = int(input())

MM = ( 1+(N-1) )*(N-1)/2

print(int(MM))

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())
ans = 0
if n>1:
    ans=((n-1)*n)/2 
        
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque
N = int(input())
M = deque()
M.append(0)
for i in range(1, N):
    if i == N-1:
        print(M[i-1] + i)
    else:
        M.append(M[i-1] + i)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

num = 0

num = n*(n-1)/2

print(int(max(num,n-1)))

Submission status: Wrong Answer

Solution code:
import sys
import math



N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

res = 0

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

print(int(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input().split()
a=int(s[0])
max=0
b=1
a=a-1
max=a*(a+1)/2
print(int(max))

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-1)/2 * N)

Submission status: Wrong Answer

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

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 * (n+1))/2) - n )

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

M = N * (N-1) / 2


print(int(M))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a = np.zeros(2,dtype = "int64")
b = np.zeros(2,dtype = "int64")
N = int(input())
a[0] = N
sum = a[0] * (a[0]-1) / 2
b[0] = sum
print(b[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
if n > 0: print(int(((n-1)*n)/2))
else: print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

sum = (N-2)*(N+1)/2 + N % 2

if N == 1:
    sum = 0
elif N ==2:
    sum = 1

print(int(sum))

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

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
h = N // 2 if N % 2 == 0 else N // 2 + 1

if N == 2:
    print(1)
    sys.exit()

cnt = 0

while N > 0:
    if N <= h:
        if N % 2 != 0:
            cnt += N // 2
        else:
            cnt += N // 2 + 1
    else:
        cnt += N
    N -= 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力


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

    if n == 1:
        print(0)
        return

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
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:
import sys
import math



N = int(input())

#max = 0
#for _ in range(1,N):
#    max = max + _
print(int(((N-1)*(N))/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

N = int(input())

calc = int(1/2 * (N-1) * (N))

print(calc)

Submission status: Wrong Answer

Solution code:
s = input().split()
a=int(s[0])
max=0
b=1
for i in range(2,a+1):
        max=max+b%i
        b+=1
if not a==1:max+=1
print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
if N == 1:
    ans = 0
elif N == 2:
    ans = 1
else:
    # suffix = 0 if N & 1 else 1
    # ans = (N-1)/2 * (1+N-1)
    ans = int((N-1)/2 * N)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
n = N -1
# print(np.sum(np.arange(1, N)))
#print(int((n/2.) * (2*1 + (n-1)*1)) - 1)
print(0)
#S=12n(2a+(n−1)d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N = int(sys.stdin.readline())

sum = 0

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

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

print(sum)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
a = np.zeros(2,dtype = "int64")
N = int(input())
sum = N * (N-1) / 2
a[0] = sum
print(a[0])

Submission status: Wrong Answer

Solution code:
n = int(input())
sum = 0
if n == 0:
    sum = 0
elif n == 1:
    sum = 0
elif n == 2:
    sum = 1
elif n == 3:
    sum = 5
else:
    sum = int((n-1)*(2+n)/2)-n+1
print(sum)

Submission status: Wrong Answer

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()
print(int((N*(N-1))/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
n = N -1
# print(np.sum(np.arange(1, N)))
print(int((n/2.) * (2*1 + (n-1)*1)) + 1)

#S=12n(2a+(n−1)d)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    ans = 0

elif n == 2:
    ans = 1

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8
n = int(input())
n = n-1
answer = 0

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

print(round(answer,0))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    ans = 0

elif n == 2:
    ans = 1

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math
N = int(input())-1
M = 0
x = int(math.ceil((N)/2))
if N%2 == 0:
    M = x*(N+1)
else:
    M = (x-1)*(N+1)
print(M)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
import math



N = int(input())

#max = 0
#for _ in range(1,N):
#    max = max + _
print(int((N-1)*(N)/2))

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

n, = map(int, input().split())
# data = getInputListInt()

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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(int(ans))

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
"""
考え方

N-1までの値を合計した値が答え
"""

N = int(input())


if N < 10**5:
  ans = 0
  for i in range(1,N):
    ans += i
elif (N >= 10**5) and (N < 10**6):
  ans = 4999950000
  for i in range(10**5, 10**6):
     ans += i
elif (N >= 10**6) and (N < 10**7):
  ans = 499999500000
  for i in range(10**6, 10**7):
     ans += i
elif (N >= 10**7) and (N < 5*(10**7)):
  ans = 49999995000000
  start = 10**7
  end = 5*(10**7)
  for i in range(start, end):
     ans += i

elif (N >= 5*(10**7)) and (N < 10**8):
  ans = 1249999975000000
  start = 5*(10**7)
  end = 10**8
  for i in range(start, end):
     ans += i


## 10**8は計算量が多いので分割する
elif (N >= 10**8) and (N < int(1.5*(10**8))):
  ans = 4999999950000000
  start = 10**8
  end = int(1.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(1.5*(10**8)))  and (N < 2*(10**8)):
  ans = 11249999925000000
  start = int(1.5*(10**8))
  end = 2*(10**8)
  for i in range(start, end):
     ans += i


elif (N >= 2*(10**8)) and (N < int(2.5*(10**8))):
  ans = 19999999900000000
  start = 2*(10**8)
  end = int(2.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(2.5*(10**8))) and (N < 3*(10**8)):
  ans = 31249999875000000
  start = int(2.5*(10**8))
  end = 3*(10**8)
  for i in range(start, end):
     ans += i  
      
elif (N >= 3*(10**8)) and (N < int(3.5*(10**8))):
  ans = 44999999850000000
  start = 3*(10**8)
  end = int(3.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(3.5*(10**8))) and (N < 4*(10**8)):
  ans = 61249999825000000
  start = int(3.5*(10**8))
  end = 4*(10**8)
  for i in range(start, end):
     ans += i
      
elif (N >= 4*(10**8)) and (N < int(4.5*(10**8))):
  ans = 79999999800000000
  start = 4*(10**8)
  end = int(4.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(4.5*(10**8))) and (N < 5*(10**8)):
  ans = 101249999775000000
  start = int(4.5*(10**8))
  end = 5*(10**8)
  for i in range(start, end):
     ans += i      

elif (N >= 5*(10**8)) and (N < int(5.5*(10**8))):
  ans = 124999999750000000
  for i in range(5*(10**8), int(5.5*(10**9))):
     ans += i 

elif (N >= int(5.5*(10**8))) and (N < 6*(10**8)):
  ans = 151249999725000000
  start = int(5.5*(10**8))
  end = 6*(10**8)
  for i in range(start, end):
     ans += i           
      
elif (N >= 6*(10**8)) and (N < int(6.5*(10**8))):
  ans = 179999999700000000
  start = 6*(10**8)
  end = int(6.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(6.5*(10**8))) and (N < 7*(10**8)):
  ans = 211249999675000000
  start = int(6.5*(10**8))
  end = 7*(10**8)
  for i in range(start, end):
     ans += i     
      
elif (N >= 7*(10**8)) and (N < int(7.5*(10**8))):
  ans = 244999999650000000
  start = 7*(10**8)
  end = int(7.5*(10**8))
  for i in range(start, end):
     ans += i
       
elif (N >= int(7.5*(10**8))) and (N < 8*(10**8)):
  ans = 281249999625000000
  start = int(7.5*(10**8))
  end = 8*(10**8)
  for i in range(start, end):
     ans += i     
      
elif (N >= 8*(10**8)) and (N < int(8.5*(10**8))):
  ans = 319999999600000000
  start = 8*(10**8)
  end = int(8.5*(10**8))
  for i in range(start, end):
     ans += i
 
elif (N >= int(8.5*(10**8))) and (N < 9*(10**8)):
  ans = 361249999575000000
  start = int(8.5*(10**8))
  end = 9*(10**8)
  for i in range(start, end):
     ans += i           
      
      
elif (N >= 9*(10**8)) and (N < int(9.5*(10**8))):
  ans = 404999999550000000
  start = 9*(10**8)
  end = int(9.5*(10**8))
  for i in range(start, end):
     ans += i

elif (N >= int(9.5*(10**8))) and (N < 10**9):
  ans = 451249999525000000
  start = int(9.5*(10**8))
  end = 10**9
  for i in range(start, end):
     ans += i

else:
  ans = 499999999500000000

print(ans)

Submission status: Wrong Answer

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

# Input
n = int(input())

# Calc Sum
if n % 2 == 0:
    ans = int((n + 1) * (n / 2) - n)
else:
    ans = (n + 1) * int(n / 2) + (int(n / 2) + 1) - n

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n_2 = int(input())

c = 0
ans = n_2 +1
anss = ans * (n_2 / 2)

print(int(anss - n_2))

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())-1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 2019 9/1
# ModSum

N = int(input())

ModSum = N * (N - 1) / 2
if N % 2 == 0:
    ModSum += 1

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

elif N == 2:
    print("2")

else:
    print(int(ModSum))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n_2 = int(input())

c = 0
ans = n_2 +1
anss = ans * (n_2 / 2)

print(anss - n_2)

Submission status: Wrong Answer

Solution code:
N = int(input())
print(max(0, 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())
M=N*(N-1)/2
print(int(M))

Submission status: Wrong Answer

Solution code:
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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

Submission status: Wrong Answer

Solution code:

N=int(input())

n=N-1

s=n*(n+1)/2

print(int(s))

Submission status: Wrong Answer

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

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:
# coding: utf-8
# Your code here!
N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools
import numpy as np
N = int(input())
print(int((N-1) * N / 2))

Submission status: Wrong Answer

Solution code:
N = int(input())

fN = float(N)

print(round(((fN-1.0)*fN)/2.0))

Submission status: Wrong Answer

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

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((N*(N-1)*0.5))


print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

print((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())
k = int((n * (n - 1) ) / 2 )
print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n=int(input())

ans=int((n*(n-1))/2)
print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:
#coding: utf-8
n = int(input())
n = n-1
answer = 0

if n % 2 == 0:
	answer = (n+1)*(n/2)
else:
	answer = n*(n-1)/2 + n
print(int(round(answer,0)))

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())
sum = 0
if n == 1:
    sum = 0
elif n == 2:
    sum = 1
else:
    sum = int(n*(n+1)/2-n)
print(sum)

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(int(sum))

Submission status: Wrong Answer

Solution code:

N=int(input())

n=N-1

s=n*(2*1+(n-1)*1)/2

print(int(s))

Submission status: Wrong Answer

Solution code:
from itertools import accumulate

n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n%2 == 1:
    ans = n*(n-1)//2
else:
    ans = n*(n-2)+n//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:
import math
n = int(input().strip())
ans = int((n-1)*n/2)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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(0.5*N*(N-1)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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 = int(N*(1+N)/2)
print(sum-N)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
ans=math.floor(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())
print(int(0.5 * N) * (N - 1))

Submission status: Wrong Answer

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

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())
a = (n-1)*n/2
print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())
print(int(N * (N - 1.0) / 2.0))

Submission status: Wrong Answer

Solution code:
N = int(input())

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