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:
def solve(A, B, arr):
  lowNum = len(list(filter(lambda n: n < A, arr)))
  highNum = len(list(filter(lambda n: n > B, arr)))
  midNum = len(arr) - lowNum - highNum
  return min([lowNum, midNum, highNum])

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

print(solve(A, B, arr))

Submission status: Wrong Answer

Solution code:
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
c = 0
i = 0
while i < n:
    d = 0
    if p[i] <= a:
        j = i
        while j < n:
            if d == 1:
                break
            if a+1 <= p[j] <=b:
                k =j
                while k < n:
                    if p[k] >= b+1:
                        c += 1
                        d = 1
                        break
                    k += 1
            j += 1
                        
    i += 1
print(c)

Submission status: Wrong Answer

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

ans = 0
C = 0
flag = 0
for p in P:
    if p>=A+1 and flag==0:
        ans = C
        flag+= 1
        C = 0
    elif p>=B+1 and flag==1:
        if C < ans: ans = C
        flag+= 1
        C = 0
    C += 1
    #print(C)
    
if C < ans: ans = C
if flag<2: ans = 0
    
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, 0, 0
for i in p:
    if i <= a:
        x += 1
    elif i <= b:
        y += 2
    else:
        z += 3
print(min(x,y,z))

Submission status: Wrong Answer

Solution code:
N = 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 and p <= B]
q3 = [p for p in P if p < B]

print(min(len(q) for q in (q1, q2, q3)))

Submission status: Wrong Answer

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

P.sort()

print(P)

p_1 = list(filter(lambda x: x<=A, P))
p_2 = list(filter(lambda x: A < x <= B, P))
p_3 = list(filter(lambda x: B <x, P))

print(min(len(p_1), len(p_2), len(p_3)))

Submission status: Wrong Answer

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

a = sum(i<=A for i in P)
b = sum(A<i<=B for i in P)

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

Submission status: Wrong Answer

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

ans = 0
C = 0
flag = 0
for p in P:
    if p>=A+1 and flag==0:
        ans = C
        flag+= 1
        C = 0
    elif p>=B+1 and flag==1:
        if C < ans: ans = C
        flag+= 1
        C = 0
    C += 1
    #print(C)
    
if C < ans: ans = C
    
print(ans)

Submission status: Wrong Answer

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

num1 = 0
num2 = 0
num3 = 0
for v in P:
    if v <= A:
        num1 += 1
    elif A < v <= B:
        num2 += 2
    else:
        num3 += 3

print(min([num1, num2, num3]))

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 i in range(n):
	if p[i] <= a:
		c[0] += 1
	if p[i] >= b+1:
		c[2] += 1
	else:
		c[1] += 1
print(min(c))

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 i in range(n):
	if p[i] <= a:
		c[0] += 1
	if p[i] >= b:
		c[2] += 1
	else:
		c[1] += 1
print(min(c))

Submission status: Accepted

Solution code:
input()
a,b=map(int,input().split())
p=list(map(int,input().split()))
x=0
y=0
z=0
for i in p:
  if b<i:
    x+=1
  elif a<i:
    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,=map(int, input().split())
mn,md,mx=0,0,0
for pi in p:
    if pi<=a:
        mn+=1
    elif pi<=b:
        md+=1
    else:
        mx+=1
print(min(mn,md,mx))

Submission status: Accepted

Solution code:
pxcount=0
pycount=0
pzcount=0

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

for i in p:
  if i<=a:
    pxcount=pxcount+1
for i in p:
  if a+1<=i and i<=b:
    pycount=pycount+1
for i in p:
  if b+1<=i:
    pzcount=pzcount+1
  
print(min(pxcount,pycount,pzcount))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    N = int(input())
    A, B = ril()
    P = ril()
    a, b, c = 0, 0, 0
    for p in P:
        if p <= A:
            a += 1
        elif p <= 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())
