How come this approach works even though it performs more than 10^9 operations?
P is incremented by 1 each time.
So for a input :
It performs more than 10^9 operations.
For time limit 1sec we are supposed to keep a upper bound of 10^8 operations, or not?