How to solve TLE for "Ratings and Rankings" problem

my sol:- CodeChef: Practical coding for everyone](CodeChef: Practical coding for everyone)
please help :pray: