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

Solution (Python):
n=int(input())
a_b=[int(i) for i in input().split()]
p=[int(i) for i in input().split()]




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

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

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

print(m)

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

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

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

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

print( min(ans) )

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

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

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

print(min(num1, num2, num3))

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

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

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

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

Solution (Python):

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


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


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


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

Solution (Python):

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



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


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


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    B()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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

    print(min(problem))



if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
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))

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

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

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


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


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


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

a = 0
b = 0
c = 0

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

print(min(a,b,c))

Solution (Python):


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

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

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a,b = LI()
    p = LI()
    c = len([k for k in p if k <= a])
    d = len([k for k in p if k > a and k <= b])
    e = len([k for k in p if k > b])

    return min([c,d,e])



print(main())

Solution (Python):
def conte(n,ab,p):
    a=ab[0]
    b=ab[1]
    cnt=0
    x=0
    y=0
    z=0
    for i in range(n):
        if p[i]<=a:
            x+=1
        elif p[i]<=b:
            y+=1
        else:
            z+=1
    return min(x,y,z)
print(conte(int(input()),[int(i) for i in input().split()],[int(i) for i in input().split()]))

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

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

first = []
second = []
third = []

for p in P:
    if p <= A:
        first.append(p)
    elif (A < p <= B):
        second.append(p)
    else:
        third.append(p)

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

Solution (Python):
N = int(input())
A,B = (int(x) for x in input().split())
a = []
b = []
c = []
for i in input().split():
    i = int(i)
    if(i<=A):
        a.append(i)
    elif(i<=B):
        b.append(i)
    else:
        c.append(i)
print(min(len(a),len(b),len(c)))

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

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

print(min(q))

Solution (Python):



def main():
    n = int(input())
    a, b = map(int, input().split())
    p = list(map(int, input().split()))
    group_1 = list()
    group_2 = list()
    group_3 = list()

    for pi in p:
        if pi <= a:
            group_1.append(pi)
        elif pi > b:
            group_3.append(pi)
        else:
            group_2.append(pi)

    print(min(len(group_1), len(group_2), len(group_3)))


if __name__ == '__main__':
    main()

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

Solution (Python):

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

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

print(
    min(
        len(list(filter(lambda x: x <= A, P))),
        len(list(filter(lambda x: A < x <= B, P))),
        len(list(filter(lambda x: B < x, P))),
    )
)

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

Solution (Python):


n = int(raw_input())

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

l = map(int, raw_input().split())


first=len([x for x in l if x <= a ])
second=len([x for x in l if (x >= a+1 and x<=b)])
third=len([x for x in l if x >= b+1 ])

print min(first,second,third)

Solution (Python):
import numpy as np

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

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

Solution (Python):
n=int(input())
(a,b)=list(map(lambda x: int (x), input().split()))
c=list(map(lambda x: int(x), input().split()))

n1=0
n2=0
n3=0

for i in c:
    if i <= a:
        n1 += 1
    elif a + 1 <= i and i <= b:
        n2 += 1
    else:
        n3 += 1

print(min([n1, n2, n3]))

Solution (Python):
import sys

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

if all([a<p for p in ps]) or all([p<b for p in ps]):
  print(0)
  sys.exit()

small = list(filter(lambda x: x<=a, ps))
large = list(filter(lambda x: x>b, ps))
other = list(filter(lambda x: not x in small and not x in large, ps))

print(min(len(small), len(large), len(other)))

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

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

P = [int(s) for s in P_str]
P_Aless = len([i for i in P if i <= A])
P_ABmiddle = len([i for i in P if (i > A and i <= B)])
P_Blarger = len([i for i in P if i > B])
min = min([P_Aless,P_ABmiddle,P_Blarger])
print(min)

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

t,c = 0,0
q=[0,0,0]

while (len(p)>c):
    q[0] += 1 if p[c]>0 and p[c]<=a else 0
    q[1] += 1 if p[c]>a and p[c]<=b else 0
    q[2] += 1 if p[c]>b and p[c]<=20 else 0
    c+=1

print(min(q))

Solution (Python):
n = int(input())
a, b = map(int, input().split())
listP = list(map(int, input().split()))

listQ1=[]
listQ2=[]
listQ3=[]

index=0
while index< len(listP):
    if listP[index]<a+1:
        listQ1.append(listP[index])
    elif listP[index]<b+1:
        listQ2.append(listP[index])
    else:
        listQ3.append(listP[index])
    index+=1

print(min(len(listQ1), len(listQ2), len(listQ3)))

Solution (Python):

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 <= B for x in P)
c = N - a - b
print(min(a, b, c))

Solution (Python):
n = int(input())
a, b = map(int,input().split())
p = [int(x) for x in 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))

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

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

a, b, c = 0, 0, 0

for i in input().split():
    item = int(i)
    if item <= A:
        a += 1
    elif A + 1 <= item <= B:
        b += 1
    elif B < item:
        c += 1

print(min(a, b, c))

