Simple C++ solution
Intuition\nwe have to make sure that a larger reward should not missed because of some smaller reward that is rewarded to mice 1.\n Describe your first thoughts
# Intuition\nwe have to make sure that a larger reward should not missed because of some smaller reward that is rewarded to mice 1.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nSo to achieve that we pair the rewards ans sort them according to thier difference\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(Nlog(N))\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- - Space complexity: -->\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    static bool comp(vector<int> &a, vector<int> &b){\n        return a[0]-a[1] > b[0]-b[1]; \n    }\npublic:\n    int miceAndCheese(vector<int>& r1, vector<int>& r2, int k) {\n        int n = r1.size(); \n        vector<vector<int>> v(n, vector<int>(2)); \n        for(int i=0; i<n; i++){\n            v[i] = {r1[i], r2[i]}; \n        }\n        sort(v.begin(), v.end(), comp); \n        \n        int res = 0; \n        for(int i=0; i<n; i++){\n            if(i<k){\n                res += v[i][0]; // for mice 1\n            }\n            else res += v[i][1]; // for mice 2\n        }\n        return res; \n    }\n};\n```
['Sorting', 'C++']