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

Fixed submission:
import sys
import fractions
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
alist=list(map(int,input().split()))
alist=list(set(alist))

n=len(alist)


def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return tmp*alist[n-1]//fractions.gcd(tmp,alist[n-1])

sk = sks(n)
gomi=sk//2

for a in alist:
	if (gomi-a//2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))

Buggy submission (verdict: Runtime Error):
import sys
import fractions
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
alist=list(map(int,input().split()))
alist=list(set(alist))

n=len(alist)

def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return int(tmp*alist[n-1]/fractions.gcd(tmp,alist[n-1]))

sk = sks(n)
gomi=sk/2

for a in alist:
	if (gomi-a/2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))

Buggy submission (verdict: Runtime Error):
import sys
import fractions
sys.setrecursionlimit(10**7)

n,m=map(int,input().split())
alist=list(map(int,input().split()))

def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return int(tmp*alist[n-1]/fractions.gcd(tmp,alist[n-1]))

sk = sks(n)
gomi=sk/2

for a in alist:
	if (gomi-a/2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))
Problem p02918 (python)

Fixed submission:
import sys
n,k=map(int,input().split())
s=input()

if n == 1:
    print(0)
    sys.exit()

hap = 0
if s[0] == "R" and s[1] == "R":
    hap += 1
if s[-1] == "L" and s[-2] == "L":
    hap += 1

for i in range(1,n-1):
    if s[i] == "L" and s[i-1] =="L":
        hap += 1
    elif s[i] == "R" and s[i+1] == "R":
        hap += 1

rl = 0
lr = 0

for i in range(n-1):
    if s[i] == "L" and s[i+1] == "R":
        lr += 1
    elif s[i] == "R" and s[i+1] == "L":
        rl += 1

tmp = min(rl,lr,k)
hap += 2 * tmp

if s[0] != s[-1] and k - tmp >0:
    hap += 1
print(hap)

Buggy submission (verdict: Runtime Error):
import sys
n,k=map(int,input().split())
s=input()

hap = 0
if s[0] == "R" and s[1] == "R":
    hap += 1
if s[-1] == "L" and s[-2] == "L":
    hap += 1

rl = 0
lr = 0

for i in range(1,n-1):
    if s[i] == "L":
        if s[i-1] == "L":
            hap += 1
        else:
            rl += 1
    else:
        if s[i+1] == "R":
            hap += 1
        if s[i-1] == "L":
            lr += 1

tmp = min(rl,lr,k)
hap += 2 * tmp

if rl != lr and k - tmp >0:
    hap += 1
print(hap)
Problem p03161 (python)

Fixed submission:
n,k=map(int,input().split())
hlist=list(map(int,input().split()))
 
mins=[0]
 
for i in range(1,n):
	if i == 1:
		mins.append(abs(hlist[1]-hlist[0]))
		continue
	
	tmplist=[]
	tmp=hlist[i]
	for j in range(min(k,i)):
		tmplist.append(mins[i-j-1]+abs(tmp-hlist[i-j-1]))
	mins.append(min(tmplist))
 
print(mins[n-1])

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

mins=[0]

if n == 2:
	print(abs(hlist[1]-hlist[0]))

for i in range(1,n):	
	smallest=1000000000001
	tmp=hlist[i]
	for j in range(min(k,i)):
		smallest=min(smallest,mins[i-j-1]+abs(tmp-hlist[i-j-1]))
	mins.append(min(tmplist))

print(mins[n-1])

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

mins=[0]

if n == 2:
	print(abs(hlist[1]-hlist[0]))

for i in range(1,n):	
	smallest=10001
	tmp=hlist[i]
	for j in range(min(k,i)):
		smallest=min(smallest,mins[i-j-1]+abs(tmp-hlist[i-j-1]))
	mins.append(min(tmplist))

print(mins[n-1])
Problem p03447 (python)

Fixed submission:
print((int(input())-int(input()))%int(input()))

Buggy submission (verdict: Runtime Error):
a,b,c,x =[int(input()) for _ in range(4)]

count=0

