New to Codechef. Can't understand the platform

Hi, I am new to codechef and I am trying to solve some easy level problem first but it seems
like I donot understand the platform well. I am good in Python 3 and have been doing great with my problem solving skill on Hackerrank platform . But ever since I logged to codechef I am always getting NZEC error or runtime error with my python code.

Also I am not able to comprehend the problem statement well I think as unlike hackerrank problem statement are not clearly explained here. Please help me.

6 Likes

Can you please the screenshot where did you get the error ?

One thing that trips up all people migrating from Hackerrank (hello :)) is that clicking “Run” (not “Submit”) here on Codechef does not run your code with the sample testcases - instead, it runs it with empty input (so attempts to read anything from stdin will fail, or give weird values). If you click “Run”, you must provide Custom Input.

40 Likes

Ha! Even I tripped on that the first time. :crazy_face:

4 Likes

I think I spent about 10 minutes clicking Run and looking at my debug output and scratching my head the first time XD

13 Likes

1 Like

did you press run?
That might explain why you got NZEC because you didn’t give any sample input

Read this post, it may help.

@gauraws import functools. Map is now in functools. This was done because GVR figured since coders can just do [func(x) for x in iterable] , map needn’t be a builtin function

1 Like

This problem occurs because you didn’t provide the inputs to your code.
So please click on Custom Input checkbox and then provide input, what you want then click on run.
Now you will good to go ; )

1 Like

My code works fine with custom input(same input as in the problem description) but when I submit it says “Wrong answer”.Need help.

#Code
def uni():
global uniprob
for i in list:
if(i.prob_num<9):
uniprob.append(i.prob_num)
uniprob = set(uniprob)
class Test:
def init(self):
self.prob_num,self.score=(int(input()),int(input()))

Taking test case and submissions

try:

tcase = input()
tcase = int(tcase)
for _ in range(tcase):
    uniprob =[]
    list=[]
    submis = int(input())

Creating a list of objects

    for i in range(submis):
        list.append(Test())

Global Scope

    uni()
    k=0
    maxm=0
    finalres=0

    for k in uniprob:
        for i in list:
            if i.score>maxm and i.prob_num==k:
                maxm = i.score
        finalres = finalres+maxm
        maxm=0
    print(finalres)

except:
pass

Even me when I came from Hackerearth :sweat_smile:

3 Likes

gosh! that was it lol. I havent competed since 2012…feel so stupid

2 Likes

Hi,I am using python 3.6 lang, I clicked on custom input and it work fine when i click on run but the problem is coming when I am clicking on Submit Button it is always showing wrong answer.
while i have checked for solutions in other language and my solution is correct what to do?

https://www.codechef.com/viewsolution/32286114
Corrected it. Your code may sometimes print yes multiple times, so you also need to check that flag!=1. Also you were not resetting flag after each test case.

Hi thank u so much :hugs:.

Use try: and except: for python. It works for me.
For example:
try:
for t in range(int(input()):
n = int(input())
print(n)
except:
pass

if you want to test your code, give sample input and then click “RUN”. if you want to submit code, you just click “submit” button. NZEC error occurs when we click “RUN” without giving input

welcome to maturity.

Hi, I am actually new to codechef platform. Could you help me in overcoming error like
“Traceback (most recent call last):
File “./prog.py”, line 5, in
EOFError: EOF when reading a line”.
However, I ran the program with custom input.But, I couldn’t manage it while submitting. Could you please help me with this.Thankyou