Medium Accuracy: 42.77% Submissions: 4298 Points: 4

Given two numbers X and N, find out the total number of ways X can be expressed as sum of Nth power of unique natural numbers.

Examples:

Input : X = 10, N = 2
Output : 1
Explanation: 10 = 1^{2} + 3^{2},
Hence total 1 possibility
Input : X = 100, N = 2
Output : 3
Explanation: 100 = 10^{2}
OR 6^{2} + 8^{2}
OR 1^{2} + 3^{2} + 4^{2} + 5^{2} + 7^{2}
Hence total 3 possibilities

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a single line containing two space seperated integers denoting the values of X and N respectively.

Output:
For each test case output a new line containing a single integer denoting the total number of ways X can be expressed as sum of Nth power of unique natural numbers.

Constraints:
1 <= T <= 100
1 <= X <= 10^{3}
1 <= N <= 5