Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [-1]*(n+1)
memo[0]=1
su = 0
if 1 in l:
  memo[1]=0
else:
  memo[1]=1
for j in l:
  memo[j]=0
  
for i in range(2,n+1):
  if memo[i]==0:
    continue
  else:
    memo[i]=((memo[i-1]%q)+(memo[i-2]%q))%q
print(memo[-1]%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n+1)
memo[0]=1
def a(x):
  if x in l :
    return 0
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=0:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [-1]*(n+1)
memo[0]=1
for i in l:
  memo[i]=0
def a(x):
  if x in l :
    continue
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=-1:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [-1]*(n+1)
memo[0]=1
def a(x):
  if x in l :
    memo[x]=0
    return 0
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=-1:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))%q
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n+1)
memo[0]=1
def a(x):
  if x in l :
    return 0
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=0:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))%q
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n+1)
memo[0]=1
def a(x):
  if x in l :
    return 0
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=0:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))%
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n+1)
memo[0]=1
def a(x):
  if x in l :
    memo[x]=0
    return 0
  elif x==1:
    memo[1]=1
    return 1
  else:
    if memo[x]!=0:
      return memo[x]
    else:
      memo[x] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7
memo = [0]*(n)
def a(x):
  if x in l :
    return 0
  if x==1:
    return 1
  elif x==2 and ( 1 in l):
    return 1
  elif x ==2:
    return 2
  else:
    if memo[x-1]!=0:
      return memo[x-1]
    else:
      memo[x-1] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))
print(a(n)%q)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [int(input()) for _ in range(m)]
q = 10**9+7

def a(x):
  memo = [0]*(x)
  if x in l :
    return 0
  if x==1:
    return 1
  elif x==2:
    return 2
  else:
    if memo[x-1]!=0:
      return memo[x-1]
    else:
      memo[x-1] = a(x-1)+a(x-2)
      return (a(x-1)+a(x-2))%q
print(a(n)%q)