Need help with Solution,of chefuba from long contest

i used deque to solve queries on array obtained after sum ,but its giving WA on most of test cases.plz help ,the code is self explanatory

Your code fails on this test case-

Input
6 2 8
0 0 1 1 0 1
!!!??!!?
Your Output
2
2
0
Expected Output
1
1
2

I think you should have a look at the part where you used “vihu” and deques.

BTW, how were you able to ask Q?? Via ‘ask a question’ thing?