Help for SEACO

hi , i am not able to find out whats wrong in my solution for the problem “Sereja and Commands”(https://www.codechef.com/problems/SEACO ) . I am implementing a fenwick tree approach , in which i am
applying all the commands of type “1” in my array a all commands of type "2"are pushed in a vector, then i am traversing the vector from back and implementing all the commands of type “2” on another BIT one by one .The second BIT is used for storing the count of all the commands with particular index , then finally implementing all the commands of type “1” on my array a . map ‘c’ and 'd’are used for the storing the type and range of the a particular command respectively. I checked in the editorial discusions that my approach is correct but not able to find the error in my code.
my submission link (https://www.codechef.com/viewsolution/22518842 )