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: Runtime Error

Solution code:
m,n=map(int,input().split())
a=sorted(list(map(int,input().split())))
s=0
for j in range(n):
  s+=a[j]
for i in range(n):
  if a[n-i] < s/(4*m):
    if i!=0:
      a=a[n-i+1:]
      break
    else:
      a=[]
      break
if len(a) >= m:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,M;
    int A[1000];
    cin >> N >> M;
    for (int i=0; i<N; i++){
        cin >> A[i];
    }
    int count=0,sum=0;
    for (int i=0; i<N; i++){
        sum = sum + A[i];
    }
    
    for (int i=0; i<N; i++){
        if (A[i]>=sum/(4*M)){
            count++;

        }
    }
    if (count < M){
        cout << "No" <<endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Submission status: Runtime Error

Solution code:
import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()])
total = sum(al)

idx = bisect.bisect_left(al,total/(4*m))

if n - idx > m:
    print('Yes')
elif al[idx+1] == total/(4*m):
    print('No')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import bisect
n,m = [int(i) for i in input().split()]
al = sorted([int(i) for i in input().split()])
total = sum(al)

idx = bisect.bisect_left(al,total/(4*m))
idx = bisect.bisect_left(al,789)

if n - idx > m:
    print('Yes')
elif al[idx+1] == total/(4*m):
    print('No')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3


N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

A = sorted(A)[::-1]
total = sum(A)
print(A[M-1])
if A[M] < total * (1 / (4 * M)):
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

count=0
sum=0

for i in a:
  sum+=i
  
for i in a:
  if a>=(sum/4*m):
    count+=1

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

Submission status: Runtime Error

Solution code:
s = input().split()
i = s[0]
m = s[1]
j = 0
el = input().split()
for p in el:
  if int(p) < 1 / (4 * m):
    j = 1
     
if j == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import numpy as np

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

total_vote = np.sum(A)
threshold = total_vote/(4*M)
A.sort(reverse = True)
if A[M] > threshold:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3


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

A = sorted(A)[::-1]
total = sum(A)
print(A[M-1])
if A[M] < total * (1 / (4 * M)):
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[m] < total // (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N,M=[int(i) for i in input().split()]
A=list(int(input()))
for i in range(M):
    if A[i]>1/(4*M):
        print("Yes")
        exit()
print("No")

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
A = list(map(int, input().split()))
line = sum(A)/(4*M)
A.sort(reverse=True)
if A[M]>line:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

A.sort(reverse=True)

total = 0
for a in A:
    total += a

for m in range(M):
    if (A[m] * 4 * M < total):
        print("No")
        exit(1)

print("Yes")

Submission status: Runtime Error

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

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

total = sum(a)
thres = total/(4*m)

ct = 0
for i in a:
    if i >= thres:
        ct += 1

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

Submission status: Runtime Error

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

th = sum(A)*0.25/M

A.sort(reverse=True)

if A[M] >= th:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
from sys import stdin

input = stdin.readline

n, k = map(int, input().split())
a = [int(x) for x in input().split()]
vote = sum(a) / 4 / m

a.sort()
a.reverse()

print("Yes" if a[m - 1] >= vote else "No")

Submission status: Runtime Error

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

real = A[M] / sum(A)
ideal = 1 / (4 * M)

if real >= ideal:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[0]*n
for i in range(n):
  a[i]=int(input().split())
num=sum(a)
tmp=num//(4*m)
count=0
for i in range(n):
  if a[i]>=tmp:
    count+=1
if count==m:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

As = list(map(int,input().split()))

As.sort(reverse=True)

al = sum(As)

ans = 'No' if al/(4*M)>As[M] else 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
vote = input("Enter the vote: ")
if

Submission status: Runtime Error

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

list.sort(A,reverse=True)

sumnum = sum(A)

if A[M] > (sumnum/(4*M)):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = input().split()
i = s[0]
m = s[1]
j = 0
el = input().split()
for p in el:
  if p < 1 / (4 * m):
    j = 1

if j == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import numpy as np

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

total_vote = np.sum(A)
threshold = total_vote*(1/4*M)
A.sort(reverse = True)
if A[M] > threshold:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

a.sort(reverse = True);

i = 0;
while a[i] >= sum(a)/(4*m) :
    i += 1;

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

Submission status: Runtime Error

Solution code:
N, M = input().split()
N = int(N)
M = int(M)
numbers = input().split()
numbers = [int(n) for n in numbers]
thresh = sum(numbers)/(4*M)
if numbers[M] < thresh:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

s = sum(A)
A.sort(reverse=True)

if A[m] >= s*1/(4*m):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
nm = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

n = nm[0]
m = nm[1]

a_s = sorted(a)[::-1]
if a_s[m-1] < sum(a)/(4*m):
  print('No')
else:
  print('Yes')vv

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)[::-1]
s=sum(a)
print("Yes" if a[m]>=s/4/m else "No")

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m;
  ll sum = 0;
  cin >> n >> m;
  vector<ll> a(n);
  REP(i,n) {
    cin >> a[i];
    sum += a[i];
  }

  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());

  int cnt = 0;
  REP(i,n){
    if( a[i] * 4 * m < sum ) break;
    else {
      cnt++;
    }
  }

  if( cnt >= m ) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Submission status: Runtime Error

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

a=list(map(int,input().split()))

sum=0
count=0
for i in a:
  sum+=a
  
for i in a:
  if a>=(sum/4*m):
    count+=1
    
if(count>=m):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

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

th = sum(A) // (4 * M)

sorted_A = sorted(A, key=lambda x: -x)
if sorted_A[M] < th:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n, m = input().split()
n, m = int(n), int(m)
a = input().split()
a = [int(i) for i in a]
a.sort()
a.reverse()
for i in range(n):
  if a[i] < 1/4m:
    print("No")
    break
  if i == m-1:
    print("Yes")
    break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# 2020/04/04
# AtCoder Beginner Contest 161 - B

# Input
n, m = map(int,input().split())
a = list(map(int,input().split()))

# Init
sump = 0
sump_m = 0

# Calc
for i in range(n):
    sump = sump + a[i]

a.sort()
a.reverse()

ans = 'Yes'
for i in range(m):
    if a[m] < sump / (4 * m):
        ans = 'No'

# Output
print(ans)

Submission status: Runtime Error

Solution code:
import sys
N, M = map(int, sys.stdin.readline().split())
li = list(map(int, sys.stdin.readline().split))
li.sort(reverse=False)
if li[M-1] < sum(li)/(4*M):
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

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

A.sort(reverse=True)

s = sum(A)
c = s / (4 * M)

if A[M] < c:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
import java.math.*;
import java.io.*;
import java.util.*;
import java.awt.*;

