Can anyone tell me why I got TLE in this code [Submission 1](https://mirror.codeforces.com/contest/1729/submission/171937869)↵
and then why did it get accepted in this code [Submission 2](https://mirror.codeforces.com/contest/1729/submission/17193786946732)↵
↵
and then why did it get accepted in this code [Submission 2](https://mirror.codeforces.com/contest/1729/submission/1719
↵