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

Fixed submission:
X,N=map(int,input().split())
p=list(map(int,input().split()))
diff=102
for i in range(102):
    if i not in p and abs(X-i)<diff:
        diff=abs(X-i)
        ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
X,N=map(int,input().split())
p=list(map(int,input().split()))
m=X
for i in range(101):
    diff=abs(X-i)
    if i not in p and diff<m and diff!=m:
        m=diff
        ans=i
print(ans)
Problem p03043 (python)

Fixed submission:
N,K=map(int,input().split())
probability=0
for dice in range(1,N+1):
    coin=1/N
    point=dice
    while(point<K):
        point*=2
        coin/=2
    probability+=coin
print(probability)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=float(0)
for i in range(n):ans+=(0.5**(int(k**0.5)+1-i))/n
print(ans)
Problem p03047 (python)

Fixed submission:
n,k=map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=countA=countB=countAB=0
for i in range(n):
    s=input()
    if "AB" in s:
        count+=1
    if s[-1]=="A":countA+=1
    if s[0]=="B":countB+=1
    if s[-1]=="A" and s[0]=="B":countAB+=1
print(countAB-1 if countA==countB==0 and countAB>0 else min(countA,countB)+countAB)

Buggy submission (verdict: Runtime Error):
n=int(input())
count=countA=countB=countAB=0
for i in range(n):
    s=input()
    if "AB" in s:
        count+=1
    if s[-1]=="A":countA+=1
    if s[0]=="B":countB+=1
    if s[-1]=="A" and s[0]=="B":countAB+=1
print(countAB-1 if countA=countB=0 and countAB>0 else min(countA,countB)+countAB)
Problem p03148 (python)

Fixed submission:
N,K=map(int,input().split())
TD=[[int(j) for j in input().split()] for i in range(N)]
TD=sorted(TD,key=lambda x:-x[1])
point=0
stack=[]
kind=set()
for t,d in TD[:K]:
    point+=d
    if t in kind:stack.append(d)
    else:kind.add(t)
point=point+len(kind)**2
ans=point
for t,d in TD[K:]:
    if not stack:break
    if not t in kind:
        point+=d-stack.pop()+2*len(kind)+1
        kind.add(t)
        ans=max(ans,point)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
TD=[[int(j) for j in input().split()] for i in range(N)]
TD=sorted(TD,key=lambda x:-x[1])
point=0
stack=[]
kind=set()
for t,d in TD[:K]:
    point+=d
    if t in kind:stack.append(d)
    else:kind.add(t)
ans1=delicious+len(kind)**2
ans2=ans1
for t,d in TD[K:]:
    if not stack:break
    if not t in kind:
        ans2+=d-stack.pop()+2*len(kind)+1
        kind.add(t)
        ans2=max(ans1,ans2)
print(ans2)
Problem p03150 (python)

Fixed submission:
import re
s=input()
if re.match("^keyence.*",s) or re.match(".*keyence$",s) or re.match("^k.*eyence$",s)  or re.match("^ke.*yence$",s) or re.match("^key.*ence$",s) or re.match("^keye.*nce$",s) or re.match("^keyen.*ce$",s)or re.match("^keyenc.*e$",s) or re.match("^keyence$",s) :
    print("YES")
else:print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list("keyence")
j=0
c=0
for i in range(len(s)):
    if s[i]==t[c]:
        j+=1
        if j==7:
            if s[i+1]="":
                print("YES")
                exit()
            else:
                break
        c+=1
print("NO")

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list("keyence")
j=0
c=0
for i in s:
    if i==t[c]:
        j+=1
        if j==7:
            print("YES")
            exit()
    c+=1
print("NO")
Problem p03160 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))print(dp[n-1])
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
m=1001
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:m=min(m,c)
print("TLE" if m==1001 else m)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
m=1001
for i in range(n):c,t=map(int,input().split())
  if i<=t:m=min(m,c)
print("TLE" if m==1001 else m)
Problem p03282 (python)

Fixed submission:
s=input()
k=int(input())-1
i=0
while s[i]=="1" and k:k,i=k-1,i+1
print(s[i])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
i=0
while s[i]=="1" and k:k,i=k-1,i+1
print(s[i])
Problem p03323 (python)

