Problem - 577A - Codeforces

it is solved but one Small Doubt.What If I will be given Test Cases
and 1<=T<=105.
Anyone Has Idea How to do it now?

We can take factors of “X”, O(sqrt(X)) per testcase

if i use O(sqrt(X)) it will give me TLE.
i solved that question but with test cases it seems harder.

Yaa, It will give TLE. I first thought X<=1e6.
I don’t have any idea how can we solve for X<=1e9