Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(1e6))
import math

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A1))
        A1[i] = A1[i] // 2
    print(sum(A1 + A2))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print(sum(A))


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h_A = []
for a in A:
    heapq.heappush(h_A, -a)

for _ in range(M):
    x = heapq.heappop(h_A)
    heapq.heappush(h_A, -(-x // 2))

prices = [- heapq.heappop(h_A) for _ in range(N)]
print(sum(prices))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(int(1e6))
import math

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A1))
        A1[i] = A1[i] // 2
    print(sum(A1, A2))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print(sum(A))


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h_A = []
for a in A:
    heapq.heappush(h_A, -a)

for _ in range(M):
    x = heapq.heappop(h_A)
    heapq.heappush(h_A, -(-x // 2))

prices = [- heapq.heappop(h_A) for _ in range(N)]
print(sum(prices))

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(int(1e6))
import math

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A2))
        A1[i] = A1[i] // 2
    print(sum(A1, A2))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print(sum(A))


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h_A = []
for a in A:
    heapq.heappush(h_A, -a)

for _ in range(M):
    x = heapq.heappop(h_A)
    heapq.heappush(h_A, -(-x // 2))

prices = [- heapq.heappop(h_A) for _ in range(N)]
print(sum(prices))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(1e6))

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

for _ in range(M):
    i = A.index(max(A))
    A[i] = A[i] // 2

print(sum(A))


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
h_A = []
for a in A:
    heapq.heappush(h_A, -a)

for _ in range(M):
    x = heapq.heappop(h_A)
    heapq.heappush(h_A, -(-x // 2))

prices = [- heapq.heappop(h_A) for _ in range(N)]
print(sum(prices))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(1e6))

N = int(input())

M_sum = 0
M_sum = sum(range(1, N))
M_sum += N % 1
print(M_sum)


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

N = int(input())

n = N - 1
if bool(n%2):
    ans = (n//2) * (n) + n
else:
    ans = (n//2) * (n+1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(int(1e6))

N = int(input())

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

M_sum += N % 1
print(M_sum)


Fixed submission:
import sys
sys.setrecursionlimit(int(1e6))

N = int(input())

n = N - 1
if bool(n%2):
    ans = (n//2) * (n) + n
else:
    ans = (n//2) * (n+1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [''] * n
s = [input() for _ in range(n)]
  
def is_anagram(a, b):
    if len(a) != len(b): 
        return False
    else:
        return sorted(a) == sorted(b)

import itertools
a = map(lambda x: is_anagram(x[0], x[1]), list(itertools.combinations(s, 2)))
print(sum(a))


Fixed submission:
n = int(input())
s = [input() for _ in range(n)]

dic = {}
count = 0
for a in s:
  key = "".join(sorted(a))
  if key in dic:
    count += dic[key]
    dic[key] += 1
  else:
    dic[key] = 1

print(count)
Buggy python submission (verdict: Runtime Error):
import sympy

N = int(input())

ans = 1
for i in range(2, N):
    ans += len(sympy.divisors(i))

print(ans)

Fixed submission:
N = int(input())

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

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())


def search_prime_num(x):
    max = int(np.sqrt(x))
    seachList = [i for i in range(2, x + 1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum


factor_list = search_prime_num(N)


def factorization(n):
    arr = []
    temp = n
    for i in factor_list:
        if i > int(-(-n**0.5//1))+1:
            break
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


ans = 1

for j in range(2, N):
    factors = factorization(j)
    buf = 1
    for factor in factors:
        buf *= (factor[1] + 1)
    ans += buf

print(ans)


Fixed submission:
N = int(input())

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

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(s) for s in input().split()]

mod_number = 10**9 + 7

total = 0
for i in range(0, N - 1):
    j_total = sum(A[i+1:N])
    total += A[i] * j_total

ans = total % mod_number

print(ans)

Fixed submission:
N = int(input())
A = [int(s) for s in input().split()]

mod_number = 10**9 + 7
sum_A = sum(A)
total = 0
for i in range(0, N - 1):
    sum_A = sum_A - A[i]
    total += A[i] * sum_A

ans = total % mod_number

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(s) for s in input().split()]

mod_number = 10**9 + 7

total = 0
for i in range(0, N - 1):
    for j in range(i + 1, N):
        total += A[i] * A[j]

ans = total % mod_number

print(ans)

Fixed submission:
N = int(input())
A = [int(s) for s in input().split()]

mod_number = 10**9 + 7
sum_A = sum(A)
total = 0
for i in range(0, N - 1):
    sum_A = sum_A - A[i]
    total += A[i] * sum_A

ans = total % mod_number

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]

x = 1
for i in range(N):
    x_before = x
    x = x * A[i]
    if i >= K:
        x = x / A[i - K]
        if x > x_before:
            print('Yes')
        else:
            print('No')

Fixed submission:
N, K = [int(s) for s in input().split()]
A = [int(s) for s in input().split()]

x = 1
for i in range(K, N):
    if A[i] > A[i - K]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = (10000 - n) % 1000

print(ans

Fixed submission:
n = int(input())
ans = (10000 - n) % 1000

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

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

Fixed submission:
N = int(input())


def f(x):
    result = N // x
    return result

ans = 0
for x in range(1, N + 1):
    Y = f(x)
    ans += x * Y * (Y + 1) / 2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
prime_number = []


def f_func(X):
    x = X
    ans = [0] * (x - 1)

    pn = 0
    n = 1
    while n <= x:
        if pn < len(prime_number):
            n = prime_number[pn]
        else:
            n += 1

        j = 1
        while True:
            mod = x % n
            if mod != 0:
                break
            x = x // n
            j += 1
        ans[n - 2] = j - 1
        pn += 1


    result = 1
    for i in ans:
        result = result * (i + 1)
    if sum(ans) == 1:
        prime_number.append(X)
    return result

ans = 1
for i in range(2, N + 1):
    ans += i * f_func(i)
print(ans)

Fixed submission:
N = int(input())


def f(x):
    result = N // x
    return result

ans = 0
for x in range(1, N + 1):
    Y = f(x)
    ans += x * Y * (Y + 1) / 2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())


def f_func(X):
    ans = [0] * (X - 1)
    n = 2
    for _ in range(X - 1):
        j = 1
        while True:
            mod = X % n
            if mod != 0:
                break
            ans[n-2] = j
            X = X // n
            j += 1
        n += 1
    result = 1
    for i in ans:
        result = result * (i + 1)
    return result

ans = 1
for i in range(2, N + 1):
    ans += i * f_func(i)
print(ans)

Fixed submission:
N = int(input())


def f(x):
    result = N // x
    return result

ans = 0
for x in range(1, N + 1):
    Y = f(x)
    ans += x * Y * (Y + 1) / 2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(s) for s in input().split()]
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = [int(s) for s in input().split()]
    B.append(b)
    C.append(c)

A_dict = {}
for a in A:
    A_dict[a] = A.count(a)

A_sum = sum(A)
for b, c in zip(B, C):
    if b in A_dict.keys():
        n = A_dict[b]
    else:
        n = 0
    A_dict[b] = 0
    if c in A_dict.keys():
        A_dict[c] += n
    else:
        A_dict[c] = n
    A_sum += (c - b) * n
    print(A_sum)


Fixed submission:
from collections import defaultdict

N = int(input())
A = [int(s) for s in input().split()]
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = [int(s) for s in input().split()]
    B.append(b)
    C.append(c)

A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

A_sum = sum(A)
for b, c in zip(B, C):
    n = A_dict[b]
    A_dict[b] = 0
    A_dict[c] += n
    A_sum += (c - b) * n
    print(A_sum)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(s) for s in input().split()]
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = [int(s) for s in input().split()]
    B.append(b)
    C.append(c)

for b, c in zip(B, C):
    A = list(map(lambda x: c if x == b else x, A))
    ans = sum(A)
    print(ans)

Fixed submission:
from collections import defaultdict

N = int(input())
A = [int(s) for s in input().split()]
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = [int(s) for s in input().split()]
    B.append(b)
    C.append(c)

A_dict = defaultdict(int)
for a in A:
    A_dict[a] += 1

A_sum = sum(A)
for b, c in zip(B, C):
    n = A_dict[b]
    A_dict[b] = 0
    A_dict[c] += n
    A_sum += (c - b) * n
    print(A_sum)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(s) for s in input().split()]

ans = 1
for a in A:
    ans *= a

if ans > 10**18:
    ans = -1

print(ans)

Fixed submission:
N = int(input())
A = [int(s) for s in input().split()]

ans = 1
if 0 in A:
    ans = 0
else:
    for a in A:
        ans *= a

        if ans > 10 ** 18:
            ans = -1
            break

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a,b)+max(min(a,b),max(a,b)-1)

Fixed submission:
a =list(map(int, input().split())) 
print(max(a)+max([min(a),max(a)-1]))
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a+b < c+d
    print('Right')
elif a+b > c+d
    print('Left')
else
    print('Balanced')


Fixed submission:
a,b,c,d = map(int,input().split())
if a+b < c+d:
    print('Right')
elif a+b > c+d:
    print('Left')
else:
    print('Balanced')

Buggy python submission (verdict: Runtime Error):
a ,b,c,d=map(int,input().split())
if a+b < c+d
    print('Right')
elif a+b > c+d
    print('Left')
else print('Balanced')


Fixed submission:
a,b,c,d = map(int,input().split())
if a+b < c+d:
    print('Right')
elif a+b > c+d:
    print('Left')
else:
    print('Balanced')
Buggy python submission (verdict: Runtime Error):
li = input().split()
c = 0
for i in range(0,3):
  if li[i]=='1':
    c++
    
print(c)

Fixed submission:
li = list(input())
c = 0
for i in [0,1,2]:
  if li[i]=='1':
    c = c +1
    
print(c)

Buggy python submission (verdict: Runtime Error):
li = input()
c = 0
for i in range(0,3):
  if li[i]=='1':
    c++
    
print(c)

Fixed submission:
li = list(input())
c = 0
for i in [0,1,2]:
  if li[i]=='1':
    c = c +1
    
print(c)

Buggy python submission (verdict: Runtime Error):
li = map(input())
c = 0
for i range 3:
  if li[i]=='1':
    c++
    
print(c)

Fixed submission:
li = list(input())
c = 0
for i in [0,1,2]:
  if li[i]=='1':
    c = c +1
    
print(c)
Buggy python submission (verdict: Runtime Error):
li = list(input())
if li[0]==li[5] && li[1]==li[4] && li[2]==li[3]:
  print("YES")
else:
  print("NO")

Fixed submission:
l = list(input())
m = list(input())
if int(l[0]==m[2]) & int(l[1]==m[1]) & int(l[2]==m[0]):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a,b,c=stdin.readline().rstrip().split()
if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)

Fixed submission:
a,b,c=map(int,input().split())
if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input().split()
s2=sorted(s)
t=0
for i in range(n):
  if s[i]!=s2[i]:
    t+=1
print(t)

Fixed submission:
n=int(input())
s=input()
s2=sorted(s)
t=0
for i in range(n):
  if s[i]!=s2[i]:
    t+=1
print(t//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
a=list(map(int,input().split()))
s=0
b=0
while 1:
    t=True
    for i in range(len(a)):
        if a[i]!=i+1:
            t=False
            break
    if t:
        print(b)
        sys.exit()
    if a[s]!=s+1:
        del a[s]
        b+=1
        if len(a)==0:
            print(-1)
            sys.exit()
    else:
        s+=1

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))

