CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Challenge 2013
    • May Cook-Off 2013
    • May Challenge 2013
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • Campus Chapters
    • Host your Contest
    • Go for Gold
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
    • Top Contributors on Discuss
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Wiki » FAQ

FAQ

 

Recently, more and more people are asking questions that have been answered many many times before. This FAQ covers virtually all of them, so please make sure you have read it before using this site.

 

Table of Contents 
  1. General FAQs
    1. How does Codechef test whether my solution is correct or not?
    2. How should I test my program?
    3. What am I allowed to post as a comment for a problem?
    4. How do I post a link to my code?
    5. How does the time limit work?
    6. What does the execution time displayed for my submission mean?
  2. Why is my code not correct?
    1. Why do I get a compile error?
    2. Why do I get a Time Limit Exceeded?
    3. Why do I get a Runtime exception?
    4. Why do I get a SIGSEGV?
    5. Why do I get a SIGABRT?
    6. Why do I get a SIGFPE?
    7. Why do I get an NZEC?
    8. Why do I get a Runtime Error (Other)?
    9. Why do I get Wrong Answer?
    10. Why do I get an internal error?
  3. Other common mistakes
  4. Other common questions
    1. If a number of test cases isn't provided, when should my program stop reading input?
    2. What should I do with invalid input?
    3. How can I store very very large integers accurately?
    4. In C/C++, how should I read/write long longs?
    5. If my code gets TLE, does that mean it is correct but takes too long?
    6. Why can I view other people's solutions? Can they view mine? What is stopping people copying other's code?
    7. Can I see if my solution to a contest problem is correct after the contest has finished?
    8. How can I measure the execution time of my program locally?
    9. Are any compiler flags set on the online judge?

 

General FAQs

How does Codechef test whether my solution is correct or not?

Your code is tested by a computer automatically, not by a human being, and you have to write your code accordingly.

For each problem, Codechef will have one or more input files, each according to the specifications mentioned in the problem statement, and corresponding correct output files. Codechef will run your program on each of the input files by redirecting the standard input stream to an input file, and the standard output stream to another file. The output generated by your program must match the correct output *exactly* in order to be judged correct.

Some consequences of this:

  • If your program starts by printing 'Enter the number' and the problem does not tell you to do so, then since this is not part of the correct output, you will be never be judged correct regardless of what the rest of your program does.
  • As all that matters is that the output files match, it makes no difference at all at what point in your program's execution that this output is written. So there is no need to read all of the input before starting output; it is much more common to just print out each result as you are reading through the input.
  • If you use any method other than using the standard input and output streams - for example, using command line arguments, reading from a file, opening up some sort of dialog box, or otherwise - you will never be judged correct.

 


 

How should I test my program?

The best way of testing your program is doing so in exactly the same way that Codechef does. Create an input file (for example, in.txt). Then run your program from the command line, using < and > to redirect the streams. For example:

java test < in.txt > out.txt

or

test.exe < in.txt > out.txt

Your output will then be in the out.txt file, so you can check if it is correct.

Often people forget to print a new line between test cases, but this is easily avoided if you use this method of testing.

 


 

What am I allowed to post as a comment for a problem?

If the problem is part of a contest that is still in progress:

 

  • Do NOT post code.
  • Do NOT post a comment asking why your solution is wrong.
  • Do NOT post a comment asking if you can be given the test case your program fails on.
  • Do NOT post a comment asking how your solution can be improved.
  • Do NOT post a comment giving any hints or discussing approaches to the problem, or what type or speed of algorithm is required.

All such comments will be ignored or deleted. All people deserve a fair chance to participate, so nobody will be given extra hints. You are expected to solve the problem completely by yourself.

The ONLY time you should be posting a comment is if you do not understand the problem statement. Before asking for a clarification, read the problem statement several times - often very silly questions are asked which are very clearly mentioned in the problem. Make sure you read earlier comments first in case your question has already been asked or answered.

 

For problems in the practice section:

 

  • Do NOT post code. (See below if you are asking for help).
  • Do NOT post a comment asking if you can be given the test cases the judge uses. These are always kept secret.
  • Do NOT post anything that gives away the solution. Most people will want to solve the problem by themselves, and will be very annoyed if they accidentally read a comment that tells them how to solve the problem.

Make sure you have read this entire FAQ before asking for help. The majority of people asking for help have made one of the very basic errors mentioned later in this FAQ.

If you have read this FAQ and still do not know why your code is not working, it is permissible to ask for help with the problem. Don't ask for a full solution or exactly what algorithm you should be using - that won't help you become a better programmer. You may well be given hints as to what your program is doing wrong, however.

