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:
if __name__ == '__main__':
    n = int(input())
    (a, b) = [int(x) for x in input().split()]
    u1 = u2 = u3 = 0
    for s in input().split():
        x = int(s)
        if x <= a:
            u1 += 1
        elif a < x <= b:
            u2 += 1
        else:
            u3 += 1
    print(min(min(u1,u2),u3))

Submission status: Accepted

Solution code:
import bisect
n = int(input())
a, b= (int(i) for i in input().split())  
p = list(int(i) for i in input().split())
p1 = sorted(p,reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0
for i in p1:
  if i <= a:
    ans1 += 1
  elif a<i and i<=b:
    ans2 += 1 
  else: 
    ans3 += 1
print (min([ans1,ans2,ans3]))

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()] 

n1 = sum(x <= A for x in P)

n2 = len([1 for x in P if (x>A and x < B+1)])  

n3 = sum(x > B for x in P)

print(min(n1, n2, n3))

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A, B = map(int,input().split())
P = list(map(int,input().split()))
P_1 = [i for i in P if i <= A]
P_2 = [i for i in P if i >= A + 1 and i <= B]
P_3 = [i for i in P if i >= B + 1]
P_len = np.array([len(P_1),len(P_2),len(P_3)])
print(P_len.min())

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()]
#print(n,a,b,p)

cnta=0
cntb=0
cntc=0

for i in p:
  if i<=a:
    cnta+=1
  if a+1<=i<=b:
    cntb+=1
  if b+1 <= i:
    cntc+=1
    
print(min(cnta,cntb,cntc))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

A,B = map(int,input().split(' '))

P = list(map(int, input().split(" ")))

#P = p.strip(' ')

#P = map(int,p.split(' '))

#print(P[0])

P.sort()

kazu = len(P)

#print(P)

A_cnt = 0
B_cnt = 0

for j in range(N):
    if P[j] <= A:
        A_cnt = A_cnt +1
    if P[j] >= B+1:
        B_cnt = B_cnt + 1

AB_cnt = kazu - A_cnt - B_cnt

print(min(A_cnt,B_cnt,AB_cnt))

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
ab = [int(i) for i in stdin.readline().rstrip().split(" ")]
p = [int(i) for i in stdin.readline().rstrip().split(" ")]

first = len([i for i in p if i <= ab[0]])
third = len([i for i in p if i > ab[1]])
second = n - first - third
print(min([first,second,third]))

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
P=list(map(int,input().split()))
a = sum(x<=A for x in P)
b = sum(x<=B and x>A for x in P) 
c = sum(x>B for x in P)

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()))


x = 0
y = 0
z = 0

for i in sorted(p):
  if i <= A:
    x += 1
  elif i <= B:
    y += 1
  else:
    z += 1
    
print(min(x,y,z))

Submission status: Accepted

Solution code:
import numpy as np

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

p = np.array(p)
print(min(len(p[p <= a]),len(p[(p > a) & (p <= b)]),len(p[p > b])))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
count = 0
for i in range(max_contest):
    # print(p[0], p[1], p[-1])
    # print(p[0] <= a , p[-1] >= b+1 , a+1 <= p[1] <= b)
    can_b = [i for i in p if a+1 <= i <= b]
    if p[0] <= a and p[-1] >= b+1 and len(can_b) != 0:
        count += 1
        del p[0]
        p.remove(can_b[0])
        del p[-1]
    else:
        break
print(count)

Submission status: Accepted

Solution code:
N = int(input())
a,b = map(int,input().split())

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

 
A = []
B = []
C = []
for i in P:
    if i<=a:
        A.append(i)
    elif i<=b:
        B.append(i)
    else :
        C.append(i)

ans = min([len(A),len(B),len(C)])
print(ans)

Submission status: Accepted

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

LOW = []
MID = []
HIG = []

for p in Ps:
    if p <= A:
        LOW.append(p)
    elif p <= B:
        MID.append(p)
    else:
        HIG.append(p)

ll = len(LOW)
lm = len(MID)
lh = len(HIG)

print(min(ll, lm, lh))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = map(int, input().split())
a,b = map(int, input().split())
p = list(map(int, input().split()))

bottom=0
middle=0
upper=0
for pi in p:
  if pi <= a:
    bottom=bottom+1
  elif pi <= b:
    middle=middle+1
  else:
    upper=upper+1
print(min(bottom,min(middle,upper)))

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A, B = map(int,input().split())
p = np.array(list(map(int,input().split())))
a = p[p<=A].shape[0]
b = p[np.logical_and(p>A,p<=B)].shape[0]
c = p[p>B].shape[0]
print(np.min(np.array([a,b,c])))

Submission status: Accepted

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

prg1 = [i for i, x in enumerate(P) if x <= A]
prg2 = [i for i, x in enumerate(P) if x >= A+1 and x <= B]
prg3 = [i for i, x in enumerate(P) if x >= B+1]

if prg1==0 or prg2==0 or prg3==0:
  result = 0
else:
  result = min([len(prg1),len(prg2),len(prg3)])
print(result)

Submission status: Accepted

Solution code:


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

P.sort()

ans = 0

fir, sec = [], []

for i in range(len(P) - 1):
    if P[i] > A:
        fir = P[:i]
        P = P[i:]
        break


for i in range(len(P)):
    if P[i] > B:
        sec = P[:i]
        P = P[i:]
        break



print(min(len(fir), len(sec), len(P)))

Submission status: Accepted

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

n = int(input())
tmp=input()
a = int(tmp.split(" ")[0])
b = int(tmp.split(" ")[1])
tmp=input()
p=[int(k) for k in tmp.split()]
p.sort()
x=[0,0,0]

j=int(len(p))
k=0
for k in range(j):
    if p[k]>a:
        break
x[0]=k

p.reverse()
k=0
for k in range(j):
    if p[k]<=b:
        break
x[2]=k
x[1]=j-x[0]-x[2]

print(min(x))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A, B = map(int, input().split())
    P = []
    p = list(map(int, input().split()))
    for l in p:
        P.append(l)
    count = 0
    while True:
        clear = False
        for p in P:
            if 1 <= p <= A:
                P.remove(p)
                clear = True
                break
        if not clear:
            break
        clear = False
        for p in P:
            if A + 1 <= p <= B:
                P.remove(p)
                clear = True
                break
        if not clear:
            break
        clear = False
        for p in P:
            if B + 1 <= p:
                P.remove(p)
                clear = True
                count += 1
                break
        if not clear:
            break
    print(count)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A, B = (int(i) for i in input().split())
P = list(map(int, input().split()))
P.sort()
num1 = 0
num2 = 0
num3 = 0
for i in range(len(P)):
    if P[i] <= A:
        num1 = i + 1
    elif P[i] > A and P[i] <= B:
        num2 = i + 1 - num1
    elif P[i] > B:
        num3 = N - num1 - num2
        break
print(min([num1, num2, num3]))

Submission status: Accepted

Solution code:
N=int(input())
a=[]
a=input().split(" ")
A=int(a[0])
B=int(a[1])
Y=input()
X=[]
X=Y.split(" ") #数値YをリストXに格納
Z=[int(i) for i in X] #リストXの要素を"文字"から"数値"に変換
Z.sort()#並び替え
p=[i for i in Z if i<=A]
q=[i for i in Z if A<i<=B]
r=[i for i in Z if B<i]
P=len(p)
Q=len(q)
R=len(r)
print(min(P,Q,R))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/aising2019/tasks/aising2019_b

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

f = 0
s = 0
t = 0

for p in P:
    if p <= A:
        f += 1
    elif p <= B:
        s += 1
    else:
        t += 1

print(min(f,s,t))

Submission status: Accepted

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

from bisect import bisect_right

a = bisect_right(P, A)
b = 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())
P = list(map(int, input().split()))

P.sort()
counterA = 0
while P:
    if P[0] <= A:
        counterA += 1
        del P[0]
    else:
        break

counterB = 0
while P:
    if P[0] <= B:
        counterB += 1
        del P[0]
    else:
        break

print(min(counterA, counterB, len(P)))

Submission status: Accepted

Solution code:
N=int(input())
A,B= map(int, input().split())
P = [int(_) for _ in input().split()]
A_c=B_c=A_B=0
for i in range(N):
    if P[i]<=A: 
        A_c = A_c+1
    elif P[i]>B: 
        B_c = B_c+1
    else:
        A_B = A_B+1
print(min(A_B,A_c,B_c))

Submission status: Accepted

Solution code:
import math

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

# N=7
# A,B=5,15
# P=[1,10,16,2,7,20,12]

# N=8
# A,B=3,8
# P=[5,5,5,10,10,10,15,20]

# N=3
# A,B=5,6
# P=[5,6,10]

PA=[i for i in P if i<=A]
PB=[i for i in P if i>A and i<=B]
PC=[i for i in P if i>B]

# print(PA)
# print(PB)
# print(PC)
m=min(len(PA),len(PB),len(PC))

print(m)

Submission status: Accepted

Solution code:
N = input()
A,B =input().split()
P = input().split()
ansX = 0
ansY = 0
ansZ = 0
for i in range(int(N)):
    if int(P[i]) <= int(A):
        ansX = ansX+1
    elif int(P[i]) <= int(B):
        ansY = ansY+1
    else:
        ansZ = ansZ+1

ans = ansX
if ans >= ansY:
    ans = ansY
if ans >= ansZ:
    ans = ansZ
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B+1])
cko=len(data[data>=A+1])-len(data[data>B])
ans=min([ako,bko,cko])
print(ans)

Submission status: Accepted

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

while flag:
    for f in [lambda x: x <= a, lambda x: x > a and x <= b, lambda x: x > b]:
        pt = list(filter(f, p))
        if len(pt) == 0:
            flag = False
            break
        p.remove(min(pt))
    else:
        c += 1

print(c)

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = [int(i) for i in input().split()]
first = [i for i in p if i<=a]
third = [i for i in p if i>=(b+1)]
first_num = len(first)
third_num = len(third)
second_num = len(p) - first_num - third_num
print(min(first_num, second_num, third_num))

Submission status: Accepted

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


def main():
    count1 = len([p for p in P if p <= A])
    count2 = len([p for p in P if p > A and p <= B])
    count3 = len([p for p in P if p > B])

    print(min([count1, count2, count3]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

L = list(map(int, input().split()))


ans = [0, 0, 0]
for i in L:
    if i <= A:
        ans[0] += 1
    elif i >= A + 1 and 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()))
list = [0, 0, 0]
for i in range(N):
	if P[i] <= A:
		list[0] = list[0] + 1
	elif P[i] > A and P[i] <= B:
		list[1] = list[1] + 1
	else:
		list[2] = list[2] + 1
print(min(list))

Submission status: Accepted

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

q = [0, 0, 0]
for pi in p:
    if pi <= a:
        q[0] += 1
    elif a+1 <= pi <= b:
        q[1] += 1
    else:
        q[2] += 1

if q[0] != 0 and q[1] != 0 and q[2] != 0:
    print(min(q))
else:
    print(0)

Submission status: Accepted

Solution code:
# coding: utf-8

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

q1 = []
q2 = []
q3 = []

for i in P:
    if int(i) <= A:
        q1.append(int(i))
    if int(i) >= A+1 and int(i) <= B:
        q2.append(int(i))
    if int(i) >= B+1:
        q3.append(int(i))

q_len = [len(q1), len(q2), len(q3)]
print(min(q_len))

Submission status: Accepted

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

t1 = sum([p<=A for p in P])
t2 = sum([p>A and p<=B for p in P])
t3 = sum([p>B for p in P])

print(min([t1, t2, t3]))

Submission status: Accepted

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

countone = 0
counttwo = 0
countthree = 0

for pi in P:
    if pi > B:
        countthree = countthree + 1
    if (pi <= B)&(pi > A):
        counttwo = counttwo + 1
    if (pi <= A):
        countone = countone + 1

print(min([countone, counttwo, countthree]))

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 = x + 1
  if a < p[i] <= b:
    y = y + 1
  if b < p[i]:
    z = z + 1

print(min(x, y, z))

Submission status: Accepted

Solution code:
N = int(input())
A,B= map(int, input().split())
#a= int(input().split()
a_list = list(map(int, input().split())) # "1 2 3"と入力

test_a=0
test_b=0
test_c=0
for num in a_list:
    if num<= A:
        test_a += 1
    elif A< num<=B:
        test_b += 1
    else:
        test_c += 1
print(min(test_a,test_b,test_c))

Submission status: Accepted

Solution code:
num_prob = map(int, raw_input().split())
a_b_list = map(int, raw_input().split())
a = a_b_list[0]
b = a_b_list[1]
prob_list = map(int, raw_input().split()) 

num_1 = 0
num_2 = 0
num_3 = 0

for i in range(len(prob_list)):
    if prob_list[i] <= a:
        num_1 += 1
    elif a < prob_list[i] <= b:
        num_2 += 1
    else:
        num_3 += 1

result = min(num_1, num_2, num_3)

print(result)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())

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

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

b = 0 
c = 0 
d = 0

