Need Help ,NZEC Error (Python3 Code): KCON JAN 18

https://www.codechef.com/viewsolution/16874166 can anyone help me out with the NZEC error in my Python3 Code?

It is because you have got TLE in 2nd sub task that’s why other test case cause RE. Because in it you got TLE then online judge kill your program, may be all three test cases in same file that’s why it cause RE. I was also getting the same but after correct logic, I got AC.

NO, after many trials I discovered that it is related to the multiplication of list i.e variable b, https://www.codechef.com/viewsolution/17059930 it gives TLE instead of NZEC.