CodeChef
  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
  • DISCUSS
    • Wiki
    • Forums
    • Blog
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host Your Contest
    • User Groups
    • CodeChef TechTalks
  • HELP
    • Frequently Asked Questions
    • FAQ for Problem Setters
    • Ranks
    • Tutorials
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CEO's Corner
    • About Directi

Frequently Asked Questions

Posted by Aniruddha on June 29th, 2009 Filed in Announcement, FAQ View Comments

Well, a lot of people seem to be having the same kind of questions across different forums and different problems. Here is a brief list of questions that have been coming up quite frequently over the past few weeks, and some hints on what you should do to solve the issue.

Q. What compilers do we use?
A. The compilers for the different languages are specified when you select the language while submitting the  solution. Code compiled on other non-standard compilers cannot be guaranteed to compile on the online judge system.

Q. What are the system specifications?
A. As of now, the specifications of the system on which the judge executes the solutions are :
Operating System : Gentoo Linux
Processor : Quad Core Intel running at 2.33 GHz
Memory : 4 GB of RAM (64 MB guaranteed for each submission)
Storage : 160 GB effective storage using SATA RAID 0 configuration
Network Link : 144 Mbit maximum throughput

Q. I can’t seem to find the compilers being used by Codechef. Can you give me a link?
A. The IDEs / Compilers / Interpreters for some commonly  used languages are listed below.
C / C++ : You can use the Dev C++ IDE if you are on windows – http://www.bloodshed.net/dev/devcpp.html
Java : Download the Java Development Kit from the Sun website – http://java.sun.com/javase/downloads/index.jsp
Python : Download the python interpreter from – http://www.python.org/download/
Perl : Download perl from http://www.perl.com/download.csp
Ruby : Download it from http://www.ruby-lang.org/en/downloads/
C# : Download it from http://www.microsoft.com/express/vcsharp/

You can use flags like -O2 in C or C++ to turn on compiler level optimization.

Q. Why does my code compile fine in Turbo C but not on the Codechef Judge?
A. The Codechef Judge uses the GNU compiler collection. Turbo C uses some non-standard headers and as such should not be used. A standards compliant C code written under Turbo C will compile fine on the online judge.

Q. Can I include the file conio.h?
A. No, conio.h is not a standard header file and as such is not available under the GNU compiler collection. Code which includes conio.h will not compile on the online judge.

Q. What should I name the class in a java solution?
A. You should name the class as Main. Failure to do so will result in a compilation error on the online judge system.

Q. Do I need to take the input for all testcases at once before processing it?

A. No, you need not take all the input at once. You can take the input for a particular test case and output the answer and then proceed to the next test case. Program should read from standard input and write into standard output. There is no need to read all data first, compute them all and then print all output. It is recommended to read and write data as simultaneously. Technically, server redirects standard stream to files. You can test you programs in the same way at home.

Q. Can I get the input for which my program failed?
A. Currently it is not possible to get the input for which your program fails. Thinking out corner cases is a part of the fun associated with algorithms :)

Q. How do I take input for problems which do not specify a distinct terminating condition or the number of test cases?
A. In cases where the total number of test cases are not specified or some input doesn’t serve as the terminating input, you are expected to take input till an EOF marker is encountered. While testing, you can terminate the input in the command line by pressing the <ctrl> and <z> keys together.

Q. How do I get the execution time of a program in Linux?
A. After compiling the program, say you have the output file with the name ‘solution’, then, you can get the execution time by using the command “time ./solution”. The sys and user times are what you should be looking at in the output.

Q. The code runs within the time limit on my system, but I get a TLE on Codechef. Why is that so?
A. TLE stands for Time Limit Exceeded. The configuration of your system might be different from the one we use. You need to optimize your algorithm or come up with a better algorithm.

Q. I can’t even take input or print output within the time limit, let alone processing the input. What should I do?
A. Make sure you have submitted an efficient solution to http://www.codechef.com/problems/INTEST/ and http://www.codechef.com/problems/TEST/ and make sure you read http://blog.codechef.com/2009/02/24/54/

Q. The time limit for the problem is 2 seconds, but some accepted solutions take more time. How is that possible?

A. This can happen if the problem has multiple test case files. The time mentioned in the constraints is per input file. If there are multiple input files, then the total time taken for executing all of them is displayed. For example, if the time constraint for the problem is 2 seconds and there are 8 input files, then your program must take at most 2 seconds for any particular input file, but the total time displayed will be the sum of the execution times for the 8 input files and this may exceed 2 seconds.

Q. Why do I get an error called SIGSEGV?
A. A SIGSEGV is an error(signal) caused by an invalid memory reference or a segmentation fault. You are probably trying to access an array element out of bounds or trying to use too much memory. Some of the other causes of a segmentation fault are : Using uninitialized pointers, dereference of NULL pointers, accessing memory that the program doesn’t own.

