apple pie's submission of Infernos | CodeChef