Problem p03013 (python)

Fixed submission:
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]+ a+ [N+1]
fib = [0,1]
for i in range(10**5):
    fib.append((fib[-1]+fib[-2])%1000000007)
ans = 1
for i in range(len(b)-1):
    ans= (ans*fib[b[i+1]-b[i]-1])%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]+ a+ [N+1]
def combination(n, k):
    result = 1
    for i in range(n - k + 1, n + 1):
        result *= i
    for i in range(1, k + 1):
        result /= i
    return result

def fibonacci(k):
    k = k + 1
    result = 0
    for i in range(1, int(math.ceil(k / 2.0) + 1)):
        result += combination(k, 2 * i - 1) * pow(5, i - 1)
    return int(result / pow(2, k - 1))

def combi(d):
    if d < 0:
        return 0
    elif 0 <= d <= 1:
        return 1
    else:
        return fibonacci(d)
ans = 1
for i in range(len(b)-1):
    ans= (ans*combi(b[i+1]-b[i]-2))%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]+ a+ [N+1]
def combi(d):
    if d < 0:
        return 0
    elif 0 <= d <= 1:
        return 1
    else:
        combi = int((1/math.sqrt(5))*(((1+math.sqrt(5))/2)**(d+1) - ((1-math.sqrt(5))/2)**(d+1)) + 0.01)
        return combi
ans = 1
for i in range(len(b)-1):
    ans= (ans*combi(b[i+1]-b[i]-2))%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]
b.extend(a)
b.extend([N+1])
ans = 1
import sympy as sym
def fibo(n):

    x = sym.symbols('x',nonnegative=True,integer=True)
    Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1))
    result=Fib.subs(x,n)
    result=sym.simplify(result) #式の整理
    return result

for i in range(M+1):
    dan = b[i+1]-1 - b[i]
    ans = ans*fibo(dan+1)%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]
b.extend(a)
b.extend([N+1])
ans = 1
import sympy as sym
def fibo(n):
    if n < 1:
        return 0
    else:
        x = sym.symbols('x',nonnegative=True,integer=True)
        Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1))
        result=Fib.subs(x,n)
        result=sym.simplify(result) #式の整理
        return result

for i in range(M+1):
    dan = b[i+1]-1 - b[i]
    ans = ans*fibo(dan)%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]
b.extend(a)
b.extend([N+1])
ans = 1
def fibo(t):
    if t < 1:
        return 0
    else:
        fi = (int(1/math.sqrt(5)*(((1+math.sqrt(5))/2)**dan-((1-math.sqrt(5))/2)**dan)+0.0000001))%1000000007
        return fi
for i in range(M+1):
    dan = b[i+1]-1 - b[i]
    ans = ans*fibo(dan)%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]
b.extend(a)
b.extend([N+1])
ans = 1
def fibo(t):
    if t == 0:
        return 0
    else:
        fi = (int(1/math.sqrt(5)*(((1+math.sqrt(5))/2)**dan-((1-math.sqrt(5))/2)**dan)+0.01))%1000000007
        return fi
for i in range(M+1):
    dan = b[i+1]-1 - b[i]
    ans = ans*fibo(dan)%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [-1]
b.extend(a)
b.extend([N+1])
ans = 1
def fibo(t):
    if t == 0:
        return 0
    else:
        fi = int(1/math.sqrt(5)*(((1+math.sqrt(5))/2)**dan-((1-math.sqrt(5))/2)**dan)+0.01)
        return fi
for i in range(M+1):
    dan = b[i+1]-1 - b[i]
    ans = ans*fibo(dan)%1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = [0]
b.extend(a)
b.extend([N+1])
ans = 1
for i in range(M+1):
    dan = b[i+1] - b[i]
    tori = int(1/math.sqrt(5)*(((1+math.sqrt(5))/2)**dan-((1-math.sqrt(5))/2)**dan)+0.01)
    ans *= tori
print(ans)

Buggy submission (verdict: Runtime Error):
def nCk(n, k):
    return bunshi(n,k)/bunbo(k)
def bunshi(n,k):
    p = 1
    for i in range(k):
        p = p*(n-i)
    return p
def bunbo(k):
    p = 1
    for i in range(k):
        p = p*(i+1)
    return p
    

N, M = map(int,input().split())
a=[-1]
for i in range(M):
    a.append(int(input()))
a.append(N+1)
#print(a)
D=[]
for i in range(M+1):
    D.append((a[i+1]-1)-(a[i]+1))
#print(D)

ans=1
for i in range(len(D)):
    temp = 0
    for j in range(D[i]//2+1):
        temp += (nCk(D[i]-j,j)%1000000007)
    ans=(ans%1000000007)*(temp%1000000007)
print(int(ans%1000000007))

Buggy submission (verdict: Runtime Error):
def nCk(n, k):
    return bunbo(n,k)/bunshi(k)
def bunbo(n,k):
    p = 1
    for i in range(k):
        p = p*(n-i)
    return p
def bunshi(k):
    p = 1
    for i in range(k):
        p = p*(i+1)
    return p
    

N, M = map(int,input().split())
a=[-1]
for i in range(M):
    a.append(int(input()))
a.append(N+1)
#print(a)
D=[]
for i in range(M+1):
    D.append((a[i+1]-1)-(a[i]+1))
#print(D)

ans=1
for i in range(len(D)):
    temp = 0
    for j in range(D[i]//2+1):
        temp += nCk(D[i]-j,j)
    ans=(ans%1000000007)*(temp%1000000007)
print(int(ans%1000000007))

Buggy submission (verdict: Runtime Error):
import fractions

N, M = map(int,input().split())
a=[-1]
for i in range(M):
    a.append(int(input()))
a.append(N+1)
#print(a)
D=[]
for i in range(M+1):
    D.append((a[i+1]-1)-(a[i]+1))
#print(D)
def nCk(n, k):
    return fractions.factorial(n)/(fractions.factorial(k)*fractions.factorial(n-k))
ans=1
for i in range(len(D)):
    if i !=len(D) and i!=0 and D[i]==0:
        temp = 0
    else:
        temp = 0
        for j in range(D[i]//2+1):
            temp += nCk(D[i]-j,j)
#    print(temp)
    ans=(ans*temp)%1000000007
print(int(ans%1000000007))