purged_data = [] #purge : [動詞]〜を粛清する
tmp = a[0] - 1
s=1
for i, e in enumerate(a):
    if e==s:
        purged_data.append(e)
        tmp = e
        s+=1
for i in range(len(purged_data)):
    if purged_data[i]!=i+1:
        print(-1)
        sys.exit()
if len(purged_data)==0:
    print(-1)
    sys.exit()
print(len(a)-len(purged_data))
Buggy python submission (verdict: Runtime Error):
s=input()
if s=="SUN"
  print(7)
if s=="MON"
  print(6)
if s=="TUE"
  print(5)
if s=="WED"
  print(4)
if s=="THU"
  print(3)
if s=="FRI"
  print(2)
if s=="SAT"
  print(1)

Fixed submission:
s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)

Buggy python submission (verdict: Runtime Error):
s=input()
if s=='SUN'
  print(7)
if s=='MON'
  print(6)
if s=='TUE'
  print(5)
if s=='WED'
  print(4)
if s=='THU'
  print(3)
if s=='FRI'
  print(2)
if s=='AST'
  print(1)

Fixed submission:
s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)

Buggy python submission (verdict: Runtime Error):
s=input()
if s='SUN'
  print(7)
if s='MON'
  print(6)
if s='TUE'
  print(5)
