jiahuimbzuai/CoQuIR huggingface dataset:
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	c := nextInt()
	k := nextInt()

	if a == b && b == c {
		fmt.Println("0")
		return
	}

	for i := 0; i < k; i++ {
		atmp := b + c
		btmp := a + c
		ctmp := a + b
		a = atmp
		b = btmp
		c = ctmp
	}

	if abs(a-b) > pow(10, 18) {
		fmt.Println("Unfair")
		return
	}

	fmt.Println(a - b)

}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func pow(a, b int) int {
	var ret int = 1
	for b > 0 {
		if (b & 1) == 1 {
			ret *= a
		}
		a *= a
		b >>= 1
	}
	return ret
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import (
        "fmt"
        "math/big"
)

func solution(a, b, c, k int) (*big.Int, error) {
        A := big.NewInt(int64(a))
        B := big.NewInt(int64(b))
        C := big.NewInt(int64(c))
        for i := 0; i < k; i++ {
                AZ := big.NewInt(0)
                BZ := big.NewInt(0)
                CZ := big.NewInt(0)
                AZ.Add(B, C)
                BZ.Add(A, C)
                CZ.Add(A, B)
                A, B, C = AZ, BZ, CZ
        }
        out := big.NewInt(0)
        out.Sub(A, B)
        Z := big.NewInt(0)
        if Z.Abs(out).Cmp(big.NewInt(1e18)) == 1 {
                return out, fmt.Errorf("Unfair")
        }
        return out, nil
}

func main() {
        var a, b, c, k int
        fmt.Scan(&a, &b, &c, &k)
        out, err := solution(a, b, c, k)
        if err != nil {
                fmt.Println(err)
        } else {
                fmt.Println(out)
        }
}
//  [ruby]
a, b, c, k = gets.split.map(&:to_i)
puts (k % 2 == 0) ? (a - b) : (b - a)
//  [ruby]
a, b, c, k = gets.split.map(&:to_i)

puts k.even? ? a - b : b - a
//  [ruby]
a, b, _, k = gets.chomp.split.map(&:to_i)
res = a - b
if res.abs > 10 ** 18
  puts "Unfair"
else
  res *= -1 if k % 2 == 1
  puts res
end
//  [ruby]
a,b,c,k=gets.split.map(&:to_i)

if k==0
    ans=a-b
else
    ans=b-a
end

puts ans
//  [ruby]
a,b,c,k=gets.split.map(&:to_i)

if k==0
    ans=a-b
else
    ans=b-a
end

if ans.abs>10**18
    puts "Unfair"
else
    puts ans
end
//  [ruby]
a,b,c,k=gets.split.map(&:to_i)

if k==0
    ans=a-b
else
    ans=b-a
end

if ans.abs>10*18
    puts "Unfair"
else
    puts ans
end
//  [rust]
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a: i64 = sc.cin();
    let b: i64 = sc.cin();
    let c: i64 = sc.cin();
    let k: i64 = sc.cin();
    put!((a-b) * if k % 2 == 0 { 1 } else { -1 });

}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> { self.cin::<String>().chars().collect() }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> { (0..n).map(|_| self.cin()).collect() }
}
//  [rust]
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i64>();
    let (a, b, c, k) = (line[0], line[1], line[2], line[3]);

    if k%2 == 1{
        println!("{}", b-a);
    }else{
        println!("{}", a-b);
    }
}
//  [rust]
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let c:i64 = read();
    let k:i64 = read();

    if k == 1 {
        println!("{}", b-a);
    } else if k == 0 {
        println!("{}", a-b);
    } else {
        println!("0");
    }

}
//  [rust]
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    let k: usize = read();

    println!("{}", c - b);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((i[3]%2>0 ?1:-1)*(i[1]-i[0]))
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((i[3]%2*2-1)*(i[1]-i[0]))
//  [swift]
import Foundation

func solution(A: Int, B: Int, C: Int, K: Int) -> String {
   var K = K
   var A = A
   var B = B
   var C = C
   
   while K > 0 {
      let haveA = A
      let haveB = B
      let haveC = C
      
      A = haveB + haveC
      B = haveA + haveC
      C = haveA + haveB
      
      if abs(A - B) > Int(pow(10.0, 18.0)) { return "Unfair"}
      
      K -= 1
   }
   
   return String(A - B)
}

