Quote:
i don't know which part is causing TLE error
A TLE is a Time Limit Error, this mean that the whole program takes too long to execute.
In other words, your algorithm is too complicated or too simple minded.
There is more than 1 solution to given problem, but we can't appreciate what your program is doing because you forgot to tell us what problem you try to solve.