public class Solution implements Runnable {
    @Override
    public void run() {
        try {
            new Solver().solve();
            System.exit(0);
        } catch (Exception | Error e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static void main(String[] args) {
        //new Thread(null, new Solution(), "Solver", 1l << 25).start();
        new Solution().run();
    }
}


class Solver {
    final Helper hp;
    final int MAXN = 1000_006;
    final long MOD = (long) 1e9 + 7;

    final Timer timer;
    final TimerTask task;

    Solver() {
        hp = new Helper(MOD, MAXN);
        hp.initIO(System.in, System.out);

        timer = new Timer();
        task = new TimerTask() {
            @Override
            public void run() {
                try {
                    hp.flush();
                    System.exit(0);
                } catch (Exception e) {
                }
            }
        };
        //timer.schedule(task, 4700);
    }


    void solve() throws Exception {
        int i, j, k;
        boolean testCases = false;

        int tc = testCases ? hp.nextInt() : 1;
        for (int tce = 1; tce <= tc; tce++) {
            int N = hp.nextInt(), M = hp.nextInt();
            PriorityQueue<Integer> pq = new PriorityQueue<>();
            int T = 0;
            for (i = 0; i < N; ++i) {
                int ele = hp.nextInt();
                T += ele;
                pq.add(ele);
            }

            while (!pq.isEmpty() && pq.peek() * 4 * M < T) {
                pq.poll();
            }

            hp.println(pq.size() >= M ? "Yes" : "No");
        }

        timer.cancel();
        hp.flush();
    }

}

class Helper {
    final long MOD;
    final int MAXN;
    final Random rnd;

    public Helper(long mod, int maxn) {
        MOD = mod;
        MAXN = maxn;
        rnd = new Random();
    }


    public static int[] sieve;
    public static ArrayList<Integer> primes;

    public void setSieve() {
        primes = new ArrayList<>();
        sieve = new int[MAXN];
        int i, j;
        for (i = 2; i < MAXN; ++i)
            if (sieve[i] == 0) {
                primes.add(i);
                for (j = i; j < MAXN; j += i) {
                    sieve[j] = i;
                }
            }
    }


    public static long[] factorial;

    public void setFactorial() {
        factorial = new long[MAXN];
        factorial[0] = 1;
        for (int i = 1; i < MAXN; ++i) factorial[i] = factorial[i - 1] * i % MOD;
    }

    public long getFactorial(int n) {
        if (factorial == null) setFactorial();
        return factorial[n];
    }

    public long ncr(int n, int r) {
        if (r > n) return 0;
        if (factorial == null) setFactorial();
        long numerator = factorial[n];
        long denominator = factorial[r] * factorial[n - r] % MOD;
        return numerator * pow(denominator, MOD - 2, MOD) % MOD;
    }


    public long[] getLongArray(int size) throws Exception {
        long[] ar = new long[size];
        for (int i = 0; i < size; ++i) ar[i] = nextLong();
        return ar;
    }

    public int[] getIntArray(int size) throws Exception {
        int[] ar = new int[size];
        for (int i = 0; i < size; ++i) ar[i] = nextInt();
        return ar;
    }

    public String[] getStringArray(int size) throws Exception {
        String[] ar = new String[size];
        for (int i = 0; i < size; ++i) ar[i] = next();
        return ar;
    }

    public String joinElements(long... ar) {
        StringBuilder sb = new StringBuilder();
        for (long itr : ar) sb.append(itr).append(" ");
        return sb.toString().trim();
    }


    public String joinElements(int... ar) {
        StringBuilder sb = new StringBuilder();
        for (int itr : ar) sb.append(itr).append(" ");
        return sb.toString().trim();
    }

    public String joinElements(String... ar) {
        StringBuilder sb = new StringBuilder();
        for (String itr : ar) sb.append(itr).append(" ");
        return sb.toString().trim();
    }

    public String joinElements(Object... ar) {
        StringBuilder sb = new StringBuilder();
        for (Object itr : ar) sb.append(itr).append(" ");
        return sb.toString().trim();
    }


    public long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    public int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }


    public long max(long... ar) {
        long ret = ar[0];
        for (long itr : ar) ret = Math.max(ret, itr);
        return ret;
    }

    public int max(int... ar) {
        int ret = ar[0];
        for (int itr : ar) ret = Math.max(ret, itr);
        return ret;
    }

    public long min(long... ar) {
        long ret = ar[0];
        for (long itr : ar) ret = Math.min(ret, itr);
        return ret;
    }

    public int min(int... ar) {
        int ret = ar[0];
        for (int itr : ar) ret = Math.min(ret, itr);
        return ret;
    }


    public long sum(long... ar) {
        long sum = 0;
        for (long itr : ar) sum += itr;
        return sum;
    }

    public long sum(int... ar) {
        long sum = 0;
        for (int itr : ar) sum += itr;
        return sum;
    }

    public void shuffle(int[] ar) {
        int r;
        for (int i = 0; i < ar.length; ++i) {
            r = rnd.nextInt(ar.length);
            if (r != i) {
                ar[i] ^= ar[r];
                ar[r] ^= ar[i];
                ar[i] ^= ar[r];
            }
        }
    }

    public void shuffle(long[] ar) {
        int r;
        for (int i = 0; i < ar.length; ++i) {
            r = rnd.nextInt(ar.length);
            if (r != i) {
                ar[i] ^= ar[r];
                ar[r] ^= ar[i];
                ar[i] ^= ar[r];
            }
        }
    }

    public void reverse(int[] ar) {
        int r;
        for (int i = 0; i < ar.length; ++i) {
            r = ar.length - 1 - i;
            if (r > i) {
                ar[i] ^= ar[r];
                ar[r] ^= ar[i];
                ar[i] ^= ar[r];
            }
        }
    }

    public void reverse(long[] ar) {
        int r;
        for (int i = 0; i < ar.length; ++i) {
            r = ar.length - 1 - i;
            if (r > i) {
                ar[i] ^= ar[r];
                ar[r] ^= ar[i];
                ar[i] ^= ar[r];
            }
        }
    }

    public long pow(long base, long exp, long MOD) {
        base %= MOD;
        long ret = 1;
        while (exp > 0) {
            if ((exp & 1) == 1) ret = ret * base % MOD;
            base = base * base % MOD;
            exp >>= 1;
        }
        return ret;
    }


    static final int BUFSIZE = 1 << 20;
    static byte[] buf;
    static int index, total;
    static InputStream in;
    static BufferedWriter bw;


    public void initIO(InputStream is, OutputStream os) {
        try {
            in = is;
            bw = new BufferedWriter(new OutputStreamWriter(os));
            buf = new byte[BUFSIZE];
        } catch (Exception e) {
        }
    }

    public void initIO(String inputFile, String outputFile) {
        try {
            in = new FileInputStream(inputFile);
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outputFile)));
            buf = new byte[BUFSIZE];
        } catch (Exception e) {
        }
    }

    private int scan() throws Exception {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0)
                return -1;
        }
        return buf[index++];
    }

    public String next() throws Exception {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan())
            sb.append((char) c);
        return sb.toString();
    }

    public int nextInt() throws Exception {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    public long nextLong() throws Exception {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    public void print(Object a) throws Exception {
        bw.write(a.toString());
    }

    public void printsp(Object a) throws Exception {
        print(a);
        print(" ");
    }

    public void println() throws Exception {
        bw.write("\n");
    }

    public void println(Object a) throws Exception {
        print(a);
        println();
    }

    public void flush() throws Exception {
        bw.flush();
    }
}

Submission status: Runtime Error

Solution code:
n,m=[int(x) for x in input().split()]
a=[int(x) for x in input().split()]

a.sort()
a.reverse()

ans="Yes"
for i in range(m+1):
    if a[i]<sum(a)/(4*m):
        ans="No"
        break;
print(ans)

Submission status: Runtime Error

Solution code:
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, m: usize,
        a: [usize; n],
    }

    let mut a = a;
    a.sort_by(|c, b| b.cmp(c));

    let ans = if (a[m - 1] as f64) < a.iter().sum::<usize>() as f64 / (4 * m) as f64 {
        "No"
    } else {
        "Yes"
    };

    println!("{}", ans);
}

Submission status: Runtime Error

Solution code:
n, m = input().split()
n, m = int(n), int(m)
a = input().split()
a = [int(i) for i in a]
a.sort()
a.reverse()
for i in range(n):
  if a[i] < 1/4m:
    print("No")
    break
  if i == m:
    print("Yes")
    break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a = list(map(int, input().split()))
a.sort(reverse=True)
total = sum(a)

canPick = True
for i in range(m):
    if a[m] < total / (4 * m):
        canPick = False

if canPick is True:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
suma=sum(a)
l=suma/(4*m)
a.sort(reverse=True)
if a[m]>=l:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

N,M =map(int, input().split())
A =list(map(int, input().split()))
B = sorted(A, reverse = True)
if B[M] >= sum(B)/4/M:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

ok_count = 0
for i in a:
    if i > 1 / (4 * sum(a)): ok_count += 1

print("Yes" if m >= ok_count else "No")

Submission status: Runtime Error

Solution code:
n, m = list(map(int,input().split()))
a = list(map(int,input().split()))
s = sum(a)
x = (1/(4*m))*(s)
for i in a:
    if(i>=x):
        u+=1
if(u>=m):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
yes = lambda boolean: print('Yes') if boolean else print('No')
input_ints = lambda: list(map(int, input().split()))

N, M = input_ints()
A = input_ints()
A.sort(reverse=1)
yes(A[M-1]*4*M>_1)

Submission status: Runtime Error

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

a.sort(reverse=True)

if a[m]<sum(a)/4/m:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)

#def my_index_multi(l, x):
#    return [i for i, _x in enumerate(l) if _x == x]

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, M: int, A: "List[int]"):
    A.sort()
    sa=sum(A)
    print(YES if sa//(4*M)>A[M] else NO)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
l = list(map(int, input().split()))
l.sorted()
if min(l[m-1]) < 1/(4*m):
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
if a[m] * 4*m >= sum(a):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    a=sorted(a,reverse=True)
    total=sum(a)
    boarder=total/(4*m)
    if a[m]>=boarder:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":

    main()

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
if a[m] * 4 * m >= sum(a):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

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

a.sort(reverse = True)
s = sum(a)

for i in range(m):
    if a[m] < s * (1 / (4*m)):
        fl = "No"
        
print(fl)