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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
num = int(input())
print(int(num * (num -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())
if(N==1):
    print(0)
    exit()
if((N-1)%2==0):
    print((N-1)/2*(N))
else:
    print((N-2)/2*(N-1)+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))
    # print(A,B)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n=int(input())

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

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
print(math.factorial(N-1))

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = ((1 + N) * N) / 2 - 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:
import sys, math; from collections import deque; readline=sys.stdin.readline;

N = int(readline())

ans = (N - 1) * N // 2 - N if N >= 2 else 0
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    print(0)
else:
    # print(sum(range(1, n)))
    print(int(n * (n - 1) / 2))

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=I()
    print(int((N-1)*(N)/2))
    # print(A,B)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

N=int(input())

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

Submission status: Wrong Answer

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

print(output)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

"""Template"""


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

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

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

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

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

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

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

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

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

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


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

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

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

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

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

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

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


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


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


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


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


main()

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

if __name__=='__main__':
    code()

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ret = int(n*(n+1)/2)
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

Solution code:
n = int(input())

ans = (0+n-1)*n/2

print(int(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
print(sum(range(N)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n = int(input())
seque = deque([i for i in range(1,n+1)])
a = seque.popleft()
seque.append(a)
# 1 2 3 4 5 6 7 8 9 10 11 12 13
# 2 3 4 5 6 7 8 9 10 11 12 13 1 
# print(seque)
ans = 0
for i in range(1,n+1):
    ans += i%seque[i-1]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import heapq


input = sys.stdin.readline
n = int(input())

result = 0
for i in range(1,n):
    result += i
    
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n = int(input())
    for i in range(1, n):
        ans += i%(i+1)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0

if n == 1:
  ans = 0
else:
  for i in range(1,n):
    ans += i
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
ans = 0
for x in range(1, int(input())):
    ans += x

print(ans)

Submission status: Time Limit Exceeded

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

for i in range(N):
  result += i
  
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = [i for i in range(0, n)]
print(sum(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[]
ans=0
for i in range(1,n+1):
  a.append(i)
b=a.copy()
b.append(a[0])
del b[0]

for i in range(n):
  ans+=a[i]%b[i]
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2020/08/16
# AtCoder Beginner Contest 139 - D

# Input
n = int(input())

# Calc
asum = 0
# for i in range(1, n+1):
#     asum = asum + (n + 1 - i) % i
for i in range(1, n):
    asum = asum + i

# Output
print(asum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans=0

for i in range(n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

lis = [i for i in range(1, n+1)]
print(sum(lis[:-1]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from numba import njit

@njit(cache=True)
def f(n):
    #n = 10**9
    ans = 0
    for i,j in zip(range(1,n),range(2,n+1)):
        #print(i,j)
        ans += i%j
    return ans

if __name__ == "__main__":
    n = int(input())
    r = f(n)
    print(r)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
for i in range(1, n//2+1):
    ans += n+1
ans -= n
if n%2 == 1:
    ans += n//2 + 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

if n == 1:
    print(0)
    exit()
elif n == 2:
    print(1)
    exit()

ans = 0
for i in range(1, n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#5
n = int(input())

num = [i for i in range(n)]
print(sum(num))

Submission status: Time Limit Exceeded

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

N = int(input())

ans = 0
for i in range(1,N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

print(sum(range(1, n)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for i in range(1, n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for i in range(n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
res = 0
for i in range(1,n):
    res += i%(i+1)
print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools
n = int(input())
#
# lst = []
# for v in itertools.permutations(range(1,n+1),n):
#     tmp = 0
#     for i in range(n):
#         tmp += (i+1) % v[i]
#     lst.append(tmp)
# print(max(lst))
ans = 0
for i in range(1,n):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    ans = 0

    for i in range(n-1):
        ans += i+1

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(1,N):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#<D>
import itertools
N = int(input())
num = [n for n in range(1, N + 1)]
print(list(itertools.accumulate(num))[N - 1] - N)

Submission status: Time Limit Exceeded

Solution code:
#<D>
N = int(input())
num = [n for n in range(1, N + 1)]
print(sum(num) - N)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

lis = [i for i in range(1, N)]

print(sum(lis))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

lis = [i for i in range(N)]

ans = 0

for i in range(1, N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# abc139_d.py
N = int(input())
A = [N-i for i in range(N)]
print(sum(A)-N)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())

    print(sum(range(1,n)))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for i in range(N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
if n == 1:
  print('0')
else:
  total = 0
  for i in range(n):
    total += i
  print(total)

Submission status: Time Limit Exceeded

Solution code:


n=int(input())

ans=0
for i in range(1,n):
    ans+=i%(i+1)

ans+=n%1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

n_list = [i for i in range(1, n)]
ans = sum(n_list)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
nums = [i for i in range(1, N + 1)]
if (N - 1) % 2 == 0:
    print(N * ((N - 1) // 2))
else:
    # 12 =>
    print(N * ((N - 1) // 2) + (N // 2))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(i) for i in range(1,N)]
print(N*(N-1)//2)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(1)
else:
    print(sum(range(1, n)))

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

result = 0;
for i in range(1, n):
  result += i
print(result)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for i in range(1,n):
  ans += i % (i+1)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
S=int(input())
print(sum([i for i in range(S)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(N):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
total=0
for i in range(N):
    total+=i
print(total)

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
total=0
for i in range(N):
    total+=i
print(total)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
s = 0
for i in range(N):
  s += i
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
print(sum(x for x in range(1,n)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
if N==1:
    print(0)
else:
    print(sum([i for i in range(1,N)]))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

a=[]
for i in range(1,N):
    a.append(i)

print(sum(a))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
total = 0
for i in range(n-1):
    total += i+1
print(total)

Submission status: Time Limit Exceeded

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

for i in range(1, N):
    score += i

print(score)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lis = []
for i in range(1,N):
    lis.append(i)
print(sum(lis))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans = 0
for i in range(N):
  ans += i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import itertools
n = int(input())
ans = 0
for i in range(1, n + 1):
    ans+=i
print(ans-n)

Submission status: Time Limit Exceeded

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

for i in range(N):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

ans = 0
for i in range(1,n):
    ans += i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
n = int(input())

res = 0
for i in range(1, n):
    res += i

print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
number = [int(x)+1 for x in range(n)]

print(sum(number[:-1]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
number = [int(x)+1 for x in range(n)]
#numberを一つずらしたリストを作成
I = number[1:]
I.append(number[0])

ans = 0
M = 0
for i in range(n):
    M = number[i]%I[i]
    ans += M
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# ABC139
# D
# ModSum

n = int(input())
print(sum(i for i in range(n)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0

for i in range(1, n):
  count += i

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(N):
    ans = ans + i

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

# In[19]:


P = int(input())


# In[20]:


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

ans = sum(range(1,P))
print(ans)


# In[ ]:

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n = int(input())
r = range(1, n+1)
p = deque(r)
p.rotate(-1)
print(sum(i%p[i-1] for i in r))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

for i in range(n-1):
    ans += i+1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from math import ceil


def main():
    n = int(input())
    # if n % 2 == 0:
    #     print(n * (n // 2) + n // 2)
    # else:
    #     print(n * ceil(n / 2))
    t = 0
    for i in range(n):
        t += i
    print(t)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def main():
    print(sum([i for i in range(1, int(readline()))]))
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans_li = [i for i in range(1,n)]
print(sum(ans_li))

Submission status: Time Limit Exceeded

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

M = [(i + 1) % P[i] for i in range(n)]
print(sum(M))

Submission status: Time Limit Exceeded

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n=int(readline())
    ans=0
    for i in range(1,n):
        ans+=i
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Time Limit Exceeded

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 )