Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
h, w = map(int, input().split())

s = [input() for i in range(h)]
l = [[0 for j in range(w)] for i in range(h)]
r = [[0 for j in range(w)] for i in range(h)]
u = [[0 for j in range(w)] for i in range(h)]
d = [[0 for j in range(w)] for i in range(h)]

for i in range(h):
    for j in range(w):
        l[i][j] = 0 if s[i][j] == '#' else 1 + (0 if j == 0 else l[i][j - 1])
    for j in range(w - 1, -1, -1):
        r[i][j] = 0 if s[i][j] == '#' else 1 + (0 if j == w - 1 else r[i][j + 1])

for j in range(w):
    for i in range(h):
        u[i][j] = 0 if s[i][j] == '#' else 1 + (0 if i == 0 else u[i - 1][j])
    for i in range(h - 1, -1, -1):
        d[i][j] = 0 if s[i][j] == '#' else 1 + (0 if i == h - 1 else d[i + 1][j])

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
h, w = map(int, input().split())

s = [input() for i in range(h)]
l = [[0 for j in range(w)] for i in range(h)]
r = [[0 for j in range(w)] for i in range(h)]
u = [[0 for j in range(w)] for i in range(h)]
d = [[0 for j in range(w)] for i in range(h)]

for i in range(h):
    for j in range(w):
        l[i][j] = 0 if s[i][j] == '#' else 1 + (0 if j == 0 else l[i][j - 1])
    for j in range(w - 1, -1, -1):
        r[i][j] = 0 if s[i][j] == '#' else 1 + (0 if j == w - 1 else r[i][j + 1])

for j in range(w):
    for i in range(h):
        u[i][j] = 0 if s[i][j] == '#' else 1 + (0 if i == 0 else u[i - 1][j])
    for i in range(h - 1, -1, -1):
        d[i][j] = 0 if s[i][j] == '#' else 1 + (0 if i == h - 1 else d[i + 1][j])

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import re

s = input()
s = s.replace('BC', 'D')
s = re.split('[BC]', s)

ans = 0
for subs in s:
    while(True):
        cnt = subs.count("AD")
        if cnt == 0:
            break
        ans += cnt
        subs = subs.replace("AD", "DA")

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
import re

s = input()
s = s.replace('BC', 'D')

ans = 0
num_a = 0
for char in s:
    if char == 'A':
        num_a += 1
    elif char == 'D':
        ans += num_a
    else:
        num_a = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
s = input()

ans = 0
while(True):
    cnt = s.count("ABC")
    if cnt == 0:
        break
    ans += cnt
    s = s.replace("ABC", "BCA")

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
import re

s = input()
s = s.replace('BC', 'D')

ans = 0
num_a = 0
for char in s:
    if char == 'A':
        num_a += 1
    elif char == 'D':
        ans += num_a
    else:
        num_a = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, m = map(int, input().split())

pass_id = [0 for i in range(n)]

for _ in range(m):
    l, r = map(int, input().split())
    for i in range(l - 1, r):
        pass_id[i] += 1

# print(pass_id)
print(pass_id.count(m))

Fixed submission:
# -*- coding: utf-8 -*-
n, m = map(int, input().split())

head = 1
tail = n

for _ in range(m):
    l, r = map(int, input().split())
    head = max(head, l)
    tail = min(tail, r)

if head > tail:
    print(0)
