My code : CodeChef: Practical coding for everyone
Share your code or submission link
you should give the question link , your solution link with your question. helps other to answer easily.
Refer Competitive-Programming/Code-Chef/K-Fibonacci at master · strikersps/Competitive-Programming · GitHub for solution.
You may get negative answers. -5\%3 computes as -2, but what you want is 1.
i solved it with a simple calculation using queue
if you want you can refer to my code-CodeChef: Practical coding for everyone