Fixed submission:
a,b=map(int,input().split())
print("Yay!" if a<9 and b<9 else ":(")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("Yay!" if A<9 and B<9 else ":(")
Problem p03325 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
c=0
for i in a:
    while i%2==0:
        i=i/2
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
c=0
for i in a:while i%2==0:i,c=i/2,c+1
print(c)
Problem p03409 (python)

Fixed submission:
N=int(input())
red=sorted([list(map(int,input().split())) for i in range(N)], key=lambda x:-1*x[1])
blue=sorted([list(map(int,input().split())) for i in range(N)])
red = sorted(red, key = lambda x:x[1] * -1)
count=0
for i in red:
    for n,j in enumerate(blue):
        if i[0]<j[0] and i[1]<j[1]:
            count+=1
            del blue[n]
            break
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
red=sorted(list(map(int,input().split())) for i in range(N), key=lambda x:-1*x[1])
blue=sorted(list(map(int,input().split())) for i in range(N))
red = sorted(red, key = lambda x:x[1] * -1)
count=0
for i in red:
    for n,j in enumerate(blue):
        if i[0]<j[0] and i[1]<j[1]:
            count+=1
            del blue[n]
            break
print(count)
Problem p03416 (python)

Fixed submission:
a,b=map(int,input().split())
print(len([i for i in map(str,range(a,b+1)) if i==i[::-1]]))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(len([i for i in map(str,range(a,b+1)) if i==i[::-1]))
Problem p03448 (python)

Fixed submission:
a,b,c,x=[int(input()) for _ in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(x))

Buggy submission (verdict: Runtime Error):
a,b,c,x=map(int,input().split())
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(x))
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())
for x in range(N+1):
    for y in range(N+1):
        z=N-x-y
        if 0<=z<=2000:
            if 10000*x+5000*y+1000*z==Y:
                print(x,y,z)
                exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
a,b,c,x=[int(input()) for i in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(x))
Problem p03605 (python)

Fixed submission:
print("Yes" if "9" in input() else "No")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n in 9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n in "9":
    print("Yes")
else:
    print("No")
Problem p03673 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
print(*(A[::-2]+A[N%2::2]))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])
Problem p03695 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
color=[0]*8
free=0
for a in A:
    if 1<=a<=399:color[0]=1
    elif 400<=a<=799:color[1]=1
    elif 800<=a<1199:color[2]=1
    elif 1200<=a<=1599:color[3]=1
    elif 1600<=a<=1999:color[4]=1
    elif 2000<=a<=2399:color[5]=1
    elif 2400<=a<=2799:color[6]=1
    elif 2800<=a<=3199:color[7]=1
    elif 3200<=a<=4800:free+=1
M=sum(color)+free
m=1 if sum(color)==0 and free!=0 else sum(color)
print(m,M)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
c=[0]*8
d=0
for a in A:
    if 1<=a<=399:c[0]=1
    elif 400<=a<=799:c[1]=1
    elif 800<=a<1199:c[2]=1
    elif 1200<=a<=1599:c[3]=1
    elif 1600<=a<=1999:c[4]=1
    elif 2000<=a<=2399:c[5]=1
    elif 2400<=a<=2799:c[6]=1
    elif 2800<=a<=3199:c[7]=1
    else:d+=1
if d>0:e=1
else e=0
print(sum(c)+e,sum(c)+d)
Problem p03720 (python)

