Algorithmic competition Google Code Jam - my solutions