else:
    print(tail - head + 1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

nr_max = n // r
ng_max = n // g

count = 0
for i in range(0, nr_max + 1):
    tmp1 = r * i
    if tmp1 == n:
        count += 1
    if tmp1 >= n:
        break
    for j in range(0, ng_max + 1):
        tmp2 = g * j + tmp1
        if tmp2 == n:
            count += 1
        if tmp2 >= n:
            break
        if (n - tmp2) % b == 0:
            count += 1

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

nr_max = n // r
ng_max = n // g

count = 0
for i in range(nr_max + 1):
    tmp1 = r * i
    if tmp1 == n:
        count += 1
        break
    res = n - tmp1
    for j in range(res // g + 1):
        tmp2 = g * j + tmp1
        if tmp2 == n:
            count += 1
        if tmp2 >= n:
            break
        if (n - tmp2) % b == 0:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

nr_max = n // r
ng_max = n // g
nb_max = n // b

count = 0
for i in range(0, nr_max + 1):
    tmp1 = r * i
    if tmp1 == n:
        count += 1
    if tmp1 >= n:
        break
    for j in range(0, ng_max + 1):
        tmp2 = g * j + tmp1
        if tmp2 == n:
            count += 1
        if tmp2 >= n:
            break
        for k in range(0, nb_max + 1):
            tmp2 += b
            if tmp2 == n:
                count += 1
            if tmp2 >= n:
                break
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

nr_max = n // r
ng_max = n // g

count = 0
for i in range(nr_max + 1):
    tmp1 = r * i
    if tmp1 == n:
        count += 1
        break
    res = n - tmp1
    for j in range(res // g + 1):
        tmp2 = g * j + tmp1
        if tmp2 == n:
            count += 1
        if tmp2 >= n:
            break
        if (n - tmp2) % b == 0:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
s = list()
counter = {
    'ab': 0,
    'begin_b': 0,
    'end_a': 0,
    'b_to_a': 0
}

for i in range(n):
    substr = input()
    counter['ab'] += substr.count('AB')
    if substr.startswith('B'):
        if substr.endswith('A'):
            counter['b_to_a'] += 1
        else:
            counter['begin_b'] += 1
    else:
        if substr.endswith('A'):
            counter['end_a'] += 1

total = counter['ab'] + min(counter['begin_b'], counter['end_a'])
if counter['b_to_a'] > 0:
    total += (counter['b_to_a'] - 1)
    if max(counter['begin_b'], counter['end_a']) > 0:
        total += 1

print(total)

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

divisors = []
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n // i)

total = 0
for divisor in divisors:
    if divisor == 1:
        continue
    fav = divisor - 1
    x = n // fav
    y = n % fav
    if x == y:
        total += fav

print(total)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(numbers):
    res = fractions.gcd(numbers[0], numbers[1])
    if len(numbers) > 2:
        for idx in range(2, len(numbers)):
            res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
A, B, T = map(int, input().split())

x = int(np.floor((T + 0.5) / A))

print(x * B)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(numbers):
    res = math.gcd(numbers[0], numbers[1])
    if len(numbers) > 2:
        for idx in range(2, len(numbers)):
            res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
A, B, T = map(int, input().split())

x = int(np.floor((T + 0.5) / A))

print(x * B)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n, k = get_numbers()
s = [int(c) for c in input()]

rle = list()
target = 1
cnt = 0
for i in range(n):
    if s[i] == target:
        cnt += 1
    else:
        target = 1 - target
        rle.append(cnt)
        cnt = 1
rle.append(cnt)
if target == 0:
    rle.append(0)

length = len(rle)
ans = 0
for l in range(0, length, 2):
    r = min(l + 2 * k + 1, length)
    ans = max(sum(rle[l:r]), ans)

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
s = list(map(int, input()))

# Run Length Encoding
rle = list()
target = 1
count = 0
for i in range(n):
    if s[i] == target:
        count += 1
    else:
        target = 1 - target
        rle.append(count)
        count = 1
rle.append(count)
if target == 0:
    rle.append(0)

offset = 2 * k + 1
res = 0

# two pointers
left = 0
right = 0
cand = 0
for i in range(0, len(rle), 2):
    next_left = i
    next_right = min(i + offset, len(rle))

    while(next_left > left):
        cand -= rle[left]
        left += 1

    while(next_right > right):
        cand += rle[right]
        right += 1

    res = max(res, cand)

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np
n, k = map(int, input().split())
s = list(map(int, input()))

# Run Length Encoding
rle = list()
target = 1
count = 0
for i in range(n):
    if s[i] == target:
        count += 1
    else:
        target = 1 - target
        rle.append(count)
        count = 1
rle.append(count)
if target == 0:
    rle.append(0)

offset = 2 * k + 1
res = 0

# two pointers
for i in range(0, len(rle), 2):
    left = i
    right = min(i + offset, len(rle))
    cand = 0
    for j in range(left, right):
        cand += rle[j]
    res = max(res, cand)

print(res)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
s = list(map(int, input()))

# Run Length Encoding
rle = list()
target = 1
count = 0
for i in range(n):
    if s[i] == target:
        count += 1
    else:
        target = 1 - target
        rle.append(count)
        count = 1
rle.append(count)
if target == 0:
    rle.append(0)

offset = 2 * k + 1
res = 0

# two pointers
left = 0
right = 0
cand = 0
for i in range(0, len(rle), 2):
    next_left = i
    next_right = min(i + offset, len(rle))

    while(next_left > left):
        cand -= rle[left]
        left += 1

    while(next_right > right):
        cand += rle[right]
        right += 1

    res = max(res, cand)

print(res)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import numpy as np

def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())


n = get_num()
costs = get_nums(5)

max_time = 0
for cost in costs:
    max_time = max(max_time, int(np.ceil(n / cost)))

print(max_time + 4)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import numpy as np

def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())


n = get_num()
costs = get_nums(5)

max_time = 0
for cost in costs:
    max_time = max(max_time, int(np.ceil(n / cost)))

print(max_time + 4)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n, q = get_numbers()
s = input()

ac_idx = list()
for i in range(n - 1):
    if s[i:i + 2] == 'AC':
        ac_idx.append(i + 1)

ans = list()
for i in range(q):
    l, r = get_numbers()
    ans.append(len([idx for idx in ac_idx if idx >= l and idx < r]))

for a in ans:
    print(a)

Fixed submission:
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n, q = get_numbers()
s = input()

dp = [0 for _ in range(n + 1)]
for i in range(1, n):
    dp[i + 1] = dp[i]
    if s[i - 1:i + 1] == 'AC':
        dp[i + 1] += 1

ans = list()
for i in range(q):
    l, r = get_numbers()
    ans.append(dp[r] - dp[l])

for a in ans:
    print(a)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n, q = get_numbers()
s = input()


ans = list()
for i in range(q):
    l, r = get_numbers()
    ans.append(s[l - 1:r].count('AC'))

for a in ans:
    print(a)

Fixed submission:
# -*- coding: utf-8 -*-
import sys


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n, q = get_numbers()
s = input()

dp = [0 for _ in range(n + 1)]
for i in range(1, n):
    dp[i + 1] = dp[i]
    if s[i - 1:i + 1] == 'AC':
        dp[i + 1] += 1

ans = list()
for i in range(q):
    l, r = get_numbers()
    ans.append(dp[r] - dp[l])

for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())

