Java Priority Queue Solution
\nclass Solution {\n    public int miceAndCheese(int[] reward1, int[] reward2, int k) {\n        PriorityQueue<Pair<Integer, Integer>> pq = new PriorityQueue<>(
```\nclass Solution {\n    public int miceAndCheese(int[] reward1, int[] reward2, int k) {\n        PriorityQueue<Pair<Integer, Integer>> pq = new PriorityQueue<>((a, b) -> Integer.compare(b.getValue(), a.getValue()));\n        for (int i = 0; i < reward1.length; i++) {\n            int diff = reward1[i] - reward2[i];\n            pq.offer(new Pair(i, diff));\n        }\n        int result = 0;\n        Set<Integer> set = new HashSet<>();\n        while (!pq.isEmpty() && k > 0) {\n            Pair<Integer, Integer> pair = pq.poll();\n            result = result + reward1[pair.getKey()];\n            set.add(pair.getKey());\n            k--;\n        }\n        for (int i = 0; i < reward2.length; i++) {\n            if (set.contains(i)) continue;\n            result = result + reward2[i];\n        }\n        return result;\n    }\n}\n```
['Heap (Priority Queue)', 'Java']