count and banned. Build a set of count distinct positive integers in which no two different elements add up to banned.
Return the smallest possible sum of such a set.count=4, banned=6 → 12
Take 1, 2 and 3 (the 3 has no partner, since it appears only once); 4 and 5 would pair with 2 and 1 to make 6, so the fourth number is 6. The total is 1 + 2 + 3 + 6 = 12.
count=3, banned=1 → 6
Two distinct positive integers never add up to 1, so 1, 2, 3 work.
count=4, banned=6
12
Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.