Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02891 (python)

Fixed submission:
S = input()
K = int(input())
brob = 0
temp = 1
first = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        temp += 1
    else:
        if first == 0:
            first = temp
        brob += temp // 2
        temp = 1
        
brob += temp // 2
last = temp

if K == 1:
    print(brob)

else:
    if last == len(S):
        print(len(S) * K // 2)
    
    elif S[-1] != S[0]:
        print(brob * K)
    

    elif last % 2 and first % 2:
        print(brob * K + K - 1)

    else:
        print(brob * K)

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
brob = 0
temp = 1
first = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        temp += 1
    else:
        if first == 0:
            first = temp
        brob += temp // 2
        temp = 1S = input()
K = int(input())
brob = 0
temp = 1
first = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        temp += 1
    else:
        if first == 0:
            first = temp
        brob += temp // 2
        temp = 1
        
brob += temp // 2
last = temp

if K == 1:
    print(brob)

else:
    if last == len(S):
        print(len(S) * K // 2)
    
    elif S[-1] != S[0]:
        print(brob * K)
    

    elif last % 2 and first % 2:
        print(brob * K + K - 1)

    else:
        print(brob * K)

        
brob += temp // 2
last = temp

if K == 1:
    print(brob)

else:
    if len(S) == 1:
        print(K // 2)
    
    elif S[-1] != S[0]:
        print(brob * K)

    elif last % 2 and first % 2:
        print(brob * K + K - 1)

    else:
        print(brob * K)
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce

N, K = map(int, input().split())
MOD = 10 ** 9 + 7


def comb(N, R):
    R = min(N-R, R)
    if R == 0: return 1
    over = reduce(mul, range(N, N - R, -1))
    under = reduce(mul, range(1,R + 1))
    return over // under % MOD


def f2(N, K):
    return comb(N+K-1, K-1)

def f(N, K):
    if (N < K): return 0
    if N == 0 and K == 0: return 1
    if (K < 1): return 0
    return f2(N-K, K)


for i in range(1,K+1):
    blue = f(K, i)
    red = 0
    red += f(N-K, i-1)
    red += f(N-K, i) * 2 % MOD
    red += f(N-K, i+1) % MOD
    
    print(red * blue % MOD)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
N, K = map(int, input().split())
MOD = 10 ** 9 + 7

def f2(N, K):
    return comb(N+K-1, K-1, exact=True) % MOD

def f(N, K):
    if (N < K): return 0
    if N == 0 and K == 0: return 1
    if (K < 1): return 0
    return f2(N-K, K)


for i in range(1,K+1):
    blue = f(K, i)
    red = 0
    red += f(N-K, i-1)
    red += f(N-K, i) * 2 % MOD
    red += f(N-K, i+1) % MOD
    
    print(red * blue % MOD)
Problem p03012 (python)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
Left = 0
Right = sum(W)
ans = Right

for val in W:
    Left += val
    Right -= val
    ans = min(ans, abs(Right - Left))
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split())))
Left = 0
Right = sum(W)
ans = Right

for val in W:
    Left += val
    Right -= val
    ans = min(ans, abs(Right - Left))
print(ans)
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = []
for _ in range(M):
    BC.append(tuple(map(int, input().split())))
BC = sorted(BC, reverse=True, key=lambda x:x[1])

first_idx = 0
last_idx = 0
for num, val in BC:
    if last_idx >= N:
        break

    if A[last_idx] >= val:
        break
    

    for _ in range(num):
        if A[last_idx] < val:
            last_idx += 1
        else:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            first_idx = last_idx
            break

        if last_idx >= N:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            break
    else:
        A[first_idx:last_idx] = [val] * (last_idx - first_idx)
        first_idx = last_idx

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = []
for _ in range(M):
    BC.append(tuple(map(int, input().split())))
BC = sorted(BC, reverse=True, key=lambda x:x[1])

first_idx = 0
last_idx = 0
for num, val in BC:
    if A[last_idx] >= val:
        break
    
    for _ in range(num):
        if last_idx >= N:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            break

        if A[last_idx] < val:
            last_idx += 1
        else:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            first_idx = last_idx
            break

        
    else:
        A[first_idx:last_idx] = [val] * (last_idx - first_idx)
        first_idx = last_idx

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = []
for _ in range(M):
    BC.append(tuple(map(int, input().split())))
BC = sorted(BC, reverse=True, key=lambda x:x[1])

first_idx = 0
last_idx = 0
for num, val in BC:
    if A[last_idx] >= val:
        break
    if last_idx >= N:
        break

    for _ in range(num):
        if A[last_idx] < val:
            last_idx += 1
        else:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            first_idx = last_idx
            break

        if last_idx >= N:
            A[first_idx:last_idx] = [val] * (last_idx - first_idx)
            break
    else:
        A[first_idx:last_idx] = [val] * (last_idx - first_idx)
        first_idx = last_idx

