Whats wrong with my code?

Link to Problem:-https://www.codechef.com/problems/VEGETA
My Solution:-https://www.codechef.com/viewsolution/18911997

Here’s where you are doing wrong

for(int k=n; k < m;k++)
{

int ct=0;

while(k%2==0)

{

k/=2;

ct+=1;

}

if(ct>0)

{

en+=1;

}

for(int j=3;j<=sqrt(k);j+=2)

{

while(k%j==0)

{

en+=1;

k/=j;

}

}

if(k>2)

{

en+=1;

}

}

Your loop variable is k and you are continuosly reducing it and the loop is running for infinite times.

I made some adjustments to your code link to code

But it will still give TLE using above code

Refer this link to solve the problem

you can refer my solution https://www.codechef.com/viewsolution/18887081