link text
this is my solution
The problem is “Best Cake Ever”
Noting that the answer doesn’t have to exactly match - the quantities just have to produce the right XOR value - you can generate some more test cases from the accepted solutions. For example I generated:
Input:
4
1 13
2 13
5 13
2 22
Output:
13
8 7
8 6 1 1 1
16 15
although admittedly I did also identify that N=1 is an edge case (as are K<4 since quantity choices are limited).