POTATOES - Editorial

in (x+y+i) i will never exceed 40 since x+y <= 2000.

could any one explain me this…?

https://www.codechef.com/viewsolution/13385218

can anyone tell me whats wrong in the above code ?
I am geeting wrong answer even though I’ve checked every thing (i think),I’ve applied fermat’s little theorem to check if the number is prime or not.

just find sum of given two integers as first and second harvest and find just next prime number , then answer will be that prime number - sum(sum of first and second harvest).