C++ || Priority Queue || Beats 95%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    double maxAverageRatio(vector<vector<int>>& classes, int k) {\n        priority_queue<pair<double,int>> pq;\n        for(int i=0;i<classes.size();i++)\n        {\n            int curr_n = classes[i][0];\n            int curr_d = classes[i][1];\n            double curr_f = (double)curr_n/(double)curr_d;\n            int new_n = curr_n+1;\n            int new_d = curr_d+1;\n            double new_f = (double)new_n/(double)new_d;\n\n            pq.push({new_f-curr_f,i});\n        }\n\n        while(k)\n        {\n            pair<double,int> p = pq.top();\n            pq.pop();\n            int index = p.second;\n            classes[index][0]+=1;\n            classes[index][1]+=1;\n\n            int new_n = classes[index][0]+1;\n            int new_d = classes[index][1]+1;\n            double new_f = (double)new_n/(double)new_d;\n            double curr_f = (double)classes[index][0]/(double)classes[index][1];\n\n            pq.push({new_f-curr_f,index});\n            k--;\n        }\n        double sum = 0;\n        for(int i=0;i<classes.size();i++)\n        {\n            sum+=(double)classes[i][0]/(double)classes[i][1];\n        }\n        return sum/(double)classes.size();\n    }\n};\n```
['C++']