Fixed submission:
n,m=map(int,input().split())
l=" ".join([input() for _ in [0]*m])
for i in range(1,n+1):print(l.split().count(str(i)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=" ".join([input() for _ in [0]*m])
for i in range(i,n+1):print(s.split().count(str(i)))
Problem p03827 (python)

Fixed submission:
input()
s=input()
c,m=0,0
for i in range(len(s)):
    if s[i]=="I":
        c+=1
        m=max(c,m)
    if s[i]=="D":
        c=c-1
        m=max(c,m)
print(m)

Buggy submission (verdict: Runtime Error):
n,s=input(),input()
c,m=0,0
for i in range(n):
    if s[i]=="I":c,m=c+1,max(c,m)
    if s[i]=="D":c,m=c-1,max(c,m)
print(m)
Problem p03844 (python)

Fixed submission:
print(eval(input()))

Buggy submission (verdict: Runtime Error):
input(eval(input()))
Problem p03852 (python)

Fixed submission:
print("vowel" if input() in "aiueo" else "consonant")

Buggy submission (verdict: Runtime Error):
c=int(input())
if c in "aiueo":
    print("vowel")
else:
    print("consonant")
Problem p04030 (python)

Fixed submission:
s=input()
t=[]
for i in s:
    if i=="B" and len(t)!=0:t.pop()
    if i=="0" or i=="1":t.append(i)
print(*t,sep="")

Buggy submission (verdict: Runtime Error):
s=input()
t=[]
for i in s:
    if i=="B" and not len(t):t.pop()
    if i=="0" or i=="1":t.append(i)
print(*t,sep="")
Problem p02675 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 16:42:23 2020

@author: Tofu
"""

#N = input()
#print(N)
def yomi(N):
    lst = N[-1]
#print(lst)
    x = ''
    if lst in ['2','4','5','7','9']:
        x = 'hon'
    elif lst in ['0','1','6','8']:
        x = 'pon'
    elif lst == '3':
        x = 'bon'
    
    print(x)
    return x


if __name__ == '__main__':
    N = input()
    
    ans = yomi(N)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 16:42:23 2020

@author: Tofu
"""

N = input()
#print(N)

lst = N[-1]
#print(lst)
x = ''
if lst in ['2','4','5','7','9']:
    x = 'hon'
elif lst in ['0','1','6','8']:
    x = 'pon'
else:
    x = 'bon'
    
#print(x)
    return x
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int,input().split())

#print(W,H,x,y)
area =  "{0:.6f}".format(float(W*H/2))
if x == W/2 and y == H/2:
    print(area,1)
else:
    print(area,0)

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())

#print(W,H,x,y)
if x ==W/2 and y == H/2:
    area =  "{0:.6f}".format(float(x*H))
    print(area,1)
else:
    area ="{0:.6f}".format(float(min(W-x)*H,x*H))
    print(area,0)
Problem p03160 (python)

Fixed submission:

def frog(H,N):
    #print(H)
    DP = [0]*N
    DP[0] = 0
    DP[1] = abs(H[1]-H[0])
    for i in range(2,N):
        DP[i] = min(abs(H[i]-H[i-2])+DP[i-2],abs(H[i]-H[i-1])+DP[i-1])
    #print(DP)
    return DP[-1]    
if __name__ == '__main__':
    N = int(input())
    H = list(map(int,input().split()))
    ans = frog(H,N)
    print(ans)

Buggy submission (verdict: Runtime Error):

def frog2(H,N,K):
    #print(H)
    DP = [10**10]*N
    #DP = [0]*N
    DP[0] = 0
    DP[1] = abs(H[1]-H[0])
    for i in range(2,N):
        for j in range(1,K+1):
            DP[i] = chmin(DP[i],DP[i-j]+abs(H[i]-H[i-j]))
    return DP[-1]

def chmin(a,b):
    if a < b:
        return a
    else:
        return b

if __name__ == '__main__':
    N,K = map(int,input().split())
    H = list(map(int,input().split()))
    ans = frog2(H,N,K)
    print(ans)
Problem p03262 (python)

Fixed submission:
import fractions
N,X = map(int,input().split())

x = list(map(int,input().split()))
lst = [0]*N
for i in range(len(x)):
    lst[i] = x[i] - X
   
a=0
for e in lst:
  a=fractions.gcd(a,e)
print(abs(a))

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())

x = list(map(int,input().split()))
lst = [0]*N
for i in range(len(x)):
    lst[i] = abs(x[i] - X)
    
def find_gcd(x, y): 
    while(y): 
        x, y = y, x % y 
  
    return x 

num1=lst[0] 
num2=lst[1] 
gcd=find_gcd(num1,num2) 
  
for i in range(2,len(lst)): 
    gcd=find_gcd(gcd,lst[i]) 
    
print(gcd)
Problem p03273 (python)

Fixed submission:
def elimrow(lst):
    lst_after = []
    gset = []
    H1 = len(lst)
    for i in range(H1):
        gset = list(set(lst[i]))
        gset.sort()
        #print(gset)
        if gset[0] != '.':
            lst_after.append(lst[i])
    return lst_after

def trans(lst):
    return list(zip(*lst))

