Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import queue
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    q = queue.Queue()
    q.put(1)
    if 1 in A:
        q.put(0)
    else:
        q.put(1)
    for i in range(2,n+1):
        if i in A:
            q.get()
            q.put(0)
        else:
            a = q.get()
            b = q.get()
            q.put(b)
            q.put((a+b)%mod)

    q.get()
    print(q.get())

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    if 1 in A:
        ans = [1,0]
    else:
        ans = [1,1]
    for i in range(2,n+1):
        if i in A:
            ans.append(0)
            ans.pop(0)
        else:
            ans.append((ans[0]+ans[1])%mod)
            ans.pop(0)

    print(ans[1]%mod)

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    @lru_cache(maxsize=1000000)
    def root(n):
        if n==0:
            return 1
        if n==1:
            if 1 in A:
                return 0
            else:
                return 1
        else:
            if n-1 in A and n-2 in A:
                return 0
            elif n-1 in A and n-2 not in A:
                return root(n-2)%mod
            elif n-1 not in A and n-2 in A:
                return root(n-1)%mod
            else:
                return (root(n-1)+root(n-2))%mod
    print(root(n))

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    @lru_cache(maxsize=1000000)
    def root(n):
        if n==0 or n==1:
            return 1
        else:
            if n-1 in A and n-2 in A:
                return 0
            elif n-1 in A and n-2 not in A:
                return root(n-2)%mod
            elif n-1 not in A and n-2 in A:
                return root(n-1)%mod
            else:
                return (root(n-1)+root(n-2))%mod
    print(root(n))

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    def root(n):
        if n==0 or n==1:
            return 1
        else:
            if n-1 in A and n-2 in A:
                return 0
            elif n-1 in A and n-2 not in A:
                return pow(root(n-2),1,mod)
            elif n-1 not in A and n-2 in A:
                return pow(root(n-1),1,mod)
            else:
                return pow(root(n-1)+root(n-2),1,mod)
    print(root(n))

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    @lru_cache(maxsize=100000)
    def root(n):
        if n==0 or n==1:
            return 1
        else:
            if n-1 in A and n-2 in A:
                return 0
            elif n-1 in A and n-2 not in A:
                return pow(root(n-2),1,mod)
            elif n-1 not in A and n-2 in A:
                return pow(root(n-1),1,mod)
            else:
                return pow(root(n-1)+root(n-2),1,mod)
    print(root(n))

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    A = []
    for _ in range(m):
        a = int(input())
        A.append(a)
    mod = 10**9+7
    @lru_cache(maxsize=1000)
    def root(n):
        if n==0 or n==1:
            return 1
        else:
            if n-1 in A and n-2 in A:
                return 0
            elif n-1 in A and n-2 not in A:
                return pow(root(n-2),1,mod)
            elif n-1 not in A and n-2 in A:
                return pow(root(n-1),1,mod)
            else:
                return pow(root(n-1)+root(n-2),1,mod)
    print(root(n))

if __name__ == "__main__":
    main()

Fixed submission:
from functools import lru_cache

def main():
    n,m = map(int,input().split())
    import numpy as np
    ans = np.ones(n+1,dtype=int)*-1
    ans[0] = 1
    mod = 10**9+7
    for _ in range(m):
        a = int(input())
        ans[a]=0
    if ans[1]!=0:
        ans[1]=1
    for i in range(2,n+1):
        if ans[i]!=0:
            ans[i] = (ans[i-1]+ans[i-2])%mod
    print(ans[-1])
        

if __name__ == "__main__":
    main()