c = map(int,input().split())
lis1 = []
lis2 = []
lis3 = []
for i in c:
    if i <= a:
        lis1.append(i)
    if a+1 <= i <= b:
        lis2.append(i)
    if b+1 <= i:
        lis3.append(i)
print(min(len(lis1),len(lis2),len(lis3)))

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
P = list(map(int, input().split()))
m1 = []
m2 = []
m3 = []
for i in range(N):
    if P[i] <= A:
        m1.append(i)
    elif A+1 <= P[i] <= B:
        m2.append(i)
    elif B+1 <= P[i]:
        m3.append(i)
print(min(len(m1),len(m2),len(m3)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A,B=map(int,input().split())
P_s = list(map(int,input().split()))
CNT_s = [0]*3
for P in P_s:
    if P <= A:
        CNT_s[0] += 1
    elif A <  P <= B:
        CNT_s[1] += 1
    if B <  P:
        CNT_s[2] += 1
print(min(CNT_s))

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 p[i] <= b: cnt[1] += 1
  else: cnt[2] += 1
ans = min(cnt)
print(ans)

Submission status: Accepted

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(min(len(c),len(d),len(e)))

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
x,y,z = 0,0,0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] <= a:
        x += 1
    elif li[i] >= a + 1 and li[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()))
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(min(len(c),len(d),len(e)))

Submission status: Accepted

Solution code:
import math
import statistics
a=int(input())
# b=input()
# c=[]
# for i in b:
#     c.append(i)
e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#j = [input() for _ in range(3)]
# h = []
# for i in range(e1):
#     h.append(list(map(int,input().split())))
a1=[]
b1=[]
c1=[]
for i in range(a):
    if f[i]<=e1:
        a1.append(f[i])
    if e1<f[i]<=e2:
        b1.append(f[i])
    if e2<f[i]:
        c1.append(f[i])

lis = [len(a1),len(b1),len(c1)]
print(min(lis))

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
    elif B<P[i]:
        c += 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()))
x,y,z = 0,0,0
for i in p:
    if i <= a:
        x += 1
    elif b+1 <= i:
        z += 1
    else:
        y += 1
print(min(x,y,z))

Submission status: Accepted

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

count = [0, 0, 0]
for i in range(n):
    if p[i] <= a:
        count[0] += 1
    elif a < p[i] <= 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 = list(map(int,input().split()))
a1 = 0
a2 = 0
a3 = 0

for i in p:
  if i <= a:
    a1 += 1
  elif a+1 <= i and i <= b:
    a2 += 1
  else:
    a3 += 1

print(min(a1,a2,a3))

Submission status: Accepted

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

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

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[0],ans[1],ans[2]))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    cnt = [0] * 3

    for x in P:
        if x <= A:
            cnt[0] += 1
        elif x <= B:
            cnt[1] += 1
        else:
            cnt[2] += 1

    print(min(cnt))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

q_a = []
q_b = []
q_c = []

for p in P:
    if p <= A:
        q_a.append(p)
    elif p <= B:
        q_b.append(p)
    else:
        q_c.append(p)

ans = 0
while q_a:
    q_a.pop()
    if q_b:
        q_b.pop()
    else:
        break
    if q_c:
        q_c.pop()
    else:
        break
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a, b = map(int, input().split())
    p_list = list(map(int, input().split()))
    diff_list = [0] * 3

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

    print(min(diff_list))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

x,y,z=0,0,0
for i in l:
    if i<=a: x+=1
    elif i >=b+1: z+=1
    else: y+=1

print(min(x,y,z))

Submission status: Accepted

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

aa, ab, bb = [], [], []

for x in l:
  if x <= a:
    aa.append(x)
  elif a + 1 <= x and x <= b:
    ab.append(x)
  else:
    bb.append(x)

print(min(map(len, [aa, ab, bb])))

Submission status: Accepted

Solution code:
from itertools import combinations
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
arr=[0]*3

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

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
l = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(n):
    if l[i] <= a:
        x += 1
    elif a + 1 <= l[i] <= b:
        y += 1
    elif b + 1 <= l[i]:
        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()))