print(sum(A))
Problem p03107 (python)

Fixed submission:
from collections import deque
import copy
S = deque(input())
S2 = deque([])
counter = 0
while True:
    flag = True
    while True:
        if len(S) == 0:
            break
        s = S.popleft()
        if len(S2) == 0:
            S2.append(s)
            flag = False
            continue
        
        elif s!=S2[-1]:
            S2.pop()
            flag = False
            counter +=2
        else:
            S2.append(s)
    
    if flag:
        break
    else:
        S = copy.deepcopy(S2)
print(counter)

Buggy submission (verdict: Runtime Error):
from collections import Counter
print(Counter(input()).most_common()[1][1]*2)
Problem p03108 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

class UnionFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.rank = [1] * N

    def root(self, x):
        px = self.par[x]
        if px == x:
            return x
        else:
            self.par[x] = self.root(px)
            return self.par[x]

    def unite(self, x, y):
        rootx = self.root(x)
        rooty = self.root(y)
        rankx = self.rank[rootx]
        ranky = self.rank[rooty]
        if rootx == rooty:
            return 0
        elif rankx < ranky:
            self.par[rooty] = rootx
            self.rank[rootx] += ranky
            return rankx * ranky
        else:
            self.par[rootx] = rooty
            self.rank[rooty] += rankx
            return ranky * rankx 
    
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

N, M = map(int, input().split())
tree = UnionFind(N)
li = [list(map(int, input().split())) for i in range(M)]
inconv = [0] * M
for i in range(M-1, -1, -1):
    inconv[i] = tree.unite(li[i][0]-1, li[i][1]-1)
    
temp = 0
for i in range(M):
    temp += inconv[i]
    print(temp)

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, N):
        self.par = [i for i in range(N)]
        self.rank = [1] * N

    def root(self, x):
        px = self.par[x]
        if px == x:
            return x
        else:
            self.par[x] = self.root(px)
            return self.par[x]

    def unite(self, x, y):
        rootx = self.root(x)
        rooty = self.root(y)
        rankx = self.rank[rootx]
        ranky = self.rank[rooty]
        if rootx == rooty:
            return 0
        elif rankx < ranky:
            self.par[rooty] = rootx
            self.rank[rootx] += ranky
            return rankx * ranky
        else:
            self.par[rootx] = rooty
            self.rank[rooty] += rankx
            return ranky * rankx 
    
    def same(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        return rx == ry

N, M = map(int, input().split())
tree = UnionFind(N)
li = [list(map(int, input().split())) for i in range(M)]
inconv = [0] * M
for i in range(M-1, -1, -1):
    inconv[i] = tree.unite(li[i][0]-1, li[i][1]-1)
    
temp = 0
for i in range(M):
    temp += inconv[i]
    print(temp)
Problem p03127 (python)

Fixed submission:
"""
import math
N = int(input())
A = list(map(int, input().split()))
g = math.gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = math.gcd(g, a)
print(g)
"""
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(input())
A = list(map(int, input().split()))
g = gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = gcd(g, a)
print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
g = math.gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = math.gcd(g, a)
print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
g = math.gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = math.gcd(g, a)
print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
g = math.gcd(A[0], A[1])
for a in A:
    if g == 1:
        break
    g = math.gcd(g, a)
print(g)
Problem p03209 (python)

Fixed submission:
def main():

    burgur = [0] * 51
    burgur[0] = 1
    pate = [0] * 51
    pate[0] = 1
    for i in range(50):
        burgur[i+1] = burgur[i] * 2 + 3
        pate[i+1] = pate[i] * 2 + 1
    
    N, X = map(int, input().split())

    X -= 1
    ans = 0
    for i in reversed(range(1, N+1)):
        if X == burgur[i] - 1:
            ans += pate[i]
            break
        elif X >= burgur[i-1] + 1:
            ans += pate[i-1] + 1
            X -= (burgur[i-1] + 2)
        else: 
            X -= 1
    if X == 0:
        ans += 1
    print(ans)
    

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
buf = sys.stdin.buffer

def main():
    N = int(buf.readline())
    A = np.frombuffer(buf.read(), dtype="int64")
    A = np.mod(A, 2)
    print("first") if np.count_nonzero(A) else print("second")
if __name__ == "__main__":
    main()
Problem p03805 (python)

Fixed submission:
import itertools

N, M = map(int, input().split())
E = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)

count = 0
for V in itertools.permutations(range(1, N)):
    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int, input().split())
E = [[] for i in range(N)]
for i in range(N):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)

count = 0
for V in itertools.permutations(range(1, N)):
    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int, input().split())
E = [[N] * (N + 1) for i in range(N + 1)]
for i in range(N):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)

