Utkarsh Garg's submission of Mahasena | CodeChef