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: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    s = [i for i in range(1, N+1)]
    s.sort(reverse=True)

    print(sum(s[1:]))
    
main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
s = [i for i in range(1, N+1)]
s.sort(reverse=True)

print(sum(s[1:]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
s = [i for i in range(1, N+1)]
s.sort(reverse=True)

count = 0
for i in range(N-1):
    count += s[i+1] % s[i]
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import math
import fractions
import heapq

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

cnt = 0
for i in range(n):
    cnt += i;

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

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 += I[ i ] % P[ i ]

print( cnt )

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

# D - ModSum
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(n)]
print(sum(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
ans = 0
for i in range(N):
    ans += n[i] % m[i]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
n = [x for x in range(1, N+1)]
m = n[1:]
m.append(n[0])
n = np.array(n)
m = np.array(m)
x = n % m
print(sum(x))

Submission status: Time Limit Exceeded

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

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())
print(sum([i for i in range(n)]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = []
for i in range(1,n+1):
  a = i % n
  s.append(a)
ans = sum(s)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 初期入力
N = int(input())

N_list =[i for i in range(1,N+1)]
ans =sum(N_list) -N
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import os, sys, re, math

N = int(input())

print(sum([i for i in range(1, N)]))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
N = int(input())
print(sum([i for i in range(N)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ret = 0
for i in range(1, N):
    ret += i
# 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(ret)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = [i for i in range(1, N + 1)]
# 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(sum(P) - P[-1])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
# a= 4, 1, 2, 3
# b= 1, 2, 3, 4 # modのmaxは 0, 1, 2, 3 なので最大6
# ----------
#    0, 1, 2, 3 
#print(int(n*(n-1)/2))  # 合わない...
print(sum([b%a for a, b in zip([i for i in range(1, n+1)], [n] + [i for i in range(1, n)])]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

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

Submission status: Time Limit Exceeded

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

c = a%b
print(sum(c))

Submission status: Time Limit Exceeded

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

c = a%b
print(sum(c))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [x+1 for x in range(n)]
b = [x+1 for x in range(1,n)]+[1]
ans = 0
for x,y in zip(a,b):
    ans += x%y
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

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

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:
N = int(input())
print(sum(v for v in range(N)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
N=[i for i in range(1,n+1)]
M=[j for j in range(1,n)]
M.insert(0,n)

ans=0
for k in range(n):
    ans += M[k]%N[k]
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:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools

#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
if __name__ == '__main__':
    n = int(input())
    r = [n]
    for i in range(1, n):
        r.append(i)
    ans = 0
    for i in range(n):
        ans += r[i] % (i + 1)
    print(ans)

Submission status: Time Limit Exceeded

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

print(sum)

Submission status: Time Limit Exceeded

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

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:
# -*- coding: utf-8 -*-
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
ans = 0
for i in range(n):
    ans += i
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def sum1(n):
    ans=0
    for i in range(1,n):
        ans=ans+i

    return ans
n=int(input())
print(sum1(n))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = [i for i in range(1, n + 1)]
B = [n] + [i for i in range(1, n)]
ans = sum(i % j for i, j in zip(B, A))
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())

print(sum(range(1, num + 1)[:-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:

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

print(sum([i+1 for i in range(N-1)]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

l = [i for i in range(n)]

print(sum(l))

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(N):
    count+=i
print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=[a for a in range(1,N)]
print(sum(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:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())

ans = sum(range(n))

print(ans)
# print("{:.10f}".format(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

q = [i for i in range(1, n+1)]
p = [1 if i == n+1 else i for i in range(2, n+2)]

print(sum([x%y for x, y in zip(q, p)]))

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:
n=int(input())
ans=0
for i in range(n):
  ans+=i
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
l = [int(x) for x in range(1, n)]

print(sum(l))

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

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

total_m = sum([(i % (i + 1)) for i in range(1, n)])
print(total_m)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
l = [int(x) for x in range(1, n + 1)]
p = l[1:] + [l[0]]

total_m = sum([i % p[i - 1] for i in range(1, n + 1)])
print(total_m)

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 num in range(N):
    ans += num


print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

answer=0

if N%2==0:
    for i in range(N//2):
        answer+=N-1
else:
    for i in range(N//2):
        answer+=N-1
    answer+=(N-1)//2
print(answer)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

answer=0

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

a = input()

ans = sum(range(1, int(a)))

print(ans)

Submission status: Time Limit Exceeded

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

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

    print(ans)

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(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%(i+1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

num = [i for i in range(1, N)]
print(sum(num))

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):
	if i < N:
		ans += i % (i + 1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
    _sum = 0
    N = int(input())
    for i in range(1, N):
        _sum += i

    print(_sum)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

print(_sum)

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:
print(sum([i for i in range(1, int(input()))]))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
s = [i+1 for i in range(N)]
print(sum(s[:-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:
print(sum([int(i) for i in range(int(input()))]))

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:
h = int(input())
l = list()
for i in range(h):
    l.append(i)
print(sum(l))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = list()
for i in range(n):
    l.append(i)
print(sum(l))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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


main()

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:
def main():
    N = int(input())
    ans = 0

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

    print(ans)

    return 0
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    ans = 0
    data = [i for i in range(1, N+1)]
    data_c = data.copy()
    tmp = data_c.pop(0)
    data_c.append(tmp)

    for i in range(N):
        ans += data[i]%data_c[i]

    print(ans)

    return 0
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=0
while n>0:
    n-=1
    ans+=n
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [i+1 for i in range(1,n)]
a.append(1)
ans = 0
for i,item in enumerate(a):
    ans += (i+1)%item
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

counter = 0

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

Submission status: Time Limit Exceeded

Solution code:
ans=0
for i in range(int(input())):
 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())
ans =sum(range(1, n))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# ABC-139-D
N = int(input())

A = [i for i in range(1, N)]
print(sum(A))

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())
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())
print(sum([i for i in range(1,n)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

for i in range(N):

    if i == N-1:
        ans += 0
    else:
        ans += (i+1)%(i+2)

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(sys.stdin.readline()[:-1])
sum = 0
for i in range(N):
    sum += i
print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
sum = 0
for i in range(5*10**8):
    sum += i
N = int(input())
if N >=5*10*8:
    for i in range((5*10**8),N):
        sum += i
else:
    for i in range(0,N,-1):
        sum -= i

print(sum)

Submission status: Time Limit Exceeded

Solution code:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
sum = 0
for i in range(N):
    sum += i
print(sum)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=[]
ans=0
for i in range(N):
  P.append(i+1)
print(sum(P) - N)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=[]
ans=0
for i in range(N):
  P.append(i + 1)
for i in range(N - 1):
  ans += P[i] % (i + 2)
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):
    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:
a=int(input())
print(sum(range(1,a+1))-a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
li = [x for x in range(1,N+1)]
ans = 0
for i in range(N):
    if i != N-1:
        ans += li[i] % li[i+1]
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list = [int(x+1) for x in range(1,n)]
list.append(1)
mod = 0

for i in range(n) :
    mod += (i + 1) % list[i]
print(mod)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list = [int(x+1) for x in range(n)]
list.pop(0)
list.append(1)
mod = 0

for i in range(n) :
    mod += (i + 1) % list[i]
print(mod)

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np
n = int(input())

p = np.array([(i+1) for i in range(n)])

ps = np.array(list(itertools.permutations(p)))

a = []
for i in range(len(ps)):
    a.append(np.sum(ps[i] % p))

print(max(a))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

def main():
    n = int(input())
    sum = 0
    for i in range(n):
        sum += i
    print(sum)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

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

numbers = [num for num in range(1, N)]
    
print(sum(numbers))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

print(sum(range(N)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

print(b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=0
if n==1:
  print(0)
elif n==2:
  print(1)
else:
  for i in range(1,n):
    a+=(n-i)
  print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1,n+1):
  if i==n :
    m += i%1
  else:
    m += i%(i+1)
    
print(m)

Submission status: Time Limit Exceeded

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

print(sum)

Submission status: Time Limit Exceeded

Solution code:
N = int(input());
count =0;
array =[[0 for i in range(N)] for j in range(N)];
 
# 割った余りを格納
for i in range(N) :
   for j in range(N):
    array[i][j] = (j+1) % (i+1);
    if(array[i][j-1] > array[i][j]) :
        count += array[i][j-1];
        break;
#print(array);
print(count);

Submission status: Time Limit Exceeded

Solution code:
N = int(input());
 
array =[[0 for i in range(N)] for j in range(N)];
 
# 割った余りを格納
for i in range(N) :
   for j in range(N):
    array[i][j] = (j+1) % (i+1);
    if(array[i][j-1]>array[i][j]) :
        break;
#print(array);

# 割った余りから最大値を算出
maxVal =0;
for i in range(N) :
    maxVal += max(array[i]);
 
print(maxVal);

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

array =[[0 for i in range(N)] for j in range(N)];

# 割った余りを格納
for i in range(N) :
   for j in range(N):
    array[i][j] = (j+1) % (i+1);
#print(array);
maxVal =0;
# 割った余りから最大値を算出
for i in range(N) :
    maxVal += max(array[i]);

print(maxVal);

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())
m = 0

for i in range(n):
	if i == n:
		pass
	else:
		m += i

print(m)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

wa = 0
a = n+1
for i in range(n//2):
    wa+=(n+1)
if n % 2 == 1:
    wa+=(n+1)/2

print(int(wa-n))

Submission status: Time Limit Exceeded

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

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

print(wa)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

sum=0
for i in range(n):
  sum+=i

print(sum)

Submission status: Time Limit Exceeded

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

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

res = 0
for i in range(1, N +1):
    if i < N:
        res += i

print(res)

Submission status: Time Limit Exceeded

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

print(res)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
a = int(input())

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(count)

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:
from sys import stdin

n = int(stdin.readline().rstrip())
point = 0
for i in range(1,n+1):
    point += i%n
print(point)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

sum = 0

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

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

print(0 if n == 1 else sum([(i - 1)%i for i in range(2, n + 1)]))

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)-l[-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()

print(sum(range(1, 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())
print(sum([i for i in range(N)]))

Submission status: Time Limit Exceeded

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

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

print(A)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = []
 
for i in range(0, N-1):
    A.append(i+1)

print(sum(A))

Submission status: Time Limit Exceeded

Solution code:
import copy

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

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

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

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 python3
import sys
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)

#### input
N = int(input())
# a, b = map(int, input().split())
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### function
# @lru_cache(maxsize=10000)

#### process
I = [i for i in range(1, N+1)]
P = [i for i in range(2, N+1)]
P.append(1)

rems = [I[i] % P[i] for i in range(0, len(I))]
print(sum(rems))
# if em: embed()

## heapsort, O(NlogN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)

Submission status: Time Limit Exceeded

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

if N>2:
    ans=0

    add = [i for i in range(2,N,1)]
    print(ans+sum(add)+1)
elif N==2:
    print("1")
elif N==1:
    print("0")

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

N = int(stdin.readline())
sum = 0
for i in range(N):
    sum += i

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

count=0

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

print(count)

Submission status: Time Limit Exceeded

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