I can give you a failing testcase to help you debug 
1
7 2
-1 -1 1 -1 -1 -1 -1
I can give you a failing testcase to help you debug 
1
7 2
-1 -1 1 -1 -1 -1 -1
still a case pending corrected it.
Now consider:
1
6 2
2 1 -1 -1 1 2
Link to latest submission?
Thank you. Figured it out.
Hmmm … small random testcases don’t seem to find any problems. Dunno, sorry 
No problem…Thnx!!
Ah - try this:
2
57 2
-1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1
82 2
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
That’s why I didn’t find it with randomised testcases - I always set T=1, whereas your issue only appears when there are multiple testcases. (Hint: there’s some state left over from previous testcases that you’re not clearing :))
Consider:
1
1 9
-1
Thanx bro for your time…finally submitted successfully!!!
Thnakyou so very much , i was unable to find the case where it was failing .
Thank you 




Thankyou so much , it got submiited , their was a error of one character , i CHANGED + TO - AND BOOM !!!
yes! Stacks size seems to the problem. Thank you for pointing out.
Thanks for actually linking your solution 
It fails for the following testcase:
1
5 2
2 -1 -1 -1 -1
I get a 403 error when trying to access your solution 
That is not the link to your solution XD The correct link is: CodeChef: Practical coding for everyone
Consider the testcase:
1
10 2
-1 -1 -1 -1 -1 2 -1 -1 -1 2