Clean Python 3, greedy with heap
Greedy add genius students into most benefit class.\n\nTime: O(N + ElogN)\nSpace: O(N)\n\nimport heapq\nclass Solution:\n    def maxAverageRatio(self, classes: 
Greedy add genius students into most benefit class.\n\nTime: `O(N + ElogN)`\nSpace: `O(N)`\n```\nimport heapq\nclass Solution:\n    def maxAverageRatio(self, classes: List[List[int]], extraStudents: int) -> float:\n        total = sum(p / t for p, t in classes)\n        heap = [(p / t - (p + 1) / (t + 1), p, t) for p, t in classes]\n        heapq.heapify(heap)\n        for _ in range(extraStudents):\n            increase, p, t = heapq.heappop(heap)\n            total -= increase\n            p, t = p + 1, t + 1\n            heapq.heappush(heap, ((p / t - (p + 1) / (t + 1), p, t)))\n        return total / len(classes)\n```
[]