Doubt about mo's algorithm

Can anyone explain me, what block size do I have to take, I thought its root(n), bt in this question (Factor Tree), when I took the size of block to be root(n), it gives TLE, when i further increase the size to 625 (constant), it still gives tle , bt when i increase it more to 1000, it gives an AC , why does that happen??, what block size do i have to take?