Very Simple Code
 # Intuition  \n\n\n\n\n\n# Complexity\n- Time complexity:O(n \cdot \log n)\n\n\n- Space complexity:O(\log n)\n(the worse-case of the sort() function in c++ is 
<!-- # Intuition -->\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n<!-- # Approach -->\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:$$O(n \\cdot \\log n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(\\log n)$$\n(the worse-case of the sort() function in c++ is $$O(\\log n)$$.)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long maximumHappinessSum(vector<int>& happiness, int k) {\n        long long res = 0;\n        sort(happiness.begin(), happiness.end(), greater<int>());\n        for (int i = 0; i < k; i++)\n            res += max(happiness[i] - i, 0);\n        return res;\n    }\n};\n```
['Greedy', 'Sorting', 'C++']