Bit manipulation problem times out

https://www.codechef.com/viewsolution/62316451
I have tried attempting this problem from the codechef jump from 2 to 3 stars problem set for bit manipulation.
I have followed the editorial for the problem and used fast input and output but the solution keeps failing.
What have I done wrong here and how do I fix it?

The shared solution is no readable, error 403: “Access denied! You don’t have permissions for this page” is reported. If this problem is from an ongoing contest or from a qualifying exam, then you should solve it individually without seeking help from the discussion forum readers.