Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
pLst = [list(map(int, input().split())) for i in range(M)]

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[i][0] - 1]
index = 1

Fixed submission:
N, M = map(int, input().split())
pLst = [list(map(int, input().split())) for i in range(M)]

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[0][0] - 1]
index = 1
for i in range(M):
    if tmp == nLst[tLst[i][0] - 1]:
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1
    else:
        index = 1
        tmp = nLst[tLst[i][0] - 1]
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1

for i in ansLst:
    print(i)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
pLst = [list(map(int, input().split())) for i in range(M)]

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[i][0] - 1]
index = 1
for i in range(M):
    if tmp == nLst[tLst[i][0] - 1]:
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1
    else:
        index = 1
        tmp == nLst[tLst[i][0] - 1]
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)

for i in ansLst:
    print(i)

Fixed submission:
N, M = map(int, input().split())
pLst = [list(map(int, input().split())) for i in range(M)]

for i in range(len(pLst)):
    pLst[i].append(i)
nLst = [''] * N

for i in range(N):
    nLst[i] = str(i + 1).zfill(6)
tLst = sorted(pLst, key=lambda x: (x[0], x[1]))
ansLst = [''] * M
tmp = nLst[tLst[0][0] - 1]
index = 1
for i in range(M):
    if tmp == nLst[tLst[i][0] - 1]:
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1
    else:
        index = 1
        tmp = nLst[tLst[i][0] - 1]
        ansLst[tLst[i][2]] = nLst[tLst[i][0] - 1] + str(index).zfill(6)
        index += 1

for i in ansLst:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = M // N
ansMax = 0
for i in range(1, tmp + 1):
    ansTmp = M - ((N - 1) * i)
    if ansTmp % i == 0:
        ansMax = i

print(ansMax)

