Easy C++ solution || commented fully & explained
\nclass Solution {\npublic:\n    double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {\n     \n        //among all classes i choose the one 
```\nclass Solution {\npublic:\n    double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {\n     \n        //among all classes i choose the one which will have a larger growth in the pass ratio if i add one student to the class\n        \n        //add one student to the each class and store the growth (difference) in the pass ratio to a max heap\n        using pi=pair<double,pair<int,int>>;\n        priority_queue<pair<double,pair<int,int>>> pq;\n        //double is used to store the difference\n        //pair.first stores the pass students in the class\n        //pair.second stores the total students in the class\n        for(int i=0;i<classes.size();i++)\n        {\n            int pass=classes[i][0];\n            int total=classes[i][1];\n            \n            //calculate the growth\n           long  double growth=(double)(pass+1)/(total+1) - (double)(pass)/(total);\n            pq.push({growth,{pass,total}});\n        }\n        \n        //now i have not added any students to any class and the number of students still remains the same\n        //i have just want to know which class would have more growth if i add one \n        //so i pushed all the classes growth to max heap\n        \n        while(extraStudents)\n        {\n            pi top= pq.top();\n            pq.pop();\n            extraStudents--;\n            //calculate the growth again if i add one student to the class at the top\n            int pass=top.second.first;\n            int total=top.second.second;\n            pass++;\n            total++;\n            long double growth=(double)(pass+1)/(total+1) - (double)(pass)/(total);\n            pq.push({growth,{pass,total}});\n        }\n        \n        //now pop out the elements from pq and calculate the pass ratio\n        double res=0;\n        while(!pq.empty())\n        {\n            //calculate the pass/total;\n            res+=(double)(pq.top().second.first)/(pq.top().second.second);\n            pq.pop();\n        }\n        return (double)res/(classes.size());\n        \n    }\n};\n```\n**Upvote if this helps you :)**
['C', 'Heap (Priority Queue)']