SPOJ-SLICK-HELP

Problem Link: https://www.spoj.com/problems/UCV2013H/
My Solution : https://ide.geeksforgeeks.org/vrYqUnsnJx
Verdict : Wrong Answer