Engxor getting TLE

https://www.codechef.com/viewsolution/30298812

I wonder which method of input should i use incase of fast i/o in java