Can someone explain me why this guy’s code is more efficient than mine (python 3.6)

my code - CodeChef: Practical coding for everyone

other guy - CodeChef: Practical coding for everyone

i am not complaining but trying to understand. my code is more efficient than his. he redifines the dictionary in every iteration while i only define it once which works perfectly. leave alone same time effciency his code should be less effcient than mine.

The same reason as last time: Can someone explain me why this guy's code is more efficient than mine (python 3.6) - #3 by ssjgz

i understood that last time he used float and i used int and that’s why his was more effcient. but this time i have the upper hand. he is redifining his dictionary in every iteration wheres i only define it once. thus my program should take less time to run.