Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (N+2)
A = set([int(input()) for _ in range(M)]) 
dp[-2] = 1

for i in range(N-1, -1, -1):
    if (i in A) == False:
        dp[i] = (dp[i + 1] + dp[i + 2]) % mod 

print(dp[0])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * N
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1

for i in range(N-2, -1, -1):
    if (i in A) == False:
        dp[i] = dp[i + 1] + dp[i + 2] 

print(dp[0] % mod)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n, mod):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1, mod)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (10**5 + 2)
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n, mod):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1, mod)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (10**5)
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n, mod):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (10**5)
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n mod):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (10**5)
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * (10**5)
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1)

N, M = map(int, input().split())
mod = 1000000007
dp = [0] * 10**5
A = [int(input()) for _ in range(M)] 
if (N-1 in A) == False:
    dp[N], dp[N-1] = 1, 1
else:
    dp[N] = 1
ans = main(A, dp, N-2)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dp, n):
    if n == -1:
        return dp[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dp, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * 10**5
A = [int(input()) for _ in range(M)] 
dp[N], dp[N-1] = 1, 1
ans = main(A, dp, N-2)
print(ans)

Buggy submission (verdict: Runtime Error):
def main(A, dq, n):
    if n == -1:
        return dq[0]

    if (n in A) == False: 
        dp[n] = dp[n + 1] + dp[n + 2]
    return main(A, dq, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * 10**5
A = [int(input()) for _ in range(M)] 
dp[N], dp[N-1] = 1, 1
ans = main(A, dp, N-2)
print(ans % mod)

Buggy submission (verdict: Runtime Error):
def main(A, dq, n):
    if n == -1:
        return dq[0]

    if (n in A) == False: 
        dp[n] = (dp[n + 1] + dp[n + 2]) % mod
    return main(A, dq, n-1)
 
N, M = map(int, input().split())
mod = 1000000007
dp = [0] * 10**5
A = [int(input()) for _ in range(M)] 
dp[N], dp[N-1] = 1, 1
ans = main(A, dp, N-2)
print(ans)