How should I test my program

Use codechef compile and run ide

Codechef should improve its testing technique.

We test our code in other sites and ide they work fine there, but when submit in codechef it simply says WRONG ANSWER. seriuosly? shouldn’t it clearly state whats went wrong. Its so irritating ti see that message again and again having no idea what did go wrong.

1 Like

Or use freopen(“in.txt”,“r”,stdin); and freopen(“out.txt”,“w”,stdout);

1 Like

seriously man,
workin on a code, i submit solution to the problem it accepts subtask1 and showing wa for subtask 2. i have test almost all possible inputs but it simply shows wa all time,
it should give feedback of what went wrong…

1 Like

This is the most irritating issue i face here.
CodeChef should provide hints or useful feedback when it throws WA. Let them reduce points/stars but provide a meaningful response. Thats the least i expect !
The current UI doesn’t look intuitive & reduces engagement levels of beginners like me :sleepy:

If it tells, whats wrong in your code, what did you learn then? Like this, every other person will get AC, because of the hints. At the end of each round, editorial is published. Do refer to that, if you were not able to solve any problem

In that case lets extend your argument and ask What is the fun in revealing full editorial afterwards but hiding the test case failure reason when the person is actually engrossed?

No / delayed feedback == Delayed learning && Low engagement.

PS: Not everyone is here for the stars / ratings. Most beginners look for smooth learning curve.

1 Like

Thats the mistake beginners do. Take example of this long challenge, 6th problem, Dr. Chef. Its a good implementation type problem where you need to spend atleast 1-2 day(even hours) to find edge cases, learn different implementation etc.
Even after writing code, it gives WA suppose.
What did you learn in these 1-2 days spent in this problem?- Learnt to debug, learnt to find edge case, leart to implement harder things or above your skills, learnt to understand question.
Now suppose, you submit within 1 hour of trying and it gives WA and you get the hint. Now you learnt nothing out of the question.

Sometimes try out codeforces. You are new here, so being impatient. We have been practising for 2 years now. We had the same mindset as you, but gradually it improved.

Ok will try codeforces next.

Personally, i tried CodeWars ( ) & totally liked it !
I highly recommend to any beginner, it has better UI & provides instant error logs so that we atleast know what went wrong. Thats how it should be, more realistic to actual development where can analyze the logs incase theres an error!

BTW, looking at your submissions, you don’t seem to be 2 years old on CodeChef :thinking:

1 Like

2 years on codeforces. Not here

1 Like

I tried this way of creating an input file and storing the output in out.txt. Everything is working as expected but the validator in CodeChef is marking it as “wrong answer”. Could you reply to this? I can share the code and input file

Try running the custom input test cases and see the mathematical logic of your code, if its correct, it will boost your confidence