Submit python solution

Hi, I am quite new to codechef and also submitted my first problem. I am extremely sorry if this is not the right question to post. I am having an issue regarding submission. The issue is when I submit the solution against the custom input which is derived from problem description, it works!! (The program able to produce the right result). But then when I submit the solution not against the custom input, I get ‘NZEC’. Below is my attached code. If there is a problem with the code, please help me out. I couldn’t move one step further. The solution is for the problem https://www.codechef.com/problems/HMAPPY2

def gcd(a,b):
   if a == b: return a
   if a > b: return gcd(a-b,a)
   return gcd(a,b-a)

def lcm(a,b):
   return a*b // gcd(a,b)

testcases = int(input())
for t in range(testcases):
    N,a,b,k = map(int,input().split())
    x = N//a
    y = N//b
    z = N//lcm(a,b)
    print('Win' if x+y-2*z >= k else 'Lose')
1 Like

Maybe the problem is with your gcd function: CodeChef: Practical coding for everyone

I have the same problem, shows a EOF error at the first line of any code I write. Yet the codes runs perfectly in other IDEs like Jupyter or Sublime text.

1 Like

Yess… I have the same problem, actually they are providing the oldest interpreter for it and many of the language platform like java they are providing the worst compiler and here the CodeChef sucks, i have never found this issue on any platform…

1 Like

The Same had happened with me… my, every python code submission always shows NZEC error while the code works fine in my PC, and even when I tried to resubmit my previous AC submitted code which earlier was accepted now they are also showing NZEC error……

1 Like

Me too. Help me if any one overcame this EOF error at the first line of any code.Thankyou.

It’s happening because the input function

I was having the same NZEC errors & EOF error issues with my Python code as well.
However, after reading a post written by drj_reddy I was able to overcome this issue.
The author discusses How to debug an NZEC errors.
In the post, the author suggest using Python’s Exception handling for submitting code:

try:
    #code that may throw an error
except Exception as e:
    pass

After reading this post, I was finally able to submit my first code submission to Codechef successfully!