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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    print(int((1 + (n - 1)) / 2 * (n - 1)))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

if n <= 2:
	print(n-1)
elif n == 3:
	print(3)
else:
	sm = int((n-1)*n/2)
	print(sm)

Submission status: Wrong Answer

Solution code:
N = int(input())
#(1,2,...,N)に対してP=(2,3,...,N,1)が最善

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

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

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

result = 0
max_result = 0

    
print(int(tosa(n-1)))

Submission status: Wrong Answer

Solution code:
n = int(input())

max_i = int(n / 2) + 1
max_mod = n % max_i

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

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

print(int(sum))

Submission status: Wrong Answer

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

ans = n/2*(n-1)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

a = n/(10**5)
b = (n-1)/(10**5)
ans_2 = (a*b)/2
ans = ans_2*(10**5)*(10**5)
print("%d" % ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
 
 
if N < 10**6:
  ans = 0
  for i in range(1,N):
    ans += i
elif (N >= 10**6) and (N < 10**7):
  base = 0
  _ = int(N / 10)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1] + base_str[1:] + base_str[-2]
  ans = int(base_str)

elif (N >= 10**7) and (N < 10**8):
  base = 0
  _ = int(N / 100)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1]*2 + base_str[1:] + base_str[-2]*2
  ans = int(base_str)


elif (N >= 10**8) and (N < 10**9):
  base = 0
  _ = int(N / 1000)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1]*3 + base_str[1:] + base_str[-2]*3
  ans = int(base_str)

else:
  ans = 499999999500000000
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
print(int(n * (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())
if n == 1:
  print(0)
if n == 2:
  print(1)
else:
  print(n * (n-1)//2)

Submission status: Wrong Answer

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

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

print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans=(1+n-1)*(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:
print(499999998500000000)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from itertools import permutations
n=int(input())
s=list(permutations([i for i in range(1,n+1)],n))
x=s[n-1]
result=0
p=1
for i in x:
  result+=p%i
  p+=1
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
print(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
import itertools
import math
def resolve():
    n=int(input())
    x=math.factorial(n)
    l=[]
    for i in range(1,n+1):
        l.append(i)
    r = l[::-1]
    sumi=0
    for i in range(n):
        sumi += l[i]%r[i]
    print(sumi)
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
if 1 <= n <= 10 ** 9:
    print(int((n - 1) * n / 2))
else:
    print('hoge!')

Submission status: Wrong Answer

Solution code:
N = int(input())

#I = [i for i in range(1,N + 1)]
ans = int(N * (N-1) / 2)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = np.array(int(input()), dtype=np.int64)
res = (n * (n - 1 ) / 2)
res = res.astype(np.int64)
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (1 + (N - 1)) / 2 * (N - 1)

    if N <= 1e07:
      a = np.arange(start=1, step=1, stop=N+1)
      bol = (N % a >= a)
      #print(a[bol])
      #print(bol)
      #print(np.any(bol))
      #if np.any(bol):
      #print((N % a)[bol])
      #print(np.sum((N % a)[bol] - a[bol]))
      ans += np.sum((N % a)[bol] - a[bol])

    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

elif n>1 and n%2 ==1:
    ans= (n-1)/2*n
    
print(round(ans))

Submission status: Wrong Answer

Solution code:
import sys
from pprint import pprint

def solve(n):
    print(int((n-1) * n / 2))

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    solve(n)

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

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

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

print(int(sum))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (1 + (N - 1)) / 2 * (N - 1)

    if N <= 1e06:
      a = np.arange(start=1, step=1, stop=N+1)
      bol = (N % a >= a)
      #print(a[bol])
      #print(bol)
      #print(np.any(bol))
      #if np.any(bol):
      #print((N % a)[bol])
      #print(np.sum((N % a)[bol] - a[bol]))
      ans += np.sum((N % a)[bol] - a[bol])

    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

def is_even(num):
	if num % 2 == 0:
		return True
	else:
		return False

def out_k(n):
	if is_even(n):
		k = int(n/2)
	else:
		k = int((n-1)/2)

	return k


def a_to_b_sum(a,b):
	return int((a+b)/2 *(b-a+1))



def calc_part(n):
	if is_even(n):
		k = out_k(n)
		return a_to_b_sum(k ,n-1) -1 , k
	else:
		k = out_k(n)
		return a_to_b_sum(k,n-1) , k

sm = 0
if n <= 2:
	print(n-1)
else:
	while n >= 4:
		s,k = calc_part(n)
		sm += s
		n = k

	if n == 3:
		print(sm + 4)
	else:
		print(sm + 2)

Submission status: Wrong Answer

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])

    return (n,)


def solve(n):

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

    return result


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r)
    else:
        print("%s" % result)


if __name__ == '__main__':

    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
 
 
if N < 10**6:
  ans = 0
  for i in range(1,N):
    ans += i
elif (N >= 10**6) and (N < 10**7):
  base = 0
  _ = int(N / 10)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1] + base_str[1:] + '0'
  ans = int(base_str)

elif (N >= 10**7) and (N < 10**8):
  base = 0
  _ = int(N / 100)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1]*2 + base_str[1:] + '0'*2
  ans = int(base_str)


