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 = [int(_) for _ in input().split()]

num1, num2, num3 = 0, 0, 0
for i in p:
    if i <= a:
        num1 += 1
    elif b+1 <= i:
        num3 += 1
    else:
        num2 += 1
print(min(num1, num2, num3))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
p_list = list(map(int,input().split()))
p_list.sort()
ans = 0
dum1 = 0
dum2 = 0
dum3 = 0
for i in p_list:
    if i <= a:
        dum1 += 1
    if a+1 <= i <= b:
        dum2 += 1
    if i >= b+1:
        dum3 += 1
print(min(dum1,dum2,dum3))

Submission status: Accepted

Solution code:
def main():
    N  = int(input())
    A,B  = map(int, input().split()) 
    P = list(map(int, input().split()))  
    c1 = 0
    c2 = 0
    c3 = 0

    for i in range(len(P)):
        if P[i]<=A:
            c1 +=1
        elif P[i]<=B:
            c2 +=1
        else:
            c3 +=1
    print(min([c1,c2,c3]))




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
import math
import re
import queue

input = stdin.readline

MOD = 1000000007
INF = 122337203685477580

def solve():
    N = int(input().rstrip())
    A,B = map(int, input().split())
    X =list(map(int, input().split())) 
    vec = [0]*3
    for x in X:
        if(x <= A):
            vec[0] += 1
        elif(x <= B):
            vec[1] += 1
        else:
            vec[2] += 1
    

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    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 p <= B:
            C[1] += 1
        else:
            C[2] += 1
    
    ans = min(C)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    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] += 1
        elif a+1 <= P[i] <= b:
            L[1] += 1
        else:
            L[2] += 1
    print(min(L))


resolve()

Submission status: Accepted

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

def resolve():
    n=int(input())
    a,b=map(int, input().split())
    l=list(map(int,input().split()))
    cnt1=0
    cnt2=0
    cnt3=0

    for i in l:
        if i<=a:
            cnt1+=1
        elif a+1<=i<=b:
            cnt2+=1
        else:
            cnt3+=1
    print(min(cnt1,cnt2,cnt3))


resolve()

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 v in p:
  if v <= a: A += 1
  elif v <= 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()))
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))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
lis_p = list(map(int, input().split()))
con1 = 0
con2 = 0
con3 = 0

for x in range(n):
  if lis_p[x] <= a:
    con1 += 1
  elif a+1 <= lis_p[x] <= b:
    con2 += 1
  else:
    con3 += 1

ans = 0
while True:
  if con1 == 0 or con2 == 0 or con3 == 0:
    break
  else:
    con1 -= 1
    con2 -= 1
    con3 -= 1
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a,b = map(int,input().split())
P = list(map(int,input().split()))
q1 = 0
q2 = 0
q3 = 0
for p in P:
  if p <= a:
    q1 += 1
  elif a < p <= 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()))
x1 = 0
x2 = 0
x3 = 0
for i in p:
  if i <= a:
    x1 += 1
  elif i <= b:
    x2 += 1
  else:
    x3 += 1
print(min(x1, x2, x3))

Submission status: Accepted

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

s = [0,0,0]

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

Submission status: Accepted

Solution code:
n=int(input())
A,B=map(int, input().split())
P=list(map(int, input().split()))
s=[]
w=[]
t=[]
l=[s,w,t]
for i in range(n):
  if P[i]<=A:
    s.append(P[i])
  elif P[i]>=A+1 and P[i]<=B:
    w.append(P[i])
  else:
    t.append(P[i])
print(min(len(s),len(w),len(t)))

Submission status: Accepted

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

l1=[]
l2=[]
l3=[]

for i in range(n):
    if p[i]<=a:
        l1.append(p[i])

for i in range(n):
    if a+1<=p[i]<=b:
        l2.append(p[i])
        
for i in range(n):
    if b<p[i]:
        l3.append(p[i])
        
print(min(len(l1),len(l2),len(l3)))

Submission status: Accepted

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

lea=[p for p in P if p<=a]
gealeb=[p for p in P if a<p<=b]
gtb=[p for p in P if p>b]

