Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
from math import gcd
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

print(int((a*b)/gcd(a,b)))

Fixed submission:
import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter

def gcd(a,b):
	if(b==0):
		return a
	return gcd(b,a%b)
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

print(int((a*b)/gcd(a,b)))

Buggy python submission (verdict: Runtime Error):
import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
from math import gcd
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

print(int(a*b/gcd(a,b)))

Fixed submission:
import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter

def gcd(a,b):
	if(b==0):
		return a
	return gcd(b,a%b)
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

print(int((a*b)/gcd(a,b)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

mod = 10**9+7

table = [0 for i in range(60)]
for i in a:
    for t in range(60):
        if i&1:
            table[t] += 1
        i >>= 1

ans = 0
for j, s in enumerate(table):
    ans += s*(n-s)*2**j
    ans %= mod
print(ans)

# -- | 01 | 10 | 11
# 01 | 00 | 11 | 10
# 10 | 11 | 00 | 01
# 11 | 10 | 01 | 00
# 12

# --- | 001 | 100 | 111
# 001 | 000 | 101 | 110
# 100 | 101 | 000 | 011
# 111 | 110 | 011 | 000
# 28

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

mod = 10**9+7

ans = 0
p = 1
for i in range(60):
    s = sum(1 for b in a if b&p)
    ans += s*(n-s)*p
    ans %= mod
    p <<= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

mod = 10**9+7

table = [0 for i in range(60)]
for i in a:
    for t in range(60):
        if i&1:
            table[t] += 1
        i >>= 1

ans = 0
for i in a:
    for j, s in enumerate(table):
        if i&1:
            ans += (n-s)*2**j
            ans %= 2*mod
        else:
            ans += s*2**j
            ans %= 2*mod
        i >>= 1
print(ans//2)

# -- | 01 | 10 | 11
# 01 | 00 | 11 | 10
# 10 | 11 | 00 | 01
# 11 | 10 | 01 | 00
# 12

# --- | 001 | 100 | 111
# 001 | 000 | 101 | 110
# 100 | 101 | 000 | 011
# 111 | 110 | 011 | 000
# 28

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

mod = 10**9+7

ans = 0
p = 1
for i in range(60):
    s = sum(1 for b in a if b&p)
    ans += s*(n-s)*p
    ans %= mod
    p <<= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
t = [list(map(int, input().split())) for _ in range(n-1)]



hands = [0 for _ in range(n+1)]
for a, b in t:
    hands[a] += 1
    hands[b] += 1

number_of_colors = max(*hands)

def next_color(i):
    return i+1 if i < number_of_colors else 1



class edge():
    def __init__(self, en):
        self.ends = en
        self.color = 0

    def set_color(self, co):
        self.color = co

class nord():
    def __init__(self, tr):
        self.parent = tr
        self.edges = []

    def add(self, ed):
        self.edges.append(ed)

    def set_color(self, previous_color):
        co = next_color(previous_color)
        for ed in self.edges:
            if ed.color == 0:
                ed.set_color(co)
                for i in ed.ends:
                    no = self.parent.nords[i-1]
                    if self is not no:
                        no.set_color(co)
                co = next_color(co)

class tree():
    def __init__(self):
        self.nords = []

    def add_nord(self, no):
        self.nords.append(no)

    def add_edge(self, ed):
        for i in ed.ends:
            self.nords[i-1].add(ed)

    def set_color(self):
        self.nords[0].set_color(0)


tr = tree()
for _ in range(n):
    no = nord(tr)
    tr.add_nord(no)

e_tree = []
for en in t:
    ed = edge(en)
    e_tree.append(ed)
    tr.add_edge(ed)

tr.set_color()

print(number_of_colors)
for e in e_tree:
    print(e.color)

Fixed submission:
from sys import setrecursionlimit


setrecursionlimit(10**6)



n = int(input())
t = [list(map(int, input().split())) for _ in range(n-1)]



hands = [0 for _ in range(n+1)]
for a, b in t:
    hands[a] += 1
    hands[b] += 1

number_of_colors = max(*hands)

def next_color(i):
    return i+1 if i < number_of_colors else 1



class edge():
    def __init__(self, en):
        self.ends = en
        self.color = 0

    def set_color(self, co):
        self.color = co

class nord():
    def __init__(self, tr):
        self.parent = tr
        self.edges = []

    def add(self, ed):
        self.edges.append(ed)

    def set_color(self, previous_color):
        co = next_color(previous_color)
        for ed in self.edges:
            if ed.color == 0:
                ed.set_color(co)
                for i in ed.ends:
                    no = self.parent.nords[i-1]
                    if self is not no:
                        no.set_color(co)
                co = next_color(co)

class tree():
    def __init__(self):
        self.nords = []

    def add_nord(self, no):
        self.nords.append(no)

    def add_edge(self, ed):
        for i in ed.ends:
            self.nords[i-1].add(ed)

    def set_color(self):
        self.nords[0].set_color(0)


tr = tree()
for _ in range(n):
    no = nord(tr)
    tr.add_nord(no)

e_tree = []
for en in t:
    ed = edge(en)
    e_tree.append(ed)
    tr.add_edge(ed)

tr.set_color()

print(number_of_colors)
for e in e_tree:
    print(e.color)
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
for i,l in enumerate(L):
    for j,m in enumerate(L[i+1:],i+1):
      	a+=bisect_left(L,l+m,j+1)-bisect(L,abs(l-m),j+1)
print(a)

Fixed submission:
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
l=[]
r=[]
for i in range(1001):
    l.append(bisect_left(L,i))
    r.append(bisect(L,i))
for p in L:
    for q in L:
        x=p+q
        y=abs(p-q)
        a+=(l[x]if x<1001else N)-(r[y]if 0<y<1001else(y>1000)*N)
for p in L:
    x=2*p
    a-=3*(l[x]if x<1001else N)
print((a+2*N)//6)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
for i in range(N):
    for j in range(i+1,N):
      	a+=bisect_left(L,L[i]+L[j],j+1)-bisect(L,abs(L[i]-L[j]),j+1)
print(a)

Fixed submission:
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
l=[]
r=[]
for i in range(1001):
    l.append(bisect_left(L,i))
    r.append(bisect(L,i))
for p in L:
    for q in L:
        x=p+q
        y=abs(p-q)
        a+=(l[x]if x<1001else N)-(r[y]if 0<y<1001else(y>1000)*N)
for p in L:
    x=2*p
    a-=3*(l[x]if x<1001else N)
print((a+2*N)//6)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
for i in range(N):
    for j in range(i+1,N):
      	a+=bisect_left(L[j+1:],L[i]+L[j])-bisect(L[j+1:],abs(L[i]-L[j]))
print(a)

Fixed submission:
from bisect import*
N,*L=map(int,open(0).read().split());L.sort()
a=0
l=[]
r=[]
for i in range(1001):
    l.append(bisect_left(L,i))
    r.append(bisect(L,i))
for p in L:
    for q in L:
        x=p+q
        y=abs(p-q)
        a+=(l[x]if x<1001else N)-(r[y]if 0<y<1001else(y>1000)*N)
for p in L:
    x=2*p
    a-=3*(l[x]if x<1001else N)
print((a+2*N)//6)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a,_=input().split();s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+int(a))
print(D[-2]%(9**9)or-1)

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[0]+[9e9]*(1<<N)
for i in range(M):
 a,_=input().split();s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):t=s|j;D[t]=min(D[t],D[j]+int(a))
print(-1*(D[-2]>8e9)or D[-2])

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[0]+[9e9]*(1<<N)
for i in range(M):
 a,_=input().split();s=sum(2**~-int(c)for c in input().split())
 for j in range(1<<N):t=s|j;D[t]=min(D[t],D[j]+int(a))
print(-1*(D[-2]>8e9)or D[-2])

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[9e9for _ in range(2**N)];D[0]=0
for i in range(M):
 a,_=input().split();s=sum(2**~-int(c)for c in input().split())
 for j in range(2**N):t=s|j;D[t]=min(D[t],D[j]+int(a))
print(-1*(D[-1]>8e9)or D[-1])

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[9**9for _ in range(2**N)];D[0]=0
for i in range(M):
 a,_=input().split();s=sum(2**~-int(c)for c in input().split())
 for j in range(2**N):D[s|j]=min(D[s|j],D[j]+int(a))
print(-1*(D[-1]>8**9)or D[-1])

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split());D=[9e9for _ in range(2**N)];D[0]=0
for i in range(M):
 a,_=input().split();s=sum(2**~-int(c)for c in input().split())
 for j in range(2**N):D[s|j]=min(D[s|j],D[j]+int(a))
print(-1*(D[-1]>8e9)or D[-1])

Fixed submission:
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache

n, q = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n-1)]
pxpx = [list(map(int, input().split())) for _ in range(q)]

pxdict = {i:0 for i in range(1, 1+n)}
for p, x in pxpx :
    pxdict[p] += x

babadict = {b:a for a, b in abab}

@lru_cache(maxsize=10**5+1)
def counter(node) :
    if node == 1 :
        return pxdict[1]
    else :
        return pxdict[node]+counter(babadict[node])

for i in range(1, n+1) :
    print(counter(i))

Fixed submission:
from operator import itemgetter
n, q = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n-1)]
pxpx = [list(map(int, input().split())) for _ in range(q)]
abab.sort(key=itemgetter(0))

ans = [0 for _ in range(n)]
for p, x in pxpx :
    ans[p-1] += x
for a, b in abab :
    ans[b-1] += ans[a-1]
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
n, m = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n)]
abab = sorted(sorted(abab, key=itemgetter(0), reverse=True), key=itemgetter(1), reverse=True)

gyara = [0 for _ in range(m+1)]

for a, b in abab :
    for i in range(a, m+1) :
        if gyara[i] == 0 :
            gyara[i] = b
            break

print(sum(gyara))

Fixed submission:
from heapq import *

n, m = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n)]
bites = [[] for _ in range(m)]
for a, b in abab :
    if a <= m : bites[a-1].append(-b)
    
ans = 0
board = []
for bite in bites:
    for b in bite : heappush(board, b)
    if board : ans -= heappop(board)
print(ans)

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
n, m = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n)]
abab = sorted(sorted(abab, key=itemgetter(0), reverse=True), key=itemgetter(1), reverse=True)

gyara = [0 for _ in range(m+1)]

def index(a) :
    if a > m:
        return m+1 
    if gyara[a] :
        return index(a+1)
    else :
        return a

for a, b in abab :
    i = index(a)
    if i <= m :
        gyara[i] = b

print(sum(gyara))

Fixed submission:
from heapq import *