let ABCK = readLine()!.components(separatedBy: " ").map { Int($0)! }

print(solution(A: ABCK[0], B: ABCK[1], C: ABCK[2], K: ABCK[3]))
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((i[3]%2>0 ?1:-1)*i[1]-i[0])
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!}
print((i[3]%2>0 ?-1:1)*i[0]-i[1])
//  [typescript]
'use strict'
 
function Main(input) {
  const takahashi = Number(input.split(' ')[0]);
  const chuhashi = Number(input.split(' ')[1]);
  const syohashi = Number(input.split(' ')[2]);
  const K = input.split(' ')[3];
  const Ka = Number(K.slice(-1));
 
  const answer = chuhashi - takahashi;
  
  if(Ka % 2 === 0 && answer !== 0) {
    console.log(answer * -1);
  } else {
    console.log(answer);
  }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [typescript]
'use strict'
 
function Main(input) {
  const takahashi = Number(input.split(' ')[0]);
  const chuhashi = Number(input.split(' ')[1]);
  const syohashi = Number(input.split(' ')[2]);
  const K = input.split(' ')[3];
  const Ka = Number(K.slice(-1));
 
  const answer = chuhashi - takahashi;
  
  if(Ka % 2 === 0 && answer !== 0) {
    console.log(answer * -1);
  } else {
    console.log(answer);
  }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from 'fs'

const inputs = fs.readFileSync('/dev/stdin', 'utf8').split(/\r?\n/) as string[];

const nums = inputs[0].split(' ').map(elm => +elm);

if (nums[3] % 2 === 0) {
    console.log(nums[0] - nums[1]);
} else {
    console.log(nums[1] - nums[0]);
}
//  [python]
N,M = input().split(" ")
A = list(map(int, input().split(" ")))
count = 0
temp = 0
for x in A:
    temp += x
num = (1/(4*int(M)))*temp
for x in A:
    if x >= num:
        count += 1
    elif count >= int(M):
        break
    else:
        continue
if count>=int(M):
    print("Yes")
else:
    print("No")
//  [python]
n,m = map(int,input().split())
a = list(map(int, input().split()))
popular = list(filter(lambda e: e>=(1/(4*m))*sum(a),a))
print("Yes" if len(popular) >= m else "No")
//  [python]
n, m = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]

a_sum = sum(a_list)
a_list.sort()
a_list.reverse()
for i in range(m):
    a = a_list[i]
    if a < a_sum / (4 * m):
        print('No')
        exit()
else:
    print('Yes')
//  [python]
N, M =  map(int, input().split())
A = list(map(int, input().split()))
assert len(A) == N
# 商品iは得票Ai
# 総得票数の1/4M以上の商品をM個選ぶ
total = sum(A)
thres = math.ceil(total / (4 * M))
count = len([i for i in range(N) if A[i] >= thres])
if count >= M:
  print('Yes')
else:
  print('No')
//  [python]
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
for i in a:
  if i > sum(a)/(4*m):
    ans += 1
    if ans == m:
      print("Yes")
      exit()
  else:
    print("No")
    exit()
//  [python]
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum = 0
cnt = 0
for i in a:
    sum += i
for i in a:
    if(sum < 4*m*i):
        cnt += 1
if(cnt >= m):
    print("Yes")
else:
    print("No")
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
  public static void main(String[] args) throws IOException{
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    String[] a_str = in.readLine().split(" ");
    int n = Integer.parseInt(str[0]);
    int m = Integer.parseInt(str[1]);
    Integer[] a = new Integer[n];
    int sum = 0;

    for(int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(a_str[i]);
      sum += a[i];
    }
    
    Arrays.sort(a, Comparator.reverseOrder());
    System.out.println(a[m-1] * 4 * m >= sum?"Yes":"No");
  }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FasterScanner sc = new FasterScanner(System.in);

		long n = sc.nextInt();
		long m =sc.nextInt();
		long sum = 0;
		long[] a = new long[(int)n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		long M = m;
		for (int i = 0; i < n; i++) {
			if (a[i]*4*M >= sum) {
				m--;
			}
		}
		if (m <= 0) {
			System.out.println("Yes");
		} else System.out.println("No");

		sc.close();
	}
	
	class FasterScanner {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner() {
			this(System.in);
		}

		public FasterScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public void close() {
			try {
				mIs.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double m = sc.nextDouble();
        double[] a = new double[n];
        double sum = 0.0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextDouble();
            sum += a[i];
        }
        double ans = 0.0;
        double tmp = sum / (m * 4.0);
        for (int i = 0; i < n; i++) {
            if(a[i] > tmp) ans++;
        }
        if(ans >= m) System.out.println("Yes");
        else System.out.println("No");
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            sum += a[i];
        }
        int ans = 0;
        int tmp = sum / (m * 4);
        for (int i = 0; i < n; i++) {
            if(a[i] > tmp) ans++;
        }
        if(ans >= m) System.out.println("Yes");
        else System.out.println("No");
    }
}
//  [java]
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); //N種類の商品
    int M = sc.nextInt(); //M個を選ぶ
    int[] A = new int[N]; //得票数
    int sum = 0; //総投票数
    int cnt = 0; //許容選択数
    String S = ""; //空
    
      for(int i=0; i<N; i++) { //商品 i
        A[i]=sc.nextInt(); 
        sum += A[i];
      }
      for(int i=0; i<N; i++){
        if(A[i]*4*M) >= sum){
          cnt++;
        } 
      }
      if(cnt>=M) {
        S="Yes";
      } else {
        S="No";
      }
    System.out.println(S);
  }
}
//  [cpp]
//
#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int MOD = 1000000007;
const int INF = 1000000007;
const int MAXN = (int)3e5+1;

void setIO(string name)
{
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //setIO("");
    int n, m;
    cin >> n >> m;
    int arr[n];
    int sum = 0;
    for(int i=0; i<n; i++)
    {
        cin >> arr[i];
        sum += arr[i];
    }
    sort(arr, arr+n);
    if(arr[n-m] * m * 4 < sum)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }


    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    
    int n,m;cin>>n>>m;
    vector<int> a(n);
    int sum=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }

    int cnt=0;
    rep(i,n){
        if(sum<=a[i]*4*m) cnt++;
    }
    if(cnt>=m){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}
//  [cpp]
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,sum=0,cnt=0;
    cin>>n>>a;
    int test[n];
    for(int i=0;i<n;i++){
        cin>>test[i];
        sum += test[i];
        if(test[i] >= sum/4*a){
            cnt++;
        }
    }
    if(cnt >= a){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
    return 0;
}
//  [cpp]
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,sum=0,cnt=0;
    cin>>n>>a;
    int test[n];
    for(int i=0;i<n;i++){
        cin>>test[i];
        sum += test[i];
        if(test[i] >= sum/4*a){
            cnt++;
        }
    }
    if(cnt >= a){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }


    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
// #include <chrono>
// #include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846
 
ll power(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}
 
int pow(int a,int b){
	if(b == 0)return 1;
	int res = pow(a,b/2);
	res = res*res;
	if(b&1)res *= a;
	return res;
}



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);

// int t;
// cin >> t;
// while(t--){



// }

int n,m;
cin >> n >> m;

int arr[n];
ld total = 0;
fo(i,0,n)cin >> arr[i];
// fo(i,0,n)cout << arr[i] << ' ';
// cout << endl;

fo(i,0,n)total += arr[i];
total = total/4;
total = total/m;


total = (int)total;
int count = 0;
for(int i = 0; i< n;i++){
	if(arr[i] <= total)continue;
	count++;
}

if(count >= m)cout << "Yes" << endl;
else cout << "No" << endl;


return 0;
	
	}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#define gc() getchar()
typedef unsigned long long ull;
int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}
int comp(const void* a, const void* b)//用来做比较的函数。
{
	return *(int*)a - *(int*)b;
}
int a[100];
int main()
{
	int n, m,i,k=0,flag=0;
	double sum=0;
	n = in(), m = in();
	for (i = 0; i < n; i++) a[i] = in(),sum+=a[i];
	sum = sum / (4 * m);
	for (i = 0; i < n; i++)
	{
		if (a[i] >= sum) k++;
		if (k == m) { flag = 1; break; }
	}
	/*printf("%d\n", sum);*/
	if (flag == 1) printf("Yes\n");
	else printf("No\n");

}
//  [c]
#include <stdio.h>