Q. Why do I get an error called SIGABRT?
A. A SIGABRT is caused if your program aborted due to a fatal error. This can also be caused if you are using an assert() which fails or an abort().

Q. Why do I get an error called SIGFPE?
A. A SIGFPE is caused by a floating point error. Your program is encountering such an error, probably a division by zero or some similar undefined operation.

Q. Why do I get an error called NZEC?
A. NZEC stands for Non Zero Exit Code. Usually, returning non-zero values from main() will cause this error. It helps telling crash from WA (Wrong Answer) with interpreted languages. Typically this would happen if you omit a return 0; from main() in C. For interpreted languages or Java/C++, this could happen if your program threw an exception which was not caught (e.g. Trying to allocate too much memory in a vector).

If you have any other questions, do post them as a comment and we will try to incorporate them into the FAQ.

  • Share/Bookmark
  • rohan

    what are the list of c++ header files that i can use?

  • rohan

    what are the list of c++ header files that i can use?

  • pr0ton

    Check here http://www.cppreference.com/

  • pr0ton

    Check here http://www.cppreference.com/

  • Bob

    Hi! Why can I only view the submissions of others for particular problems?

  • Bob

    Hi! Why can I only view the submissions of others for particular problems?

  • http://www.codechef.com The Chef

    Currently only previous contest problem submissions are available as well as two easy practice problems. We will continue to make solutions to past contests available. Soon we will have a visual indicator showing which problems have solutions available.
    Cheers

  • http://www.codechef.com The Chef

    Currently only previous contest problem submissions are available as well as two easy practice problems. We will continue to make solutions to past contests available. Soon we will have a visual indicator showing which problems have solutions available.
    Cheers

  • arup saha

    many programs submitted in codechef written in C/C++ include header file

    as far as i kno… there’s no such header file in Turbo C compiler ( the one i use)…. please mention which header file is it?

  • arup saha

    many programs submitted in codechef written in C/C++ include header file

    as far as i kno… there’s no such header file in Turbo C compiler ( the one i use)…. please mention which header file is it?

  • Aniruddha

    Please read the FAQ. Turbo C++ is a non standard compiler. Use gcc if you are on Linux or mingw if you are on Windows. The list of files can be seen at http://www.cppreference.com.

  • nitin

    JAVA
    my compilations are correct then why do i get a compile error on submitting. I even made the class name as Main.

  • nitin

    JAVA
    my compilations are correct then why do i get a compile error on submitting. I even made the class name as Main.

  • http://TheOpenSourceU.com Frank

    Will support for Objective-C be added as one of the languages to submit code in?

  • http://TheOpenSourceU.com Frank

    Will support for Objective-C be added as one of the languages to submit code in?

  • Johnes

    i am doing in ruby
    i am getting Runtime Error: NZEC. even though it Exit code: 0 in my platform.
    Why is this?

  • Johnes

    i am doing in ruby
    i am getting Runtime Error: NZEC. even though it Exit code: 0 in my platform.
    Why is this?

  • Aniruddha

    @nitin You might want to go through the sample programs in the help section on the site. http://www.codechef.com/help/

    @Frank No plans to do this at the moment. If something comes up, we will let you know.

    @Johnes You are probably having some issues with the way you are doing your IO. You might want to check that again.

  • Amlan

    I am using Turbo c++ IDE …is there any way…i can use this compiler and avoid the runtime error (NZEC) that i am getting, everytime i submit a sulution…

  • Amlan

    I am using Turbo c++ IDE …is there any way…i can use this compiler and avoid the runtime error (NZEC) that i am getting, everytime i submit a sulution…

  • Aniruddha

    No, you need to use a more standards compliant compiler like the GNU compiler collection.

  • Aniruddha

    No, you need to use a more standards compliant compiler like the GNU compiler collection.

  • http://www.rebhu.co.nr Rebhu

    How to participate in the August Mini Challenge?

  • http://www.rebhu.co.nr Rebhu

    How to participate in the August Mini Challenge?

  • Aniruddha

    You can participate in it in the same way you participate in any of the current contests.

  • Aniruddha

    You can participate in it in the same way you participate in any of the current contests.

  • http://www.rebhu.co.nr Rebhu

    But I can’t find any link to it. Can u help me out?

  • http://www.rebhu.co.nr Rebhu

    But I can’t find any link to it. Can u help me out?

  • Aniruddha

    A link will be up soon. You can mail us your queries at admin@codechef.com. Don’t go offtopic on the FAQ’s comment section.

  • Aniruddha

    A link will be up soon. You can mail us your queries at admin@codechef.com. Don’t go offtopic on the FAQ’s comment section.

  • sookie

    Hey people,

    Just now I submitted my first program in this site but it said “Compilation Failed” though it compiled fine in my system JDK1.6 . Even I was looking for JDK1.6 option in the drop down provided while submitting it but there was only JDK1.5. Now what should I do?

    Thanks !

  • sookie

    Hey people,

    Just now I submitted my first program in this site but it said “Compilation Failed” though it compiled fine in my system JDK1.6 . Even I was looking for JDK1.6 option in the drop down provided while submitting it but there was only JDK1.5. Now what should I do?

    Thanks !

  • Aniruddha

    As of now, it is 1.5 We will upgrade soon.

  • Aniruddha

    As of now, it is 1.5 We will upgrade soon.

  • Maheshwar

    I had tested my program independently. It was working fine. I had tested for few scenarios including the sample input given in the CEO Ride problem. Only after successfully testing I had submitted it here. It is said that it was failed due to run time error. How can I get more info on this.

    Thanks
    Maheshwar

  • Maheshwar

    I had tested my program independently. It was working fine. I had tested for few scenarios including the sample input given in the CEO Ride problem. Only after successfully testing I had submitted it here. It is said that it was failed due to run time error. How can I get more info on this.

    Thanks
    Maheshwar

  • nitish

    i have an error received when i submitt my solution to factorial that RUNTIME ERROR NZEC
    plz…. try to solve my problem

  • nitish

    i have an error received when i submitt my solution to factorial that RUNTIME ERROR NZEC
    plz…. try to solve my problem

  • Aniruddha

    You can get a runtime error because of a variety of reasons. You can get a segfault if you are accessing memory which you are not supposed to. You can get a NZEC if your code does not exit with a return status of 0 etc. Depending on what the error code is, you can debug your code and try finding out what is going wrong and where.

  • Aniruddha

    You can get a runtime error because of a variety of reasons. You can get a segfault if you are accessing memory which you are not supposed to. You can get a NZEC if your code does not exit with a return status of 0 etc. Depending on what the error code is, you can debug your code and try finding out what is going wrong and where.

  • Anshum

    Some Language takes More time of execution then Others for eg compare java and c++ so don’t You think there Should be separate time Limit and judging criteria for these languages because it makes impossible for java programmers like me to compete in your competitions…

  • Anshum

    Some Language takes More time of execution then Others for eg compare java and c++ so don’t You think there Should be separate time Limit and judging criteria for these languages because it makes impossible for java programmers like me to compete in your competitions…

  • Aniruddha

    http://blog.codechef.com/2009/04/01/announcing-time-limits-based-on-programming-language/ This has already been addressed. :)

  • Aniruddha

    http://blog.codechef.com/2009/04/01/announcing-time-limits-based-on-programming-language/ This has already been addressed. :)

  • Tanmoy

    Please tell me what version of PHP codechef is using and what libraries are being enabled.
    Thanks.

  • Tanmoy

    Please tell me what version of PHP codechef is using and what libraries are being enabled.
    Thanks.

  • Mahesh

    I solving Bibi frog problem in python 2.5 and my code is running perfectly on my system but i am getting runtime error wen i submit the solution…plz help me….

  • Mahesh

    I solving Bibi frog problem in python 2.5 and my code is running perfectly on my system but i am getting runtime error wen i submit the solution…plz help me….

  • Input Question

    Can any one tell me that how to submit the programs procedure … and from where the input file gonna be taken … i dont know which input to use for processing the program and checking out the results
    … plz help

  • Input Question

    Can any one tell me that how to submit the programs procedure … and from where the input file gonna be taken … i dont know which input to use for processing the program and checking out the results
    … plz help

  • Tariq Mehmood Khatri

    Can any one tell me that how to submit the programs procedure … and from where the input file gonna be taken … i dont know which input to use for processing the program and checking out the results
    … plz help

  • Tariq Mehmood Khatri

    Can any one tell me that how to submit the programs procedure … and from where the input file gonna be taken … i dont know which input to use for processing the program and checking out the results
    … plz help

  • Aniruddha

    The input is to be taken from stdin and the output should be written to stdout.

  • Aniruddha

    The input is to be taken from stdin and the output should be written to stdout.

  • pulkit jasrapuria

    i have written a code in java. it is running fine on my machine but when i upload it online(code chef) it shows run time error ???

    plzz help me

  • pulkit jasrapuria

    i have written a code in java. it is running fine on my machine but when i upload it online(code chef) it shows run time error ???

    plzz help me

  • dinesh

    Whether i have to give input for all the test cases once or one by one in each test case.

  • dinesh

    Whether i have to give input for all the test cases once or one by one in each test case.

  • Aniruddha

    @pulkit Check out http://www.codechef.com/help for a sample solution in Java.
    @dinesh Either way is fine.

  • Aniruddha

    @pulkit Check out http://www.codechef.com/help for a sample solution in Java.
    @dinesh Either way is fine.

  • Michael

    I’ve error at SIGSEGV. Do you have a program to see the false runtime? I see my code. Seems correct n not out of bounds.

  • Michael

    I’ve error at SIGSEGV. Do you have a program to see the false runtime? I see my code. Seems correct n not out of bounds.

  • Aniruddha

    A segfault can occur due to a number of reasons other than an array access going out of bounds :)

  • Aniruddha

    A segfault can occur due to a number of reasons other than an array access going out of bounds :)

  • grv

    I m keep on trying submitting my code.. but its either showing incorrect or compile error.. its working with no errors in my compiler.. i m using dev-C++ 4.9.9.2… what should i do to successfully submit my code..

  • grv

    I m keep on trying submitting my code.. but its either showing incorrect or compile error.. its working with no errors in my compiler.. i m using dev-C++ 4.9.9.2… what should i do to successfully submit my code..

  • Kartikeya

    What do you mean by Trying to allocate too much memory in a vector?…in java??…

  • Kartikeya

    What do you mean by Trying to allocate too much memory in a vector?…in java??…

  • xagyg

    What should the main function for a Scheme submission look like?

  • xagyg

    What should the main function for a Scheme submission look like?

  • Aniruddha

    Please take a look at http://discuss.codechef.com/showthread.php?p=135 for sample solutions in different languages for the problem http://www.codechef.com/problems/TEST.

  • http://google.com/profiles/SeifElIslam.Sallam Seif Sallam

    can anyone share the Bash script used to test our programs, i'm using python and my code works perfectly on my machine, but the problem every time is with CodeChef

  • http://google.com/profiles/SeifElIslam.Sallam Seif Sallam

    can anyone share the Bash script used to test our programs, i'm using python and my code works perfectly on my machine, but the problem every time is with CodeChef

  • http://www.aeonity.com/adrian646/blogging-be-fun Sam Halgrimson

    I venture there are heaps of people like me, who happen across varied strong blogs or web sites by fortune. Your site seems to have got a solid community and a sound blogosphere presence. Its right to have engrossing and different views on issues.

  • http://www.aeonity.com/adrian646/blogging-be-fun Sam Halgrimson

    I venture there are heaps of people like me, who happen across varied strong blogs or web sites by fortune. Your site seems to have got a solid community and a sound blogosphere presence. Its right to have engrossing and different views on issues.

  • Akshay

    Why does Python show an NZEC error if it is only present in C/C++ or java

  • Mohd_rafi000

    wat it actually means by run time error

  • nisha goel

    what language is corresponding to dev c++ 4.9.9.2

  • Bcprashanth

    Are all libraries in standard java supported?

  • http://www.codechef.com CodeChef

    Yes. J2SE jdk 6.0 with standard library (excluding some multimedia, network and system interaction classes).

    Starting point for Java programs is public
    static void main (String[] a) method in Main class, which must be defined.

