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: Accepted

Solution code:
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())

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
import sys

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

    return 0

if __name__ == "__main__": solve()

Submission status: Runtime Error

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

print(sum(n))

Submission status: Runtime Error

Solution code:
from functools import lru_cache

@ lru_cache(maxsize = None)
def sum(n):
  if n <= 0:
    return n
  return n + sum(n-1)
  
n = int(input())-1

print(sum(n))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(range(1,N+1))
B = list(range(2,N+1))+[1]
ans = 0
for i in range(N):
  ans+=A[i]%B[i]
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
tmp = np.array(range(1, N, 1))
print(sum(tmp))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import heapq


input = sys.stdin.readline
n = int(input())
n_list = list(range(1,n))
print(sum(n_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n = int(input())
    if n == 1: print(0); exit()
    k = list(range(1, n+1))
    list1 = [i+1 for i in range(2, n)]
    a = [1] + list1[:] + [2]
    b = [2] + list1[:] + [1]
    ans = 0
    for row in (a, b):
        r = 0
        for x, y in zip(k, row):
            r += x % y
        ans = max(ans, r)
    print(ans)



main()

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

temp = np.linspace(1, N-1, N-1)
answer = np.cumsum(temp)

print(int(answer[-1]))

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())

temp = np.linspace(1, N, N)
re_temp = np.linspace(2, N, N-1)
re_temp = np.append(re_temp, 1)

answer = (temp % re_temp).sum()
print(int(answer))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
P = list(range(1, N+1))

M = []
for i in range(1, N+1):
    m = list(map(lambda x : i%x, P))
    #print(m)
    M.append(max(m))
    #print(m.index(max(m)))
    del P[m.index(max(m))]
print(sum(M))

Submission status: Runtime Error

Solution code:
N = int(input())
P = list(range(1, N+1))

M = []
for i in range(1, N+1):
    m = [i%x for x in P]
    M.append(max(m))
    del P[m.index(max(m))]
print(sum(M))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ans := 0
	for i := 1; i < n; i++ {
		ans += i
	}

	fmt.Println(ans)
}

Submission status: Runtime Error

Solution code:
n = int(input())
ans = 0
if n <= 1000:
	for i in range(n):
		ans += i
else:
	for j in range(500500,n):
		ans += i
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
N=[0]*(n+1)
result=0
for i in range(1,n+1):
  N[i]=i
for i in range(2,len(N)):
  result+=N[i-1]%N[i]
print(result)

Submission status: Runtime Error

