QUES: happy birthday codechef(coderush contest)


please anyone solve the problem and explain the logic of the solution !