peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())

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

count = 1
if 0 in a:
    print(0)
for i in a:
    count *= i
    if count > 10 ** 18:
        print(-1)
        break
if count <= 10 ** 18:
    print(count)
# Judge status: Accepted
N = int(input())
A  = list(map(int, input().split()))
B  = list(map(int, input().split()))

ans = 0

for i in range(N):
    ans += min(A[i], B[i])
    if B[i] > A[i]:
        carry = (B[i] - A[i])
        if A[i+1] > carry:
            ans += carry
            A[i+1] -= carry
        else:
            ans += A[i+1]
            A[i+1] = 0


print(ans)
# Judge status: Accepted
D,T,S=map(int,input().split())
if D>S*T:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
L,R,d=map(int,input().split())
count=0
for i in range(L,R+1):
	if i%d==0:
		count+=1
print(count)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

for i in range(tx - sx):
    print("R",end="")

for i in range(ty - sy):
    print("U",end="")

for i in range(tx - sx):
    print("L",end="")

for i in range(ty - sy):
    print("D",end="")

print("D",end="")
    
for i in range(tx - sx + 1):
    print("R",end="")

for i in range(ty - sy + 1):
    print("U",end="")

print("L",end="")
print("U",end="")

for i in range(tx - sx + 1):
    print("L",end="")

for i in range(ty - sy + 1):
    print("D",end="")

print("R",end="")
# Judge status: Accepted
a, b, c = map(int, input().split())

if 0 < c - a - b and 4 * a * b < (c - a - b) **2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
w = input()

w = sorted(w, key = lambda x: x)
ans = 1
before = w[0]
for i in range(1, len(w)):
    if w[i] == before:
        ans += 1
    else:
        if ans % 2 != 0:
            print("No")
            exit()
        before = w[i]
        ans += 1
print("Yes")
# Judge status: Wrong Answer
def mod_inv(a, m):
    return pow(a, m-2, m)


X, Y = map(int, input().split())
MOD = 10 ** 9 + 7

if (X + Y) % 3:
    print(0)
    exit()

n = (X + Y) // 3
nx, ny = X - n, Y - n

if nx < 0 or ny < 0:
    print(0)
    exit()

ans = 1
for i in range(nx + 1, nx + ny + 1):
    ans = ans * mod_inv(i, MOD) % MOD
for i in range(1, ny + 1):
    ans = ans * mod_inv(i, MOD) % MOD

print(ans)
# Judge status: Accepted
from fractions import gcd
a, b, c, d = map(int, input().split())
ans = b-a+1
lcm_cd = (c*d)//gcd(c, d)

under_a = (a-1)//c + (a-1)//d - (a-1)//lcm_cd
under_b = b//c + b//d - b//lcm_cd
print(ans-(under_b-under_a))
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
m = min(a,b,c,d,e)
if n%m!=0:
  t = n//m +5
else:
  t = n//m +4
print(t)
# Judge status: Wrong Answer
a, b = [int(w) for w in input().split()]
s = input()

cond = True

if not s[:a].isnumeric():
    cond = False

if not s[a] == "-":
    cond = False

if not s[a+2:].isnumeric():
    cond = False

print("Yes" if cond else "No")
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
job = sorted(AB)
reward_list = []
ans = 0
j = 0
for i in range(1, M + 1):
    while j < N and job[j][0] <= i:
        heapq.heappush(reward_list, -job[j][1])
        j += 1
    if len(reward_list) > 0:
        ans -= heapq.heappop(reward_list)
print(ans)
# Judge status: Accepted
S = input()
N = len(S)
def f(s):
    n = len(s)
    for i in range((n-1)//2+1):
        if s[i] != s[n-i-1]:
            return False
    return True

if f(S) and f(S[:(N-1)//2]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
(n, m), *r = [[*map(int, i.split())] for i in open(0)]
for i in range(1, n + 1):
    print(sum(r, []).count(i))
# Judge status: Accepted
a,b=map(int,input().split())
c=b-a
ans=0

for i in range(1,c+1):
  ans+=i
  
print(ans-b)
# Judge status: Accepted
def readinput():
    n,m,x,y=map(int,input().split())
    xx=list(map(int,input().split()))
    yy=list(map(int,input().split()))
    return n,m,x,y,xx,yy

def main(n,m,x,y,xx,yy):
    xx.append(x)
    yy.append(y)
    xx.sort()
    yy.sort()
    if xx[-1]<yy[0]:
        return 'No War'
    else:
        return 'War'

if __name__=='__main__':
    n,m,x,y,xx,yy=readinput()
    ans=main(n,m,x,y,xx,yy)
    print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
if x%y==0:
  exit(print(-1))
t=0
for i in range(1000001):
  t+=x
  if t%y!=0:
    print(t)
    exit(0)
# Judge status: Wrong Answer
n=int(input())
dp=[float("inf")]*(n+1)
dp[0]=0
for i in range(n):
    for j in range(1,7):
        j=6**j
        if i+j<n:
            dp[i+j]=min(dp[i+j],dp[i]+1)
    for j in range(1,6):
        j=9**j
        if i+j<n:
            dp[i+j]=min(dp[i+j],dp[i]+1)
    dp[i+1]=min(dp[i+1],dp[i]+1)
print(dp[-1])
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    x, y, z = map(int, readline().split())

    print(x * y // 2)

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())

one = min(q * 4, h * 2, s)
two = min(one * 2, d)

ans = (n // 2) * two + (n % 2) * one
print(ans)
# Judge status: Accepted
def resolve():
	from statistics import median
	import sys
	input = sys.stdin.readline
	n = int(input())
	ab = [list(map(int, input().split())) for i in range(n)]
	mina = median(i[0] for i in ab)
	maxb = median(i[1] for i in ab)
	abrange = maxb - mina
	if n%2 == 0:
		print(int(abrange*2 + 1))
	else:
		print(int(abrange + 1))
resolve()
# Judge status: Accepted
import math

def ABC137C(i):
    if i!=1:
        return math.factorial(i)//math.factorial(i-2)//2
    else:
        return 0

n,*a=open(0).read().split()
a=[''.join(sorted(i)) for i in a]
d=dict()
p=0
for i in a:
    if i not in d:
        d[i]=1
    else:
        d[i]+=1
for i in d.values():
    p+=ABC137C(i)
print(p)
# Judge status: Accepted
N, K = map(int, input().split())
Ds = set(input().split())

i = N
while 1:
  S = str(i)
  flag = 1
  for s in S:
    if s in Ds:
      flag = 0
      break
  if flag == 1:
    print(i)
    exit()
  i += 1
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
cnt = 0
while K * cnt <= 1000:
    if A <= K * cnt <= B:
        print('OK')
        exit()
    cnt += 1
print('NG')
# Judge status: Accepted
import math
a,b,h,m=map(int,input().split())
kak=abs(6*m-(h+m/60)*30)
#print(kak)
kakok=math.radians(kak)
#print(kakok)
ans=(a**2+b**2-2*a*b*math.cos(kakok))**0.5
print(ans)
# Judge status: Accepted
import numpy as np

x = int(input())
k = 0
A = 0
B = 0
for i in range(0, 1000):
    I = i**5
    j = I - x
    J = abs(j)
    k = 0
    while k <= J**(0.2):
        if k**5 == J:
            A = i
            B = k*(np.sign(j))
            break
        k += 1
print(str(A) + ' ' + str(B))
# Judge status: Wrong Answer
N,M = map(int,input().split())

if N <= 2*M:
    M -= 2*N
    print(N+M//4)
else:
    print(N)
# Judge status: Accepted
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

res = [[0]*N for _ in range(2)]
res[0][0] = A1[0]
res[1][N-1] = A2[N-1]

for i in range(1, N):
    res[0][i] = res[0][i-1]+A1[i]
    res[1][N-i-1] = res[1][N-i]+A2[N-i-1]

r = 0
for i in range(N):
    r = max(res[0][i]+res[1][i], r)

print(r)
# Judge status: Accepted
X, N = list(map(int, input().split()))
if N!=0:
    P = set(list(map(int, input().split())))
else:
    print(X)
    exit(0)

dist = 100
r = None
for i in range(105, -1, -1):
    if not i in P and abs(X-i) <= dist:
        dist = abs(X-i)
        r = i

print(r)
# Judge status: Accepted
S=[x for x in input()]
A='abcdefghijklmnopqrstuvwxyz'
for a in A:
  if a not in S:
    print(a)
    break
else:
  print('None')
# Judge status: Accepted
s = input()
n = len(s)
t = input()
m = len(t)
ans = []

for i in range(n-m+1):
    for j in range(m):
        if s[i+j] not in [t[j] , "?"]:
            break
        elif j == m-1:
            res = s[:i]+t+s[i+m:]
            ans.append(res.replace("?","a"))

if not ans:
    ans.append("UNRESTORABLE")

print(min(ans))
# Judge status: Accepted
a,b,c=map(int,input().split())
if a>c and c>b:
  print("Yes")
elif a<c and c<b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split()))

sal=sum(al)
res=10**9+1
temp=0
for i in range(0,n-1):
    temp += al[i]
    res = min(res,abs(sal/2-temp))
    if res <=0.5:
        break

print(int(res*2))
# Judge status: Wrong Answer
a=list(map(int,input().split()))
sorted(a)
print(a[0]+a[1]*a[2])
# Judge status: Accepted
N = int(input())
An = list(map(int,input().split()))

for i in An:
    if i%2==0:
        if i%3 !=0 and i%5!=0:
            print('DENIED')
            exit()
else:
    print('APPROVED')
# Judge status: Accepted
N,M=map(int,input().split())
box=[1]*N
P=[1]+[0]*(N-1)
for i in range(M):
  x,y=map(int,input().split())
  x,y=x-1,y-1
  box[x]-=1
  box[y]+=1
  if P[x]==1:
    P[y]=1
    if box[x]==0:
      P[x]=0
print(sum(P))
# Judge status: Wrong Answer
N, M = map(int ,input().split())

# N + x : M - 2x = 1 : 2
# M - 2x = 2N + 2x
# x = (M - 2N) / 4

if N * 2 >= M:
  print(N)
else:
  x = (M - 2 * N) / 4
  N += int(x)
  M -= 2 * int(x)
  print(N)
# Judge status: Accepted
n = int(input())
l = []
for i in range(1, n // 2 + 1):
  a = str(i)
  b = str(n - i)
  k = 0
  for j in range(len(a)):
    k += int(a[j])
  for j in range(len(b)):
    k += int(b[j])
  l.append(k)
print(min(l))
# Judge status: Accepted
n = int(input())
a = set()
i = 2
res = 0
while i * i <= n:
    if (n % i) == 0:
        count = 0
        while n % i == 0:
            count += 1
            n //= i
        dif = 1
        while count >= dif:
            res += 1
            count -= dif
            dif += 1
    i += 1
if n != 1:
    res += 1
print(res)
# Judge status: Accepted
n = int(input())

def dfs(a, used=0):
    if len(a)==n:
        print(''.join(a))
    else:
        for i in range(ord('a'), ord('a')+used+1):
            if i == ord('a')+used:
                dfs(a+[chr(i)], used+1)
            else:
                dfs(a+[chr(i)], used)

dfs([], 0)
# Judge status: Accepted
S = input()
l = [i for i in S] 
count = 0

while len(l) > 1:

    if l.pop(0) != l.pop(-1):
        count += 1

print(count)
# Judge status: Wrong Answer
n = float(input())
print(n*3.14159265)
# Judge status: Accepted
N, M = map(int, input().split())
from_1 = set()
to_N = set()
for i in range(M):
  a, b = map(int, input().split())
  if a == 1:
    from_1.add(b)
  if b == N:
    to_N.add(a)

if len(from_1 & to_N) >= 1:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
print('ABC'*(len(input())<4)or'ABD')
# Judge status: Accepted
n, k = [int(i) for i in input().split()]
s = [i + 1 for i in range(n)]
for i in range(k):
  d = int(input())
  ns = [int(j) for j in input().split()]
  for l in ns:
    s.remove(l) if l in s else None
print(len(s))
# Judge status: Accepted
n=float(input())    # float
print("%.6f" % pow(n/3, 3))
# Judge status: Wrong Answer
N,M=map(int,input().split())
def steps(N,M):
	if M==0:
		return print(0)
	else:
		a=[]
		for i in range(M):
			a.append(int(input()))
		for i in range(M-1):
			if a[i+1]-a[i]==1:
				return print(0)
		b=[1,1]
		for j in range(N):
			b.append(b[-1]+b[-2])
		ans=1
		a.append(N+1)
		a.insert(0,-1)
		for i in range(M+1):
			c=a[i+1]-a[i]-2
			ans*=(b[c])
		return print(ans%1000000007)
steps(N,M)
# Judge status: Wrong Answer
import sys

N, K, S = map(int, input().split())
if N == K:
    ans = ''
    for i in range(N): ans += str(S) + ' '
    print(ans.rstrip())
    sys.exit()

ans = ''
s1, s2 = 0, 0
if S % 2 == 0:
    s1 = s2 = S // 2
else:
    s1 = S // 2
    s2 = s1 + 1
for i in range(N):
    if i % 2 == 0 and i <= K:
        ans += str(s1) + ' '
    elif i <= K:
        ans += str(s2) + ' '
    else:
        ans += str(S + 1) + ' '
print(ans.strip())
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(0, N):
    if p[i] != i + 1:
        count += 1

print("NO") if count > 2 else print("YES")
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))

a = [b[0]]

for i in b:
    if a[-1] > i: a[-1] = i
    a.append(i)
print(sum(a))
# Judge status: Wrong Answer
import sys
INF = 10 ** 10
MOD = 10 ** 9 + 7
from functools import lru_cache
sys.setrecursionlimit(100000000)

def main():
    n = int(input())
    ans = 0
    before = 0
    for _ in range(n):
        a = int(input())
        ans += a//2
        if (a%2) and before :
            ans += 1
            before = 0
        else:
            before = a%2

    print(ans)
if __name__ =='__main__':
    main()
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
if b-a<=2*k:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)
# Judge status: Accepted
# -*- coding: utf-8 -*-
n,a,b = map(int,input().split()) 
s = list(input())

count = 0
tmp = 0
for i in range(n):
    if s[i] == 'a' and count < a + b:
        count += 1
        print("Yes")
    elif s[i] == 'b' and count < a + b and tmp < b:
        count += 1
        tmp += 1
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
for i in range(1,1010):
    if int(i*0.08) == a and int(i*0.1) ==b:
        print(i)
        break
else:
    print(-1)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
ac=a*c
ad=a*d
bc=b*c
bd=b*d
if max(ac,ad,bc,bd)<0:
    if a<0<b or c<0<d:
        print(0)
else:
    print(max(ac,ad,bc,bd))
# Judge status: Accepted

n = int(input())

ans = 0

for i in range(1,n+1):
    k = n//i
    ans += k*(k+1)*i//2
    
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())
if x == - y:
  print(1)