Solution code:
n1=[*range(1,int(input())+1)]
n2=n1[1:]+[n1[0]]
count=0
for i in range(len(n1)):
  count+=n1[i]%n2[i]
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def resolve():
    N = int(input())
    ary = [N] + list(range(1, N))
    print(N*(N-1)//2)



if '__main__' == __name__:
    resolve()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

N = int(input())
l = list(range(2, N + 1)) + [1]
print(sum([i % x for i, x in enumerate(l, start=1)]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

nums = list(range(1,n+1))
print(sum(nums)-n)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

nums = list(range(1,n+1))
print(sum(nums[:-1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

print(sum(n))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())

ans = list(range(1,n))

print(sum(ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    print(sum(list(range(1, n))))
        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

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

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    p = list(range(1,n+1))
    q = p[1:]
    q.append(p[0])
    s = 0
    for i, v in enumerate(q):
        s += (i+1) % v
    print(s)

if __name__ == "__main__":
    main()

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:
print(sum(list(range(int(input())))))

Submission status: Runtime Error

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

print(sum(my_list))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import deque
n = int(input())
li = list(range(1,n+1))
q = deque(li)
q.rotate(-1)
count = 1
ans = 0
for q_i in q:
    ans += count % q_i
    count += 1
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
print((np.arange(N-1) + 1).sum())

Submission status: Runtime Error

Solution code:
N=int(input())
dp=[0]*(N)
for i in range(1,N):
  dp[i] += dp[i-1]+i
print(dp[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

# In[8]:


P = int(input())


# In[10]:


i_list = list(range(1, P+1))
p_list = i_list[1:]
p_list.append(i_list[0])

# print(i_list, p_list)

ans = 0
for i in range(P):
    ans += i_list[i]%p_list[i]
print(ans)


# In[ ]:

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i
print(sum(r) + (n - 1))

Submission status: Runtime Error

Solution code:
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i + 1
print(sum(r))

Submission status: Runtime Error

Solution code:
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = (i + 1) % (i + 2)
print(sum(r))

Submission status: Runtime Error

Solution code:
n = int(input())
p = [1] * n
q = [1] * n
r = [0] * n
for i in range(n):
  p[i] = i + 1
  q[i] = p[i] + 1
  r[i] = p[i] % q[i]
r[-1] = 0
print(sum(r))

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np 
def main():
    A = np.arange(1, int(readline()), dtype=np.int64)
    print(A.sum())
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S=int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
N=int(input())

N_sum=list(range(N))
print(sum(N_sum))

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

int main()
{
    long long n;
    scanf("%lld",&n);
    printf("%lld\n",n*(n-1)/2);
    return 0;
}

Submission status: Runtime Error

Solution code:
N = int( input() )
 
I = range( 1, N + 1 )
P = [ i for i in range(2, N + 1) ] + [ 1 ]
 
cnt = 0
for i in range( N ):
  cnt =　cnt + I[ i ] % P[ i ]

print( cnt )

Submission status: Runtime Error

Solution code:
def main():
    import numpy as np
    
    N = int(input())
    
    s = np.linspace(1, N-1, N-1)
    res = np.sum(s)

    print(int(res))
    
main()

Submission status: Runtime Error

Solution code:
def main():
    import numpy as np
    
    N = int(input())
    
    s = np.linspace(1, N, N)
    res = np.sum(s) - np.max(s)

    print(int(res))
    
main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
from io import StringIO
import unittest

def resolve():
    n = int(input())

    print(sum(list(range(n + 1))) - n)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
print(np.arange(1, n).sum())

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = np.arange(1, n + 1)
b = np.hstack((np.arange(2, n + 1), 1))
print(np.sum(a % b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
r=input()

c=0
for i in range(1,n):
  if r[i-1]==r[i]:
    c+=1
  
print(min(n-1,c+2*k))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

print(sum(list(range(1, N))))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
print(sum(list(range(1, n))) if n != 0 else 0)

Submission status: Runtime Error

Solution code:
import numpy as np

N=int(input())
print(np.arange(1,N).sum())

Submission status: Runtime Error

Solution code:
import numpy as np

N=int(input())
print(np.arange(1,N-1).sum())

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""

import numpy as np

N = int(input())
arr = np.arange(1, N + 1)
t_arr = np.append(arr[1:], arr[0])
print(sum(arr % t_arr))


# def main():


# if __name__ == '__main__':
#     main()

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""

import numpy as np

N = int(input())
arr = np.arange(1, N + 1)
t_arr = np.append(arr[1:], arr[0])

mod_arr = arr % t_arr
print(sum(mod_arr))


# def main():


# if __name__ == '__main__':
#     main()

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    n = int(input())
    print(sum(list(range(1, n + 1))) - n)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int main()
{
    ll n;
    cin >> n;
    cout << (n - 1) * n / 2 << endl;

    return 0;
}

Submission status: Runtime Error

Solution code:
from sys import stdin

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

def solve(n):
    for i in range(n):
        ans += i
    return ans

print(solve(n))

Submission status: Runtime Error

Solution code:
from sys import stdin

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

from numba import njit

@njit
def solve(n):
    for i in range(n):
        ans += i
    return ans

print(solve(n))

Submission status: Runtime Error

Solution code:
n = int(input())

ans = 0

l = list(range(1,n))
l.insert(0, n)

for i,x in enumerate(l):
    ans += x % (i+1)

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
l = list(range(1, N+1))

ans = 0
for i in range(N):
  if i == N-1:
    ans += l[i] % 1
  else: ans += l[i] % (l[i] + 1)
print(ans)

Submission status: Runtime Error

Solution code:
print(int(input())*(int(input())-1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math 
import bisect
import heapq
from collections import deque

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
n = int(input())
d, m = divmod(n,2)
if m != 0
    print(n*d)

else:
    print(n*(d - 1) + d)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
print(np.sum(np.arange(n)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
n = list(range(N))

import numpy as np
print(sum(np.array(n)) % np.array(n[::-1]))

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
n = int(input())

print(sum(list(range(n))))

Submission status: Runtime Error

Solution code:
n = int(input())

p = list(reversed(list(range(1,n+1))))

r = set(range(1,n+1))

m = []

for i in range(n):
    f = True
    a = 1
    b = 1
    while f:
        while (a*p[i]-b)<=n and f:
            if a*p[i]-b in r:
                r.remove(a*p[i]-b)
                m.append((a*p[i]-b)%p[i])
                f = False
                break
            a += 1
        b += 1

print(sum(m))

Submission status: Runtime Error

Solution code:
n=int(input())
total=0
l = list(range(2,n+1)) + [1]
for i in range(n):
  total+=(i+1)%l[i]
print(total)

Submission status: Runtime Error

Solution code:
n=int(input())
total=0
l = list(range(2,n+1)) + [1]
for i in range(n):
  total+=(i+1)%l[i]
print(total)

Submission status: Runtime Error

Solution code:
N=int(input())
import numpy as np
x = np.arange(N+1)
print(np.sum(x)-N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(sum([int(i) for i in range(N)]))

Submission status: Runtime Error

Solution code:

N = int(input())
L = list(range(1, N))

from functools import reduce
from operator import add

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

print(reduce(add, L))

Submission status: Runtime Error

Solution code:
a=int(input())

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

Submission status: Runtime Error

Solution code:

N = int(input())

X = list(range(1, N+1))
Y = X[:]
Y.append(Y.pop(0))

ans = 0
for i in range(N):
  ans += X[i] % Y[i]

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(range(1, n+1))
p = list(range(2, n+1)) + [1]
m = 0
for i in range(n):
  m += a[i] % p[i]
print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

def solve(n):
    n = list(range(1, n))
    return sum(n)


N = int(input())

print(solve(N))

Submission status: Runtime Error

Solution code:
n = int(input())

a = list(range(1, n+1))
ans = 0
for i in range(n):
    ans += a[i] % a[(i+1)%n]

print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

a = list(range(1, n+1))
b = a[1:] + [a[0]]

ans = 0
for i, j in zip(a, b):
    ans += (i % j)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

if N == 1:
    print(0)

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

Submission status: Runtime Error

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
if N >1:
    sum = N*(N-1)/2
elif N = 1:
    sum = 1
else:
    sum = 0
sum = int(sum)
print(sum)

Submission status: Runtime Error

Solution code:
a=int(input())
b=[0]*a

for i in range(a):
    b[i]=i+1
print(sum(b)-b[-1])

Submission status: Runtime Error

Solution code:
n=int(input())
ans=0
for i in range n:
  ans+=i
print(ans/2)

Submission status: Runtime Error

Solution code:
ans=0
for i in range(N-1):
  ans=ans+i+2
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=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(sum(list(range(1,N))))

Submission status: Runtime Error

Solution code:
modsum = 0
for i in range(N-1):
    # print(i + 1)
    # print(divisor)
    modsum += (i + 1) % (i +2)
    
print(modsum)

Submission status: Runtime Error

Solution code:
import sys
import numpy as np

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def MAP(): return [int(s) for s in input().split()]

n = int(input())
if n==1:
	print(0)
	sys.exit()

N = list(range(1,n))
print(np.cumsum(N)[-1])

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
l = np.zeros(n)
for i in range(n):
    l[i] = i + 1
#print(l)

l2 = np.zeros(n)
for i in range(n):
    if l[i] == l[-1]:
        l2[i] = l[i] % l[0]
        continue
    l2[i] = l[i] % l[i + 1]
p = int(sum(l2))
print(p)

Submission status: Runtime Error

Solution code:
n = int(input())
m = list(range(1, n+1))

print(sum(m)-m[-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
m = 0
p = list(range(2, n + 1)) + [1]
for i, pi in enumerate(p):
  m += (i + 1) % pi
print(m)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import heapq
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')

N = L()
ans = int(0)

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

Submission status: Runtime Error

Solution code:
a = input()
b=a-1

d=(a*b)/2

print(d)

Submission status: Runtime Error

Solution code:
N = int(input())

num_list = range(1, N + 1)

def mod_sum(num_list, div_list):
    res = 0
    for i in range(N):
        res += num_list[i] % div_list[i]

    return res


div_list = list(num_list[1:])
div_list.append(num_list[0])

print(mod_sum(num_list, div_list))

Submission status: Runtime Error

Solution code:
N=int(input())

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

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
n = int(input)

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

Submission status: Runtime Error

Solution code:
print(sum(range(int(input())))

Submission status: Runtime Error

Solution code:
import copy

print(sum(B))

A = []

for i in range(0, N):
    A.append(i)
    
B = copy.deepcopy(A)
del B[0:1]

print(sum(B))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = ii()

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

Submission status: Runtime Error

Solution code:
n = ii()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
a_L = list(range(1,n+1))
a_L.pop()

print(sum(a_L))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
a = np.array(range(1,n+1))
b = np.array([a[(i+1)%n] for i in range(n)])
sum(a%b)import numpy as np
n = int(input())
a = np.array(range(1,n+1))
b = np.array([a[(i+1)%n] for i in range(n)])
print(sum(a%b))

Submission status: Runtime Error

Solution code:
n = int(input())

ans = 0
for i in range(len(n)):
  ans += i
  
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())

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

Submission status: Runtime Error

Solution code:
N = int(input())

P = [0] * N

for i in range(0, N):
    P[i] = i

print(sum(P))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())

list = list(range(N))

print(sum(list))

Submission status: Runtime Error

Solution code:
N = int(input())

list = list(range(1, N))

print(sum(list))

Submission status: Runtime Error

Solution code:
n = int(input())
p = list(range(2, n+1))
p.append(1)
sum = 0
for i in range(n-1):
    sum += (i+1) % p[i]
print(sum)

Submission status: Runtime Error

Solution code:
N = int(input())
P0=list(range(N+1))
P = P0[1:]
ans = 0
for (i,j) in enumerate(P):
    ans += (i+1) % (j+1)
print(ans-P[N-1])

Submission status: Runtime Error

Solution code:
N = int(input())
P0=list(range(N+1))
P = P0[1:]
ans = 0
I=P.copy()
for i in range(N):
    ans += I[i] % (P[i]+1)
print(ans-P[N-1])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(void){
    int N;
    int count = 0;
    cin >> N;
    cout << (int)(((N-1)*(1 + N-1))/2) << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
array = np.arange(N)
print(sum(array))

Submission status: Runtime Error

Solution code:
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """2"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13"""
        output = """78"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    unittest.main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

N = int(input())

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

Submission status: Runtime Error

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

 N = int(input())

 print(N**2-N)

Submission status: Runtime Error

Solution code:
N = int(input())
 
P = list(range(2, N+1)) + [1]
I = range(1, N+1)
 
total = 0
for i in range(1, N+1):
    p = (i + 1) if i < N else 1
    total += i % p
print(total)

Submission status: Runtime Error

Solution code:
N = int(input())

print(sum(range(N))

Submission status: Runtime Error

Solution code:
N = int(input())

P = list(range(2, N+1)) + [1]
I = range(1, N+1)

print(sum((i % p) for p, i in zip(P, I)))

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
A = list(map(int,input().split())).sort()

for i in range(N):
	A[N] // 2
	A.sort()

B = sum(A)

print(B)

Submission status: Runtime Error

Solution code:
import heapq
a = [6, 3, 2, 4, 5]
heapq.heapify(a)    # 破壊的

print a[0]    # => 2
heapq.heappop(a)    # 最小値をヒープから取り出す
print a[0]    # => 3
heapq.heappush(a, 1)    # ヒープに要素を追加する
print a[0]    # => 1

Submission status: Runtime Error

Solution code:
#include<stdio.h>
int main(void){long n;scanf("%ld",&n);printf("%ld\n",n*(n-1)/2);}

Submission status: Runtime Error

Solution code:
N = int(input())


if N % 2 == 0:
    if N == 2:
        print(1%2)

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

elif N % 2 == 1:

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

Submission status: Runtime Error

Solution code:
N = int(input())

print(sum(list(range(N))))

Submission status: Runtime Error

Solution code:
n = int(input())

def kaidan(n):
    if n <= 1:
        return 0
    else:
        return n - 1 + kaidan(n - 1)

print(kaidan(n))

Submission status: Runtime Error

Solution code:
import sys 
sys.setrecursionlimit(1000000000)

N = int(input())

def sum(n):
	if n==0:return 0
	else:return n+sum(n-1)

print(sum(N-1))

Submission status: Runtime Error

Solution code:
N = int(input())

def sum(n):
	if n==0:return 0
	else:return n+sum(n-1)

print(sum(N-1))

Submission status: Runtime Error

Solution code:
N = int(input())
list_N = list(range(1, N+1))
ret = 0
for i in list_N:
  val = sum([x % i for x in list_N])
  if ret < val:
    ret = val
print(ret)

Submission status: Runtime Error

Solution code:
    N = int(input())
    list_N = list(range(1, N+1))

    ret = 0
    for i in list_N:
        val = sum([x % i for x in list_N])
        if ret < val:
            ret = val

    print(ret)

Submission status: Runtime Error

Solution code:
N = int( input() )

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



if len(L)==1:
    print(L[0]%1)

elif len(L)==2:
    print(L[0]%2)

elif L[len(L)-1] % 2 == 0:
    print(sum(L[1:len(L)-1]))

else:
    print(sum(L[1:len(L)-1])+1)

Submission status: Runtime Error

Solution code:
N = int( input() )

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



if len(L)==1:
    print(L[0]%1)

elif len(L)==2:
    print(L[0]%2)

    


elif L[len(L)-1] % 2 == 0:
    print(sum(L[1:len(L)-1]))

else:
    print(sum(L[0:len(L)-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(1%1)

elif N==2:

    R.insert(0,R.pop(1))


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


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