for group in chain.from_iterable(combinations(subset, n + 1) for n in
    range(len(subset))):
    sums[sum(group)] = group
return sums

def posneg(items):
    positive = posneg_calcsums([item for item in items if item > 0])
negative = posneg_calcsums([item for item in items if item < 0])
for n in sorted(positive, reverse=True):
    if -n in negative:
        return positive[n] + negative[-n]
else:
    return None
print(posneg([-1, 1, -4, 5]))
удалить числа из списка без изменения общей суммы