blog comments powered by Disqus

Recent Posts

  • ACRush eclipsed
  • … and we meet!
  • Progress report of April contests
  • Moving into a New Kitchen.
  • The color and mischief of March contests

Categories

  • About (8)
  • ACM ICPC (9)
  • Announcement (119)
  • Campus Chapters (6)
  • College Contests (8)
  • Contests (126)
  • Events (23)
  • FAQ (1)
  • Features (34)
  • Languages (1)
  • Meetup (5)
  • Open Source (1)
  • Practice Problems (7)
  • Prizes (17)
  • Problems (5)
  • Programmer of the Month (27)
  • Tech Talks (6)
  • Tutorials (15)
  • Winners (80)

Recent Comments

  • CodeChef on ACRush eclipsed
  • CodeChef on ACRush eclipsed
  • random123 on ACRush eclipsed
  • Sagar Malhotra on Moving into a New Kitchen.
  • Guest on Moving into a New Kitchen.

Recent Pictures

Blogroll

  • Documentation
  • Plugins
  • Suggest Ideas
  • Support Forum
  • Themes
  • WordPress Blog
  • WordPress Planet

Archives

  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009

Company Blogs

  • Directi
  • .pw Corp Blog
  • CEOs Blog

Careers@Directi


  • About CodeChef
  • About Directi
  • CEO's Corner
  • CodeChef Campus Chapters
  • Blogger Community Program
  • User Group Outreach Program

© 2009, Directi Group. All Rights Reserved.

Sponsors