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

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = s[i]
        c = collections.Counter(s)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans) 

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)

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

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = s[i]
        c = collections.Counter(s)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans) 

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)

Buggy python submission (verdict: Runtime Error):
import counter

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = s[i]
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans) 

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)

Buggy python submission (verdict: Runtime Error):
import counter

num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = int(s[i])
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans) 

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)

Buggy python submission (verdict: Runtime Error):
import counter

num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = int(s[i])
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans) 

Fixed submission:
import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)