Fixed submission:
N, M = map(int, input().split())
tmp = M // N
ansMax = 0
y = []
for i in range(1, (int(M ** (0.5)) + 1)):
    if M % i == 0:
        y.append(i)
        if i != M // i:
            y.append(M // i)
y.sort()

for i in y:
    if i <= tmp:
        ansMax = i
    else:
        break
print(ansMax)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
tmp = M // N
ansMax = 0
for i in range(1, tmp + 1):
    ansTmp = M - ((N - 1) * i)
    if ansTmp % i == 0:
        ansMax = i

print(ansMax)

Fixed submission:
N, M = map(int, input().split())
tmp = M // N
ansMax = 0
y = []
for i in range(1, (int(M ** (0.5)) + 1)):
    if M % i == 0:
        y.append(i)
        if i != M // i:
            y.append(M // i)
y.sort()

for i in y:
    if i <= tmp:
        ansMax = i
    else:
        break
print(ansMax)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
ansCnt = 0
for i in range(len(S)):
    for j in range(1, len(S) + 1):
        if S[-j] == T[-j]:
            continue
        elif j != len(S):
            for z in range(len(S) - j):
                if S[-j] == T[z]:
                    S = S[0:z] + S[-j] + S[z:-j] + S[-j + 1:]
                    continue

if S == T:
    print('Yes')
else:
    print('No')


Fixed submission:
S = input()
T = input()
ansCnt = 0
for i in range(len(S)):
    if S == T:
        break
    S = S[-1] + S[0:-1]
if S == T:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
ansCnt = 0
for i in range(len(S)):
    for j in range(1, len(S) + 1):
        if S[-j] == T[-j]:
            continue
        elif j != len(S):
            S = S[-j] + S[0: -j] + S[-j + 1:]
            ansCnt += 1

if S == T:
    print('Yes')
else:
    print('No')


Fixed submission:
S = input()
T = input()
ansCnt = 0
for i in range(len(S)):
    if S == T:
        break
    S = S[-1] + S[0:-1]
if S == T:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = list(map(int, input().split()))

for i in range(N):
    tmp = x.pop(i)
    tmplst = sorted(x)
    print(tmplst[(N - 1) // 2])
    x.insert(i, tmp)


Fixed submission:
import statistics

N = int(input())
x = list(map(int, input().split()))
sx = sorted(x)
tmp = statistics.median(sx)

for i in range(N):
    if x[i] <= tmp:
        print(sx[((N - 1) // 2) + 1])
    else:
        print(sx[(N - 1) // 2])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [list(input()) for _ in range(N)]

ans = 0
cntM = 0
cntA = 0
cntR = 0
cntC = 0
cntH = 0
for i in range(N):
    cntM += (1 if S[i][0] == 'M' else 0)
    cntA += (1 if S[i][0] == 'A' else 0)
    cntR += (1 if S[i][0] == 'R' else 0)
    cntC += (1 if S[i][0] == 'C' else 0)
    cntH += (1 if S[i][0] == 'H' else 0)
cntlst = [cntM, cntA, cntR, cntC, cntH]

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            ans += cntlst[i] * cntlst[j] * cntlst[k]
print(ans)

Fixed submission:
N = int(input())
S = [list(input()) for _ in range(N)]

ans = 0
cntM = 0
cntA = 0
cntR = 0
cntC = 0
cntH = 0
for i in range(N):
    cntM += (1 if S[i][0] == 'M' else 0)
    cntA += (1 if S[i][0] == 'A' else 0)
    cntR += (1 if S[i][0] == 'R' else 0)
    cntC += (1 if S[i][0] == 'C' else 0)
    cntH += (1 if S[i][0] == 'H' else 0)
cntlst = [cntM, cntA, cntR, cntC, cntH]

for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += cntlst[i] * cntlst[j] * cntlst[k]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
X, Y = map(int, input().split())
if X == Y:
    print(-1)
    sys.exit()

for i in range(2, 10 ** 18 + 1):
    ans = i * X
    if ans % Y != 0:
        print(ans)
        sys.exit()

Fixed submission:
import sys
X, Y = map(int, input().split())
if X % Y == 0:
    print(-1)
    sys.exit()

for i in range(2, 10 ** 18 + 1):
    ans = i * X
    if ans % Y != 0:
        print(ans)
        sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)

INF = 10**18
N, M = map(int, input().split())
g = [[] for _ in range(N)]
lst = [INF] * N

def dfs(v):
    for n, d in g[v]:
        if lst[n] == INF:
            lst[n] = lst[v] + d
            if not dfs(n):
                return False
        else:
            if lst[n] != lst[v] + d:
                return False
    return True

for i in range(M):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    g[l].append((r, d))
    g[r].append((l, -d))

for i in range(N):
    if lst[i] == INF:
        lst[i] = 0
        if not dfs(i):
            print('No')
            exit()

print('Yes')

Fixed submission:
import sys
sys.setrecursionlimit(10**7)

INF = 10**18
N, M = map(int, input().split())
g = [[] for _ in range(N)]
lst = [INF] * N

def dfs(v):
    for n, d in g[v]:
        if lst[n] == INF:
            lst[n] = lst[v] + d
            if not dfs(n):
                return False
        else:
            if lst[n] != lst[v] + d:
                return False
    return True

for i in range(M):
    l, r, d = map(int, input().split())
    l -= 1
    r -= 1
    g[l].append((r, d))
    g[r].append((l, -d))

for i in range(N):
    if lst[i] == INF:
        lst[i] = 0
        if not dfs(i):
            print('No')
            exit()

print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans = c[j][1] + c[j][0]
        else:
            index = 1
            tmp = c[j][1] + c[j][2]
            while ans > tmp:
                tmp = c[j][1] + index * c[j][2]
                index += 1
            ans += (tmp - ans) + c[j][0]

    anslst[i] = ans

for i in anslst:
    print(i)

Fixed submission:
N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans += (c[j][1] - ans) + c[j][0]
        else:
            sho, amari = divmod(ans, c[j][2])
            if amari == 0:
                ans += c[j][0]
            else:
                ans += c[j][0] + (((sho + 1) * c[j][2]) - ans)

    anslst[i] = ans

for i in anslst:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
aList = list(map(int, input().split()))
tmp = set(aList)
tmpLst = list(tmp)
ans = 0

for i in tmpLst:
    t1 = aList.count(i)
    t2 = t1 - i
    if t2 > 0:
        ans += t2
    elif t2 < 0:
        ans += t1
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
aList = Counter(int(x) for x in input().split())
ans = 0
for i, j in aList.items():
    if i < j:
        ans += j - i
    elif i > j:
        ans += j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, K = map(int, input().split())
a = list(map(int, input().split()))

seta = set(a)
cntK = len(seta)
cnta = [0] * cntK
if cntK <= K:
    print(0)
    sys.exit()

for i in range(len(seta)):
    cnta[i] = a.count(seta.pop())

cnta.sort()
cnt = 0
for i in range(cntK - K):
    cnt += cnta[i]

print(cnt)

Fixed submission:
import sys
from collections import defaultdict
N, K = map(int, input().split())
a = list(map(int, input().split()))

seta = set(a)
cntK = len(seta)
cnta = [0] * cntK
if cntK <= K:
    print(0)
    sys.exit()

d = defaultdict(int)
for key in a:
    d[key] += 1

dtmp = sorted(d.items(), key=lambda x: x[1])
cnt = 0
for i in range(cntK - K):
    cnt += dtmp[i][1]
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if S.count(T) != 0:
    S = S.replace('?', 'a')
    print(S)
    sys.exit()

for i in range(len(S)):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        break
    else:
        s = -1
        e = -1
if s == -1:
    print(ans)
else:
    ans = S.replace('?', 'a')
    ans = ans[:s] + T + ans[e:]
    print(ans)


Fixed submission:
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if len(S) < len(T):
    print(ans)
    sys.exit()

tmp = True
anss = -1
anse = -1
for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        anss = i
        anse = i + len(T)

if anss == -1:
    print(ans)

else:
    ans = S.replace('?', 'a')
    ans = ans[:anss] + T + ans[anse:]
    print(ans)

Buggy python submission (verdict: Runtime Error):
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'
if S.count(T) != 0:
    S = S.replace('?', 'a')
    print(S)
    sys.exit()

for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        break
    else:
        s = -1
        e = -1
if s == -1:
    print(ans)
else:
    ans = S.replace('?', 'a')
    ans = ans[:s] + T + ans[e:]
    print(ans)

Fixed submission:
import sys
S = input()
T = input()
ans = 'UNRESTORABLE'

if len(S) < len(T):
    print(ans)
    sys.exit()

if len(S) < len(T):
    print(ans)
    sys.exit()

tmp = True
anss = -1
anse = -1
for i in range(len(S) - len(T) + 1):
    tmp = True
    s = i
    e = i + len(T)
    for j in range(len(T)):
        if S[i + j] != '?' and\
            S[i + j] != T[j]:
            tmp = False
            break

    if tmp:
        anss = i
        anse = i + len(T)

if anss == -1:
    print(ans)

else:
    ans = S.replace('?', 'a')
    ans = ans[:anss] + T + ans[anse:]
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
k = [[] for _ in range(N)]
flst = [list([0] * 2) for _ in range(M)]

for i in range(M):
    a, b = map(int, input().split())
    k[b - 1].append(a - 1)
    k[a - 1].append(b - 1)
    flst[i][0] = a
    flst[i][1] = b

d = [0] * M
def dfs(v):
    d[v] = 1
    for i in range(len(k[v])):
        if d[k[v][i]] == 0:
            dfs(k[v][i])
    return
ans = 0
for i in range(M):
    tmp1 = k[flst[i][0] - 1].index(flst[i][1] - 1)
    tmp2 = k[flst[i][1] - 1].index(flst[i][0] - 1)
    k[flst[i][0] - 1].pop(tmp1)
    k[flst[i][1] - 1].pop(tmp2)
    dfs(0)
    if sum(d) != N:
        ans += 1

    d = [0] * M
    k[flst[i][0] - 1].append(flst[i][1] - 1)
    k[flst[i][1] - 1].append(flst[i][0] - 1)

print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
k = [[] for _ in range(N)]
flst = [list([0] * 2) for _ in range(M)]

for i in range(M):
    a, b = map(int, input().split())
    k[b - 1].append(a - 1)
    k[a - 1].append(b - 1)
    flst[i][0] = a
    flst[i][1] = b

d = [0] * N
def dfs(v):
    d[v] = 1
    for i in range(len(k[v])):
        if d[k[v][i]] == 0:
            dfs(k[v][i])
    return
ans = 0
for i in range(M):
    tmp1 = k[flst[i][0] - 1].index(flst[i][1] - 1)
    tmp2 = k[flst[i][1] - 1].index(flst[i][0] - 1)
    k[flst[i][0] - 1].pop(tmp1)
    k[flst[i][1] - 1].pop(tmp2)
    dfs(0)
    if sum(d) != N:
        ans += 1

    d = [0] * N
    k[flst[i][0] - 1].append(flst[i][1] - 1)
    k[flst[i][1] - 1].append(flst[i][0] - 1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = 0
h = 0
w = 0

for i in range(1, 3501):
    for j in range(1, 3501):
        tmp1 = N * i * j
        tmp2 = (4 * i * j) - (N * j) - (N * i)
        if tmp2 != 0:
            s, m = divmod(tmp1, tmp2)
            if m == 0 and s >= 0:
                n, h, w = i, j, s
                print(n, h, w)
                exit()


Fixed submission:
N = int(input())
n = 0
h = 0
w = 0

for i in range(1, 3501):
    for j in range(1, 3501):
        tmp1 = N * i * j
        tmp2 = (4 * i * j) - (N * j) - (N * i)
        if tmp2 != 0:
            s, m = divmod(tmp1, tmp2)
            if m == 0 and s >= 0:
                n, h, w = i, j, s
                print(n, h, w)
                exit()
Buggy python submission (verdict: Runtime Error):
S=input()
if S[：4]=='YAKI'：
    print('Yes')
else：
    print('No')
 


Fixed submission:
S = input()
if len(S) < 4:
    print("No")
    exit(0)
if S[:4] == "YAKI":
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
if S[：4]=='YAKI'：
    print('Yes')
else：
    print('No')
 

Fixed submission:
S = input()
if len(S) < 4:
    print("No")
    exit(0)
if S[:4] == "YAKI":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
def warshallFloyd():
    for i in range(N):
        for j in range(N):
            if dp[j][i] == INF: continue
            for k in range(N):
                if dp[i][k] == INF: continue
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k])
    return

INF = 10 ** 18
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
dp = [[INF for _ in range(N)] for _ in range(N)]
ansF = False
for i in range(N):
    for j in range(N):
        if i == j:
            dp[i][j] = 0

for i in range(M):
    a, b, c = map(int, input().split())
    dp[a - 1][b - 1] = c
    dp[b - 1][a - 1] = c

warshallFloyd()
ans = INF
for i in permutations(r):
    tmp = 0
    for j in range(1, len(i)):
        tmp += dp[i[j - 1] - 1][i[j] - 1]
    ans = min(ans, tmp)

print(ans)

Fixed submission:
from itertools import permutations
def warshallFloyd():
    for i in range(N):
        for j in range(N):
            for k in range(N):
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k])
    return

INF = 10 ** 18
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
dp = [[INF for _ in range(N)] for _ in range(N)]
ansF = False
for i in range(N):
    for j in range(N):
        if i == j:
            dp[i][j] = 0

for i in range(M):
    a, b, c = map(int, input().split())
    dp[a - 1][b - 1] = c
    dp[b - 1][a - 1] = c

warshallFloyd()
ans = INF
for i in permutations(r):
    tmp = 0
    for j in range(1, len(i)):
        tmp += dp[i[j - 1] - 1][i[j] - 1]
    ans = min(ans, tmp)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
def warshallFloyd():
    for i in range(N):
        for j in range(N):
            for k in range(N):
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k])
    return

INF = 10 ** 18
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
dp = [[INF for _ in range(N)] for _ in range(N)]
ansF = False
for i in range(N):
    for j in range(N):
        if i == j:
            dp[i][j] = 0

for i in range(M):
    a, b, c = map(int, input().split())
    dp[a - 1][b - 1] = c
    dp[b - 1][a - 1] = c

warshallFloyd()
ans = INF
for i in permutations(r):
    tmp = 0
    for j in range(1, len(i)):
        tmp += dp[i[j - 1] - 1][i[j] - 1]
    ans = min(ans, tmp)

print(ans)

Fixed submission:
from itertools import permutations
def warshallFloyd():
    for i in range(N):
        for j in range(N):
            for k in range(N):
                dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k])
    return

INF = 10 ** 18
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
dp = [[INF for _ in range(N)] for _ in range(N)]
ansF = False
for i in range(N):
    for j in range(N):
        if i == j:
            dp[i][j] = 0

for i in range(M):
    a, b, c = map(int, input().split())
    dp[a - 1][b - 1] = c
    dp[b - 1][a - 1] = c

warshallFloyd()
ans = INF
for i in permutations(r):
    tmp = 0
    for j in range(1, len(i)):
        tmp += dp[i[j - 1] - 1][i[j] - 1]
    ans = min(ans, tmp)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
aset = set(a)

cnt = 0
for i in aset:
    tmp = a.count(i) + a.count(i + 1) + a.count(i - 1)
    if cnt <= tmp:
        cnt = tmp

print(cnt)

Fixed submission:
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)

