qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n, m = map(int, input().split())
# A = set()
# for i in range(m):
#     a = int(input())
#     A.add(a)
a = set()
for i in range(m):
    a.append(int(input()))
    A = a
dp = [0] * (n + 1)
for i in range(n + 1):
    if i in A:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

Fixed code:
n, m = map(int, input().split())

a = set()
for i in range(m):
    a_tmp = int(input())
    a.add(a_tmp)

# a = [int(input()) for i in range(m)]

dp = [0] * (n + 1)
for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])
Buggy code:
n, m = map(int, input().split())
a = []
for i in range(m):
    a.appen(int(input()))

dp = [0] * (n + 1)

for i in range(n + 1):
    if i in a:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007

print(int(dp[n]))

"""
100 5
1
23
45
67
89
"""


Fixed code:
n, m = map(int, input().split())
A = set()
for i in range(m):
    a = int(input())
    A.add(a)
dp = [0] * (n + 1)
for i in range(n + 1):
    if i in A:
        dp[i] = 0
    else:
        if i == 0:
            dp[i] = 1
        elif i == 1:
            dp[i] = 1
        else:
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007
print(dp[n])

"""
100 5
1
23
45
67
89
"""
Buggy code:
import sys
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10 * 9 + 7
dp = [0] * (N + 1)
dp[0] = 1
for i in range(1, N+1):
    if i not in A:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N])

Fixed code:
import sys
sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())
A = set(int(input()) for _ in range(M))

MOD = 10 ** 9 + 7
dp = [0] * (N + 1)
dp[0] = 1
for i in range(1, N+1):
    if i not in A:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[N])
Buggy code:
n,m=map(int,input().split())
a = [int(input()) for _ in range(m)]
mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    if i in a:
        dp[i]=0
        a.pop(0)
    else:
        dp[i]=(dp[i-2]+dp[i-1])%mod
print(dp)


Fixed code:
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp=[0]*(n+1)
dp[0]=1
dp[1]=0 if 1 in a else 1
for i in range(2,n+1):
  dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
  if i in a: dp[i]=0

print(dp[n])
Buggy code:
n,m=map(int,input().split())
a=[]
for i in range(m):
	a.append(int(input()))



num=[1,1,2]


mod=1000000007

list=[]
count=0
jud=1
ans=1
for i in range(n+1):
	
	if i>2:
		num.append(1)
		num[i]=(num[i-1]+num[i-2])%mod

	if(jud==0 and i in a):
		print("0")
		
		break
	elif i in a:

		#list.append(count-1)
		ans*=num[count-1]%mod
		count=1
		jud=0
	elif(i==n):
		
		ans*=num[count-1]%mod
		#list.append(count-1)
		print(ans%mod)
	else:
		jud=1
		count+=1


Fixed code:
n,m=map(int,input().split())
a=[0]*(n+1)
for i in range(m):
	a[int(input())]=1


num=[1,1,2]


mod=1000000007

count=0
jud=1
ans=1
for i in range(n+1):
	
	if i>2:
		num.append(1)
		num[i]=(num[i-1]+num[i-2])%mod

	if(jud==0 and a[i]==1):
		print("0")
		break
	elif a[i]==1:
		ans=(ans%mod)*(num[count-1]%mod)
		count=0
		jud=0
	elif(i==n):
		count+=1
		ans=(ans%mod)*(num[count-1]%mod)
		print(ans%mod)
	else:
		jud=1
		count+=1
Buggy code:
N,M=map(int,input().split())
if N==1:
  print(N)
  exit()
dp=[-1]*N
dp[-1]=1
dp+=[1]
mod=10**9+7
for i in range(M):
  a=int(input())
  dp[a]=0
i=N-2
while i>=0:
  if dp[i]==-1:
    dp[i]=dp[i+1]+dp[i+2]
  i-=1
print(dp[0])

Fixed code:
N,M=map(int,input().split())
dp=[-1]*N
dp[-1]=1
dp+=[1]
mod=10**9+7
for i in range(M):
  a=int(input())
  dp[a]=0
i=N-2
while i>=0:
  if dp[i]==-1:
    dp[i]=(dp[i+1]+dp[i+2])%mod
  i-=1
print(dp[0])
Buggy code:
N,M=map(int,input().split())
broken=[0]*N
for _ in range(M):
  a=int(input())
  broken[a]=1
