max heap
Code\n\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) \n    {\n        priority_queue<vector<int>>pq;\n   
# Code\n```\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) \n    {\n        priority_queue<vector<int>>pq;\n        for(int i=0;i<reward1.size();i++)\n        {\n            int a = reward1[i];\n            int b = reward2[i];\n            int diff = a - b;\n            \n            pq.push({diff,reward1[i],reward2[i]});\n        }\n        int sum = 0;\n        while(!pq.empty())\n        {\n            if(k > 0)\n            {\n               sum = sum + pq.top()[1];\n               k--;\n            }\n            else\n            {\n                sum = sum + pq.top()[2];\n            }\n            pq.pop();\n        }\n        return sum;\n    }\n};\n```
['C++']