Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
kaidan = [0] * (N + 1)
for i in range(M):
    tmp = int(input())
    kaidan[tmp] = -1
kaidan[0] = 1
for i in range(1,N + 1):
    if i == 1:
        if kaidan[i] != -1:
            kaidan[i] = 1
        else:
            kaidan[i] = 0
    else:
        if kaidan[i] != -1:
            kaidan[i] = kaidan[i -1] + kaidan[i - 2]
        else:
            kaidan[i] = 0
print(kaidan[N] % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
if M > 1 :
    for i in range(M - 1):
    m = a[i + 1] - a[i]
    if m > 1:
        num = num * fibo(m - 2)
    else:
        num = 0
        break
    num = num * fibo(N - a[M - 1] - 1)
elif M == 1:
    num = num * fibo(N - a[M - 1] - 1)
else :
    num = fibo(N)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    if m > 1:
        num = num * fibo(m - 2)
    else:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    if m > 1:
        num = num * fibo(m - 2)
    elif m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    c, b = 1, 0
    while i > 0:
        c, b = c + b, c
        i -= 1
    return c
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    a, b = 1, 0
    while i > 0:
        a, b = a + b, a
        i -= 1
    return a
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0:
        return 1
    elif i == 1:
        return 1
    else:
        if i in memo:
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2, memo)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2, memo)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1, memo)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0:
        return 1
    elif i == 1:
        return 1
    else:
        if i in memo:
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0, 1:
        memo[i] = 1
        return memo[i]
    else:
        if i in memo:
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0, 1:
        memo[i]=1
        return memo[i]
    else:
        if i in memo.keys():
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i):
    if i == 0 :
        return 1
    elif i == 1:
        return 1
    else :
        return fibo(i - 1) + fibo(i - 2)
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)