What changes the code needs to avoid TLE, as i think i already have done it in an efficient way. The question is from August challenge 2020(chefina strange tree)

https://www.codechef.com/viewsolution/36849198