Problem:


Score : 200 points

Problem Statement

You have written N problems to hold programming contests.
The i-th problem will have a score of P_i points if used in a contest.

With these problems, you would like to hold as many contests as possible under the following condition:

A contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.

The same problem should not be used in multiple contests.
At most how many contests can be held?

Constraints

3 \leq N \leq 100

1 \leq P_i \leq 20 (1 \leq i \leq N)

1 \leq A < B < 20

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A B
P_1 P_2 ... P_N

Output

Print the answer.

Sample Input 1

7
5 15
1 10 16 2 7 20 12

Sample Output 1

2

Two contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.

Sample Input 2

8
3 8
5 5 5 10 10 10 15 20

Sample Output 2

0

No contest can be held, because there is no problem with a score of A = 3 or less.

Sample Input 3

3
5 6
5 6 10

Sample Output 3

1



Sample input:
7
5 15
1 10 16 2 7 20 12


Sample output:
2

Submission status: Wrong Answer

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

    count, isSet_A, isSet_B, isSet_C = 0, False, False, False
    for i in range(N):
        if points[i] < 0:
            continue

        if isSet_A == False and 0 <= points[i] and points[i] <= pt_A and pt_A < 20:
            isSet_A = True
            points[i] = -1
        if isSet_B == False and pt_A + 1 <= points[i] and points[i] <= pt_B and pt_B < 20:
            isSet_B = True
            points[i] = -1
        if isSet_C == False and pt_B + 1 <= points[i] and pt_B < 20:
            isSet_C = True
            points[i] = -1
        
        if isSet_A and isSet_B and isSet_C:
            count += 1
            isSet_A, isSet_B, isSet_C = False, False, False

    print(count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    N = int(input())
    temp = input()
    flds = temp.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])

    count, isSet_A, isSet_B, isSet_C = 0, False, False, False
    for i in range(N):
        if points[i] < 0:
            continue

        if isSet_A == False and 0 <= points[i] and points[i] <= pt_A:
            isSet_A = True
            points[i] = -1
        if isSet_B == False and pt_A + 1 <= points[i] and points[i] <= pt_B:
            isSet_B = True
            points[i] = -1
        if isSet_C == False and pt_B + 1 <= points[i]:
            isSet_C = True
            points[i] = -1
        
        if isSet_A and isSet_B and isSet_C:
            count += 1
            isSet_A, isSet_B, isSet_C = False, False, False

    print(count)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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: Wrong Answer

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

q1 = [p for p in P if p <= A]
q2 = [p for p in P if A < p and p <= B]
q3 = [p for p in P if p < B]

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

Submission status: Wrong Answer

Solution code:
import copy

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

al = []
bl = []
cl = []

for x in P:
    if x <= A:
        al.append(x)
    elif A+1 <= x and x <= B:
        bl.append(x)
    else:
        cl.append(x)

btbl = [[] for i in range(len(bl))]
for b in range(len(bl)):
    for c in cl:
        if bl[b] < c:
            btbl[b].append(c)

if len(al) == 0:
    print(0)
    exit()

if len(btbl) == 0:
    print(0)
    exit()

ans = 0
for i in range(len(btbl)):
    temp_btbl = copy.deepcopy(btbl)

    del_list = btbl[i]
    t = 0
    flag = True

    for d in del_list:
        for x in range(len(btbl)):
            if d in temp_btbl[x]:
                temp_btbl[x].remove(d)
            else:
                flag = False
                break
        if flag is False:
            break
        else:
            t += 1
    ans = max(ans, t)

print(ans)

Submission status: Wrong Answer

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)
else:
    sum = len(f)

print(sum)

Submission status: Wrong Answer

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
    if i <= B:
        COUNT[1] += 1
    else:
        COUNT[2] += 1
print(min(COUNT))

Submission status: Wrong Answer

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

if x == 0 or y == 0 or z == 0:
    print(0)
else :
    print(min([x,y,z]))
    print(x, y,z)

Submission status: Wrong Answer

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 f > s:
    if s > t:
        sum = len(t)
    else:
        sum = len(s)
else:
    sum = len(f)

print(sum)

Submission status: Wrong Answer

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

if x != 0 or y != 0 or z != 0:
    print(min([x,y,z]))
    print(x, y,z)
else :
    print(0)

Submission status: Wrong Answer

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

print(p)

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: Wrong Answer

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]
if al==bl==1:
  print(0)
else:
  print(min(list))

Submission status: Wrong Answer

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

if x != 0 and y != 0 and z != 0:
    print(min([x,y,z]))
else :
    print(0)

Submission status: Wrong Answer

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 = 0
for i in range(3):
    if max_value < num[i]:
        max_value = num[i]
print(max_value)

Submission status: Wrong Answer

Solution code:
import copy

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

al = []
bl = []
cl = []

for x in P:
    if x <= A:
        al.append(x)
    elif A+1 <= x and x <= B:
        bl.append(x)
    else:
        cl.append(x)

btbl = [[] for i in range(len(bl))]
for b in range(len(bl)):
    for c in cl:
        if bl[b] < c:
            btbl[b].append(c)

temp = 0
if len(btbl) == 0:
    print(0)
    exit()

for i in range(1, len(btbl)):
    if btbl[temp] >= btbl[i]:
        temp = i

min_btbl = copy.deepcopy(btbl[temp])

print(min(len(al), len(min_btbl)))

Submission status: Wrong Answer

Solution code:
n = int(input())
ab = input().rstrip().split()
p = input().rstrip().split()
c=0 
i = 1
for i in range(n):
  j=i-1
  for j in range(n):
    if(p[j] > p[i]):
      temp = p[j]
      p[j] = p[i]
      p[i] = temp
i = 0
for i in range(n):
  p[i] = int(p[i])
a=int(ab[0])
b=int(ab[1])
i = 0
j = 0
k = 0
for i in range(n):
  if(p[i] <= a and p[i]!=0):
    j = i + 1
    for j in range(n):
      if(p[j]<=b and p[j] >= a+1):
        k = j + 1 
        for k in range(n):
          if(p[k] >= b+1):
            c = c + 1
            p[i]=0 
            p[j]=0
            p[k]=0

print(c)

Submission status: Wrong Answer

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(len(uA) & len(oAuB) & len(oB))

Submission status: Wrong Answer

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 < P[i] and P[i] <= B:
        oAuB.append(P[i])
    if B < P[i]:
        oB.append(P[i])
print(len(uA) & len(oAuB) & len(oB))

Submission status: Wrong Answer

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
b = i - a # A+1以上B以下の枚数
c = N - i
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, c)
print(count)

Submission status: Wrong Answer

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+1,N):
    if P[i]>B: break
b = i - a # B以下の枚数
c = N - i + 1
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, c)
print(count)

Submission status: Wrong Answer

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+1,N):
    if P[i]>B: break
b = i - a # B以下の枚数
c = N - i
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, c)
print(count)

Submission status: Wrong Answer

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+1,N):
    if P[i]>B: break
b = i - a # B以下の枚数
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, N-(b+a))
print(count)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
N = input()
H = raw_input().split()
P = map(int, raw_input().split())

A = int(H[0])
B = int(H[1])



P.sort()

num0 = 0
num1 = 0

for i in range(N):
    if P[i] <= A:
        num0 = i+1
    elif P[i] > A and P[i] <= B:
        num1 = i+1
num3 = N-num1

print(min(num0, num1-num0, num3))

Submission status: Wrong Answer

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)#
#print(P)#
P.sort()
for i in range(N):
    if P[i]>A: break
a = i # A 以下の枚数
for i in range(A+1,N):
    if P[i]>B: break
b = i - a # B以下の枚数
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, N-(b+a))
print(count)

Submission status: Wrong Answer

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

result = ''
count = 0
for i in range(N):
    if P[i] <= A:
        result += 'A'
    for j in range(N):
        if result == 'A' and A < P[j] and P[j] <= B:
            result += 'AB'
        for k in range(N):
            if result == 'AAB' and P[k] <= A:
                result += 'B'
    if result == 'AABB':
        count += 1
    result = ''
print(count)

Submission status: Wrong Answer

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)#
#print(P)#
P.sort()
for i in range(N):
    if P[i]>A: break
a = i # A 以下の枚数
for i in range(a+1,N):
    if P[i]>=B: break
b = i - a # B以下の枚数
#print(a,b)#
#count = min(a+1, b-a+1, N-b)
count = min(a, b, N-(b+a))
print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

for i in itertools.combinations(P, 3):
    if not i[0] in L and not i[1] in L and not i[2] in L:
        if i[0] <= A and i[1] >= A+1 and i[1] <= B and i[2] >= B+1:
            count += 1
            L = L + i
print(count)

Submission status: Wrong Answer

Solution code:
import itertools

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

for i in itertools.combinations(P, 3):
    if not i[0] in L and not i[1] in L and not i[2] in L:
        if i[0] <= A and i[1] >= A+1 and i[1] <= B and i[2] >= B+1:
            count += 1
            L = L + i
print(count)
print(L)

Submission status: Wrong Answer

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

check = []
for i in range(N-2):
  if(P[i] <= A):
    if(A+1 <= P[i+1] <= B):
      if(P[i+2] >= B+1):
        if(P[i] not in check and P[i+1] not in check and P[i+2] not in check):
          check.append(P[i])
          check.append(P[i+1])
          check.append(P[i+2])

print(int(len(check)/3))

Submission status: Wrong Answer

Solution code:
N = input()
H = raw_input().split()
P = map(int, raw_input().split())

A = int(H[0])
B = int(H[1])



P.sort()

num0 = 0
num1 = 0
num2 = 0
num3 = 0

for i in range(N):
    if P[i] <= A:
        num0 = i+1
    elif P[i] > A and P[i] <= B:
        num1 = i+1
num3 = N-num1+1


print(min(num0, num1-num0, num3))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B])
cko=len(data[data>=A+1])-len(data[data>=B])
ans=min([ako,bko,cko])
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
while True:
    if max_contest == 0:
        break
    elif p[max_contest-1] <= a and p[-1*max_contest] >= b+1 and a+1 <= p[max_contest] <= b:
        break
    else:
        max_contest -= 1
print(max_contest)

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B])
cko=len(data[data>=A+1])-len(data[data>B])
ans=min([ako,bko,cko])
print(ans)

Submission status: Wrong Answer

Solution code:
N = input()
H = raw_input().split()
P = map(int, raw_input().split())

A = int(H[0])
B = int(H[1])



P.sort()

num0 = 0
num1 = 0
num2 = 0
num3 = 0

for i in range(N):
    if P[i] <= A:
        num0 = i+1
    elif P[i] > A and P[i] <= B:
        num1 = i+1
num3 = N-num1


print(min(num0, num1-num0, num3))

Submission status: Wrong Answer

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

result = ''
for i in range(N):
    if P[i] <= A:
        result += '<=A'
    if A < P[i] and P[i] <= B:
        result += '|A<B<=|'
    if B < P[i]:
        result += '<B'
print(result.count('<=A|A<B<=|<B'))

Submission status: Wrong Answer

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

first, second, third = 0, 0, 0
for i in p:
    if i <= a:
        first += 1
    if a+1 <= i <= b:
        second += 1
    if b <= i:
        third += 1

print(min([first, second, third]))

Submission status: Wrong Answer

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

print(min(x, y, z))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B])
cko=len(data[data<=A+1])-ako
ans=min([ako,bko,cko])
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
while True:
    if max_contest == 0:
        break
    elif p[max_contest-1] > a or p[-1*max_contest] <= b or p[max_contest] <= a:
        max_contest -= 1
    else:

        break
print(max_contest)

Submission status: Wrong Answer

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

result = ''
for i in range(N):
    if P[i] <= A:
        result += 'A'
    if A < P[i] and P[i] <= B:
        result += 'AB'
    if B < P[i]:
        result += 'B'
print(result.count('AABB'))

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=(int(i) for i in input().split())
point=[int(i) for i in input().split()]
point.sort()
pointp=point[::-1]
p=[i for i in  point if i<=A]
q=[i for i in point if A<=i<=B]
r=[i for i in pointp if i>B]
print(min(len(p),len(q),len(r)))

Submission status: Wrong Answer

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

cnt = 0
check = []
ind = 0
for i in range(N-2):
  if(P[i] <= A):
    if(A+1 <= P[i+1] <= B):
      if(P[i+2] >= B+1):
        check.append(P[i:i+3])
result = []
tmp = [x for x in check if x not in result and not result.append(x)]
print(len(result))

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
canb = len([i for i in p if i > a])
if max_contest > canb:
    max_contest = canb
while True:
    if max_contest == 0:
        break
    elif p[max_contest-1] > a or p[-1*max_contest] <= b:
        max_contest -= 1
    else:

        break
print(max_contest)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = input().split()
n1 = 0
n2 = 0
n3 = 0
for item in p:

    if int(item) <= a:
        n1 += 1
    if b + 1 <= int(item):
        n3 += 1
    else:
        n2 += 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int, input().split())
P = sorted(set([int(i) for i in input().split()]))
ans = 0
num1 = 0
num2 = 0
num3 = 0

for i in P:
    if i <= A:
        num1 += 1
    elif A+1 <= i <= B:
        num2 += 1
    elif B+1 <= i:
        num3 += 1

print(min(num1, num2, num3))

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
a,b = map(int,raw_input().split())
arr = map(int, raw_input().split())
t1 = 0
t2 = 0
t3 = 0
for i in range(n):
    if arr[i] <= a:
        t1 += 1
    elif  a+1<=arr[i]<=b:
        t2 += 1
    else:
        t3 += 1
print t1 * t2 * t3

Submission status: Wrong Answer

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

print(min(x, y, z))

Submission status: Wrong Answer

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

P.sort()

c1, c2, c3 = 0, 0, 0
for i, p in enumerate(P, 1):
    if p <= A:
        c1 = i
    if (p > A) and (p <= B):
        c2 = i
    if p > B:
        c3 = i

print(min((c1), (c2 - c1), (c3 - c2)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 or int(p[i]) < int(B):
        cntC += 1

print(min(cntA,cntB,cntC))

Submission status: Wrong Answer

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

P.sort()

c1, c2, c3 = 0, 0, 0
for i, p in enumerate(P, 1):
    if p <= A:
        c1 = i
    if (p > A) and (p <= B):
        c2 = i
    if p > B:
        c3 = i

print(c1, c2, c3)
print(min((c1), (c2 - c1), (c3 - c2)))

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=np.array(data)
ako=len(data[data<=A])
bko=len(data[data>=B])
cko=N-ako-bko
ans=min([ako,bko,cko])
print(ans)

Submission status: Wrong Answer

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

print(min(x, y, z))

Submission status: Wrong Answer

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

P.sort()

ans = 0

print(min(len([v for v in P if v <= A]),max(len([v for v in P if v > A and v <= B]),len([v for v in P if v >= B]))))

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=map(int,input().split() )
P=list(map(int,input().split() ))
X1=sum( [p<=A for p in P])
X2=sum( [ (p>A and p<=B)  for p in P] )
X3=sum( [p>=B  for p in P] )
print(min([X1,X2,X3]))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 and int(p[i]) < int(B):
        cntC += 1

print(min(cntA,cntB,cntC))

Submission status: Wrong Answer

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

P.sort()

comb = 0
cont = 0

for p in P:
    if comb == 0 and p <= A:
        comb += 1
    if comb == 1 and p >= A+1 and p <= B:
        comb += 1
    if comb == 2 and p >= B+1:
        comb += 1
    if comb == 3:
        cont += 1
        
print(cont)

Submission status: Wrong Answer

Solution code:
n = int(input())
a, b = map(int, input().split())
p = sorted(map(int, input().split()))
max_contest = n // 3
while True:
    # print(p[max_contest-1], p[-1*max_contest])
    if max_contest == 0:
        break
    elif p[max_contest-1] > a or p[-1*max_contest] <= b:
        max_contest -= 1
    else:
        break
print(max_contest)

Submission status: Wrong Answer

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


def solve():
    N = int(input())
    A,B  = map(int,input().split())
    P = list(map(int,input().split()))
    P1 = list(p for p in P if p<=A)
    P2 = list(p for p in P if A<p<=B)
    P3 = list(p for p in P if B<p)
    res = min(P1,P2,P3)
    return str(res)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A, B = map(int,input().split())
list = [int(x) for x in input().split()]
counta = 0
countb = 0
countc = 0 
for p in list:
    if p < A:
        counta += 1
    elif B > p >= A+1:
        countb += 1
    elif p >= B+1:
        countc +=1
print(min(min(counta,countb),countc))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
n=nCast(input())
ab=nCast(input().split())
p=nCast(input().split())
x,y,z=0,0,0
for number in p:
    if number<ab[0]:
        x+=1
    elif number>ab[1]:
        z+=1
    else:
        y+=1
print(min(x,y,z))

Submission status: Wrong Answer

Solution code:
N = int(input())
A,B = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
s=t=u=0
for i in range(N):
    if P[i]<=A:
        s+=1
    if P[i]>A and i <= B:
        t+=1
    if P[i] > B:
        u+=1
re = min(s,t,u)
print(re)

Submission status: Wrong Answer

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

# print(n)
# print(a, b)
# print(sorted(p))

q_a = 0
q_b = 0
q_c = 0

for i in sorted(p):
    if i <= a:
       q_a += 1
    if a < i <= b:
        q_b += 1
    else:
        q_c += 1

print(min([q_a, q_b, q_c]))

Submission status: Wrong Answer

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

P = np.array(P)
X = P[P <= A]
Y = P[(P <= (A + 1)) & (P <= B)]
Z = P[P >= (B + 1)]

print(min(len(X), len(Y), len(Z)))

Submission status: Wrong Answer

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

P = np.array(P)
X = P[P <= A]
Y = P[(P <= A) & (P <= B)]
Z = P[P >= (B + 1)]

print(min(len(X), len(Y), len(Z)))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 20:43:52 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 20:43:41 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Dec 29 18:42:51 2018

@author: Owner
"""


import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*M
Y = [0]*M
for m in range(M):
    P[m], Y[m] = map(int, input().split())
    
all(nstr.count(c) for c in '753')
"""# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 20:43:41 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Dec 29 18:42:51 2018

@author: Owner
"""

import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*M
Y = [0]*M
for m in range(M):
    P[m], Y[m] = map(int, input().split())
    
all(nstr.count(c) for c in '753')
"""

N = int(input())
A, B = map(int, input().split())
P = [0]*N
P[:] = map(int, input().split())

P.sort()
print(P)

num1 = len([i for i in P if i <= A])
num3 = len([i for i in P if i >= B+1])
num2 = N-num1-num3

num = min(num1, num2, num3)
print(num)

Submission status: Wrong Answer

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

cnt = 0
for i in range(N-2):
  if(P[i] <= A):
    if(A+1 <= P[i+1] <= B):
      if(P[i+2] >= B+1):
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

gte_a = len(p)
for i,v in enumerate(p):
    if a + 1 <= v <= b:
        gte_a = i
        break

gte_b = len(p)

for i,v in enumerate(p[gte_a:]):
    if b + 1 <= v:
        gte_b = i
        break

print(min(map(len, (p[:gte_a],p[gte_a:gte_b+1],p[gte_b+1:]))))

Submission status: Wrong Answer

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

P.sort()

c1, c2, c3 = 0, 0, 0
for p in P:
    if p <= A:
        c1 = p
    if (p > A) and (p <= B):
        c2 = p
    if p > B:
        c3 = p

print(min(c1, (c2 - c1), (c3 - c2)))