n, m = map(int, input().split())
abab = [list(map(int, input().split())) for _ in range(n)]
bites = [[] for _ in range(m)]
for a, b in abab :
    if a <= m : bites[a-1].append(-b)
    
ans = 0
board = []
for bite in bites:
    for b in bite : heappush(board, b)
    if board : ans -= heappop(board)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = input()
effects = [1, 10, 9, 12, 3, 4]
mod = 10**9+7

amari = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
arrays = [np.eye(13, k=i, dtype=np.int64)+np.eye(13, k=i-13, dtype=np.int64) for i in range(13)]
for i, c in enumerate(reversed(s)) :
    if c != "?" :
        c = int(c)
        array = arrays[c*effects[i%6]%13]
        amari = np.dot(amari, array)
    else :
        array = sum(arrays[c*effects[i%6]%13] for c in range(10))
        amari = np.dot(amari, array)%mod

print(amari[5])

Fixed submission:
import numpy as np
s = input()
effects = [1, 10, 9, 12, 3, 4]
mod = 10**9+7

amari = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
arrays = [np.eye(13, k=i, dtype=np.int64)+np.eye(13, k=i-13, dtype=np.int64) for i in range(13)]
brrays = [sum(arrays[c*effects[i]%13] for c in range(10)) for i in range(6)]
for i, c in enumerate(reversed(s)) :
    if c != "?" :
        c = int(c)
        array = arrays[c*effects[i%6]%13]
        amari = np.dot(amari, array)
    else :
        array = brrays[i%6]
        amari = np.dot(amari, array)%mod

