Harryxun/stf_run huggingface dataset:
N=int(input())
A=[]
for i in range(2):
    A_ = list(map(int, input().split()))
    A.append(A_)
    A[i].append(0)
A.append([0]*(N+1))
# A=[[0]*(N+1),[0]*(N+1),[0]*(N+1)]
# A[0]=list(map(int,input().split()))
# A[1]=list(map(int,input().split()))

max_candidate=[]
x=0
y=0
ans=A[0][0]
for i in range(N):
  if A[y][x+1]>=A[y+1][x]:
    ans+=A[0][x+1]
    x+=1
  #下方向移動の方が値が大きい場合、最大値の候補としてリストに追加
  else:
    ans_can=ans
    # for j in range(x,N):
    #   ans_can+=A[1][j]
    ans_can+=A[1][3]
    ans_can+=A[1][4]
    max_candidate.append(ans_can)
    x+=1
print(max(max_candidate))


### FIXED CODE ###

N=int(input())
A=[]
for i in range(2):
    A_ = list(map(int, input().split()))
    A.append(A_)
    A[i].append(0)
A.append([0]*(N+1))
# A=[[0]*(N+1),[0]*(N+1),[0]*(N+1)]
# A[0]=list(map(int,input().split()))
# A[1]=list(map(int,input().split()))

max_candidate=[]
x=0
y=0
ans=A[0][0]
for i in range(N):
  if A[y][x+1]>=A[y+1][x]:
    ans+=A[0][x+1]
    x+=1
  #下方向移動の方が値が大きい場合、最大値の候補としてリストに追加
  else:
    ans_can=ans
    for j in range(x,N):
      ans_can+=A[1][j]
    max_candidate.append(ans_can)
    ans+=A[0][x+1]
    x+=1
print(max(max_candidate))
n,k = map(int,input().split())
if k > (n-1)*(n-2)/2:
  print(-1)
else:
  p = (n-1)*(n-2)/2 - k
  print(int(N-1+p))
  for i in range(2,n+1):
    print(1,i)
  x = 2
  y = 3
  for _ in range(int(p)):
    print(x,y)
    y = y + 1
    if y == n + 1:
      x = x + 1
      y = x + 1

### FIXED CODE ###

n,k = map(int,input().split())
if k > (n-1)*(n-2)/2:
  print(-1)
else:
  p = (n-1)*(n-2)/2 - k
  print(n-1+int(p))
  for i in range(2,n+1):
    print(1,i)
  x = 2
  y = 3
  for _ in range(int(p)):
    print(x,y)
    y = y + 1
    if y == n + 1:
      x = x + 1
      y = x + 1
import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

A = []
for x in X:
    SL, SR, TL, TR = 10**20, 10**20, 10**20, 10**20
    i = bisect.bisect_left(S, x)
    if i != 0:
        SL = x-S[i-1]
    if i != A:
        SR = S[i]-x

    j = bisect.bisect_left(T, x)
    if j != 0:
        TL = x-T[j-1]
    if j != B:
        TR = T[j]-x

    ans = min(max(SL, TL), min(2*SL+TR, SL+2*TR),
              min(2*TL+SR, TL+2*SR), max(SR, TR))
    A.append(ans)
print(*A, sep='\n')


### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

for x in X:
    p0, p1, p2, p3 = (10**12 for _ in range(4))
    si = bisect.bisect_left(S, x)
    ti = bisect.bisect_left(T, x)

    if si != 0 and ti != 0:
        p0 = max(x-S[si-1], x-T[ti-1])
    if si != 0 and ti != B:
        p1 = min(x-S[si-1], T[ti]-x)*2+max(x-S[si-1], T[ti]-x)
    if si != A and ti != 0:
        p2 = min(S[si]-x, x-T[ti-1])*2+max(S[si]-x, x-T[ti-1])
    if si != A and ti != B:
        p3 = max(S[si]-x, T[ti]-x)
    print(min(p0, p1, p2, p3))
import time

N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

count = 0

for i in range(N):
    if n[i] >= K:
        count += 1

print(count)

### FIXED CODE ###

N, K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

count = 0

for i in range(N):
    if h[i] >= K:
        count += 1

print(count)
N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]
dpx = 10**4+1
for i in range(1,N):
  for j in range(i):
      dpx = min(dpx, abs(h[i]-h[i-j])+dp[i-j])
  dp.append(dpx)
