Problem p03013 (python)

Fixed submission:
def examC():
    N, M = LI()
    A = [I() for _ in range(M)]
    A.append(N+1)
    fib = [1]*(N+2)
    for i in range(1,N):
        fib[i+2] = fib[i+1] + fib[i]
    fib[0] = 0
#    print(fib)
    ans = fib[A[0]]%mod
    for i in range(M):
        ans *= fib[A[i+1]-A[i]-1]
        ans %=mod
    print(ans)
    return

def examD():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()

Buggy submission (verdict: Runtime Error):
def examC():
    N, M = LI()
    A = [I() for _ in range(M)]
    A.append(N+1)
    fib = [1]*(N+1)
    for i in range(1,N-1):
        fib[i+2] = fib[i+1] + fib[i]
    fib[0] = 0
#    print(fib)
    ans = fib[A[0]]
    for i in range(M):
        ans *= fib[A[i+1]-A[i]-1]
        ans %=mod
    print(ans)
    return

def examD():
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,inf
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0]=N
if M!=0:
    A[0] = a[0] - 1
    A[M] = N - a[M-1]-1
    for i in range(M-1):
        A[i+1] = a[i+1] - a[i]- 2
        if A[i+1]==-1:
            ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
if N>2:
    for i in range(N - 1):
        SA[i + 2] = SA[i + 1] + SA[i]
        SA[i + 2] = SA[i + 2] % 1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):


N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0]=N
if M!=0:
    A[0] = a[0] - 1
    A[M] = N - a[M-1]-1
    for i in range(M-1):
        A[i+1] = a[i+1] - a[i]- 2
        if A[i+1]==-1:
            ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
if N>2:
    for i in range(N - 2):
        SA[i + 2] = SA[i + 1] + SA[i]
        SA[i + 2] = SA[i + 2] % 1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
if M!=0:
    A[0] = a[0] - 1
    A[M] = N - a[M-1]-1
    for i in range(M-1):
        A[i+1] = a[i+1] - a[i]- 2
        if A[i+1]==-1:
            ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
if N>2:
    for i in range(N - 2):
        SA[i + 2] = SA[i + 1] + SA[i]
        SA[i + 2] = SA[i + 2] % 1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
if M!=0:
    A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
if N>2:
    for i in range(N - 2):
        SA[i + 2] = SA[i + 1] + SA[i]
        SA[i + 2] = SA[i + 2] % 1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
if M!=0:
    A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0


SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    if A[i]>=0:
        ans *= SA[A[i]]
        ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
if M>0:
    a = [0]*M
    for i in range(M):
        a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a = [0]*M
for i in range(M):
    a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
import sys

N,M =map(int,input().split())
a = [0]*M
for i in range(M):
    a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0
        print(ans)
        sys.exit()

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(ans)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a = [0]*M
for i in range(M):
    a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0
        print(ans)
        exit()

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]
    SA[i+2] = SA[i+2]%1000000007

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(int(ans))

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a = [0]*M
for i in range(M):
    a[i] = int(input())

ans = int(1)

A = [0]*(M+1)
A[0] = a[0]-1
A[M] = N - a[M-1]-1
for i in range(M-1):
    A[i+1] = a[i+1] - a[i]- 2
    if A[i+1]==-1:
        ans = 0
        print(ans)
        exit()

SA =[0]*N
SA[0] = int(1)
SA[1] = int(1)
for i in range(N-2):
    SA[i+2] = SA[i+1] + SA[i]

for i in range(M+1):
    ans *= SA[A[i]]
    ans = ans%1000000007


print(int(ans))