Time limit exceeding problem

Please have a look at this code. I am getting a tle error. Can you please point out my mistake?

You have written a brute force algorithm with complexity O(t*n^3). Since n <= 2000 and t <= 20, in the worst case, your code will perform 16*10^{10} operations. Anything more than 10^8 operations generally give TLE. Only solution is for you to improve your algorithm.