I'm not proud of my implementation to last 2 days, but they work in a reasonable time. I might optimize them later... Problem is largely with my hash structures. Preallocating a lot of elements before running day22 makes it run in less than half of the current time.