elif x * y < 0:
  print(abs(abs(x) - abs(y)) + 1)
elif x < y:
  print(y - x)
elif x * y:
  print(abs(abs(x) - abs(y)) + 2)
else:
  print(abs(abs(x) - abs(y)) + 1)
# Judge status: Accepted
import math
a,b,h,m=map(int,input().split())
ji=(h*60+m)/360

hun=m/30
use=math.pi*(ji-hun)
ans=(a**2+b**2-2*a*b*math.cos(use))**0.5
print(ans)
# Judge status: Accepted
n = int(input())
li = [0]*10050

for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            s = i*i+j*j+k*k+i*j+j*k+i*k
            
            if s<10050:
                li[s]+=1
                
for i in range(1,n+1):
    print(li[i])
# Judge status: Accepted
A = list(map(int, input().split()))
A.sort()

print('Yes'if A[0] + A[1] == A[2] else 'No')
# Judge status: Wrong Answer
N=int(input())
w=list(map(int, input().split()))
if sum(w)%2==0:
    d=sum(w)//2
else:
    d=(sum(w)-1)//2
k=0
S=0
S2=0
for i in w:
    S+=i
    if S>=d:
        break
    k+=1

for j in range(k+1):
    S2+=w[j]

print(abs(sum(w)-2*S2))
# Judge status: Accepted
N = int(input())
T = [int(input()) for _ in range(N)]

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list(T))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    s = ["".join(sorted(input())) for i in range(N)]
    # print(s)
    S = set(s)
    # print(S)
    print(len(s)-len(S))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
b1=b[0]
res="No"
for i in range(n-m+1):
    if b1 in a[i]:
        x=a[i].index(b1)
        match=1
        for j in range(1,m):
            if a[i+j][x:]!=b[j]:
                match=0
        if match:
            res="Yes"
print(res)
# Judge status: Accepted
a=[list(map(int,input().split()))for _ in range(3)]
for i in range(int(input())):
  b=int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k]==b:a[j][k]=0
ans="No"
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes"
  if a[0][i]==a[1][i]==a[2][i]==0:ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:ans="Yes"
if a[2][0]==a[1][1]==a[0][2]==0:ans="Yes"
print(ans)
# Judge status: Wrong Answer
K = input()
K = int(K)

def seven():
    seven_i = 0
    count = 0
    for i in range(K):
        seven_i += (10**i*7)
        seven_i %= K
        count += 1
        print(seven_i)
        if seven_i % K == 0:
            return count
    return -1

print(seven())
# Judge status: Wrong Answer
n=int(input())
heights=list(map(int,input().split(" ")))
for i in range(n):
    heights[i]-=i
res=len(heights)-len(set(heights))
if res==0:
    print(0)
else:
    print(res+1)
# Judge status: Accepted
n = input()
t = ["dream", "dreamer", "erase", "eraser"]