count = 0
for V in itertools.permutations(range(1, N)):
    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int, input().split())
E = [[-1] * N for i in range(N)]
for i in range(N):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)

count = 0
#V = (1,2,3,4,5,6), (1,2,3,4,6,5) ... 
for V in itertools.permutations(range(1, N)):
    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int, input().split())
E = [[0] * N for i in range(N)]
for i in range(N):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)

count = 0
for V in itertools.permutations(range(1, N)):
    if V[0] in E[0] and all(V[i] in E[V[i-1]] for i in range(1, N-1)):
        count += 1
print(count)
Problem p02596 (python)

Fixed submission:
k = int(input())

ans = -1
memo = 7 % k
a = 7 % k
for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*a+7) % k
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())

ans = -1
memo = 7 % k

for i in range(k):
    if a == 0:
        ans = i+1
        break
    a = (10*k+7) % k
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())

ans = -1
memo = 7 % k

for i in range(k):
    if a == 0:
        ans = a+1
        break
    a = (10*k+7) % k
print(ans)
Problem p02873 (python)

Fixed submission:
#0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<1
import math
s = input()
bigger=0
smaller=0
count = 0
bigger=1 if s[0]=="<" else 0 
smaller=1 if s[0]==">" else 0 


for i in range(len(s)-1):
    if (s[i]==">" and s[i+1]=="<"):
        count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
        count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0
        bigger = 1
        smaller = 0
    elif (s[i]=="<" and s[i+1]=="<"):
        bigger += 1
    elif (s[i]=="<" and s[i+1]==">"):
        smaller += 1
    elif (s[i]==">" and s[i+1]==">"):
        smaller += 1
count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
count += (min(bigger,smaller)-1)*(min(bigger,smaller))/2 if (min(bigger,smaller)-1)!=0 else 0

print(int(count))

Buggy submission (verdict: Runtime Error):
#0<3>2>1>0<1<2>0<1<2<3<4<5>2>1>0<1
import math
s = input()
bigger=0
smaller=0
count = 0
for i in range(len(s)-1):
    if (s[i]==">" and s[i+1]=="<"):
        count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
        count += (min(bigger,smaller)-1)*((min(bigger,smaller)-1)+1)/2 if (min(bigger,smaller)-1)!=0 else 0
        bigger = 0
        smaller = 0
    elif (s[i]=="<" and s[i+1]=="<"):
        bigger += 1
    elif (s[i]=="<" and s[i+1]==">"):
        bigger += 1
        smaller += 1
    elif (s[i]==">" and s[i+1]==">"):
        smaller += 1
count += (max(bigger,smaller))*((max(bigger,smaller))+1)/2
count += math.factorial(min(bigger,smaller)-1) if smaller!=0 else True

print(int(count))
Problem p02880 (python)

Fixed submission:
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(81):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(1,82):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)

b = 0
for i in a:
  if a[i]==n:
    print("Yes")
    break
  else:
    b = 1
  
if b==1:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
    
for i in a:
  if a[i]==n:
    print("Yes")
    break
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.apppend(i*j)
    
for i in a:
  if a[i]==n:
    print("Yes")
    break
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a=[]
for i in range(9):
  for j in range(9):
    a.apppend(i*j)
    
for i in a:
  if a[i]==n:
    print("Yes")
    break
  else:
    print("No")
Problem p02916 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.append(23)
c.append(0)
count = 0

for i in range(n):
    count += b[a[i]-1]
    #print("added"+str(b[a[i]-1]))
    if ((a[i]+1)==a[i+1]):
        #print("yeah"+str(c[a[i]-1]))
        count += c[a[i]-1]
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.append(23)

count = 0

for i in range(n):
    count += b[a[i]-1]
    #print("added"+str(b[a[i]-1]))
    if ((a[i]+1)==a[i+1]):
        #print("yeah"+str(c[i]))
        count += c[i+1]
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a.append(23)

count = 0

for i in range(n):
    count += b[a[i]-1]
    print("added"+str(b[a[i]-1]))
    if ((a[i]+1)==a[i+1]):
        print("yeah"+str(c[i]))
        count += c[i+1]
print(count)
Problem p02970 (python)

Fixed submission:
n,d = map(int,input().split())

if (2*d+1) > n:
  print(1)
