Yeaah!
I used it in a contest where n<=10^18, and I got AC
ig this one is better than fast doubling as it can be easily applied to diff variations of this que.
As @prmondal said
But I think in your exam time limit is more bcz 10^18 is very big range…
Time limit was 1 second. It was HMC contest, I guess even Abdullah used the same code in that contest. I’ll check it out
Log(10^18) is not that time consuming
But how can u implement sieve of this long range
We are calculating fibonacci numbers, not prime numbers…
Oh sry sry…wrong context…