print(dp[-1])

### FIXED CODE ###

def main():
    N,K = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [0]*N
    for i in range(1,N):
        dp[i]= min(abs(h[i]-h[j])+dp[j] for j in range(max(0,i-K),i))
    print(dp[-1])
main()
import collections
n,m = map(int, raw_input().split(' '))
matrix = [list(raw_input()) for _ in range(n)]
dpleft = [[0 for j in range(m)] for i in range(n)]
dpright = [[0 for j in range(m)] for i in range(n)]
dpup = [[0 for j in range(m)] for i in range(n)]
dpdown = [[0 for j in range(m)] for i in range(n)]
for l in matrix:
	print l
for i in range(n):
	cumul = 0
	for j in range(m):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpleft[i][j] = cumul
			cumul +=1

	cumul = 0
	for j in range(m)[::-1]:
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpright[i][j] = cumul
			cumul +=1

for j in range(m):
	cumul = 0
	for i in range(n):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpup[i][j] = cumul
			cumul +=1

	cumul = 0
	for i in range(n)[::-1]:
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpdown[i][j] = cumul
			cumul +=1
r = 0
for i in range(len(matrix)):
	for j in range(len(matrix)):
		if matrix[i][j] == '.':
			r = max(r, 1 + dpleft[i][j] + dpright[i][j] + dpdown[i][j] + dpup[i][j])
print r

### FIXED CODE ###

import collections
n,m = map(int, raw_input().split(' '))
matrix = [list(raw_input()) for _ in range(n)]
dpleft = [[0 for j in range(m)] for i in range(n)]
dpright = [[0 for j in range(m)] for i in range(n)]
dpup = [[0 for j in range(m)] for i in range(n)]
dpdown = [[0 for j in range(m)] for i in range(n)]

for i in range(n):
	cumul = 0
	for j in range(m):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpleft[i][j] = cumul
			cumul +=1

	cumul = 0
	for j in range(m-1,-1,-1):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpright[i][j] = cumul
			cumul +=1

for j in range(m):
	cumul = 0
	for i in range(n):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpup[i][j] = cumul
			cumul +=1

	cumul = 0
	for i in range(n-1,-1,-1):
		if matrix[i][j] == '#':
			cumul = 0
		else:
			dpdown[i][j] = cumul
			cumul +=1
r = 0
for i in range(len(matrix)):
	for j in range(len(matrix[0])):
		if matrix[i][j] != '#':
			r = max(r, 1 + dpleft[i][j] + dpright[i][j] + dpdown[i][j] + dpup[i][j])

print r
s = input()

if "RRR" in s:
    ans = 3
elif "RR" in s:
    ans = 2
elif "R" in s:
    ans = 1

print(ans)


### FIXED CODE ###

s = input()

if "RRR" in s:
    ans = 3
elif "RR" in s:
    ans = 2
elif "R" in s:
    ans = 1
else:
    ans = 0

print(ans)
import numpy as np

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

L = []
for i in range(M):
    B, C = map(int, input().split())
    L.append([B,C])
L = np.array(L)
L = L[np.argsort(L[:,1])[::-1]]


i = 0
for b,c in L:
    for j in range(b):
        if A[i] < c:
            A[i] = c
            i += 1
        else:
            print(sum(A))
            quit()
print(sum(A))

### FIXED CODE ###

import numpy as np

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

L = []
for i in range(M):
    B, C = map(int, input().split())
    L.append([B,C])
L = np.array(L)
L = L[np.argsort(L[:,1])[::-1]]

i = 0
for b,c in L:
    for j in range(b):
        if i+1 <= len(A):
            if A[i] < c:
                A[i] = c
                i += 1
            else:
                print(sum(A))
                quit()
        else:
            print(sum(A))
            quit()

