Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail == 0 and head_b == 0):
  total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)
 

Fixed submission:
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail_a == 0 and head_b == 0):
  if(doubleAB == 0):
    total_cand = inside_str
  else:
    total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)

print(total_cand)

Buggy python submission (verdict: Runtime Error):
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
except_Dcount = 0

for i in range(N):
  str = input()
  ab_inside_str = str.count('AB')

  inside_str = inside_str + ab_inside_str
  if (str[-1] == 'A'):
    tail_a = tail_a + 1
  if (str[0] == 'B'):
    head_b = head_b + 1
  if(str[-1] == 'A' && str[0] == 'B'):
    except_Dcount = except_Dcount + 1

total_cand = inside_str + min(tail_a, head_b) - except_Dcount
print(total_cand)

Fixed submission:
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail_a == 0 and head_b == 0):
  if(doubleAB == 0):
    total_cand = inside_str
  else:
    total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)

print(total_cand)
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = float(input())

n = math.sqrt(N)
sum = 0
for i in range(int(n), int(N)):
  div = int(N/i)
  res = N - i*div
  if(div == res):
    sum = sum + i
  
print(sum)

Fixed submission:
import math
N = int(input())
sqrtN = int(math.sqrt(float(N)))

ans = 0
prefnum = []

for div in range(1, sqrtN+1):
  if( N % div == 0):
    quot = int(N/div)
    if((quot-1) > div):
      prefnum.append(int(quot-1))
      
for i in prefnum:
  ans = ans + i

print(ans)
Buggy python submission (verdict: Runtime Error):
D = int(input())
T = int(input())
S = int(input())
if D/S - T >0:
    print('No')
else:
    print('Yes')

Fixed submission:
D,T,S = map(int,input().split())
if D/S - T >0:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
D = int(input())
T = int(input())
S = int(input())
if D/S - T >0:
    print('No')
else:
    print('Yes')

Fixed submission:
D,T,S = map(int,input().split())
if D/S - T >0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
int(input())
print(r*r)

Fixed submission:
r=int(input())
print(r*r)

Buggy python submission (verdict: Runtime Error):
print(r*r)

Fixed submission:
r=int(input())
print(r*r)
Buggy python submission (verdict: Runtime Error):
(a,b,c) = (int(input()),int(input()),int(input()))
s = (a+b)*h/2
print(s)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(int(s))
Buggy python submission (verdict: Runtime Error):
N=input[]
A=input[]
print(N**2-A)

Fixed submission:
N=int(input())
A=int(input())
print(N**2-A)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

mod = 10**9+7
r = n-k

def mod_combination(n, k, mod):
     # nCk (mod m)
     def mod_permutation(n, k, mod):
         if n<=k:
             return 1
         else:
             return (n * mod_permutation(n-1, k, mod))%mod
 
     def mod_inv_permutation(k, mod):
         k, mod = int(k), int(mod)
         if k<=1:
             return 1
         else:
             return (pow(k, mod-2, mod) * mod_inv_permutation(k-1, mod))%mod
 
     return (mod_permutation(n, n-k, mod) * mod_inv_permutation(k, mod))%mod

def f(n):
    a = mod_combination(k-1, n, mod)
    return a

for i in range(k):
    ans = 1
    ans = mod_combination(r+1, i+1, mod) * mod_combination(k-1, i, mod) % mod
    print(ans)

Fixed submission:
n, k = map(int, input().split())

mod = 10**9+7
r = n-k

def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    invs[0] = 1
    
    return factorials, invs

fr, inv = prepare(2010, mod)
for i in range(k):
    ans = 1
    if r-i < 0:
        ans = 0
    else:
        ans = (((fr[n-k+1] * inv[i+1] * inv[n-k-i]) % mod) * fr[k-1] * inv[i] * inv[k-1-i]) % mod
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())

mod = 10**9+7
r = n-k

def mod_combination(n, k, mod):
     # nCk (mod m)
     def mod_permutation(n, k, mod):
         if n<=k:
             return 1
         else:
             return (n * mod_permutation(n-1, k, mod))%mod
 
     def mod_inv_permutation(k, mod):
         k, mod = int(k), int(mod)
         if k<=1:
             return 1
         else:
             return (pow(k, mod-2, mod) * mod_inv_permutation(k-1, mod))%mod
 
     return (mod_permutation(n, n-k, mod) * mod_inv_permutation(k, mod))%mod

def f(n):
    a = mod_combination(k-1, n, mod)
    return a

for i in range(k):
    ans = 1
    ans = mod_combination(r+1, i+1, mod)
    ans = ans * f(i) % mod
    print(ans)

Fixed submission:
n, k = map(int, input().split())

mod = 10**9+7
r = n-k

def prepare(n, MOD):
    # 1! - n! の計算
    f = 1
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
    invs[0] = 1
    
    return factorials, invs

fr, inv = prepare(2010, mod)
for i in range(k):
    ans = 1
    if r-i < 0:
        ans = 0
    else:
        ans = (((fr[n-k+1] * inv[i+1] * inv[n-k-i]) % mod) * fr[k-1] * inv[i] * inv[k-1-i]) % mod
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


a_c = (a-1)//c
b_c = b//c
a_d = (a-1)//d
b_d = b//d
a_cd = (a-1)//lcm(c, d)
b_cd = b//lcm(c, d)

ans = (b - a + 1) - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)

print(ans)

Fixed submission:
import fractions

a, b, c, d = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


a_c = (a-1)//c
b_c = b//c
a_d = (a-1)//d
b_d = b//d
a_cd = (a-1)//lcm(c, d)
b_cd = b//lcm(c, d)

ans = (b - a + 1) - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

fib = [0]*n
fib[0] = 1
fib[1] = 1
for x in range(2, n):
    fib[x] = fib[x-1] + fib[x-2]

mod = 10**9+7
ans = 1
prev_a = -1
for i in range(m):
    a = int(input())
    if a - 1 == prev_a:
        ans = 0
        break
    else:
        ans = (ans * fib[a - prev_a - 2]) % mod
    prev_a = a

ans = (ans * fib[n - a - 1]) % mod
print(ans)

Fixed submission:
n, m = map(int, input().split())

fib = [0]*(n + 1)
fib[0] = 1
fib[1] = 1
for x in range(2, n+1):
    fib[x] = fib[x-1] + fib[x-2]

mod = 10**9+7
ans = 1
prev_a = -1
a = 0
for i in range(m):
    a = int(input())
    if a - 1 == prev_a:
        ans = 0
        break
    else:
        ans = (ans * fib[a - prev_a - 2]) % mod
    prev_a = a

if m == 0:
    ans = fib[n] % mod
else:
    ans = (ans * fib[n - a - 1]) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())

sq = [input() for _ in range(h)]
up = [[0] * (w + 2) for _ in range(h + 2)]
down = [[0] * (w + 2) for _ in range(h + 2)]
left = [[0] * (w + 2) for _ in range(h + 2)]
right = [[0] * (w + 2) for _ in range(h + 2)]

ans = 0

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sq[i][j] == '#':
            left[i][j] = 0
            up[i][j] = 0
        else:
            left[i][j] = left[i][j - 1] + 1
            up[i][j] = up[i - 1][j] + 1
for _i in range(h - 1, 0, -1):
    for _j in range(w - 1, 0, -1):
        if sq[_i][_j] == '#':
            right[_i][_j] = 0
            down[_i][_j] = 0
        else:
            right[_i][_j] = right[_i][_j + 1] + 1
            down[_i][_j] = down[_i + 1][_j] + 1

            temp = up[_i][_j] + down[_i][_j] + left[_i][_j] + right[_i][_j] 
            if temp > ans:
                ans = temp