for a_num in range(a+1):
  for b_num in range(b+1):
    for c_num in range(c+1):
      if a*500+b*100+c*50==x:
        count+=1

print(str(count))

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,input().strip())


count=0

for a_num in range(a+1):
  for b_num in range(b+1):
    for c_num in range(c+1):
      if a*500+b*100+c*50==x:
        count+=1

print(str(count))
Problem p03448 (python)

Fixed submission:
a,b,c,x = [int(input()) for _ in range (4)]


count=0

for a_num in range(a+1):
  for b_num in range(b+1):
    for c_num in range(c+1):
      if a_num*500+b_num*100+c_num*50==x:
        count+=1

print(str(count))

Buggy submission (verdict: Runtime Error):
a,b,c,x = map(int,input().strip())


count=0

for a_num in range(a+1):
  for b_num in range(b+1):
    for c_num in range(c+1):
      if a*500+b*100+c*50==x:
        count+=1

print(str(count))

Buggy submission (verdict: Runtime Error):
a=input()#500
b=input()#100
c=input()#50
x=input()

count=0

for a_num in range(a+1):
  for b_num in range(b+1):
    for c_num in range(c+1):
      if a*500+b*100+c*50==x:
        count+=1

print(str(count))
Problem p02848 (python)

Fixed submission:
import string
l=string.ascii_uppercase
N=int(input())
S=input()
T=""
for i in range(len(S)):
  for j in range(26):
    if S[i]==l[j]:
      T+=l[(j+N)%26]
      break
print(T)

Buggy submission (verdict: Runtime Error):
import string
l=string.ascii_uppercase
N=int(input())
S=input()
T=""
for i in range(N):
  for j in range(26):
    if S[i]==l[j]:
      T+=l[i+N]
      break
print(T)
Problem p02939 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)
def f(x):
  if x<=2:
    if x==2 and S[0]==S[1]:
      return 1
    else:
      return x
  else:
    if S[x-1]==S[x-2]:
      return f(x-3)+2
    else:
      return f(x-1)+1
S=input()
print(f(len(S)))

Buggy submission (verdict: Runtime Error):
def f(x):
  if x<=2:
    if x==2 and S[0]==S[1]:
      return 1
    else:
      return x
  else:
    if S[x-1]==S[x-2]:
      return f(x-3)+2
    else:
      return f(x-1)+1
S=input()
print(f(len(S)))

Buggy submission (verdict: Runtime Error):
def f(x):
  if x==0:
    return 0
  elif x==1:
    return 1
  elif x==2:
    if S[0]==S[1]:
      return 1
    else:
      return 2
  else:
    if S[x-1]==S[x-2]:
      return f(x-3)+2
    else:
      return f(x-1)+1
  
S=input()
print(f(len(S)))
Problem p03112 (python)

Fixed submission:
import bisect
A,B,Q=map(int,input().split())
s=[]
t=[]
for i in range(A):
  s.append(int(input()))
for i in range(B):
  t.append(int(input()))
for i in range(Q):
  x=int(input())
  j=bisect.bisect_left(s,x)
  if j==0:
    kouhoA=[s[j]]
  elif j==A:
    kouhoA=[s[j-1]]
  else:
    kouhoA=[s[j],s[j-1]]
  k=bisect.bisect_left(t,x)
  if k==0:
    kouhoB=[t[k]]
  elif k==B:
    kouhoB=[t[k-1]]
  else:
    kouhoB=[t[k],t[k-1]]
  if len(kouhoA)==1:
    
    if len(kouhoB)==1:
      a=abs(kouhoA[0]-kouhoB[0])
      ans=min([abs(x-kouhoA[0])+a,abs(x-kouhoB[0])+a])
    else:
      u=abs(x-kouhoA[0])
      a=abs(kouhoA[0]-kouhoB[0])
      b=abs(kouhoA[0]-kouhoB[1])
      ans=min([u+a,abs(x-kouhoB[0])+a,u+b,abs(x-kouhoB[1])+b])
  else:
    if len(kouhoB)==1:
      a=abs(kouhoA[0]-kouhoB[0])
      c=abs(kouhoB[0]-kouhoA[1])
      v=abs(x-kouhoB[0])
      ans=min([abs(x-kouhoA[0])+a,v+a,abs(x-kouhoA[1])+c,v+c])
    else:
      u=abs(x-kouhoA[0])
      a=abs(kouhoA[0]-kouhoB[0])
      b=abs(kouhoA[0]-kouhoB[1])
      c=abs(kouhoB[0]-kouhoA[1])
      d=abs(kouhoA[1]-kouhoB[1])
      v=abs(x-kouhoB[0])
      w=abs(x-kouhoA[1])
      y=abs(x-kouhoB[1])
      ans=min([u+a,v+a,w+d,y+d,w+c,v+c,u+b,y+b])
  print(ans)

