Need Help with CodeForces Edu Section (DSU)

This problem is from Codeforces Edu Section. The problem is from DSU Step 1, problem no C. Experience.

Link : Courses - Codeforces

My Code : ZJt4a5 - Online C++0x Compiler & Debugging Tool -

Verdict: Wrong Answer on Test Case 7.
I cannot figure out why I am getting wrong answer. Please Help.