Problem p02923 (python)

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

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        ans   = max(count, ans)
        count = 0
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    elif count > ans:
        ans   = count
        count = 0
    else
        count = 0
      
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    elif count > ans:
        count = ans
        count = 0
    else
        count = 0
      
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        if count > ans:
            ans   = count
            count = 0
        else:
            pass
 
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        if count > ans:
            ans   = count
            count = 0
        else:
            pass
 
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        if count > ans:
            ans   = count
            count = 0
        else:
 
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H_inp = input()
H = H_inp.split(" ")
for i in range(N):
    H[i] = int(H[i])
 

ans   = 0
count = 0


for j in range(1,N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        if count > ans:
            ans   = count
            count = 0
 
    if j == N-1:
        if count > ans:
            ans   = count
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H_inp = input()
H = H_inp.split(" ")

for i in range(N):
    H[i] = int(H[i])

now        = H[0]
max_move   = 0
move_count = 0

for j in range(N):
    if now >= H[j+1]:
        move_count = move_count + 1
    else:
        if move_count > max_move:
            max_move = move_count
            move_count = 0

    if j == N-2:
        if move_count > max_move:
            max_move = move_count
            move_count = 0
        break
    
    now = H[j+1]

print(max_move)

Buggy submission (verdict: Runtime Error):
N = int(input())
H_inp = input()
H = H_inp.split(" ")

for i in range(N):
    H[i] = int(H[i])

now        = H[0]
max_move   = 0
move_count = 0

for j in range(N):
    if now >= H[j+1]:
        move_count = move_count + 1
    else:
        if move_count > max_move:
            max_move = move_count
            move_count = 0

    if max_move > N - j:
        if move_count > max_move:
            max_move = move_count
            move_count = 0
        break
    if j == N-2:
        if move_count > max_move:
            max_move = move_count
            move_count = 0
        break
    
    now = H[j+1]

print(max_move)