Python minheap
```\ndef kSum(self, nums: List[int], k: int) -> int:\n        n=len(nums)\n        mxs=sum(a for a in nums if a>0)\n        if k==1:\n            return mxs\n  
```\ndef kSum(self, nums: List[int], k: int) -> int:\n        n=len(nums)\n        mxs=sum(a for a in nums if a>0)\n        if k==1:\n            return mxs\n        k-=1\n        q=[]\n        heapq.heapify(q)\n        nums=[abs(a) for a in nums]\n        nums.sort()\n        heappush(q,[nums[0],0])\n        while k>0:\n            s,i=heappop(q)\n            k-=1\n            if k==0:\n                return mxs-s\n            if i+1<n:\n                heappush(q,[s-nums[i]+nums[i+1],i+1])\n                heappush(q,[s+nums[i+1],i+1])\n
[]