Failing to identify the failing test-case

Hello the wonderful code chef community ,
i recently attempted a problem
problem link-
i am getting WA and i am not able to identify which case is it giving me WA for
i have tested the solution for the 2 most common WA test-case that is
k=2 s=??1?
k=1 s=0
k=2 s=??1
my solution for all these test cases is correct but still i am getting WA
This is my solution-
plz help me i have been trying this problem for 8hrs now