Buggy python submission (verdict: Runtime Error):
N = int(input())
alist = list(map(int, input().split()))
aset = set(alist)
max_num = 0
X = 0
for x in xset:
    num = len([xx for xx in alist if x == xx])
    if max_num < num:
        max_num = num
        X = x
max_num = 0
for x in [X - 1, X, X + 1]:
    num = len([xx for xx in alist if x - 1 <= xx <= x + 1])
    max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
aset = set(alist)
xset = set()
for a in aset:
    xset.add(a - 1)
    xset.add(a)
    xset.add(a + 1)
max_num = 0
for x in xset:    
        num = len([xx for xx in alist if x -1 <= xx <= x + 1])
        max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
aset = set(alist)
min_x, max_x = min(alist), max(alist)
max_num = 0
for x in range(min_x, max_x + 1):
    if x in aset:
        num = len([xx for xx in alist if x -1 <= xx <= x + 1])
        max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
min_x, max_x = min(alist), max(alist)
max_num = 0
for x in range(min_x, max_x + 1):
    if x in alist:
        num = len([xx for xx in alist if x -1 <= xx <= x + 1])
        max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
min_x, max_x = min(alist), max(alist)
max_num = 0
for x in range(min_x, max_x + 1):
    num = len([xx for xx in alist if x -1 <= xx <= x + 1])
    max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))

Buggy python submission (verdict: Runtime Error):
N = int(input())
alist = list(map(int, input().split()))
min_x, max_x = min(alist), max(alist)
max_num = 0
for x in range(min_x, max_x + 1):
    num = len([xx for xx in alist if x -1 <= xx <== x + 1])
    max_num = max(max_num, num)
print(max_num)

Fixed submission:
from collections import defaultdict as dd
N = input()
a_raw = list(map(int, input().split()))
num_count = dd(int)
for item in a_raw:
    num_count[item] += 1
    num_count[item-1] += 1
    num_count[item+1] += 1
print(max(num_count.values()))