Buggy submission (verdict: Runtime Error):
A,B,Q=map(int,input().split())
s=[]
t=[]
for i in range(A):
  s.append(int(input()))
for i in range(B):
  t.append(int(input()))
for i in range(Q):
  x=int(input())
  s1=s[:]
  s1.append(x)
  s1.sort()
  j=s1.index(x)
  if j==0:
    kouhoA=[s[j]]
  else:
    kouhoA=[s[j],s[j-1]]
  t1=t[:]
  t1.append(x)
  t1.sort()
  k=t1.index(x)
  if k==0:
    kouhoB=[t[k]]
  else:
    kouhoB=[t[k],t[k-1]]
  if j==0:
    
    if k==0:
      a=abs(kouhoA[0]-kouhoB[0])
      ans=min([abs(x-kouhoA[0])+a,abs(x-kouhoB[0])+a])
    else:
      u=abs(x-kouhoA[0])
      a=abs(kouhoA[0]-kouhoB[0])
      b=abs(kouhoA[0]-kouhoB[1])
      ans=min([u+a,abs(x-kouhoB[0])+a,u+b,abs(x-kouhoB[1])+b])
  else:
    if k==0:
      a=abs(kouhoA[0]-kouhoB[0])
      c=abs(kouhoB[0]-kouhoA[1])
      v=abs(x-kouhoB[0])
      ans=min([abs(x-kouhoA[0])+a,v+a,abs(x-kouhoA[1])+c,v+c])
    else:
      u=abs(x-kouhoA[0])
      a=abs(kouhoA[0]-kouhoB[0])
      b=abs(kouhoA[0]-kouhoB[1])
      c=abs(kouhoB[0]-kouhoA[1])
      d=abs(kouhoA[1]-kouhoB[1])
      v=abs(x-kouhoB[0])
      w=abs(x-kouhoA[1])
      y=abs(x-kouhoB[1])
      ans=min([u+a,v+a,w+d,y+d,w+c,v+c,u+b,y+b])
  print(ans)
Problem p03241 (python)

Fixed submission:
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
        if M%s==0:
          ans=s
          break
        s-=1
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      s=N
      while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    if N<rM:
      nya-n
      
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    if ans==1:
      nya-n
      
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    else:
      nya-n
    print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
