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: Runtime Error

Solution code:
N = int( input() )

R = list(range(1,N+1))
L = list(range(1,N+1))

if N==1:

    print(0)

elif N==2:

    print(1)


else:
    R.insert(len(R)-1,R.pop(1))


    print(sum(list(map(lambda x,y: x % y,L,R))))

Submission status: Runtime Error

Solution code:
n = int(input())
print(sum(list(range(n))))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
count = 0
for i in range(1, N+1):
  if i == 1:
    P = N
  else:
    P = n - 1
    
  count += i % P
  
print(count)N = int(input())
count = 0
for i in range(1, N+1):
  if i == N:
    P = 1
  else:
    P = i + 1
    
  count += i % P
  
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main(){
    long long N;
    cin >> N;
    cout << N * (N - 1) / 2 << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
x = int(input())
def total(n):
    if n < 1:
        return 0
    
    return n + total(n-1)

print(total(x-1))

Submission status: Runtime Error

Solution code:
n = int(input())
def total(x):
  if x == 0:
    return 0
  else:
    return total(x-1) + x
print(total(n-1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:


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



if __name__ == "__main__":
  main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# import itertools

num = int(input())

# 実は[5,1,2,3,4]のようにずらしたのが一番でかくなるのでは？
tgt_list = list(range(num+1))[1:]
tgt_list.insert(0, tgt_list.pop(num-1)) # [1,2,3,4] -> [4,1,2,3]

rtn = 0
for i, v in enumerate(tgt_list):
  rtn += v % (i+1)
  
print(rtn)


# 下記は全通りを調べるが、処理が長すぎてエラーになるのでボツ。
# for v_list in itertools.permutations(range(num+1)[1:]):
#   tmp = 0
#   for i, v in enumerate(v_list):
#     tmp += v % (i+1)
#   rtn = max(rtn, tmp)
#   if (rtn == tmp):
#     print(v_list)
#     print(tmp)   
# print(rtn)

Submission status: Runtime Error

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

xs = list(range(N))

print(sum(xs))

Submission status: Runtime Error

Solution code:

import math
N = int(input())

sum = list(range(2,N))

print(sum)

Submission status: Runtime Error

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

sum = list(range(N))

print(sum)

Submission status: Runtime Error

Solution code:
N = list(range(1,int(input())))
print(sum(N))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
res = sum(list(range(N)))
print(res)

Submission status: Runtime Error

Solution code:
N = long(input())

print(long(N*(N-1)*0.5))

Submission status: Runtime Error

Solution code:
a = list(input())
ans = sum(a) - max(a)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools

N = int(input())

NUMBERS = list(itertools.permutations(range(N)))
ret = 0
for numbers in NUMBERS:
  sum = 0
  for num,i in zip(numbers,range(N)):
    sum += (num+1)%(i+1)
  ret = max(ret,sum)

print(ret)

Submission status: Runtime Error

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

init = list(range(1, N+1))
all = []
hashtable = {}
tempSum = 0


def helper(input):
    global tempSum, max
    if len(input) == N:
        # print(input)
        if tempSum > max:
            max = tempSum
        return

    for i in range(1, N+1):
        if i not in input:
            input.append(i)
            tempSum += len(input) % i
            # print(tempSum, len(input), i)
            helper(input)
            input.pop()
            tempSum -= len(input) % i


list = []
helper(list)

print(max)

Submission status: Runtime Error

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

init = list(range(1, N+1))
all = []


def helper(input):
    if len(input) == N:
        all.append([i for i in list])
        return

    for i in range(1, N+1):
        if i not in input:
            input.append(i)
            helper(input)
            input.pop()


list = []
helper(list)

for i in all:
    sum = 0
    for j in range(N):
        sum += i[j] % (j+1)
    if sum > max:
        max = sum

print(max)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(range(1, N + 1))
M = list(range(2, N + 1))
n = 0
for a in range(0, N - 1):
    n = n + (S[a] % M[a])
print(n)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
r = range(N)
#print(r)
l = list(r)
#print(l)

if N == 1:
  print(1)
else:
  print(sum(l))

Submission status: Runtime Error

Solution code:
N = int(input())
r = range(N)
print(r)
l = list(r)
print(l)

if N == 1:
  print(1)
else:
  print(sum(l))

Submission status: Runtime Error

Solution code:
a = int(input())
  c=0
for i in range(a)
  c = i+c
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def print_kaijou(k):
    print(str(int(k*(k+1)/2)))

n = int(input())


    
print_kaijou(n-1):

Submission status: Runtime Error

Solution code:
from itertools import product, permutations,combinations
#from operator import itemgetter
#from bisect import bisect_left,bisect
#from heapq import heappop,heappush
#from fractions import gcd
#from math import ceil,floor,sqrt,cos,sin,pi
#from copy import deepcopy
import numpy as np

N = int(input())

# 元配列を生成
N_array = np.arange(1,N+1, dtype=np.int)

# 順列を生成
per = list(permutations(N_array))

# count配列を生成
count = np.zeros(len(per), dtype=np.int)


for i in range(len(per)):
	for j in range(len(per[i])):
		rem = N_array[j] % per[i][j]
		count[i] += rem

print(count.max())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8

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

Submission status: Runtime Error

Solution code:
n = input()
answer = 0
for i in range(1, n):
	answer += i

print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(range(n))
ans = sum(a)+1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())


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

Submission status: Runtime Error

Solution code:
S=long(input())
#N=list(map(int,input().split()))

ans=long((S-1)*S/2)

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(range(1, n))
print(sum(a))

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(range(1, n))
print(sum(map(lambda n: n % (n+1), a)))

Submission status: Runtime Error

Solution code:
N = int(input())
pre = list(range(1,N+1))
new = pre[:]
a0 = new[0]
new.remove(a0)
new.append(a0)

val = 0
for i in range(N):
    val += pre[i] % new[i]

print(val)

Submission status: Runtime Error

Solution code:
N = int(input())
pre = list(range(1,N+1))
new = pre[:] 
new.remove(a0)
new.append(a0)

val = 0
for i in range(N):
    val += pre[i] % new[i]

print(val)

Submission status: Runtime Error

Solution code:
N = int(input())

NL = []
PL = []
ans = 0

if N < 10:
  for i in range(N):
    NL.append(i+1)
    PL.append(i+2)
else:
  NL = list(range(1, N+1))
  PL = list(range(2, N+2))
PL[N-1] = 1

for i in range(N):
  ans += NL[i] % PL[i]

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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())
p=list(range(2,n))
if n ==1:
    print(0)
elif n == 2:#なぜ？
    print(1)
else:
    print(n*(n-1)//2)

Submission status: Runtime Error

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())
p=list(range(2,n))
if n ==1:
    print(0)
elif n == 2:
    print(0)
else:
    print(n*(n-1)//2)

Submission status: Runtime Error

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())
p=list(range(2,n))
if n ==1:
    print(0)
else:
    print(n*(n-1)//2)

Submission status: Runtime Error

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())
p=list(range(2,n))
if n ==1:
    print(0)
else:
    print(n*(n-1)/2)

Submission status: Runtime Error

Solution code:
def resolve():
    N = int(input())
    num = list(range(1,N))
    ans = sum(num)
    print(ans)
resolve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
ulong MOD = 1_000_000_007;
ulong INF = 1_000_000_000_000;
ulong MIDDLE = 100_000;
alias Pair = Tuple!(long, "flag", long, "num");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto n = lread();
    iota(n).sum.writeln();
}

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
ans = (pow(n,2) - n) / 2
if not n 2:
  print(int(ans))
else:
  print(2)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
n=int(input)

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

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(range(1,N+1))
print(sum(P[0:N-1])+P[-1]%P[0])

Submission status: Runtime Error

Solution code:
N = int(input())
for i in range(1,N):
  ans += ans + i
print(ans)

Submission status: Runtime Error

Solution code:
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)
    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

Submission status: Runtime Error

Solution code:
    # -*- coding: utf-8 -*-
def main():
    N = int(input())
    H = list(map(int,input().split()))
    cnt = 0
    flg = 0
    for i in range(N):
        if cnt >= N-i:
            print(cnt)
            return
        if flg!=0:
            if i==flg:
                flg=0
            else:
                continue
        tmp=0
        for j in range(i,N-1):
            if H[j]>=H[j+1]:
                tmp+=1
            else:
                flg=j+1
                # if cnt >= N-j+1:
                #     print(cnt)
                #     return
                break
        if cnt < tmp:
            cnt=tmp
    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a =int(input())
b = range(1,a+1)
b = list(b)
print(sum(b)-b[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import time
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
def is0(num):
    if num==0:
        time.sleep(10)
    else:pass
is0(H_list[0])

Submission status: Runtime Error

Solution code:
import time
N=int(input())
H_list=[int(thing) for thing in input().split(" ")]
def is0(num):
    if num==0:
        time.sleep(3)
    else:pass

Submission status: Runtime Error

Solution code:
N = int(input())
Ns = list(range(1, N+1))
NNs = Ns[1:N+1] + [1]
s = 0
for i, k in zip(Ns, NNs):
  s += i%k
  
print(s)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000000)
N = int(input())
candi =int((N+1)/2*N -N)
def f(count,i):
    if i == 2:
        return count +1
    nex_num = (i//2) + 1
    count += (i%nex_num) 
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    return f(count,nex_num)

def f2(count,i):
    if i == 1:
        return count
    nex_num = (i+1)//2
    count += (i%nex_num)
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    return f2(count,nex_num)

if N%2 == 0:
    nex_num = N
    count = f(0,nex_num)
else:
    nex_num = N
    count = f2(0,nex_num)
print(count)
'''
if candi > count:
    print(candi)
else:
    print(count)
'''

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

n=int(input())
if n==1:
    print(0)
else:
    plist=list(range(1,n+1))
    qlist=list(range(2,n+1))
    qlist.append(1)
    parray=np.array(plist)
    qarray=np.array(qlist)
    rarray=parray%qarray
    sm=rarray.sum()
    print(sm)

Submission status: Runtime Error

Solution code:
print(list(map(lambda N: ((N-1)*N)//2, int(input())))[0])

Submission status: Runtime Error

Solution code:
n = int(input())
print(round(format((n)*(n-1)/2,"f")))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000000)
N = int(input())
candi =int((N+1)/2*N -N)
def f(count,i):
    if i == 2:
        return count +1
    nex_num = (i//2) + 1
    count += (i%nex_num) 
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    return f(count,nex_num)

def f2(count,i):
    if i == 0:
        return count
    nex_num = (i+1)//2
    count += (i%nex_num)
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    return f2(count,nex_num)

if N%2 == 0:
    nex_num = N
    count = f(0,nex_num)
else:
    nex_num = N
    count = f2(0,nex_num)
if candi > count:
    print(candi)
else:
    print(count)

Submission status: Runtime Error

Solution code:
#include<cstdio>
using namespace std;
main()
{
  int n;
  scanf("%d",&n);
  printf( "%d\n",n*(n-1)/2);
  return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
s = 0
Ns = list(range(1, N + 1))
NNs = Ns[1:N+1] + [1]
for i, k in zip(Ns, NNs):
  s += i%k
  
print(s)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000000)
N = int(input())
candi =int((N+1)/2*N -N)
def f(count,i):
    nex_num = (i//2) + 1
    count += (i%nex_num) 
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 2:
        return count +1
    return f(count,nex_num)

def f2(count,i):
    nex_num = (i+1)//2
    count += (i%nex_num)
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 0:
        return count
    return f2(count,nex_num)

if N%2 == 0:
    nex_num = N
    count = f(0,nex_num)
else:
    nex_num = N
    count = f2(0,nex_num)
if candi > count:
    print(candi)
else:
    print(count)

Submission status: Runtime Error

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from math import log10

n = int(input())
ans = log10(n) + log10(n-1) - log10(2)
print(round(10**ans))

Submission status: Runtime Error

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))
    ans = np.sum(np.arange(start=1, step=1, stop=N))
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def get_max(n):
    if n==1:
        return 0
    if n % 2 == 0:
        return (n/2+(n-1))*n/2/2-1 + get_max((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: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(1000000000)
N = int(input())
candi =int((N+1)/2*N -N)
def f(count,i):
    nex_num = (i//2) + 1
    count += (i%nex_num) 
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 2:
        return count +1
    return f(count,nex_num)

def f2(count,i):
    nex_num = (i+1)//2
    count += (i%nex_num) 
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 1:
        return count
    return f2(count,nex_num)

if N%2 == 0:
    nex_num = N
    count = f(0,nex_num)
else:
    nex_num = N
    count = f2(0,nex_num)
if candi > count:
    print(candi)
else:
    print(count)

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
candi =int((N+1)/2*N -N)
import sys
sys.setrecursionlimit(1000000000)
def f(count,i):
    nex_num = (i//2) + 1
    count += (i%nex_num) #next_numを割るところに使う
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 2:
        return count +1
    return f(count,nex_num)

def f2(count,i):
    nex_num = (i+1)//2
    count += (i%nex_num) #next_numを割るところに使う
    middle_sum = int((i-1 + nex_num )/2*(i -nex_num))
    count += middle_sum
    nex_num = nex_num -1
    if nex_num == 1:
        return count
    return f2(count,nex_num)

if N%2 == 0:
    nex_num = N
    count = f(0,nex_num)
else:
    nex_num = N
    count = f2(0,nex_num)
if candi > count:
    print(candi)
else:
    print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

ans =  N(N-1)/2

print(int(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

Solution code:
n = int(input())

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

print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from decimal import Decimal

import math
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
p = li[0]
d = li[0][0]**2 + li[0][1]**2
for i in range(1,n):
  if (p[0]+li[i][0])**2 + (p[1]+li[i][1])**2 > d:
    p = [p[0]+li[i][0],p[1]+li[i][1]]
    d = p[0]**2 + p[1]**2
distance = p[0]**2 + p[1]**2

print(math.sqrt(distance))

Submission status: Runtime Error

Solution code:
N = int(input())

P = [0]*N
M = [0]*N
for i in range(1, N):
  P[i] = i 
  M[i] = (i + 1) % P[i]
M[1] = 0  
print(sum(M))

Submission status: Runtime Error

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())
p=list(range(2,n))
if n ==1:
    print(0)
else:
    print(sum(p)+1)

Submission status: Runtime Error

Solution code:
N = int(input())

Ns = range(1, N + 1)
for i, k in zip(Ns, Ns[::-1]):
  s+=i%k
  
print(s)

Submission status: Runtime Error

Solution code:
from itertools import permutations
n=int(input())
def all_perms(elements):
    if len(elements) <=1:
        yield elements
    else:
        for perm in all_perms(elements[1:]):
            for i in range(len(elements)):
                # nb elements[0:1] works in both string and list contexts
                yield perm[:i] + elements[0:1] + perm[i:]
s=[i for i in all_perms([*range(1,n+1)])]
x=s[n-1]
result=0
p=1
for i in x:
  result+=p%i
  p+=1
print(result)

Submission status: Runtime Error

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)
      if N %2 == 1:
        bol = (a % ((N+1)/2) >= a)
        ans += np.sum((a % ((N+1)/2)[bol] - a[bol]))
      else:
        bol = (a % (N/2) >= a)
        ans += np.sum((a % (N/2)[bol] - a[bol]))
    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy as np

n=int(input())
plist=list(range(1,n+1))
qlist=list(range(2,n+1))
qlist.append(1)
parray=np.array(plist)
qarray=np.array(qlist)
rarray=parray%qarray
sm=rarray.sum()
print(sm)

Submission status: Runtime Error

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: Runtime Error

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)
      if N %2 == 1:
        bol = (a % ((N+1)/2) >= a)
        ans += np.sum((a % ((N+1)/2)[bol] - a[bol]))
      else:
        bol = (a % (N/2) >= a)
        ans += np.sum((a % (N/2)[bol] - a[bol])
    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)

    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

Submission status: Runtime Error

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)
      if N %2 == 1:
        bol = (a % ((N+1)/2) >= a)
        ans += np.sum((a % ((N+1)/2)[bol] - a[bol]))
      else:
        bol = (a % (N/2) >= a)
        ans += np.sum((a % (N/2)[bol] - a[bol]))

    print(int(ans))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import random


N = int(input())
P = list(range(1, N))
max = 0

for i in range(1000):
  sum = 0
  k = 0
  random.shuffle(P)
  for j in P:
    M = k % j
    sum += M
    k += 1
  if max < sum:
    max = sum

print(max)

Submission status: Runtime Error

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

Submission status: Runtime Error

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())
import numpy as np
p=np.arange(2,n)
if n ==1:
    print(0)
else:
    print(sum(p)+1)