DEEPAK AND PRIMES II - TIme Limit Exceeded

@abhishek_trigunait and @O17LPOLC0033 I am trying to solve this problem using segmented sieve concept but still i am getting tle . https://ide.codingblocks.com/#/s/16457
https://online.codingblocks.com/player/2872/content/1038?tab=submissions

could you pleasse suggest whats wrong in the code .

Heyy Vikash ! , actually your code is not working for n<=1 so you have to take care of that as well . And one more thing ur code is not working for larger nos like this input
1
7000000000000 7000000040000
So u have to optimise ur code
For further help m giving u this code
https://ide.codingblocks.com/#/s/16475

Hi @O17LPOLC0033 - I followed the logic that was there in given code by you but still its giving tle for two of the test cases . seems like it’s because java takes comparatively longer time than c++ . If that’s the case than what we should do to resolve it .
https://ide.codingblocks.com/#/s/16524

Nopes that cant be the reason for this problem . There must be some other thing that you are missing in ur code like ur code is still not working for this case
1
0 5
Try to debugg ur code
and one more thing my code is working fine , it passes my all test cases

for input
1
0 5 its working but in answer its including 1 as well .Yes , your code is working fine its not giving tle that’s why i mentioned the above reason.

@O17LPOLC0033 - is my understanding correct bro :neutral_face:?

Yeah ! Just need some modification in ur code