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: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
Ps = list(map(int, input().split()))
n1 = 0
n2 = 0
n3 = 0
for P in Ps:
  if P <= A:
    n1 += 1
  if A+1 <= P <= B:
    n2 += 1
  if P >= B+1:
    n3 += 1
r = min(n1, n2, n3)
print(r)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

a,b = m()

p = l()
c = 0
co = 0
coo = 0

for i in range(n):
    if p[i] <= a:
        c += 1
    elif p[i] <= b:
        co += 1
    else:
        coo += 1
print(min(c,co,coo))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
d=[0]*3
for i in p:
    if i<=a:
        d[0]+=1
    elif a+1<=i<=b:
        d[1]+=1
    elif b+1<=i:
        d[2]+=1
print(min(d))

Submission status: Accepted

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

first=[i for i in p if i <= a]
second=[i for i in p if i <= b and i >= a+1]
third=[i for i in p if i >=b+1]

print(min(len(first), len(second), len(third)))

Submission status: Accepted

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

q_1 = []
q_2 = []
q_3 = []

for i in P:
    if i <= A:
        q_1.append(i)
    elif A < i <= B:
        q_2.append(i)
    else:
        q_3.append(i)

print(min(len(q_1), len(q_2), len(q_3)))

Submission status: Accepted

Solution code:
N,A,B,*P=map(int,open(0).read().split());b=len([p for p in P if p>A]);c=len([p for p in P if p>B]);print(min(N-b,b-c,c))

Submission status: Accepted

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

a = len([p for p in P if p<=A])
a = min(a,
        len([p for p in P if A<p<=B]))
a = min(a,
        len([p for p in P if B<p]))
print(a)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a,b = map(int, input().split())
p = np.array([int(i) for i in input().split()])
x1 = len(p[p <= a])
x2 = len(p[(a+1 <= p) & (p <= b)])
x3 = len(p[p>= b+1])
print(min(x1,x2,x3))

Submission status: Accepted

Solution code:
N=int(input())
AB=input().split()
AB=[int(n) for n in AB]
P=input().split()
P=[int(n) for n in P]
q=[0,0,0]

for p in P:
  if (p<=AB[0]):
    q[0]+=1
  elif (AB[0]+1)<=p<=(AB[1]):
    q[1]+=1
  elif (AB[1]+1)<=p:
    q[2]+=1

print ('{}'.format(min(q)))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
key1 = 0
key2 = n-1
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))

Submission status: Accepted

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

c0 = 0
c1 = 0
c2 = 0

for i in range(N):
    if P[i] <= A:
        c0 += 1
    elif A + 1 <= P[i] <= B:
        c1 += 1
    else:
        c2 += 1

print(min(c0, c1, c2))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
P = list(map(int, input().split()))
p1 = len(list(filter(lambda x: x <= a, P)))
p2 = len(list(filter(lambda x: a+1 <= x <= b, P)))
p3 = len(list(filter(lambda x: x >= b+1, P)))
print(min(p1, p2, p3))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
ca=0
cb=0
cc=0
for i in range(n):
    if p[i]<=a:
        ca+=1
    elif a<p[i] and p[i]<=b:
        cb+=1
    else:
        cc+=1
print(min(ca,cb,cc))

Submission status: Accepted

Solution code:
N = int(input())
A, B = [int(_) for _ in input().split()]
P = [int(_) for _ in input().split()]

X = [0,0,0]
for p in P:
    if p <= A:
        X[0] += 1
    elif p <= B:
        X[1] += 1
    else:
        X[2] += 1

print(min(X))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
P=list(map(int,input().split()))
x=[0]*3
for p in P:
  x[0 if p<=a else (1 if p<=b else 2)]+=1
print(min(x))

Submission status: Accepted

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

for i in range(n):
    if p[i] <= a:
        count1 +=1
    elif a+1 <= p[i] <= b:
        count2 +=1
    elif b+1 <= p[i]:
        count3 +=1
print(min(count1,count2,count3))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
x=0
y=0
z=0
for p in P:
  if p<=A:
    x+=1
  elif A+1<=p and p<=B:
    y+=1
  else:
    z+=1
print(min(x,y,z))

Submission status: Accepted

Solution code:
n = int(input())
a, b = [int(i) for i in input().split()]
numlist = [int(i) for i in input().split()]

cntx = 0
cnty = 0
cntz = 0

for i in range(n):
  if numlist[i]<=a:
    cntx += 1
  elif numlist[i]<=b:
    cnty += 1
  else:
    cntz += 1
 
print(min([cntx, cnty, cntz]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=input()
A,B=input().split()
A=int(A)
B=int(B)
P=input().split()
c=[0]*3
for i in P:
        i=int (i)
        if i <= A:
                c[0]+=1
        elif i <= B:
                c[1]+=1
        else :
                c[2]+=1
c.sort()
print(c[0])

Submission status: Accepted

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

one = len([i for i in score if i <= a])
two = len([i for i in score if (a < i <= b)])
three = n - one - two
print(min((one, two, three)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

p.sort()

cnt = [0,0,0]

for i in range(0,n):
    if(p[i] <= a):
        cnt[0]+=1
    elif(a < p[i] <= b):
        cnt[1]+=1
    else:
        cnt[2]+=1

#print(cnt)
print(min(cnt))

Submission status: Accepted

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

for i in range(len(P)):
	if P[i] <= A:
		A_list.append(P[i])
	elif A+1<=P[i] and P[i] <= B:
		B_list.append(P[i])
	else:
		C_list.append(P[i])
		
print(min(len(A_list),len(B_list),len(C_list)))

Submission status: Accepted

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

P.sort()
d = {
    "A":0,
    "B":0,
    "C":0,
}
for p in P:
    if p <= A:
        d["A"] += 1
    elif p <= B:
        d["B"] += 1
    else:
        d["C"] += 1

print(min(d["A"],d["B"],d["C"]))

Submission status: Accepted

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

p1 = 0; p2 = 0; p3 = 0
for item in p:
    if item <= a:
        p1 += 1
    elif item <= b:
        p2 += 1
    else:
        p3 += 1
print(min(p1, p2, p3))

Submission status: Accepted

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

count = [0, 0, 0]
for p in P:
	if p <= A:
		count[0] += 1
	elif p <= B:
		count[1] += 1
	else:
		count[2] += 1
print(min(count))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=[int(i) for i in input().split()]

print(min(len([p for p in P if p<=A]), \
len([p for p in P if A+1<=p<=B]), \
len([p for p in P if B+1<=p])))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
c = [0, 0, 0]
for pt in p:
    if pt > b:
        c[2] += 1
    elif pt > a:
        c[1] += 1
    else:
        c[0] += 1
print(min(c))

Submission status: Accepted

Solution code:
# aising2019B - Contests
def main():
    n = int(input())
    A, B = list(map(int, input().rstrip().split()))
    P = sorted(map(int, input().rstrip().split()))
    a, b, c = 0, 0, 0
    for i in P:
        if i <= A:
            a += 1
        elif A < i <= B:
            b += 1
        else:
            c += 1
    print(min(a, b, c))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Q1 = len([x for x in P if x <= A])
Q2 = len([x for x in P if A+1 <= x <= B])
Q3 = len([x for x in P if x >= B+1])

print(min(Q1, Q2, Q3))

Submission status: Accepted

Solution code:
import bisect

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

P.sort()

a = bisect.bisect_right(P, A)
b = bisect.bisect_right(P, B)

print(min(a, b - a, N - b))

Submission status: Accepted

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

#plist.sort()
alist=[]
blist=[]
clist=[]
for p in plist:
  if p<=A:
    alist.append(p)
  elif p<=B:
    blist.append(p)
  else:
    clist.append(p)
    
print(min(len(alist),len(blist),len(clist)))

Submission status: Accepted

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

memo = [0]*3
for e in P:
    if e <= A:
        memo[0] += 1
    elif e <= B:
        memo[1] += 1
    else:
        memo[2] += 1
print(min(memo))

Submission status: Accepted

Solution code:
n = int(input())
a, b = [ int(v) for v in input().split() ]
num_list = [ int(v) for v in input().split() ]
x, y, z = 0, 0, 0
for i in num_list:
  if i <= a:
    x += 1
  elif i <= b:
    y += 1
  else:
    z += 1
print(min(x,y,z))

Submission status: Accepted

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

print(min(cnt))

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
P = [int(x) for x in input().split()]

n1 = sum(1 if x <= A else 0 for x in P)
n2 = sum(1 if A < x <= B else 0 for x in P)
n3 = sum(1 if B < x else 0 for x in P)
answer = min(n1,n2,n3)
print(answer)

Submission status: Accepted

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

first = []
second = []
third = []
for p in P:
    if p in range(A+1):
        first.append(p)
    elif p in range(A+1, B+1):
        second.append(p)
    else:
        third.append(p)
print(min(len(first), len(second), len(third)))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=[int(i) for i in input().split()]
x=sum(i<=a for i in p)
y=sum(a<i<=b for i in p)
z=sum(b<i for i in p)
print(min(x,y,z))

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
ps = list(map(int,input().split()))
minn = []
middle = []
max = []
for p in ps:
    if p<=a:
        minn.append(p)
    elif a<p and p<=b:
        middle.append(p)
    else:
        max.append(p)
print(min(len(minn),len(middle),len(max)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())
A, B = mi()
Ps = list(mi())

acnt = 0
bcnt = 0
ccnt = 0

for p in Ps:
  if p <= A: acnt += 1
  elif p <= B: bcnt += 1
  else: ccnt += 1

print(min(acnt,bcnt,ccnt))

Submission status: Accepted

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

Submission status: Accepted

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([len(p1),len(p2),len(p3)]))

Submission status: Accepted

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

# Firstは1問目にのみ、Secondは2問目にのみ、Thirdは2,3問目に使えるもの
First, Second, Third = [], [], []
for p in P:
	if p <= A:
		First.append(p)
	elif p >= B + 1:
		Third.append(p)
	elif p >= A + 1:
		Second.append(p)

print(min(len(First), len(Second), len(Third)))

Submission status: Accepted

Solution code:
import bisect
n=int(input())
a,b=map(int,input().split())
p=sorted(list(map(int,input().split())))
s1=bisect.bisect_right(p,a)
s2=bisect.bisect_right(p,b)
print(min(s1,s2-s1,n-s2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
T=list(map(int,input().split()))
print(min(len([t for t in T if t<=A]),len([t for t in T if A<t<=B]),len([t for t in T if B<t])))

Submission status: Accepted

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

Submission status: Accepted

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 + 1:B + 1]), sum(ans[B + 1:])))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
a = 0
b = 0
c = 0
for i in range(N):
  if P[i] <= A: a += 1
  elif P[i] >= B + 1: c += 1
  else: b += 1
print(min(a,b,c))

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
P = list(map(int,input().split()))
s = []
m = []
l = []
for p in P:
    if p <= a:
        s.append(p)
    elif p <= b:
        m.append(p)
    else:
        l.append(p)
print(min(len(s),len(m),len(l)))

Submission status: Accepted

Solution code:
if __name__=="__main__":
    n = int(input())
    A, B = [int(i) for i in input().split(' ')]
    C = [int(i) for i in input().split(' ')]
    l = 0
    mid = 0
    r = 0
    for i in C:
        if i <= A:
            l += 1
        elif i <= B:
            mid += 1
        else:
            r += 1
    print(min(l, min(mid, r)))

Submission status: Accepted

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+1
  if arr[i]<=b:
    pos2=i+1
ans=min(pos1,pos2-pos1,n-pos2)
print(ans)

Submission status: Accepted

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: Accepted

Solution code:
N = int(input())
A, B = [int(x) for x in input().split()]
Ps = [int(x) for x in input().split()]

n1 = len([x for x in Ps if x <= A])
n2 = len([x for x in Ps if A < x <= B])
n3 = len([x for x in Ps if B + 1 <= x])
ans = min(n1, n2, n3)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
l = 0
m = 0
u = 0
x = list(map(int,input().split()))
for i in range(n):
    if x[i]<=a:
        l+=1
    elif x[i]<=b:
        m+=1
    else:
        u += 1

print(min(l,m,u))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p1,p2,p3=0,0,0
for t in map(int,input().split()):
  if t<=a:
    p1+=1
  elif t<=b:
    p2+=1
  else:
    p3+=1
print(min(p1,p2,p3))

Submission status: Accepted

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)-bisect.bisect_right(p,a),n-bisect.bisect_right(p,b)))

Submission status: Accepted

Solution code:
n=int(input())
a_b=[int(i) for i in input().split()]
p=[int(i) for i in input().split()]
#n=7
#a_b=[5,15]
#p=[1,10,16,2,7,20,12]

level1=[]
level2=[]
level3=[]

for i in range(len(p)):
    if p[i]<=a_b[0]:
        level1.append(p[i])
    elif p[i]>a_b[0] and p[i]<=a_b[1]:
        level2.append(p[i])
    else:
        level3.append(p[i])

m=min(len(level1), len(level2), len(level3))

print(m)

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
q1,q2,q3=0,0,0
for p in map(int,input().split()):
    if p<=a:
        q1+=1
    elif p>b:
        q3+=1
    else:
        q2+=1
print(min(q1,q2,q3))

Submission status: Accepted

Solution code:
n=int(input());a,b=map(int,input().split());p=list(map(int,input().split()));num=[0,0,0]
for i in p:num[2if i>b else 1if i>a else 0]+=1
print(min(num))

Submission status: Accepted

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

ans = [0]*3
for p in P:
    if p <= A: ans[0] += 1
    if A < p and p <= B: ans[1] += 1
    if B < p: ans[2] += 1

print( min(ans) )

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = [int(_) for _ in input().split()]
cnt = [0]*(21)

for i in P:
    cnt[i] += 1

num1 = sum(cnt[:A+1])
num2 = sum(cnt[A+1:B+1])
num3 = sum(cnt[B+1:])

print(min(num1, num2, num3))

Submission status: Accepted

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

x0 = list(filter(lambda x:x<=a, p))
x1 = list(filter(lambda x:a<x and x<=b, p))
x2 = list(filter(lambda x:b<x, p))

print(min([len(x0), len(x1), len(x2)]))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))
a, b, c = 0, 0, 0
for p in P:
  if p <= A:
    a += 1
  elif A+1 <= p <= B:
    b += 1
  elif p >= B+1:
    c += 1
print(min(a, b, c))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    h = II()
    w = II()
    print((n-h+1)*(n-w+1))
    return

#B
def B():
    n = II()
    a, b = LI()
    p = LI()
    p.sort()
    ans = [0 for i in range(3)]
    for p_ in p:
        if p_ <= a:
            ans[0] += 1
        elif a < p_ <= b:
            ans[1] += 1
        else:
            ans[2] += 1
    print(min(ans))
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


#A
def A():
    n,h,w = IR(3)
    print((n-h+1)*(n-w+1))
    return

#B
def B():
    n = I()
    a,b = LI()
    p = LI()
    k = [0 for i in range(a+1)]
    k += [1 for i in range(b-a)]
    k += [2 for i in range(max(p)+1-b)]
    d = defaultdict(int)
    for i in p:
        d[k[i]] += 1
    ans = min(d[0],d[1],d[2])
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split(' '))
P=list(map(int,input().split(' ')))
Q1=[p for p in P if p<=A]
Q2=[p for p in P if A<p<=B]
Q3=[p for p in P if B<p]
print(min(len(Q1),len(Q2),len(Q3)))

Submission status: Accepted

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)
    else:
        case[2].append(i)
print(min(map(lambda x: len(x), case)))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
l,m,h = 0,0,0
for i in p:
  if i <= a:
    l += 1
  elif i > b:
    h += 1
  else:
    m += 1
print(min(l, m, h))

Submission status: Accepted

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

P.sort()
count = 0
res = 0
while True:
    flag = True
    start = 0
    end = A
    for i in range(N):
        if start < P[i] <= end:
            P[i] = 0
            count += 1
            if count == 1:
                start = A
                end = B
                
            elif count == 2:
                start = B
                end = 10 ** 5

        if count == 3:
            res += 1
            count = 0
            flag = False
            break
            
    if flag:
        break
        
print(res)

Submission status: Accepted

Solution code:
n,a,b,*p=map(int,open(0).read().split())
c=[0]*3
for t in p:c[(a<t)+(b<t)]+=1
print(min(c))

Submission status: Accepted

Solution code:
_,a,b,*p=map(int,open(0).read().split())
print(min(sum(i==(a<x)+(b<x)for x in p)for i in[0,1,2]))

Submission status: Accepted

Solution code:
_,a,b,*p=map(int,open(0).read().split())
print(min([(a<x)+(b<x)for x in p].count(i)for i in[0,1,2]))

Submission status: Accepted

Solution code:
n,a,b,*p=map(int,open(0).read().split());c=[0]*3
for t in p:c[(t<=a)-(t>b)]+=1
print(min(c))

Submission status: Accepted

Solution code:
import numpy;n,a,b,*p=map(int,open(0).read().split());c=numpy.array(p);d,f=sum(c<=a),sum(b<c);print(min(d,n-d-f,f))

Submission status: Accepted

Solution code:
from numpy import*;n,a,b,*p=map(int,open(0).read().split());c=array(p);print(min(sum(c<=a),sum((a<c)&(c<=b)),sum(b<c)))

Submission status: Accepted

Solution code:
from numpy import*;n,a,b,*p=map(int,open(0).read().split());c=array(p);print(min(len(c[c<=a]),len(c[(a<c)&(c<=b)]),len(c[b<c])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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

    print(min(problem))



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
L = list(map(int,input().split()))
one = []
two = []
three = []
for i in range(N):
  if L[i] <= A:
    one.append(L[i])
  elif A+1 <= L[i] <= B:
    two.append(L[i])
  else:
    three.append(L[i])
print(min(len(one),len(two),len(three)))

Submission status: Accepted

Solution code:
n = int(input())
a, b = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

first = []
sec = []
thi = []

for i in A:
    if i<=a:
        first.append(i)
    elif i<=b:
        sec.append(i)
    else:
        thi.append(i)

print(min(len(first), len(sec), len(thi)))

Submission status: Accepted

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

Submission status: Accepted

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] += 1

print(min(Ans))

Submission status: Accepted

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

first_question_num = 0
second_question_num = 0
third_question_num = 0
for p in P:
    if p <= A:
        first_question_num += 1
    elif p <= B:
        second_question_num += 1
    else:
        third_question_num +=1
        
print(min(first_question_num,second_question_num, third_question_num))

Submission status: Accepted

Solution code:
def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


def readmap():
    return map(int, input().split())


N = read()
A, B = readmap()
P = readlist()

a = 0
b = 0
c = 0

for p in P:
    if p <= A:
        a += 1
    elif p <= B:
        b += 1
    else:
        c += 1

print(min(a,b,c))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A, B = MAP()
P = LIST()

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