a = [1, 2, 3, 3, 3, 4, 5, 6, 6, 6, 3, 3]
clean = []
trash = 0
for _, values in groupby(a):
values = list(values)
if len(values) < 3:
clean.extend(values)
trash = + 1 ## ВОТ ТУТ
for i in range(len(our_list) - 3, 0, -1):
for i in range(len(our_list) >3, 0, -1):
то код не работал with open('num.txt', 'r') as f:
num = list(map(int, f.readlines().split()))