int main() 
{
    int m,n,h=0;
    int b,a[105]={0};
    int i,sum=0;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
    {
    	scanf("%d",&a[i]);
    	sum=sum+a[i];
	}
	for(i=0;i<n;i++)
	{
		b=a[i]*m*4;
		if(b>=sum)
		   h++;
	}
	if(h>=m)
	  printf("Yes");
	else
	printf("No");
    return 0;
}
//  [c]
#include <stdio.h>
 
int main()
{
  int nn, mm;
  scanf("%d %d", &nn, &mm);
  int aa[nn];
  for(int ii = 0;ii < nn;ii++)
  {
    scanf("%d", &aa[ii]);
  }
  int sum = 0;
  for(int ii = 0;ii < nn;ii++)
  {
    sum += aa[ii];
  }
  int max, old_max = 1001;
  for(int ii = 1;ii <= mm;ii++)
  {
    max = 0;
    for(int jj = 0;jj < nn;jj++)
    {
      if(aa[jj] > max && aa[jj] < old_max)
      {
        max = aa[jj];
      }
    }
    old_max = max;
  }
  float hikaku = sum / (4.0 * mm);
  if(max >= hikaku)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
//  [c]
#include<stdio.h>

int main(void){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[n],c=0,d=0;
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    c+=a[i];
  }
   for(int i=0;i<n;i++){
    if(c/(4*m)<=a[i]){
      d++;
    }
   }
  if(d>=m){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
return 0;
}
//  [c]
#include<stdio.h>

int main(void){
  int n,m;
  scanf("%d %d",&n,&m);
  int a[n],c=0,d=0;
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    c+=a[i];
  }
   for(int i=0;i<n;i++){
    if(c/(4*m)<a[i]){
      d++;
    }
   }
  if(d>=m){
    printf("Yes");
  }else{
    printf("No");
  }
return 0;
}
//  [c]
#include<stdio.h>

int main () 
{
  int m,n,i,score,check;
  int a[1001];
  
  scanf("%d %d",&n,&m);
  
  score=0;
  
  for (i=1;i<=n;i++)
  {
  scanf("%d",&a[i]);
  score+=a[i];   
  }
  
  check=0;
  for (i=1;i<=n;i++)
  {
     if (a[i] >= score / (4*m))
     {
       check+=1;
     }
  }
  
  if (check >= m )
  {
  printf("Yes");
    return 0;
  }
 
  printf("No");
  return 0;
}
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const N = Number(input[0].split(" ")[0]);
    const M = Number(input[0].split(" ")[1]);
    const A = input[1].split(" ").map(n => Number(n));
    const total = A.reduce((acc, curr) => acc+curr)
    const thresh = 1*total / (4*M)
    A.sort((a,b) => b-a)
    if(A[M-1] < thresh) console.log("No")
    else console.log("Yes")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const N = Number(input[0].split(" ")[0]);
    const M = Number(input[0].split(" ")[1]);
    const A = input[1].split(" ").map(n => Number(n));
    const total = A.reduce((acc, curr) => acc+curr)
    const thresh = 1*total / (4*M)
    A.sort((a,b) => b-a)
    if(A[M-1] >= thresh) console.log("Yes")
    else console.log("No")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
const input = require("fs").readFileSync("/dev/stdin", "utf8")
const lines = input.split('\n')
const [N, M] = lines[0].split(' ').map(Number)
const A = lines[1].split(' ').map(Number)

const sum = A.reduce((a, b) => a + b)

const div = sum / (M * 4)

let count = 0
A.forEach(a => {
  count += a > div ? 1 : 0
})

