All testcases incorrect in Beautiful Vertices

Please check my algorithm if I am missing some cases

@vivek21,
Beautiful Vertex is defined as that vertex which has more children than its parent. But every vertex has its own different parent and children.
Sample test case:
10 9
1 2
2 4
2 5
2 6
5 8
1 3
3 7
7 11
7 13
Correct output - 2
Your output - 1

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.