a, b = get_numbers()
if a % 2 == 1:
    ans = a
    numbers = list(range(a + 1, b + 1))
else:
    ans = 0
    numbers = list(range(a, b + 1))

mod = len(numbers) % 4


if mod == 0:
    print(ans ^ 0)
elif mod == 1:
    print(ans ^ 0 ^ b)
elif mod == 2:
    print(ans ^ 1)
elif mod == 3:
    print(ans ^ 1 ^ b)

Fixed submission:
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())


def xor(n):
    if n % 4 == 3:
        return 0
    if n % 4 == 0:
        return n
    if n % 4 == 1:
        return 1
    if n % 4 == 2:
        return 1 ^ n


a, b = get_numbers()
print(xor(a - 1) ^ xor(b))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())

a, b = get_numbers()
if a % 2 == 1:
    ans = a
    numbers = list(range(a + 1, b + 1))
else:
    ans = 0
    numbers = list(range(a, b + 1))

mod = len(numbers) % 4


if mod == 0:
    print(ans ^ 0)
elif mod == 1:
    print(ans ^ 0 ^ b)
elif mod == 2:
    print(ans ^ 1)
elif mod == 3:
    print(ans ^ 1 ^ b)

Fixed submission:
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())


def xor(n):
    if n % 4 == 3:
        return 0
    if n % 4 == 0:
        return n
    if n % 4 == 1:
        return 1
    if n % 4 == 2:
        return 1 ^ n


a, b = get_numbers()
print(xor(a - 1) ^ xor(b))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())

a, b = get_numbers()
if a % 2 == 1:
    ans = a
    numbers = list(range(a + 1, b + 1))
else:
    ans = 0
    numbers = list(range(a, b + 1))

mod = len(numbers) % 4


if mod == 0:
    print(ans ^ 0)
elif mod == 1:
    print(ans ^ 0 ^ b)
elif mod == 2:
    print(ans ^ 1)
elif mod == 3:
    print(ans ^ 1 ^ b)

Fixed submission:
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())


def xor(n):
    if n % 4 == 3:
        return 0
    if n % 4 == 0:
        return n
    if n % 4 == 1:
        return 1
    if n % 4 == 2:
        return 1 ^ n


a, b = get_numbers()
print(xor(a - 1) ^ xor(b))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())

a, b = get_numbers()
if a % 2 == 1:
    ans = a
    numbers = list(range(a + 1, b + 1))
else:
    ans = 0
    numbers = list(range(a, b + 1))

mod = len(numbers) % 4


if mod == 0:
    print(ans)
elif mod == 1:
    print(ans ^ b)
elif mod == 2:
    print(ans ^ 1)
elif mod == 3:
    print(ans ^ 1 ^ b)

Fixed submission:
# -*- coding: utf-8 -*-
def get_numbers():
    return map(int, input().split())


def xor(n):
    if n % 4 == 3:
        return 0
    if n % 4 == 0:
        return n
    if n % 4 == 1:
        return 1
    if n % 4 == 2:
        return 1 ^ n


a, b = get_numbers()
print(xor(a - 1) ^ xor(b))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[r] = min([dp[j] + abs(h[r] - h[j]) for j in range(l, r)])