while True:
  if not n:
    status = "YES"
    break

  elif n[-5:] in t:
    n = n[:-5]
    
  elif n[-6:] in t:
    n = n[:-6]
  
  elif n[-7:] in t:
    n = n[:-7]
    
  else:
    status = "NO"
    break
    
print(status)
# Judge status: Accepted
import math
n = int(input())
if (n-1)%2 == 0:
    a = int((n-1)/2)
    ans = n*a
else:
    ans = n * math.floor((n-1)/2) + math.ceil((n-1)/2)

print(int(ans))
# Judge status: Accepted
def main():
    n = int(input())
    ss = [list(input()) for _ in range(n)]

    ss_set = sorted(list(set(ss[0])))
    ans = ''

    for ch in ss_set:
        cnt = min(ss[i].count(ch) for i in range(n))
        ans += ch * cnt
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, k = map(int, input().split())
c = 0
for i in range(a, -1, -1):
  if a % i == 0 and b % i == 0:
    c += 1
    if c == k:
      print(i)
      break
# Judge status: Accepted
import sys
input = sys.stdin.readline

c1 = input().rstrip()
c2 = input().rstrip()[-1::-1]

print('YES' if c1 == c2 else 'NO')
# Judge status: Accepted
N = list(input())
if N[1:].count('9') == len(N[1:]):
    print(int(N[0]) + 9 * (len(N) - 1))
else:
    print(int(N[0]) + 9 * (len(N) - 1) - 1)
# Judge status: Wrong Answer
a,b = map(int,input().split())
x = (a+b)//2
print(x)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = [0]*(N+1)

for i in range(N,0,-1):
    c = 0
    for j in range(i,N+1,i):
        c += ans[j]
    if (A[i-1] == 0 and c % 2 == 1) or (A[i-1] == 1 and c % 2 == 0):
        ans[i] = 1

print(sum(ans))
for i in range(1,N+1):
    if ans[i] == 1:
        print(i,end=" ")
# Judge status: Accepted
import itertools

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

e = []

for i in range(q):
  e.append(list(map(int, input().split())))

a = itertools.combinations_with_replacement(list(range(1, m+1)),n)

max_total = 0

for i in a:
  total = 0
  
  for j in e:
    if i[j[1]-1] - i[j[0]-1] == j[2]:
      total += j[3]
  
  if max_total < total:
    max_total = total
      
print(max_total)
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

s = max(h,w)
if n%s==0:
    print(int(n/s))
