total and power. Count the ways to write total as a sum of power-th powers of **distinct** positive integers, that is, the number of sets of distinct numbers {a₁, a₂, …, aₖ} with a₁^power + a₂^power + … + aₖ^power = total.
Order does not matter: sets made of the same numbers count as one way.
The answer can be large, so return it modulo 10⁹ + 7.total=13, power=2 → 1
13 = 2² + 3² is the only way: no other set of distinct squares from 1, 4, 9 adds up to 13.
total=6, power=1 → 4
With power = 1 we count splits into distinct parts: 6, 5 + 1, 4 + 2 and 3 + 2 + 1, so 4 in total.
total=35, power=3 → 1
total=13, power=2
1
Run checks the first 3 tests in your browser. Submit checks all 99 tests on the server, hidden ones included.