My code is showing time limit exceeding

pls tell what is wrong in my code, the input is endless