alexjercan/bugnet huggingface dataset:
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

#!/usr/bin/env python3
n = int(input())
h = list(map(int, input().split()))
ans = 0
tmp = 0
for i in range(n - 1):
    if h[i] < h[i + 1]:
        tmp = 0
    else:
        tmp += 1
    ans = max(ans, tmp)
print(ans)


Error: TLE

Fixed submission:

#!/usr/bin/env python3
n = int(input())
h = list(map(int, input().split()))
ans = 0
for i in range(n):
    tmp = 0
    for j in range(i, n - 1):
        if h[j] < h[j + 1]:
            tmp = 0
        else:
            tmp += 1
        ans = max(ans, tmp)
print(ans)
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

def resolve():
    N = int(input())
    H = [int(i) for i in input().split()]
    maxM = 0
    m = 0
    for i in range(N - 1):
        if H[i] < H[i + 1]:
            m = 0
        else:
            m += 1
            maxM = max(maxM, m)
    print(maxM)


resolve()


Error: TLE

Fixed submission:

def resolve():
    N = int(input())
    H = [int(i) for i in input().split()]
    maxM = 0
    for i in range(N - 1):
        m = 0
        for j in range(i, N - 1):
            if H[j] < H[j + 1]:
                break
            else:
                m += 1
        maxM = max(maxM, m)
    print(maxM)


resolve()
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print(0)
else:
    ans = 0
    H1 = H[0]
    H2 = H[1]
    count = 1
    move = 0
    while count != N:
        count += 1
        if H2 <= H1:
            move += 1
            ans = max(ans, move)
        else:
            move = 0
        if count != N:
            H1 = H2
            H2 = H[count]

    print(ans)


Error: 0

Fixed submission:

N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print(0)
else:
    ans = 0
    H1 = H[0]
    H2 = H[1]
    count = 1
    move = 0
    while count != (N):
        count += 1
        if H2 <= H1:
            move += 1
            ans = max(ans, move)
        else:
            move = 0
        if count != N:
            H1 = H2
            H2 = H[count]

print(ans)
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
h = list(map(int, input().split()))

ans = 0
x = 0
for i in range(1, n):
    if h[i - 1] >= h[i]:
        x += 1
    else:
        x = 0
    ans = max(ans, x)
print(ans)


Error: TLE

Fixed submission:

n = int(input())
hh = list(map(int, input().split()))

ans = 0
for i in range(n - 1, 0, -1):
    x = 1
    while i + x < n and hh[i + x - 1] >= hh[i + x]:
        x += 1
    ans = max(ans, x - 1)
print(ans)
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

# coding: utf-8
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
data = []
for i in range(n - 1):
    if lst[i] >= lst[i + 1]:
        cnt += 1
    else:
        data.append(cnt)
        cnt = 0
data.append(cnt)
print(max(data))


Error: TypeError: 'int' object is not iterable
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02923/Python/s153309090.py", line 12, in <module>
    print(max(cnt))
TypeError: 'int' object is not iterable


Fixed submission:

# coding: utf-8
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
data = []
for i in range(n - 1):
    if lst[i] >= lst[i + 1]:
        cnt += 1
    else:
        data.append(cnt)
        cnt = 0
print(max(cnt))
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

n = input()
h_string = input()
h_list = h_string.split(" ")
for i in range(len(h_list)):
    h_list[i] = int(h_list[i])


longest = 0
now_value = -1
now_length = 0


for value in h_list:
    if value <= now_value:
        now_length += 1
        now_value = value
        if now_length > longest:
            longest = now_length
    else:
        if now_length > longest:
            longest = now_length
        now_value = value
        now_length = 0

print(longest)


Error: TypeError: '<=' not supported between instances of 'str' and 'int'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p02923/Python/s196465841.py", line 14, in <module>
    if value <= now_value:
TypeError: '<=' not supported between instances of 'str' and 'int'


Fixed submission:

n = input()
h_string = input()
h_list = h_string.split(" ")
for item in h_list:
    item = int(item)


longest = 0
now_value = -1
now_length = 0


for value in h_list:
    if value <= now_value:
        now_length += 1
        now_value = value
        if now_length > longest:
            longest = now_length
    else:
        if now_length > longest:
            longest = now_length
        now_value = value
        now_length = 0

print(longest)
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
h = list(map(int, input().split()))

max_step = 0
current_step = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        current_step += 1
        if current_step > max_step:
            max_step = current_step
    else:
        current_step = 0
print(max_step)


Error: TLE

Fixed submission:

n = int(input())
h = list(map(int, input().split()))

