Please have a look at the following two submissions of the same problem:
Both the codes are exactly the same, yet one is TLE and the other is AC.
Other Example:
Submission-1
Submission-2
This issue isn’t new and there have been several posts already (Link) but still, it hasn’t been resolved. @admin please look into it.