Repeated question in CodeNight Contest Question Help Amal CONI2018

@admin @shalithasurang @vijju123 Plz, remove this question this is against the policies of codechef. This question is already available on codechef. check my sol here.
In my soln I have mentioned original question in my soln.
This question also lacks proper specifications.

Original question Link -