We have introduced a new feature on Practice for debugging your code. Whenever you get a WA, you can now click on ‘Debug my code’ and get the smallest test case where your code fails.
- One of the most common requests is to understand the test case where their code is failing.
- However, providing the test file is not of much use given the size of a typical test file and the way in which a test file is structured. Each test file can contain thousands of test cases. Eventually the user still has to identify the specific test case. And a code may fail on multiple test cases within a test file.
- What is most helpful is to find the smallest test case where the code fails - since this can be interpreted by the user and the code can be fixed accordingly.
How to use?
Once you ‘Submit’ your code in Practice, if you get a WA, you will find the box ‘Debug my code’
Once you click on ‘Debug my code’ the system will fetch the smallest test case where the code fails, and display it as follows
This feature is currently live for a total of 1772 problems and for the programming languages C / C++14 / C++17 / Python 3.6 / Java / PyPy 3.
– This feature is ONLY for WA. It will not show up for other verdicts like TLE, RTE, Compilation error, etc.
– This feature will be live for problems in future contests immediately after the contest ends.
– We will gradually make this feature live for older problems and more programming languages. Currently the languages above cover 99%+ of the submissions on the platform
– This is currently not live for problems for problems with custom judges. Will get some of these fixed in the later iterations.
It will currently take approximately 5 - 10 seconds for the system to find the specific test case where your code fails.
Given that this is under our beta phase - we sincerely request you to report your feedback / any issues on this thread.
Currently, the ‘Debug my code’ feature is free for all users. At some stage, we will migrate this to our list of premium features to support and sustain the platform.