https://www.codechef.com/viewsolution/33240696
this is my answer.
Don’t know why getting WA even though it is working for sample test case
The question says he can purchase fruits <= K times.
So in the following test case, the correct output should be 0 but your output will be 1
1
3 3 1