else:
    print((n//s)+1)
# Judge status: Accepted

def solve():
    n=int(input())
    a=list(map(int,input().split()))
    cnt=[0]*(int(1e5)+9)
    s=0
    for i in range(0,n) :
        s+=a[i]
        cnt[a[i]]+=1
    q=int(input())
    for q in range(0,q) :
        b,c=map(int,input().split())
        ct=cnt[b]
        s+=ct*(c-b)
        cnt[b]=0
        cnt[c]+=ct
        print(s)

solve()
# Judge status: Accepted
import sys

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

S = []
C = []
for m in range(M):
  s, c = map(int, input().split())
  S.append(s)
  C.append(c)

for i in range(10**N):
  tes = str(i)

  if len(tes) != N:
    continue
  
  flag = True
  for s, c in zip(S, C):
    if tes[s-1] != str(c):
      flag = False
  if flag:
    print(tes)
    sys.exit()


print(-1)
# Judge status: Accepted
import math
n, k = map(int,input().split())
total = 0
mod = 10**9+7
max_value = (n*(n+1)) //2
for a in range(k,n+1):
    high = (max_value-(n-a)*(n-a+1)//2)
    low = (a*(a-1)) //2
    total += high - low + 1
total += 1 # k = n+1
print(total%mod)
# Judge status: Wrong Answer
X = int(input())
ans = "Yes" if X == 7 or X == 5 or X == 3 else "No"
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n - k):
    if a[i] >= a[i + k]:
        print("No")
    else:
        print("Yes")
# Judge status: Accepted
n=int(input())

a=0

for i in range(1,n+1,2):
  c=0
  for j in range(1,i+1):
    if i%j==0:
      c+=1
  if c==8:
    a+=1

print(a)
# Judge status: Accepted
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from numpy.random import randint
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    # D = 365
    D = int(readline())
    C = list(map(int, readline().split()))
    S = list(list(map(int, readline().split())) for _ in range(D))

    for _ in range(D):
        print(randint(1,26))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
L,R,d = map(int,input().split())

print(R//d - L//d + 1)
# Judge status: Wrong Answer
s = input()

for i in range(len(s)-1):
  if s[i]==s[i+1]:
    print("no")
    exit()
print("yes")
# Judge status: Accepted
n,k,*a=map(int,open(0).read().split())
r=range(n)
while(min(a)<n)*k:
 k-=1;b=[0]*n*3
 for i in r:b[max(0,i-a[i])]+=1;b[i-~a[i]]-=1
 for i in r:b[i+1]+=b[i]
 a=b[:n]
print(*a)
# Judge status: Wrong Answer
n=int(input())
c=[]
s=[]
f=[]
for i in range(n-1):
    a,b,d=map(int,input().split())
    c.append(a)
    s.append(b)
    f.append(d)

for i in range(n-1):
    count=0
    for j in range(i,n-1):
        if count<s[j]:
            count=s[j]
        else:
            count+=count%f[j]
        count+=c[j]
    print(count)

print(0)
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

for i in range(N):
  H[i] = abs(T - H[i]*0.006 - A)
  

print(H.index(min(H))+1)
# Judge status: Wrong Answer
S = str(input())

if S[0] != S[1] and S[0] != S[2] and S[1] != S[2]:
    result = "Yse"
else:
    result = "No"

print(result)
# Judge status: Wrong Answer
N= int(input())
P= list(map(int,input().split()))

ans = 0
flag = False
for i in range(N-1):
    a= P[i]
    b= P[i+1]
    if a == i+1 and flag==True:
        P[i] = b
        P[i+1] = a
        ans += 1
        flag = True
    elif flag== False:
        flag= True
print(ans)
# Judge status: Accepted
import numpy as np
import math

def cmb(n, r, mod):
    n_1 = 1
    n_2 = 1

    r = min(r, n-r)
    for i in range(1, r+1):
        n_1 = n_1 * i % mod
        n_2 = n_2 * (n - i + 1) % mod

    return (n_2 * pow(n_1, mod - 2, mod))%mod

mod = 10**9+7

X, Y = map(int, input().split())

x = (2*Y - X) / 3
y = (2*X - Y) / 3


if x.is_integer() == False or y.is_integer() == False or x < 0 or y < 0:
    print(0)
else:
    print(cmb(int(x+y), int(x), mod))
# Judge status: Accepted
s = input()
s = ''.join(sorted(s))
if s == 'abc':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
x=N*800
y=N//15*200
print(x-y)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
num = A[0] == 0
if num:
    # print(len(C))
    if C[0] == 1:
        for i in range(len(A)):
            if not C.get(i+1):
                if i < len(C)-1:num = 0
                break
            num = (num*pow(C[i],C[i+1],998244353))%998244353
            # print(num)

print(num%998244353)
# Judge status: Accepted
X = int(input())

if X % 2 != 0 or X < 10:
    print(0)
else:
    X //= 2
    ans = 0
    while X > 0:
        X //= 5
        ans += X
    print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split( )))
c = 0
m = p[0]
for i in range(n):
    if m >= p[i]:
        c += 1
        m = p[i]
print(c)
# Judge status: Accepted
n=input()
if n[0]==n[1]==n[2]:
  print("Yes")
elif n[1]==n[2]==n[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def resolve():
    N, M = map(int,input().split())
    S = tuple(map(int, input().split()))
    g = sum(S) * (1/(4*M))

    count = 0
    ans = 'No'
    for s in S:
        if s >= g:
            count += 1

        if count == M:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()