else:
  print(-(-n // (2*d+1)))

Buggy submission (verdict: Runtime Error):
n,d = map(int,input().split())

if (2*d+1) > N:
  print(1)
else:
  print(int(n / (2*d+1)))

Buggy submission (verdict: Runtime Error):
n,d = map(int.input(),split())

if (2*d+1) > N:
  print(1)
else:
  print(int(n / (2*d+1)))
Problem p02989 (python)

Fixed submission:
n = int(input())
d = sorted(list(map(int,input().split())))

print(d[n//2]-d[n//2-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
d = sorted(list(map(int,input().split())))

print(d[2//n+3]-d[2//n+2])

Buggy submission (verdict: Runtime Error):
n = int(input())
d = sorted(list(map(int,input().split())))

print(d[2//n+2]-d[2//n+1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))

print(int(d[(n//2)+1]-d[(n//2)]))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))


print(int(d[n//2+1]-d[n//2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))


print(int(d[n//2+1]-d[n//2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))


print(int(d[n//2+1]-d[n//2-1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))

print(d[n//2+1]-d[n//2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))

print(d[n/2+1]-d[n/2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))

dd=sorted(d)

print(dd[n/2+1]-dd[n/2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))

d=sorted(d)

print(d[n/2+1]-d[n/2-1])
Problem p02771 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))
ret = "No"
if len(set([a,b,c]))==2:
    ret = "Yes"
print(ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))
ret = "No"
if len(set(a,b,c))==2:
    ret = "Yes"
print(ret)
Problem p02933 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
from collections import deque
import sys
input = sys.stdin.readline

def main():
    N, Q = map(int, input().split())
    edges = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        edges[b-1].append(a-1)
        edges[a-1].append(b-1)

    counts = [0]*N
    for _ in range(Q):
        p, x = map(int, input().split())
        counts[p-1] += x

    parent_nodes = deque()
    parent_nodes.append(0)
    visited_nodes = set()
    while parent_nodes:
        parent = parent_nodes.popleft()
        if parent in visited_nodes:
            continue
        visited_nodes.add(parent)
        for child in edges[parent]:
            if child in visited_nodes:
                continue
            counts[child] += counts[parent]
            parent_nodes.append(child)

    print(' '.join(list(map(str, counts))))

if __name__ == "__main__":
    main()
Problem p02948 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))

from collections import defaultdict
from heapq import heappush, heappop
dd = defaultdict(list)

for _ in range(n):
    a,b = tuple(map(int,input().split()))
    dd[a].append(b)

hq = []
ret = 0
for i in range(1,m+1):
    for j in dd[i]:
        heappush(hq,-j)
    if hq:
        ret+=heappop(hq)
print(-ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
d = [list(map(int,input().split())) for i in range(n)]
d.sort(key = lambda x:x[0])
d.sort(key = lambda x:x[1],reverse=True)

from heapq import heappush, heappop
hq = []
for i,ab in enumerate(d):
    heappush(hq,(i,ab))

cur_dat = 1
ret = 0
while cur_dat <= m:
    val = heappop(hq)[1]
    if val[0] <= cur_dat:
        ret+=val[1]
    else:
        heappush(hq,val)
    cur_dat+=1
print(ret)
Problem p03013 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
a = [int(input()) for i in range(m)]

inf=float("inf")

fib_memo = [-inf for i in range(n+1)]
fib_memo[0] = 1
if 1 in a:
    fib_memo[1]=0
else:
    fib_memo[1]=1
for i in a:
    fib_memo[i]=0

if 1 in [a[i] - a[i-1] for i in range(1,m)]:
    print(0)
    import sys
    sys.exit()
else:
    cur_fib_i = 2
    while cur_fib_i <= n:
        if fib_memo[cur_fib_i]==0:
            pass
        else:
            fib_memo[cur_fib_i] = fib_memo[cur_fib_i-1] + fib_memo[cur_fib_i-2]
        cur_fib_i += 1
print(fib_memo[n]%1000000007)
#print(fib_memo)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
a = [int(input()) for i in range(m)]

inf=float("inf")
i_pattern = [-inf for i in range(n+1)]

#i段目までの行き方を数える
def solve(i):
    if i == 1:
        if 1 in a:
            i_pattern[1] = 0
            return 0
        else:
            i_pattern[1] = 1
            return 1
    if i == 0:
        i_pattern[0]=1
        return 1
    if i_pattern[i] >= 0:
        ret = i_pattern[i]
    else :
        if i in a:
            i_pattern[i]=0
            return 0
        ret = solve(i-1)+solve(i-2)
        i_pattern[i]=ret
    return ret

print(solve(n)%1000000007)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m = list(map(int,input().split()))
a = [int(input()) for i in range(m)]

inf=float("inf")
i_pattern = [-inf for i in range(n+1)]

#i段目までの行き方を数える
def solve(i):
    if i == 1:
        if 1 in a:
            i_pattern[1] = 0
            return 0
        else:
            i_pattern[1] = 1
            return 1
    if i == 0:
        i_pattern[0]=1
        return 1
    if i_pattern[i] >= 0:
        ret = i_pattern[i]
    else :
        if i in a:
            i_pattern[i]=0
            return 0
        ret = solve(i-1)+solve(i-2)
        i_pattern[i]=ret
    return ret

print(solve(n)%1000000007)