cnt = [0] * 3
for pi in p:
    if(pi <= a):
        cnt[0] += 1
    elif(pi > b):
        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 = list(map(int,input().split()))
a1 = 0
for i in range(A+1):
    a1 += p.count(i)
a2 = 0
for i in range(A+1,B+1):
    a2 += p.count(i)
a3 = 0
for i in range(B+1,21):
    a3 += p.count(i)

print(min(a1,a2,a3))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
listA=[]
listB=[]
listC=[]
for i in P:
    if i<=A:
        listA.append(i)
    elif A+1<=i<=B:
        listB.append(i)
    else:
        listC.append(i)
print(min(len(listA),len(listB),len(listC)))

Submission status: Accepted

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

lis = sorted(lis, reverse=True)

cnt = 0
for i in range(n):
    tmp = []
    for j in lis:
        if j >= b+1:
            tmp.append(j)
            break
    for k in lis:
        if a+1 <= k <= b:
            tmp.append(k)
            break
    
    for l in lis:
        if l <= a:
            tmp.append(l)
            break
    
    if len(tmp) == 3:
        cnt += 1
    
    for x in tmp:
        lis.remove(x)

print(cnt)

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
    elif a + 1 <= 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 = [int(x) for x in input().split()]
A=0
B=0
C=0
for i in range(n):
    if p[i] <= a:
        A += 1
    elif p[i] > a and b >= p[i]:
        B += 1
    else:
        C += 1

print(min(A, B, C))

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A, B = LI()
    P = LI()

    ans = [0] * 3
    for i in P:
        if i <= A:
            ans[0] += 1
        elif A + 1 <= i <= B:
            ans[1] += 1
        else:
            ans[2] += 1

    print(min(ans))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n=int(input())
a,b,=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(min(sum(i<=a for i in p),sum(a<i and i<=b for i in p),sum(b<i for i in p)))

Submission status: Accepted

Solution code:
import itertools

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

cnt = 0
first = []
second = []
third = []
for i in points:
    if i <= a:
        first.append(i)
    elif a+1 <= i and i <= b:
        second.append(i)
    else:
        third.append(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,a,b,*p,=map(int,open(0).read().split())
A,B,C=0,0,0
for i in p:
    if i<=a:
        A+=1
    elif i<=b:
        B+=1
    else:
        C+=1
print(min(A,B,C))

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int,input().split())
NNN = map(int,input().split())
NN= list(NNN)
counta = 0
countb = 0
countc = 0
for i in NN:
  if i <= A:
    counta += 1
for i in NN:
  
  if A < i <= B:
    countb += 1
for i in NN:
  if B < i:
    countc += 1


print(min(counta,countb,countc))

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
easy = []
norm = []
hard = []
for pi in p:
    if pi <= a:
        easy.append(pi)
    elif a < pi <= b:
        norm.append(pi)
    else:
        hard.append(pi)

ans = min(len(easy), len(norm))
ans = min(ans, len(hard))
print(ans)

Submission status: Accepted

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

q = {0:0, 1:0, 2:0}
for i in p:
    if i <= a:
        q[0] += 1
    elif i >= b + 1:
        q[2] += 1
    else:
        q[1] += 1
print(min(q.values()))

Submission status: Accepted

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

cnt = [0]*3

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

Submission status: Accepted

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

fst, snd, thr = 0, 0, 0

for p in P:
    if p <= a:
        fst += 1
    elif a + 1 <= p <= b:
        snd += 1
    else:
        thr += 1

print(min([fst, snd, thr]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
count=[0]*3
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:
N = int(input())
A,B = map(int, input().split())
*P, = map(int, input().split())

P.sort()

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

print(min(c))

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>A and x<=B 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()))
count =[0,0,0]

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

min = 100    
for i in count:
  if min > i:
    min = i
print(min)

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a,b=mp()
p=lmp()
ans=[0,0,0]
for i in p:
    if i<=a:
        ans[0]+=1
    elif 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 = [int(i) for i in input().split()]
