I am probably missing something in the corner cases. (As i am not regular to codechef).
Do the test cases contain the data, outside the limits of the expected inputs (i.e. negative testcases).
In such cases, should I just print 0, or just return 1)
I am coding in C
No, the test cases never contain data what is not specified in the problem statement.(Unless it is wrong test case of course). But since there are accepted solutions there is nothing wrong with the test cases here. Hope this helps…
Some general hints
Also test cases are created and tested by people, so some probability of errors is there. As @sidthesloth wrote - no data out of range.
I you want to be 100% you can use something like:
scanf( "%d", &N );
assert( 1 <= N && N <= 100 );
if the condition in assert is evaluated to false
you will get SIGABRT error and you can be 100% sure, that it’s because of assert and take some steps (check the asserts first, you can modify your code and also contact CodeChef team)…