Getting wrong answer error in Chef-Diet in November Cook-Off 2019 Division 2

i amgetting wrong answers error even when the answer id wright
here is the link to solution

your code suggests that you have taken max size of array to be 100. so if n=100 the last index will be 99 and not 100. So if you try accessing the 100th index it will be definitely wrong as your loop goes from 1 to 100.
Leaving this everything is fine.

1 Like

Try with this test case
1 5
1 5
The answer will be
NO 1