Pair Stl || sort || easy understanding || C++
\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n        int n = reward1.size();\n        vector<pair<in
```\nclass Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n        int n = reward1.size();\n        vector<pair<int,int>> cheese(n);\n        for(int i=0;i<n;i++){\n            cheese[i] = {reward1[i] - reward2[i], i};\n        }\n        sort(cheese.begin(), cheese.end(), greater<pair<int,int>>());\n        int ans = 0;\n        for(int i=0;i<k;i++){\n            ans += reward1[cheese[i].second];\n        }\n        for(int i=k;i<n;i++){\n            ans += reward2[cheese[i].second];\n        }\n        return ans;\n    }\n};\n```
['Sorting']