✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1\nTime complexity: O(nlog(k)). Space co
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1\nTime complexity: $$O(n*log(k))$$. Space complexity: $$O(k)$$.\n```\nclass Solution:\n    def maximumHappinessSum(self, a: List[int], k: int) -> int:\n        return sum(max(0,v-i) for i,v in enumerate(nlargest(k,a)))\n```\n\n# Code #2.1\nTime complexity: $$O(n*log(k))$$. Space complexity: $$O(k)$$.\n```\nclass Solution:\n    def maximumHappinessSum(self, a: List[int], k: int) -> int:\n        return sum(v-i for i,v in takewhile(lambda q:lt(*q),enumerate(nlargest(k,a))))\n```\n\n# Code #2.2\nTime complexity: $$O(n*log(k))$$. Space complexity: $$O(k)$$.\n```\nclass Solution:\n    def maximumHappinessSum(self, a: List[int], k: int) -> int:\n        return -sum(starmap(sub,takewhile(lambda q:lt(*q),enumerate(nlargest(k,a)))))\n```
['Array', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'Python', 'Python3']