CHEQUE : Wrong Answer :(

I’m getting WA in a problem of December Cook Off 2015. The problem link is : here.

Would anybody please give me an input, so that I can find out the bug? It will be really helpful… :slight_smile: My code link is given below…

code link of ideone