from functools import reduce
def remove_sublist(big_list, sub_list):
result = reduce(lambda r, x: r[:1]+([1]+r[2:-r[1]],[min(len(r[0]),r[1]+1)]+r[2:])[r[-r[1]:]!=r[0]]+[x], big_list+[0], [sub_list, 1])[2:-1]
print("remove_sublist(%s, %s) == %s" % (big_list, sub_list, result))
return result
remove_sublist([], [1, 2])
remove_sublist([2, 1, 2, 3, 1, 2, 4], [1])
remove_sublist([2, 1, 2, 3, 1, 2, 4], [1, 2])
remove_sublist([2, 1, 2, 3, 1, 2, 4], [2, 1])
remove_sublist([2, 1, 2, 3, 1, 2, 4], [2, 3, 1])
remove_sublist([2, 1, 2, 3, 1, 2, 4, 1, 2], [1, 2])
remove_sublist([1, 2, 3, 1, 2, 4, 1, 2], [1, 2])
remove_sublist([1, 1, 2, 2, 3, 1, 2, 4], [1, 2])
ZnJvbSBmdW5jdG9vbHMgaW1wb3J0IHJlZHVjZQoKZGVmIHJlbW92ZV9zdWJsaXN0KGJpZ19saXN0LCBzdWJfbGlzdCk6CiAgICByZXN1bHQgPSByZWR1Y2UobGFtYmRhIHIsIHg6IHJbOjFdKyhbMV0rclsyOi1yWzFdXSxbbWluKGxlbihyWzBdKSxyWzFdKzEpXStyWzI6XSlbclstclsxXTpdIT1yWzBdXStbeF0sIGJpZ19saXN0K1swXSwgW3N1Yl9saXN0LCAxXSlbMjotMV0KICAgIHByaW50KCJyZW1vdmVfc3VibGlzdCglcywgJXMpID09ICVzIiAlIChiaWdfbGlzdCwgc3ViX2xpc3QsIHJlc3VsdCkpCiAgICByZXR1cm4gcmVzdWx0CgoKcmVtb3ZlX3N1Ymxpc3QoW10sIFsxLCAyXSkKcmVtb3ZlX3N1Ymxpc3QoWzIsIDEsIDIsIDMsIDEsIDIsIDRdLCBbMV0pCnJlbW92ZV9zdWJsaXN0KFsyLCAxLCAyLCAzLCAxLCAyLCA0XSwgWzEsIDJdKQpyZW1vdmVfc3VibGlzdChbMiwgMSwgMiwgMywgMSwgMiwgNF0sIFsyLCAxX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