Getting NZEC in python,while AC in C++

Getting NZEC in code submitted in python, while same thing written in C++ got AC. Can anyone figure out please what is the problem with python on codechef ide?
It’s working on offline ide.
https://www.codechef.com/viewsolution/24344953. Link for python code.
https://www.codechef.com/viewsolution/22162945. Link for C++ code.
https://www.codechef.com/problems/TRISQ. Link for the problem.
@l_returns

1 Like
RecursionError: maximum recursion depth exceeded in comparison

You have to give costum recurssive limit
here is your accepted code

Solution

import sys
sys.setrecursionlimit(150000)

def fun(n):
if(n<3):
return 0
return fun(n-2)+(n//2)-1
for _ in range(int(input())):
n=int(input())
print(fun(n))

for more have a look at

1 Like

Thanks a lot bro…

1 Like