print(sum(A))
N, M = map(int,input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(A)

for _ in range(M):
  tmp_min = heapq.heappop(A)
  heapq.heappush(A, (-1) * (-tmp_min // 2))

print(-sum(A))

### FIXED CODE ###

from bisect import bisect_left as bs
#ソート順序を保ったまま値を挿入する
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()

while M > 0:
  i = A.pop(-1) // 2
  A.insert(bs(A, i), i)
  M -= 1

print(sum(A))
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in sorted(list(set(l[:k] + l[-k:]))):
    print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
l = []
for i in range(k):
    if a+i <= b-i:
        l.append(a+i)
        l.append(b-i)

List = sorted(set(l))
for i in range(len(List)):
    print(List[i])
import string
def print_ans(s):
    """Print substring of s, odd_th char
    >>> print_ans("abcdefghijklmnopqrstuvwxyz")
    None
    >>> print_ans("cbbbaeae")
    d
    >>> print_ans("b")
    a
    >>> print_ans("abc")
    d
    
    """
    a = string.ascii_lowercase
    b = list(set(a)-set(s)) #diff of list a and list b
    b.sort()

    print_ans(b[0] if b else 'None')

if __name__ == '__main__':
    S = input()
    print_ans(S)



### FIXED CODE ###

#!/usr/bin/env python3
import sys
s = input()
for i in range(26):
    if chr(97+i) not in s: 
        print(chr(97+i)) 
        break
    if i == 25:
        print("None")
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]+=B[C[i][0]]
    B[C[i][0]]=0
    print(S)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*(10**5+1)
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)
X = int(input())

sum_ = [0] * (X // 2 + 1)
a = [i for i in range(1, X//2 + 1)]
for i in range(X//2):
    sum_[i + 1] = sum_[i] + a[i]
import bisect
print(bisect.bisect_left(sum_, X))


### FIXED CODE ###

X = int(input())
a = [i for i in range(1, 10**5)]
import bisect
from collections import deque
s = deque([])
s.append(0)
i = 0
while s[i] < 10 ** 9:
    s.append(s[i] + a[i])
    i += 1

print(bisect.bisect_left(s, X))
def xor(data):
    res = data[0]
    for i in range(1,len(data)):
        res ^= data[i]
    return res

A,B = map(int,input().split())
num = B-A+1
data = []
cut = 0
if A % 2 == 0:
    cut = (num) // 2
    if cut == 1:
        data.append(1)
    if num % 2 == 1:
        data.append(B)
else:
    data.append(A)
    cut = (num-1) // 2
    if cut == 1:
        data.append(1)
    if (num-1) % 2 == 1:
        data.append(B)
ans = xor(data)
print(ans)

### FIXED CODE ###

def xor(data):
    if not data:
        return 0
    res = data[0]
    for i in range(1,len(data)):
        res ^= data[i]
    return res

A,B = map(int,input().split())
if A == B:
    print(A)
    exit()
num = B-A+1
data = []
cut = 0
if A % 2 == 0:
    cut = (num) // 2
    if cut % 2 == 1:
        data.append(1)
    if num % 2 == 1:
        data.append(B)
else:
    data.append(A)
    cut = (num-1) // 2
    if cut % 2 == 1:
        data.append(1)
    if (num-1) % 2 == 1:
        data.append(B)
ans = xor(data)
print(ans)
n = input()
k = input()
x = input()
y = input()
print(k*(x-y)+n*y)

### FIXED CODE ###

n,k,x,y = (int(input())for i in [0]*4)
if k <= n:
    print(k*(x-y)+n*y)
else:
    print(n*x)
h, w= map(int, raw_input().split())
n = int(raw_input())
ais = map(int, raw_input().split())
ais.sort(key = lambda x:-x)
mat = [[-1 for _ in range(w)] for ii in range(h)]
import collections
color = 0
vis = set([])
def bfs(start, color, count,mat):
	q = collections.deque([start])
	vis = set([start])
	while(q and count):
		count -=1
		cur = q.popleft()
		mat[cur[0]][cur[1]] = color + 1
		i,j = cur
		for ni,nj in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
			if 0 <= ni < len(mat) and 0<= nj < len(mat[0]):
				if (ni,nj) not in vis:
					vis.add((ni,nj))
					q.append((ni,nj))

for i in range(len(mat)):
	for j in range(len(mat[0])):
		if mat[i][j] == -1:
			bfs((i,j), color, ais[color],mat)
			color +=1

for l in mat:
	print ' '.join(map(str,l))

### FIXED CODE ###


h, w= map(int, raw_input().split())
n = int(raw_input())
ais = map(int, raw_input().split())
mat = [[-1 for _ in range(w)] for ii in range(h)]
import collections
color = 0
vis = set([])
def bfs(start, color, count,mat):
	q = collections.deque([start])
	vis = set([start])
	while(q and count):
		count -=1
		cur = q.popleft()
		mat[cur[0]][cur[1]] = color + 1
		i,j = cur
		for ni,nj in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
			if 0 <= ni < len(mat) and 0<= nj < len(mat[0]):
				if (ni,nj) not in vis:
					vis.add((ni,nj))
					q.append((ni,nj))

for i in range(len(mat)):
	for j in range(len(mat[0]))[::(-1 if i % 2 else 1)]:
		mat[i][j] = color +1
		ais[color] -= 1
		if ais[color] == 0: color +=1
for l in mat:
	print ' '.join(map(str,l))
import math
A, B, H, M = = map(int, open(0).split())


arg_b = math.pi * float(M) / 30
arg_a = (math.pi / 6) * (float(H) + float(M)/60) 
K = abs(arg_b - arg_a)
print(math.sqrt(A**2+B**2 - 2*A*B*math.cos(K)))


### FIXED CODE ###

import math
A, B, H, M = map(int, input().split())


arg_b = math.pi * float(M) / 30
arg_a = (math.pi / 6) * (float(H) + float(M)/60) 
K = abs(arg_b - arg_a)
C = math.sqrt(A*A+B*B - 2*A*B*math.cos(K))
print(C)
n=input()
m=input()

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

### FIXED CODE ###

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

if m>=n:
    print('Yes\n')
else:
    print('No\n')
n=int(input())
c=[list(map(int,unput().split())) for _ in [0]*n].reverse()
t=0
for i in c:
  a=c[0]
  b=c[2]
  t+=b-1-(a+t-1)%b
print(t)

### FIXED CODE ###

c=list(reversed([list(map(int,input().split())) for _ in [0]*int(input())]))
t=0
for i in c:
  a=i[0]
  b=i[1]
  t+=b-1-(a+t-1)%b
print(t)
x,y=input().split()
if x>y:
    print('>')
elif x=y:
    print('=')
else:
    print('<')

### FIXED CODE ###

x,y=input().split()
if x>y:
    print('>')
elif x==y:
    print('=')
else:
    print('<')
n,a,b =map(int,input().split())
c = a+b

sum1 = c/n
l = c%n
if a>l:
  sum2 = l
else:
  sum2 = a
  
print(sum1+sum2)

### FIXED CODE ###

a,b,c=input()
if a==b and b==c:
  print("No")
else:
  print("Yes")
N,M = map(int, input().split())
p = [0]*M
S = [0]*M
X = [0]*N
Y = [0]*N
X = [int(s) for s in X]
Y = [int(s) for s in Y]
A = 0
B = 0
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s) for s in p]
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))      

### FIXED CODE ###

N,M = map(int, input().split())
p = [0]*M
S = [0]*M
for i in range(M):
    p[i],S[i] = input().split()
q = [int(s)-1 for s in p]
X = [0]*N
Y = [0]*N
A = 0
B = 0
for i in range(M):
    if S[i] == "AC":
        if Y[q[i]]==0:
            Y[q[i]]+=1
            A += 1
            B += X[q[i]]
    else:
        if Y[q[i]]==0:
            X[q[i]] += 1
print(str(A)+" "+str(B))
N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:5
        hotel+=1


print(hotel)

### FIXED CODE ###

N=int(input())
H=[int(i) for i in input().split()]
hotel=0
for i in range(N):
    count=0
    for k in range(i):
        if H[k]<=H[i]:
            count+=1
        continue
            
    if count==i:
        hotel+=1


print(hotel)
n = int(input())
A = [int(i) for i in input().split()]

A.sort()
m = 1 << 30
used = [False] * n
ans = 0

def search(ok, ng, n):
    if abs(ok-ng) <= 1:
            return ok
    mid = (ok+ng) // 2
    if A[mid] < n or (A[mid] == n and used[mid]):
        return search(mid, ng, n)
    else:
        return search(ok, mid, n)

for i in range(30):
    for j in range(n):
        if A[j] >= m:
            break
        if used[j]:
            cotinue
        a = search(-1, n, m - A[j]) + 1
        if a >= n:
            continue
        if A[a] == m - A[j]:
            if a == j:
                a += 1
                if a >= n or not A[a] == A[j]:
                    continue
            used[a] = True
            used[j] = True
            ans += 1
    m >>= 1

print(ans)



### FIXED CODE ###

from collections import Counter

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

A.sort(reverse=True)
C = Counter(A)
m = 1 << 30
ans = 0

for a in A:
    if C[a] <= 0:
        continue
    C[a] -= 1
    while m > a * 2:
        m >>= 1
    v = m - a
    if v in C and C[v] > 0:
        C[v] -= 1
        ans += 1

print(ans)
import numpy as np
n, m = map(int, input().split())
stairs = set([int(input()) for i in range(m)])
ans = np.ones(n+1)
mod = 10**9 + 7
if 1 in stairs:
    ans[1] -= 1
for i in range(2, n+1):
    if i in stairs:
        ans[i] = 0
    else:
        ans[i] = ans[i-1] + ans[i-2]

print(int(ans[-1]) % mod)


### FIXED CODE ###

import numpy as np
n, m = map(int, input().split())
stairs = set([int(input()) for i in range(m)])
ans = [1] * (n+1)
mod = 10**9 + 7
if 1 in stairs:
    ans[1] -= 1
for i in range(2, n+1):
    if i in stairs:
        ans[i] = 0
    else:
        ans[i] = ans[i-1] + ans[i-2]

print(ans[-1]%mod)
n=input()
while True:
       for j in range(n):
              j=input()
       
nm=0
nm1=0
cnt=j
for i in cnt:
      if i=='A' or i=='B':
              nm+=1
              nm1=max(nm1,nm)
      else:
              nm=0
print(nm1)

### FIXED CODE ###

N = int(input())
c1 = 0
c2 = 0
c3 = 0
count = 0
for i in range(N):
  s = input()
  count += s.count('AB')
  if s[0] == 'B' and s[-1] == 'A':
    c1 += 1
  elif s[0] == 'B' and s[-1] != 'A':
    c2 += 1
  elif s[0] != 'B' and s[-1] == 'A':
    c3 += 1
  else:
    pass

if c1 == 0:
  print(count + min(c2,c3))
else:
  if c2 > 0 or c3 > 0:
    print(count + c1 + min(c2,c3))
  else:
    print(count + c1-1)
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

ans = 0
for i in s:
  ans=max(ans, s.count(i)- t.count(i))
print(ans)

### FIXED CODE ###

a,b,c = map(int, input().split())

print('Yes' if a+b >= c else 'No')
N, S = open('0').read().split()
N = int(N)
cnt = 0
l = 0
for i in range(N):
  if S[i]=='(':
    cnt += 1
  else:
    if cnt==0:
      l += 1
    else:
      cnt -= 1
cnt = 0
r = 0
for i in range(N-1,-1,-1):
  if S[i]==')':
    cnt += 1
  else:
    if cnt==0:
      r += 1
    else:
      cnt -= 1
print('('*l+S+')'*r)

### FIXED CODE ###

N, S = open(0).read().split()
N = int(N)
cnt = 0
l = 0
for i in range(N):
  if S[i]=='(':
    cnt += 1
  else:
    if cnt==0:
      l += 1
    else:
      cnt -= 1
cnt = 0
r = 0
for i in range(N-1,-1,-1):
  if S[i]==')':
    cnt += 1
  else:
    if cnt==0:
      r += 1
    else:
      cnt -= 1
print('('*l+S+')'*r)
from operator import itemgetter

A, B, C, D, E, F = list(map(int,input().split()))
X = []

for a in range(31):
    for b in range(31):
        for c in range(101):
            for d in range(101):
                w = 100*A*a+100*B*b #砂糖水の質量
                s = C*c+D*d        #砂糖の質量
                if w == 0 or s == 0 or w + s >= F: #ダメな条件
                    break
                else:
                    if s/(w+s) <= E/(100 + E):
                        ans = 100 * s/(w+s)
                        X.append([ans,w + s, s])
X = sorted(X,key=itemgetter(0),reverse = True) 
print(X[0][1],X[0][2])

### FIXED CODE ###

from operator import itemgetter

A, B, C, D, E, F = list(map(int,input().split()))
X = []
ans = 1000
for i in range(31):
    for j in range(31):
        for k in range(51):
            for l in range(51):
                if 100*A*i+100*B*j+C*k+D*l != 0:
                    if 100*A*i+100*B*j+C*k+D*l <= F and (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l) <= E/(100 + E):
                        ans =(E/(100 + E) - (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l))
                        X.append([ans , 100*A*i+100*B*j+C*k+D*l, C*k+D*l])
X = sorted(X,key=itemgetter(0),reverse = False) 

print(X[0][1],X[0][2])
#def calc():
    #summ  = sum(A)
    #print(summ)
    
    #low = summ / (4*M)
    #print(low)

    #newlist = [i for i in A if i >= low]
    #print(newlist)

    #num = len(newlist)
    #print(num)

    #if M <= num:
        #print ("Yes")
    #else:
        #print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
#calc()

S = sum(A)
cnt = 0
for i in A:
    if i >= S / (4*M):
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

#def calc():
    #summ  = sum(A)
    #print(summ)
    
    #low = summ / (4*M)
    #print(low)

    #newlist = [i for i in A if i >= low]
    #print(newlist)

    #num = len(newlist)
    #print(num)

    #if M <= num:
        #print ("Yes")
    #else:
        #print ("No")

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

#N, M = 5, 2
#A = [110, 2, 20, 10, 0]
#calc()

S = sum(A)
cnt = 0

for i in A:
    if i >= S / (4*M):
        cnt += 1
if cnt >= M:
    print("Yes")
else:
    print("No")
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    d=defaultdict(int)
    t=[]
    f=[]
    for x in A:
        d[x]+=1
        if d[x]==2:
            t.append(x)
        elif d[x]==4:
            f.append(x)
    t.sort()
    f.sort()
    if not f:
        if len(t)<2:
            print(0)
        else:
            print(t[-1]*t[-2])
    else:
        t.extend([0,0])
        t.sort()
        if f[-1]>=t[-1]:
            print(f**2)
        if t[-1]>f[-1]>=t[-2]:
            print(t[-1]*f[-1])
        else:
            print(t[-1]*t[-2])

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    d=defaultdict(int)
    t=[0]
    f=[0]
    for x in A:
        d[x]+=1
        if d[x]==2:
            t.append(x)
        elif d[x]==4:
            f.append(x)
    t.sort()
    f.sort()
    if len(t)>=2:
        print(max(f[-1]**2,t[-1]*t[-2]))
    else:
        print(0)

if __name__ == '__main__':
    main()
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=550000000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
s = list(input())
if len(s)
if (s[0] == "A") and (s[2:-2].count("C")==1):
    print("aa")
    s[0] = "a"
    s[s[2:-2].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")

### FIXED CODE ###

s = list(input())
if (s[0] == "A") and (s[2:-1].count("C")==1):
    s[0] = "a"
    s[s[2:-1].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")
a,b = input().split()

n = int(a+b)

for i in range(1000):
  if i**2 = n:
    print("Yes")
    exit()

print("No")

### FIXED CODE ###


a,b = input().split()

n = int(a+b)

for i in range(1000):
  if i**2 == n:
    print("Yes")
    exit()

print("No")
for i in range(1,10):
	for j in range(1,10):
		print str(i) + "x" + str(j) + "=" + str(i*j)



### FIXED CODE ###

for i in range(1,10):
	for j in range(1,10):
		print str(i) + "x" + str(j) + "=" + str(i*j)
S = [int(e) for e in input().split()]
list_a =  [int(e) for e in input().split()]
list_b =  [int(e) for e in input().split()]

dis_list = []

for i in range(S[2]):
    dis_list.append([int(e) for e in input().split()])

cost_list = []
min_num = min(list_a)+min(list_b)

for i in list_a:
    for j in list_b:
        cost_list.append(i+j)


for l in dis_list:
    if cost_list[S[0]*(l[0]-1)+l[1]-1] - l[2] < min_num:
        min_num = cost_list[S[0]*(l[0]-1)+l[1]-1] - l[2]

print(min_num)


### FIXED CODE ###

S = list(input())

word_num = int(len(S)/2)

temp_num = 0

if len(S) % 2 == 0:
    for i in range(word_num):
        if S[2*i]+S[2*i+1] == 'hi':
            pass
        else:
            temp_num += 1
else:
    pass

if len(S) % 2 == 0 and temp_num == 0:
    print('Yes')
else:
    print('No')