C++|| sorting
\nclass Solution\n{\npublic:\n    static bool comp(vector<int> &a, vector<int> &b)\n    {\n        return a[0] > b[0];\n    }\n    int miceAndCheese(vector<int>
```\nclass Solution\n{\npublic:\n    static bool comp(vector<int> &a, vector<int> &b)\n    {\n        return a[0] > b[0];\n    }\n    int miceAndCheese(vector<int> &reward1, vector<int> &reward2, int k)\n    {\n        vector<vector<int>> arr;\n        for (int i = 0; i < reward1.size(); i++)\n        {\n            arr.push_back({reward1[i] - reward2[i], reward1[i], reward2[i]});\n        }\n        sort(arr.begin(), arr.end(), comp);\n        int ans = 0;\n        int i = 0;\n        while (k > 0)\n        {\n            ans += arr[i][1];\n            i++;\n            k--;\n        }\n        for (; i < arr.size(); i++)\n            ans += arr[i][2];\n\n        return ans;\n    }\n};\n```
[]