c++ solution
\nclass Solution {\npublic:\n    vector<vector<int>>dp;\n    void find(int x,int p,vector<int>&sub)\n    {\n        for(auto it:dp[x])\n        {\n            i
```\nclass Solution {\npublic:\n    vector<vector<int>>dp;\n    void find(int x,int p,vector<int>&sub)\n    {\n        for(auto it:dp[x])\n        {\n            if(it!=p)\n            {\n               find(it,x,sub);\n               sub[x]+=sub[it];\n            }\n        }\n        \n    }\n    int countHighestScoreNodes(vector<int>& parents)\n    {\n        int n=parents.size();\n        dp.resize(n);\n        for(int i=1;i<n;i++)\n        {\n            dp[parents[i]].push_back(i);\n        }\n        vector<int>subtree(n,1);\n        find(0,-1,subtree);\n        map<long long ,int,greater<long long>>mp;\n        for(int i=0;i<n;i++)\n        {\n            long long  pro=max(1,n-subtree[i]);\n            for(auto it:dp[i])\n            {\n                pro=1ll*pro*subtree[it];\n            }\n            mp[pro]++;\n        }\n        return mp.begin()->second;\n    }\n};\n```
['Depth-First Search', 'C', 'C++']