As mentioned above, do not post your code as part of the comment - just paste in the link to your solution (which looks something like http://www.codechef.com/viewsolution/xxxxxx ). The Codechef admin, or anyone else who has solved the problem, will be able to see your submission.

 


 

How do I post a link to my code?

  1. Visit the problem page, say: http://www.codechef.com/problems/TEST/
  2. To the right of the headline "Life, the Universe, and Everything" you will see 3 buttons: "ALL SUBMISSIONS", "MY SUBMISSIONS", and "SUBMIT". Click "MY SUBMISSIONS".
  3. You will see a list of your submitted programs. Pick the one you want, and on the far right of the row, click "View Solution".
  4. Copy and paste the link from your browser's navigation bar into the Comment page: http://www.codechef.com/viewsolution/110651

 


 

How does the time limit work?

Your program must read, process, and output the result for an input file within the specified time limit. The input file will be of the format mentioned in the problem.

This means, if the input contains multiple test cases, your code must complete ALL of these within that time limit. If the time limit is 2 seconds, and there may be 1000 test cases, your program shouldn't be taking 1 second per test case - it needs to run all 1000 in under 2 seconds.

Some programming languages are slower than others, and are thus given more time. Currently, Java and Python are allowed twice the time limit, while Ruby, PHP and Lisp are allowed to run for up to three times the time limit.

The hyperlinked blog post explains how the time limit will work for various languages.



 

What does the execution time displayed for my submission mean?

Codechef might test your code multiple times with different input files. If your code gives the correct answer within the time limit for each input file, the execution time displayed is the total of the time spent for each test case.

If your code does not pass an input file correctly, the time limit will be the total time of all input files, up to and including the one on which you fail, but not any further ones.

An example: suppose there are 5 input files, each with a time limit of 2 seconds. Your program runs for 1 second on each input file and produces the correct answer. The total time displayed will be 5 seconds - which is fine, because the time limit only applies to each input file individually.

On the other hand, suppose you get the first 2 input files correct in 1 second, the third one incorrect in 1.5 seconds. Your reported time will be 3.5 seconds.

People are often confused by a wrong answer in a very quick time changing to time limit exceeded. This is due to the first input file being small; a wrong answer means the time for large input files is not included.

 


 

Why is my code not correct?

Why do I get a compile error?

There are a few reasons why your code may compile on your computer but not on Codechef. In all cases, you can see the compile error by clicking on the Compile Error icon after submitting your code.

Java:

Your class containing the main method must be a public class called Main. It may not be called anything else.
Do not use packages.

C/C++:

Make sure you are using a compiler that complies with the standards. Turbo C++ is not such a compiler, and often code which compiles in Turbo C++ will not compile on Codechef.

Make sure you are using standard headers. Do not use conio.h in C; this is not part of the C standard library. Do not use iostream.h; this is a deprecated header file and again is not a standard library. (You should just be using iostream instead).

The flags used for C++ are: g++ -pipe -O2 -lm -s -fomit-frame-pointer

Other languages:

As with C/C++, make sure you are using a standard compiler/interpreter. The exact ones that Codechef uses are listed next to the language when submitting the program.

Read the sample solutions page to see an example of code which compiles and correctly solves the TEST program as a starting point.

 


 

Why do I get a Time Limit Exceeded?

The most common reason that you would get a Time Limit Exceeded is because your program is too slow. If a problem tells you that N <= 100000, and your program has nested loops each which go up to N, your program will never be fast enough. Read the bounds in the input carefully before writing your program, and try to figure out which inputs will cause your program to run the slowest.

The second most common cause of TLE is that your method of reading input and writing output is too slow. In Java, do not use a Scanner; use a BufferedReader instead. In C++, do not use cin/cout - use scanf and printf instead.

To see if your method of reading input is fast enough, try solving the Enormous Input Test problem. If you get time limit exceeded, try another method of reading input.

In Python, you could try speeding up your solutions by adding the following two lines to the start of your file:

import psyco
psyco.full()

Finally, you may have tested your code on all sorts of large inputs and are sure your code will run inside the time limit. However, Codechef's judge may be slower than your computer. It is common for a program to take 2-3 times as long on Codechef as it does on your computer. The time limits are all attainable, so you will just need to come up with a way of making your algorithm faster. (One possibility in C++ is to avoid using STL, which can be a little slow).

 


 

Why do I get a Runtime exception?

There are four types of Runtime exception, and you can see which one you are getting by hovering your mouse over the icon. Each is covered below. You cannot know anything more specific; for example the exact Exception thrown in Java. Note that some errors could lead onto other errors, so even if you are getting one particular message, you should check each of these sections below.

 


 

Why do I get a SIGSEGV?

This is an error caused by an invalid memory reference or segmentation fault. The most common causes are accessing an array element out of bounds, or using too much memory.

Some things for you to try:

  • Make sure you aren't using variables that haven't been initialised. These may be set to 0 on your computer, but aren't guaranteed to be on the judge.
  • Check every single occurrence of accessing an array element and see if it could possibly be out of bounds.
  • Make sure you aren't declaring too much memory. 64 MB is guaranteed, but having an array of size [10000][10000] will never work.
  • Make sure you aren't declaring too much stack memory. Any large arrays should be declared globally, outside of any functions - putting an array of 100000 ints inside a function probably won't work.

 


 

Why do I get a SIGABRT?

SIGABRT errors are caused by your program aborting due to a fatal error. In C++, this is normally due to an assert statement in C++ not returning true, but some STL elements can generate this if they try to store too much memory.

 


 

Why do I get a SIGFPE?

This is the easiest runtime error to debug - it is a floating point error. It is virtually always caused by a division by 0, so check any divisions or modulo operations in your code carefully.

 


 

Why do I get an NZEC?

NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Java/C++ could generate this error if they throw an exception.

 


Why do I get a Runtime Error (Other)?

This type of error is sometimes generated if you use too much memory. Check for arrays that are too large, or other elements that could grow to a size too large to fit in memory.

It can also be sometimes be generated for similar reasons to the SIGSEGV error.

 


 

Why do I get Wrong Answer?

Wrong answer means simply that - your program is not printing out the correct answer. You will just have to debug your program very carefully! Make sure your program is conforming exactly to the output format required, and not printing out unnecessary information, as mentioned at the start of this FAQ. Read below for a couple of other common issues that may lead to a Wrong Answer.

 

Why do I get an internal error?

If you get an internal error this is not due to anything you have done - it is an error on the Codechef server. You may need to just try again later; alternatively, sometimes it will display an internal error but you will still be able to see the result of your submission by clicking on the My Submissions link on the problem page.

 


 

Other common mistakes

In Java, do not create multiple BufferedReaders on the standard input stream. Create it once, and use it from there. Creating it multiple times will lead to a wrong answer due to the method Codechef uses to test your program.

Different operating systems have different ways of representing a newline; do not assume one particular way will be used. For example, on Unix a newline is simply a \n character. On Windows, a newline is represented by \r\n, and not testing for the \r character will lead to problems. Ideally, use input reading functions from your language which handle new line issues for you.

 


 

Other common questions

If a number of test cases isn't provided, when should my program stop reading input?

Some problems do not have multiple test cases, and are instead judged by testing your code multiple times on different input files. If the problem statement does not say there are multiple cases, do not assume there are.

Other problems mention multiple test cases, but don't provide any limits on how many there could be. Your program should stop at the end of the input file. All programming languages have a way of testing this; for example, in Java, a BufferedReader's readLine() method will return null. In C++, scanf returns the number of items successfully matched; EOF if it reaches the end of the file.

Read your programming language's documentation to find out what it returns.

If you choose to test your program without the redirection method mentioned earlier, you can generate an EOF (end-of-file) character by pressing Ctrl-Z.

 


 

What should I do with invalid input?

There will not be invalid input. If a program says a number will be between 0 and 100, it will be between 0 and 100. There is no need to write if (number>=0 && number<=100), or do anything in other cases.

 


 

How can I store very very large integers accurately?

Some problems require the use of what is called arbitrary-precision arithmetic, for example, adding together two numbers of 100 digits each.

These numbers are too large to store in an 32 or 64 bit integer. They are also too big to store in a double - a double is not accurate enough to store every single digit.

Some languages such as Java or Python have big integer classes built in. In other languages such as C/C++, the best way of handling these is to store them as strings. You can write methods to multiply, divide, add or subtract these just as you were taught in school using pen and paper.

 


 

In C/C++, how should I read/write long longs?

Some compilers, such as Dev-C++, require you to use %I64d with scanf/printf. However, for your code to work on Codechef, use %lld instead.

 


 

If my code gets TLE, does that mean it is correct but takes too long?

No, TLE simply means you exceeded the time limit. Your program never finished running in time - so Codechef has no idea whether it was going to print out the right results or not!

 


 

Why can I view other people's solutions? Can they view mine? What is stopping people copying other's code?

In general, solutions to a problem are only viewable by people who have already solved them themselves, and are accessible for educational purposes.

There are a couple of exceptions. Some very basic problems like TEST have all solutions public to help people get started with Codechef. After a contest is complete, contest solutions are also made public so you can see how other people have solved the problem.

 


 

Can I see if my solution to a contest problem is correct after the contest has finished?

Contest problems are normally added to the practice section shortly after the contest is concluded, and you can submit them there. The fastest way to get to the practice problem is to delete the contest ID from the URL.

For example, to submit the problem at http://www.codechef.com/JAN10/problems/L3/, delete the JAN10 and instead go to http://www.codechef.com/problems/L3/ .

 


 

How can I measure the execution time of my program locally?

In unix, if your output file is called out.txt, you can get the execution time with the command time ./out.txt. Otherwise, you could just use functions from your programming language which measure the time at the start and end, and print out the difference.

 


 

Are any compiler flags set on the online judge?

ONLINE_JUDGE is defined to be true in C/C++, and possibly other languages with similar functionality. You can therefore write some code that only executes on your computer for testing purposes; for example, in C/C++:

#ifndef ONLINE_JUDGE
// some code in here
#endif

The flags used for C++ are: g++ -pipe -O2 -lm -s -fomit-frame-pointer


Comments

  • Login or Register to post a comment.

hey.. where can I see the

paloflat @ 21 Oct 2009 11:07 PM

hey.. where can I see the compilation error.. The email is not telling me.. also the yellow triangle is not clickable.. Is there a link.. and how/where can I find it?

when ever i loged in .. i

nitin3star @ 26 Oct 2009 10:54 PM

when ever i loged in .. i cannot see directly that which ever code i had alreay made which are still to be done. or there is no priority list given by you.

so can you try to add those tags which may specify me that i had done this problem in list of all problems ..

hope you understand me.

if not mail me at nitin3star@gmail.com.

thank you.

how do I KNOW what is the

prashant1067 @ 28 Oct 2009 07:11 PM

how do I KNOW what is the reason for runtime error

There is no specific reason

rushikesh30 @ 31 Oct 2009 08:53 AM

There is no specific reason for runtime error.You should check multiple test cases not only given as example.The  range of variables will help you for multiple test cases.

Tell me how to get started

nadeemrasool @ 4 Nov 2009 11:07 AM

Tell me how to get started after Login the account.Either we have to give any problem from our side with algorithm or you will suggest the problem for which we have to find the Algorithm.

Go to any problem and solve

admin @ 6 Nov 2009 06:58 PM

Go to any problem and solve it.

i tried so many test cases

JohnnyBravo @ 7 Nov 2009 01:09 AM

i tried so many test cases but it still give *run time error* after uploding

got the error :)

