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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n = I()
    r = (n-1) * n // 2

    return r


print(main())

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


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

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

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

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

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


if __name__ == "__main__":
    main()

Solution (Python):


from collections import deque, defaultdict
import itertools as ite
import sys
import math
import re

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()

print N * (N - 1) / 2

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

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

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

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

Solution (Python):
rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())


def solve(N):
    return N*(N+1)/2 - N

print solve(rri())

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n = getN()

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

Solution (Python):
import sys

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

    return 0

if __name__ == "__main__": solve()