Solution (Python):
n=int(input())
a,b=list(map(int,input().split()))
arr=list(map(int,input().split()))
ans1=[]
ans2=[]
ans3=[]
for num in arr:
    if num<=a:ans1+=[num]
    elif num>b:ans3+=[num]
    else:ans2+=[num]
print(min(len(ans1),len(ans2),len(ans3)))

Solution (Python):
n = int(input())
a, b = [int(_) for _ in input().split(' ')]
p = [int(_) for _ in input().split(' ')]
c1 = len([i for i in p if i <= a])
c2 = len([i for i in p if a + 1 <= i and i <= b])
c3 = len([i for i in p if b + 1 <= i])
print(min(c1, c2, c3))

Solution (Python):

from sys import stdin
import numpy as np

s_in = lambda: stdin.readline()[:-1]  
d_in = lambda: int(stdin.readline())  
ds_in = lambda: list(map(int, stdin.readline().split()))  


N = d_in()
A, B = ds_in()
p_list = np.array(ds_in())

first = (p_list <= A).sum()
second = np.logical_and(p_list > A, p_list <= B).sum()
third = (p_list > B).sum()
print(min(first, second, third))

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

P = list(map(int,input().split()))
one=0
two=0
thre=0
for i in range(N):
    if P[i]<=A:
        one+=1
    elif P[i]<=B:
        two+=1
    else:
        thre+=1
print(min(one,two,thre))

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

one, two, three = 0, 0, 0
for i in p:
	if i <= a:
		one += 1
	elif a < i <= b:
		two += 1
	else:
		three += 1
print(min(one, two, three))

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

l = ["x" if i <= A else "y" if A < i <= B else "z" for i in P]
c = [l.count("x"), l.count("y"), l.count("z")]
c.sort()

print(c[0])

Solution (Python):
a = int(input())
b,c = map(int,input().split())
lis = input().split()

li = [int(l) for l in lis]

judge = True

d = 0

li.sort()

while judge:
    if li == []:
        break
    
    s = []
    for n in li:
        if n <= b:
            s.append(n)
            li.remove(n)
            break
        else:judge = False

    for n in li:
        if n >= b+1 and n<=c:
            s.append(n)
            li.remove(n)
            break
        else:judge = False

    for n in li:
        if n>=c+1:
            s.append(n)
            li.remove(n)
            break
        else:
            judge= False

    if len(s) == 3:
        d+=1
        judge = True
    else:judge=False

print(d)

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

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

print(min(q_counts))

Solution (Python):






def main():
    N = int(raw_input().strip())
    A, B = [int(i) for i in raw_input().strip().split(' ')]
    P = [int(i) for i in raw_input().strip().split(' ')]

    q1, q2, q3 = 0, 0, 0
    for p in P:
        if p <= A:
            q1 += 1
        elif p <= B:
            q2 += 1
        else:
            q3 += 1
    print min(q1, q2, q3)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
N = int(raw_input())
A,B = map(int,raw_input().split())
cnt = [0,0,0]
arr = map(int,raw_input().split())
for i in arr:
    if i<=A:
        cnt[0] += 1
    elif i>B:
        cnt[1] += 1
    else:
        cnt[2] += 1
print min(cnt)

Solution (Python):
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:z+=1
    else:y+=1
print(min(x,y,z))

Solution (Python):
n = int(input())
a, b = list(map(int, input().split()))
p = list(map(int, input().split()))
cnta = 0
cntb = 0
cntc = 0
for pi in p:
  if pi <= a:
    cnta += 1
  elif pi <= b:
    cntb += 1
  else:
    cntc += 1
ans = min([cnta, cntb, cntc])
print(ans)

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

easy = 0
normal = 0
hard = 0

for i in P:
    if i <= A:
        easy += 1
    elif A < i <= B:
        normal += 1
    else:
        hard += 1

print(min(easy, normal, hard))

Solution (Python):

N=int(input())
li=[]
A,B=map(int,input().split())

a=list(input().split())
a=[int(s) for s in a]
under=0
middle=0
upper=0


count=0
def hold(a):
    global under
    global middle
    global upper
    global A
    global B
    for i in range(len(a)):
        if a[i]<=A:
            under+=1
        elif a[i]>=B+1:
            upper+=1
        else:
            middle+=1
    return [under,middle,upper]                
d=hold(a)

print(min(d))

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

a = b = c = 0
for pi in P:
    if pi <= A:
        a += 1
    if A < pi <= B:
        b += 1
    if B < pi:
        c += 1

print(min(a, b, c))

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

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

print(min(q))

Solution (Python):
import sys

def main():
    N = int(input())

    flds = input().split(' ')
    pt_A, pt_B = int(flds[0]), int(flds[1])

    flds = input().split(' ')
    points = [-1]*N
    for i in range(N):
        points[i] = int(flds[i])

    e, m, h = 0, 0, 0
    for i in range(N):
        if points[i] <= pt_A:
            e += 1
        elif points[i] <= pt_B:
            m += 1
        else:
            h += 1
    ans = min(e, m, h)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):


