Help me in solving GSCP14 problem

My issue

I am not able to understand code in the solution

Learning course: [C for problem solving - 1](https://www.codechef.com/learn/c-beginner-v2-p1)
Problem Link: https://www.codechef.com/learn/BC01BC04_V2/problems/GSCP14