console.log(count >= M ? 'Yes' : 'No')
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  var ans = "Yes";
  input = input.trim().split("\n");
  const [N, M] = input[0].split(" ").map((n) => parseInt(n));
  var a = input[1].split(" ").map((n) => parseInt(n));
  a.sort((a, b) => b - a);
  var top = a.slice(0, M);
  const lim = arrsum(a) / 4 / N;

  if (top[top.length - 1] < lim) {
    ans = "No";
  }

  function arrsum(arr) {
    return arr.reduce((c, a, i, self) => {
      return c + a;
    });
  }

  //出力
  console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input.txt", "utf-8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	var ans = 'Yes'
  input = input.trim().split("\n");
	const [N, M] = input[0].split(" ").map((n) => parseInt(n));
	var a = input[1].split(' ').map(n => parseInt(n))
	a.sort((a, b) => b - a)
	var top = a.slice(0, M)
	const lim = 4 * M

  if (top[top.length -1] < lim)	{
    ans = 'No'
  }	



  //出力
  console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require("fs").readFileSync("./input.txt", "utf-8"));
//  [go]
// 参考: https://atcoder.jp/contests/abc161/submissions/12499845
// Kagemekaさんのおかげでfmt.Scan()でスライスを活用できることを知れました！

package main

import (
	"fmt"
)

func main() {
	var requires []int = make([]int, 2)
	for i := 0; i < 2; i++ {
		fmt.Scan(&requires[i])
	}

	var things []float64 = make([]float64, requires[0])
	var sumNum float64 = 0
	for i := 0; i < requires[0]; i++ {
		fmt.Scan(&things[i])
		sumNum += things[i]
	}

	var popularNum int = 0
	// なんか条件は小数点切り捨てじゃいけないらしい
	// 急がば回れ
	var requirement float64 = sumNum / float64(4*requires[1])
	for _, num := range things {
		if num >= requirement {
			popularNum++
		}
	}

	if popularNum >= requires[1] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
  "fmt"
  "sort"
)

func sumInt(a ...int) int {s := 0; for _, v := range a {s += v}; return s}

func main() {
  var n, m int 
  fmt.Scan(&n, &m)
  a := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&a[i])
  }
  sort.Ints(a)
  s := sumInt(a...)
  ans := "No"
  if a[n-m] * 4*m >= s {
    ans = "Yes"
  }
  fmt.Println(ans)
  

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func readLine() string {
	sc.Scan()
	return sc.Text()
}