print(min(len(lea),len(gealeb),len(gtb)))

Submission status: Accepted

Solution code:
# AISing Programming Contest 2019 / エイシング プログラミング コンテスト 2019: B – Contests
N = int(input())
A, B = [int(s) for s in input().split()]
P = [int(s) for s in input().split()]

leA = [p for p in P if p <= A]
gtAleB = [p for p in P if A < p <= B]
gtB = [p for p in P if p > B]

print(min(len(leA), len(gtAleB), len(gtB)))

Submission status: Accepted

Solution code:

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

l1 = []
l2 = []
l3 = []

for i in range(n):
    if p[i] <= a:
        l1.append(p[i])
 
for i in range(n):
    if a+1 <= p[i] <= b:
        l2.append(p[i])
 
for i in range(n):
    if b < p[i]:
        l3.append(p[i])

print(min(len(l1),len(l2),len(l3)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a, b = map(int, readline().split())
p = list(map(int, readline().split()))
memo = [0, 0, 0]
for check in p:
    if check <= a:
        memo[0] += 1
    elif a < check <= b:
        memo[1] += 1
    else:
        memo[2] += 1
print(min(memo))

Submission status: Accepted

Solution code:
N=int(input())
A,B=map(int,input().split())
P=input().split()
P_low=[int(x) for x in P if int(x)<=A]
P_normal=[int(x) for x in P if A+1<=int(x)<=B]
P_high=[int(x) for x in P if B+1<=int(x)]


ans=P_low
if len(ans)<=len(P_normal):
    pass
else:
    ans=P_normal
if len(ans)<=len(P_high):
    pass
else:
    ans=P_high
print(len(ans))

Submission status: Accepted

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

s1, s2, s3 = 0, 0, 0
for p in P:
    if p <= A:
        s1 += 1
    elif A+1 <= p <= B:
        s2 += 1
    else:
        s3 += 1
print(min(s1, s2, s3))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a,b = na()
p = na()
c = [0,0,0]

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

Submission status: Accepted

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

for i in range(n):
    if p[i] <= a:
        cnt1 +=1
    elif a < p[i] <= b:
        cnt2+=1
    else:
        cnt3+=1
ans = min(cnt1,cnt2,cnt3)
print(ans)

Submission status: Accepted

Solution code:
# 1
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_a
if False:
    print('YES' if set(input().split())==set(list('1974')) else 'NO')

# 2
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b
if False:
    S=input()
    ans='NO'
    K='keyence'
    for i in range(len(K)):
        l=K[:i]
        r=K[i:]
        # print(l,r)
        if l in S and r in S:
            l_i=S.index(l)
            for j in range(len(S)):
                # print(S[j:j+len(K)-1])
                if j+len(r)-1<len(S) and S[j:j+len(r)]==r:
                    r_i=j
            # print(l_i,r_i)
            if l_i<=r_i:
                ans='YES'
                break
    print(ans)

# 3
# https://atcoder.jp/contests/aising2019/tasks/aising2019_a
if False:
    N=int(input())
    H=int(input())
    W=int(input())
    print((N-H+1)*(N-W+1))

# 4
# https://atcoder.jp/contests/aising2019/tasks/aising2019_b
N=int(input())
A,B=map(int,input().split())
P=[int(i) for i in input().split()]
cnt=[0,0,0]
for p in P:
    if p<=A: cnt[0]+=1
    elif A<p<=B: cnt[1]+=1
    else: cnt[2]+=1
print(min(cnt))

Submission status: Accepted

Solution code:
import sys
f = sys.stdin
n = int(f.readline())
a, b = map(int,f.readline().split())
P = list(map(int, f.readline().split()))
x = [0 for _ in range(3)]
for p in P:
  if p <= a:
    x[0]+=1
  elif p <= b:
    x[1] += 1
  else:
    x[2] += 1
print(min(x))

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:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

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 b+1>p[i]>a:
        two+=1
    else:
        three+=1
print(min(one,two,three))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
H=list(map(int,input().split()))
d=[]
e=[]
f=[]
for i in range(n):
    k=H[i]
    if k<=a:
        d.append(k)
    elif a<k<=b:
        e.append(k)
    else:
        f.append(k)
print(min(len(d),len(e),len(f)))

Submission status: Accepted

Solution code:
_,a,b,*p=map(int,open(0).read().split())
print(min(eval("sum(%s for j in p)"%["j<=a","a<j<=b","b<j"][i]) for i in range(3)))

Submission status: Accepted

Solution code:
n, a, b, *p = map(int, open(0).read().split())
print(min(eval("sum(%s for j in p)" % ["j<=a", "a<j<=b", "b<j"][i]) for i in range(3)))

Submission status: Accepted

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

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

print(min(a, b, c))

Submission status: Accepted

Solution code:
import sys
from sys import stdin

n = int(stdin.readline().rstrip())
a, b = map(int, stdin.readline().rstrip().split())
p = list(map(int, stdin.readline().rstrip().split()))
ans1 = 0
ans2 = 0
ans3 = 0
p.sort()

for pi in p:
    if pi <= a:
        ans1 += 1
    elif pi > a and pi <= b:
        ans2 += 1
    else:
        ans3 += 1

print(min(ans1, ans2, ans3))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    a,b=map(int,input().split())
    P=[int(_) for _ in input().split()]
    P.sort()
    cunt1,cunt2,cunt3=0,0,0
    for p in P:
        if p<=a:
            cunt1+=1
        elif a+1<=p and p<=b:
            cunt2+=1
        else:cunt3+=1
    print(min(cunt1,cunt2,cunt3))

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod_,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod_-2,mod_)*pow(fac[r],mod_-2,mod_))%mod_
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
#################################### ########
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
###################################################
def main():
    n=int(input())
    A,B=map(int,input().split())
    P=list(map(int,input().split()))
    C=[0,0,0]
    for a in P:
      if a<=A:
        C[0]+=1
      elif A+1<=a and a<=B:
        C[1]+=1
      else:
        C[2]+=1

    print(min(C))

main()

Submission status: Accepted

Solution code:
from bisect import *
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
a = bisect_right(P, A)
b = bisect_right(P, B)-a
c = N-b-a
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()))

c1 = 0
c2 = 0
c3 = 0

for pi in p:
    if pi <= a:
        c1 += 1
    elif pi <= b:
        c2 += 1
    else:
        c3 += 1

print(min(c1, c2, c3))

Submission status: Accepted

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

first = 0
second = 0
third = 0
ans = []

for i in range(len(p)):
  if p[i] <= a:
    first += 1
  elif p[i] >= a+1 and p[i] <= b:
    second += 1
  elif p[i] >= b+1:
    third += 1

ans.append(first)
ans.append(second)
ans.append(third)

print(min(ans))

Submission status: Accepted

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

Submission status: Accepted

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

print(min(len([p for p in P if p <=A]), len([p for p in P if (A<p) and(p<=B)]),\
      len([p for p in P if B<p])))

Submission status: Accepted

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

cnt_a = 0
cnt_b = 0
for p in Ps:
    if p <= A:
        cnt_a += 1
    elif p > B:
        cnt_b += 1
print(min(cnt_a,cnt_b,N-cnt_a-cnt_b))

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 a + 1 <= 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()
x = bisect.bisect_right(P, a)
y = bisect.bisect_right(P, b)
print(min(x, y-x, n-y))

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
a,b = iim()
P = iil()

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

for item in P:
    if item <= a:
        p1.append(item)
    elif item <= b:
        p2.append(item)
    else:
        p3.append(item)
print(min(len(p1),len(p2),len(p3)))

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
first = [p for p in P if p<=A]
second = [p for p in P if p>A and p<=B]
third = [p for p in P if p>B]

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

print(ans)   

#print(*ans, sep='\n')

Submission status: Accepted

Solution code:
import bisect
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
x = bisect.bisect_left(p,a+1)
y = bisect.bisect_left(p,b+1)
one = p[:x]
two = p[x:y]
three = p[y:]
print(min(len(one),len(two),len(three)))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A, B = MI()
P = LMI()

d = defaultdict(int)
for p in P:
    if p <= A:
        d[0] += 1
    elif A < p <= 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())
P = list(map(int, input().split()))
P1 = [p for p in P if p <= A]
P2 = [p for p in P if A < p <= B]
P3 = [p for p in P if B < p]
print(min(len(P1), len(P2), len(P3)))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a = b = c = 0
n = int(input())
A,B = map(int,input().split())
P = list(map(int,input().split()))
for i,pi in enumerate(P):
    if pi <= A:
        a += 1
    elif A+1 <= pi <= 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()))
P1 = [p for p in P if p <= A]
P2 = [p for p in P if A < p <= B]
P3 = [p for p in P if B < p]

print(min(len(P1), len(P2), len(P3)))

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
q=[0,0,0]
for x in p:
    if x<=a: q[0]+=1
    elif x>a and x<=b: q[1]+=1
    else: q[2]+=1

print(min(q))

Submission status: Accepted

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

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

print(min(pr))

Submission status: Accepted

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

cnt1, cnt2, cnt3 = 0, 0, 0
for i in range(N):
    if P[i] <= A:
        cnt1 += 1
    elif A < P[i] <= B:
        cnt2 += 1
    else:
        cnt3 += 1
print(min(cnt1, cnt2, cnt3))

Submission status: Accepted

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

B = [0, 0, 0]

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

Submission status: Accepted

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

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()]
am = 0
ab = 0
bu = 0
for i in range(N):
    if P[i]<=A:
        am+=1
    if A+1<=P[i]<=B:
        ab +=1
    if B+1<=P[i]:
        bu+=1

print(min(am,ab,bu))

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] += 1
    elif (P[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()))

nums = [0] * 3
for e in p:
    if e <= a:
        nums[0] += 1
    elif e <= b:
        nums[1] += 1
    else:
        nums[2] += 1

ans = min(nums)
print(ans)

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

A = [0,0,0]
for i in range(n):
    if P[i] <= a:
        A[0] += 1
    elif P[i] <= b:
        A[1] += 1
    else:
        A[2] += 1
print(min(A))

Submission status: Accepted

Solution code:
def main():
    questions = int(input())
    a, b = map(int, input().split())
    score = list(map(int, input().split()))
    count_range = [0, 0, 0]
    for s in score:
        if s <= a:
            count_range[0] += 1
        elif s <= b:
            count_range[1] += 1
        else:
            count_range[2] += 1
    print(min(count_range))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a,b=map(int,input().split())
p=list(map(int,input().split()))
li1 = [i for i in p if i<=a]
li2 = [i for i in p if a<i<=b]
li3 = [i for i in p if b<i]
a,b,c=len(li1),len(li2),len(li3)
print(min(a,b,c))

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Problem B - Contests

# input process
N = int(input())
A, B = map(int, input().split())
P_list = list(map(int, input().split()))

# initizaliation
combi_1 = []
combi_2 = []
combi_3 = []

# count step
for p in P_list:
    if p<=A:
        combi_1.append(p)
    elif p>=(A+1) and p<=B:
        combi_2.append(p)
    else:
        combi_3.append(p)

# output process
ans = min(len(combi_1), len(combi_2), len(combi_3))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))
ans1 = 0
ans2 = 0
ans3 = 0  
for i in P:
    if A>=i:
        ans1 = ans1 + 1
    if A+1 <= i <= B:
        ans2 = ans2 + 1
    if B+1 <= i:
        ans3 = ans3 + 1 


print(min(ans1,ans2,ans3))

Submission status: Accepted

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

import bisect
abis = bisect.bisect_right(p,a)
bbis = bisect.bisect_right(p,b)
print(min(abis-0, bbis-abis, len(p)-bbis))

Submission status: Accepted

Solution code:
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
one = sum(1 for i in p if i <= a)
two = sum(1 for i in p if a + 1 <= i <= b)
three = sum(1 for i in p if b + 1<= i)
print(min(one, two, three))