python| shortest code |greedy | mathematical proof | breif explained|
Intuition\n Describe your first thoughts on how to solve this problem. \nlet a be rat1 array and b be rat2 array\nso according to question....\n\nSince \u2211i 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nlet a be rat1 array and b be rat2 array\nso according to question....\n![image.png](https://assets.leetcode.com/users/images/b93b2e58-31a3-443e-87f5-1d0beb411335_1680429987.5440614.png)\nSince \u2211i bi is a constant, the sum reaches the maximum if \u2211i\u2208I(ai\u2212bi)\n reaches the maximum. So we can select the k largest elements in the array a\u2212b=(a1\u2212b1,a2\u2212b2,\u22EF,an\u2212bn). \n# Approach\n<!-- Describe your approach to solving the problem. -->\nhere we will create new array aa wehere aa[i]=a[i]-b[i]\nsort aa in decreasing order assign ans=sum of all element of b.\nthen add k largest element from array aa. \n# Complexity\n- Time complexity:\n- $$O(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 - $$O(n)$$\n\n# Code\n```\nclass Solution:\n    def miceAndCheese(self, a: List[int], b: List[int], k: int) -> int:\n        n=len(a)\n        aa=[a[i]-b[i] for i in range(n)]\n        aa.sort( reverse=True)\n        ans=sum(b)+sum(aa[:k])\n        return ans\n        \n```
['Math', 'Greedy', 'Python3']