What is Wrong with this code..?

I was practicing and stumbled upon this question - https://www.codechef.com/problems/SHIRO

here I read the editorial and tried solving it the same way.
I have used the “table of 2 by K” as explained in the tutorial.
I dont understand why my answer is wrong. Can anyone explain please…

My Code - https://www.codechef.com/viewsolution/15326690