Testing Interactive Problems Locally

Could someone please share a guide or an explanation on how to go about testing interactive problems locally? I am asking this as it is hard to gauge what is wrong in your solution on Codechef as the judge does not give any hints on why the test cases are failing. Any leads would be appreciated.


I use the command prompt on windows to compile (GCC). I am able to test it as if I’m interactive computer.

Do you run a script to copy the behavior of the judge?

Remove fast IO and run the program in your terminal.

Why remove fast I/O?

If you use


You get the output after taking in all the input. That won’t work in interactive problems where you have to give the next input on the basis of the output you recieve.

1 Like

Oh! I didn’t know that. So we can’t use this on the submission too right?
Good thing I didn’t use this for the interactive problems last contest.

1 Like

Yes, we can’t.

Till now the interactive problems I have attempted are basic(involve yes/no queries) which I can personally judge, hence haven’t used any script. However I remember in Google Codejam/Hashcode they had provided a script to mimic behaviour and also given instructions how to use it. Check that out. Hope it helps

I guess to “mimic” the behavior, you need to personally input into the program behaving as the Judge based on the properties specified for the Judge.

I use Sublime Text along with the MinGW compiler for competitive programming. It is really easy to solve the interactive problems along with that because the command prompt gives you output after every case and not all together.

@satin1004 Can you share a resource explaining the process for some problem?

To simulate the interactive judge, you will need to write the problem checker (judge) code alongside your solution.
Then, use the CROUPIER PYTHON SCRIPT to connect the input/outputs of two different programs.

For eg : This is how i would test a simple interactive binary search game in Linux Environment . I have not tested this on windows but i guess the instruction are pretty similar.


Compile the following codes using command in terminal :

g++ judge.cpp -o judge
g++ solution.cpp -o solution

Link the two generated objects using :

python croupier.py “./solution” “./judge”