Problem:


Score : 200 points

Problem Statement

You have written N problems to hold programming contests.
The i-th problem will have a score of P_i points if used in a contest.

With these problems, you would like to hold as many contests as possible under the following condition:

A contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.

The same problem should not be used in multiple contests.
At most how many contests can be held?

Constraints

3 \leq N \leq 100

1 \leq P_i \leq 20 (1 \leq i \leq N)

1 \leq A < B < 20

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A B
P_1 P_2 ... P_N

Output

Print the answer.

Sample Input 1

7
5 15
1 10 16 2 7 20 12

Sample Output 1

2

Two contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.

Sample Input 2

8
3 8
5 5 5 10 10 10 15 20

Sample Output 2

0

No contest can be held, because there is no problem with a score of A = 3 or less.

Sample Input 3

3
5 6
5 6 10

Sample Output 3

1



Sample input:
7
5 15
1 10 16 2 7 20 12


Sample output:
2

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p_list = list(map(int,input().split()))
ans=0
for i in range(n-2):
    if p_list[i]>a:continue
    if p_list[i+1]<=a or p_list[i+1]>b:continue
    if p_list[i+2]<=b:continue
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n=int(input())
a,b=map(int,input().split())
p_list = list(map(int,input().split()))
ans=0
for i in range(n-2):
    if p_list[i]>a:continue
    if p_list[i+1]>b:continue
    if p_list[i+2]<=b:continue
    ans+=1
    i+=3
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n=int(input())
a,b=map(int,input().split())
p_list = list(map(int,input().split()))
ans=0
for i in range(n-2):
    if p_list[i]>a:continue
    if p_list[i+1]>b:continue
    if p_list[i+2]<=b:continue
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=map(int,input().split())
p = list(map(int,input().split()))
c=[]
d=[]
e=[]
for i in range(N):
    if p[i]<=A:
        c.append(p[i])
    if A+1 <= p[i] <= B:
        d.append(p[i])
    if B+1 <= p[i]:
        e.append(p[i])

