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())
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
    elif  b + 1 <= p[i]:
        z += 1

#print(x,y,z)
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()))
x = 0
y = 0
z = 0

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    cnt = [0]*3
    for v in p:
        if v <= a:
            cnt[0] += 1
        elif v <= 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()))

first = 0
second = 0
third = 0

for i in p:
    if i<=a:
        first += 1
    elif i<=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()))

c = [0] * 3
for Pi in P:
    if Pi <= A:
        c[0] += 1
    elif Pi <= B:
        c[1] += 1
    else:
        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()))
l=[0,0,0]

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

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

p1 = 0
p2 = 0
p3 = 0

for p in P:
    if p <= a:
        p1 += 1
    elif p <= 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()))
q1,q2=0,0
for i in range(n):
    if p[i]<=a:
        q1+=1
    elif p[i]<=b:
        q2+=1
print(min(q1,q2,n-(q1+q2)))

Submission status: Accepted

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

Submission status: Accepted

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

print(min(counts))

Submission status: Accepted

Solution code:
N,A,B,*P=map(int, open(0).read().split())
S=[0]*3
f=lambda p:(A+1<=p)+(B+1<=p)
for p in P:
    S[f(p)]+=1
print(min(S))

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int, input().split())
dat = list(map(int, input().split()))
q1=q2=q3=0
for i in range(n):
    if dat[i] <= a:
        q1 += 1
    elif a < dat[i] <= b:
        q2 += 1
    else:
        q3 += 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()))
cnt1=0
cnt2=0
cnt3=0
for i in range(n):
    if p[i]<=a:
        cnt1+=1
    elif p[i]<=b:
        cnt2+=1
    else:cnt3+=1
print(min(cnt1,cnt2,cnt3))

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



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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

n = int(input())
a, b = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
p1 = [x for x in p if x <= a]
p2 = [x for x in p if a < x <= b]
p3 = [x for x in p if b < x]
r = [len(p1), len(p2), len(p3)]
print(min(r))

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] >= B+1):
        cnt[2] += 1
    elif(P[i] <= A):
        cnt[0] += 1
    else:
        cnt[1] += 1
print(min(cnt))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
li = list(map(int, input().split()))
li.sort()
x = len([i for i in li if i <= a])
y = len([i for i in li if a < i <= b])
z = len([i for i in li if b < i])
print(min(x, y, z))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
l=list(map(int,input().split()))
x,y=sum(i<=a for i in l),sum(b<i for i in l)
print(min(x,y,len(l)-x-y))

Submission status: Accepted

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

problem_set = [0] * 3

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

print(min(problem_set))

Submission status: Accepted

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

p1 = []
p2 = []
p3 = []

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

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read

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

a = 0
b = 0
c = 0
for i in P:
    if i <= A:
        a += 1
    elif A < 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())
P = list(map(int,input().split()))
cnt = 0
e,m,h = 0,0,0
for i in range(N):
	if P[i] <= A:
		e+=1
	elif P[i] <= B:
		m+=1
	else:
		h+=1
ans = min(min(e,m),h)
print(ans)

Submission status: Accepted

Solution code:
def main(n, a, b, p):
    _a, _ab, _b = 0, 0, 0

    for p in p:
        if p <= a:
            _a += 1
        elif a < p <= b:
            _ab += 1
        elif p > b:
            _b += 1

    print(min(_a, _ab, _b))


if __name__ == "__main__":
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))

    main(n, a, b, p)

Submission status: Accepted

Solution code:
number=int(input().rstrip())
A,B=input().rstrip().split()
score=input().rstrip().split()
score=list(map(int,score))

score.append(int(A)+1)
score.append(int(B)+1)
score.sort()
n1=score.index(int(A)+1)
n2=score.index(int(B)+1)-score.index(int(A)+1)-1
n3=number-score.index(int(B)+1)+1
#print(n1)
#print(n2)
#print(n3)
#print(score)
print(min(n1,n2,n3))

Submission status: Accepted

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

lis = [0,0,0]

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

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

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
print(min(cnt))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
a,b = [int(x) for x in stdin.readline().rstrip().split()]
li = list(map(int,stdin.readline().rstrip().split()))

one = 0
two = 0
three = 0

for i in li:
    if i <= a:
        one += 1
    elif a+1 <= i <= b:
        two += 1
    else:
        three += 1
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()))
q = [0,0,0]
for i in p:
  if i <= a:
    q[0] += 1
  elif b < i:
    q[2] += 1
  else:
    q[1] += 1
q.sort()
print(q[0])

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 x in p:
    if x <= a:
        c += 1
    elif x <= 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())
x=list(map(int,input().split()))
t=0
u=0
v=0
for i in x:
  if i<=a:
    t+=1
  elif i<=b:
    u+=1
  else:
    v+=1
print(min(t,u,v))

Submission status: Accepted

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

cnt1 = 0
cnt2 = 0
cnt3 = 0

for i in range(n):
    if ls[i] <= a:
        cnt1 += 1
    elif a + 1 <= ls[i] <= b:
        cnt2 += 1
    elif ls[i] >= b + 1:
        cnt3 += 1

