Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
mod=10**9+7
A=set([int(input()) for i in range(M)])

data=[0 for i in range(N)]
if 1 not in A:
    data[0]=1
if N>=2:
    if 2 not in A:
        data[1]=1+data[0]


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

#print(data)

print(data[-1])

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
mod=10**9+7
A=set([int(input()) for i in range(M)])

data=[0 for i in range(N)]
if 1 not in A:
    data[0]=1
if 2 not in A:
    data[1]=1+data[0]


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

#print(data)

print(data[-1])

Buggy submission (verdict: Runtime Error):
def _comb(N,M):
    if not N:return(0)
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
if N-1 in A:pass
else:A.append(N+1)
if 1 in A:pre=-1
else:pre=0
count=1
for a in A:
    if a-pre==0:
        print(0)
        exit()
    count*=sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)])
    pre=a+1
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
def _comb(N,M):
    if not N:return(0)
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
if N-1 in A:pass
else:A.append(N+1)
if 1 in A:pre=-1
else:pre=0
count=1
for a in A:
    count*=sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)])
    pre=a+1
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
def _comb(N,M):
    if not N:return(0)
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N+1)
count=1
if 1 in A:pre=-1
else:pre=0
for a in A:
    count*=sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)])
    pre=a+1
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
def _comb(N,M):
    if not N:return(0)
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N+1)
count=1
if 1 in A:pre=-1
else:pre=0
for a in A:
    count*=sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)])
    print(sum([_comb(a-1-pre-i,i) for i in range((a-1)-pre)]),a)
    pre=a+1
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
def _comb(N,M):
    count=1
    for i in range(0,M):
        count*=N-i
    for i in range(1,M+1):
        count/=i
    return(int(count))

N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N)
if not 1 in A:
    A.append(0)
    A.sort()
count=1
for m in range(len(A)-1):

    count*=sum([_comb((A[m+1]-1)-A[m]-i,i) for i in range((A[m+1]-1)-A[m])])
    #print(sum([comb((A[m+1]-1)-A[m]-i,i,exact=True) for i in range((A[m+1]-1)-A[m])]),sum([_comb((A[m+1]-1)-A[m]-i,i) for i in range((A[m+1]-1)-A[m])]),count)
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb
N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N)
if not 1 in A:
    A.append(0)
    A.sort()
count=1
for m in range(len(A)-1):

    count*=sum([comb((A[m+1]-1)-A[m]-i,i,exact=True) for i in range((A[m+1]-1)-A[m])])
    #print(sum([comb((A[m+1]-1)-A[m]-i,i,exact=True) for i in range((A[m+1]-1)-A[m])]),count)
print(count%1000000007)

Buggy submission (verdict: Runtime Error):
from scipy.special import perm, comb
N,M=list(map(int,input().split()))
A=[int(input()) for i in range(M)]
A.append(N)
if not 1 in A:
    A.append(0)
    A.sort()
count=1
for m in range(len(A)-1):

    count*=sum([comb((A[m+1]-1)-A[m]-i,i,exact=True) for i in range((A[m+1]-1)-A[m])])
    print(sum([comb((A[m+1]-1)-A[m]-i,i,exact=True) for i in range((A[m+1]-1)-A[m])]),count)
print(count%1000000007)