Stuck in the problem VLD

I am stuck in the problem https://www.codechef.com/ALKH2016/problems/VLD
Any help will be appreciated…