PLEASE HELP ME!! EVRYTIME GETTING TLE..COMPARED WITH MANY OTHER USERS..FOUND MY CODE BETTER THAN THEM STILL GIVING TLE!!!

https://ideone.com/e.js/kOlZ4g

THIS IS THE IDE ONE LINK OF MY CODE WHICH IS GETTING TLE