How to solve TLE for "Ratings and Rankings" problem

my sol:- https://www.codechef.com/viewsolution/38026942](https://www.codechef.com/viewsolution/38026942)
please help :pray: