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

Fixed submission:
#!/usr/bin/env python3
# Daydream
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

tokens = ['dream', 'dreamer', 'erase', 'eraser']

def solve(S: str):
    print(YES if is_valid2(S) else NO)
    return

def is_valid(S):
    if S == '':
        return True
    for token in tokens:
        sub = S[-len(token):]
        if sub == token:
            return is_valid(S[:-len(token)])
    return False

def is_valid2(S):
    import re
    x = r"^(dream|dreamer|erase|eraser)*$"
    return True if re.match(x, S) else False

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# Daydream
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

tokens = ['dream', 'dreamer', 'erase', 'eraser']

def solve(S: str):
    print(YES if is_valid(S) else NO)
    return

def is_valid(S):
    if S == '':
        return True
    for token in tokens:
        sub = S[-len(token):]
        if sub == token:
            return is_valid(S[:-len(token)])
    return False

def is_valid2(S):
    import re
    x = r"^(dream|dreamer|erase|eraser)*$"
    return True if re.match(x, S) else False

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# Daydream
import sys

YES = "YES"  # type: str
NO = "NO"  # type: str

tokens = ['dream', 'dreamer', 'erase', 'eraser']

def solve(S: str):
    print(YES if is_valid(S) else NO)
    return

def is_valid(S):
    if S in tokens:
        return True
    for token in tokens:
        sub = S[-len(token):]
        if sub == token:
            return is_valid(S[:-len(token)])
    return False


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()
Problem p03079 (python)

Fixed submission:
A, B, C = [int(i) for i in input().split()]

if A == B & B == C:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, Q = [int(i) for i in input().split()]
g = [1] * N

s = input()
dict = {}
for i in range(N):
  if s[i] not in dict:
    dict[s[i]] = []
  dict[s[i]].append({ "L": i - 1, "R": i + 1, "P": i })

for i in range(Q):
  t_i, d_i = input().split()
  if t_i not in dict:
    continue
  for x in dict[t_i]:
    if x[d_i] < 0:
      g[x["P"]] = 0
      continue
    elif x[d_i] >= N:
      g[x["P"]] = 0
      continue
    else:
      g[x[d_i]] += g[x["P"]]
      g[x["P"]] = 0

print(sum(g))
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]

memo = []
for i in range(N):
  if i == 0:
    memo.append(0)
  elif i == 1:
    memo.append(memo[i - 1] + abs(h[i - 1] - h[i]))
  else:
    j1 = memo[i - 1] + abs(h[i - 1] - h[i])
    j2 = memo[i - 2] + abs(h[i - 2] - h[i])
    memo.append(j1 if j1 < j2 else j2)

print(memo[N - 1])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N = int(input())
h = [int(i) for i in input().split()]

memo = {}

def f(i):
  if i == 0:
    return 0
  if i == 1:
    return abs(h[i - 1] - h[i])
  else:
    if i - 1 not in memo:
      memo[i - 1] = f(i - 1)
    if i - 2 not in memo:
      memo[i - 2] = f(i - 2)
    j1 = memo[i - 1] + abs(h[i - 1] - h[i])
    j2 = memo[i - 2] + abs(h[i - 2] - h[i])
    return j1 if j1 < j2 else j2

print(f(N - 1))

Buggy submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]

memo = {}

def f(i):
  if i == 0:
    return 0
  if i == 1:
    return abs(h[i - 1] - h[i])
  else:
    if i - 1 not in memo:
      memo[i - 1] = f(i - 1)
    if i - 2 not in memo:
      memo[i - 2] = f(i - 2)
    j1 = memo[i - 1] + abs(h[i - 1] - h[i])
    j2 = memo[i - 2] + abs(h[i - 2] - h[i])
    return j1 if j1 < j2 else j2

print(f(N - 1))
Problem p03597 (python)

Fixed submission:
one_side=input()
oneside=int(one_side)
whole=oneside**2
white_side=input()
whiteside=int(white_side)
print(whole-whiteside)

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

x=list(map(int,input().split()))
a=0
for i in range(n):
  a+=min(x[i]*2,(k-x[i])*2)
  
