Practice on Codechef

This might seem like a rant, but solving practice questions on Codechef is really a headache. You might think you have the right logic, submit your code, but get a wrong answer. Okay, maybe I will look at the editorial. I look at the editorial but the explanation is exactly what I did. Maybe there is a bug that is pretty small and I am unable to find. So, I check other AC’ed solutions. But they are also pretty much what I am trying to do. So, back to square one, I still don’t know why my code is wrong. So, I post it on Discuss, hoping some keen-eyed individuals might be able to solve the issue. But sadly, most of them are a bunch of circlejerks obsessed with “Plagiarism” and pulling others down. So, I still don’t know why my code was wrong.

Proposed Solution:
Please for the love of God, can we have open test cases for questions in Practice. I don’t want to spend 3 hours debugging code with perfect logic due to some sly corner cases maybe, or some integer overflow. Most big sites already have that, so why can’t we have it here as well. For those who don’t want to see the test cases, we can have an option to see the failing test cases when we want to.

Okay, I am done.



I totally agree.



1 Like

This is so true, I agree fully. One thing that could be done though is that the test cases are shown only to those who have made a non runtime/compilation error submission (i.e. a WA) to the practice problem.

P.S. In the same spirit, if someone could help me here, it would be great!

1 Like

I recently started coding and i started to notice the minor errors by myself that used to give WA even if my logic was correct…Maybe we should consider WA the opportunity of understanding minor errors and concept bit better as it can ruin good logical code… After sometime and practise pattern of same mistakes disappears slowly


Maybe that works for you as you are a beginner, but for a veteran who is just trying to brush up some specific topics, it does more harm than good. It is almost a crutch.

Anyways my suggestion was to show test cases on request basis. So, if you don’t want to see the test cases, no one is forcing you to.

1 Like

But sadly, most of them are a bunch of circlejerks obsessed with “Plagiarism”

So now being concerned about people cheating is a bad thing? You know it actually happens, right? Most of it gets moderated out before many can see it, but there are plenty of people asking about problems from ongoing contests, even from long challenges!

About your suggestion, it’s been said many times that the stance of CodeChef is that testcases should be invisible and that debugging is a good skill to have. It’s kind of controversial, which is fair since people have different opinions.

But how is posting on Discuss going to even help you, or seeing the test cases? Say you find some bug in your code and it turns out to be a typo. Great, so what’s your takeaway? “Don’t make typos”? The point of hidden test cases is to force you to learn some sort of debugging process, which includes trying to come up with strong countertests, scouring your code for unexpected mistakes, and actively trying to disprove your own logic if nothing else works. And it’s realistic - obviously you aren’t going to have testcases in contests, and learning those debugging skills is going to help you.

Now you say it’s possible to just make it optional. But most beginners aren’t going to initially see the value of debugging without countertests. The practice is going to spoil them and make it harder to perform well in contests if they make some mistakes. It already happens with sites like Codeforces that give exact tests out - you’ve seen the number of help posts asking for a countertest or a mistake, right? Most of them are from low-rated contestants, who haven’t had enough experience in “blind debugging”, so to say. Forcing practice without the ability to give up and see tests is valuable.


I hope you see the kind of posts that come to fill up the discuss feed. It is mostly people playing the blame game and pointing out answer leaks does actually leads to more people searching up the solutions. There are portals to report plagiarism and filling up the discuss feed with 10+ posts about the same plagiarism issue won’t help to resolve it.

As for what I proposed, we can agree to disagree. You might not find it pretty useful to look at test cases, but some people do. And an option to look at test cases on request is not going to affect those who actively don’t want to see the test cases.

As long as we have the option, if suggested by top-rated coders like you, beginners might not choose to look at the test cases to improve.

I will like to share my approach when I am like really stuck…
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
Above is the random number generartor just use rng() anywhere and u have a random no. like cout<<rng();
With freopen(“input.txt”,“r”,stdin) and freopen(“output.txt”,“w”,stdout); we can read and write files (they get automatically created), now just write a test code generator and pick out any successful submission and check on random cases…
fc output1.txt output2.txt
with above code u can compare any two files in windows terminal.
Actually in competitions also u can check ur code against a brute forces soln.