NZEC Error Python. Winning strategy game

https://www.codechef.com/viewsolution/37959248
here is my code. it works fine on pycharm in my computer but it says nzec error on codechef. how can I fix it ?

it hapened with me also . so try this … it’ll work.
in try function paste ur code and in exception pass . it 'll throw all exception(e.g. NZCE error)
and pass it.

try:
paste ur whole code here
except:
pass

I did but now it is showing even bigger error
Traceback (most recent call last):
File “/usr/lib/python3.6/py_compile.py”, line 125, in compile
_optimize=optimize)
File “”, line 741, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “./prog.py”, line 2
n = int(input("Enter the length of the array: "))
^
IndentationError: expected an indented block

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python3.6/py_compile.py”, line 129, in compile
raise py_exc
py_compile.PyCompileError: Sorry: IndentationError: expected an indented block (prog.py, line 2)

It’s Indentation Error, rewrite the code again.

I can see only indentation error!!
Write with proper indentation.

Now , I’ve seen ur code .
when sys giving input in format
2 (one int )
3 (one int)
1 1 1 (this is a line input e.g array , u can’t take it as one by one and append)
4 (one input)
1 1 1 1 (same as above , a line input())

just few cahnges u can apply:
n = int(input())
arrayinput = list(map(int,input().split()))
after this ur code run succesfully. believe me :slight_smile:
take input as like above and don’t print messages in it. it’ll also cause error .
print only needed output anything else . bec compiler detect extra things will cause error.

i did all the changes you said. its still showing error

here is the code: CodeChef: Practical coding for everyone