Buggy python submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
tn = 0
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    if m>=len(x):break
    tn = i
print(m)






Fixed submission:
def abc072_c():
    from collections import Counter
 
    _ = int(input())
    a = list(map(int, input().split()))
    a_ex = []
    for num in a:
        a_ex.append(num)
        a_ex.append(num-1)
        a_ex.append(num+1)
 
    print(max(Counter(a_ex).values()))
 
 
abc072_c()

Buggy python submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
tn = 0
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    tn = i
print(m)






Fixed submission:
def abc072_c():
    from collections import Counter
 
    _ = int(input())
    a = list(map(int, input().split()))
    a_ex = []
    for num in a:
        a_ex.append(num)
        a_ex.append(num-1)
        a_ex.append(num+1)
 
    print(max(Counter(a_ex).values()))
 
 
abc072_c()

Buggy python submission (verdict: Runtime Error):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
for i in l:
    if i- tn==1:
        ta = tb
        tb = tc
        tc = x.count(i+1)
    else:
        ta = x.count(i-1)
        tb = x.count(i)
        tc = x.count(i+1)
    t = ta+tb+tc
    m=max(m,t)
    tn = i
print(m)






Fixed submission:
def abc072_c():
    from collections import Counter
 
    _ = int(input())
    a = list(map(int, input().split()))
    a_ex = []
    for num in a:
        a_ex.append(num)
        a_ex.append(num-1)
        a_ex.append(num+1)
 
    print(max(Counter(a_ex).values()))
 
 
abc072_c()

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import math
import re
import numpy


def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
k= []
l = []
f = 0
s=0
c=0
e =1
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
#def rep(i):return for i in range()
a = a()
x = lma()
l = set(x)
m=1
for i in l:
    t = x.count(i)+x.count(i+1)+x.count(i-1)
    m=max(m,t)
print(m)






Fixed submission:
def abc072_c():
    from collections import Counter
 
    _ = int(input())
    a = list(map(int, input().split()))
    a_ex = []
    for num in a:
        a_ex.append(num)
        a_ex.append(num-1)
        a_ex.append(num+1)
 
    print(max(Counter(a_ex).values()))
 
 
abc072_c()