Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

if x >= 2000:
    print(1)
else:
    flag = False
    n = 19
    for a in range(n):
        for b in range(n):
            for c in range(n):
                for d in range(n):
                    for e in range(n):
                        for f in range(n):
                            if x == a * 100 + b * 101 + c * 102 + d * 103 + e * 104 + f * 105:
                                flag = True
                                break
                        if flag:
                            break
                    if flag:
                        break
                if flag:
                    break
            if flag:
                break
        if flag:
            break

    print(1) if flag else print(0)


Fixed submission:
x = int(input())

dp = [0] * 100001

dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1

for i in range(106, 100001):
    if dp[i - 100] == 1 or dp[i - 101] == 1 or dp[i - 102] == 1 or dp[i - 103] == 1 or dp[i - 104] == 1 or dp[
        i - 105] == 1:
        dp[i] = 1

print(dp[x])

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

if x >= 2000:
    print(1)
else:
    flag = False
    n = 19
    for a in range(n):
        for b in range(n):
            for c in range(n):
                for d in range(n):
                    for e in range(n):
                        for f in range(n):
                            val = x - a * 100 - b * 101 - c * 102 - d * 103 - e * 104 - f * 105
                            if val == 0:
                                flag = True
                                break
                        if flag:
                            break
                    if flag:
                        break
                if flag:
                    break
            if flag:
                break
        if flag:
            break

    print(1) if flag else print(0)


Fixed submission:
x = int(input())

dp = [0] * 100001

dp[100] = dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = 1

for i in range(106, 100001):
    if dp[i - 100] == 1 or dp[i - 101] == 1 or dp[i - 102] == 1 or dp[i - 103] == 1 or dp[i - 104] == 1 or dp[
        i - 105] == 1:
        dp[i] = 1

print(dp[x])
Buggy python submission (verdict: Runtime Error):
import itertools

n = int(input())
l = map(int, input().split())

comb = list(itertools.combinations(l, 3))

result = 0

for i in range(len(comb)):
    a, b, c = comb[i]
    if a < b + c:
        if b < c + a:
            if c < a + b:
                result += 1

print(result)


Fixed submission:
n = input()
s = str(input())

result = []

for i in range(int(n)):
    if s[i:i + 1] != s[i + 1:i + 2]:
        result.append(s[i:i + 1])

print(len(result))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = input().split()

result = []

for i in range(len(a)):
    result.append(a.index(str(i + 1)) + 1)

print(*result)


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

ans = [0] * n

for i in range(n):
    ans[a[i] - 1] = i + 1

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

a = []
for i in range(q):
    a.append(int(input()))

point = [k] * n

for i in range(q):
    win = a[i - 1]
    point = list(map(lambda x: x - 1, point))
    point[win - 1] += 1

for i in range(n):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')


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

a = []
for i in range(q):
    a.append(int(input()))

point = [k] * n

for i in range(q):
    win = a[i - 1]
    point[win - 1] += 1

point = list(map(lambda x: x - q, point))

for i in range(n):
    if point[i] <= 0:
        print('No')
    else:
        print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split()]
h.reverse()

flag = True

for i in range(1, n):
    print(h, i)

    if h[i - 1] >= h[i]:
        continue
    elif h[i] == h[i - 1] + 1:
        h[i] -= 1
    else:
        flag = False
        break

print('Yes') if flag else print('No')


Fixed submission:
n = int(input())
h = [int(x) for x in input().split()]
h.reverse()

flag = True

for i in range(1, n):
    if h[i - 1] >= h[i]:
        continue
    elif h[i] == h[i - 1] + 1:
        h[i] -= 1
    else:
        flag = False
        break

print('Yes') if flag else print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]

for i in range(n):
    temp = a[i]
    a[i] = 0
    print(max(a))
    a[i] = temp


Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]

aa = sorted(a)
first = aa[-1]
second = aa[-2]

for i in range(n):
    if a[i] != first:
        print(first)
    else:
        print(second)
Buggy python submission (verdict: Runtime Error):
import math


def func(n, c, d):
    x = n // c
    y = n // d
    z = n // (c * d // math.gcd(c, d))

    return n - x - y + z


a, b, c, d = map(int, input().split())

print(func(b, c, d) - func(a - 1, c, d))


Fixed submission:
import fractions


def func(n, c, d):
    x = n // c
    y = n // d
    z = n // (c * d // fractions.gcd(c, d))

    return n - x - y + z


a, b, c, d = map(int, input().split())