max_step = 0
for i in range(n):
    current_step = 0
    for j in range(i + 1, n):
        if h[j - 1] >= h[j]:
            current_step += 1
            if current_step > max_step:
                max_step = current_step
        else:
            i = j
            break
print(max_step)
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

# -*- coding: utf-8 -*-
# 整数の入力


def main():
    n = int(input())
    h = list(map(int, input().split()))

    if n == 1:
        print(0)
        return

    result = []
    count = 0
    for i in range(n - 1):
        if h[i] < h[i + 1]:
            result.append(count)
            count = 0
            continue

        count += 1
        if i == n - 2:
            result.append(count)

    print(max(result))


if __name__ == "__main__":
    main()


Error: 0

Fixed submission:

# -*- coding: utf-8 -*-
# 整数の入力


def main():
    n = int(input())
    h = list(map(int, input().split()))

    result = []
    count = 0
    for i in range(n - 1):
        if h[i] < h[i + 1]:
            result.append(count)
            count = 0
            continue

        count += 1
        if i == n - 2:
            result.append(count)

    print(max(result))


if __name__ == "__main__":
    main()
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
height = list(map(int, input().split()))
max_count = 0
count = 0
for i in range(n - 1):
    if height[i] < height[i + 1]:
        max_count = max(count, max_count)
        count = 0
        continue
    count += 1
max_count = max(count, max_count)
print(max_count)


Error: TLE

Fixed submission:

n = int(input())
height = list(map(int, input().split()))
max_count = 0
for i in range(n):
    count = 0
    for j in range(i, n):
        if j == n - 1 or height[j] < height[j + 1]:
            break
        count += 1
    max_count = max(max_count, count)
print(max_count)
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
h = list(map(int, input().split()))

counter, ans = 0, 0
for i in range(len(h) - 1):
    if h[i] >= h[i + 1]:
        counter += 1
    else:
        if ans <= counter:
            ans = counter
        counter = 0
ans = max(ans, counter)


print(ans)


Error: 0

Fixed submission:

n = int(input())
hlist = list(map(int, input().split()))
delta = [hlist[i + 1] - hlist[i] for i in range(len(hlist) - 1)]

counter = 0
for i in range(len(delta)):
    if delta[i] <= 0:
        counter += 1
    else:
        ans = counter
        counter = 0
ans = max(ans, counter)
print(ans)
Problem p02923 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[0] = 0
ans = 0
for i in range(1, n):
    if h[i - 1] >= h[i]:
        if dp[i - 1] == 0:
            dp[i] = 1
        else:
            dp[i] = dp[i - 1] + 1
        ans = max(dp[i], ans)
print(ans)


Error: TLE

Fixed submission:

n = int(input())
h = list(map(int, input().split()))

ans = 0
for left in range(n - 1):
    right = left + 1
    length = 0
    while right < n and h[right - 1] >= h[right]:
        length += 1
        right += 1
    ans = max(ans, length)
print(ans)
Problem p02923 (Python) — buggy submission, verdict: Runtime Error

from sys import stdin

n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

m = 0
count = 0
for i in range(n):
    if i == n - 1:
        if m < count:
            m = count
    else:
        if h[i] >= h[i + 1]:
            count += 1
        else:
            if m < count:
                m = count
            count = 0

print(m)


Error: 0

Fixed submission:

from sys import stdin

n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

m = 0
count = 0
for i in range(n):
    if (i == n - 1) and (m < count):
        m = count
    else:
        if h[i] >= h[i + 1]:
            count += 1
        else:
            if m < count:
                m = count
            count = 0

print(m)
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
print(sum(range(N)))


Error: 0

Fixed submission:

N = int(input())
print(sum(list(range(N))))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())

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

print(c)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

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

print(sum)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8 -*-
# 整数の入力
from decimal import Decimal


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

    if n == 1:
        print(0)
        return

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


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

# -*- coding: utf-8 -*-
# 整数の入力


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


if __name__ == "__main__":
    main()
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
if n % 2 == 0:
    sum = int(n / 2)
    sum = sum * (n - 1)

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

print(int(sum))


Error: TLE

Fixed submission:

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

print(sum)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

n = N - 1
result = 0

if n != 0:
    result = n * (n + 1) // 2

print(result)


Error: TLE

Fixed submission:

N = int(input())

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

print(result)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
max = 0


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


Error: TLE

Fixed submission:

N = int(input())
max = 0

for i in range(N):
    max += i

print(max)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
ans = 0
for i in range(1, n):
    ans += i
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

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


Error: 0

Fixed submission:

N = int(input())
print(sum(list(range(N))))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
ans = 0

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

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


Error: 0

Fixed submission:

n = int(input())
a = list(range(1, n))
print(sum(a))
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