JohnnyBravo @ 7 Nov 2009 01:16 AM

got the error :)

Could you tell how do you

techgeek @ 7 Nov 2009 01:28 AM

Could you tell how do you time the programs (for C++)??

Do you calculate the time for each test case separately or find total time for all test cases  and divide it by number of cases?

 

 

Regarding the time that is

smilingtheja @ 8 Nov 2009 12:50 AM

Regarding the time that is displayed for successful submissions.. well, there were 4 successful submissions for one particular problem.. one of them was shown to have taken only 0.04s, and 2 of them (including mine) taking over 20s. In one of the FAQs, it said that you guys calculate and display the total time for all the input files that the online judge has used to test our codes. Does this mean that it is not neccessary that all codes are fed the same number of input files? please clarify.

Many Thanks.

Ravi Theja

It means that your algorithm

triplem @ 8 Nov 2009 03:50 AM

It means that your algorithm was a lot slower than the other person's..

I have implemented an ideal

shakir @ 10 Nov 2009 08:51 PM

I have implemented an ideal O(n) solution for TSORT problem in ruby. But still it gives me time limit exceeded. How can i overcome this issue ?

how to submit the solution

BCD @ 21 Nov 2009 09:11 PM

how to submit the solution

how to submit the

charango @ 21 Nov 2009 09:36 PM

