Not able to get the solution of this debugging problem pls help!

x is the total amount of eggs so we definitly need to subtract it from y.

if x = total amount of egg so why you have done x==0 than print y*2 -1
because if x is 0 than y must 0

this is the original question . And if i printed 0 the answer was wrong