dp=[0]*(N+2)
dp[N]=1
for i in range(N-1,-1,-1):
  if broken[i]==1:
    dp[i]=0
  else:
    dp[i]=dp[i+1]+dp[i+2]
print(dp[0])

Fixed code:
N,M=map(int,input().split())
broken=[0]*N
for _ in range(M):
  a=int(input())
  broken[a]=1
dp=[0]*(N+2)
dp[N]=1
for i in range(N-1,-1,-1):
  if broken[i]==1:
    dp[i]=0
  else:
    dp[i]=(dp[i+1]+dp[i+2])%1000000007
print(dp[0])
Buggy code:
n,m=map(int,input().split())
A=set(int(input()) for i in range(m))
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in A:dp[i]=0
print(dp)

Fixed code:
n,m=map(int,input().split())
A=set(int(input()) for i in range(m))
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in A:dp[i]=0
print(dp[n])
Buggy code:
c_mod=1000000007
n,m = map(int,input().split())

step=[0]*n
for _ in range(m):
    a=int(input())
    step[a-1]=-1

if step[0]!=-1:
    step[0]=1
if step[1]!=-1:
    step[1]=1
for i in range(2,n):
    if step[i]==-1:
        continue
    if step[i-1]!=-1:
        step[i]+=step[i-1]
    if step[i-2]!=-1:
        step[i]+=step[i-2]
print(step[n-1]%c_mod)


Fixed code:
c_mod=1000000007
n,m = map(int,input().split())

step=[0]*(n+1)
for _ in range(m):
    a=int(input())
    step[a-1]=-1

if step[0]!=-1:
    step[0]=1
if step[1]!=-1:
    step[1]=1
for i in range(n-1):
    if step[i]==-1:
        continue
    if step[i+1]!=-1:
        step[i+1]+=step[i]
    if step[i+2]!=-1:
        step[i+2]+=step[i]
print(step[n-1]%c_mod)
Buggy code:
n,m = list(map(int, input("").split()))
a=set([int(input()) for i in range(m)])

print(a)

mod = 10 ** 9 + 7

dp = [0] * (n+2)
dp[1] = 1

for i in range(2,n+2):
    if i-1 not in a:
        dp[i] = dp[i-1] % mod + dp[i-2] % mod
        
print(dp[n+1] % mod)

Fixed code:
n,m = list(map(int, input("").split()))
a=set([int(input()) for i in range(m)])

mod = 10 ** 9 + 7

dp = [0] * (n+2)
dp[1] = 1

for i in range(2,n+2):
    if i-1 not in a:
        dp[i] = dp[i-1] % mod + dp[i-2] % mod
        
print(dp[n+1] % mod)
Buggy code:
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
mod = int(1e9 + 7)
notbroken = [True for _ in range(n+1)]

for i in a:
  notbroken[i] = False

dp = [0 for _ in range(n+1)]
dp[0] = 1
dp[1] = 1
for i in range(2, n+1):
    if not i in a:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= mod

print(dp[n])

Fixed code:
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
mod = int(1e9 + 7)
notbroken = [True for _ in range(n+1)]

for i in a:
  notbroken[i] = False

dp = [0 for _ in range(n+1)]
dp[0] = 1
if notbroken[1]: dp[1] = 1

for i in range(2, n+1):
    if notbroken[i]:
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= mod

print(dp[n])
Buggy code:
n,m = map(int, input().split())
a = [int(input()) for _ in range(m)]

dp = [1,1]
temp = 1
for i in range(2,n+1):
  temp = dp[i-1] + dp[i-2]
  if i in a:
    temp = 0
  dp.append(temp)

print(dp[-1]%1000000007)

Fixed code:
n,m = map(int, input().split())
a = set([int(input()) for _ in range(m)])

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

print(dp[n]%1000000007)
Buggy code:
Num = 1000000007 
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
now = 0
if 1 in a:
    prev1 = 0
else:
    prev1 = 1
prev2 = 1

for i in range(2,N+1):
    if i in a:
        now = 0
        prev2 = prev1
        prev1 = now 
        continue
    else:
        now = prev1 +prev2
        prev2 = prev1
        prev1 = now
    print(prev1,prev2)

print(now%Num)

Fixed code:
Num = 1000000007 
N,M = map(int,input().split())
a = set([int(input()) for i in range(M)])

now = 0
if 1 in a:
    prev1 = 0
else:
    now = 1
    prev1 = 1
prev2 = 1

