Problem:


Score : 400 points

Problem Statement

For an integer N, we will choose a permutation \{P_1, P_2, ..., P_N\} of \{1, 2, ..., N\}.

Then, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.

Find the maximum possible value of M_1 + M_2 + \cdots + M_N.

Constraints

N is an integer satisfying 1 \leq N \leq 10^9.

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum possible value of M_1 + M_2 + \cdots + M_N.

Sample Input 1

2

Sample Output 1

1

When the permutation \{P_1, P_2\} = \{2, 1\} is chosen, M_1 + M_2 = 1 + 0 = 1.

Sample Input 2

13

Sample Output 2

78

Sample Input 3

1

Sample Output 3

0



Sample input:
2


Sample output:
1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

print(int(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"

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 main():
    N=float(I())
    print(int((N-1)*(N)//2))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = np.int64(input())
    ans = np.int64((1 + (N - 1)) / 2 * (N - 1))
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = x*n
print(int(a/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2==0:
  print('{:.20g}'.format((n/2)*(n-1)))
else:
  print('{:.20g}'.format(n*((n-1)/2)))

Submission status: Wrong Answer

Solution code:
from decimal import *

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

Submission status: Wrong Answer

Solution code:
N = float(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())

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


print(int(ans))

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

if __name__ == '__main__':
    main()

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans=0
a = N-1
ans = (a*(a+1))/2
# for i in range(1,N+1):
#     s += i-1
print(int(ans))

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

print(sum)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans =  N*(N-1)/2

print(int(ans))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math

if __name__ == "__main__":
    N = int(input())
    a = int((1/2)*(N-1)*N)
    b = math.floor(N/2)+1
    c = a-(b-1)+(N%b)
    print(a if a>c else c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

ans = int(((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())

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

print(int(ans))

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

print(output)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans=0
a = N-1
ans = (a*(a-1))/2
# for i in range(1,N+1):
#     s += i-1
print(ans)

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

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=float(input())
res=0.5*N*(N-1)
print(int(res))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def main():
    N = int(input())
    print(int(get_max(N)))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

print(output)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    ans = np.sum(N-1)
    print(ans)
if __name__ == '__main__':
    main()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math

if __name__ == "__main__":
    N = int(input())
    a = int((1/2)*(N-1)*N)
    b = math.floor(N/2)+1
    c = a-N+(N%b)
    print(a if a>c else c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
import numpy as np
N = int(input())
print(int((N-1)*N/2))

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N= int(input())

n= N-1

sum = (n*N)/2

print(int(sum))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def main():
    N = int(input())
    print(int(get_max(N)))


if __name__ == '__main__':
    main()

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

# Output
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

SUM=0
if N%2==1:
    SUM=float(N/2)*(N-1)
else:
    SUM=(float((N-1)/2))*(N-2)+(N-1)


print(int(SUM))

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

target += N % 1
print(target)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 10 * 9:
    print(500000000500000000)
elif n % 2:
    print(int((1 + n-1) * ((n-1) / 2)))
else:
    print(int((1 + n-1) * ((n-1) // 2) + -(-n // 2)))

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:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    ans = 0
elif n == 2:
    ans = 1
elif n > 2:
    ans = (n+1)*(n-2)//2 + n%2

print(ans)

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:
from sys import stdin
n = int(stdin.readline().rstrip())
li = [p for p in range(1,n)]
if n == 1:
    print(0)
else:
    if n%2 == 0:
        print((li[0]+li[-1])*(n//2)+n//2+1)
    else:
        print((li[0]+li[-1])*(n//2))

Submission status: Wrong Answer

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

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())
a = 10

if n == 1:
    print(0)
elif n == 2:
    print(1)
elif n == 3:
    print(2)
elif n == 4:
    print(5)
elif n == 5:
    print(10)
else:
    for i in range(6,n+1):
        a += i-1
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = int(input())
total=0
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())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools
import numpy as np

#N = 2
N = int(input())
a = [i for i in range(1, N+1)]

if N%2 == 0:
    b = a[N:N//2-1:-1]+a[:N//2]
else:
    b = a[N:N//2:-1]+a[:N//2+1]
a = np.array( [i for i in range(1, N+1)])
b = np.array(b)
c = b%a
print(np.sum(c))

Submission status: Wrong Answer

Solution code:
N=int(input())

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


print(int(SUM))

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] = int(sum)
print(b[0])

Submission status: Wrong Answer

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

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

ind_max=0

for _ in range(150000):
  B = [i+1 for i in range(N)]
  random.shuffle(B)
  ind = 0
  for i in range(N):
    ind += (A[i] % B[i])
  if ind_max < ind:
    ind_max = ind
print(ind_max)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans=0
ans = (N*(N-1))/2
# for i in range(1,N+1):
#     s += i-1
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 = n * -1
    ans += (n + 1) * (n / 2)
else:
    ans = 1
    ans -= n
    ans += (n + 2) * int(n / 2)

# Output
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = 10

if n == 1:
    print(0)
elif n == 2:
    print(1)
elif n == 3:
    print(2)
elif n == 4:
    print(5)
elif n == 5:
    print(10)
else:
    for i in range(6,n):
        a += i-1
print(a)

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

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-1:
  sum = (sum - max_i-1) + max_mod

print(int(sum))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

def tosa(m):
  return int(m * (m+1) * 0.5)

result = 0
max_result = 0

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

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

a = x*n
print(int(a/2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#-*- coding: utf-8 -*-
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)



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

Submission status: Wrong Answer

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


print(result)

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(1,_):
    base += i
  
  base_str = str(base)
  base_str = base_str[:1] + base_str[1] + base_str[1:-2] + base_str[-2]*2 + base_str[-1]
  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:-2] + base_str[-2]*3 + base_str[-1]
  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:-2] + base_str[-2]*4 + base_str[-1]
  ans = int(base_str)

else:
  ans = 499999999500000000
  
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(int(n_sum-n))

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:
# -*- 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*0.5)

    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())
a = N/2*0.0001
b = (N-1)*0.0001
print(int(a*b*100000000))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    ans = 0

elif n == 2:
    ans = 1

elif n == 3:
    ans = 4

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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
  if n <= 6:
    return n
  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:
import sys
input = sys.stdin.readline
from collections import deque
from collections import defaultdict
from copy import deepcopy

N = int(input())
A = []
for i in range(N):
    A.append(deque([int(item) for item in input().split()]))

current = defaultdict(lambda: 0)
pre = {}
day = 0
while sum([len(row) for row in A]) > 0:

    day += 1
    for n in range(N, 0, -1):
        if current[n] == 0:
            if len(A[n - 1]) > 0:
                current[n] = A[n - 1].popleft()

        pair = current[n]
        if pair > n and current[pair] == n:
            current.pop(n)
            current.pop(pair)

    if current == pre and current != {}:
        print(-1)
        break

    pre = deepcopy(current)
else:
    print(day)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

mod = (N-1)*N/2

print(mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
n -= 1
print(int(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:
# 2019/09/01
# AtCoder Beginner Contest 139 - D

# Input
n = int(input())

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

# Output
print(ans)