Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
a = []
mod = 10**9+7
for i in range(m):
    temp = int(input())
    a.append(temp)

a.append(0)
dp = [0]*(n+1)
dp[0] = 1
if a[0] == 1:
    dp[1] = 0
    l = 1
else:
    dp[1] = dp[0]
    l = 0
    
for i in range(2,n+1):
    if a[l] != i:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i]%=mod 
    else:
        l += 1

print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
mod = 10**9+7
for i in range(m):
    temp = int(input())
    a.append(temp)

a.append(0)

dp = [0]*(n+1)
dp[0] = 1
if a[0] == 1:
    dp[2] = dp[0]+dp[1]
    l = 1
else:
    dp[1] = dp[0]
    dp[2] = dp[1]+dp[0]
    l = 0
    
for i in range(3,n+1):
    if a[l] != i:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i]%=mod 
    else:
        l += 1
        
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
mod = 10**9+7
for i in range(m):
    a.append(int(input()))

a.append(0)

dp = [0]*(n+1)
dp[0] = 1
if a[0] == 1:
    dp[2] = dp[0]+dp[1]
    l = 1
else:
    dp[1] = dp[0]
    dp[2] = dp[1]+dp[0]
    l = 0
    
for i in range(3,n+1):
    if a[l] != i:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i]%=mod 
    else:
        l += 1
        
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))

a.append(0)

dp = [0]*(n+1)
dp[0] = 1
if a[0] == 1:
    dp[2] = dp[0]+dp[1]
    l = 1
else:
    dp[1] = dp[0]
    dp[2] = dp[1]+dp[0]
    l = 0
    
for i in range(3,n+1):
    if a[l] != i:
        dp[i] = dp[i-1] + dp[i-2]
    else:
        l += 1
        
print(dp[-1]%1000000007)

Buggy submission (verdict: Runtime Error):
def fio(x,y):
    return x+y

n_a,m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))

n = [0,1,2]

for i in range(1,100000):
    n.append(fio(n[i],n[i+1]))

last_break = 0
ans = 1
ans = ans * n[a[0]-last_break-1]
ans = ans % 1000000007
last_break = a[0]

if a[0] == 1:
    ans = 1
    
for i in range(1,m):
    ans = ans * n[max(0,a[i]-last_break-2)]
    ans = ans % 1000000007
    last_break = a[i]
    
ans = ans * n[n_a-last_break-1]
ans = ans % 1000000007
if m == 0:
    ans = n[n_a]
    ans = ans % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
def fio(x,y):
    return x+y

n_a,m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))

n = [0,1,2]

for i in range(1,100000):
    n.append(fio(n[i],n[i+1]))

last_break = 0
ans = 1
ans = ans * n[a[0]-last_break-1]
ans = ans % 1000000007
last_break = a[0]

if a[0] == 1:
    ans = 1
    
for i in range(1,m):
    ans = ans * n[max(0,a[i]-last_break-2)]
    ans = ans % 1000000007
    last_break = a[i]
    
ans = ans * n[n_a-last_break-1]
ans = ans % 1000000007
if m == 0:
    ans = n[n_a]
    ans = ans % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
def fio(x,y):
    return x+y

n_a,m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))

n = [0,1,2]

for i in range(1,100000):
    n.append(fio(n[i],n[i+1]))

last_break = 0
ans = 1
ans = ans * n[a[0]-last_break-1]
ans = ans % 1000000007
last_break = a[0]

if a[0] == 1:
    ans = 1
    
for i in range(1,m):
    ans = ans * n[max(0,a[i]-last_break-2)]
    ans = ans % 1000000007
    last_break = a[i]
    
ans = ans * n[n_a-last_break-1]
ans = ans % 1000000007
print(ans)