royappa's blog

By royappa, 14 years ago, In English

It would be nice to have a CODEFORCES environment variable, to allow our programs to print debug output selectively.


Currently I use my own variable to control debug output, but have to turn it off when submitting to CF. For difficult problems where I submit many times (during practice), it'd be nice to not have to turn that variable on, off, on, off, repeatedly. So some mechanism for the program to detect it is running on CF server, would be great. 

Thanks for the nice platform and great problems.



  • Vote: I like it
  • +5
  • Vote: I do not like it

| Write comment?
14 years ago, # |
  Vote: I like it +5 Vote: I do not like it
There is such env. variable, but called "ONLINE_JUDGE"
14 years ago, # |
  Vote: I like it 0 Vote: I do not like it
what is environment variable?
Its use?
  • 14 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    C++ example:

    #ifndef ONLINE_JUDGE
    cout<<"Some debug output";
    cout<<"It will not be used in CF server";
    //You can add freopen's here to use file input/output on your local machine
    #endif