print(amari[5])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
effects = [1, 10, 9, 12, 3, 4]
mod = 10**9+7

amari = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for i, c in enumerate(reversed(s)) :
    if c != "?" :
        c = int(c)
        effect = c*effects[i%6]%13
        amari = [amari[j-effect] for j in range(13)]
    else :
        amari = [sum(amari[j-c*effects[i%6]%13] for c in range(10))%mod \
                                                 for j in range(13)]

print(amari[5])

Fixed submission:
import numpy as np
s = input()
effects = [1, 10, 9, 12, 3, 4]
mod = 10**9+7

amari = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
arrays = [np.eye(13, k=i, dtype=np.int64)+np.eye(13, k=i-13, dtype=np.int64) for i in range(13)]
brrays = [sum(arrays[c*effects[i]%13] for c in range(10)) for i in range(6)]
for i, c in enumerate(reversed(s)) :
    if c != "?" :
        c = int(c)
        array = arrays[c*effects[i%6]%13]
        amari = np.dot(amari, array)
    else :
        array = brrays[i%6]
        amari = np.dot(amari, array)%mod

print(amari[5])
Buggy python submission (verdict: Runtime Error):
from math import *
s=int(input())
a=math.ceil(math.sqrt(s))
print(0,0,a,1,a**2-s,a)

Fixed submission:
import math
from collections import Counter

s = int(input())

def primes(n) :
    ps = [2]
    for i in range(3, n+1) :
        for p in ps :
            if i%p == 0 :
                break
        else :
            ps.append(i)
    return ps

def factorint(n) :
    ps = primes(n)
    l = []
    while n != 1 :
        for p in ps :
            if n%p == 0 :
                n //= p
                l.append(p)
                break
    return Counter(l)

a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)

Buggy python submission (verdict: Runtime Error):
import math
a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)

Fixed submission:
import math
from collections import Counter

s = int(input())

def primes(n) :
    ps = [2]
    for i in range(3, n+1) :
        for p in ps :
            if i%p == 0 :
                break
        else :
            ps.append(i)
    return ps

def factorint(n) :
    ps = primes(n)
    l = []
    while n != 1 :
        for p in ps :
            if n%p == 0 :
                n //= p
                l.append(p)
                break
    return Counter(l)

a = math.ceil(math.sqrt(s))
print(0, 0, a, 1, a**2-s, a)
Buggy python submission (verdict: Runtime Error):
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)

Fixed submission:
S = input()
if "11" in S or "22" in S or "33" in S or \
   "44" in S or "55" in S or "66" in S or \
   "77" in S or "88" in S or "99" in S or "00" in S :
    print("Bad")
else :
    print("Good")
Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = list(map(int, input().split()))
e = c * d / math.gcd(c, d)

cko = math.floor(b/c) - math.ceil(a/c) + 1
dko = math.floor(b/d) - math.ceil(a/d) + 1
cdko = math.floor(b/e) - math.ceil(a/e) + 1
print(b-a+1-cko-dko+cdko)

Fixed submission:
import fractions
a, b, c, d = list(map(int, input().split()))
e = c * d // fractions.gcd(c, d)

