I was solving this question http://mirror.codeforces.com/problemset/problem/696/E and my code is passsing in less than a second int max test cases as in test case 10 but it is giving TLE in test case 14 where there is a single node.I am unable to find where it is getting TLE. someone please help and please do not down vote as i have been caught for a while. My submission: http://mirror.codeforces.com/contest/696/submission/19464350