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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))

Submission status: Accepted

Solution code:
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))),
    )
)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
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)

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np

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


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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AISing Programming Contest 2019：B - Contests


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# coding: utf-8
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
# _*_ coding:utf-8 _*_
#  Atcoder_AISingProgramming_Contest-B
#  TODO https://aising2019.contest.atcoder.jp/tasks/aising2019_b

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 : # secondScore + 1 <= problemScore
			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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
a = int(input())
b,c = (int(x) for x in input().split())
lis =[]
lis = input().split()
lis = [int(s) for s in lis]

d = int(0)
e = int(0)
f = int(0)

for i in range(a):
  if lis[i] <= b:
    d += 1 
  elif b+1 <= lis[i] <= c:
    e += 1
  else:
    f += 1

if min(d,e,f,) > 0:
  print(min(d,e,f,))
else:
  print(0)

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.readlines()

N = int(lines[0])
A, B = map(int, lines[1].split())
Ps = [int(n) for n in lines[2].split()]

Ps.sort()

count = 0

p_p1 = [x for x in Ps if x <= A]
p_p2 = [x for x in Ps if (x >= A + 1) and (x <= B)]
p_p3 = [x for x in Ps if x >= B + 1]

#print(p_p1)
#print(p_p2)
#print(p_p3)

print(min([len(p_p1), len(p_p2), len(p_p3)]))

Submission status: Accepted

Solution code:
n = int(input())
list1 = list(map(int,input().split()))
list2=list(map(int,input().split()))

a = list1[0]
b = list1[1]

num0 = sum([1 for p in list2 if p <=a])
num2 = sum([1 for p in list2 if p > b])
num1 = n - num0 -num2
print(min([num0,num1,num2]))

Submission status: Accepted

Solution code:
#あなたはプログラミングコンテストを開催するため問題を N 問作成しました。
#このうち i 問目をコンテストに出題する場合、配点は Pi 点となります。

#これらの問題を使って、以下の条件を満たすコンテストをできるだけ多く開催したいと思います。
#異なるコンテストの間で問題の重複があってはいけません。 最大で何回のコンテストを開催できますか。

#問題が 3 問出題され、1 問目の配点は A 点以下、2 問目の配点は A+1 点以上 B 点以下、3 問目の配点は B+1 点以上である。

N = int(input())

a = input().rstrip().split(" ")
A = int(a[0])
B = int(a[1])
#点数
P = input().rstrip().split(" ")

f = []
for i in range(len(P)):
    if int(P[i]) <= A:
        f.append(int(P[i]))
#print(f)
s = []
for i in range(len(P)):
    if int(P[i]) > A and int(P[i]) <= B:
        s.append(int(P[i]))
#print(s)
t = []
for i in range(len(P)):
    if int(P[i]) > B:
        t.append(int(P[i]))
#print(t)
sum = 0
if len(f) > len(s):
    if len(s) > len(t):
        sum = len(t)
    else:
        sum = len(s)
elif len(f) > len(t):
    sum = len(t)
else:
    sum = len(f)

print(sum)

Submission status: Accepted

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

x = len([i for i in p if i <= a])
y = len([i for i in p if a < i <= b])
z = len([i for i in p if i > b])
print(min(x, y, z))

Submission status: Accepted

Solution code:
n = int(input())
listAB = list(map(int,input().split()))
listP=list(map(int,input().split()))

a = listAB[0]
b = listAB[1]

num0 = sum([1 for p in listP if p <=a])
num2 = sum([1 for p in listP if p > b])
num1 = n - num0 -num2
print(min([num0,num1,num2]))

Submission status: Accepted

Solution code:
N = int(input())
A, B = [int(_) for _ in input().split()]
P =  [int(_) for _ in input().split()]
x = len([i for i in P if i <= A])
y = len([i for i in P if i <= B and i >= A+1])
z = len([i for i in P if i >= B + 1])
 
if x != 0 and y != 0 and z != 0:
    print(min([x,y,z]))
else :
    print(0)

Submission status: Accepted

Solution code:
N = int(input())
A,B = map(int, input().split())
T= [int(i) for i in input().split()]
a=[i for i in T if i<=A]
b=[i for i in T if A<i<=B]
c=[i for i in T if i>B]
al=len(a)
bl=len(b)
cl=len(c)
list=[al,bl,cl]
print(min(list))

Submission status: Accepted

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



list1 = []
list2 = []
list3 = []

