TSORT: Time limit Exceeded for Randomized Quick Sort

I have used Randomized Quick Sort for this problem and still facing time limit exceeding issue. I have used both Merge Sort and Counting Sort and my solutions were accepted but I want to solve this using Randomized Quick Sort algorithm. Please help me improve my program.
My code’s link is: CodeChef: Practical coding for everyone