I am trying to solve CHEFDTRE Problem - CodeChef. This is my first attempt at treap and I chose this problem as it seemed simple for beginner. But I am getting SIGSEGV in all cases. It runs fine on my computer. I am unable to find my mistake. Please help.
My code : CodeChef: Practical coding for everyone
I am following e-maxx.ru for the concept.