print(ans - 3)


Fixed submission:
h, w = map(int, input().split())

sq = [input() for _ in range(h)]
up = [[0] * (w + 2) for _ in range(h + 2)]
down = [[0] * (w + 2) for _ in range(h + 2)]
left = [[0] * (w + 2) for _ in range(h + 2)]
right = [[0] * (w + 2) for _ in range(h + 2)]

ans = 0

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sq[i - 1][j - 1] == '#':
            left[i][j] = 0
            up[i][j] = 0
        else:
            left[i][j] = left[i][j - 1] + 1
            up[i][j] = up[i - 1][j] + 1
for _i in range(h, 0, -1):
    for _j in range(w, 0, -1):
        if sq[_i - 1][_j - 1] == '#':
            right[_i][_j] = 0
            down[_i][_j] = 0
        else:
            right[_i][_j] = right[_i][_j + 1] + 1
            down[_i][_j] = down[_i + 1][_j] + 1

            temp = up[_i][_j] + down[_i][_j] + left[_i][_j] + right[_i][_j] 
            if temp > ans:
                ans = temp

print(ans - 3)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())


ans = [1] * n
for i in range(m):
    l, r = map(int, input().split())
    ans[:l-1] = [0] * (l - 1)
    ans[r:] = [0] * (n - r)
print(sum(ans))

Fixed submission:
n, m = map(int, input().split())

Left = -1
Right = n + 1
for i in range(m):
    l, r = map(int, input().split())
    Left = max(Left, l)
    Right = min(Right, r)
if Left <= Right:
    ans = Right - Left + 1
else:
    ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)

Fixed submission:
import math
n, k = map(int, input().split())

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)

Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)

Fixed submission:
import math
n, k = map(int, input().split())

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N+1):
    for g in range(N+1):
        blue = N - R*r - G*g
        if blue >= 0 and blue % B == 0:
            ans += 1


print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N+1):
    for g in range(N+1):
        blue = N - R*r - G*g
        if blue >= 0 and blue % B == 0:
            ans += 1


print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

pattern1 = A+A-1
pattern2 = A+B
pattern3 = B+B-1

print(max(pattern1, pattern2, pattern3))

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

count = 0
maximum = 0
for i in range(N):
    if H[i] >= maximum:
        maximum = H[i]
        count += 1


print(count)
Buggy python submission (verdict: Runtime Error):
s = input()

count = 0
ans = []
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))


Fixed submission:
s = input()

count = 0
ans = [0]
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
        if i == (len(s)-1):
            ans.append(count)
        
    else:
        ans.append(count)
        count = 0
print(max(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))


ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.dot(a, b) + c > 0:
        ans += 1
    
print(ans)

Fixed submission:
import numpy as np

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))


ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.dot(a, b) + c > 0:
        ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = str(input())
if s == "AAA" or s == "BBB":
    input("No")
else:
    input("Yes")


Fixed submission:
s = str(input())
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
def hats(m):
    if m == 1:
        return 3
    else:
        xL = [i for i, j in enumerate(a) if j == a[m - 1]]
        xS = [i for i, j in enumerate(a) if j == a[m - 1] - 1]
        xl = 0
        xs = 0
        for i in range(len(xL)):
            if xL[i] < m - 1:
                xl += 1
        for i in range(len(xS)):
            if xS[i] < m - 1:
                xs += 1
        if xl + 1 == xs:
            return hats(m - 1) % 1000000007
        else:
            return hats(m - 1) * (xs - xl) % 1000000007
print(hats(n))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = 1
l = [0] * n
for k in range(n):
    xl = l[a[k]]
    if a[k] == 0:
        xs = 3
    else:
        xs = l[a[k] - 1]
    if xs + 1 != xl:
        x = x * (xs - xl) % 1000000007
    l[a[k]] = l[a[k]] + 1
print(x)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
x = 1

