You know team name for icpc ?
“DP nahi aati”
Have you checked editorial for this problem ? In what are part are you facing issue ?
Yes i have checked the editorial, I am stuck at the part where
There should be at least dp[i]ones in the subtree of i such that the number on i is one. Then k+1−dp is the final answer