for i in range(N):
    if a[i] <= A:
        b = b + 1
    elif a[i] <= B:
        c = c + 1
    else:
        d = d + 1

if b < c:
    if b < d:
        print(b)
    else:
        print(d)
elif c < d:
    print(c)
else:
    print(d)

Submission status: Accepted

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

P.sort()

c1, c2, c3 = 0, 0, 0
for i, p in enumerate(P, 1):
    if p <= A:
        c1 = i
    if (p > A) and (p <= B):
        c2 = i
    if p > B:
        c3 = i


if c1 <= c2 <= c3:
    print(min((c1), (c2 - c1), (c3 - c2)))
else:
    print(0)

Submission status: Accepted

Solution code:
# スペース区切りの整数の入力
n = int(input())
a, b = input().strip().split(' ')
a, b = [int(a),int(b)]
arrayP = list(map(int, input().split()))
m = 0
l = 0
s = 0
for i in range(n):
    if arrayP[i] <= a:
        m = m + 1
    elif arrayP[i] > a and arrayP[i] <= b:
        l = l + 1
    else:
        s = s + 1
array = [m,l,s]
array.sort()
print(array[0])

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 and int(p[i]) <= int(B):
        cntC += 1

print(min(cntA,cntB,cntC))

Submission status: Accepted

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

len_p_over_a = len([p_i for p_i in p_list if p_i <= a])
len_p_ap1_to_b = len([p_i for p_i in p_list if a+1 <= p_i <= b])
len_p_over_bp1 = len([p_i for p_i in p_list if b+1 <= p_i])

min_combi = min(len_p_over_a, len_p_ap1_to_b, len_p_over_bp1)
print(min_combi)

Submission status: Accepted

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

first, second, third = 0, 0, 0
for i in p:
    if i <= a:
        first += 1
    if a+1 <= i <= b:
        second += 1
    if b+1 <= i:
        third += 1

print(min([first, second, third]))

Submission status: Accepted

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

a,b,c = [],[],[]
for p in P:
    if p<=A: a.append(p)
    elif p<=B: b.append(p)
    else: c.append(p)
    
