It would really be helpful if Codechef makes representative test cases available for problems after the competition

I feel making representative test cases available after the competition can be really helpful to programmers in debugging their code. Of course, I understand that this could lead to some users just hard coding the test cases to get an accept but that really doesn’t matter because the competition is over and the rankings/ratings are fixed. It is not really going to help them and they are only wasting their time.

For others, who code up their own solution and when they test locally the program seems to be working on all the test cases that they are coming up with but they are getting WA when submitting, they are either forced to look at the tester or problem author’s solution and try to find any differences between their own code and the tester’s code. This can be difficult for several reasons. One being that many a time the author’s code is cryptic and messy with a lot of macros and the other would be that each person’s coding style varies, so handling of the input can be very different from one person’s code to another. Many a time, when looking at tester’s code, I would end up modifying my own code to almost resemble the tester’s code. This is not very useful given that in any competition, in response to a question, I would intuitively code up the solution in my own natural style, so knowing the bug in MY code will help me avoid future mistakes, as opposed to modifying my code to look like the tester’s code.

And I want to emphasize on the word REPRESENTATIVE test cases, not just test cases. This is because in other competitive coding platforms, like Hackerrank, where test cases are made available, they will end up giving the test cases file containing like 10^9 test cases with huge inputs and this really doesn’t help much, since then we would have to run our code on the input, the tester’s code on the input, compare the outputs to find differences and then drill down on the bug and it’s very cumbersome.

Instead, if we have REPRESENTATIVE test cases, i.e. test cases that represent all scenarios while being concise at the same time, it would help us debug in case we are stuck with the problem for long and feel that we are getting WA because we are missing out on some corner cases.


I agree with you, also in addition almost all other sites such as codeforces,hackerearth,etc. make the testcases available once the contest ends, i hope codechef would do the same.

Sometimes all you want to know is whats wrong with your algorithm and knowing the test cases is the most effective way.

I hope you mail codechef about this.

That would definitely be very helpful, Debugging gets very frustrating after a certain point, the test cases will definitely reduce that frustration.

1 Like

See this link. After reading this you will not complain about test cases again

@bansal1232 , I went through the link. Just like many people have expressed in that link too, I still feel that giving representative test cases would be helpful for a lot of competitive coders. If a particular coder(like yourself), doesn’t want to have a look at them, you are always welcome not to look at the representative test cases. Nobody is forcing you to do that.

Take the example of SPOJ. SPOJ even doesn’t reveal test cases but also doesn’t show other solution. So that’s a beauty of SPOJ that make us to code more and more.

The same case is been apply at codechef. I love this decision of codechef as it make us to find out bug in your own code.

We need test cases only when our code doesn’t show the result as the user want. If user at somehow get the test cases without mugging up their brain on a program then there will be no use of their code on the program.

Just imagine if you couldn’t able to debug your own code then how could you help/test someone else codes? Please change your mind set and think by yourself that codechef is right or not!

yes test cases is very helpful for understanding programs

There are many tests for a reason.
Organizers don’t try to make debugging after the contest harder.
We try to invent various types of tests and we create them.
It’s impossible to give you a small subset of tests and guarantee that your solution will fail on one of them.

You can create a small counter-test yourself. Take the author’s solution, write your own generator of random tests, and in bash/whatever run the generator many times, each time comparing the answer from your solution and from the intended solution. This is called stress-testing.