import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


N = II()
A, B = LI()
P = LI()

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

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

P = sorted(P)
c1 = bisect.bisect(P, A)
c2 = bisect.bisect(P, B) - c1
c3 = N - c1 - c2
print(min(c1, c2, c3))

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

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

n1 = sum(p <= A for p in P)
n2 = sum(A < p <= B for p in P)
n3 = sum(B < p for p in P)

print(min(n1,n2,n3))

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

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=[int(i) for i in input().split()]
L,C,R=(0,0,0)
for i in range(N):
    if P[i]<=A:
        L+=1
    elif P[i]<=B:
        C+=1
    else:
        R+=1
print(min(L,C,R))

Solution (Python):
n = int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
print(min(sum(x<=a for x in p),sum(x>a and x<=b for x in p),sum(x>b for x in p)))

Solution (Python):
N=int(input())
A,B=map(int,input().split())
P=list(map(int,input().split()))
e=0
n=0
h=0
for i in range(N):
    if P[i]<=A:
        e+=1
    elif P[i]<=B:
        n+=1
    else:
        h+=1
print(min(e,n,h))

Solution (Python):
n = int(input())
minp, maxp = map(int, input().split())
scores = list(map(int, input().split()))
cnta, cntb, cntc = 0, 0, 0
for item in scores:
    if(item <= minp): cnta+=1
    elif(item <= maxp): cntb+=1
    else: cntc+=1
qnum = min([cnta, cntb, cntc])
print(qnum)

Solution (Python):
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
a = []
b = []
c = []
for p in P:
    if p <= A:
        a.append(p)
    elif A + 1 <= p <= B:
        b.append(p)
    else:
        c.append(p)

print(min(len(a),len(b),len(c)))

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

Solution (Python):
n=int(input())
a,b=map(int,input().split())
arr=list(map(int,input().split()))
count1=0
count2=0
count3=0
for i in range(n):
    if(arr[i]<=a):
        count1+=1
    elif(arr[i]>a and arr[i]<=b):
        count2+=1
    else:
        count3+=1
print(min(min(count1,count2),count3))

Solution (Python):

N = int(input())
line = input().split()
A = int(line[0])
B = int(line[1])
line = input().split()
q_num = [0, 0, 0]
for i in line:
  i = int(i)
  if i <= A:
    q_num[0] += 1
  elif i > B:
    q_num[2] += 1
  else:
    q_num[1] += 1
print(min(q_num))

Solution (Python):
from collections import deque
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
n = int(input())
a,b = map(int,input().split())
x = list(map(int,input().split()))
iti = 0
ni = 0
san = 0
for i in range(n):
        if x[i] <= a:
                iti += 1
        elif a+1<= x[i] and x[i] <= b:
                ni += 1
        else:
                san += 1
print(min(iti,ni,san))

Solution (Python):
num = int(input())
tmp = input()
A = int(tmp.split(' ')[0])
B = int(tmp.split(' ')[1])
ans_list = [0,0,0]

list = input().split(' ')

for i in list:
    if int(i)<=A:
        ans_list[0]+=1
    elif int(i)<=B:
        ans_list[1] += 1
    else:
        ans_list[2] += 1

print(min(ans_list))

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

Solution (Python):
n=int(input())
a,b=map(int,input().split())
p =list(map(int,input().split()))
e=f=g=0
for i in p:
    if i<=a:
        e+=1
    elif i>=a and i<=b:
        f+=1
    else:
        g+=1
print(min(e,f,g))

Solution (Python):
n=int(input())
a,b=map(int,input().split())
*p,=map(int,input().split())

A=len(list(filter(lambda x:x<=a,p)))
B=len(list(filter(lambda x:a+1<=x<=b,p)))
C=len(list(filter(lambda x:x>=b+1,p)))
print(min(A,B,C))

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

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

q1 = len([p for p in P if p <= A])
q2 = len([p for p in P if A < p and p <= B])
q3 = len([p for p in P if p > B])

print(min(q1, q2, q3))

Solution (Python):




def solveProblem(problemSeed,FirstScore,SecondScore,ScoreList):
	firstBarrier = 0
	secondBarrier = 0
	lastBarrier = 0
	for problemNo in range(0,len(ScoreList),+1):
		problemScore = ScoreList[problemNo]
		if problemScore <= FirstScore:
			firstBarrier = firstBarrier + 1
		elif ( FirstScore+1 <= problemScore ) and ( problemScore <= SecondScore):
			secondBarrier = secondBarrier + 1
		else : 
			lastBarrier = lastBarrier + 1
	problemPattern = min(firstBarrier, secondBarrier,lastBarrier)
	answer = problemPattern
	return answer


if __name__ == '__main__':
	N = int(input().strip())
	A,B = map(int,input().strip().split(' '))
	Ps = list(map(int,input().strip().split(' ')))
	solution = solveProblem(N,A,B,Ps)
	print("{}".format(solution))

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

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

ans = min(a,b,c)
print(ans)