C++ || EASY || FULLY COMMENTED
```\n  int cnt=0;\n    //pair of sum of subtree,numbr of nodes in the subtree is being used here\n    pair slv(TreeNoderoot)\n    {\n        // if root is null 
```\n  int cnt=0;\n    //pair of sum of subtree,numbr of nodes in the subtree is being used here\n    pair<int,int> slv(TreeNode*root)\n    {\n        // if root is null then sum and nmbr of nodes .. both are 0\n        if(!root)\n            return {0,0};\n        //get data from left subtree\n        pair<int,int>l=slv(root->left);\n        //get data from right subtree\n        pair<int,int>r=slv(root->right);\n        //calculate nmbr of nodes from left and right subtrees data \n        int n=l.second+r.second+1;\n        //calculate the sum of the complete subtree i.e root+left tree + right tree\n        int sum=l.first+r.first+root->val;\n        //if root\'s value is equal to avg then increase count\n        if(root->val==sum/n)\n          cnt++;\n        //return the sum and the nmbr of nodes calculated \n        return {sum,n};\n    }\n    \n    int averageOfSubtree(TreeNode* root) {\n       slv(root);\n        return cnt;\n    }
['Tree', 'Depth-First Search', 'Recursion', 'C', 'Binary Tree', 'C++']