for i in range(2,N+1):
    if i in a:
        now = 0
        prev2 = prev1
        prev1 = now 
    else:
        now = prev1 +prev2
        prev2 = prev1
        prev1 = now

print(now%Num)
Buggy code:
n,m = map(int,input().split())
o = [int(input()) for _ in range(m)]
print(o)
mod = (10**9)+7
dp = [1]+[0]*(n)

for i in range(1,n+1):
  dp[i] = dp[i-1]+dp[i-2]
  if i in o:
    dp[i] = 0
  #print(i,dp)
#print(dp)
print(dp[-1]%mod)


Fixed code:
n,m = map(int,input().split())
o = set(int(input()) for _ in range(m))
#print(o)
mod = (10**9)+7
dp = [0]*(n+1)
dp[0] = 1

for i in range(1,n+1):
  dp[i] = (dp[i-1]+dp[i-2])%mod
  if i in o:
    dp[i] = 0
  #print(i,dp)
#print(dp)
print(dp[-1])
Buggy code:
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
print(a)
dp = [0] * (n+1)
dp[0] = 1
for i in range(1,n+1):
  dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
  if i in a:dp[i]=0
print(dp[n])

Fixed code:
n,m = map(int,input().split())
a = set([int(input()) for _ in range(m)])
dp = [0] * (n+1)
dp[0] = 1
for i in range(1,n+1):
  dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
  if i in a:dp[i]=0
print(dp[n])
Buggy code:
n,m=[int(i) for i in input().split()]
badone=[int(input()) for i in range(m)]
badstares=[1 for i in range(n)]
for i in badone:
    badstares[i-1]=0


stares=[-1 for i in range(n)]
for i in range(n):
    
    i=n-1-i
    if i==n-1:
        stares[i]=1
    elif i==n-2:
        if badstares[i]==0:
            stares[i]=-1
        else:
            stares[i]=1
    else:
        if badstares[i]==0:
            stares[i]=-1
        else:
            if stares[i+1]==-1:
                if stares[i+2]==-1:
                    stares[i]=-1
                else:
                    stares[i]=stares[i+2]
            elif stares[i+2]==-1:
                stares[i]=stares[i+1]
            else:
                stares[i]=stares[i+1]+stares[i+2]
    
print(max(stares[0]+stares[1],0)%1000000007)


Fixed code:
n,m=[int(i) for i in input().split()]
badone=[int(input()) for i in range(m)]
badstares=[1 for i in range(n)]
for i in badone:
    badstares[i-1]=0


stares=[-1 for i in range(n)]
if n==1:
    print(1)
else:
    for i in range(n):

        i=n-1-i
        if i==n-1:
            stares[i]=1
        elif i==n-2:
            if badstares[i]==0:
                stares[i]=-1
            else:
                stares[i]=1
        else:
            if badstares[i]==0:
                stares[i]=-1
            else:
                if stares[i+1]==-1 and stares[i+2]==-1:
                        stares[i]=-1
                elif stares[i+1]==-1 and stares[i+2]!=-1:
                        stares[i]=stares[i+2]
                elif stares[i+2]==-1:
                    stares[i]=stares[i+1]
                else:
                    stares[i]=stares[i+1]+stares[i+2]

    if stares[0]==-1 and stares[1]==-1:
        print(0)
    elif stares[0]==-1:
        print(stares[1]%1000000007)
    elif stares[1]==-1:
        print(stares[0]%1000000007)
    else:
        print((stares[0]+stares[1])%1000000007)
Buggy code:
N,M=map(int,input().split())
dp=[0]*(N+3)
dp[0]=1
a=[0]*(N+3)
for i in range(M):
    a[int(input())]=1
mod=10**9+7

for i in range(N+1):
    if a[i+1] != 1:
        dp[i+1]+=dp[i]
        dp[i+1]%=mod
    if a[i+2] != 1:
        dp[i+2]+=dp[i]
        dp[i+2]%=mod
    print(i,dp[i])
    
print(dp[N])

Fixed code:
N,M=map(int,input().split())
dp=[0]*(N+3)
dp[0]=1
a=[0]*(N+3)
for i in range(M):
    a[int(input())]=1
mod=10**9+7

for i in range(N+1):
    if a[i+1] != 1:
        dp[i+1]+=dp[i]
        dp[i+1]%=mod
    if a[i+2] != 1:
        dp[i+2]+=dp[i]
        dp[i+2]%=mod

print(dp[N])
Buggy code:
n, m = map(int, input().split())
a = [0] * m
dp = [1, 1]

