Simple c++ code || sorting
C++ Code-\n\n\nclass Solution {\npublic:\n    \n    static bool comp(const pair<int,int> &a,pair<int,int>&b)\n    {\n       return a.first>b.first;\n    }\n    
C++ Code-\n\n```\nclass Solution {\npublic:\n    \n    static bool comp(const pair<int,int> &a,pair<int,int>&b)\n    {\n       return a.first>b.first;\n    }\n    int miceAndCheese(vector<int>& r1, vector<int>& r2, int k) {\n        \n        vector<pair<int,int>> v;\n        int n=r1.size();\n        for(int i=0;i<n;i++)\n        {\n            v.push_back({r1[i]-r2[i],i});\n        }\n        sort(v.begin(),v.end(),comp);\n        vector<bool> vis(n,0);\n        int ans=0;\n        int j=0;\n        for(auto x:v)\n        {\n            if(j<k)\n            {\n              ans+=r1[x.second];\n                vis[x.second]=1;\n                j++;\n            }\n        }\n        for(int i=0;i<n;i++)\n        {\n            if(!vis[i])\n            {\n                ans+=r2[i];\n            }\n        }\n        return ans;\n    }\n};\n```
['C', 'Sorting']