This is a google hash code 2017 challenge solution.
The first committed version of the problem solves the problem better, but takes eternity to do so. The following commits are just attempts to solve the problem faster by code optimisation and quality sacrifices.
Not indicative of my code style at all.
That's just what happens when solving the problem at hand is the only priority.