def sums(lst, limit):
    res = set()
res_add = res.add
for i, first in enumerate(lst):
    for second in lst[i:]:
        res_add(first + second)
return sorted([x for x in res if x < limit])
print(sums(listgen(), 20000))
Generate all possible combinations from a int list under a limit