Amit Dwivedi's submission of Mahasena | CodeChef