def hats(m):
    if m == 1:
        return 3
    else:
        xL = [i for i, j in enumerate(a) if j == a[m - 1]]
        xS = [i for i, j in enumerate(a) if j == a[m - 1] - 1]
        xl = 0
        xs = 0
        for i in range(len(xL)):
            if xL[i] < m - 1:
                xl += 1
        for i in range(len(xS)):
            if xS[i] < m - 1:
                xs += 1
        if xl + 1 == xs:
            return hats(m - 1)
        else:
            return hats(m - 1) * (xs - xl)
print(hats(n) % 1000000007)
    

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = 1
l = [0] * n
for k in range(n):
    xl = l[a[k]]
    if a[k] == 0:
        xs = 3
    else:
        xs = l[a[k] - 1]
    if xs + 1 != xl:
        x = x * (xs - xl) % 1000000007
    l[a[k]] = l[a[k]] + 1
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
x = []
x = [0 for i in range(n)]
for j in range(n):
    x.pop(a[j] - 1)
    x.insert(a[j] - 1, j + 1)
print(" ".join(map(str, x)))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append((a[i], i + 1))
x.sort()
y = []
for i in range(n):
    y.append(x[i][1])
print(" ".join(map(str, y)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append(0)
for j in range(n):
    x.pop(a[j] - 1)
    x.insert(a[j] - 1, j + 1)
print(" ".join(map(str, x)))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append((a[i], i + 1))
x.sort()
y = []
for i in range(n):
    y.append(x[i][1])
print(" ".join(map(str, y)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(1000000, 1000000 + n):
    x.append(i + 1)
for j in range(n):
    x.remove(a[j] + 1000000)
    x.insert(a[j] - 1, j + 1)
print(" ".join(map(str, x)))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append((a[i], i + 1))
x.sort()
y = []
for i in range(n):
    y.append(x[i][1])
print(" ".join(map(str, y)))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append(a.index(i + 1) + 1)
print(" ".join(map(str, x)))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
x = []
for i in range(n):
    x.append((a[i], i + 1))
x.sort()
y = []
for i in range(n):
    y.append(x[i][1])
print(" ".join(map(str, y)))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
import fractions
n = fractions.gcd(a, b)
devide = 2
l1 = []
while devide <= n:
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1 = list(set(l1))
print(int(len(l1) + 1))

Fixed submission:
a, b = map(int, input().split())
import math
import fractions
n = fractions.gcd(a, b)
devide = 2
l1 = []
while devide <= math.sqrt(n):
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1.append(n)
l1 = list(set(l1))
if n == 1:
    print(int(len(l1)))
else:
    print(int(len(l1) + 1))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
import math
n = math.gcd(a, b)
devide = 2
l1 = []
while devide <= n:
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1 = list(set(l1))
print(int(len(l1) + 1))


Fixed submission:
a, b = map(int, input().split())
import math
import fractions
n = fractions.gcd(a, b)
devide = 2
l1 = []
while devide <= math.sqrt(n):
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1.append(n)
l1 = list(set(l1))
if n == 1:
    print(int(len(l1)))
else:
    print(int(len(l1) + 1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
max1 = 0
for i in range(n):
    now = i
    try1 = 0
    for l in range(n - i - 1):
        if h[now] >= h[now + 1]:
            now += 1
            try1 += 1
        else:
            if try1 > max1:
                max1 = try1
                break
        if now == n - 1:
            if try1 > max1:
                max1 = try1
            break
    if max1 == n - i:
        break
print(max1)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
max1 = 0
count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    else:
        count = 0
    if count > max1:
        max1 += 1
print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
max1 = 0
for i in range(n):
    now = i
    try1 = 0
    for l in range(n - i - 1):
        if h[now] >= h[now + 1]:
            now += 1
            try1 += 1
        else:
            if try1 > max1:
                max1 = try1
                break
        if now == n - 1:
            if try1 > max1:
                max1 = try1
            break
print(max1)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
max1 = 0
count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    else:
        count = 0
    if count > max1:
        max1 += 1
print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h = list(map(int, input().split()))
max1 = 0
for i in range(n):
    now = i
    try1 = 0
    for l in range(n - i - 1):
        if h[now] >= h[now + 1]:
            now += 1
            try1 += 1
        else:
            if try1 > max1:
                max1 = try1
                break
        if now == n - 1:
            if try1 > max1:
                max1 = try1
            break
print(max1)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
max1 = 0
count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    else:
        count = 0
    if count > max1:
        max1 += 1
print(max1)
Buggy python submission (verdict: Runtime Error):
n = int(inut())
h = list(map(int, input().split()))
t = 0
for i in range(n - 2):
    if h[i] - h[i+1] >= 2:
        print("No")
        t = 1
        break
    elif i <= n - 4:
        if h[i] - h[i+1] == 1 and h[i+1] - h[i+2] == 1:
            print("No")
            t = 1
            break
if t == 0:
    print("Yes")


Fixed submission:
n = int(input())
h = list(map(int, input().split()))
t = 0
m = 0
for i in range(n):
    if h[i] > t:
        t = h[i]
    elif t - h[i] >= 2:
        print("No")
        m += 1
        break
if m == 0:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
n = int(inut())
h = list(map(int, input().split()))
t = 0
for i in range(n - 2):
    if h[i] - h[i+1] >= 2:
        print("No")
        t = 1
        break
    elif i <= n - 3:
        if h[i] - h[i+1] == 1 and h[i+1] - h[i+2] == 1:
            print("No")
            t = 1
            break
if t == 0:
    print("Yes")

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
t = 0
m = 0
for i in range(n):
    if h[i] > t:
        t = h[i]
    elif t - h[i] >= 2:
        print("No")
        m += 1
        break
if m == 0:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
def frog(num):
    if num == 1:
        return 0
    elif num == 2:
        return abs(h[1] - h[0])
    else:
        p1 = frog(num - 1) + abs(h[num - 2] - h[num - 1])
        p2 = frog(num - 2) + abs(h[num - 3] - h[num - 1])
        if p1 >= p2:
            return frog(num - 2) + abs(h[num - 3] - h[num - 1])
        else:
            return frog(num - 1) + abs(h[num - 2] - h[num - 1])
print(frog(n))

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
def frog(num):
    if num == 1:
        return 0
    elif num == 2:
        return abs(h[1] - h[0])
    else:
        l1 = [frog(1), frog(2)]
        for i in range(2, num):
            p1 = l1[i - 1] + abs(h[i - 1] - h[i])
            p2 = l1[i - 2] + abs(h[i - 2] - h[i])
            if p1 >= p2:
                l1.append(p2)
            else:
                l1.append(p1)
    return l1[num - 1]
print(frog(n))

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
def flog(num):
    if num == 1:
        return 0
    elif num == 2:
        return abs(h[1] - h[0])
    else:
        p1 = flog(num - 1) + abs(h[num - 2] - h[num - 1])
        p2 = flog(num - 2) + abs(h[num - 3] - h[num - 1])
        if p1 >= p2:
            return flog(num - 2) + abs(h[num - 3] - h[num - 1])
        else:
            return flog(num - 1) + abs(h[num - 2] - h[num - 1])
print(flog(n))

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
def frog(num):
    if num == 1:
        return 0
    elif num == 2:
        return abs(h[1] - h[0])
    else:
        l1 = [frog(1), frog(2)]
        for i in range(2, num):
            p1 = l1[i - 1] + abs(h[i - 1] - h[i])
            p2 = l1[i - 2] + abs(h[i - 2] - h[i])
            if p1 >= p2:
                l1.append(p2)
            else:
                l1.append(p1)
    return l1[num - 1]
print(frog(n))