print(min([len(a),len(b),len(c)]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = (int)(input())
A, B = (list)(map(int, input().split()))
scores = (list)(map(int, input().split()))

cand1 = sum(x <= A for x in scores)
cand3 = sum(x >= B+1 for x in scores)
cand2 = n - cand1 - cand3

print(min(cand1, cand2, cand3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = [int(i) for i in input().split()]
r = [0]*3
for p in P:
    if p<=A:
        r[0]+=1
    elif A<p<=B:
        r[1]+=1
    else:
        r[2]+=1
r = sorted(r, reverse=False)
print(r[0])

Submission status: Accepted

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

gte_a = len(p)
for i,v in enumerate(p):
    if a + 1 <= v <= b:
        gte_a = i
        break

gte_b = len(p)

for i,v in enumerate(p):
    if b + 1 <= v:
        gte_b = i
        break

s = range(0, gte_a)
t = range(gte_a, gte_b)
u = range(gte_b, len(p))
print(min(map(len, (s,t,u))))

Submission status: Accepted

Solution code:
N=int(input())
A,B=(int(i) for i in input().split())
point=[int(i) for i in input().split()]
point.sort()
pointp=point[::-1]
p=[i for i in  point if i<=A]
q=[i for i in point if A<i<=B]
r=[i for i in pointp if i>B]
print(min(len(p),len(q),len(r)))

Submission status: Accepted

Solution code:
#! 

N = int(input())
AB = list(map(int, input().split(" ")))
P = list(map(int, input().split(" ")))

Pa = []
Pb = []
Pc = []

for i in range(N):
    Pi = P[i]
    if Pi <= AB[0]:
        Pa.append(Pi)
    elif Pi <= AB[1]:
        Pb.append(Pi)
    else:
        Pc.append(Pi)
        
temp = min(len(Pa),len(Pb))
ans = min(temp,len(Pc))

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
sita=0
mannaka=0
ue=0
for pi in p:
    if pi <= a:
        sita+=1
    elif a+1 <= pi<=b:
        mannaka+=1
    else:
        ue+=1
print(min(ue,min(sita,mannaka)))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = sorted([int(i) for i in input().split()])
ans = 0
num1 = 0
num2 = 0
num3 = 0

for i in P:
    if i <= A:
        num1 += 1
    elif A+1 <= i <= B:
        num2 += 1
    elif B+1 <= i:
        num3 += 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()]

# print(n)
# print(a, b)
# print(sorted(p))

q_a = 0
q_b = 0
q_c = 0

for i in p:
    if i <= a:
        q_a += 1
    elif a < i <= b:
        q_b += 1
    else:
        q_c += 1

print(min([q_a, q_b, q_c]))

Submission status: Accepted

Solution code:
n=input()
list1=[int(i) for i in input().split(" ")]
list2=[int(i) for i in input().split(" ")]
a=list1[0]
b=list1[1]
count1=0
count2=0
count3=0
for i in list2:
    if i<=a:
        count1+=1
    elif a<i<=b:
        count2+=1
    else:
        count3+=1
print(min(count1,count2,count3))

Submission status: Accepted

Solution code:
N = int(input())
A, B = list(map(int, input().split()))
P = list(map(int, input().split()))
E = []
S = []
D = []

for i in range(N):
	if P[i] >= B+1:
		D.append(P[i])
	elif P[i] <= B and P[i] >= A+1:
		S.append(P[i])
	else:
		E.append(P[i])


print(min(len(E), len(S), len(D)))

Submission status: Accepted

Solution code:
N=int(input())
a,b=map(int,input().split())
list=list(map(int,input().split()))
list1=[]
list2=[]
list3=[]
list.sort()
for i in range(len(list)):
    if list[i]<=a:
        list1.append(list[i])
    elif a+1<=list[i]<=b:
        list2.append(list[i])
    else:
        list3.append(list[i])
print(min(len(list1),len(list2),len(list3)))

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a, b = [int(x) for x in input().split(" ")]

p = np.array([int(x) for x in input().split(" ")])


m1 = np.sum(p <= a)
m2 = np.sum((p > a) & (p <= b))
m3 = np.sum(p > b)

print(np.min([m1, m2, m3]))

Submission status: Accepted

Solution code:
n = int(raw_input())
a,b = map(int,raw_input().split())
arr = map(int, raw_input().split())
t1 = 0
t2 = 0
t3 = 0
for i in range(n):
    if arr[i] <= a:
        t1 += 1
    elif  a+1<=arr[i]<=b:
        t2 += 1
    else:
        t3 += 1
print min(t1, t2, t3)

Submission status: Accepted

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

count = 0
sel_P_idx = []
for i in range(len(P)-2):
    for j in range(i+1, len(P)-1):
        for k in range(j+1, len(P)):
            if i in sel_P_idx or j in sel_P_idx or k in sel_P_idx:
                continue

            q1 = P[i]
            q2 = P[j]
            q3 = P[k]

            if q1 <= A and A+1 <= q2 <= B and q3 >= B+1:
                count += 1
                sel_P_idx.append(i)
                sel_P_idx.append(j)
                sel_P_idx.append(k)
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=input().split()
p=list(map(int,p))
p.sort()
q=filter(lambda x: x<=a,p)
r=filter(lambda x: a+1<=x<=b,p)
s=filter(lambda x:b+1<=x,p)
a=min(len(list(q)),len(list(r)))
print(min(a,len(list(s))))

Submission status: Accepted

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

anum = bnum = cnum = 0
for i,pi in enumerate(p_):
    if pi > a :
        anum = i
        break

for i,pi in enumerate(p_):
    if pi > b :
        bnum = i - anum
        break

cnum = n - anum - bnum
print(min(anum,bnum,cnum))

Submission status: Accepted

Solution code:
from itertools import permutations

n  = int(input())
a, b = [int(x) for x in input().split(' ')]
p = sorted([int(x) for x in input().split(' ')])

p_easy = len([x for x in p if x<=a])
p_normal = len([x for x in p if a<x<=b])
p_hard = len([x for x in p if b<x])

print(min(p_easy,p_normal,p_hard))

Submission status: Accepted

Solution code:
import sys, copy, math, collections, itertools

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

n1 = len([i for i in p if i <= a])
n2 = len([i for i in p if a < i <= b])
n3 = len([i for i in p if b < i])
print(min(n1,n2,n3))

Submission status: Accepted

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

Submission status: Accepted

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

P = np.array(P)
X = P[P <= A]
Y = P[(P >= (A + 1)) & (P <= B)]
Z = P[P >= (B + 1)]

print(min(len(X), len(Y), len(Z)))

Submission status: Accepted

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

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 i in P:
    if i <= A:
        a+=1
    elif i <= B:
        b+=1
    else:
        c+=1
else:
    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()))
a = 0
b = 0
c = 0
for i in range(N):
    if P[i]<=A:
        a+=1
    elif P[i]<=B:
        b+=1
    else:
        c+=1
l = [a, b, c]
print(min(l))

Submission status: Accepted

Solution code:
import numpy as np

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

p = np.array(sorted(p))
n_under_a = len(p[p<=a]) #値がa以下の個数
n_under_b = len(p[p<=b])-n_under_a #a<x<=bの個数
n_over_b = len(p[p>b]) #x>bの個数

print(min(n_under_a, min(n_under_b, n_over_b)))

Submission status: Accepted

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

Q1 = len([n for n in P if n <= A])
Q2 = len([n for n in P if n > A and n <=B])
Q3 = len([n for n in P if n > B])

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() ))
X1=sum( [p<=A for p in P])
X2=sum( [ (p>A and p<=B)  for p in P] )
X3=sum( [p>B  for p in P] )
print(min([X1,X2,X3]))