for i in range(m):
    a[i] = int(input())

for i in range(1, n+1):
    if i not in a:
        dp.append((dp[-1] + dp[-2]) % 1000000007)
    else:
        dp.append(0)
# print(dp)
print(dp[-1])


Fixed code:
n,m = map(int,input().split())
a = []

for i in range(m):
    a.append(int(input()))
    
a = set(a)

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])
Buggy code:
n, m = map(int, input().split())
broken = [0]*(n+1)
for i in range(m):
    a = int(input())
    broken[a] = 1
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1
mod = 1000000007
for i in range(2, n+1):
    if broken[i]:
        continue
    dp[i] = (dp[i-1] + dp[i-2]) % mod
print(dp[n])


Fixed code:
n, m = map(int, input().split())
broken = [0]*(n+1)
for i in range(m):
    a = int(input())
    broken[a] = 1
dp = [0]*(n+1)
dp[0] = 1
mod = 1000000007
for i in range(1, n+1):
    if broken[i]:
        continue
    dp[i] = (dp[i-1] + dp[i-2]) % mod
print(dp[n])
Buggy code:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+1)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2]: %= MOD
       
print(DP[N]%MOD)
      
  




Fixed code:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+10)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2] %= MOD
       
print(DP[N]%MOD)
Buggy code:
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  a=[int(input()) for _ in [0]*m]
  mod=pow(10,9)+7
  ans=[0]*n
  ans[0]=1
  for i in range(n):
    if a.count(i+1)==1:
      ans[i]=0
    else:
      if i==1:
        ans[i]=ans[0]+1
      else:
        ans[i]=(ans[i-1]%mod+ans[i-2]%mod)%mod
  print(ans[-1])
if __name__ == '__main__':
    main()

Fixed code:
def main():
  import sys
  input = sys.stdin.readline
  n,m=map(int,input().split())
  mod=pow(10,9)+7
  ans=[1]*(n+1)
  for _ in [0]*m:
    ans[int(input())]=0
  for i in range(n+1):
    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod
  print(ans[-1])
if __name__ == '__main__':
    main()
Buggy code:
n, m = map(int, input().split())
w = [1 for _ in range(n)]
for _ in range(m):
    w[int(input())] = 0
for i in range(2, n):
    if w[i] != 0:
        w[i] = w[i-2] + w[i-1]
print(w[-1] % 1000000007)

Fixed code:
n, m = map(int, input().split())
w = [1 for _ in range(n+1)]
for _ in range(m):
    w[int(input())] = 0
for i in range(2, n+1):
    if w[i] != 0:
        w[i] = w[i-2] + w[i-1]
#print(w)
print(w[-1] % 1000000007)
Buggy code:
import sys
input = sys.stdin.readline

MOD = 1000000007


def main():
    n, m = [int(i) for i in input().split()]
    a = [int(input()) for _ in range(m)]
    steps = [0] * (n + 1)
    steps[0] = 1

    for now in range(n):
        for next_ in range(now + 1, min(now + 2, n) + 1):
            if next_ not in a:
                steps[next_] += steps[now] % MOD
    print(steps[-1])


if __name__ == '__main__':
    main()


Fixed code:
import sys
input = sys.stdin.readline

MOD = 1000000007


def main():
    n, m = [int(i) for i in input().split()]
    a = {int(input()) for _ in range(m)}
    steps = [0] * (n + 1)
    steps[0] = 1

    for now in range(n):
        for next_ in range(now + 1, min(now + 2, n) + 1):
            if next_ not in a:
                steps[next_] += steps[now] % MOD
                steps[next_] %= MOD
    print(steps[-1])


if __name__ == '__main__':
    main()
Buggy code:
n, m  = map(int, input().split())

if n == 1:
  print(1)
  exit()

f = [0 for i in range(n+1)]
f[-2:] = [1, 1]
for i in range(m):
  f[int(input())-1] = -1

div_num = 1000000007

for i in range(n-1)[::-1]:
  if f[i] == -1:
    continue
  if f[i+1] == -1 and f[i+2] == -1:
    print(0)
    exit()
  elif f[i+1] == -1 and f[i+2] != -1:
    f[i] = f[i+2]
  elif f[i+1] != -1 and f[i+2] == -1:
    f[i] = f[i+1]
  else:
    f[i] = f[i+1]+f[i+2]

print(int(f[0]%div_num))

Fixed code:
n, m  = map(int, input().split())