print(func(b, c, d) - func(a - 1, c, d))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

dp = [0] * (n + 10)

for i in range(n + 1):
    if i in a:
        dp[i] = 0
    elif i == 0 or i == 1:
        dp[i] = 1
    else:
        dp[i] = dp[i - 2] + dp[i - 1]

print(dp[n] % 1000000007)


Fixed submission:
n, m = map(int, input().split())
a = []
for i in range(m):
    a.append(int(input()))

dp = [1] * (n + 10)
for i in range(len(a)):
    dp[a[i]] = 0

for i in range(n + 1):
    if i == 0 or i == 1:
        dp[i] = dp[i] * 1
    else:
        dp[i] = dp[i] * (dp[i - 2] + dp[i - 1])

print(dp[n] % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
lr = []
for i in range(m):
    lr.append(list(map(int, input().split())))

canPass = [m] * n

for j in range(len(lr)):
    l = lr[j][0] - 1
    r = lr[j][1] - 1
    for k in range(l, r + 1):
        canPass[k] -= 1

ans = canPass.count(0)
print(ans)


Fixed submission:
n, m = map(int, input().split())
l = 1
r = n
for i in range(m):
    a, b = map(int, input().split())
    l = max(l, a)
    r = min(r, b)

if l <= r:
    print(r - l + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
dish = [int(input()) for x in range(5)]
hitoketa = list(map(int, [str(x)[-1] for x in dish]))

last = 999
for i in hitoketa:
    if not i % 10 == 0:
        last = min(last, i)

last = dish[hitoketa.index(last)]
ans = last
skip = False
for i in dish:
    if i == last and not skip:
        skip = True
    elif i % 10 == 0:
        ans += i
    else:
        ans += (i // 10 + 1) * 10

print(ans)


Fixed submission:
dish = [int(input()) for x in range(5)]
hitoketa = list(map(int, [str(x)[-1] for x in dish]))

last = 999
for i in hitoketa:
    if not i % 10 == 0:
        last = min(last, i)

if last != 999:
    last = dish[hitoketa.index(last)]
else:
    last = dish[0]

ans = last
skip = False

for i in dish:
    if i == last and not skip:
        skip = True
    elif i % 10 == 0:
        ans += i
    else:
        ans += (i // 10 + 1) * 10

print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(map(str, input()))

change = 0
count = 0
i = 0

while True:
    if not s:
        break
    if i + 1 >= len(s):
        if change != 0:
            i = 0
            change = 0
        else:
            break

    if s[i] != s[i + 1]:
        del s[i: i + 2]
        count += 1
        change += 1
    else:
        i += 1

print(count * 2)


Fixed submission:
s = [int(x) for x in list(map(str, input()))]

x = s.count(0)
y = s.count(1)

print(min(x, y) * 2)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [10 ** 10] * (n + k)
h += [10 ** 10] * k
dp[0] = 0

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

print(dp[n - 1])


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

dp = [10 ** 10] * (n + k)
h += [10 ** 10] * k
dp[0] = 0

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

print(dp[n - 1])

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

dp = [10 ** 10] * n
dp[0] = 0

for i in range(1, n):
    value = 10 ** 10
    for j in range(1, min(k + 1, n)):
        cost = abs(h[i] - h[i - j])
        value = min(value, dp[i - j] + cost)
    dp[i] = value

print(dp[n - 1])


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

dp = [10 ** 10] * (n + k)
h += [10 ** 10] * k
dp[0] = 0

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

print(dp[n - 1])

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

dp = [10 ** 10] * n
dp[0] = 0

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

print(dp[n - 1])


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

dp = [10 ** 10] * (n + k)
h += [10 ** 10] * k
dp[0] = 0

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

print(dp[n - 1])
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n // 2)
else:
    v1 = [v[i] for i in range(0, n, 2)]
    v2 = [v[i + 1] for i in range(0, n, 2)]

    kw1 = Counter(v1)
    kw2 = Counter(v2)

    x1 = kw1.most_common()[0][0]
    x2 = kw2.most_common()[0][0]

    if x1 != x2:
        ans = 0
        for i in v1:
            if i != x1:
                ans += 1
        for i in v2:
            if i != x2:
                ans += 1
    else:
        y1 = kw1.most_common()[1][0]
        y2 = kw2.most_common()[1][0]

        ans1 = 0
        ans2 = 0

        for i in v1:
            if i != y1:
                ans1 += 1
        for i in v2:
            if i != x2:
                ans1 += 1

        for i in v1:
            if i != x1:
                ans2 += 1
        for i in v2:
            if i != y2:
                ans2 += 1

        ans = min(ans1, ans2)

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(n // 2)
else:
    v1 = [v[i] for i in range(0, n, 2)]
    v2 = [v[i + 1] for i in range(0, n, 2)]

    kw1 = Counter(v1)
    kw2 = Counter(v2)

    x1 = kw1.most_common()[0][0]
    x2 = kw2.most_common()[0][0]

    if x1 != x2:
        ans = 0
        for i in v1:
            if i != x1:
                ans += 1
        for i in v2:
            if i != x2:
                ans += 1
    else:
        y1 = kw1.most_common()[1][0]
        y2 = kw2.most_common()[1][0]

        ans1 = 0
        ans2 = 0

        for i in v1:
            if i != y1:
                ans1 += 1
        for i in v2:
            if i != x2:
                ans1 += 1

        for i in v1:
            if i != x1:
                ans2 += 1
        for i in v2:
            if i != y2:
                ans2 += 1

        ans = min(ans1, ans2)

    print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n, x = map(int, input().split())
xx = list(map(int, input().split()))
xx.sort()

if n == 1:
    ans = xx[0] - x
else:
    dist = [xx[i + 1] - xx[i] for i in range(n - 1)]
    ans = reduce(math.gcd, dist)

print(ans)


Fixed submission:
import fractions
from functools import reduce

n, x = map(int, input().split())
xx = [abs(int(i) - x) for i in input().split()]

if n == 1:
    ans = xx[0]
else:
    ans = reduce(fractions.gcd, xx)

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

ans = 10 ** 10
for i in range(n - k + 1):
    temp = x[i:i + k]
    left = temp[0]
    right = temp[-1]
    ans = min(ans, abs(left) + abs(right - left), abs(right) + abs(right - left))

print(ans)


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

ans = 10 ** 10
for i in range(n - k + 1):
    left = x[i]
    right = x[i + k - 1]
    ans = min(ans, abs(left) + abs(right - left), abs(right) + abs(right - left))

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

if s[0] == '1':
    print(s[1])
else:
    print(s[0])


Fixed submission:
s = input()
k = int(input())

limit = min(100, k)

ans = 1
for i in range(limit):
    if s[i] != '1':
        ans = s[i]
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 110000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])


Fixed submission:
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 1100000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])

Buggy python submission (verdict: Runtime Error):
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 110000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])