for key in a:
    d[key] += 1

cnt = 0
for i in d:
    d1 = 0
    d2 = 0
    if (i - 1) in d:
        d1 = d[i - 1]
    if (i + 1) in d:
        d2 = d[i + 1]

    cnt = max(cnt, d[i] + d1 + d2)

print(cnt)

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

cnt = 0
for i in aset:
    tmp = a.count(i) + a.count(i + 1) + a.count(i - 1)
    if cnt <= tmp:
        cnt = tmp

print(cnt)

Fixed submission:
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)

for key in a:
    d[key] += 1

cnt = 0
for i in d:
    d1 = 0
    d2 = 0
    if (i - 1) in d:
        d1 = d[i - 1]
    if (i + 1) in d:
        d2 = d[i + 1]

    cnt = max(cnt, d[i] + d1 + d2)

print(cnt)

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

cnt = 0
for i in a:
    tmp = a.count(i) + a.count(i + 1) + a.count(i - 1)
    if cnt <= tmp:
        cnt = tmp

print(cnt)

Fixed submission:
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)

for key in a:
    d[key] += 1

cnt = 0
for i in d:
    d1 = 0
    d2 = 0
    if (i - 1) in d:
        d1 = d[i - 1]
    if (i + 1) in d:
        d2 = d[i + 1]

    cnt = max(cnt, d[i] + d1 + d2)