if n == 1:
  print(1)
  exit()

f = [0 for i in range(n)]
f[-2:] = [1, 1]
for i in range(m):
  f[int(input())-1] = -1

div_num = 1000000007

for i in range(n-2)[::-1]:
  if f[i] == -1:
    continue
  if f[i+1] == -1 and f[i+2] == -1:
    print(0)
    exit()
  elif f[i+1] == -1 and f[i+2] != -1:
    f[i] = f[i+2]
  elif f[i+1] != -1 and f[i+2] == -1:
    f[i] = f[i+1]
  else:
    f[i] = f[i+1]+f[i+2]

if f[0] != -1 and f[1] != -1:
  print(int((f[0]+f[1])%div_num))
elif f[0] == -1 and f[1] != -1:
  print(int(f[1]%div_num))
elif f[0] != -1 and f[1] == -1:
  print(int(f[0]%div_num))
else:
  print(0)
Buggy code:
n,m = map(int, input().split())
bk = []
for i in range(m):
    bk.append(int(input()))

p = [0]*(n+1)
for i in bk:
    p[i] = -100
if n == 1 and m == 0:
    print(1)
elif n == 1 and m == 1:
    print(0)
else:
    p[0] = 1
    if 1 in bk:
        p[1] = 0
    else:
        p[1] = 1
    for i in range(n-2):
        if p[i+2] < 0:
            p[i+2] = 0
        else:
            p[i+2] = p[i]+p[i+1]
            if p[i+2] >= 1000000007:
                p[i+2] -= 1000000007

    print(p[n])


Fixed code:
n,m = map(int, input().split())
bk = []
for i in range(m):
    bk.append(int(input()))

p = [0]*(n+1)
for i in bk:
    p[i] = -100
if n == 1 and m == 0:
    print(1)
elif n == 1 and m == 1:
    print(0)
else:
    p[0] = 1
    if 1 in bk:
        p[1] = 0
    else:
        p[1] = 1
    for i in range(n-1):
        if p[i+2] < 0:
            p[i+2] = 0
        else:
            p[i+2] = p[i]+p[i+1]
            if p[i+2] >= 1000000007:
                p[i+2] -= 1000000007

    print(p[n])
Buggy code:
n,m=map(int,input().split())
a=set([int(input()) for j in range(m)])
dp=[0]*(n+1)
dp[0]=1
if not a[0]==1:
    dp[1]=1
else:
    dp[1]=0
for i in range(n-1):
    if i+2 in a:
        dp[i+2]=0
    else:
        dp[i+2]=(dp[i+1]+dp[i])%(10**9+7)
print(dp[n])

Fixed code:
n,m=map(int,input().split())
a=set([int(input()) for j in range(m)])
dp=[0]*(n+1)
dp[0]=1
if not 1 in a:
    dp[1]=1
else:
    dp[1]=0
for i in range(n-1):
    if i+2 in a:
        dp[i+2]=0
    else:
        dp[i+2]=(dp[i+1]+dp[i])%(10**9+7)
print(dp[n])
Buggy code:
N, M = map(int, input().split())

if M == 0:
    alist = set()
else:
    alist = set(map(int, input()) for _ in range(M))

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 1 if 1 not in alist else 0

MOD = 10**9 + 7
for i in range(2, N + 1):
    if i in alist:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])


Fixed code:
N, M = map(int, input().split())

if M == 0:
    alist = set()
else:
    alist = set(int(input()) for _ in range(M))

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 1 if 1 not in alist else 0

MOD = 10**9 + 7
for i in range(2, N + 1):
    if i in alist:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])
Buggy code:
n,m = map(int,input().split())
a = list(int(input())for i in range(M))
mod = 10**9+7
b = [0] * (n-1)
b[0] = 1
b[1] = 1
for i in a:
    b[i] = -1

for i in range(2,n+1):
    if b[i] == -1:
        continue
    if b[i-1] != -1:
        b[i] += b[i-1]
    if b[i-2] != -1:
        b[i] += b[i-2]

print(b[-1]%mod)

Fixed code:
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
b=[0]*(n+1)
b[0]=1
b[1]=1

for i in a:
    b[i]=-1

for i in range(2,n+1):
    if b[i]==-1:
        continue
    if b[i-1]!=-1:
        b[i]+=b[i-1]
    if b[i-2]!=-1:
        b[i]+=b[i-2]
        
print(b[-1]%mod)
Buggy code:
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[N-1] % (10**9 + 7))

