What should i do inorder to optimize my code? (NOTALLFL)

Here is the link of the problem - NOTALLFL
My code - solution