how to submit the solution?

SNCK01 submiit link is not working!!

how to print factorial of 100

sushil @ 30 Nov 2009 01:15 PM

how to print factorial of 100 in c or c++

Please help me

The same way you would do it

triplem @ 30 Nov 2009 01:24 PM

The same way you would do it with pen and paper.

hello friends.i'm new to

suvro @ 2 Dec 2009 12:42 PM

hello friends.i'm new to codehef.i'm having an alert saying 'contest_id_field is required' ,while trying to submit a solution .where will i get the id & where should i place it?please help.

problem while submitting

gaorav @ 6 Dec 2009 02:28 PM
problem while submitting solution. It says contest_problem_id required. pls help....

I am getting run time error

sachinfarfade @ 6 Dec 2009 09:51 PM

I am getting run time error with code : NZEC. what is the meaning of this

i'm getting a runtime error

android @ 19 Dec 2009 04:12 AM

i'm getting a runtime error with code: SIGSEGV

What does this mean?

Status codes

triplem @ 19 Dec 2009 05:55 AM

Status codes

I am getting an compilation

Sarthak Dash @ 21 Dec 2009 01:57 PM

I am getting an compilation error for the problem...I have already tested all the test cases...even there is an answer for 100! ...

But I keep on getting Compilation error under the OTHERS category.I am little new over here...Could anyone tell me what may be the possible reasons..???

P.S. My code size is 1.6M and time of running as shown by Codechef is 0.01s