if M%N==0:
  print(M//N)
else:
  s=M//N
  if s<100000:
    ans=1
    while s!=1:
      if M%s==0:
        ans=s
        break
      s-=1
    print(ans)
  else:
    nya-n
    rM=M**(1/2)
    s=N
    ans=1
    while s<=rM:
      if M%s==0:
        ans=M//s
        break
      s+=1
    print(ans)
Problem p03246 (python)

Fixed submission:
from collections import Counter
N=int(input())
NN=N//2
l=list(map(int,input().split()))
l1=[l[2*i] for i in range(NN)]
l2=[l[2*i+1] for i in range(NN)]
l1c=Counter(l1)
l2c=Counter(l2)
r1=l1c.most_common()
r2=l2c.most_common()
if r1[0][0]==r2[0][0]:
  if r1[0][1]==NN and r2[0][1]==NN:
    ans=NN
  elif r1[0][1]>r2[0][1]:
    ans=N-r1[0][1]-r2[1][1]
  elif r1[0][1]<r2[0][1]:
    ans=N-r1[1][1]-r2[0][1]
  else:
    if r1[1][1]>r2[1][1]:
      ans=N-r1[1][1]-r2[0][1]
    else:
      ans=N-r1[0][1]-r2[1][1]
else:
  ans=N-r1[0][1]-r2[0][1]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
NN=N//2
l=list(map(int,input().split()))
l1=[l[2*i] for i in range(NN)]
l2=[l[2*i+1] for i in range(NN)]
l1c=Counter(l1)
l2c=Counter(l2)
r1=l1c.most_common()
r2=l2c.most_common()
if r1[0][0]==r2[0][0]:
  if r1[0][0]==NN and r2[0][0]==NN:
    ans=NN
  elif r1[0][1]>r2[0][1]:
    ans=N-r1[0][1]-r2[1][1]
  else:
    ans=N-r1[1][1]-r2[0][1]
else:
  ans=N-r1[0][1]-r2[0][1]
print(ans)
Problem p03263 (python)

Fixed submission:
H,W=map(int,input().split())
l=[]
for i in range(H):
  l.append(list(map(int,input().split())))
  
x,y=0,0
p=1
J=[]
ans=0
if(H,W)==(1,1):
  print(0)
else:
  while y<H:
    if y%2==0:
      if x<W-1:
        nx=x+1
        ny=y
      else:
        nx=x
        ny=y+1
    else:
      if x>0:
        nx=x-1
        ny=y
      else:
        nx=x
        ny=y+1
    if l[y][x]%2==1:
      l[ny][nx]+=1
      ans+=1
      J.append((y+1,x+1,ny+1,nx+1))
    x,y=nx,ny
    if x==[0,W-1][H%2] and y==H-1:
      break

  print(ans)
  for a,b,c,d in J:
    print(a,b,c,d)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
l=[]
for i in range(H):
  l.append(list(map(int,input().split())))
  
x,y=0,0
p=1
J=[]
ans=0
while y<H:
  if y%2==0:
    if x<W-1:
      nx=x+1
      ny=y
    else:
      nx=x
      ny=y+1
  else:
    if x>0:
      nx=x-1
      ny=y
    else:
      nx=x
      ny=y+1
  if l[y][x]%2==1:
    l[ny][nx]+=1
    ans+=1
    J.append((y+1,x+1,ny+1,nx+1))
  x,y=nx,ny
  if x==[0,W-1][H%2] and y==H-1:
    break

print(ans)
for a,b,c,d in J:
  print(a,b,c,d)

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
l=[]
for i in range(H):
  l.append(list(map(int,input().split())))
  
x,y=0,0
p=1
J=[]
ans=0
while y<H:
  if y%2==0:
    if x<W-1:
      nx=x+1
      ny=y
    else:
      nx=x
      ny=y+1
  else:
    if x>0:
      nx=x-1
      ny=y
    else:
      nx=x
      ny=y+1
  if l[y][x]%2==1:
    l[ny][nx]+=1
    ans+=1
    J.append((x,y,nx,ny))
  x,y=nx,ny
  if x==[0,W-1][H%2] and y==H-1:
    break

print(ans)
for a,b,c,d in J:
  print(a,b,c,d)
Problem p03289 (python)

Fixed submission:
S=input()
c=0
if S[0]=="A" and "C" in S[2:len(S)-1]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")

Buggy submission (verdict: Runtime Error):
S=input()
s=abcdefghijklmnopqrstuvwxyz
c=0
if S[0]=="A" and "C" in S[2:len(S-1)]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")
Problem p03308 (python)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
ans=0
for i in range(N):
  for j in range(i+1,N):
    ans=max(ans,abs(A[i]-A[j]))
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]
ans=0
for i in range(N):
  for j in range(i+1,N):
    ans=max(ans,abs(A[i]-A[j])
print(ans)
Problem p03309 (python)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
for i in range(N):
  A[i]=A[i]-1-i
A.sort()
if N==1:
  print(0)
else:
  b=A[N//2]
  c=A[(N//2)+1]
  ans1,ans2=0,0
  for i in range(N):
    ans1+=abs(A[i]-b)
    ans2+=abs(A[i]-c)
  print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]
for i in range(N):
  A[i]=A[i]-1-i
b=A[N//2]
c=A[(N//2)+1]
ans1,ans2=0,0
for i in range(N):
  ans1+=abs(A[i]-b)
  ans2+=abs(A[i]-c)
print(min(ans1,ans2))
Problem p03353 (python)

Fixed submission:
s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort(reverse=True)
st=[]
while len(st)<K:
  t=li.pop()
  if t not in st:
    st.append(t)
print(st[-1])

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort()
print(li[K])

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i-1)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort()
print(li[K])
Problem p03435 (python)

Fixed submission:
L=[]
for i in range(3):
  L.append(list(map(int,input().split())))
if all(L[i][0]-L[i+1][0]==L[i][1]-L[i+1][1]==L[i][2]-L[i+1][2] for i in range(2)) and all(L[0][i]-L[0][i+1]==L[1][i]-L[1][i+1]==L[2][i]-L[2][i+1] for i in range(2)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
L=[]
for i in range(3):
  L.append(list(map(int,input().split())))
if all(S[i][0]-S[i+1][0]==S[i][1]-S[i+1][1]==S[i][2]-S[i+1][2] for i in range(2)) and all(S[0][i]-S[0][i+1]==S[1][i]-S[1][i+1]==S[2][i]-S[2][i+1] for i in range(2)):
  print("Yes")
else:
  print("No")
Problem p03457 (python)

Fixed submission:
N=int(input())
t,x,y=0,0,0
s=0
for i in range(N):
  a,b,c=map(int,input().split())
  p,q=a-t,abs(b-x)+abs(c-y)
  if p<q or p%2!=q%2:
    s=1
    break
  t,x,y=a,b,c
print("No" if s else "Yes")

Buggy submission (verdict: Runtime Error):
N=input()
t,x,y=0,0,0
s=0
for i in range(N):
  a,b,c=map(int,input().split())
  if a-t!=abs(b-x)+abs(c-y):
    s=1
    break
  t,x,y=a,b,c
print("No" if s else "Yes")
Problem p03472 (python)

Fixed submission:
N,H=map(int,input().split())
sl=[]
th=[]
for i in range(N):
  s,t=map(int,input().split())
  sl.append(s)
  th.append(t)
th.sort()
gsl=max(sl)
ans=0
while th:
  if gsl<th[-1]:
    at=th.pop(-1)
    H-=at
    ans+=1
    if H<=0:
      break
  else:
    ans+=H//gsl
    if H%gsl!=0:
      ans+=1
    break
else:
  ans+=H//gsl
  if H%gsl!=0:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,H=map(int,input().split())
sl=[]
th=[]
for i in range(N):
  s,t=map(int,input().split())
  sl.append(s)
  th.append(t)

gsl=max(sl)
ans=0
while H>0:
  if gsl<max(th):
    at=max(th)
    H-=at
    ans+=1
    th.remove(at)
  else:
    ans+=H//gsl
    if H%gsl!=0:
      ans+=1
    break
print(ans)
Problem p02613 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print('{0} x {1}'.format(v, s.count(v)))

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print({0}×{1}.format(v, s.count(v)))
Problem p02614 (python)

Fixed submission:
h,w,k=map(int, input().split())
board = [list(input()) for _ in range(h)]
ans=0
for paint_h in range(2**h):
  for paint_w in range(2**w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
          if board[i][j]=='#':
            cnt+=1
    if cnt==k:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
h,w,k=map(int, input().split())
board = [list(input()) for _ in range(h)]
ans=0
for paint_h in range(2**h):
  for paint_w in range(2**w):
    cnt=0
    for i in range(h):
      for j in range(w):
        if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
          if board[i][j]=='#':
            cnt+=1
    if cnk==l:
      ans += 1
print(ans)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print('{:.16g}'.format(1 / sum(1 / x for x in A)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split)
print('{:.16g}'.format(1 / sum(x for x in A)))
Problem p02606 (python)

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

count = 0

for i in range(101):
  if d * i >= L and d * i <= R:
    count += 1
  if d * i > R:
    break
    
print(count)

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

for i in range(0,n,2):
  if a[i] % 2 == 1:         
    ans += 1 
print(ans)
Problem p02640 (python)

Fixed submission:
x, y = map(int, input().split())
ans = 'No'

for i in range(x + 1):
	j = x - i
	if i * 2 + j * 4 == y:
		ans = 'Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

x, y = map(int, input().split())

for i in range(x + 1):
  for j in range(x + i):
    if i * 2 + j * 4 == y and i + j == X:
      print('yes')
      sys.exit()
 
print('no')
Problem p02705 (python)

Fixed submission:
import math

r = int(input())

print(2 * r * math.pi)

Buggy submission (verdict: Runtime Error):
import collections 

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

c = collections.Counter(a)

for i in range(1, n + 1):
  print(c[i])
Problem p02727 (python)

Fixed submission:
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)

ans = p[:x] + q[:y] + r
ans.sort(reverse = True)

print(sum(ans[:x + y]))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)

ans = p[:x] + q[:y]

for i in range(x + y):
  if ans[i] < r[0]:
    ans[i] = r[0]
    r.pop(0)

print(sum(ans))
Problem p02811 (python)

Fixed submission:
K, X = map(int, input().split())

if 500 * K >= X:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
from itertools import permutations

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
num_P = 0
num_Q = 0

li = list(permutations(range(1, N + 1)))

#print(P, Q, li)
print(abs(li.index(P) - li.index(Q)))
#print(li)
#print(li.index(P))
#print(li.index(Q))
Problem p02818 (python)

Fixed submission:
A, B, K = map(int, input().split())

A_after = 0
B_after = 0

if A - K >= 0:
  A_after = A - K
  B_after = B

elif A + B - K >= 0:
  B_after = B - (K - A)
  
print(A_after, B_after)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())

A_after = A - K

if A < K:
  B_after = B - (K - A)
  A_after = 0
  
print(A_after, B_after)
Problem p02582 (python)

Fixed submission:
A = input()
count = 0
for a in range(3):
    if A[a] == 'R':
      count+=1
      
if count == 2 and A[1] == 'S':
      count = 1
print(count)

Buggy submission (verdict: Runtime Error):
A = input().split()
count = 0
for a in range(3):
    if A[a] == 'R':
      count++
      
if count == 2 A[1] == 'S':
      count = 1
print(count)

Buggy submission (verdict: Runtime Error):
A = input().split()
count = 0
for a in range(3)
    if A[a] == 'R':
      count++
      
if count == 2 A[1] == 'S':
      count = 1
print(count)
Problem p02675 (python)

Fixed submission:
N = input()
N = int(N[-1])
if N == 3:
    print('bon')
elif N in [0,1,6,8]:
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
N = input()
N = int(N[2])
if N == 3:
    print('bon')
elif N in [0,1,6,8]:
    print('pon')
else:
    print('hon')

Buggy submission (verdict: Runtime Error):
N = input()
N = N[2]
if N == 3:
    print('bon')
elif N in [0,1,6,8]:
    print('pon')
else:
    print('hon')
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
if S == T[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
if S == T[:-1]:
    return 'Yes'
else:
    return 'No'
Problem p02718 (python)

Fixed submission:
N,M = map(int, input().split())
x = list(map(int, input().split()))
total_vote = sum(x)
count = 0
for y in x:
    if y >=(total_vote/(4*M)):
        count+=1
      
if count>=M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
x = input()
total_vote = sum(x)
count = 0
for y in x:
    if y >=(total_vote/(4*M)):
        count+=1
      
if count>=M:
    print('Yes')
else:
    print('No')
Problem p02719 (python)

Fixed submission:
N, K = map(int, input().split())
N, K = map(abs, (N,K))
amari = N%K
if amari == 0:
    print(0)
else:
    amari2 = K - amari
    print(min(amari, amari2))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
N, K = map(abs, (N,K))
amari = N%K
if amari == 0:
    print(0)
else:
    amari2 = K - amari
    print(max(amari, amari2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
N, K = map(abs, (N,K))
amari = N%K
if amari == 0:
    print(0)
else:
    amari2 = K - amari
    print(max(amari, amari2)