x = len(list(filter(lambda x: x <= a, p)))
y = len(list(filter(lambda x: a < x <= b, p)))
z = len(list(filter(lambda x: b < x, p)))
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()))
c1, c2, c3 = 0, 0, 0

for pi in p:
    if pi<=A:
        c1 += 1
    elif A<pi<=B:
        c2 += 1
    else:
        c3 += 1

print(min(c1, c2, c3))

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 pp in p:
    if pp <= a:
        c += 1
    elif pp <= 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()))
check=[0]*3
for x in P:
  if x<=A:
    check[0]+=1
  elif A<x<=B:
    check[1]+=1
  else:
    check[2]+=1
print(min(check))

Submission status: Accepted

Solution code:
import math
import sys
import collections
import bisect


def main():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    q = [0, 0, 0]
    for i in range(n):
        if p[i] <= a:
            q[0] += 1
            continue
        if p[i] <= b:
            q[1] += 1
            continue
        q[2] += 1
    print(min(q))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A, B = map(int, readline().split())
    P = list(map(int, readline().split()))
    a = 0
    b = 0
    c = 0
    for p in P:
        if p<=A:
            a += 1
        elif A<p<=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()))
small = 0
medium = 0
large = 0
for score in p:
    if score <= a:
        small += 1
    elif a < score <= b:
        medium += 1
    elif score > b:
        large += 1
ans = min(small, medium, large)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
dp = [0]*3

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

print(min(dp))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
p1 = []
p2 = []
p3 = []

for i in p:
    if i <= a:
        p1.append(i)
    elif a < i <= b:
        p2.append(i)
    else:
        p3.append(i)

ans = min(len(p1), len(p2), len(p3))
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=sorted(list(map(int,input().split())))
X=0
Y=0
Z=0
for i in range(N):
  if P[i]<=A:
    X+=1
  elif A+1<=P[i]<=B:
    Y+=1
  else:
    Z+=1
X=min(X,Y)
print(min(X,Z))

Submission status: Accepted

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

cnt = [0, 0, 0]
for pi in p:
    if pi <= a:
        cnt[0] += 1
    elif pi <= b:
        cnt[1] += 1
    else:
        cnt[2] += 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()]


q1 = sum(x <= a for x in p)
q2 = sum(a < x <= b for x in p)
q3 = sum(b < x for x in p)

print(min(q1, q2, q3))

Submission status: Accepted

Solution code:
input()
a, b = map(int, input().split())
s = t = u = 0
for p in map(int, input().split()):
  if p <= a:
    s += 1
  elif p <= b:
    t += 1
  else:
    u += 1
print(min(s, t, u))

Submission status: Accepted

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

cnt = {0:0, 1:0, 2:0}

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

print(min(cnt.values()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    A, B = mi()
    P = list(mi())
    diff_a = sum(1 for p in P if p <= A)
    diff_b = sum(1 for p in P if A < p <= B)
    diff_c = sum(1 for p in P if p > B)
    print(min(diff_a, diff_b, diff_c))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
#N, h, w = map(int,input().split())
N = int(input())
#s = list(map(str,input().split()))
a, b = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
c1 = 0
c2 = 0
c3 = 0

for p in P:
    if p <= a:
        c1 += 1
    elif a < p <= b:
        c2 += 1
    else:
        c3 += 1
print(min(c1,c2,c3))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
first = 0
second = 0
third = 0
for P in input().split():
    P = int(P)
    if P <= A:
        first += 1
    elif P <= B:
        second += 1
    else:
        third += 1
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()))
e,m,d=0,0,0
for x in p:
    if x<=a:e+=1
    if a<x<=b:m+=1
    if b<x:d+=1
print(min(e,m,d))

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 A + 1 <= 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()))

c, d, e = [],[],[]

for i in range(n):
  if p[i] <= a:
    c.append(p[i])
  elif p[i] <= b:
    d.append(p[i])
  else:
    e.append(p[i])
print (min(len(c),len(d),len(e)))