solve using vector pair in c++
class Solution {\npublic:\n    int miceAndCheese(vector& reward1, vector& reward2, int k) {\n        int n = reward1.size();\n        vector>>vpp;\n        for(
class Solution {\npublic:\n    int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n        int n = reward1.size();\n        vector<pair<int,pair<int,int>>>vpp;\n        for(int i=0; i<n; i++){\n            vpp.push_back(make_pair(reward1[i]-reward2[i],make_pair(reward1[i],i)));\n        }\n        sort(vpp.begin(),vpp.end());\n        reverse(vpp.begin(),vpp.end());\n        int i=0, ans=0;\n        map<int,int>mpp;\n        \n        while(k--){\n            ans += vpp[i].second.first;\n            ++mpp[vpp[i].second.second];\n            i++;\n        }\n        for(i=0; i<n; i++){\n            if(mpp[i] == 0) {\n                ans += reward2[i];\n            }\n        }\n        return ans;\n    }\n};
['Sorting']