elif (N >= 10**8) and (N < 10**9):
  base = 0
  _ = int(N / 1000)
  for i in range(_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1]*3 + base_str[1:] + '0'*3
  ans = int(base_str)

else:
  ans = 499999999500000000
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = (1 + (N - 1)) / 2 * (N - 1)

    if N <= 1e05:
      a = np.arange(start=1, step=1, stop=N+1)
      bol = (N % a >= a)
      #print(a[bol])
      #print(bol)
      #print(np.any(bol))
      #if np.any(bol):
      #print((N % a)[bol])
      #print(np.sum((N % a)[bol] - a[bol]))
      ans += np.sum((N % a)[bol] - a[bol])

    print(int(ans))

if __name__ == '__main__':
    main()

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

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:
a = int(input())
print(int(a*a/2 - a/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:
#coding:utf-8

N = int(input())

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

print(int(calc))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
#int_list  = [int(x) for x in stdin.readline().rstrip().split()]
N = int(stdin.readline())

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

Submission status: Wrong Answer

Solution code:
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


n = int(input())
sum = 0

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

Submission status: Wrong Answer

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

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

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

print(calc)

Submission status: Wrong Answer

Solution code:
##
n1 = int(input())
if n1 == 1:
    print(0)
else:
    a1 = n1
    a2 = n1-1
    a3 = int(int(a2)/2)
    a4 = int(int(a3)/2)
    print(round(a4))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = 13
ans = (1 / 2.0 * (n - 1)) * n
print long(ans)

Submission status: Wrong Answer

Solution code:
#-*- coding: utf-8 -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_d -d test-d
oj test -d test-d -c "python abc116d.py"
oj test -d test-d -c "python abc116d.py" test-d/sample-3.in
"""

from collections import defaultdict
import sys
import time
import logging



def deco(func):
    def wrapper(*args, **kwargs):
        s = time.time()
        #print('--start--')
        ret = func(*args, **kwargs)
        logging.debug('--end in %f --' % (time.time() - s))
        return ret

    return wrapper


def sol_wrong(n):
    if n <= 0: return 0
    dp = [0] * (n+1)

    dp[1] = 0
    if n == 1:
        return dp[n]
    if n == 2:
        return 1
    if n == 3:
        return 3
    # dp[2] = 1
    # dp[2] = 3
    # dp[4] = 5

    for i in range(3, n+1):
        dp[i] = dp[i-2] + i

    return dp[n]


def sol_lte():
    if n <= 0: return 0
    dp = [0] * (n+1)
    dp[1] = 0
    if n == 1:
        dp[1] = 0
        return dp[1]
    if n == 2:
        dp[2] = 1
        return dp[2]
    dp[2] = 1
    for i in range(3, n+1):
        dp[i] = dp[i-1] + i - 1
    return dp[i]


def sol(n):
    if n <= 0: return 0
    if n == 1:
        return 0
    if n == 2:
        return 1
    x = n - 1
    if x % 2 == 0: # even
        return ((x + 1) * int(n/2))
    else: # odd
        return ((x + 1) * int(n/2)) + int((n+1)/2)



do_submit = True
#do_submit = False
if do_submit:
    logging.basicConfig(level=logging.ERROR, format="%(message)s")
else:
    logging.basicConfig(level=logging.DEBUG, format="%(message)s")

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [[x.strip() for x in line.split()] for line in lines]
    n, k = parsed_lines[0]
    n = int(n)
    k = int(k)
    S = parsed_lines[1][0]
    return (n, k, S)


if not do_submit:
    n, k, S = input_parse("""
    14 2
    11101010110011
    """)
    print(sol(n, k, S))

    n, k, S = input_parse("""
    5 1
    00010
    """)
    print(sol(n, k, S))

    n, k, S = input_parse("""
    1 1
    1
    """)
    print(sol(n, k, S))


else:
    # str = ""
    # str += input().strip() + "\n"# n, k
    # str += input().strip() # S
    # n, k, S = input_parse(str)
    n = int(input().strip())
    print (sol(n))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
candi =int((N+1)/2*N -N)
if N%2 == 0:
    print(candi)
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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def culc(n):
    if n%2==0:
        return (n+1)*(n/2)-n
    if n%2==1:
        return (n+1)*((n-1)/2)+(n+1)/2-n

N = int(input())
if N == 1:
    print(0)
else:
    print(int(culc(N)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = np.array(int(input()), dtype=np.int64)
print(int(n * (n - 1 ) / 2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())

# n_list = np.arange(1, n + 1)
# m_list = np.zeros(n)
# m_list[:-1] = n_list[1:]
# m_list[-1] = n_list[0]

# n_l = np.arange(1, n + 1)
# res = np.cumsum(n_l) 
# print(int(res[-2]))

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

temp1 = (n-1) // 2
temp2 = 2 + n - 2
#ans = ((n-1) / 2) * (2 + (n - 2))
ans = temp1 * temp2

#print(ans)
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if (sum > N):
    print(sum - N)
else:
    print(sum)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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())
if (N-1)*(N-2)%2==0:
  print((N-1)*(N-2)//2)
else:
  print((N-1)*(N-2)//2+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

MM = N*(N-1)/2

print(int(MM))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
N = N - 1

print(int(math.ceil((N * (N + 1)) * 0.5)))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(sum)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000)
N = int(input())

def calc(n):
  # print('n=%d' % n)
  if n == 1:
    return 1
  elif n == 2:
    return 2
  half = n // 2
  ret = half + 1
  print(ret)
  return ret + calc(half)

total = (1+N)*N//2
print(total - calc(N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

N = float(input())

answer = (N-1.0)*N/2.0
print(int(answer))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(mysum)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
a = int(input())

ans = 0

n = a-1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
N = N - 1

print(int(math.floor((N * (N + 1)) / 2)))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
int_list  = [int(x) for x in stdin.readline().rstrip().split()]

N = int_list[0]


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

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 2:
    print(1)
elif N % 2 == 1:  #N:odd
    n = (N+1)/2
    print(int(2 * (n-1) * n))
else:
    n = N/2
    print(int(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())
sum_M = ((1 + (N-1)) * (N-1)) / 2
print(int(sum_M))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(sys.stdin.readline())
print(int((N - 1) / 2 * N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

mysum = int((N*(N+1))/2)

print(mysum - N)

Submission status: Wrong Answer

Solution code:
import math

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

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

print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Dekaiketa = int(((N*(N-1))/2)//(10**9+7))
Chisaiketa = int(((N*(N-1))/2)%(10**9+7))
print(Dekaiketa*(10**9+7)+Chisaiketa)

Submission status: Wrong Answer

Solution code:
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 < 5*(10**8)):
  ans = 4999999950000000
  start = 10**8
  end = 5*(10**8)
  for i in range(start, end):
     ans += i

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

else:
  ans = 499999999500000000
 
print(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
 
print(int(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
Dekaiketa = ((N*(N-1))/2)//(10**9+7)
Chisaiketa = ((N*(N-1))/2)%(10**9+7)
print(Dekaiketa*(10**9+7)+Chisaiketa)

Submission status: Wrong Answer

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

N = int(input())

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

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

print(ans)

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
elif N % 2 ==0:
    sum += 1

print(int(sum))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
import numpy
N = int(input())
L = [i for i in range(1, N)]
print(numpy.sum(L))