codechef; solve "Mahesh and his lost array" from October Cook-Off 2014