print(cnt)

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

cnt = 0
for i in a:
    tmp = a.count(i) + a.count(i + 1) + a.count(i - 1)
    if cnt <= tmp:
        cnt = tmp

print(cnt)

Fixed submission:
from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)

for key in a:
    d[key] += 1

cnt = 0
for i in d:
    d1 = 0
    d2 = 0
    if (i - 1) in d:
        d1 = d[i - 1]
    if (i + 1) in d:
        d2 = d[i + 1]

    cnt = max(cnt, d[i] + d1 + d2)

print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
cnt = 0
if p[0] == 1:
    tmp = p[1]
    p[1] = p[0]
    p[0] = tmp
    cnt += 1

for i in range(N, 0, -1):
    if i == p[i - 1]:
        tmp = p[i]
        p[i] = p[i - 1]
        p[i - 1] = tmp
        cnt += 1

print(cnt)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
cnt = 0
if p[0] == 1:
    tmp = p[1]
    p[1] = p[0]
    p[0] = tmp
    cnt += 1

for i in range(N - 1, -1, -1):
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i - 1]
        p[i - 1] = tmp
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
cnt = 0
if p[0] == 1:
    tmp = p[1]
    p[1] = p[0]
    p[0] = tmp
    cnt += 1

for i in range(N, 0, -1):
    if i == p[i - 1]:
        tmp = p[i]
        p[i] = p[i - 1]
        p[i - 1] = tmp
        cnt += 1

print(p, cnt)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
cnt = 0
if p[0] == 1:
    tmp = p[1]
    p[1] = p[0]
    p[0] = tmp
    cnt += 1

for i in range(N - 1, -1, -1):
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i - 1]
        p[i - 1] = tmp
        cnt += 1

print(cnt)