Comments

Why is no one pointing this out!! We add i to check and add i+1 to cur. Also it gives WA. Also why are we looping on j?

0

In C, remember that with each >iq question, your iq reduces too. So if initially if some question had been <=iq, now it might not be so. That's something i didn't consider.

seems integer overflow problem.

because you do not need to store entire expanded array. you can simply store counts of repeating factors.