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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_uniq = list(set(A))

    a_list = np.zeros(100005)
    # a_list = [0 for _ in range(100005)]

    for a in A_uniq:
        a_cnt = A.count(a)
        a_list[a] += a_cnt
        a_list[a+1] += a_cnt
        a_list[a+2] += a_cnt

    print(int(a_list.max())) 

main()

Fixed submission:
import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
 
def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_uniq = f7(A)

    a_list = np.zeros(100005)

    for a in A_uniq:
        a_cnt = A.count(a)
        a_list[a] += a_cnt
        a_list[a+1] += a_cnt
        a_list[a+2] += a_cnt

    print(int(a_list.max())) 

main()

Fixed submission:
import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)

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

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

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

a_list = np.zeros(100005)

for a in A_uniq:
    a_cnt = A.count(a)
    a_list[a] += a_cnt
    a_list[a+1] += a_cnt
    a_list[a+2] += a_cnt
    
print(int(a_list.max())) 

Fixed submission:
import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)

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

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

a_list = np.zeros(100005)
# a_list = [0 for _ in range(100005)]

for a in A_uniq:
    a_cnt = A.count(a)
    a_list[a] += a_cnt
    a_list[a+1] += a_cnt
    a_list[a+2] += a_cnt
    
print(int(a_list.max())) 

Fixed submission:
import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)

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

a_list = [0 for _ in range(100005)]

for a in A_uniq:
    a_cnt = A.count(a)
    a_list[a] += a_cnt
    a_list[a+1] += a_cnt
    a_list[a+2] += a_cnt
    
            
print(max(a_list))   

Fixed submission:
import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)