def main():
    H,W = map(int,input().split())

    grid = [list(str(input())) for _ in range(H)]
    grid_after = []
    grid_after = elimrow(grid)
    gridT = trans(grid_after)
    grid_after2 = elimrow(gridT)
    gridT2 = trans(grid_after2)
    #print(gridT2)
    for i in gridT2:
        print(*i,sep='')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())

grid = [list(str(input())) for _ in range(H)]

def elim(grid):
    grid_after = []
    for i in range(H):
        gset = list(set(grid[i]))
        #print(gset)
        #print(grid[i])
        if gset[0] != '.':
            grid_after.append(grid[i])
    return grid_after
    
def transpose(grid_after):
    
    H1 = len(grid_after)
    W1 = len(grid_after[0][:])
    gridT = [['']*H1 for _ in range(W1)]
    for i in range(W1):
        for j in range(H1):
            gridT[i][j] = grid_after[j][i]
            
            
    return gridT

grid_after = elim(grid)

gridT1 = transpose(grid_after)
#print(gridT1)
grid_after2 = elim(gridT1)
# print(grid_after2)
gridT2 = transpose(grid_after2)
#print(gridT2)
for i in gridT2:
    print(*i,sep='')
Problem p03624 (python)

Fixed submission:
import string
s = str(input())
low = string.ascii_lowercase
fin = ''
for i in range(len(low)):
    if low[i] not in s:
        fin += low[i]
if len(fin) == 0:
    print('None')
else:
    print(fin[0])

Buggy submission (verdict: Runtime Error):
import string
s = str(input())
low = string.ascii_lowercase
fin = ''
for i in range(len(low)):
    if low[i] not in s:
        fin += low[i]
        
print(fin[0])
Problem p03633 (python)

Fixed submission:
import math
N = int(input())
T = []

def lcm(x, y):
    gc = math.gcd(x, y)
    ans = (x * y)//gc
    return ans

for i in range(N):
    T.append(int(input()))

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    g = lcm(T[0],T[1])
    print(g)
else:
    print(T[0])

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []

def lcm(x, y):
    gc = math.gcd(x, y)
    ans = (x * y)//gc
    return ans

for i in range(N):
    T.append(int(input()))

    

if len(T) > 2:
    g = lcm(T[0],T[1])
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
elif len(T) == 2:
    print(g)
else:
    print(T[0])

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []

def lcm(x, y):
    gc = math.gcd(x, y)
    ans = (x * y)//gc
    return ans

for i in range(N):
    T.append(int(input()))

    
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
else:
    print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    ans = (x * y)//math.gcd(x, y)
    return ans
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(3,N-1):
        g = lcm(g,T[i+1])
    print(g)
else:
    print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    ans = (x * y)//math.gcd(x, y)
    return ans
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
g = lcm(T[0],T[1])
if len(T) > 2:
    for i in range(N-1):
        g = lcm(g,T[i+1])
print(g)
Problem p03760 (python)

Fixed submission:
O = str(input())
E = str(input())
st = ''
if len(O) == len(E):
    for i in range(len(O)):
        st += O[i]
        st+= E[i]
    print(st)
else:
    for i in range(len(O)-1):
        st += O[i]
        st+= E[i]
    
    print(st+O[-1])

Buggy submission (verdict: Runtime Error):
O = str(input())
E = str(input())
st = ''
for i in range(len(O)):
    st += O[i]
    st+= E[i]
    
print(st)
Problem p03852 (python)

Fixed submission:

#lst = list(map(str,input().split()))
st = str(input())
if st in ['a','e','i','o','u']:
    print('vowel')
else:
    print('consonant')

Buggy submission (verdict: Runtime Error):

lst = list(map(str,input().split()))
#print(lst)
#print(lst[1])
print(lst[0][0]+lst[1][0]+lst[2][0])
Problem p03951 (python)

Fixed submission:
n=int(input())
s=input()
t=input()

for i in range(n+1):
    #print(s[i:],t[:n-i])
    if s[i:] == t[:n-i]:
        print(n+i)
        exit()

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()

for i in range(n,2*n-1):
    if s[:2*n-i] == t[2*n-i]:
        print(i)
        exit()
print(2*n)
Problem p03164 (python)

Fixed submission:
N, W = map(int, input().split())
A = list()
for n in range(N):
	A.append(list(map(int, input().split())))
inf = 10**10
V = 0
for a in range(N):
	V += A[a][1]
