[C++] Priority queue
We know the max sum is the sum of all positive values.\nWith the max sum as the starting point, the problem (to find any subsequence sum) becomes to remove any 
We know the max sum is the sum of all positive values.\nWith the max sum as the starting point, the problem (to find any subsequence sum) becomes to remove any subset `|val| : nums`. \nFor any particular sum, we shall proceed by the absolute values in ascending order. \n\nReference\nhttps://leetcode.com/problems/find-the-k-sum-of-an-array/discuss/2456716/Python3-HeapPriority-Queue-O(NlogN-%2B-klogk)\n\n```\nclass Solution {\n    using integer = long long;\n    static constexpr integer kZero = 0;\n\n    enum Indexing : int {\n        VALUE = 0, INDEX        \n    };\n    \npublic:\n    long long kSum(vector<int>& nums, int k) {        \n        std::vector<integer> vals_abs;\n        vals_abs.reserve(nums.size());\n        integer total = kZero;\n        for (const integer val : nums) {\n            vals_abs.push_back(std::abs(val));\n            total += std::max(kZero, val);\n        }\n        std::sort(vals_abs.begin(), vals_abs.end());\n        std::priority_queue<\n            integer, \n            std::vector<integer>, \n            std::greater<integer>> vals_ord;\n        vals_ord.push(total);\n        std::priority_queue<std::pair<integer, int>> records_ord;\n        records_ord.push({\n            total - vals_abs[0],\n            0\n        });\n        \n        while (vals_ord.size() < k) {\n            assert(!records_ord.empty());\n            const auto record = records_ord.top();\n            records_ord.pop();\n            const integer val = std::get<Indexing::VALUE>(record);\n            vals_ord.push(val);\n            const int idx = std::get<Indexing::INDEX>(record);\n            if (idx + 1 < vals_abs.size()) {\n                records_ord.push({\n                    val - vals_abs[idx + 1],\n                    idx + 1\n                });\n                records_ord.push({\n                    val + vals_abs[idx] - vals_abs[idx + 1],\n                    idx + 1\n                });\n            }\n        }\n        \n        return vals_ord.top();\n    }\n};\n```
[]