cko = b//c - (a-1)//c
dko = b//d - (a-1)//d
eko = b//e - (a-1)//e
print(b-a+1-cko-dko+eko)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def mysort(lol) :
    l = len(lol)
    if l == 1 :
        return lol
    else :
        return merge(mysort(lol[:l//2]), mysort(lol[l//2:]))

def merge(lol1, lol2) :
    ans = []
    l1, l2 = lol1, lol2
    while l1 != [] and l2 != [] :
        if l1[0][1] > l2[0][1] :
            ans.append(l2.pop(0))
        else :
            ans.append(l1.pop(0))
    else :
        if l1 != [] :
            ans += l1
        else :
            ans += l2
    return ans

ablist = [list(map(int, input().split())) for _ in range(n)]
ablist = mysort(ablist)
wa = 0
for i in ablist :
    wa += i[0]
    if wa > i[1] :
        print("No")
        break
else :
    print("Yes")

Fixed submission:
from operator import itemgetter

n = int(input())

ablist = [list(map(int, input().split())) for _ in range(n)]
ablist = sorted(ablist, key=itemgetter(1))

wa = 0
for i in ablist :
    wa += i[0]
    if wa > i[1] :
        print("No")
        break
else :
    print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def insert(ab, lol) :
    for j in range(len(lol)) :
        if ab[1] > lol[j][1] :
            pass
        else :
            return lol[:j] + [ab] + lol[j:]
    else :
        return lol + [ab]

ablist = []
for i in range(n) :
    ab = list(map(int, input().split()))
    ablist = insert(ab, ablist)
wa = 0
for i in ablist :
    wa += i[0]
    if wa > i[1] :
        print("No")
        break
else :
    print("Yes")

Fixed submission:
from operator import itemgetter

n = int(input())

ablist = [list(map(int, input().split())) for _ in range(n)]
ablist = sorted(ablist, key=itemgetter(1))

wa = 0
for i in ablist :
    wa += i[0]
    if wa > i[1] :
        print("No")
        break
else :
    print("Yes")
Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))

mod = 10**9+7

@lru_cache(maxsize=n)
def stairway(i) :
    if i in a :
        return 0
    elif i == 0 :
        return 1
    elif i == 1 :
        return stairway(0)
    else :
        return (stairway(i-1)+stairway(i-2))%mod
    
print(stairway(n))

Fixed submission:
from functools import lru_cache
from sys import setrecursionlimit

n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))

mod = 10**9+7
setrecursionlimit(mod)

@lru_cache(maxsize=n)
def stairway(i) :
    if i in a :
        return 0
    elif i == 0 :
        return 1
    elif i == 1 :
        return stairway(0)
    else :
        return (stairway(i-1)+stairway(i-2))%mod
    
print(stairway(n))

Buggy python submission (verdict: Time Limit Exceeded):
N, M = list(map(int, input().split()))
alist = []
for m in range(M) :
    alist.append(int(input()))
    
a2 = 0
a1 = 1
for n in range(N) :
    a0 = (a1 + a2)*int((n+1) not in alist)%1000000007
    a2, a1 = a1, a0
else :
    print(a0)

Fixed submission:
from functools import lru_cache
from sys import setrecursionlimit

n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))

mod = 10**9+7
setrecursionlimit(mod)

@lru_cache(maxsize=n)
def stairway(i) :
    if i in a :
        return 0
    elif i == 0 :
        return 1
    elif i == 1 :
        return stairway(0)
    else :
        return (stairway(i-1)+stairway(i-2))%mod
    
print(stairway(n))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(200000)

N, M = list(map(int, input().split()))
alist = []
for m in range(M) :
    alist.append(int(input()))

def stairs(n, a1, a2) :
    a0 = (a1 + a2)*int(n not in alist)%1000000007
    if n == N :
        return a0
    else :
        return stairs(n+1, a0, a1)
      
print(stairs(1, 1, 0))

Fixed submission:
from functools import lru_cache
from sys import setrecursionlimit

n, m = map(int, input().split())
a = set(int(input()) for _ in range(m))

mod = 10**9+7
setrecursionlimit(mod)

@lru_cache(maxsize=n)
def stairway(i) :
    if i in a :
        return 0
    elif i == 0 :
        return 1
    elif i == 1 :
        return stairway(0)
    else :
        return (stairway(i-1)+stairway(i-2))%mod
    
print(stairway(n))
Buggy python submission (verdict: Runtime Error):
#D
n, m = list(map(int, input().split()))
alist = list(map(int, input().split()))
for i in range(m) :
    b, c = list(map(int, input().split()))
    alist += [c] * min(n, b)
alist.sort()
print(sum(alist))

Fixed submission:
a, b = list(map(int, input().split()))
if a > 12 :
    print(b)
elif a > 5 :
    print(b//2)
else :
    print(0)