Getting wrong answer in buy1-get1(BUY1GET1) problem

Here is the link to my solution for BUY1GET1 problem: http://www.codechef.com/viewsolution/4424469

I’ve used map datastructure and I don’t know which test case it is failing. What is wrong with this solution ?

//