well i tried this:
5
100 200
10000 10100
100000 100100
1000000 1000100
10000000 10000100
and also:
1
9000000 9010000
2
9900000 10000000
300 10000
it was not fast, but there was a result and no runtime errors.
i've considered building the list starting from the smallest first number or even building a new list for every test case, but that would only be usefull in certain test cases, right? Like my last one, would be faster if the list was created starting from first number, but the first case would perform better if there was a smaller list for every case.
Anyway, no idea why it works on my pc and not on the judge. Any more test cases i can run?
Another idea i have is to optimize the output search, but is there a way to find the index of a certain list member? On the other hand, that won't work if the first and last numbers are not prime, then i'd have to search for the closest prime that is in the list