Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int,input().split())))
diffH = np.diff(H)
if np.any(diffH <= -2):
  print("No")
  exit(0)

if np.any((diffH[range(N-2)] + diffH[range(1, N-1)]) <= -2):
  print("No")
  exit(0)
 
print("Yes")


Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int,input().split())))
diffH = np.diff(H)
if np.any(np.diff(H) <= -2):
  print("No")
  exit(0)
if np.any((diffH[range(N-2)] + diffH[range(1, N-1)]) <= -2):
  print("No")
  exit(0)
 
print("Yes")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int,input().split())))
diffH = np.diff(H)
if np.any((diffH[range(N-2)] + diffH[range(1, N-1)]) <= -2):
  print("No")
 
print("Yes")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
H=np.array(list(map(int,input().split())))
diffH = np.diff(H)
if np.any((diffH[range(N-1)] + diffH[range(1, N)]) <= -2):
  print("No")
 
print("Yes")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

Buggy python submission (verdict: Runtime Error):
import numpy as np
 
N = int(input())
H = np.array(list(map(int, input().split())))
if all(np.diff(H) >= 0):
  print("Yes")
  
for i in range(N):
  h = H.copy()
  h[i] = h[i] - 1
  if all(np.diff(h) >= 0):
    print("Yes")
 
print("No")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
 
N = int(input())
H = np.array(list(map(int, input().split())))
if all(np.diff(H) >= 0):
  print("Yes")
  sys.exit()
  
for i in range(N):
  h = H.copy()
  h[i] = h[i] - 1
  if all(np.diff(h) >= 0):
    print("Yes")
    sys.exit()
 
print("No")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")

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

N = int(input())
H = np.array(list(map(int, input().split())))
if all(np.diff(H) >= 0):
  print("Yes")
  sys.exit()
  
for i in range(N):
  h = H.copy()
  h[i] = h[i] - 1
  if all(np.diff(h) >= 0):
    print("Yes")
    sys.exit()
 
print("No")

Fixed submission:
import numpy as np
N = int(input())
H = list(map(int, input().split()))

max = 0
for i in range(N):
  if max < H[i]:
    max = H[i]
  if max - H[i] >= 2:
    print("No")
    exit(0)
print("Yes")