HTML & JS
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    int n,m,sum=0,count=0;
    cin >> n >> m;
    int arr[n];
    for(int i=0;i<n;i++) {
        cin >> arr[i];
        sum += arr[i];
    }
    int check = sum/(4*m);
    for(int i=0;i<n;i++){
        if(arr[i] >= check) {
            count+=1;
        }
    }
    if(count >= m)
        cout << "Yes";
    else
        cout << "No";
}

Generated URL:

Output:

Yes
Report Bug