82 points in KCON LRNDSA06

I seem to be missing subtask 1.

Problem : https://www.codechef.com/LRNDSA06/problems/KCON/
Solution : https://www.codechef.com/viewsolution/33327843