dp = [inf for v in range(V+1)]
dp[0] = 0
for p in range(N):
	for q in range(V - A[p][1], -1, -1):
		dp[q + A[p][1]] = min(dp[q + A[p][1]], dp[q] + A[p][0])
# print(dp)
ans = 0
for b in range(V+1):
	if (dp[b] <= W):
		ans = b
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N, W = map(int, input().split())
A = list()
for n in range(N):
	A.append(list(map(int, input().split())))
g = math.gcd(W, A[0][0]) 
for a in range(1, N):
	g = math.gcd(g, A[a][0])
W = W//g 
# print(g)
dp = [[0 for w in range(W+1)] for n in range(N+1)]
for i in range(W+1):
	dp[0][i] = 0
for p in range(1, N+1):
	for q in range(W+1):
		dp[p][q] = dp[p-1][q]
		if ((A[p-1][0]//g) <= q):
			dp[p][q] = max(dp[p][q], dp[p-1][q - (A[p-1][0]//g)] + A[p-1][1])
# print(dp)
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
import math
N, W = map(int, input().split())
A = list()
for n in range(N):
	A.append(list(map(int, input().split())))
g = math.gcd(W, A[0][0]) 
for a in range(1, N):
	g = math.gcd(g, A[a][0])
W = W//g 
# print(g)
dp = [[0 for w in range(W+1)] for n in range(N+1)]
for i in range(W+1):
	dp[0][i] = 0
for p in range(1, N+1):
	for q in range(W+1):
		dp[p][q] = dp[p-1][q]
		if (A[p-1][0]//g <= q):
			dp[p][q] = max(dp[p][q], dp[p-1][q - (A[p-1][0]//g)] + A[p-1][1])
# print(dp)
print(dp[N][W])
Problem p03170 (python)

Fixed submission:
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
# dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if n >= i:
			if fn(n-i) == 0:
				ans = 1
				break
	dp[n] = ans		
	return dp[n]
for l in range(K):
	fn(l)
if fn(K) == 1:
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	for i in L:
      if n >= i:
		if fn(n-i) == 1:
			dp[n] = 0
			return 0
	dp[n] = 1
	return 1
for l in range(1, 	K):
	fn(l)
if fn(K) == 0:
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
# dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if fn(n-i) == 0:
			ans = 1
			break
	dp[n] = ans		
	return dp[n]
for l in range(K):
	fn(l)
if fn(K) == 1:
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
# dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if fn(n-i) == 0:
			ans = 1
			break
	dp[n] = ans		
	return dp[n]
for l in range(K):
	fn(l)
if fn(K):
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
# dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n == 0:
		dp[n] = 0
		return dp[n]
	ans = 0
	for i in L:
		if fn(n-i) == 0:
			ans = 1
			break
	dp[n] = ans		
	return dp[n]
for l in range(1, 	K):
	fn(l)
if fn(K):
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 1
def fn(n):
	if dp[n] != -1:
		return dp[n]
	for i in L:
		if fn(n-i) == 1:
			dp[n] = 0
			return 0
	dp[n] = 1
	return 1
for l in range(1, 	K):
	fn(l)
if fn(K) == 0:
	print("First")
else:
	print("Second")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))
dp = [-1 for k in range(K+1)]
dp[0] = 0
def fn(n):
	if dp[n] != -1:
		return dp[n]
	if n < L[0]:
		dp[n] = 1
		return 1
	if n in L:
		dp[n] = 0
		return 0
	for i in L:
		if fn(n-i) == 1:
			dp[n] = 0
			return 0
	dp[n] = 1
	return 1
for i in range(K):
	fn(i)
if fn(K) == 0:
	print("First")
else:
	print("Second")
Problem p02606 (python)

Fixed submission:
L, R, d = map(int, input().split())
ans = 0
for x in range(L, R+1):
    if x % d == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
ans = []
for x in range(1, math.ceil(n**(1/2))+1):
    for y in range(1, math.ceil(n**(1/2))+1):
        for z in range(1, math.ceil(n**(1/2))+1):
            ans.append(x**2 + y**2 + z**2 + x*y + y*z + z*x)
ans.sort()
for i in range(1, n+1):
    tmp = 0
    for x in ans:
        if x == i:
            tmp += 1
        elif x > i:
            print(tmp)
            break