if s='WED'
  print(4)
if s='THU'
  print(3)
if s='FRI'
  print(2)
if s='AST'
  print(1)

Fixed submission:
s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
for i in range(len(s)):
  s[i]=str(int(s[i])+n)
print(s)

Fixed submission:
n=int(input())
s=input()
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s=list(s)
a=list(a)
for i in range(len(s)):
    if a.index(s[i]) + n >= 26:
        s[i]=a[int(a.index(s[i])+n-26)]
    else:
        s[i]=a[int(a.index(s[i])+n)]
s="".join(s)
print(s)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
for i in range(len(s)):
  s[i]+=n
print(s)

Fixed submission:
n=int(input())
s=input()
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s=list(s)
a=list(a)
for i in range(len(s)):
    if a.index(s[i]) + n >= 26:
        s[i]=a[int(a.index(s[i])+n-26)]
    else:
        s[i]=a[int(a.index(s[i])+n)]
s="".join(s)
print(s)
Buggy python submission (verdict: Runtime Error):
print(int(input()**2))

Fixed submission:
print(int(input())**2)

Buggy python submission (verdict: Runtime Error):
print(int(input()**2)

Fixed submission:
print(int(input())**2)
Buggy python submission (verdict: Runtime Error):
S=input()
if S==Sunny:
  print(Cloudy)
elif S==Cloudy:
  print(Rainy)
else:
  print(Sunny)

Fixed submission:
S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B={i:0 for i in range(N)}
for i in range(Q):
    B[A[i]-1]+=1
for i in range(N):
    if 0>=K-sum(B.values())+B[i]:
        print('No')
    else:
        print('Yes')

Fixed submission:
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
C=sum(B)-K
for i in range(N):
    if C>=B[i]:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
for i in range(N):
    if sum(B)-B[i]>=K:
        print('No')
    else:
        print('Yes')

Fixed submission:
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
C=sum(B)-K
for i in range(N):
    if C>=B[i]:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
for i in range(N):
    if sum(B)-B[i]>=K:
        print('No')
    else:
        print('Yes')

Fixed submission:
N,K,Q=list(map(int,input().split()))
A=[int(input()) for _ in range (Q)]
B=[0 for _ in range (N)]
for i in range(Q):
    B[A[i]-1]+=1
C=sum(B)-K
for i in range(N):
    if C>=B[i]:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
    heapq.heapify(A)
print(-sum(A))

Fixed submission:
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
while M>0:
    B=max(A)
    A[A.index(B)]=A[A.index(B)]//2
    M-=1
print(sum(A))

Fixed submission:
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
while M>0:
    B=max(A)
    A[A.index(max(A))]=A[A.index(max(A))]//2
    M-=1
print(sum(A))

Fixed submission:
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
while M>0:
    B=max(A)
    A[A.index(max(A))]=A[A.index(max(A))]//2
    M-=1
print(sum(A))

Fixed submission:
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print(-sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))
L=[0 for _ in range(N)]
for t in range(N):
    for i in range(t,N):
        if t==i:
            continue
        if H[t]>=H[i]:
            L[t]+=1
            H[t]=H[i]
        else:
            break