Submission status: Accepted

Solution code:
def main():
    """
    問題が 3問出題され、
    1問目の配点は A点以下、
    2問目の配点は A+1点以上 B点以下、
    3問目の配点は  B+1点以上である。
    """
    N = int(input())
    A, B = map(int, input().split())
    *P, = map(int, input().split())

    n_a = 0
    n_ab = 0
    n_b = 0
    for p in P:
        if p > B:
            n_b += 1
        elif A < p <= B:
            n_ab += 1
        elif p <= A:
            n_a += 1

    ans = min([n_a, n_ab, n_b])
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def solve():
    N = int(input())
    A,B  = map(int,input().split())
    P = list(map(int,input().split()))
    P1 = list(p for p in P if p<=A)
    P2 = list(p for p in P if A<p<=B)
    P3 = list(p for p in P if B<p)
    res = min(len(P1),len(P2),len(P3))
    return str(res)

if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
import numpy as np


N = int(input())
A, B = map(int, input().split(" "))
P_list = np.array(list(map(int, input().split(" "))))

min_A = P_list[P_list <= A]
min_B = P_list[(P_list > A) & (P_list <= B)]
above_B = P_list[P_list > B]

print(min(len(min_A), len(min_B), len(above_B)))

Submission status: Accepted

Solution code:
def piyo():
    _ = int(input())
    a, b = (int(_) for _ in input().split()) 
    p = list(int(i) for i in input().split())
    c1=0
    c2=0
    c3=0
    for i in p:
        if i<=a:
            c1+=1
        elif a<i and i<=b:
            c2+=1
        elif b<i:
            c3+=1
    ans=min(c1,c2,c3)
    print(ans)

if __name__ == '__main__':
    piyo()

Submission status: Accepted

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

count = collections.Counter(p)

nQues = []
nQues.append( sum([count[i] for i in count.keys() if i <= a]) )
nQues.append( sum([count[i] for i in count.keys() if a < i and i <= b]) )
nQues.append( sum([count[i] for i in count.keys() if b < i]) )

print(min( nQues ))

Submission status: Accepted

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

ans_1 = len([p for p in p_lst if p <= a])
ans_2 = len([p for p in p_lst if p >  a and p <= b])
ans_3 = len([p for p in p_lst if p > b])
print(min(ans_1,ans_2,ans_3))

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
First = 0
Second = 0
Third = 0
for i in P:
  if i <= A:
    First += 1
  elif i <= B:
    Second += 1
  else:
    Third += 1
Answer = min(First,Second,Third)
print(Answer)

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
a = sum(x <= A for x in P)
b = sum((A + 1) <= x and x <= B for x in P)
c = sum(B + 1 <= x for x in P)
print(min([a, b, c]))

Submission status: Accepted

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()]

low = len([i for i in P if i <= A])
mid = len([i for i in P if (i > A and i <= B)])
high = len([i for i in P if i > B])

num = min(low,mid,high)

print(num)

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int,input().split())
list = [int(x) for x in input().split()]
counta = 0
countb = 0
countc = 0 
for p in list:
    if p <= A:
        counta += 1
    elif B >= p >= A+1:
        countb += 1
    elif p >= B+1:
        countc +=1
print(min(min(counta,countb),countc))

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()]
s=t=u=0
for i in range(N):
    if P[i]<=A:
        s+=1
    if P[i]>A and P[i] <= B:
        t+=1
    if P[i] > B:
        u+=1
re = min(s,t,u)
print(re)