KCOMPRESS August long challenge

I am a newbie to competitive programming, can someone please explain the logic behind this question
Link : https://www.codechef.com/problems/KCOMPRES/