C++ | using priority_queue | simple and sort
\nclass Solution {\npublic:\n    double mx(double a,double b)\n    {\n        return (a+1)/(b+1)-a/b;\n    }\n    \n    double maxAverageRatio(vector<vector<int
```\nclass Solution {\npublic:\n    double mx(double a,double b)\n    {\n        return (a+1)/(b+1)-a/b;\n    }\n    \n    double maxAverageRatio(vector<vector<int>>& cls, int extra) {\n        priority_queue<pair<double,pair<double,double>>> pq;\n        \n        for(auto v:cls)\n            pq.push({mx(v[0],v[1]),{v[0],v[1]}});\n        \n        while(extra--)\n        {\n            pair<double,pair<double,double>> p=pq.top();\n            \n            p.first=mx(p.second.first+1,p.second.second+1);\n            pq.pop();\n            p.second.first+=1;\n            p.second.second+=1;\n            pq.push(p);\n        }\n        double ans=0;\n        while(!pq.empty())\n        {\n           pair<double,pair<double,double>> p=pq.top();\n            pq.pop();\n            ans+=p.second.first/p.second.second;\n        }\n        \n        return ans/cls.size();\n        \n    }\n};\n```
['C', 'C++']