Error - CSUMQ (SPOJ)

Problem Link -
My Code -

My code isn’t passing sample test case. Can someone tell me what is wrong in my code logic, and how I can correct it?

You have to read N, then the array and then Q. But in your code, you had read N and then Q.

Oh okay, thanks !