n = int(input())


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


Error: 0

Fixed submission:

n = int(input())


a = list(range(1, n))

print(sum(a))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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

print(ans)


Error: TLE

Fixed submission:

n = int(input())

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
print(sum(range(1, N)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
ans = 0

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

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


Error: 0

Fixed submission:

N = int(input())
print(sum(list(range(N))[1:]))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
print(sum(x for x in range(n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
res = 0
for i in range(N):
    res += i
print(res)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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

n = n - 1

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

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


Error: TLE

Fixed submission:

# 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))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

if n % 2:
    print(n * (n - 1) // 2)
else:
    print(n * (n // 2 - 1) + n // 2)


Error: TLE

Fixed submission:

n = int(input())
print(sum(range(n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())


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


Error: TLE

Fixed submission:

N = int(input())

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

print(sum(x) - N)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
ans = 0

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8 -*-
n = int(input())

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


Error: TLE

Fixed submission:

# -*- coding: utf-8 -*-
n = int(input())

tmp = [i for i in range(1, n + 1)]
print(sum(tmp) - n)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

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))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

a = int(input())
sum = 0
for i in range(a):
    sum += i
print(sum)
Problem p02924 (Python) — buggy submission, verdict: Runtime Error

N = int(input())

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


Error: 0

Fixed submission:

N = int(input())

list = list(range(N))

print(sum(list))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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


Error: TLE

Fixed submission:

N = int(input())

ans = 0
for n in range(1, N):
    ans += n
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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


Error: TLE

Fixed submission:

N = int(input())

print(sum(i % (i + 1) for i in range(1, N)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
print(sum(v for v in range(N)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

print(sum(range(int(input()))))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())

if N == 1:
    print(0)
else:
    print(sum([i for i in range(1, N)]))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


main()


Error: TLE

Fixed submission:

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


main()
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
print(sum([i for i in range(N)]))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

m = n * (n - 1) // 2

print(m)


Error: TLE

Fixed submission:

n = int(input())
m = 0


for i in range(n):
    t = i + 1
    if t == n:
        m += 0
    else:
        m += t % (t + 1)


print(m)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
r = 0
for i in range(n):
    r += i
print(r)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

print(sum(range(1, int(input()))))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
ans = 0

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


Error: TLE

Fixed submission:

n = int(input())
ans = 0

for i in range(n):
    ans += i
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
ans = 0
for i in range(n):
    ans += i
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

print(sum(range(int(input()))))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
# print(sum([i for i in range(N)]))
print(N * (0 + N - 1) // 2)


Error: TLE

Fixed submission:

N = int(input())
print(sum([i for i in range(N)]))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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

print(ans)


Error: TLE

Fixed submission:

N = int(input())

ans = 0
for i in range(N):
    ans += i
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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


Error: TLE

Fixed submission:

N = int(input())
score = 0

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

print(score)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

print(sum([i for i in range(1, n)]))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
print(sum(i for i in range(N)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
print(sum(range(1, n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

n = int(input())
print(sum(i for i in range(1, n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

from decimal import Decimal


n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

n_list = [i for i in range(1, n)]
ans = sum(n_list)
print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8 -*-

N = int(input())

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

print(ans)


Error: TLE

Fixed submission:

# -*- coding: utf-8 -*-

N = int(input())

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())

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

print(sum)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

# しらんけど
# ふつうにこれやったらTLEなったのでアレする
# n = int(input())
# print(sum(range(n)))

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


Error: TLE

Fixed submission:

# しらんけど
n = int(input())
print(sum(range(n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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

print(res)


Error: TLE

Fixed submission:

N = int(input())

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

print(res)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())
print(sum(range(1, n)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

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


Error: TLE

Fixed submission:

n = int(input())

ans = 0

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

print(ans)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

num = 0

num = n * (n - 1) // 2

print(num)


Error: TLE

Fixed submission:

n = int(input())
num = 0

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

print(num)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

N = int(sys.stdin.readline())
print(int((N - 1) * N // 2))


Error: TLE

Fixed submission:

import sys

N = int(sys.stdin.readline())
print(sum(n + 1 for n in range(N - 1)))
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())

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


Error: TLE

Fixed submission:

N = int(input())

result = 0
for i in range(N):
    result += i
print(result)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

N = int(input())
n = 0
for m in range(N - 1, 0, -1):
    n = n + m
print(n)
Problem p02924 (Python) — buggy submission, verdict: Time Limit Exceeded

import math

n = int(input().strip())
ans = (n * (n - 1)) // 2

print(ans)


Error: TLE

Fixed submission:

n = int(input().strip())
ans = 0
for i in range(n):
    ans = ans + i
print(ans)