Hemant Joshi's submission of Mahasena | CodeChef