Fixed code:
NM = [int(i) for i in input().split()]
a = [0] * NM[0]
for _ in range(NM[1]):
    a[int(input()) - 1] = -1

for i in range(NM[0]):
    if (i == 0):
        if(a[i] != -1):
            a[i] = 1
        else:
            a[i] = 0
    elif(i == 1):
        if(a[i] != -1):
            a[i] = a[i - 1] + 1
        else:
            a[i] = 0
    else:
        if(a[i] != -1):
            a[i] = a[i-1] + a[i - 2]
        else:
            a[i] = 0

print(a[NM[0]-1] % (10**9 + 7))
Buggy code:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10**9 + 7

safe = [True] * (N+1)
for i in range(len(A)):
    safe[A[i]] = False

print(safe)

dp = [0] * (N+1)
dp[0] = 1
if safe[1]:
    dp[1] = 1

for i in range(2, N+1):
    if(safe[i]):
        dp[i] = dp[i-1] + dp[(i-2)]
        dp[i] = dp[i] % MOD
    else:
        dp[i] = 0

print(dp)

Fixed code:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10**9 + 7

safe = [True] * (N+1)
for i in range(len(A)):
    safe[A[i]] = False

dp = [0] * (N+1)
dp[0] = 1
if safe[1]:
    dp[1] = 1

for i in range(2, N+1):
    if(safe[i]):
        dp[i] = dp[i-1] + dp[(i-2)]
        dp[i] = dp[i] % MOD
    else:
        dp[i] = 0

print(dp[N])
Buggy code:
MOD = 10 ** 9 + 7
N, M = map(int, input().split())
a = []
for i in range(M):
  a.append(int(input()))
broken = [False for _ in range(N+1)]

dp = [0 for _ in range(N + 1)]
dp[0] = 1
for _ in range(M):
	broken[int(input())] = True
for i in range(1, N+1):
	if broken[i]:
		continue
	if i == 1:
		dp[i] = dp[i-1]
	else:
		dp[i] = dp[i-1] + dp[i-2]
		dp[i] %= MOD
print(dp[N])


Fixed code:
MOD = 10 ** 9 + 7

N, M = map(int, input().split())

broken = [False for _ in range(N+1)]
for _ in range(M):
	broken[int(input())] = True

dp = [0 for _ in range(N + 1)]
dp[0] = 1
if(broken[1] == False):
  dp[1] = 1

for i in range(2, N+1):
	if broken[i]:
		continue
	else:
		dp[i] = dp[i-1] + dp[i-2]
		dp[i] %= MOD
print(dp[N])
Buggy code:
N, M = list(map(int,input().split()))

MOD = 1000000007

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]
        b[i] %= MOD

print(b[N])

Fixed code:
N, M = list(map(int,input().split()))

MOD = 1000000007

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]
        b[i] %= MOD

print(b[N]%MOD)
Buggy code:
N, M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]

b = [0]*N

if 1 not in a:
    b[0] = 1

if 2 not in a:
    if b[0] == 1:
        b[1] = 2
    else:
        b[1] = 1

for i in range(2,N):
    if i+1 not in a:
        if b[i-2] != 0:
            b[i]+= b[i-2]
        if b[i-1] != 0:
            b[i]+= b[i-1]
print(b)
print(b[N-1]%1000000007)

Fixed code:
N, M = list(map(int,input().split()))

b = [0]*(N+2)
b[0] = 1

for i in range(M):
    b[int(input())] = -1

for i in range(N):
    if b[i] != -1:
        if b[i+1] != -1:
            b[i+1] += b[i]
        if b[i+2] != -1:
            b[i+2] += b[i]

print(b[N]%1000000007)
Buggy code:
n , m = map(int, input().split())
lis = [int(input()) for _ in range(m)]
mod = 10**9+7

ans =[1] + [1] + [-1] * (n-1)

for i in range(2, n+1):
    if ans[i] != 0:
        ans[i] = (ans[i-1] + ans[i-2]) % mod
    if i in lis:
        ans[i] = 0

print(ans[n])

Fixed code:
n , m = map(int, input().split())
lis = [int(input()) for _ in range(m)]
mod = 10**9+7

ans =[1] + [1] + [-1] * (n-1)

for i in lis:
    ans[i] = 0


for i in range(2, n+1):
    if ans[i] != 0:
        ans[i] = (ans[i-1] + ans[i-2]) % mod

print(ans[n])