This is hacky stuff for advent of code.

It is not good code. It is not maintainable code. It is correct code. The first couple solutions are just for the second part, as I modified the original solution and now it is gone forever