Java Solution BEATS 77%
Code
# Code\n```java []\nclass Pair{\n    double ratio;\n    int index;\n    Pair(double ratio,int index)\n    {\n        this.ratio=ratio;\n        this.index=index;\n    }\n}\n\nclass Solution {\n    public double maxAverageRatio(int[][] classes, int extraStudents) {\n        PriorityQueue<Pair> pq=new PriorityQueue<>((a,b)->Double.compare(b.ratio,a.ratio));\n        int n=classes.length;\n        for(int i=0;i<n;i++)\n        {\n            double r=(classes[i][0]*1.0)/(classes[i][1]*1.0);\n            double r2=((classes[i][0]+1)*1.0)/((classes[i][1]+1)*1.0);\n            pq.add(new Pair(r2-r,i));\n        }\n        while(extraStudents>0)\n        {\n            int ind=pq.peek().index;\n            pq.remove();\n            classes[ind][0]++;\n            classes[ind][1]++;\n            double r=(classes[ind][0]*1.0)/(classes[ind][1]*1.0);\n            double r2=((classes[ind][0]+1)*1.0)/((classes[ind][1]+1)*1.0);\n            pq.add(new Pair(r2-r,ind));\n            extraStudents--;\n        }\n        double ans=0;\n        for(int i=0;i<n;i++)\n        {\n            ans+=(classes[i][0]*1.0)/(classes[i][1]*1.0);\n        }\n        return ans/n;\n    }\n}\n```
['Array', 'Math', 'Greedy', 'Memoization', 'Queue', 'Sorting', 'Heap (Priority Queue)', 'Counting', 'Java']