I am getting only one test case accepted...please tell me the error

@mayank10 do not get what are you calculating inside your factorize function, it is causing you run error.
try solving this problem as per this hint:

  • A number is a T prime if it is a perfect square
  • and its square root is a prime number.

my code is giving right answer…but it is not getting accepted?

your code is giving run error for bigger cases,look at the constraints n can be upto 10^5 and a[i] can be upto 10^12.