Fixed submission:
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 1100000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])

Buggy python submission (verdict: Runtime Error):
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 110000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])


Fixed submission:
n = int(input())
num = [1]

x = 6
while x < 100000:
    num.append(x)
    x *= 6

x = 9
while x < 100000:
    num.append(x)
    x *= 9

dp = [n] * 1100000
dp[0] = 0

for i in range(n):
    for j in num:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
n = len(s)

s = list(s)
ans = []
for i in range(n + 1):
    for j in range(i + 1, n + 1):
        ans.append(str(''.join(s[i:j])))

ans = sorted(list(set(ans)))
print(ans[k - 1])


Fixed submission:
s = input()
k = int(input())
n = len(s)

s = list(s)
ans = []
for i in range(n + 1):
    for j in range(i + 1, min(i + 1 + k, n + 1)):
        ans.append(str(''.join(s[i:j])))

ans = sorted(list(set(ans)))
print(ans[k - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    temp = sorted(x[:i] + x[i + 1:])
    ans = temp[n // 2 - 1]
    print(ans)


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

y = sorted(x)
mid1 = y[(n + 1) // 2]
mid2 = y[(n - 1) // 2]

for i in range(n):
    if mid1 == mid2:
        ans = mid1
    elif x[i] >= mid1:
        ans = mid2
    elif x[i] <= mid2:
        ans = mid1

    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

dist = [abs(a[i + 1] - a[i]) for i in range(len(a) - 1)]

for i in range(1, n + 1):
    ans = sum(dist) - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1])
    print(ans)


Fixed submission:
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

dist = [abs(a[i + 1] - a[i]) for i in range(len(a) - 1)]
total = sum(dist)

for i in range(1, n + 1):
    ans = total - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1])
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

dist = [abs(a[i + 1] - a[i]) for i in range(len(a) - 1)]

for i in range(1, n + 1):
    ans = sum(dist) - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1])
    print(ans)


Fixed submission:
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

dist = [abs(a[i + 1] - a[i]) for i in range(len(a) - 1)]
total = sum(dist)

