Reach a target, each item once
Given a list candidates of positive integers, which may contain repeated values, and a positive integer target, return every combination that adds up to target when each entry of candidates is used at most once. Two combinations are the same if they hold the same values the same number of times: with candidates = [1, 1, 2] and target = 3, [1, 2] counts once, whichever 1 it uses. Return each combination once, in any order, with its numbers in any order; if there is none, return an empty list.
1 ≤ len(candidates) ≤ 30, 1 ≤ candidates[i], target ≤ 50. Values may repeat many times, so the answer can be tiny while the number of ways to pick positions is huge.
Besides the tests, one large input (27 candidates, 21 of them 1s) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
sum_combinations_once([10,1,2,7,6,1,5], 8)→[[1,1,6],[1,2,5],[1,7],[2,6]]sum_combinations_once([2,5,2,1,2], 5)→[[1,2,2],[5]]sum_combinations_once([3,4], 2)→[]