for i in p:
    if i<=a:
        list1.append(i)
    elif i<=b:
        list2.append(i)
    else:
        list3.append(i)


if len(list1)>=len(list2):
    if len(list2)>=len(list3):
        print(len(list3))
    else:
        print(len(list2))
else:
    if len(list1)>=len(list3):
        print(len(list3))
    else:
        print(len(list1))

Submission status: Accepted

Solution code:
N = int(input())
a,b = (int(x) for x in input().split())

lis = []
lis = input().split()
lis = [int(s) for s in lis]

#print(lis)
a_num,b_num,c_num = 0,0,0

for i in range(N):
#    print(lis[i])
    if lis[i] <= a:
        a_num +=1
    elif lis[i] <= b:
        b_num +=1
    else:
        c_num +=1
"""
print("a_num"+str(a_num))
print("b_num"+str(b_num))
print("c_num"+str(c_num))
"""

if a_num == 0:
    print(0)
elif b_num == 0:
    print(0)
else:
    print(min(a_num,b_num,c_num))

Submission status: Accepted

Solution code:
N = int(input())
A,B=(int(x) for x in input().split())
scores = input().split()
num = [0,0,0]
for i in range(N):
    score = int(scores[i])
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] += 1
max_value = num[2]
for i in range(2):
    if max_value > num[i]:
        max_value = num[i]
print(max_value)

Submission status: Accepted

Solution code:
#coding:utf-8
n = 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:
l_a = []
l_ab = []
l_b = []
l = []

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

for i in inputs:
    if(int(i) <= A):
        l_a.append(i)
    elif(int(i) >= A + 1 and int(i) <= B):
        l_ab.append(i)
    elif(int(i) >= B + 1):
        l_b.append(i)

l.append(len(l_a))
l.append(len(l_ab))
l.append(len(l_b))

print(min(l))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
a=list(map(int,input().split()))
j=k=l=0
for i in a:
    if i<(A+1):
        j=j+1
    elif A<i<(B+1):
        k=k+1
    else:
        l=l+1
if j<k and j<l:
    print(j)
elif k<j and k<l:
    print(k)
else:
    print(l)

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 i in range(N):
    if P[i]  <= A:
        P1 += 1
    elif P[i]  <= B:
        P2 += 1
    else:
        P3 += 1
print(min(P1,P2,P3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
uA = []
oAuB = []
oB = []
for i in range(N):
    if P[i] <= A:
        uA.append(P[i])
    if A+1 <= P[i] and P[i] <= B:
        oAuB.append(P[i])
    if B+1 <= P[i]:
        oB.append(P[i])
print(min(len(uA), len(oAuB), len(oB)))

Submission status: Accepted

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

for i in range(N):
    if P[i]>A: break
a = i # A 以下の枚数
for i in range(a,N):
    if P[i]>B: break
else:
    i = N
b = i - a # A+1以上B以下の枚数
c = N - i
#print(a,b,c)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, c)
print(count)

Submission status: Accepted

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

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

q =[q1,q2,q3]

print(min(q))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

P = np.array(P)
P_1 = P[P <= A]
P_2 = P[(P >= (A+1)) & (P <= B)]
P_3 = P[P > B]
print(min(len(P_1), len(P_2), len(P_3)))

Submission status: Accepted

Solution code:
num=int(input())
line=input().split(" ")
a=int(line[0])
b=int(line[1])
low=[]
middle=[]
high=[]

lines=input().split(" ")


for i in range(num):
    n=int(lines[i])
    if n<=a:
        low.append(n)
    elif n<=b:
        middle.append(n)
    else:
        high.append(n)

print(min(len(low),len(middle),len(high)))

Submission status: Accepted

Solution code:
n = int(input())
line = input().split()
a = int(line[0])
b = int(line[1])
line = input().split()
p = []
for i in range(n):
    p.append(int(line[i]))

c1 = 0
c2 = 0
c3 = 0

for i in p:
    if (i <= a):
        c1 += 1
    elif ((i >= a + 1) and (i <= b)):
        c2 += 1
    elif (i >= b +1):
        c3 += 1

print(min(c1,c2,c3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -coding UTF-8 -*-
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

count_a = 0
b_count = 0
i = 0
while i < N:
    if P[i] <= A:
        count_a += 1
    elif B < P[i]:
        b_count += 1
    i += 1

print(int(min(count_a, b_count, N - count_a - b_count)))