print(min(cnt1, cnt2, cnt3))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

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

	if j == n-1:
		print(0)
		sys.exit()

cnt_3 = n-j
print(min(cnt_1,cnt_2,cnt_3))

Submission status: Accepted

Solution code:
import sys
if sys.platform =='ios':
	sys.stdin=open('input.txt')
	
n = int(input())

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

l = list(map(int,input().split()))
k = [0]*3

for i in range(n):
	if l[i]<=a:
		k[0]=k[0]+1
	elif a<l[i]<=b:
		k[1]=k[1]+1
	elif b<l[i]:
		k[2]=k[2]+1

print(min(k))

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 A+1<= 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())
cnt = [0,0,0]
for p in list(map(int,input().split())):
  if p<=A:
    cnt[0] += 1
  elif A<p and 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())
probs = [0] * 3
for p in map(int, input().split()):
    if p <= A:
        probs[0] += 1
    elif p <= B:
        probs[1] += 1
    else:
        probs[2] += 1
print(min(probs))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
import sys
for i in range(N):
    for l in range(N-3*i):
        if P[l] <= A:
            del P[l]
            break
        elif l == N-3*i-1:
            print(i)
            sys.exit()
    for l in range(N-3*i-1):
        if A < P[l] <= B:
            del P[l]
            break
        elif l == N-3*i-2:
            print(i)
            sys.exit()
    for l in range(N-3*i-2):
        if B < P[l]:
            del P[l]
            break
        elif l == N-3*i-3:
            print(i)
            sys.exit()
    if not P:
        print(i+1)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

under=0
middle=0
upper=0

for i in li:
    if i<=a:
        under+=1
    elif a+1 <=i <= b:
        middle+=1
    else:
        upper+=1
print(min(under,middle,upper))

Submission status: Accepted

Solution code:
n,a,b,*p=map(int,open(0).read().split())
x=y=z=0
for q in p:
  if q<=a:
    x+=1
  elif a<q<=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()))
one = 0
two = 0
three = 0
for i in range(N):
  if P[i] <= A:
    one += 1
  elif P[i] > A and P[i] <= B:
    two += 1
  else:
    three += 1
ans = min(one,two)
ans = min(ans,three)
print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))

p1 = 0
p2 = 0
p3 = 0

for i in p:
  if i <= a:
    p1 += 1
  elif i >= (a+1) and i <= b:
    p2 += 1
  elif i >= (b+1):
    p3 += 1

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

Submission status: Accepted

Solution code:
def examB():
    N = I(); A,B = LI()
    P = LI()
    exam = [0]*3
    for i in P:
        if i<=A:
            exam[0] +=1
        elif i<=B:
            exam[1] +=1
        else:
            exam[2] +=1
    ans = min(exam)
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

Submission status: Accepted

Solution code:
# 2019/12/7

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

f,s,t=0,0,0
for e in p:
    if e<=a:f+=1
    elif b+1<=e:t+=1
    else:s+=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()))
C = {1:0,2:0,3:0}
for i in range(N):
    if P[i]<=A:
        C[1] += 1
    elif P[i]<=B:
        C[2] += 1
    else:
        C[3] += 1
print(min(C[1],C[2],C[3]))

Submission status: Accepted

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

q1,q2,q3=0,0,0

for i in range(n):
    if p[i]<=a:
        q1+=1
    elif p[i]<=b:
        q2+=1
    else:
        q3+=1

print(min([q1,q2,q3]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(N: int, A: int, B: int, P: "List[int]"):
    P.sort()
    from bisect import bisect_left, bisect_right
    x = bisect_right(P, A)
    y = bisect_right(P, B)

    print(min(x, y-x, N-y))

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A, B, P)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

x = len([0 for i in P if i<=A])
y = len([0 for i in P if i>=A+1 and i<=B])
z = len([0 for i in P if i>=B+1])

print(min(min(x,y),z))

Submission status: Accepted

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

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

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

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 p in P:
  if p <= a:
    C[0] += 1
  elif a < p <= b:
    C[1] += 1
  else:
    C[2] += 1

print(min(C))

Submission status: Accepted

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

one = [p for p in pli if p<=a]
two = [p for p in pli if (a+1)<=p<=b]
the = [p for p in pli if (b+1)<=p]

print(min([len(one), len(two), len(the)]))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if 0 < p[i] <= a:
        if a+1 <= p[j] <= b:
          if b+1 <= p[k]:
            ans += 1
            p[i] = 0
            p[j] = 0
            p[k] = 0

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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 a+1<=i<=b:
        second+=1
    elif i>=b+1:
        third+=1
co=0
while True:
    if first>0 and second>0 and third>0:
        first-=1
        second-=1
        third-=1
        co+=1
    else:
        break
print(co)

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

print(min((x, y, z)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random

import os
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A,B = inputMap()
    P = inputList()
    
    rinko = []
    manaka = []
    nene = []
    for i in P:
        if i <= A:
            rinko.append(i)
        elif i >= B+1:
            nene.append(i)
        else:
            manaka.append(i)
            
    print(min(len(rinko), len(nene), len(manaka)))
    
if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter

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

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

if len(cli.keys()) != 3:
  print(0)
else:
  print(min(cli.values()))

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a,b = inpl()
p = inpl()
d = defaultdict(int)
for i in p:
    if i <= a:
        d[0] += 1
    elif a < i <= b:
        d[1] += 1
    else:
        d[2] += 1
print(min(d[0],d[1],d[2]))

Submission status: Accepted

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

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

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 p:
  if i <= a:
    c1 += 1
  elif i <= 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()))

p.sort()

s = 0
t = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
c=0
c1=0
c2=0
for i in range(n):
    if p[i]<=a:
        c+=1
    elif a<p[i]<=b:
        c1+=1
    else:
        c2+=1
print(min(c,c1,c2))

Submission status: Accepted

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

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

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 a < 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())
p = [int(i) for i in input().split()]
p_a = len([i for i in p if i <= a])
p_a_b = len([i for i in p if a < i <= b])
p_b = n - p_a - p_a_b
print(min(min(p_a, p_b), p_a_b))

