Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A_ = sorted(A_)
A = np.array(A_)

dic = {}
for a in A:
    dic[a] = 0

for a in A:
    dic[a] += 1

ans = 0
for X in dic.keys():
    tmp = 0
    tmp = np.sum((X-1 <= A) & (A<= X+1))
    ans = max(tmp,ans)


# ans = max(ans,dic[X] + dic[X+1])

# for X in A[1:]:

#     tmp = dic[]


#     tmp = dic[dic.key()] + dic[X] + dic[X+1]

#     ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A_ = sorted(A_)
A = np.array(A_)

ans = 0
for X in A:
    tmp = 0
    tmp = np.sum((X-1 <= A) & (A<= X+1))
    ans = max(tmp,ans)
# dic = {}
# for a in A:
#     dic[a] = 0

# for a in A:
#     dic[a] += 1


# ans = max(ans,dic[X] + dic[X+1])

# for X in A[1:]:

#     tmp = dic[]


#     tmp = dic[dic.key()] + dic[X] + dic[X+1]

#     ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A_ = sorted(A_)
A = np.array(A_)

dic = {}
for a in A:
    dic[a] = 0

for a in A:
    dic[a] += 1


ans = 0

for X in range(A[1],A[-1]):
    tmp = dic[X-1] + dic[X] + dic[X+1]

    ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A_ = sorted(A_)
A = np.array(A_)
ans = 0

for X in range(A[0],A[-1]+1):
    tmp = np.sum((X-1 <= A) & (A<= X+1))
    ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))
A_ = sorted(A_)

A = np.array(A_)

ans = 0
for X in range(np.min(A),np.max(A)+1):
    tmp = 0
    for a in A:
        if X-1 <= a <= X+1:
            tmp += 1
        elif X+1 < a:
            break
    ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A = np.array(A_)

ans = 0
for X in range(np.min(A),np.max(A)+1):
    tmp = 0
    for a in A:
        if X-1 <= a <= X+1:
            tmp += 1
    ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A_ = list(map(int, input().split()))

A = np.array(A_)

ans = 0
for X in range(np.min(A),np.max(A)+1):
    tmp = 0
    for a in A:
        if a == X or a == X+1 or a == X-1:
            tmp += 1
    ans = max(tmp,ans)
print(ans)


Fixed submission:
import collections

N = int(input())
A = sorted(list(map(int, input().split())))

dic = collections.Counter(A)
tmp = [0 for _ in range(A[-1]+1)]


for X in dic.keys():
    tmp[X] = dic[X]

ans = 0
for i in range(len(tmp)):
    ans = max(ans,sum(tmp[i:i+3]))

print(ans)