@admin @shalithasurang @vijju123 Plz, remove this question this is against the policies of codechef. This question is already available on codechef. https://www.codechef.com/viewsolution/17870769 check my sol here.
In my soln I have mentioned original question in my soln.
This question also lacks proper specifications.
Original question Link - https://www.codechef.com/JULY17/problems/NITIKA/