Submission status: Accepted

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

one = 0
two = 0
for p in P:
    if p <= A:
        one += 1
    elif A < p <= B:
        two += 1

print(min(one, two, N - (one + two)))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
C=[0]*3
for i in range(N):
  if(P[i]<=A):
    C[0]+=1
  elif(P[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())
P = list(map(int, input().split()))

p1, p2, p3 = 0, 0, 0
for p in P:
    if p <= a:
        p1 += 1
    elif p <= 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()))

ans=0
p.sort()
v=0
x=0
z=0
for i in range(len(p)):
    if p[i]<=a:
        v+=1
    elif a<p[i]<=b:
        x+=1
    else:
        z+=1

print(min(v,x,z))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
p = list(map(int, input().split()))
oneCnt = 0
twoCnt = 0
treeCnt = 0
for i in p:
    if i <= A:
        oneCnt += 1
    elif A + 1 <= i <= B:
        twoCnt += 1
    else:
        treeCnt += 1

print(min(oneCnt, twoCnt, treeCnt))

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
lis = list(map(int,input().split()))
pro1,pro2,pro3 = 0,0,0
for problem in lis:
  if problem <= a:pro1 += 1
  elif problem <= b:pro2 += 1
  else:pro3 += 1
print(min(pro1,pro2,pro3))

Submission status: Accepted

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A, B = list(map(int, sys.stdin.readline().split()))
P = list(map(int, sys.stdin.readline().split()))

P = np.array(P, dtype=int)
c1 = (P <= A).sum()
c2 = (B < P).sum()
c3 = N - c1 - c2

print(min(c1, c2, c3))

Submission status: Accepted

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

Submission status: Accepted

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

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 p:
    if i <= a:
        c1 += 1
    elif a < i <= b:
        c2 += 1
    elif b < i:
        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()))

x1 = 0
x2 = 0
x3 = 0

for i in range(n):
    if p[i] <= a:
        x1 += 1
    elif a < p[i] <= b:
        x2 += 1
    else:
        x3 += 1

print(min(x1, x2, x3))

Submission status: Accepted

Solution code:
N = int(input())
A, B = tuple(map(int, input().split()))
P = list(map(int, input().split()))
first = [p for p in P if p <= A]
second = [p for p in P if A + 1 <= p <= B]
third = [p for p in P if B + 1 <= p]
print(min(len(first), len(second), len(third)))

Submission status: Accepted

Solution code:
import sys
def input():
	return sys.stdin.readline().strip()

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

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

print(min(sum_list))

Submission status: Accepted

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

ans=[0]*3

for i in range(n):
    if l[i]<=a:
        ans[0]+=1
    elif l[i]>b:
        ans[2]+=1
    else:
        ans[1]+=1
print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

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

ans = [0,0,0]
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()))

C=[0]*3
for p in P:
  if p<=A:
    C[0]+=1
  elif A+1<=p<=B:
    C[1]+=1
  else:
    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()))
x, y, z=0, 0, 0

for i in p:
    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=list(map(int, input().split()))
ul=[]
ml=[]
ol=[]
sorted(l)
for i in range(n):
	if l[i]<=a:
		ul.append(l[i])
	elif (a+1)<=l[i]<=b:
		ml.append(l[i])
	elif l[i]>=(b+1):
		ol.append(l[i])
print(min(len(ul),len(ml),len(ol)))

Submission status: Accepted

Solution code:
def main():

    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 <= B:
            count[1] += 1
        else:
            count[2] += 1
    return min(count)

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

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
p=list(map(int,input().split()))
No1=No2=No3=0

for i in p:
    if i <= A:
        No1 += 1
    elif i >= A and i <= B:
        No2 += 1
    else:
        No3 += 1

print(min(No1,No2,No3))

Submission status: Accepted

Solution code:
def solve(n, a, b, p):
    v = [0] * 3
    for i in range(n):
        if p[i] <= a:
            v[0] += 1
        elif p[i] <= b:
            v[1] += 1
        else:
            v[2] += 1
    return min(v)

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