my code https://ide.codingblocks.com/s/46115 ques link https://www.codechef.com/OCT16/problems/BGQRS/