print(a)
Problem p03598 (python)

Fixed submission:
n=int(input())
k=int(input())

x=list(map(int,input().split()))
a=0
for i in range(n):
  a+=min(x[i]*2,(k-x[i])*2)
  
print(a)

Buggy submission (verdict: Runtime Error):
l
Problem p03079 (python)

Fixed submission:
def regtri(a, b, c):
    if a == b and b == c:
        return 'Yes'
    else:
        return  'No'
 
a, b, c = (int(i) for i in input().split())
print(regtri(a, b, c))

Buggy submission (verdict: Runtime Error):
def regtri(a, b, c):
    if a == b && b == c:
        returm 'Yes'
    else:
        return 'No'

a, b, c = (int(i) for i in input().split())
regtri(a, b, c)
Problem p03080 (python)

Fixed submission:
def red_or_blue(N, s):
  s_1 = [x for x in s]
  l_r = s_1.count('R')
  l_b = s_1.count('B')
  if l_r > l_b:
    return 'Yes'
  else:
    return 'No'

i = [input() for i in range(2)]
N = i[0]
s = i[1]
print(red_or_blue(N, s))

Buggy submission (verdict: Runtime Error):
def red_or_blue(N, s):
  s_1 = [x for x in s]
  l_r = s_1.count('R')
  l_b = s_1.count('B')
  if l_r > l_b:
    return 'Yes'
  else:
    return 'No'

i = input().split() 

N = i[0]
s = i[1]
print(red_or_blue(N, s))
Problem p03079 (python)

Fixed submission:
import sys

a,b,c = map(int,input().split())

val = [a,b,c]

for i in val:
    if 1 >= i and i <= 100:
        print('No')
        sys.exit()

