ZCO BAMBOO ONE TC GIVING TLE

HELP ME ONLY ONE TC GIVING TLE
SOL LINK–https://www.codechef.com/viewsolution/38978306
prob link–https://www.codechef.com/ZCOPRAC/problems/ZCO16002