print(len(min(c,d,e)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
a = len([*filter(lambda x: x<=A,P)])
b = len([*filter(lambda x: A<x<=B,P)])
c = len([*filter(lambda x: B<=x,P)])
print(min(a,b,c))

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b, = map(int,input().split())
p = list(map(int,input().split()))
cnt = 0
num = 1
for i in range(n):
    if num == 1 and p[i] <= a:
        num = 2
    elif num == 2 and a+1 <= p[i] <= b:
        num =3
    elif num == 3 and p[i] >= b+1:
        cnt += 1
        num = 1
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B+1:
    count3 += 1
    continue
  if P[i] >= A+1:
    count2 += 1
count4 = max(count2,count3)
print(min(count1,count4))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B+1:
    count3 += 1
    continue
  if P[i] >= A+1:
    count2 += 1
count4 = max(count2,count3//2)
print(min(count1,count4))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B+1:
    count3 += 1
  if P[i] >= A+1:
    count2 += 1
if count2 == count3:
  print(min(count1,count2//2))
else:
  print(min(count1,count2,count3))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B+1:
    count3 += 1
  if P[i] >= A+1:
    count2 += 1

print(min(count1,count2,count3))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B:
    count3 += 1
  if P[i] >= A+1:
    count2 += 1

print(min(count1,count2,count3))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
count1,count2,count3 = 0,0,0
for i in range(N):
  if P[i] <= A:
    count1 += 1
  if P[i] >= B:
    count3 += 1
  if P[i] >= A+1:
    count2 += 1

print(min(count1,count3))

Submission status: Wrong Answer

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a,b=nii()
p=lnii()

x=0
y=0
z=0

for i in p:
  if i<=a:
    x+=1
  if i>=b+1:
    z+=1
  else:
    y+=1

print(min(x,y,z))

Submission status: Wrong Answer

Solution code:
def main():
    n=int(input())
    a,b=map(int, input().split())
    p = sorted(map(int,input().split()))
    A,B,C = -1,-1,-1
    for i in range(n):
        if A == -1 and p[i] > a:
            A = i
        elif B == -1 and p[i] > b:
            B = i-A
            C = n - A - B
            break
    print(min(A,B,C))
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

# import bisect
# import numpy as np
# from collections import deque
from collections import deque
# map(int, sys.stdin.read().split())
# import heapq
import bisect


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A, B = map(int, input().split())

    P = list(map(int, input().split()))
    first = 0
    second = 0
    other = 0
    for i in P:
        if i <= A:
            first += 1
        if i <= B:
            second += 1
        else:
            other += 1
    print(min(first, second, other))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int, input().split())
p = list(map(int, input().split()))

cnt=[0,0,0]
for poi in p:
  if poi <= a:
  	cnt[0]+=1
  elif poi <=b:
    cnt[1]+=1
  else:
    cnt[2]+=1
print(max(cnt))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A, B = [int(_) for _ in stdin.readline().rstrip().split()]
P = [int(_) for _ in stdin.readline().rstrip().split()]
a, ab, b = 0, 0, 0
for p in P:
    if p <= A:
        a += 1
    elif A+1 <= p <= B:
        ab += 1
    else:
        b += 1
print(min(a, ab, p))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A, B = [int(_) for _ in stdin.readline().rstrip().split()]
P = [int(_) for _ in stdin.readline().rstrip().split()]
a, ab, b = 0, 0, 0
for p in P:
    if p <= A:
        a += 1
    elif A+1 <= p <= B:
        ab += 1
    elif B+1 <= p:
        b += 1
print(min(a, ab, p))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A, B = [int(_) for _ in stdin.readline().rstrip().split()]
P = [int(_) for _ in stdin.readline().rstrip().split()]
a, ab, b = 0, 0, 0
for p in P:
    if p <= A:
        a += 1
    elif A < p <= B:
        ab += 1
    elif B < p:
        b += 1
print(min(a, ab, p))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
l=list(map(int,input().split()))

c0=0
c1=0
c2=0
for i in range(n):
    if l[i]<=a:
        c0+=1
    if a<=l[i]<=b:
        c1+=1
    if l[i]>=b:
        c2+=1
print(min(c0,c1,c2))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p=sorted(list(map(int,input().split())))
x,y=-1,-1
for i in range(n):
    if x==-1 and p[i]>a:
        x=i
    elif y==-1 and p[i]>b:
        y=i
if x==-1 or y==-1:
    print(0)
    exit()
print(min(x,y-x,n-y))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p=sorted(list(map(int,input().split())))
x,y=-1,-1
for i in range(n):
    if x==-1 and p[i]>a:
        x=i
    elif y==-1 and p[i]>b:
        y=i
print(max(0,min(x,y-x,n-y)))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    a,b=map(int,input().split())
    P=list(map(int,input().split()))
    L=[0,0,0]
    for i in range(n):
        if P[i]<=a:
            L[0]+=1
        elif a+1<=P[i]<=b:
            L[1]+=1
        else: L[2]+=2
    print(min(L))


    
resolve()

Submission status: Wrong Answer

Solution code:
n=int(input())
A,B=map(int, input().split())
P=list(map(int, input().split()))
s=0
w=0
t=0
l=[s,w,t]
for i in range(n):
  if P[i]<=A:
    s=P[i]
  elif P[i]>=A+1 and P[i]<=B:
    w=P[i]
  else:
    t=P[i]
if s!=0:
  if w!=0:
    if t!=0:
      print(3)
    else:
      print(2)
  else:
    print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
A,B=map(int, input().split())
p=list(map(int, input().split()))
p.sort()
t=0
y=0
u=0
g=0
for i in range(len(p)):
  if t==0 and p[i]<=A:
    t=p[i]
    g+=1
  elif y==0 and A+1<p[i] and p[i]<=B:
    y=p[i]
    g+=1
  elif u==0 and p[i]>=B+1:
      u=p[i]
if t!=0 and y!=0 and u!=0:
    print(3)
elif t!=0 and y!=0:
    print(2)
elif t!=0:
    print(1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
A,B=map(int, input().split())
p=list(map(int, input().split()))
p.sort()
t=0
y=0
u=0
g=0
for i in range(len(p)):
  if t==0 and p[i]<=A:
    t=p[i]
    g+=1
  elif y==0 and A+1<=p[i] and p[i]<=B:
    y=p[i]
    g+=1
  elif u==0 and p[i]>=B+1:
      u=p[i]
if t!=0 and y!=0 and u!=0:
    print(g)
elif t!=0 and y!=0:
    print(2)
elif t!=0:
    print(1)
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
A,B=map(int, input().split())
p=list(map(int, input().split()))
p.sort()
t=0
y=0
u=0
g=0
for i in range(len(p)):
  if t==0 and p[i]<=A:
    t=p[i]
    g+=1
  elif y==0 and A+1<=p[i] and p[i]<=B:
    y=p[i]
    g+=1
  elif u==0 and p[i]>=B+1:
      u=p[i]
print(g)

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int, input().split())
p=list(map(int, input().split()))
p.sort()
t=0
y=0
u=0
for i in range(len(p)):
  if i==0:
    t=p[i]
  elif t!=p[i]:
    y=p[i]
  elif t!=0 and y!=0:
    if y!=p[i]:
      u=p[i]
if t!=0 and y!=0 and u!=0:
  print(3)
elif t!=0 and y!=0:
  print(2)
elif t!=0:
  print(1)
else:
  print(0)

Submission status: Wrong Answer

Solution code:

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

l1 = []
l2 = []
l3 = []

for i in range(n):
    if p[i] <= a:
        l1.append(p[i])
 
for i in range(n):
    if a+1 <= p[i] <= b:
        l2.append(p[i])
 
for i in range(n):
    if b < p[i]:
        l3.append(p[i])

print(min(len(l1),len(l2),len(p)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int, input().split())
res = [0,0,0]
arr = list(map(int, input().split()))
for i in range(n):
  if arr[i] <= a:
    res[0] += 1
  elif arr[i] <= b:
    res[1] += 1
  else:
    res[2] += 1
print(min(arr))

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a,b = na()
p = na()
c = [0,0,0]

for i in p:
    if i <= a:
        c[0] += 1
    elif a+1 < i <= b:
        c[1] += 1
    else:
        c[2] += 1

print(min(c))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod_,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod_-2,mod_)*pow(fac[r],mod_-2,mod_))%mod_
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
#################################### ########
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
###################################################
def main():
    n=int(input())
    A,B=map(int,input().split())
    P=list(map(int,input().split()))
    C=[0,0,0]
    for a in P:
      if a<=A:
        C[0]+=1
      elif a+1<=A and a<=B:
        C[1]+=1
      else:
        C[2]+=1

    print(min(C))

main()

Submission status: Wrong Answer

Solution code:
n=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
C=[0,0,0]
for a in P:
  if a<=A:
    C[0]+=1
  elif a+1<=a and a<=B:
    C[1]+=1
  else:
    C[2]+=1
print(min(C))

Submission status: Wrong Answer

Solution code:
from bisect import *
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
a = bisect_right(P, A)
b = bisect_right(P, B)-a
c = N-b
print(min(a, b, c))

Submission status: Wrong Answer

Solution code:
n = int(input()) #問題数
a,b = map(int,(input().split())) 
p = list(map(int,(input().split()))) #点数
p.sort()

jouken1=[]
jouken2=[]
jouken3=[]
for i in range(len(p)):
    if a >= p[i]:
        jouken1.append(p[i])
    elif a + 1 <= p[i] <= b:
        jouken2.append(p[i])
    elif b + 1 <= p[i]:
        jouken3.append(p[i])
    else:
        break

result = jouken1
if result > jouken2:
    result = jouken2

if result > jouken3:
    result = jouken3

print(len(result))

Submission status: Wrong Answer

Solution code:
import bisect
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
x = bisect.bisect_left(p,a)
y = bisect.bisect_left(p,b)
one = p[:x]
two = p[x:y]
three = p[y:]
print(min(len(one),len(two),len(three)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans1 = 0
ans2 = 0
ans3 = 0  
for i in P:
    if A>=i:
        ans1 = ans1 + 1
    if A+1 <= i <= B+1:
        ans2 = ans2 + 1
    if B+1 <= i:
        ans3 = ans3 + 1 


print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(p)

import bisect
abis = bisect.bisect_right(p,a)
bbis = bisect.bisect_right(p,b)
print(min(abis-0, bbis-abis, len(p)-bbis))

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
one = sum(1 for i in p if i <= a)
two = sum(1 for i in p if a + 1 <= i <= b)
three = sum(1 for i in p if b <= i)
print(min(one, two, three))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
x = []
y = []
z = []

for i in P:
    if i <= A:
        x.append(i)
    elif i <= B:
        y.append(i)
    else:
        z.append(i)
print(len(min(x, y, z)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
x = []
y = []
z = []

for i in P:
    if i <= A:
        x.append(i)
    elif (i >= A + 1) and (i <= B):
        y.append(i)
    else:
        z.append(i)
print(len(min(x, y, z)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
x = []
y = []
z = []

P = sorted(P)
for i in P:
    if i <= A:
        x.append(i)
    elif (i >= A + 1) and (i <= B):
        y.append(i)
    else:
        z.append(i)
print(len(min(x, y, z)))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

A, B = [int(i) for i in input().split()]

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



def Three_Categorize(P,A,B):
    count_1 = 0
    count_2 = 0
    count_3 = 0
    for i in P:
        if i <= A:
            count_1 +=1
        elif (i > A) & (i < B):
            count_2 +=1
        elif i > B:
            count_3 +=1
    
    return [count_1, count_2, count_3]
            
    
count = Three_Categorize(P,A,B)
ans=min(count)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

A, B = [int(i) for i in input().split()]

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



def Three_Categorize(P,A,B):
    count_1 = 0
    count_2 = 0
    count_3 = 0
    for i in P:
        if i <= A:
            count_1 +=1
        elif (i > A) & (i < B):
            count_2 +=1
        elif i > B:
            count_3 +=1
    
    return [count_1, count_2, count_3]
            
    
count = Three_Categorize(P,A,B)
ans=1
for i in count:
    ans = ans*i
    
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
c, d, e = 0, 0, 0
for x in p:
    if x <= a:
        c += 1
    elif x <= b:
        d += 1
    else:
        e += 1
print(min(a, b, c))

Submission status: Wrong Answer

Solution code:
import bisect
N = int(input())
A,B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
ans = N
id = bisect.bisect_right(P,A)
ans = min(ans,id)
prev = id
id = bisect.bisect_right(P,B)
ans = min(ans,id - prev)
ans = min(ans,N-1 - id)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(list(map(int, input().split())))
cnt_1, cnt_2, cnt_3 = 0,0,0
for i in range(n):
	if p[i] > a:
		break
	cnt_1 += 1

for j in range(i,n):
	if p[j] > b:
		break
	cnt_2 += 1

	if j == n-1:
		print(0)
	else:
		cnt_3 = n-j
		print(min(cnt_1,cnt_2,cnt_3))

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(list(map(int, input().split())))
cnt_1, cnt_2, cnt_3 = 0,0,0
for i in range(n):
	if p[i] > a:
		break
	cnt_1 += 1

for j in range(i,n):
	if p[j] > b:
		break
	cnt_2 += 1

cnt_3 = n-j

print(min(cnt_1,cnt_2,cnt_3))

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))

q1=len([i for i in range(N) if P[i]<=A])
q2=len([i for i in range(N) if A<P[i]<=B])
q3=len([i for i in range(N) if P[i]<B])

ans=min(q1,q2,q3)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int , input().split())
p = list(map(int, input().split()))
group_a = len([i for i in p if i <= a])
group_b = len([i for i in p if i < a and i <= b])
group_c = len([i for i in p if i > b])
print(min( group_a, group_b, group_c))

Submission status: Wrong Answer

Solution code:
from collections import Counter

input()
A, B = map(int, input().split())
P = list(map(int, input().split()))

li = []
for i in P:
  if i <= A:
    li.append(1)
  elif A < i <= B:
    li.append(2)
  else:
    li.append(3)
    
cli = Counter(li)

print(min(cli.values()))

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
li_p = list(map(int, input().split()))

print(
    min(
        len(list(filter(lambda x: x <= a, li_p))),
        len(list(filter(lambda x: (a + 1) <= x <= b, li_p))),
        len(list(filter(lambda x: b <= x, li_p))),
    )
)

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

s = 0
t = 0

for i in p:
    if i <= a:
        s += 1
        t += 1
    elif i <= b:
        t += 1

ans = min(s, t-s, len(p))

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    low, mid, high = 0, 0, 0
    for pi in p:
        if pi <= a:
            low += 1
        elif a + 1 <= pi <= a:
            mid += 1
        else:
            high += 1
    print(min(low, mid, high))


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
# aising2019B - Contests
import sys
input = sys.stdin.readline

from bisect import bisect_right


def main():
    n = int(input())
    A, B = list(map(int, input().rstrip().split()))
    P = sorted(map(int, input().rstrip().split()))
    a = bisect_right(P, A)
    b = bisect_right(P, B) - a
    c = n - b
    print(min(a, b, c))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int,input().split())
p = [int(x) for x in input().split()]

p.sort()

p1 = [i for i in p if i<=a]
p2 = [j for j in p if a<j<=b]
p3 = [k for k in p if b<k]

print(min([p1,p2,p3]))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans = [0] * 21

for i in range(N):
  ans[P[i]] += 1

print(min(sum(ans[0:A + 1]), sum(ans[A:B + 1]), sum(ans[B:])))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr)
pos1=0
pos2=0
for i in range(n):
  if arr[i]<=a:
    pos1=i
  if arr[i]<=b:
    pos2=i
ans=min(pos1,pos2-pos1,n-pos2)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
x=y=z=0
for i in range(n):
    if p[i]<=a :
        x+=1
    if p[i]>=a+1 and b<=p[i]:
        y+=1
    if p[i]>=b+1:
        z+=1
print(min(x,y,z))

Submission status: Wrong Answer

Solution code:
import bisect
n=int(input())
a,b=[int(i) for i in input().split()]
p=sorted([int(i) for i in input().split()])
print(min(bisect.bisect_right(p,a)+1,bisect.bisect_right(p,b)+1,n-bisect.bisect_right(p,b)-1))

Submission status: Wrong Answer

Solution code:
import bisect
n=int(input())
a,b=[int(i) for i in input().split()]
p=sorted([int(i) for i in input().split()])
print(min(bisect.bisect_right(p,a),bisect.bisect_right(p,b),n-bisect.bisect_right(p,b)))

Submission status: Wrong Answer

Solution code:
import bisect
n=int(input())
a,b=[int(i) for i in input().split()]
p=sorted([int(i) for i in input().split()])
print(min(bisect.bisect_left(p,a+1),bisect.bisect_left(p,b+1),n-bisect.bisect_left(p,b+1)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))

copyP = P[:]
cnt = 0
x, y, z = 0, 0, 0
tmp = []
while copyP:
  for p in P:
    if p <= A:
      tmp += [p]
      copyP.remove(p)
      x += 1
    elif A+1 <= p <= B:
      tmp += [p]
      copyP.remove(p)
      y += 1
    elif p >= B+1:
      tmp += [p]
      copyP.remove(p)
      z += 1
    if len(tmp) == 3 and x == y == z == 1:
      cnt += 1
      tmp = []
      x, y, z = 0, 0, 0
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
case = [[], [], []]
for i in p:
    if i <= a:
        case[0].append(i)
    elif i <= b:
        case[1].append(i)
    case[2].append(i)
print(min(map(lambda x: len(x), case)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))

Ans = [0]*3
for i in range(N):
    if P[i]<=A:
        Ans[0] += 1
    elif P[i]<=B:
        Ans[1] += 1
    else:
        Ans[2] += 2

print(min(Ans))

Submission status: Wrong Answer

Solution code:
def conte(n,ab,p):
    p.sort()
    a=ab[0]
    b=ab[1]
    cnt=0
    for i in range(n):
        if p[i]==0:
            break
        if a>=p[i]:
            for x in range(i+1,n):
                if a+1<=p[x]<=b:
                    for y in range(i+x+1,n):
                        if b+1<=p[y]:
                            cnt+=1
                            p[i]=0
                            p[x]=0
                            p[y]=0

    return cnt
n=int(input())
print(conte(n,list(map(int,input().split())),list(map(int,input().split()))))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
A=list(map(int,input().split()))
M=[]
N=[]
P=[]
for i in A:
  if i<=a:
    M.append(i)
  elif a<i<=b:
    N.append(i)
  elif b+1<i:
    P.append(i)
print(min(len(M),len(N),len(P)))

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b=map(int,input().split())
p=[int(i) for i in input().split()]
cnta=0
cntb=0
cntc=0
for i in p:
  if i<=a:
    cnta+=1
  elif i<=b:
    cntb+=1
  else:
    cntc+=1
print(cnta*cntb*cntc)

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b = list(map(int, input().split()))
p = list(map(int, input().split()))

q = list([0,0,0])
for i in p:
    if i <= a:
        q[0] += 1
    elif i >= b:
        q[2] += 1
    else:
        q[1] +=1

print(min(q))