if val[0] == val[1] and val[1] == val[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

val = [int(args[1]),int(args[2]),int(args[3])]

for i in val:
    if 1 >= i and i <= 100:
        print('No')
        sys.exit()

if val[0] == val[1] and val[1] == val[2]:
    print('Yes')
else:
    print('No')
Problem p03219 (python)

Fixed submission:
#!/usr/bin/env python3

if __name__ == "__main__":
    t,b = map(int, input().split())
    print(t +b//2)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

from collections import defaultdict

def tostring(p,j):
    p = str(p+1)
    j = str(j+1)
    return (6 - len(p))*"0" + p + (6-len(j)) *"0" + j


if __name__ == "__main__":
    N, M = map(int, input().split())

    py = [[] for _ in range(N)]

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

    for i in range(M):
        p,y = dat[i]
        py[p-1].append((y,i))
    
    for p in range(N):
        py[p] = sorted(py[p])
    
    answer = M * [None]

    for p in range(N):
        for j in range(len(py[p])):
            y,i = py[p][j]
            answer[i]= tostring(p,j)
    
    for a in answer:
        print(a)
Problem p03079 (python)

Fixed submission:
abc=input().split()
if abc[0] == abc[1] and abc[1]==abc[2]:
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
abc=input().split()
if abc[0] == abc[1] and abc[1]==abc[2]
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
if a==b and b==c:
    print("Yes")
else:
    print("No")
Problem p03080 (python)

Fixed submission:
n=int(input())
string=input()
cnt=0
for color in string:
  if color == "R":
    cnt += 1
  else:
    cnt += -1

if cnt > 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
sring=input()
cnt=0
for color in string:
  if color == "R":
    cnt += 1
  else:
    cnt += -1

if cnt > 0:
  print("Yes")
else:
  print("No")
Problem p03081 (python)

Fixed submission:
N,Q=map(int,input().split())
s="0"+input()+"0"
queri=[input().split() for i in range(Q)]
 
L,R=0,N+1
for i in range(Q-1,-1,-1):
    t,d=queri[i]
    if t==s[L] and d=="R":
        L-=1
    elif t==s[L+1] and d=="L":
        L+=1
    if t==s[R] and d=="L":
        R+=1
    elif t==s[R-1] and d=="R":
        R-=1
 
print(R-L-1)

Buggy submission (verdict: Runtime Error):
nq=input().split()
n=int(nq[0])
q=int(nq[1])
block_word=[""]
block_num=[""]
block_move=[""]
golem=n
s=input()
t=""
d=""

for i in range(q):
  block_num += [1]

for word in s:
  block_word += [word]
  block_move+=[0]

for i in range(q):
  td=input().split()
  t=td[0]
  d=td[1]
  for j in range(1,n+1):
    if t==block_word[j]:
      if j==n and d=="R":
        golem-=block_num[n]
        block_num[n]=0
      elif j==1 and d=="L":
        golem-=block_num[1]
        block_num[1]=0
      else:
        if d=="R":
          block_move[j+1]=block_num[j]
          block_num[j]=0
        if d=="L":
          block_move[j-1]=block_num[j]
          block_num[j]=0
    else:
        block_move[j]=0
  for k in range(1,n+1):
    block_num[k]+=block_move[k]
  for i in range(1,n+1):
    block_move[i]=0

print(golem)

Buggy submission (verdict: Runtime Error):
nq=input().split()
n=int(nq[0])
q=int(nq[1])
block_word=[""]
block_num=[""]
block_move=[""]
golem=n
s=input()
t=""
d=""

for i in range(q):
  block_num += [1]

for word in s:
  block_word += [word]
  block_move+=[0]

for i in range(q):
  print(golem)
  td=input().split()
  t=td[0]
  d=td[1]
  for j in range(1,n+1):
    if t==block_word[j]:
      if j==n and d=="R":
        golem-=block_num[n]
        block_num[n]=0
      elif j==1 and d=="L":
        golem-=block_num[1]
        block_num[1]=0
      else:
        if d=="R":
          block_move[j+1]=block_num[j]
          block_num[j]=0
        if d=="L":
          block_move[j-1]=block_num[j]
          block_num[j]=0
    else:
        block_move[j]=0
  for k in range(1,n+1):
    block_num[k]+=block_move[k]
  for i in range(1,n+1):
    block_move[i]=0

print(golem)
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
ans = H * W - h * W - w * H + h * w
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
for i in range(1, N + 1):
    Ai = [int(_) for _ in input().split()]
right = 0
for i in range(1,N + 1):
    for j in range(M):
        a = 0
        a += Ai[j] * B[j]
    if a + C > 0:
        right += 1
print(right)
Problem p03102 (python)

Fixed submission:
N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
A = []
for i in range(N):
    A.append([int(_) for _ in input().split()])

right = 0

for i in range(N):
    src = 0
    for j in range(M):
        src += A[i][j]*B[j]
    if src+C>0:
        right+=1

print(right)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
A = []
for i in range(N):
    A.append([int(_) for _ in input().split()])

right = 0

for i in range(N):
    src = 0
    for j in range(M):
        src += A[i][j]*B[j]
    if src + C >0 :
        right + =1

print(right)

Buggy submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
B = [int(_) for _ in input().split()]
for i in range(1, N + 1):
    Ai = [int(_) for _ in input().split()]

right = 0

for j in range(1,N + 1):
  src = 0
  for k in range(M):
    src += Aj[k] * B[k]
  if src + C > 0:
    right += 1

print(right)
Problem p03415 (python)

Fixed submission:
s1 = input()
s2 = input()
s3 = input()
ans = s1[0] + s2[1] + s3[2]
print(ans)

Buggy submission (verdict: Runtime Error):
s1 = input()
s2 = input()
s3 = input()
ans = s1[0] + s2[1] + s3[3]
print(ans)
Problem p03469 (python)

Fixed submission:
s = input()
s = s.replace('7','8',1)
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s = input()
pirnt(s.count('1'))
Problem p03711 (python)

Fixed submission:
x, y = map(int, input().split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]
A = x in list1 and y in list1
B = x in list2 and y in list2
C = x in list3 and y in list3
if A == True or B == True or C == True:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
list1 = [1, 3, 5, 7, 8, 10, 12]
list2 = [4, 6, 9, 11]
list3 = [2]
if (x in list1 and y in list1)　or (x in list2 and y in list2) or (x in list3 and y in list3):
  print('Yes')
else:
  print('No')
Problem p03080 (python)

Fixed submission:
num = int(input())
hats = input()

rhat = len([hat for hat in hats if hat == "R"])
bhat = len([hat for hat in hats if hat == "B"])

if rhat > bhat:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
num = int(input())
hats = input()

rhat = len([hat for hat in fats if hat == "R"])
bhat = len([hat for hat in fats if hat == "B"])

if rhat > bhat:
    print("Yes")
else:
    print("No")
Problem p03417 (python)

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

if n==1 and m==1:
    print(1)
elif n==1 and m!=1:
    print(m-2)
elif n!=1 and m==1:
    print(n-2)
else:
    print((n-2)*(m-2))

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

if n==1 and m==1:
    print(1)
elif n==1 and m!=1:
    print(m-2)
elif n!=1 and m==1:
    print(n-2)
else:
    print((n-2)*(m-2)
Problem p03606 (python)

Fixed submission:
n=int(input())

ans=0

for i in range(n):
    l,r=map(int,input().split())
    ans+=r-l+1

print(ans)

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

ans=0

for i in range(n):
    l,r=map(int,input())
    ans+=r-l+1

print(ans)

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

ans=0

for i in range(N):
    l,r=map(int,input())
    ans+=r-l+1

print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
a={}
for i in range(n):
    b=int(input())
    if b in a:
        del a[b]
    else:
        a[b]=1

print(len(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a={}
for i in range(n):
    b=int(input())
    if b in a[b]:
        del a[b]
    else:
        a[b]=1

print(len(a))
Problem p03089 (python)

Fixed submission:
_ = input()
data = list(map(int, input().split()))

result = []
pos = min(len(data), max(data)) - 1

while pos >= 0:
    if data[pos] == pos + 1:
        x = data.pop(pos)
        #print('remove {0} {1}'.format(x, data))
        result.append(x)
        if len(data) == 0:
            break
        pos = min(len(data), max(data)) - 1
    else:
        pos -= 1

if len(data) == 0:
    result.reverse()
    for res in result:
        print(res)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
def remove(data):
    global result
    pos = min(len(data), max(data))
    for n in range(pos-1, -1, -1):
        if data[n] == n + 1:
            result.append(data.pop(n))
            #print('remove {0} '.format(n + 1), end='')
            if len(data) == 0:
                #print('OK')
                return True
            else:
                #print(data)
                if remove(data):
                    return True
    else:
        return False

_ = input()
B = list(map(int, input().split()))

result = []

if remove(B):
    result.reverse()
    for res in result:
        print(res)
else:
    print(-1)
Problem p03139 (python)

Fixed submission:
line = input().split()
N = int(line[0])
A = int(line[1])
B = int(line[2])
print(min(A, B), max(A + B - N, 0))

Buggy submission (verdict: Runtime Error):
N = int(input())
happiness = []

for n in range(N):
    num = input().split()
    a = int(num[0])
    b = int(num[1])
    happiness.append([a + b, a, b])

happiness.reverse()

sum = 0
turn = 0

for n in range(N):
    if turn == 0:
        sum += happiness[n][1]
    else:
        sum -= happiness[n][2]
    turn ^= 1

print(sum)
Problem p03200 (python)

Fixed submission:
S = input()
N = len(S)

count = 0
num = 0
idx = -1
while True:
  idx = S.find('W', idx + 1)
  if idx < 0:
    break
  count += idx - num
  num += 1

print(count)

Buggy submission (verdict: Runtime Error):
# AtCoder Grand Contest 029
# December 15, 2018
#

S = input()
count = 0

while True:
  if S.find('BW') >= 0:
    S = S.replace('BW', 'WB', 1)
    count += 1
    print(S)
  else:
    break

print(count)
Problem p03080 (python)

Fixed submission:
n=int(input())
s = str(input())
count=0
for i in range(n):
    if s[i]=='R':
        count+=1
        
if count > n-count:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s = str(input())
count=0
for i in range(n):
    if s[i]=='R':
        count+=1
        
if count > n-count:
    printr('Yes')
else:
    print('No')
Problem p03087 (python)

Fixed submission:
N,Q = list(map(int, input().split()))
S = str(input())
lr=[]
for i in range(Q):
    lr.append(list(map(int, input().split())))


count=[0 for i in range(N)]
ind=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        ind+=1
    count[i+1]+=count[i+1]+ind

for i,j in lr:
    print(count[j-1]-count[i-1])

Buggy submission (verdict: Runtime Error):
N,Q = list(map(int, input().split()))
S = str(input())
lr=[]
for i in range(Q):
    lr.append(list(map(int, input().split())))


count=[0 for i in range(N)]
ind=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
      	ind+=1
        count[i+1]+=count[i+1]+ind

for i,j in lr:
    print(count[j-1]-count[i-1])

Buggy submission (verdict: Runtime Error):
N,Q = list(map(int, input().split()))
S = str(input())
lr=[]
for i in range(Q):
    lr.append(list(map(int, input().split())))


count=[0 for i in range(N)]
ind=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
      	ind+=1
        count[i+1]+=ind

for i,j in lr:
    print(count[j-1]-count[i-1])
Problem p03103 (python)

Fixed submission:
N,M = list(map(int, input().split()))
lis=[]
for i in range(N):
    a,b = list(map(int, input().split()))
    lis.append([a,b])

lis.sort()

count=0
money=0
ind=0
while count+lis[ind][1]<M:
    count+=lis[ind][1]
    money+=lis[ind][0]*lis[ind][1]
    ind+=1
    #print(ind)
    

money+=(M-count)*lis[ind][0]
print(int(money))

Buggy submission (verdict: Runtime Error):
N,M = list(map(int, input().split()))
lis=[]
for i in range(N):
    a,b = list(map(int, input().split()))
    lis.append([a,b])

lis.sort()

count=0
money=0
ind=0
while count+lis[ind][1]<=M:
    count+=lis[ind][1]
    money+=lis[ind][0]*lis[ind][1]
    ind+=1
    print(ind)
    

money+=(M-count)*lis[ind][0]
print(int(money))
Problem p03126 (python)

Fixed submission:
N, M = list(map(int, input().split())) # 整数
a = []
for i in range(N):
    a.append(list(map(int, input().split())))
    

m_lis= [0 for i in range(M+1)]
for i in range(N):
    for j in range(a[i][0]):
        m_lis[a[i][j+1]]+=1
        
        

count=0
for i in range(M+1):
    if m_lis[i]==N:
        count+=1
        
print(count)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split())) # 整数
a = []
for i in range(N):
    a.append(list(map(int, input().split())))
    

m_lis= [0 for i in range(M)]
for i in range(N):
    for j in range(a[i][0]):
        m_lis[a[i][j+1]]+=1
        
        

count=0
for i in range(N+1):
    if m_lis[i]==N:
        count+=1
        
print(count)
Problem p03129 (python)

Fixed submission:
N,K = list(map(int,input().split()))
if N >= 2*K -1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
K,A,B = list(map(int,input().split()))
if A>=B-2:
    answer = K+1
elif A+1>K:
    answer=K+1
else:
  # gutyoku
    first = A
    rest = K - (A-1) - 2
    if rest%2==0:
        answer = (rest/2+1)*B - (rest/2)*A
    else:
        #print('else')
        answer = ((rest-1)/2+1)*B - ((rest-1)/2)*A+1
    
print(int(answer))

Buggy submission (verdict: Runtime Error):
K,A,B = list(map(int,input().split()))
if A>=B-2:
    answer = K+1
else:
  # gutyoku
    first = A
    rest = K - A -1
    if rest%2==0:
        answer = (rest/2+1)*B - (rest/2)*A
    else:
        #print('else')
        answer = ((rest-1)/2+1)*B - ((rest-1)/2)*A+1
    
print(int(answer))
Problem p03140 (python)

Fixed submission:
n= int(input())

a=  input()
b = input()
c = input()

totalcount=0
for i in range(n):
    count=2
    if a[i] == b[i]:
        count=1
        if  b[i]==c[i]:
            count=0
    elif a[i] == c[i]:
        count=1
    elif b[i]==c[i]:
        count=1
    totalcount+=count
print(totalcount)

Buggy submission (verdict: Runtime Error):
totalcount=0
for i in range(n):
    count=2
    if a[i] == b[i]:
        count=1
        if  b[i]==c[i]:
            count=0
    elif a[i] == c[i]:
        count=1
    elif b[i]==c[i]:
        count=1
    totalcount+=count
print(totalcount)
Problem p03155 (python)

Fixed submission:
n1=int(input())
n2=int(input())
n3=int(input())
out=(n1-n2+1)*(n1-n3+1)
print(out)

Buggy submission (verdict: Runtime Error):
n1=input()
n2=input()
n3=input()
out=(n1-n2+1)*(n1-n3+1)
print(out)

Buggy submission (verdict: Runtime Error):
n1, n2, n3 = list(map(int, input().split()))
print((n1-n2+1)*(n1-n3+1))

Buggy submission (verdict: Runtime Error):
n1, n2, n3 = list(map(int, input().split()))
print((n1-n2)*(n1-n3))
Problem p03156 (python)

Fixed submission:
N=int(input())
A,B  = list(map(int, input().split()))
lis = list(map(int, input().split()))
lis_1=[]
lis_2=[]
lis_3=[]
for i in lis:
    if i <= A:
       lis_1.append(i)
    elif i > A and i <=B:
       lis_2.append(i)
    else:
       lis_3.append(i)

print(min([len(lis_1),len(lis_2),len(lis_3)]))

Buggy submission (verdict: Runtime Error):
N=int(input())
A,B  = list(map(int, input().split()))
lis = list(map(int, input().split()))
lis_1=[]
lis_2=[]
lis_3=[]
for i in lis:
    if i <= A:
       lis_1.append(i)
    elif i > A and i <=B:
       lis_2.append(i)
    else:
       lis_3.append(i)

print(min[len(lis_1),len(lis_2),len(lis_3)])

Buggy submission (verdict: Runtime Error):
N=int(input())
A,B  = list(map(int, input().split()))
lis = list(map(int, input().split()))
lis_1=[]
lis_2=[]
lis_3=[]
for i in lis:
   if i <= A:
      lis_1.append(i)
   elif i > A and i <=B:
      lis_2.append(i)
   else:
      lis_3.append(i)

print(min[len(lis_1),len(lis_2),len(lis_3)])

Buggy submission (verdict: Runtime Error):
N=int(input())
A,B  = list(map(int, input().split()))
lis = list(map(int, input().split())))
lis_1=[]
lis_2=[]
lis_3=[]
for i in lis:
   if i <= A:
      lis_1.append(i)
   elif i > A and i <=B:
      lis_2.append(i)
   else:
      lis_3.append(i)

print(min[len(lis_1),len(lis_2),len(lis_3)])
Problem p03607 (python)

Fixed submission:
n = int(input())
lis=[]
for i in range(n):
    lis.append(int(input()))

lis.sort()

count=0
while len(lis)>1:
    if lis[0]==lis[1]:
        del lis[:2]
    else:
        del lis[0]
        count+=1
print(count+len(lis))

Buggy submission (verdict: Runtime Error):
n = int(input())
lis=[]
for i in range(n):
    lis.append(int(input()))

lis.sort()

count=0
while len(lis)>0:
    if lis[0]==lis[1]:
        del lis[:2]
    else:
        del lis[0]
        count+=1
print(count)
Problem p03254 (python)

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

y = x
cnt = 0
for ai in a:
    if y - ai >= 0:
        y -= ai
        cnt += 1
if y and cnt == n:
    print(cnt - 1)
else:
    print(cnt)

Buggy submission (verdict: Runtime Error):
y = x
cnt = 0
for ai in a:
    if y - ai >= 0:
        y -= ai
        cnt += 1
if y and cnt == n:
    print(cnt - 1)
else:
    print(cnt)