I am trying to solve https://www.codechef.com/problems/CHEFDTRE. 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.
I am following e-maxx.ru for the concept.