print(dp[-1])

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[i] = min([pdp + abs(h[i] - ph) for pdp, ph in zip(dp[l:r], h[l:r])])

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    for j in range(l, r):
        dp[r] = min(dp[r], dp[j] + abs(h[r] - h[j]))

print(dp[-1])

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[i] = min([pdp + abs(h[i] - ph) for pdp, ph in zip(dp[l:r], h[l:r])])

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0 for _ in range(n)]

for i in range(1, n):
    dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
    for j in range(2, k + 1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))
        else:
            break

print(dp[-1])

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[i] = min([pdp + abs(h[i] - ph) for pdp, ph in zip(dp[l:r], h[l:r])])

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0 for _ in range(n)]

for i in range(1, n):
    dp[i] = dp[i - 1] + abs(h[i] - h[i - 1])
    for j in range(2, k + 1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]))

print(dp[-1])

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
h = list(map(int, input().split()))

INF = float('inf')
dp = [INF for _ in range(n)]
dp[0] = 0

for i in range(1, n):
    l, r = max(i - k, 0), i
    dp[i] = min([pdp + abs(h[i] - ph) for pdp, ph in zip(dp[l:r], h[l:r])])

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, max_w = map(int, input().split())

dp = [-1 for _ in range(max_w + 1)]
dp[0] = 0

for i in range(n):
    w, v = map(int, input().split())
    queue = list()
    for i in range(max_w, w - 1, -1):
        dp[i] = max(dp[i], dp[i - w] + v)

print(max(dp))

Fixed submission:
# -*- coding: utf-8 -*-
n, max_w = map(int, input().split())

dp = [-1 for _ in range(max_w + 1)]
dp[0] = 0

for i in range(n):
    w, v = map(int, input().split())
    queue = list()
    for i in range(max_w, w - 1, -1):
        dp[i] = max(dp[i], dp[i - w] + v)

print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n, max_w = map(int, input().split())

dp = [-1 for _ in range(max_w + 1)]
dp[0] = 0

for i in range(n):
    w, v = map(int, input().split())
    queue = list()
    for i in range(max_w, w - 1, -1):
        dp[i] = max(dp[i], dp[i - w] + v)

print(max(dp))

Fixed submission:
# -*- coding: utf-8 -*-
n, max_w = map(int, input().split())

w = []
v = []
for i in range(n):
    _w, _v = map(int, input().split())
    w.append(_w)
    v.append(_v)

total_v = sum(v)


INF = float('inf')
dp = [[INF] * (total_v + 1) for i in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for j in range(total_v + 1):
        if j >= v[i]:
            dp[i + 1][j] = min(dp[i][j - v[i]] + w[i], dp[i + 1][j])
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j])

for j in range(total_v, -1, -1):
    if dp[n][j] <= max_w:
        ans = j
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
for i in range(1,N):
  if hantei=="No":
    break
  kabe=max(hlist[0:i])
  if kabe>=hlist[i]+2:
    hantei="No"
print(hantei)

Fixed submission:
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
kabe=0
for i in range(1,N):
  if hantei=="No":
    break
  kabe=max(kabe,hlist[i])
  if kabe>=hlist[i]+2:
    hantei="No"
print(hantei)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
for i in range(1,N):
  if hantei=="No":
    break
  for j in range(i):
    if hlist[j]>=hlist[i]+2:
      hantei="No"
      break
      
print(hantei)

Fixed submission:
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
kabe=0
for i in range(1,N):
  if hantei=="No":
    break
  kabe=max(kabe,hlist[i])
  if kabe>=hlist[i]+2:
    hantei="No"
print(hantei)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
for i in range(1,N):
  for j in range(i):
    if hlist[j]>=hlist[i]+2:
      hantei="No"
print(hantei)

Fixed submission:
N=int(input())
hlist=list(map(int,input().split()))
hantei="Yes"
kabe=0
for i in range(1,N):
  if hantei=="No":
    break
  kabe=max(kabe,hlist[i])
  if kabe>=hlist[i]+2:
    hantei="No"
print(hantei)
Buggy python submission (verdict: Runtime Error):
times = []
ones = []
for i in range(5):
    t = int(input())
    times.append((t + 9) // 10 * 10)
    ones.append(t % 10)
ones.sort()
print(sum(times) - 10 + min(filter(lambda x: x, ones)))


Fixed submission:
times = []
ones = [10]
for i in range(5):
    t = int(input())
    times.append((t + 9) // 10 * 10)
    ones.append(t % 10)
ones.sort()
print(sum(times) - 10 + min(filter(lambda x: x, ones)))