TWOVRIBL : WA | can't think of a solution other than this

Here is the link to my WA submission for the question TWOVRIBL
Please explain what is it that I am doing wrong here.
Thank you.

The output for 1000000000 is 59

Oh, I see. What stupid code I have written :man_facepalming: