Problem:


Score : 200 points

Problem Statement

We have held a popularity poll for N items on sale. Item i received A_i votes.

From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.

If M popular items can be selected, print Yes; otherwise, print No.

Constraints

1 \leq M \leq N \leq 100

1 \leq A_i \leq 1000

A_i are distinct.

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
A_1 ... A_N

Output

If M popular items can be selected, print Yes; otherwise, print No.

Sample Input 1

4 1
5 4 2 1

Sample Output 1

Yes

There were 12 votes in total. The most popular item received 5 votes, and we can select it.

Sample Input 2

3 2
380 19 1

Sample Output 2

No

There were 400 votes in total. The second and third most popular items received less than \dfrac{1}{4\times 2} of the total number of votes, so we cannot select them. Thus, we cannot select two popular items.

Sample Input 3

12 3
4 56 78 901 2 345 67 890 123 45 6 789

Sample Output 3

Yes



Sample input:
4 1
5 4 2 1


Sample output:
Yes

Submission status: Wrong Answer

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

sum=0
asp=float(1/(4*m))
a=sorted(a,key=lambda x: -x)
for i in range(n):
    sum=sum+int(a[i-1])

if int(a[0])>sum*asp:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
list = input().split()
A = input().split()

for i in range(len(A)):
  A[i] = int(A[i])
  
N = int(list[0])
M = int(list[1])

tmp = []
for i in A:
  if i >= sum(A) / (4 * M):
    tmp.append(i)
if len(tmp) >= M:
  print("Yse")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=list(map(int,input().split()))
s=sum(a)
k=0
for x in a:
    if x>=s//(M*4):k+=1
if k>=M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
def main():
  n, m = map(int, input().split())
  l = list(map(int, input().split()))
  d = sum(l) / 4 / m
  l.sort()
  for li in l:
    if li < d:
      print ("No")
      return
  print ("Yes")
  return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = abs( n % k)
b = abs(  a - (n + a) % k)
if a < b:
    print(a)
else:
    print(b)

Submission status: Wrong Answer

Solution code:
N, M= map(int,input().split())
A = list(map(int,input().split()))
B = 0
C =  1 / (4 * M)
count = 0
D = 0

for i in range(len(A)):
    B += A[i]

D = B * C
for i in range(len(A)):
    if D < A[i]:
        count += 1
if M > count :
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

sum=0
asp=float(1/(4*m))
a=sorted(a,key=lambda x: -x)
for i in range(n):
    sum=sum+int(a[i-1])

if int(a[0])>sum*asp and int(a[1])>sum*asp:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import math
N,M = (int(y) for y in input().split())
A = list(map(int, input().split()))
X = math.ceil(sum(A)/(4*M))
B = [i for i in A if i >= X]
print(sum(A))
print(X)
print(B)
if len(B) >= M:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
list = input().split()
A = input().split()

for i in range(len(A)):
  A[i] = int(A[i])
  
N = int(list[0])
M = int(list[1])

tmp = []
for i in A:
  if i >= sum(A) / (4 * int(M)):
    tmp.append(i)
if len(tmp) >= M:
  print("Yse")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N, M= map(int,input().split())
A = list(map(int,input().split()))
B = 0
C =  1 / (4 * M)
count = 0
D = 0
print(C)

for i in range(len(A)):
    B += A[i]

D = B * C
for i in range(len(A)):
    if D < A[i]:
        count += 1
if M > count :
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# your code goes here
N,M = map(int,input().split())
A = list(map(int,input().split()))
T = 0
C = 0
Y = "Yes"
E = "No"
for i in range(N):
    T += A[i]
for i in range(N):
    if C > M:
        print(Y)
        break
    if (A[i]*4*M) > T:
        C += 1
if C < M:
    print(E)

Submission status: Wrong Answer

Solution code:
N, M  = map(int, input().split())
A = list(map(int, input().split()))
a = int(sum(A)/(4 * M))
b = 0

for i in range(N):
    if A[i] < a:
        b =+ 1
if M < b:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

count = 0
allpoint = sum(A)
X = float(allpoint // (4 * M))

for i in A:
    if i >= X:
        count += 1

if count > M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
a = input()
b = a.split()
m = int(b[1])
c = input()
d = c.split()
c = sorted(d, reverse=True)
c = [int(i) for i in c]
i = 0
z = []
while i < m:
    if c[i] > (1 / (4 * m)) * sum(c):
        z.append(1)
    else:
        z.append(0)
        break
    i = i + 1
z = set(z)
if len(z) == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
nmlist = list(map(int, input().split()))
svote = list(map(int, input().split()))
allvote = sum(svote)
maxvote = max(svote)
svote.sort(reverse=True)
n0 = nmlist[1] - 1
n1 =  svote[n0] / allvote
n2 = 1 / (4 * nmlist[1])
if n1 > n2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse = True)
l_sum = sum(l)
d = (1/(4*M))*l_sum
d = int(d)
cnt = 0
 
for i in range(N):
    if l[i] > d:
        cnt += 1
    else:
        break
 
if cnt >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

#if N < M:
#    print('No')
#if M == 0:
#    print('No')

B = []
for i in range(len(A)):
    if A[i] >= sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))

line = math.floor(sum(A) / (4 * M))
ans = [i for i in A if i >= line]
print("Yes") if len(ans) >= M else print("No")

Submission status: Wrong Answer

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

count = 0
allpoint = sum(A)
X = float(allpoint // (4 * M))

for i in A:
    if i > X:
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N,m=input().split()
M=int(m)
As=[]
As=input().split()

Amax = int(max(As))

if Amax > 1/ (4*M):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M = map(int, input().split())
#print(M)
S = list(map(int,input().split()))
S.sort(reverse=True)
#print(S)
L = len(S)
SUM = sum(S)
#print(SUM)
#print(L)
#print(S[M-1])
if S[M-1] / SUM > 1/(4*M):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
a = sorted(list(map(int,input().split())))
suma = int(sum(a) / (4 * m))
a = [i for i in a if i >= suma]
ans = (len(a) >= m)
print("Yes" if ans else "No")

Submission status: Wrong Answer

Solution code:
NM = [int(_) for _ in input().split()]
N = NM[0]
M = NM[1]

A = [int(_) for _ in input().split()]

def solve(N, M, A):
    
    d = int(sum(A) / (4 * M))
    
    a = [i for i in A if i>d ]
    
    if  len(a) >= M:
        return "Yes"
    else:
        return "No"

print(solve(N, M, A))

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

if N < M:
    print('No')
if M == 0:
    print('No')

B = []
for i in range(len(A)):
    if A[i] >= sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
i1 = input()
i1 = i1.split()
types = int(i1[0])
select = int(i1[1])

i2 = input()
i2 = [int(n) for n in i2.split()]
i2.sort(reverse=True)

summary = sum(i2)
threshold = summary / (select * 4)
print("i2=", i2)
print("summary=", summary)
print("threshold=", threshold)

if i2[select-1] < threshold :
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
sum_ = 0
for i in a:
    sum_ +=i
if(a[m-1]>(sum_/4*m)):
    print('Yes')
else: print('No')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
n = list(map(int, input().split()))
A = n[M-1]/sum(n)
B = 1/4*M
if A > B:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

count = 0
allpoint = sum(A)

for i in A:
    if i >= float(allpoint // (4 * M)):
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
'''select the popular items'''
N, M = [int(i) for i in input().split()]
A = map(int, input().strip().split())
votes = N + M
Total_votes = 0
for j in A:
    Total_votes += j
if votes < (1/4*M)*Total_votes:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(set((map(int,input().split()))))
print(A)
vote=[]
for B in A:
    if B>(1/(4*M)*sum(A)):
        vote.append(B)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
num, m = map(int,input().split())
list = [int(x) for x in input().split()]


count = 0

for i in range(num):
    if list[i] < int(sum(list) * (1/(4*m))):
        None
    else:
        count += 1

if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

A_sum =sum(A)

ans = 0
for i in range(N):
    if A[i] > A_sum/(4*M):
        ans += 1

if ans >= M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

if N < M:
    print('No')
if M == 0:
    print('No')

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = list(map(int, input().split()))
sums = 0
count = 0
for i in arr:
    sums = sums + i
check = (1 / (4*m))*sums
for i in arr:
    if i < check:
        count = 1
        break
    else:
        continue
if count >= 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

sum = sum(l)
l = sorted(l,reverse=True)
x = sum / (1 / 4*m)
ans = 0



for i in range(m):
    if(l[i] >= x):
        ans = ans + 1

if(ans >= m):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
a = list(map(int, input().split()))
fla=True
n=sum(a)
for i in range(l[1]):
    if sorted(a)[-(i+1)]<n/(4*l[1]):
        print(sorted(a)[-(i+1)])
        fla=False
if fla==True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
A2 = sorted(A,reverse=True)
Judge = 0
for i in range(N):
    if(A2[i]>(sum/(4*M))):
        Judge = Judge+1
if Judge<M:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
sousuu = 0
kakutoku = 0
x = [0]*n

x = [int(y) for y in input().split()]

for i in range(n):
    sousuu += int(x[i])

for k in range(n):
    if int(x[k]) > int(sousuu/(4*m)):
        kakutoku += 1

if kakutoku >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
def RA():
    l = input().split()
    return [int(i) for i in l]

[n, m] = RA()
votes = RA()

s = [0] * 1001
for v in votes:
  s[v] = 1

start = math.ceil(1/(4 * m))
count = 0
for i in range(start, 1001):
  if s[i] == 1:
    count += 1
    if count == m:
      print("Yes")
      break
if count < m:
  print("No")

Submission status: Wrong Answer

Solution code:
import math
N, M = map(int, input().split())
A = list(map(int, input().split()))

line = math.floor(sum(A) / (4 * M))
ans = [i for i in A if i > line]
print("Yes") if len(ans) >= M else print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = set((map(int, input().split())))
vote = []
for Ai in A:
    if Ai > (1 / (4 * M) * sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
vote= []
for Ai in A:
    if Ai > (1 /(4 * M) *sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) > N - M  +1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math
num, m = map(int,input().split())
list = [int(x) for x in input().split()]


least = math.floor(sum(list) * (1/(4*m)))
count = 0

for i in range(num):
    if list[i] < least:
        None
    else:
        count += 1

if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
sousuu = 0
kakutoku = 0
x = [0]*n

x = [int(y) for y in input().split()]

for i in range(n):
    sousuu += int(x[i])

for i in range(n):
    if int(x[i]) > int(sousuu/(4*m)):
        kakutoku += 1

if kakutoku >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
a = sorted(list(map(int,input().split())))
suma = int(sum(a) / (4 * m))
count = True
#print(a[n - 1])
for i in range(m):
    if a[n - 1 - i] <= suma:
        count = False
        break
print("Yes" if count == True else "No")

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = list(map(int, input().split()))
sums = 0
for i in arr:
    sums = sums + i
check = (1 / (4*m))*sums
for i in arr:
    if i < check:
        print("No")
        break
    else:
        continue

Submission status: Wrong Answer

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

a.sort(reverse=True)
bordar = sum(a) // (4 * m)
if bordar == 0:
    print('No')
    exit()
for i in range(m):
    if a[i] <= max(1,bordar):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
if 0 <= N <= 10^18 and 1 <= K <= 10^18:
    if N>K:
        N = abs(N-K)
        N = abs(N-K)
        print(N)
    else:
        print(N)
else:
    print("0")

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(set((map(int,input().split()))))
print(A)
vote=[]
for Ai in A:
    if Ai>(1/(4*M)*sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
#a = list(map(int, input().split()))
a = sorted(list(map(int, input().split())),reverse=True)
s = 0
for i in range(m):
    if a[i]*4*m > sum(a):
        s += 1
if s == m:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) >= M:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
a = input()
b = a.split()
m = int(b[1])
c = input()
d = c.split()
c = sorted(d, reverse=True)
c = [int(i) for i in c]
i = 0
z = []
while i < m:
    if c[i] > (1 / (4 * m) * sum(c)):
        z.append(1)
    else:
        z.append(0)
        break
    i = i + 1
z = set(z)
if len(z) == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
vote = []
for Ai in A:
    if Ai > (1 / (4 * M)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def swap(a,b):
  return b,a
n,m = map(int,input().split())
arr = list(map(int,input().split()))
sum = 0
for i in arr:
  sum += i
sum = sum//(4*m)
count=0
for i in arr:
  if (i>=sum):
    count+=1
if (count>=m):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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


t = 0
check=False
for x in range(len(a)):
  t += a[x]

for i in reversed(range(len(a))):
  for j in range(i):
    if(a[j] < a[j+1]):
      a[j], a[j+1] = a[j+1],a[j]

for y in range(m):
  if(a[y] > t/(4*m)):
    check = True
  else:
    check=False
    break

if(check):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
print(A)
vote = []
for Ai in A:
    if Ai > (1 / (4 * M) * sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
A2 = sorted(A,reverse=True)
Judge = 0
for i in range(N):
    if(A2[i]>(sum/(4*M))):
        Judge = Judge+1
if Judge>=M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
vote = []
for Ai in A:
    if Ai > (1 / (4 * M) * sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>(cnt*(1/(4*m))):
        b.append(a[i])

if len(b) >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

N, M= map(int, input().split())

C = map(int, input().split())

A = list(C)

B = []
for i in range(len(A)):
    if A[i] > sum(A)/4/M:
        B.append(1)
    else:
        B.append(0)

if sum(B) >= M:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
num, choice = map(int, input().split())
tmp = input().split()
product_list = [int(s) for s in tmp]
product_list.sort()
sum = 0
for i in range(num):
  sum += product_list[i]
if product_list[choice-1] >= sum/(choice*4):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
nmlist = list(map(int, input().split()))
svote = list(map(int, input().split()))
allvote = sum(svote)
maxvote = max(svote)
n0 = nmlist[1] - 1
n1 =  n0 / allvote
n2 = 1 / (4 * nmlist[1])
if n1 > n2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
x, y = map(int,input().split())
ls = list(map(int, input().split()))

ls.sort()
total = sum(ls)
Yes = 0
No = 0

for i in range(y):
  a = ls[x-i-2]
  b =  total * (1/(4*x))
  if a > b:
    Yes += 1
  else:
    No += 1
if Yes == y:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
Nj = N
while True:
    Ni = Nj
    Nj = abs(Ni - K)
    if Ni > N:
        print(N)
        break
    elif Nj > Ni:
        print(Ni)
        break
    elif K == 1 or Nj == K:
        print(0)
        break
    else:
        continue

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(set((map(int,input().split()))))
print(A)
vote=[]
for Ai in A:
    if Ai>(1/(4*M)*sum(A)):
        vote.append(Ai)
if len(vote)>=M:
    print("yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
a = sorted(list(map(int,input().split())))
suma = int(sum(a) / (4 * m))
count = True
#print(a[n - 1])
for i in range(m):
    if a[n - 1 - i] <= suma:
        count = False
print("Yes" if count == True else "No")

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
a = list(map(int, input().split()))
fla=True
n=sum(a)
for i in range(l[1]):
    if sorted(a)[-(i+1)]<n/(4*l[0]):
        fla=False
if fla==True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
i1 = input()
i1 = i1.split()
types = int(i1[0])
select = int(i1[1])

i2 = input()
i2 = [int(n) for n in i2.split()]
i2.sort(reverse=True)

summary = sum(i2)
threshold = summary / (types * 4)
#print("summary=", summary)
#print("threshold=", threshold)

if i2[select-1] < threshold :
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
tvote = sum(A)
nc =(1/ (4*M)) * tvote
if 1 <= M <= N <= 1000 and (1 <= Ai <= 1000 for Ai in A):
    vote = []
    for Ai in A:
        if Ai > nc:
            vote.append(Ai)
    if len(vote) >= M:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
l = list(map(int, input().split()))
a = list(map(int, input().split()))
fla=True
n=sum(a)
for i in range(l[1]):
    if sorted(a)[-(i+1)]<n/(4*l[0]):
        print(sorted(a)[-(i+1)])
        fla=False
if fla==True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math
n, m = map(int, input().split())
a = sorted(list(map(int,input().split())))
suma = math.floor(sum(a) / (4 * m))
count = True
#print(a[n - 1])
for i in range(m):
    if a[n - 1 - i] <= suma:
        count = False
print("Yes" if count == True else "No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
A2 = sorted(A,reverse=True)
Judge = 0
for i in range(N):
    if(A2[i]>(sum/(4*M))):
        Judge = Judge+1
print(Judge)
if Judge>=M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
n, m = map(int, input().split())
all_vote=0;
cnt=0;
a =list(map(int, input().split()))

for i in range(0, n):
    num=a.count(i)
    all_vote=all_vote+num

for i in range(0,n):
    if a.count(i)>=(all_vote/(4*m)):
      cnt=cnt+1

if cnt>=m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
arr = list(map(int, input().split()))
sums = 0
for i in arr:
    sums = sums + i
check = (1 / (4*m))*sums
for i in arr:
    if i < check:
        print("No")
        break
    else:
        continue
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import os
from fractions import Fraction

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


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

    N, M = il()
    print('Yes' if int(N * 0.25) >= M else 'No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
ai = list(map(int,input().split()))
s = sum(ai)
check = s/4/m
count = 0
for i in ai:
  if i > round(check, 0):
    print(round(check, 0))
    count += 1
if count >= m:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a = list(map(int,input().split()))
cnt_border = 0

for i in range(len(a)):
    if a[i] > sum(a)/(4*m):
        cnt_border +=1

if cnt_border >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
i1 = input()
i1 = i1.split()
types = int(i1[0])
select = int(i1[1])

i2 = input()
i2 = [int(n) for n in i2.split()]
i2.sort(reverse=True)

summary = sum(i2)
threshold = int(summary / (types * 4))

if i2[select-1] < threshold :
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N,M = (int(y) for y in input().split())
A = list(map(int, input().split()))
X = int(sum(A)/(4*M))
B = [i for i in A if i >= X]

if len(B) >= M:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:

n, m = (int(x) for x in input().split())
a_list = list(map(int, input().split()))

border = sum(a_list) / (4 * m)

print('border')
print(border)

count = 0

for i in range(len(a_list)):

    print('a_list')
    print(a_list[i])

    if border <= a_list[i] :
        print('カウント!')
        count = count + 1

if m <= count :
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a = list(map(int,input().split()))
cnt_border = 0

for i in range(len(a)):
    if a[i] > sum(a)/(4*m):
        cnt_border +=1
        
print(cnt_border)

if cnt_border >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,M =map(int, input().split())
A = list(set((map(int,input().split()))))
vote = []
for i in A:
    if i > (1/(4*M)*sum(A)):
        vote.append(i)
if len(vote)>=M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

sum = sum(l)
l = sorted(l,reverse=True)
x = 1 / (1 / 4*m)
ans = 0



for i in range(m):
    if(l[i] >= x):
        ans = ans + 1

if(ans >= m):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = input().split()
m = input().split()

a = len(m)
sum = 0
for i in range(a):
  sum += int(m[i])

item2 = []
for i in range(a):
  item2.append(int(m[i]) / sum)

ans = 1 / (4 * int(n[1]))

item3 = []
for i in range(a):
  if item2[i] >= ans:
    item3.append(item2[i])

if int(n[1]) == int(len(item3)):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

border = sum(A)/(4*M)
count = 0

popular = [i for i in A if i > border]
count = len(popular)

if count > M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#import math
n,m = map(int, input().split());
l = list(map(int, input().split()))
#print(m)
#print(n)
#print(l)
num = 0;
th = sum(l)/(4*m);
print(th);
for i in range(len(l)):
    if l[i] >= th:
        num += 1;
if num >= m:
    print('Yes');
else:
    print('No');

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
print(A)
vote = []
for Ai in A:
    if Ai > (1 / (4 * M) * sum(A)):
        vote.append(Ai)
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
'''select the popular items'''
N, M = [int(i) for i in input().split()]
A = map(int, input().strip().split())
votes = N + M
Total_votes = 0
for j in A:
    Total_votes += int(j)
if votes < (1/4*M)*Total_votes:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
x, y = map(int,input().split())
ls = list(map(int, input().split()))

ls.sort()
total = sum(ls)
Yes = 0
No = 0

for i in range(y):
  a = ls[x-i-1]
  b =  total * (1/(4*x))
  if a >= b:
    Yes += 1
  else:
    No += 1
if Yes == y:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = sum(x > (sum(A) // (4 * M)) for x in A)
print('No' if ans < M else 'Yes')

Submission status: Wrong Answer

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

a.sort(reverse=True)
bordar = sum(a) // (4 * m)

for i in range(m):
    if a[i] <= bordar:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>(cnt*(1/(4*m))):
        b.append(a[i])

if len(b) >= m:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
ans = sum(x > (sum(A) // (4 * M)) for x in A)
if ans == 0:
    print('No')
else:
    print('Yes' if ans >= M else 'No')

Submission status: Wrong Answer

Solution code:
N,M =map(int, input().split())
A = list(set((map(int,input().split()))))
print(A)
vote = []
for i in A:
    if i > (1/(4*M)*sum(A)):
        vote.append(i)
if len(vote)>=M:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = input().split()
m = input().split()

a = len(m)
sum = 0
for i in range(a):
  sum += int(m[i])

ld = sorted(m, reverse=True)

item2 = []
for i in range(int(len(ld))):
  item2.append(int(ld[i]) / sum)

ans = 1 / (4 * int(n[1]))

item3 = []
for i in range(int(n[1])):
  if item2[i] >= ans:
    item3.append(item2[i])

if int(n[1]) == int(len(item3)):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a_list = input().split()
a_sum = 0
for i in range(len(a_list)):
    a_list[i] = int(a_list[i])
    a_sum += a_list[i]
a_list.reverse()

ok_num = 0
kijyun = int(a_sum/(4*m))
for i in a_list:
    if i > kijyun:
        ok_num += 1
    else:
        break
    if ok_num >= m:
        print('Yes')
        quit()
print('No')

Submission status: Wrong Answer

Solution code:
import sys
import os
from fractions import Fraction

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


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

    N, M = il()
    A = il()
    sm = sum(A)
    mi = sm * Fraction(1, 4*M)
    cnt = 0

    for a in A:
        if a > mi: cnt += 1

    print('Yes' if cnt >= M else 'No')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
top=0
sum=0
asp=0
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

for i in range(n):
    sum=sum+int(a[i-1])
    if a[i-1]<a[i] or i==1:
        top=int(a[i-1])

asp=float(1-(1/(4*m)))
if top>sum*asp:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
X = int(sum(A)/(4*M))
B = [i for i in A if i >= X]

if len(B) >= M:
  print("Yes")
else:
  print("No")