The range is too big ...Cannot make a array of size 5000000

Sir/Maam please provide a hint to the method to solve this problem as making array of such size is not possible

Think of it using Sieve and modify your sieve to reduce your complexity.

Did that … Even had a look at the editorial … But the answer in the editorial is also wrong… exact copy paste of editorial solution also gives wrong answer!!!

Please send your code link.