Sponsored
Use these hints if you're stuck. Try solving on your own first.
Binary search the answer <code>x</code>.
Use the inclusion-exclusion principle to count the number of distinct amounts that can be made up to <code>x</code>.
Solve with full IDE support and test cases