Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if a_pos[1] else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[1] else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[1] == 1 else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
for i in range(n-1):
    if a_pos[i+2] == 1:
        dp[i+2] = 0
    else:
        dp[i+2] = (dp[i] + dp[i+1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
pos = 1 if aL[0] == 1 else 0
for i in range(n-1):
    if pos < len(aL):
        if i+2 == aL[pos]:
            dp[i+2] = 0
            pos += 1
        else:
            dp[i+2] = (dp[i] + dp[i+1]) % mod
    else:
        dp[i+2] = (dp[i] + dp[i+1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
cant = 0
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
pos = 1 if aL[0] == 1 else 0
for i in range(n-1):
    if pos < len(aL):
        if i+2 == aL[pos]:
            dp[i+2] = 0
            pos += 1
        else:
            dp[i+2] += (dp[i] + dp[i+1]) % mod
    else:
        dp[i+2] += (dp[i] + dp[i+1]) % mod

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
cant = 0
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
for i in range(n-1):
    if i+2 in aL:
        if dp[i+1] > 0:
            dp[i+2] = 0
        else:
            cant = 1
            break
    else:
        dp[i+2] += (dp[i] + dp[i+1]) % mod
if cant == 1:
    print(0)
else:
    print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
cant = 0
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
pos = 1 if aL[0] == 1 else 0
for i in range(n-1):
    if pos < len(aL):
        if i+2 == aL[pos]:
            if dp[i+1] > 0:
                dp[i+2] = 0
                pos += 1
            else:
                cant = 1
                break
        else:
            dp[i+2] += (dp[i] + dp[i+1]) % mod
    else:
        dp[i+2] += (dp[i] + dp[i+1]) % mod
if cant == 1:
    print(0)
else:
    print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
cant = 0
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
if dp[1] == 0:
    pos = 1
else:
    pos = 0
for i in range(n-1):
    if pos < len(aL):
        if i+2 == aL[pos]:
            if dp[i+1] > 0:
                dp[i+2] = 0
                pos += 1
            else:
                cant = 1
                break
        else:
            dp[i+2] += (dp[i] + dp[i+1]) % mod
    else:
        dp[i+2] += (dp[i] + dp[i+1]) % mod
if cant == 1:
    print(0)
else:
    print(dp[n])