print(sorted(L,reverse=True)[0])

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
min=H[0]
count=[0 for _ in range(N)]
cnt=0
t=0
for i in range(1,N):
    if H[i]<=min:
        min=H[i]
        cnt+=1
    else:
        count[t]=cnt
        cnt=0
        t+=1
        min=H[i]
count[t]=cnt
print(max(count))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))
L=[0 for _ in range(N)]
for t in range(N):
    if max(L)>N-t:
        break
    for i in range(t,N):
        if t==i:
            continue
        if H[t]>=H[i]:
            L[t]+=1
            H[t]=H[i]
        else:
            break
print(max(L))

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
min=H[0]
count=[0 for _ in range(N)]
cnt=0
t=0
for i in range(1,N):
    if H[i]<=min:
        min=H[i]
        cnt+=1
    else:
        count[t]=cnt
        cnt=0
        t+=1
        min=H[i]
count[t]=cnt
print(max(count))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))
L=[0 for _ in range(N)]
for t in range(N):
    for i in range(t,N):
        if t==i:
            continue
        if H[t]>=H[i]:
            L[t]+=1
            H[t]=H[i]
        else:
            break
print(max(L))

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
min=H[0]
count=[0 for _ in range(N)]
cnt=0
t=0
for i in range(1,N):
    if H[i]<=min:
        min=H[i]
        cnt+=1
    else:
        count[t]=cnt
        cnt=0
        t+=1
        min=H[i]
count[t]=cnt
print(max(count))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))
L=[0 for _ in range(N)]
for t in range(N):
    for i in range(t,N):
        if t==i:
            continue
        if H[t]>=H[i]:
            L[t]+=1
            H[t]=H[i]
        else:
            break
print(max(L))

Fixed submission:
N=int(input())
H=list(map(int,input().split()))
min=H[0]
count=[0 for _ in range(N)]
cnt=0
t=0
for i in range(1,N):
    if H[i]<=min:
        min=H[i]
        cnt+=1
    else:
        count[t]=cnt
        cnt=0
        t+=1
        min=H[i]
count[t]=cnt
print(max(count))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
sum=0
for i in range(N):
    sum+=i
if N==1:
    print(0)
else:
    print(sum)

Fixed submission:
N=int(input())-1
sum=(N*(N+1))//2
if N==0:
    print(0)
else:
    print(sum)