I dont seem to understand this run error

Almost every code I write is running into this run error kindly, offer a workaround to this problem in python

hello @KushagraNITJ
please share ur code using cb ide

astr=input()
N=int(astr[0])
M=int(astr[-1])
mat=[]
for i in range(N):
x=input()
alist=x.split(" ")
mat.append(alist)
target=int(input())
def check(mat):
for i in mat:
if str(target) in i:
return 1
return 0
print (check(mat))

pls save it here -> https://ide.codingblocks.com/
and then share the link.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.