
I am getting WA in only one case.. Is there any trick in this problem I cannot see?
Can someone help me?

You must help yourself.
Check Your solution in twilight zone of task memory limitation.

Thanks..
I didn't see that I was typing 100001 instead of 1000001, =)