for i in range(1, n + 1):
    ans = total - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i - 1] - a[i + 1])
    print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
    print('Yes')
else:
    print('No')


Fixed submission:
n = input()

if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

q = deque()
for i in a:
    q.append([i])

ans = 0
while q:
    now = q.popleft()
    n = len(now)
    if n == 3:
        ans += 1
    elif n == 2:
        for x in c:
            if now[-1] < x:
                q.append(now + [x])
    elif n == 1:
        for y in b:
            if now[-1] < y:
                q.append(now + [y])

print(ans)


Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))

ans = 0
for i in b:
    a_pos = bisect.bisect_left(a, i)
    c_pos = n - bisect.bisect_right(c, i)
    ans += a_pos * c_pos

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)


def dfs(parts):
    global ans
    n = len(parts)
    if n == 3:
        ans += 1
    elif n == 2:
        for i in c:
            if parts[1] < i:
                dfs(parts + [i])
            else:
                break
    elif n == 1:
        for j in b:
            if parts[0] < j:
                dfs(parts + [j])
            else:
                break


ans = 0
for i in a:
    dfs([i])

print(ans)


Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))

ans = 0
for i in b:
    a_pos = bisect.bisect_left(a, i)
    c_pos = n - bisect.bisect_right(c, i)
    ans += a_pos * c_pos

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))


def dfs(parts):
    global ans
    n = len(parts)
    if n == 3:
        ans += 1
    elif n == 2:
        for i in c:
            if parts[1] < i:
                dfs(parts + [i])
    elif n == 1:
        for j in b:
            if parts[0] < j:
                dfs(parts + [j])


ans = 0
for i in a:
    dfs([i])

print(ans)


Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
b = list(map(int, input().split()))
c = sorted(list(map(int, input().split())))

ans = 0
for i in b:
    a_pos = bisect.bisect_left(a, i)
    c_pos = n - bisect.bisect_right(c, i)
    ans += a_pos * c_pos

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

n = len(s)
m = len(t)

for i in range(n - m + 1):
    bubun = s[i:i + m]
    flag = True
    for j in range(m):
        x = bubun[j]
        y = t[j]
        if x == y:
            pass
        elif x == '?':
            pass
        else:
            flag = False

    if flag:
        ans = s[:i].replace('?', 'a') + t + s[i + m:].replace('?', 'a')
        break

print(ans) if flag else print('UNRESTORABLE')


Fixed submission:
s = input()
t = input()

n = len(s)
m = len(t)

if t in s:
    print(s.replace('?', 'a'))
else:
    ans = []
    for i in range(n - m + 1):
        bubun = s[i:i + m]
        flag = True
        for j in range(m):
            x = bubun[j]
            y = t[j]
            if x == y:
                continue
            elif x == '?':
                continue
            else:
                flag = False
                break

        if flag:
            ans.append((s[:i] + t + s[i + m:]).replace('?', 'a'))

    print(sorted(ans)[0]) if ans else print('UNRESTORABLE')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]

ans=[]
for i in a:
    if i in ans:
        ans.remove(i)
    else:
        ans.append(i)

print(len(ans))

Fixed submission:
from collections import Counter

n = int(input())
a = [int(input()) for _ in range(n)]

c = Counter(a)

ans = 0
for key, value in c.most_common():
    if value % 2 != 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

ans = 0
c = Counter(a).most_common()
for i in range(min(a), max(a) + 1):
    temp = [value if abs(i - key) <= 1 else 0 for key, value in c]
    ans = max(ans, sum(temp))

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

ans = 0
c = Counter(a)
for i in range(min(a), max(a) + 1):
    temp = [value if abs(i - key) <= 1 else 0 for key, value in c.most_common()]
    ans = max(ans, sum(temp))

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)

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

ans = 0
for i in range(min(a), max(a) + 1):
    temp = [1 if abs(i - x) <= 1 else 0 for x in a]
    ans = max(ans, sum(temp))

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)

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

ans = 0
for i in range(min(a), max(a) + 1):
    temp = [abs(x - i) for x in a]
    ans = max(ans, temp.count(0) + temp.count(1))

print(ans)


Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
t = [int(input()) for _ in range(n)]

ans = reduce(lambda x, y: x * y // math.gcd(x, y), t)
print(ans)


Fixed submission:
import fractions
from functools import reduce

n = int(input())
t = [int(input()) for _ in range(n)]

ans = reduce(lambda x, y: x * y // fractions.gcd(x, y), t)
print(ans)