func main()  {
	var N, M int
	fmt.Scan(&N, &M)

	inputs := strings.Split(readLine(), " ")

	sum := 0

	for i := 0; i < N; i++{
		num, _ := strconv.Atoi(inputs[i])
		sum += num
	}

	count := 0
	MFloat := float32(M)

	for i := 0; i < N; i++ {
		num, _ := strconv.Atoi(inputs[i])
		numFloat := float32(num)

		if numFloat >= (float32(sum) / (4.0 * MFloat)){
			count = count + 1
		}
	}

	if count >= M {
		fmt.Println("Yes")
	}else{
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n, m := readI(), readI()
	a := readIs(n)

	sou := float64(sum(a))

	ninki := 0
	for _, v := range a {
		if float64(v) > sou/float64((4*m)) {
			ninki++
		}
	}

	if ninki >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func sum(a []int) int {
	b := 0
	for _, v := range a {
		b += v
	}
	return b
}

/*-----------Utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/hand_05.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n, m := readI(), readI()
	a := readIs(n)

	sou := sum(a)

	ninki := 0
	for _, v := range a {
		if v > sou/(4*m) {
			ninki++
		}
	}

	if ninki >= m {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

func sum(a []int) int {
	b := 0
	for _, v := range a {
		b += v
	}
	return b
}

/*-----------Utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/hand_05.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}
//  [ruby]
n, m = gets.split.map(&:to_i)
values = gets.split.map(&:to_i)
total_v = values.inject(:+)
count = 0

values.each do |v|
  if v >= total_v.to_f / (4 * m)
    count += 1
  end
end

if count >= m
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
n, a = gets.chomp.split(" ").map(&:to_i)
k = gets.chomp.split(" ").map(&:to_i)
j = k.sort.reverse
all = 0
(1..n).each do |i|
    all += k[i-1]
end
count =0
N = (all.to_f / (4 * a.to_f)).ceil
(0..a-1).each do |d|
   count += 1 if j[d] >= N
end
puts count.to_i == a ? "Yes" : "No"
//  [ruby]
# Your code here!

n, a = gets.chomp.split(" ").map(&:to_i)
k = gets.chomp.split(" ").map(&:to_i)
j = k.sort.reverse
all = 0
(1..n).each do |i|
    all += k[i-1]
end
count =0
N = (all.to_f / (4 * a.to_f)).ceil

(0..a-1).each do |d|
    if j[d] >= N
        count += 1
    end
end
if a == count.to_i
    puts "Yes"
else
    puts "No"
end
//  [ruby]
n,m,*a=`dd`.split.map(&:to_i)
l=a.sum./4*m.to_f
c=a.inject(0){|a,b|b<l ? a : a+b}
puts c<m ? 'No':'Yes'
//  [ruby]
n,m,*a=`dd`.split.map(&:to_i)
puts a.inject(0){|a,b|b<a.sum./4*m.to_f ? a : a+b}<m ? 'No':'Yes'
//  [ruby]
n,m,*a=`dd`.split.map(&:to_i)
l=a.sum./4*m.to_f
c=a.inject(0){|a,b|a+b if b>=l}
puts c<m ? 'No':'Yes'
//  [rust]
macro_rules! get_tuple {
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };

    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get_tuple!($($t),*)
        ).collect::<Vec<_>>()
    };
}

macro_rules! get_vec {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_| get_vec!($t)).collect::<Vec<_>>()
    };
}

fn main() {
    let (_, m) = get_tuple!(usize, usize);
    let v_a = get_vec!(usize);

    let sum: usize = v_a.iter().sum();
    let thresh = (sum as f64) / (4.0 * m as f64);
    let choosable = v_a.into_iter().filter(|&a| a as f64 >= thresh).count();
    let ans = if choosable >= m { "Yes" } else { "No" };
    println!("{}", ans)
}
//  [rust]
// rust input macro: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
 
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
  input!{
    n: i32, m: i32,
    a: [i32; n]
  };
  let mut sum: i32 = 0;
  for i in a.iter() {
    sum += *i;
  }
  let mut cnt = 0;
  for i in a.iter() {
    if i * 4 * m >= sum {
      cnt += 1;
    }
  }
  if cnt >= m {
    println!("Yes");
  }else{
    println!("No");
  }
  
}
//  [rust]
use proconio::*;

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

    let sum: usize = a.iter().sum();
    let mut ans = 0;
    for i in 0..n {
        if a[i] >= (sum + 4 * m - 1) / (4 * m) {
            ans += 1;
        }
    }
    println!("{}", if ans >= m { "Yes" } else { "No" });
}
//  [rust]
use proconio::{fastout, input, marker::*};

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

    a.sort();
    a.reverse();

    let sum = a.iter().sum::<usize>();

    if a[m-1] >= sum / (4 * m) {
        println!("Yes");
    } else {
        println!("No");
    }

}
//  [rust]
use proconio::{fastout, input, marker::*};

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

    let total = a.iter().sum::<usize>() / (4 * m);

    println!(
        "{}",
        if m <= a.iter().filter(|&&x| total <= x).count() {
            "Yes"
        } else {
            "No"
        }
    );
}
//  [rust]
use proconio::{fastout, input, marker::*};

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

    let total = (1f64 / (4f64 * m as f64) * a.iter().sum::<usize>() as f64) as usize;

    println!(
        "{}",
        if m <= a.iter().filter(|&&x| total <= x).count() {
            "Yes"
        } else {
            "No"
        }
    );
}
//  [swift]
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nm = readInts()
    let (_,m) = (nm[0],nm[1])
    let votes = readInts().sorted { $0 > $1 }
    let total = votes.reduce(0) { $0 + $1 }
    let counter = votes.filter { $0*4*m >= total }.count
    
    print( counter >= m ? "Yes": "No")
}
main()
//  [swift]
import Foundation

let inputLine = readLine()!.components(separatedBy: " ").map({Int($0)!})
let N = inputLine[0]
let M = inputLine[1]

let inputLine2 = readLine()!.components(separatedBy: " ").map({Int($0)!})

let sumVotes = inputLine2.reduce(0){$0 + $1}
let popularItems = inputLine2.filter({$0*4*M >= sumVotes})

if popularItems.count >= M {
    print("Yes")
} else {
    print("No")
}
//  [swift]
// Popular Vote

func main() {
    let m = readLine()!.split(separator: " ").map{Int($0)!}[1]
    let a = readLine()!.split(separator: " ").map{Int($0)!}.sorted(by: >)
    
    let sum = a.reduce(0, +)

    if a[m-1] * 4 * m < sum {
        print("No")
    } else {
        print("Yes")
    }
}

main()
//  [swift]
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nm = readInts()
    let (_,m) = (nm[0],nm[1])
    let votes = readInts().sorted { $0 > $1 }
    let total = votes.reduce(0) { $0 + $1 }
    let count = votes.filter { $0*4*m >= total }.count
    
    print( count >= 3 ? "Yes": "No")
}
main()
//  [swift]
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nm = readInts()
    let (_,m) = (nm[0],nm[1])
    let votes = readInts().sorted { $0 > $1 }
    let total = votes.reduce(0) { $0 + $1 }
    let count = votes.filter { $0 < total / (4*m) }.count
    
    print( count >= 3 ? "Yes": "No")
}
main()
//  [swift]
import Foundation

func readInts() -> [Int]{
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main(){
    let nm = readInts()
    let (_,m) = (nm[0],nm[1])
    let votes = readInts().sorted { $0 > $1 }
    let total = votes.reduce(0) { $0 + $1 } // 総得票数
    
    for i in 0...m {
        if votes[i] * 4 * 2 < total {
            print("No")
            return
        }
    }
    print("Yes")
}

main()
//  [typescript]
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let [n,m]=o.nn(2)
  let ar=[],g=0
  for(let i=0;i<n;i++){
    let t=o.n();
    g+=t;
    ar.push(t);
  }
  let bo = g/(4*m)
  o.asc(ar);
  for(let i=0;i<m;i++){
    if(Number(ar.pop()) < bo){
      o.No()
      return
    };
  }
  o.Yes()
}
m();
//  [typescript]
function main(input) {
  const lines = input.split("\n");
  const [N, M] = lines[0].split(' ').map(Number);
  const a = lines[1].split(' ').map(Number);

  const total = a.reduce((acc, current) => acc + current);
  const border = total / (4 * M);
  let count = 0;
  a.forEach(n => {
    if (n < border) return;
    count++;
  });

  console.log(count < M ? 'No' : 'Yes');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input: string) {
  const params: string[][] =
    input.split('\n')
      .map(line => line.split(' '));
  const [n, m] = params[0].map(x => parseInt(x));
  const a: number[] = params[1].map(x => parseInt(x));

  const sum = a.reduce((x, y) => x + y);

  const b = a.filter(x => 4 * m * x >= sum);

  const msg = (b.length >= m) ? 'Yes' : 'No';

  console.log(msg)
}

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin', 'utf8');
Main(input);
//  [typescript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const itemNum = Number(inputs[0].split(' ')[0]);
  const selectNum = Number(inputs[0].split(' ')[1]);
  const itemList = inputs[1].split(' ')
                   .map(Number)
                   .sort((x, y) => (x < 1 ? 1 : -1));
  const totalVotes = itemList.reduce((acc, cur) => acc + cur);

  if (itemList[selectNum - 1] * 4 < totalVotes) {
    console.log('No');
  } else {
    console.log('Yes');
  }
}
//  [typescript]
function Main(input: string) {
  const lines = input.split('\n');
  const params1 = lines[0].split(' ').map(x => parseInt(x));
  const params2 = lines[1].split(' ').map(x => parseInt(x));

  const n = params1[0];
  const m = params1[1];
  const a = params2;

  const sum = a.reduce((m, n) => m + n);
  
  const b = a.filter(x => 4 * x >= sum);

  const msg = (b.length >= m) ? 'Yes' : 'No';

  console.log(msg)
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
function Main(input: string) {
  const lines = input.split('\n');
  const params1 = lines[0].split(' ').map(x => parseInt(x));
  const params2 = lines[1].split(' ').map(x => parseInt(x));

  const n = params1[0];
  const m = params1[1];
  const a = params2;

  const sum = a.reduce((m, n) => m + n);
  const pickSum = sort(a).slice(0, m).reduce((m, n) => m + n);

  const msg = (sum <= 4 * pickSum) ? 'Yes' : 'No';
  
  console.log(msg)
}

function sort(a: number[]): number[] {
  let b = a;
  b.sort((m, n) => n - m);
  return b
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
n=int(input())
dict1={}
flag=0
arr=[]
for i in range(n):
    s=str(input())
    if(i==0):
        dict1[s]=1
        arr.append(s)
    else:
        if(arr[-1][-1]!=s[0]):
            flag=1
        else:
            try:
                dict1[s]+=1
                flag=1
            except:
                KeyError
                dict1[s]=1
            arr.append(s)
if(flag==0):
    print("Yes")
else:
    print('No')
//  [python]
N = int(input())
W = [input() for i in range(N)]

result = True

for i in range(1, N):
    if W[i-1][-1] != W[i][0]:
        result = False
        break
    if W[i] in W[:i]:
        result = False
        break

if result:
    print("Yes")
else:
    print("No")
//  [python]
N = int(input())
w =[input() for i in range(N)]

ans = "Yes"
if len(set(w))!=len(w):
    ans = "No"
for i in range(N-1):
    if w[i+1][0] !=w[i][-1]:
        ans = "No"
        break
print(ans)
//  [python]
import sys
import numpy as np
import collections as cl
import itertools as it
# import more_itertools as mit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(100000)

n = int(readline())
w = list(readlines().split())
dic = set()

for i in w:
    if i == 0:
        dic.append(i)
        continue
    if i in dic or dic[i-1][-1] != dic[i][0]:
        print('No')
        sys.exit()
    dic.append(i)
print('Yes')
//  [python]
n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i - 1][-1] == list_w[i][0]) and list_w[i] not in list_w[:i]:
        print(list_w[i])
        continue
    else:
        print("No")
        exit()
print("Yes")
//  [python]
n = int(input())
list_w = [input() for s in range(0, n)]
for i in range(0, n):
    if i == 0 or (list_w[i][-1] == list_w[i][0] and list_w[i] not in list_w[:i]):
        continue
    else:
        print("No")
        exit()
print("Yes")
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;

    int in_N;

    int                     cnt;
    HashMap<String, String> word;
    String                  last;
    boolean                 ans;

    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));
      word      = new HashMap<String, String>();

      /*----------------
       * 引数
       *----------------*/
      in_str = new String(in_stream.readLine());
      in_N   = Integer.parseInt(in_str);

      ans    = true;
      last = new String(in_stream.readLine());
      word.put(last, "a");
      for(cnt=1; cnt<in_N; cnt++)
      {
        in_str = new String(in_stream.readLine());

        if(null == word.get(in_str))
        {
          if( !(last.substring(last.length()-1, last.length()).equals(in_str.substring(0, 1))) )
          {
            ans = false;
            break;
          }

          last = in_str;
          word.put(last, "a");
        }
        else
        {
          ans = false;
          break;
        }
      }

      /*----------------
       * 計算
       *----------------*/
      if(ans)
      {
        System.out.println("Yes");
      }
      else
      {
        System.out.println("No");
      }
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}
//  [java]
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N=nextInt();

		String ans ="Yes";
		String last=nextString();
		Map<String,Boolean> map = new HashMap<>();
		map.put(last, true);
		for(int i=1;i<N;i++){
			String w = nextString();
			if(last.charAt(last.length()-1)==w.charAt(0)&&!map.containsKey(w)){
				last=w;
				map.put(last, true);
			}else{
				ans="No";
				break;
			}
		}

		System.out.println(ans);




	}




	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main{
	public static void main(String[] args){
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		try {
			ArrayList<String> list = new ArrayList<String>();
			int N =Integer.parseInt(br.readLine());
			String pre = br.readLine();
			list.add(pre);
			for(int i=1;i<N;i++){
				String post = br.readLine();
				if(list.contains(post)){
					System.out.println("No");
					return;
				}
				if(pre.charAt(pre.length()-1) != post.charAt(0)){
					System.out.println("No");
                                        return;
				}
				list.add(post);
				pre = post;
			}
			System.out.println("Yes");
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			try {
				br.close();
			} catch (IOException e) {
				// NOP
			}
		}
	}

}