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:
# coding: utf-8
import sys
# import random
# import bisect
# import math
# import numpy as np
# from fractions import gcd
# import itertools

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def make_divisors(n):
    # divisors = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            # divisors.append(i)
            return i
            # if i != n // i:
            #     divisors.append(n//i)


def n_to_10(X, n):
    if int(X / n):
        return n_to_10(int(X / n), n) + str(X % n)
    return str(X % n)


def main():
    ip = IP()
    id = Idea()
    """この下から書いてね"""
    n = int(input())
    memo = ((n + 1)/2 * n - n)
    print(int(memo // 1))


main()

Submission status: Wrong Answer

Solution code:
N = float(input())

res = (N - 1.0) / 2.0 * N

print(int(res))

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0.5 * N * (1 + N) - N
print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
if N == 1:
    ans = 0

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


print(ans)

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 sys
input = sys.stdin.readline

n = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
import math

sys.setrecursionlimit(4100000)


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


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        half_l = math.floor(num / 2)
        half = (half_l + half_l + 1) / 2
    else:
        half = math.floor(num / 2)
    return int(half * num)


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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

print(int(max(N*(N-1)/2, 0)))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
n = int(sys.stdin.readline())
print(int(n*(n-1)/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
# import random
# import bisect
# import math
# import numpy as np
# from fractions import gcd
# import itertools

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def make_divisors(n):
    # divisors = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            # divisors.append(i)
            return i
            # if i != n // i:
            #     divisors.append(n//i)


def n_to_10(X, n):
    if int(X / n):
        return n_to_10(int(X / n), n) + str(X % n)
    return str(X % n)


def main():
    ip = IP()
    id = Idea()
    """この下から書いてね"""
    n = int(input())
    memo = ((n + 1)/2 * n - n)
    print(memo // 1)


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
#coding:utf-8

N = int(input())

# 初項1, 等差1, 項数Nの等差数列の和の公式：1/2n{2a+(n-1)d}

N -= 1

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

print(int(calc))

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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:
def s(n):
  return N * (N + 1) // 2
N = int(input())

result = s(N-1) - N
if N%2 == 0 and N != 2:
  result -= 1

print(result)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

n = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

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

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = int(input())
if A>2:
    kotae=(2+A-1)*(A-2)/2
    kotae=kotae+1
    kotae=int(kotae)
elif A==2:
    kotae=1
else:
    kotae=0
print(kotae)

Submission status: Wrong Answer

Solution code:
N = int(input())


print("{:}".format(int((N-1)*N/2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

a = 0
if N > 2 and N % 2 == 0: a = 1
print((N - 1) / 2 * (1 + N) + a)

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

ans = 0
if N == 1:
    ans = 0

elif N == 2:
    ans = 1
else:
    ans = ((N-2)*(2+N-1))//2 + N%2

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import decimal
N = int(input())
n = N - 1
a = n / 2 * (n + 1)
ans = decimal.Decimal(str(a))
print(int(ans))

Submission status: Wrong Answer

Solution code:
import itertools
N = int(input())
# A = list(range(1,N+1))
# mx = 0
# for ls in itertools.permutations(A, N):
#     #print (ls)
#     sm = sum([n%(i+1) for i,n in enumerate(ls)])
#     #print (sm)
#     mx = max(sm,mx)
# print (mx)
print (int(0.5*N*(N-1)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
A = int(input())
if A>2:
    kotae=(2+A-1)*(A-2)/2
    amari=A%2
    kotae=kotae+amari
    kotae=int(kotae)
elif A==2:
    kotae=1
else:
    kotae=0
print(kotae)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(int(output))

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(4100000)


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


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    sum = 0
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        avg = ((num // 2) + (num // 2 + 1)) / 2
        sum = avg * num
    else:
        sum = (num // 2) * num
    return sum


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


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

Submission status: Wrong Answer

Solution code:
S = int(input())

if(S%2==1):
    total=S*((S-1)/2)
else:
    total=(S-1)*((S-2)/2)+(S-1)
print(int(total))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(4100000)


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


def solve(inputs):
    [N] = string_to_int(inputs[0])
    num = N - 1
    sum = 0
    if num == 0:
        return 0
    if num == 1:
        return 1
    if num % 2 == 0:
        avg = ((num // 2) + (num // 2 + 1)) / 2
        print(avg)
        sum = avg * num
    else:
        sum = (num // 2) * num
    return sum


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


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
print(int(((n-1)*n)/2))

Submission status: Wrong Answer

Solution code:
def solve(N):
    return int(N * ((N - 1) / 2))


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

    answer = solve(N)
    print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
N = int(input())

A = N-1

answer = A * N/2
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

n_list = [x for x in range(1,N+1)]
p_list = [x for x in range(1,N+1)]
p_list.sort()

ans_list = []

for i in n_list:
    for x in p_list:
        ans_list.append(i % x)

print(sum(ans_list))

Submission status: Wrong Answer

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

n = int(input())

a = round(1/2 * (n-1)*n)

print(a)

Submission status: Wrong Answer

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

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

print(max(int((n-1)*n/2), int((n-2)*(n-1)/2+n % 2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
if N == 1:
    ans = 0

elif N == 2:
    ans = 1

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

print(ans)

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:


a = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())

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

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

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

print('%d' %(Ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# D - ModSum
N = int(input())

# 一番大きい並び方は{1, 2, 3, ..., n} → {n, 1, 2, 3, ..., n-1}
modSum = N * (N - 1) / 2

print(modSum)

Submission status: Wrong Answer

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

n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(p)

Submission status: Wrong Answer

Solution code:
N = int(input())

M = 0

M = (1 + N) * (N/2)

M = M - N

print(int(M))

Submission status: Wrong Answer

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

n = int(input())

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

print(a)

Submission status: Wrong Answer

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

print(int(output))

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = n/2*(n-1)

print(int(ans))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
sum_ = (1/2)*N*(N+1)
print(int(sum_ - N))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(result)

Submission status: Wrong Answer

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

sum = 0

if N == 1:
  print(0)
else:
  for i in range(N):
    sum += i

print(sum)

Submission status: Wrong Answer

Solution code:
num = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import queue

mod = 1e9+7

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a):
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def main():
    n = int(input())
    ans = n*(n+1)/2-n
    print(int(ans))
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(output)

Submission status: Wrong Answer

Solution code:
def solve(N):
    return int(N * (N - 1) / 2)


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

    answer = solve(N)
    print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

sum = 0

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

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

# per = list(permutations(range(1,n+1),n))

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

Submission status: Wrong Answer

Solution code:
from math import factorial

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

if __name__ == "__main__":
    main()

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())

neko=int(n/2)

ans=neko*(n-1)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N = int(input())

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(4100000)


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


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


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


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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

N -= 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())


ans = n * (n-1) / 2


print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

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

print(x)

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

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

Submission status: Wrong Answer

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

n = int(input())

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

print(a)

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:

N=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

m = N-1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math

n = int(stdin.readline().rstrip())

ans = 0

ans = math.floor(n*(n-1)/2)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
n = float(input())

n-=1.0

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


print(int(ret))

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(int(record))