:( internal error occurred in

3rdEye @ 26 Dec 2009 09:33 AM

:( internal error occurred in the system

 

This is what I get everytime I try to post my solution in C#2 (mcs 2.0.1). How to work around it? Please reply.

can we somehow know the kind

prm2612 @ 27 Dec 2009 08:46 AM

can we somehow know the kind of RunTimeException thrown by the program???

If you hover over the RTE

triplem @ 28 Dec 2009 08:46 AM

If you hover over the RTE icon you can narrow it down to one of five possibilities (these four: Status Codes, or 'other'). You can't know anything more detailed than that, no.

(deleted by admin)

Swaroop Bhandary @ 30 Dec 2009 12:56 AM

(deleted by admin)

how to submit a separate

Vibek_Agarwal @ 6 Jan 2010 07:35 PM

how to submit a separate class file.

How to make my C codes run

amir_003 @ 8 Jan 2010 03:57 PM

How to make my C codes run faster?

I got result as 'time limit

IttagoniK @ 16 Jan 2010 10:43 PM
I got result as 'time limit extended'. Can anyone please help me to improve speed in C. i'm using scanf and printf and while loop?

In C# can I use dll's like

prateekg @ 17 Jan 2010 12:56 AM

In C# can I use dll's like System.Linq and System.Collections.Generic?

i'm new to codehef.i'm having

ankit.mahanot @ 21 Jan 2010 04:03 PM

i'm new to codehef.i'm having an alert saying 'contest_id_field is required' ,while trying to submit a solution .where will i get the id & where should i place it?please help.

Logout and log back in.

admin @ 21 Jan 2010 05:45 PM

Logout and log back in.

i am getting runtime error

prince.pradeep.1 @ 24 Jan 2010 03:10 PM

i am getting runtime error but the code is working perfectly on my pc for all the values.what can be the problem??????????

where is questions???

poojakhandelwal179@gmail.com @ 31 Jan 2010 02:32 PM

where is questions???

If the output of the program

omkardanke @ 4 Feb 2010 02:49 PM

If the output of the program contains an extra newline like..

 

1 2 4

4 3 4

_          ---->newline

 

or extra spaces

 

1 2 4_      --->spaces

4 3 4_      --->spaces

 

Can these generate a Wrong Answer? Because it seems you'll be comparing files. So files with spaces or extra newline are not the same as the files without them.

Please clarify this...

The standard judge strips all

triplem @ 4 Feb 2010 02:53 PM

The standard judge strips all unnecessary whitespace from your solution, thus that would not generate wrong answer. It is possible that a special judge is used for a problem, though rare, so I wouldn't rely on that too much.

The problem with your code is

triplem @ 5 Mar 2010 06:11 AM

The problem with your code is mentioned in the FAQ. Read it.

I am unable to see the

ravi_villuri @ 7 Mar 2010 09:03 AM

I am unable to see the ranking list for the current contest Mar2010.

Although I see "Current Contest Rankings" section, I cant see anything below the tabs - "Global","India","Non-India". It just has a sentence saying "Rankings are refreshed every few minutes". But nothing else is displayed. I see errors at the bottom of the browser window.

 What is wrong??

hello.i'm working in Pascal

Wanda92 @ 9 Mar 2010 09:06 PM

hello.i'm working in Pascal and receiving a NZEC Runtime Error.Can anyone help me,tell me why?The peoblem works well on my pc.

I am getting the error ":(

eatme123 @ 27 Mar 2010 12:53 PM

I am getting the error ":( internal error occurred in the system". Please help me

Even I got the error: ":(

zena @ 31 Mar 2010 11:28 PM

Even I got the error: ":( internal error occured in the system". Please tell a way around this

The codechef admin are aware

triplem @ 1 Apr 2010 05:14 AM

The codechef admin are aware of this. For now, ignore that box and see the true result of all of your submissions by clicking on the 'My Submissions' link until this is fixed.

How can I check how much time

pankaj_tux @ 8 Apr 2010 07:56 PM

How can I check how much time my program is taking when it has exceeded time limit? Please help

You can't.

triplem @ 9 Apr 2010 02:58 AM

You can't.

help me i got spoj run

prabhaker @ 2 May 2010 12:49 PM

help me i got spoj run timeerror

I am getting the error ":(

Ra16bit @ 9 May 2010 11:23 PM

I am getting the error ":( internal error occurred in the system". What does it mean?

i am always able to solve

shishir806 @ 10 May 2010 05:25 PM

i am always able to solve codes but not able to optimize them please help for the same

Is there a way I can see the

srinivaslikesit @ 28 May 2010 11:21 PM

Is there a way I can see the code posted until now.

"Some programming languages

Sand33Prakash @ 6 Jun 2010 12:21 AM

"Some programming languages are slower than others, and are thus given more time. Currently, Java and Python are allowed twice the time limit, while Ruby, PHP and Lisp are allowed to run for up to three times the time limit."

Is Perl allowed any extra time limit? I am solving problems in Perl and all the recurssive type of problems give TLE.

Kindly let me/us know if Perl solutions should also be given any extra time.

It would be nice if we can

Sand33Prakash @ 6 Jun 2010 12:23 AM

It would be nice if we can sort the submissions based on coding language. I would atleast see if someone has submitted any solution in Perl.

My program works correctly in

coolman @ 13 Jun 2010 10:00 AM

My program works correctly in my comp.But it gives runtime error in your comp.Why?

hey m sry its d dumbest

mickey087 @ 20 Jun 2010 02:00 PM

hey m sry its d dumbest question evr askd on codechef but i really wanna knw a suitable compiler for working on c++ compatible ANSI and which cud also shw me mem usage nd all ........ i hv tried DEV compliers nd all but it uses sm differnt syntaxes other than usual c++ which usually produces errors ......... sm1 plz help URGENT .thanx

my code works well in my

dwrakh @ 2 Jul 2010 04:03 PM

my code works well in my system and gives the exact result as desired, but when i submit here, it shows run time error.. can anyone help me in this, i am unaware why this thing occurs... thank you.

@admin: can you please allow

Juned123 @ 11 Jul 2010 04:25 PM

@admin: can you please allow us to submit solutions to contest problems even after the contest is over.

coz not everyone solves problems to compete, some just want to try new problems and learn from their mistakes.

That question is already in

triplem @ 11 Jul 2010 04:34 PM

That question is already in the FAQ..

Is there any issue in using

sandeep.ravi @ 2 Aug 2010 05:37 PM

Is there any issue in using cout<<endl; ?

I think that is causing me some issue in one of the problems as the answers seems to coming correctly when im trying it locally.

i have submited my code after

phanindhar @ 3 Aug 2010 10:38 PM

i have submited my code after cheqing in my systerm..

but the online judge have decided it as wrong answer..

whats the reason..

i use dev c++ compiler to verify my code..

is there any problem .. with it ..i hav filled the c++4.3.2

should i change that field..?

please help my..

i have submited my code after

phanindhar @ 3 Aug 2010 10:38 PM

i have submited my code after cheqing in my systerm..

but the online judge have decided it as wrong answer..

whats the reason..

i use dev c++ compiler to verify my code..

is there any problem .. with it ..i hav filled the c++4.3.2

should i change that field..?

please help my..

<3 programming

aditya @ 12 Aug 2010 02:19 AM

<3 programming

i cant submit anything

Rupertt Wind @ 13 Aug 2010 04:44 PM

i cant submit anything ionline because it says wrong account or password

Hi I'm not able to submit a

shwetanka_19 @ 13 Aug 2010 07:17 PM

Hi

I'm not able to submit a solution.

I'm already logged in and when i click submit It says Wrong login or password.

hey ... even i'm facing the

Tihaya Noch 1 @ 13 Aug 2010 07:24 PM

hey ... even i'm facing the same problem ... wrong login or password

I submitted and it says... my

mrs.ronnie @ 14 Sep 2010 05:57 PM

I submitted and it says... my code should be saved in a file called test.java.

/sources/Main.java:3: class test is public, should be declared in a file named test.java public class test { ^ 1 error

 

It already is saved in test.java. I don't get it ..what does it mean?

That's specifically mentioned

triplem @ 15 Sep 2010 02:59 AM

That's specifically mentioned in the compile error section of the above FAQ.

in Encryption ques...could u

shubh2_vaib @ 7 Oct 2010 08:09 PM

in Encryption ques...could u plz tell answer for 101? thr is some confusion...

How can I measure the

wycywa @ 8 Oct 2010 02:32 PM

How can I measure the execution time of my program locally? and set the time limit for input file

like online judge

how to set lime limit for

wycywa @ 8 Oct 2010 02:33 PM

how to set lime limit for input file--localy?

when i upload mu solution in

indar00 @ 11 Oct 2010 08:45 AM

when i upload mu solution in JAVA on a particular problem , then it GIVES me a COMPILATION ERROR .

 

But on viewing the compilation error , no such information is displayed , instead a empty box is displayed ...

 

Is there some thng i am missing .!!???

What does following message

avinash1 @ 14 Oct 2010 06:36 PM

What does following message mean?

"Your solution is too long for this problem, the limit is 2000 bytes!"

I got this pop up after submittig code.

That message is pretty self

triplem @ 15 Oct 2010 04:40 AM

That message is pretty self explanatory.. it means you have to write a solution which is less than 2000 characters long.

my doubt is that the TIME

jravi96 @ 4 Nov 2010 05:53 PM

my doubt is that the TIME LIMIT is applicable only for processing input or ; processing input along with displaying output

As the FAQ says: Codechef

triplem @ 5 Nov 2010 01:18 AM

As the FAQ says:

Codechef will run your program on each of the input files by redirecting the standard input stream to an input file, and the standard output stream to another file

There is no 'display' involved at all. The time starts when your program starts, and stops when your program stops.

i m getting wrong answer

netal @ 27 Nov 2010 10:31 PM

i m getting wrong answer though my code is giving correct answer for different test cases on my machine....how can i identify the error in my code???

I tried out but there is

wolfram77 @ 8 Dec 2010 01:34 PM

I tried out but there is runtime error. Program runs correctly on my computer.

how to see the time of a

vickysirwani @ 9 Dec 2010 09:59 PM

how to see the time of a program in c++???

can you explain wat exactly

enjoyurlife @ 10 Dec 2010 12:47 AM

can you explain wat exactly is NZEC RUNTIME ERROR?

Did you actually read the FAQ

triplem @ 10 Dec 2010 01:48 AM

Did you actually read the FAQ above?

please tell me how to create

nimitz92 @ 18 Dec 2010 05:01 PM

please tell me how to create an appropriate input file to check my program...

as i m finding no fault in my program but still it is showing wrong answer...

I am a Dev C++ user. I use

umang_rungta @ 23 Dec 2010 09:18 PM

I am a Dev C++ user.

I use cin and cout for IO.

including conio.h is giving compilation error.

On removing that and getch(), it compiles but gives wrong answer.

I selected C++ 4.3.2

Is using cin or cout instead of scanf and printf wrong?

Was I expected to first get the entire input and then give the entire output?

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int n=0;
while(cin>>n)
{
if(n==42)
break;
cout<<n;
}   
getch();
return 0;
}

All of those questions are

triplem @ 24 Dec 2010 02:03 AM

All of those questions are already answered in the FAQ that you commented on.. you could have at least read it.

i am a new user. can anyone

dreamrider @ 2 Jan 2011 02:45 AM

i am a new user. can anyone tell me What does it mean,when a question says like  "The answer should be calculated MOD 100000007"

http://en.wikipedia.org/wiki/

triplem @ 2 Jan 2011 03:16 AM

http://en.wikipedia.org/wiki/Modulo_operation

i am getting rntime error

fahd @ 27 Jan 2011 11:25 PM

i am getting rntime error even if i upload only a small segment of code like

int main()
{
short T=0,n=0,k=0,c1=0,c2=0,c3=0,c4=0,x=0,y=0,initial=0,min=0,df=0,a1=0,a2=0,b1=0,b2=0,end=0;
short array[1001];
short darray[11];

.......

i included the header files and also tried malloc but error persists

plz help

provide sample inputs-outputs

jaldeep @ 5 Mar 2011 09:27 PM

provide sample inputs-outputs for UFO LAnding...

what is "insufficient

cmayur @ 5 Mar 2011 11:44 PM

what is "insufficient score"????

Please explain what does the

nitin_garg @ 14 Mar 2011 02:42 AM

Please explain what does the 2nd line of "

  • Make sure you aren't using variables that haven't been initialised. These may be set to 0 on your computer, but aren't guaranteed to be on the judge.

 

mean?"

int

triplem @ 14 Mar 2011 06:03 AM

int x;

x+=2;

printf("%d\n",x);

x isn't initialised, so this could print anything.

#include<iostream>using

rahul1951991 @ 27 Mar 2011 01:20 PM

#include<iostream>
using namespace std;
int main()
{
long n,k,m;
int i=0;
cin>>n>>k;
while(n--)
{
cin>>m;
if(m%k==0)
i++;
}
cout<<i;
}

my time limit is exceeded why...........???

how could i come to know

son14ali @ 10 Apr 2011 11:56 AM

how could i come to know about the right solutions

plz help

how i hve to register mmy

nid18 @ 10 Apr 2011 01:42 PM

how i hve to register mmy team

How do one get know the test

thefourtheye @ 14 Apr 2011 02:26 PM

How do one get know the test cases for which the program failed, in the practise area?

Sir My program is

kickers @ 15 Apr 2011 12:37 PM

Sir My program is successfully run in the dev cpp but when i submit then it raise run time error please help me...

Please help. Running

kilobytecoders @ 15 Apr 2011 03:37 PM

Please help. Running successfully in DevC++ and VisualC++ with correct outputs and in sequence, but while submitting it gives Wrong Answers.

Also tried rn but not worked :(

Please please please help.

the code i created runs

struts2 @ 15 Apr 2011 07:44 PM

the code i created runs successfull on my machine but when submit to codechef it shows Runtime error. plz help.

 

@Codechef, how Mem is

harish_8080 @ 17 Apr 2011 01:16 AM

@Codechef, how Mem is checked?

I've submitted the same code in C as others with 0M did. But it shows me 1.6M? Why?

Same no. of variables, same statements (it was the first program in easy set).

@codechef: Can we do any

sergico @ 20 Apr 2011 08:55 PM

@codechef: Can we do any assumption on the endianess of the "judge" machine?

Is teh code always compiled and run on little endian CPUs?

why contest questions of RGPV

sharanjain @ 30 Apr 2011 11:57 PM

why contest questions of RGPV is not open for all.???
since contest is over.
http://www.codechef.com/RGPV20...
http://www.codechef.com/RGPV2
http://www.codechef.com/RGPV3

@ ADMIN why contest questions

sharanjain @ 30 Apr 2011 11:58 PM

@ ADMIN

why contest questions of RGPV is not open for all.???
since contest is over.
http://www.codechef.com/RGPV20...
http://www.codechef.com/RGPV2
http://www.codechef.com/RGPV3

 

when this question will open???

 

import java.util.*; class

sohan_aryan @ 15 May 2011 09:07 PM

import java.util.*;

class life

{

public static void main(String args[])

{

Scanner s=new Scanner(System.in);

int a;

do

{

a=s.nextInt();

}

while(a!=42);

}

}

M new to Code Chef.. can

avi_mathur @ 25 May 2011 10:49 AM
M new to Code Chef.. can anyone recommend me which compiler i sholud use to practice.. I run on a 64-bit i5processor.. most f the C compilers donot support dis architecture. Please help nd post a link to download a C compiler. I would recommend CODECHEF to present its users with a Common Compiler so as to avoid later compile errors after submission..

What should I do if I am

damaman @ 7 Jun 2011 10:23 PM
What should I do if I am pretty sure that my code is correct and the judge says it's wrong

is solution of dev c++ or

nisha_goel15 @ 18 Jun 2011 03:31 AM
is solution of dev c++ or turbo c++ valid???? pls rply asap

@nisha_goel15: No, it is not

balajiganapath @ 18 Jun 2011 08:04 AM
@nisha_goel15: No, it is not valid. Compile with MinGW if you are using windows. Better download an IDE+compiler combination for windows like CodeBlocks + MinGW here: http://www.codeblocks.org/downloads/26

http://www.codechef.com/views

rijul007 @ 18 Jun 2011 04:07 PM
http://www.codechef.com/viewsolution/576407 plz chek out the sol and tell me whats wrong with it... it gave the correct answers for all the test cases that i tested ... but on submitting produced wroong ans..............

@balajiganapath thanks.. can

nisha_goel15 @ 19 Jun 2011 02:58 AM
@balajiganapath thanks.. can u also tell me that where i will get its header files and function refrences....

@nisha_goel15

balajiganapath @ 19 Jun 2011 07:54 AM
@nisha_goel15 http://www.cplusplus.com/reference/

please check my codes .It's

sudarshani071 @ 3 Jul 2011 10:26 AM
please check my codes .It's correct answer when i test.but when i submitting it gives wrong... import java.util.*; class Stop42{ public static void main(String[] arg){ Scanner myScn = new Scanner(System.in); int num = myScn.nextInt(); ArrayList art = new ArrayList(); while(num!=42){ art.add(num); num = myScn.nextInt(); } System.out.println(art); System.out.println("you have entered 42 number"); } }

i want to know how to input a

chester_lp_92 @ 10 Aug 2011 01:19 AM
i want to know how to input a long long int correctly using scanf ... somebody help !!

@chester_lp_92: You

lg5293 @ 12 Aug 2011 08:53 PM
@chester_lp_92: You use: scanf ("%lld", &num);

i want to know that do we

coder1 @ 15 Aug 2011 12:12 AM
i want to know that do we have to write code according to command line arguments or any aother. i m writing it in jcreator(java).will it do?

sources/Main.java:2: class

deba_22 @ 28 Aug 2011 09:34 PM
sources/Main.java:2: class luckynumber is public, should be declared in a file named luckynumber.java public class luckynumber ^ 1 error what does this error mean ??

where is my codechef id

cheena @ 14 Sep 2011 03:20 PM
where is my codechef id given???

I am not able to post comment

s1aurabhpal_7 @ 24 Sep 2011 03:54 PM
I am not able to post comment :D

if my program gives a

saumya_rastogi @ 3 Oct 2011 12:07 PM
if my program gives a "runtime error"...can consider my code as correct or not? (by correct i mean it is giving right output)

how do you compute rank . .

coolgaurav13 @ 9 Oct 2011 07:06 PM
how do you compute rank . . .?? Plzz explain me..

sir, plz give me the solution

ashutosh1991 @ 24 Oct 2011 02:37 PM
sir, plz give me the solution of contest RGVPPRAC contest url is http://www.codechef.com/RGVPPRAC . plz allow me that i can view solution

@admin : why so much fuss

tarun_joshi01 @ 6 Nov 2011 11:02 PM
@admin : why so much fuss regarding submitting solution,, i have seen other coding contests where there is more focus on the solution rather than a contestant being rejected due to this in.txt/out.txt. They just provide the method signature in a textfield and you have to provide your logic as that method's implementation, you dont have to implement the main method neither have to worry about the datatype of the input testcases , which are trifle as seen in the whole context of solving the puzzle.

@ Saumya no. How to fix NZEC

tru3liar @ 3 Dec 2011 08:15 PM
@ Saumya no. How to fix NZEC error? I got to use throws IOException so please help

I used try and catch for

tru3liar @ 3 Dec 2011 08:41 PM
I used try and catch for IOException ...still NZEC error...ADMINS can YOU respond?

NZEC error here. How to

tru3liar @ 6 Dec 2011 10:49 PM
NZEC error here. How to fix? (i got to use throws or throw) http://www.codechef.com/viewsolution/744527 http://www.codechef.com/viewsolution/744477

what is runtime error

avinash1 @ 18 Dec 2011 08:41 AM
what is runtime error SIGKILL? normally I gets this in C# on your platform.

Input can be negative

tru3liar @ 3 Feb 2012 11:32 AM
Input can be negative numbers? -47 is lucky?

Input can be float?

tru3liar @ 3 Feb 2012 11:32 AM
Input can be float?

some more examples of

chaubey12 @ 6 Feb 2012 07:07 PM
some more examples of question http://www.codechef.com/FEB12/problems/MAXCOUNT#comment-22003

some more examples of

chaubey12 @ 6 Feb 2012 07:07 PM
some more examples of question http://www.codechef.com/FEB12/problems/MAXCOUNT#comment-22003

some more examples of

chaubey12 @ 6 Feb 2012 07:08 PM
some more examples of question http://www.codechef.com/FEB12/problems/MAXCOUNT

weather should i have to

pank12 @ 16 Mar 2012 02:39 AM
weather should i have to submit the out.txt also for successful submission?

what does the SIGKILL error

prajacta @ 19 Mar 2012 01:37 AM
what does the SIGKILL error imply?

Pretty informative.

mrdigerati @ 1 Apr 2012 09:13 AM
Pretty informative.

What is the exact version of

yejianfei @ 8 Apr 2012 11:05 AM
What is the exact version of the operating system used in CodeChef? What is the exact compiler's version used in CodeChef?

whats happening with my

taruntps @ 9 Apr 2012 07:03 PM
whats happening with my code,giving run-time error.wheres the problem

Is it necessary to include

vsaijan4 @ 2 May 2012 09:03 PM
Is it necessary to include import java.io.*; (and others like import java.util.*; if necessary) while submitting a file containing my java code??? Please reply. Thank you.

What can be done to reduce

faadu_coder @ 3 May 2012 10:42 PM
What can be done to reduce excecution time,if my code require nested loops

if a allocate some memory

mayank_natani @ 7 May 2012 06:57 PM
if a allocate some memory which is not permitted like int array[1000000][1000000] and free it in the last then also will it give the run time error???

how score of a problem is

anucodes @ 9 May 2012 06:30 PM
how score of a problem is calculated in long contests???

@vsaijan4 of course it is

betlista @ 23 May 2012 02:19 AM
@vsaijan4 of course it is needed to include imports

The code is running fine in

jatincse @ 31 May 2012 01:05 PM
The code is running fine in my system.There is no run time error.In codechef,my all program are given run time error.that's why i could not become the regular coder of code chef.I am using cygwin gcc compiler pluged in netbens. Please tell me the solution

@admin for import

Gaurav Rai @ 8 Jul 2012 03:48 PM
@admin for import psyco psyco.full() I am getting runtime error in Python, so I think package not included in your both Python 2.7 & Python 3

@admin, the code is running

priyank61 @ 13 Aug 2012 06:27 PM
@admin, the code is running perfectly fine in my PC, but there is some problem when I run it on Codechef, it always shows runtime error. I guess there is a problem with I/O. Do we have to use 'cin' object for input or file stream?

All the codes i had submitted

sivareddy963 @ 14 Aug 2012 07:19 PM
All the codes i had submitted for Doors problem of Bytecode 2012 are running successfully in Borland C++ compiler yielding desired results. Then why am i getting Compile error in code chef . Plz once refer to my code and give a solution to me as to why am i getting problem... Plz reply soon

@admin All the codes i had

sivareddy963 @ 14 Aug 2012 07:20 PM
@admin All the codes i had submitted for Doors problem of Bytecode 2012 are running successfully in Borland C++ compiler yielding desired results. Then why am i getting Compile error in code chef . Plz once refer to my code and give a solution to me as to why am i getting problem... Plz reply soon

how can i fix the size of

sattu125 @ 25 Aug 2012 12:23 PM
how can i fix the size of BufferedReader in java??????? i wand to enter only 100 char from user using BufferedReader.

Thanks For Best Infomation.

uwenice @ 13 Sep 2012 11:52 AM
Thanks For Best Infomation.

submission of this code fetch

bablu @ 20 Sep 2012 09:42 PM
submission of this code fetch wrong answer....kindly tell what's wrong with the code... http://www.codechef.com/submit/complete/113185-4834--505b3fbd96437

Hi admin, please update

abhishrivastav @ 15 Oct 2012 08:12 PM
Hi admin, please update support for c++ compiler(like g++ 4.7) that supports c++11 for the problems that can be solved in c++ . Thanks.

how can i get counntrywise

aof_tanvir @ 16 Oct 2012 07:52 PM
how can i get counntrywise ranking such as bangladesh contestant ranking

can anyone help me to

maha94 @ 26 Oct 2012 01:21 PM
can anyone help me to understand balancing factors in avl tree??? i searched a lot in google and saw more results since morning. i can't able to understand fully. plz someone guide me to learn that through suggesting sme links or source....??

How do I know my score during

arif334 @ 2 Nov 2012 11:26 PM
How do I know my score during a contest?

i dont understand one thing.

vignesh07 @ 22 Nov 2012 06:07 PM
i dont understand one thing. on submitting my program it says running for long time. later displays wrong answer. but in my mail it says "Time to run: 0.10sec". i dont understand this.

How can I know any scenario

nehaheights @ 24 Nov 2012 12:18 AM
How can I know any scenario 'coz of which am getting Wrong Answer.

after submission the program

harishgarg @ 10 Dec 2012 11:51 AM
after submission the program it shows wrong but my program is correct

i m getting answer on many

nitheshrocks @ 3 Feb 2013 01:33 AM
i m getting answer on many compilers but in this its showing run time error(sigsegv) error. can u plz help me

i'm new to codechef.. i'm

srinivas12 @ 9 Feb 2013 06:10 PM
i'm new to codechef.. i'm interested in coding but does'nt know where to start.. could you help me??

If I get TIME LIMIT EXCEED,

siddharth6150 @ 7 Mar 2013 10:03 PM
If I get TIME LIMIT EXCEED, does it mean my ANSWER is correct?

I am applying for a contest

rbharti_928 @ 14 Mar 2013 11:17 PM
I am applying for a contest and that needs CodeChef ID . what is a CodeChef ID ? i am not understanding it. Please clear my doubt

@rbharti_928 : CodeChef ID is

vineetpaliwal @ 14 Mar 2013 11:30 PM
@rbharti_928 : CodeChef ID is you login name with which you login to codechef website if you are a registered member of codechef .

@siddharth6150 : No . The

vineetpaliwal @ 14 Mar 2013 11:32 PM
@siddharth6150 : No . The system kills your process as soon as the time limit is exceeded . Your solution may be giving correct answer till that time but didn't finish or it may not have even begun writing to output and the time got over .

if psyco is not supported in

chef_sandy @ 18 Mar 2013 08:23 PM
if psyco is not supported in python 2.7 then why is it mentioned here?

i am getting na in long

vibhor1510 @ 19 Apr 2013 09:15 PM
i am getting na in long ranking despite having solved 10 odd questions from practice and it says in bottom oops!we cannot find your country code pls help!

you get ranking only when you

pbhaskal @ 20 Apr 2013 10:36 AM
you get ranking only when you solve questions in a contest (long or short duration)

Can I change my country code

wangyl90 @ 20 May 2013 02:13 AM
Can I change my country code from 'US' to 'CN'?
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.