Harryxun/stf_run huggingface dataset:
N, M = input().split(' ')
lis1 = map(int, input().split(' '))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[M - 1] < thresh:
  print 'No'
else:
  print 'Yes'

### FIXED CODE ###

N, M = map(int, input().split(' '))
lis1 = list(map(int, input().split(' ')))
S = sum(lis1)
thresh = S / (4 * M)
lis2 = sorted(lis1)
if lis2[-M] < thresh:
  print('No')
else:
  print('Yes')
from itertools import groupby
H, W = map(int, input().split())
if W%2==1:
    assert False
S = ["" for _ in range(W)]
T = []
for _ in range(H):
    s = input()
    T.append(s)
    for i, c in enumerate(s):
        S[i] += c
T = [sorted(t) for t in T]
S = [sorted(s) for s in S]
T.sort()
S.sort()
cnt = 0
for _, g in groupby(T):
    if len(list(g))%2:
        cnt += 1
if H%2 < cnt:
    print("NO")
    exit()
cnt = 0
for _, g in groupby(S):
    if len(list(g))%2:
        cnt += 1
if W%2 < cnt:
    print("NO")
    exit()
print("YES")


### FIXED CODE ###

# この解法は嘘を含む

from itertools import groupby
H, W = map(int, input().split())
S_ = ["" for _ in range(W)]
T_ = []
for _ in range(H):
    s = input()
    T_.append(s)
    for i, c in enumerate(s):
        S_[i] += c
T = [sorted(t) for t in T_]
S = [sorted(s) for s in S_]
cnt = 0
for _, g in groupby(sorted(T)):
    if len(list(g))%2:
        cnt += 1
if H%2 < cnt:
    print("NO")
    exit()
cnt = 0
for _, g in groupby(sorted(S)):
    if len(list(g))%2:
        cnt += 1
if W%2 < cnt:
    print("NO")
    exit()
if W%2 or H%2:
    print("YES")
    exit()
T1 = []
T2 = []
for i, (_, t) in enumerate(sorted(zip(T, T_))):
    if i%2:
        T1.append(t)
    else:
        T2.append(t)
T_p = T1 + T2[::-1]
S_pp = ["" for _ in range(W)]
for t in T_p:
    for i, c in enumerate(t):
        S_pp[i] += c
S1 = []
S2 = []
for i, (_, s) in enumerate(sorted(zip(S, S_pp))):
    if i%2:
        S1.append(s)
    else:
        S2.append(s)
S_p = S1 + S2[::-1]
for s1, s2 in zip(S_p, S_p[::-1]):
    for c1, c2 in zip(s1, s2[::-1]):
        if c1!=c2:
            print("NO")
            exit()
print("YES")
def main():
    _ = int(input())
    D = [int(i) for i in input().split()]
    ans = 0
    cnt = [0]*24
    from collections import Counter
    c = Counter(D)
    cnt[0] = 1
    s = [0]*13
    for k, v in c.items():
        if v >= 3:
            ans = 0
            return print(ans)
        elif v >= 2:
            cnt[k] += 1
            cnt[24 - k] += 1
        elif k == 0 or k == 12:
            cnt[k] += 1
        else:
            s[k] += 1
    if any(c >= 2 for c in cnt):
        return print(0)
    for bit in range(1 << 11):
        cur = cnt[:]
        for i in range(11):
            if s[i+1]:
                if bit & (1 << i):
                    cur[24 - (i+1)] += 1
                else:
                    cur[i+1] += 1
        pre = 0
        mi = 24
        for i, ne in enumerate(cur[1:] + [1], start=1):
            if ne:
                if i - pre < mi:
                    mi = i - pre
                pre = i
        ans = max(ans, mi)
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    D = [int(i) for i in input().split()]
    ans = 0
    cnt = [0]*24
    from collections import Counter
    c = Counter(D)
    cnt[0] = 1
    s = [0]*13
    for k, v in c.items():
        if v >= 3 or k == 0:
            ans = 0
            return print(ans)
        elif v >= 2:
            cnt[k] += 1
            cnt[24 - k] += 1
        elif k == 12:
            cnt[12] += v
        else:
            s[k] += 1
    if any(c >= 2 for c in cnt):
        return print(0)
    for bit in range(1 << 11):
        cur = cnt[:]
        for i in range(11):
            if s[i+1]:
                if bit & (1 << i):
                    cur[24 - (i+1)] += 1
                else:
                    cur[i+1] += 1
        if any(c >= 2 for c in cnt):
            continue
        pre = 0
        mi = 24
        for i, ne in enumerate(cur[1:] + [1], start=1):
            if ne:
                if i - pre < mi:
                    mi = i - pre
                pre = i
        if mi != 24:
            ans = max(ans, mi)
    print(ans)


if __name__ == '__main__':
    main()
import numpy as np
a, b, c = map(np.sqrt, map(lambda x:100*x, map(int, input().split())))
print('Yes' if a + b - c < 0 and  else 'No')

### FIXED CODE ###

a, b, c = map(int, input().split())
print('Yes' if (c-a-b)>0 and 4*a*b < (c - a- b)**2 else 'No')
int a = int(input())
int b = int(input())

int result_a = a % 2;
int result_b = b % 2;

if(result_a == 0 || result_b == 0){
    print("Even")
}else{
    print("Odd")
}
          
          

### FIXED CODE ###

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

a = int(i[0])
b = int(i[1])

result_a = a % 2
result_b = b % 2

if (result_a == 0 or result_b == 0 ):
    print("Even")
else :
    print("Odd")
s,t=input().split()
a,b=map(int,input().split())
u=input()
print(a-1 b if s==u else a b-1)

### FIXED CODE ###

s,t=input().split()
a,b=map(int,input().split())
u=input()
print(a-1, b) if u==s else print(a, b-1)
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
B=[list(map(int,input().split())) for i in range(Q)]

dp=[0 for i in range(1,10**5+1)]
for i in A:
    dp[i]+=1
S=sum(A)
for i in B:
    S+=(i[1]-i[0])*dp[i[0]]
    print(S)
    dp[i[1]]+=dp[i[0]]
    dp[i[0]]=0

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
B=[list(map(int,input().split())) for i in range(Q)]

dp=[0 for i in range(1,10**6)]
for i in A:
    dp[i]+=1
S=sum(A)
for i in B:
    S+=(i[1]-i[0])*dp[i[0]]
    print(S)
    dp[i[1]]+=dp[i[0]]
    dp[i[0]]=0
H, N = map(int, input().split())

dp = [np.inf for _ in range(H+1)]

# min_cost = np.inf
dp[0]=0
for n in range(N):
    a,b =  map(int, input().split())
    for h in range(H):
    
        nj = min(h+a,H)
        dp[nj] = min([dp[nj],dp[h]+b])
            # if h+a<H:
            #     dp[h+a] = np.min([dp[h+a], dp[h]+b])
            # elif dp[h]+b<min_cost:
            #     min_cost = dp[h]+b
        
print(int(dp[H]))

### FIXED CODE ###

H, N = map(int, input().split())
inf =1000100001001000
dp = [inf for _ in range(H+1)]
 
# min_cost = np.inf
dp[0]=0
for n in range(N):
    a,b =  map(int, input().split())
    for h in range(H):
        nj = min(h+a,H)
        dp[nj] = min([dp[nj],dp[h]+b])
        
print(int(dp[H]))
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    print(comb(K-1,i)*comb(N-K+1,i+1)%div)

### FIXED CODE ###

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K=map(int,input().split())
div=10**9+7

for i in range(K):
    if N-K<i:
        print(0)
    else:
        print(comb(K-1,i)*comb(N-K+1,i+1)%div)
a,b = [int(k) for k in input.split()]
if b%a:
  print(abs(b-a))
else:
  print(a+b)
    

### FIXED CODE ###

a,b = [int(k) for k in input().split()]
if b%a:
  print(abs(b-a))
else:
  print(a+b)
N=int(input())
 
li=list(map(int,input().split()))
 
ans=sorted(range(N), key=lambda k: li[k])
 
for n in range(N):
  ans[n]+=1
      
print(*ans)

### FIXED CODE ###

N=int(input())

if N%2==0:
  print(1/2)

else:
  print((N+1)/(2*N))
import numpy as np

h, w = map(int, input().split())
grid = (np.array([list(input())
                  for _ in range(h)]) == "#")
cost = np.full((h, w), 1000, dtype=np.int64)
cost[grid[:, :]] = 0

for j in range(2):
    for i in range(h - 1):
        cost[i] = np.minimum(cost[i], cost[i + 1] + 1)
    for i in range(1, h)[::-1]:
        cost[i] = np.minimum(cost[i], cost[i - 1] + 1)
    for i in range(w - 1):
        cost[i] = np.minimum(cost[:, i], cost[:, i + 1] + 1)
    for n in range(1, w)[::-1]:
        cost[i] = np.minimum(cost[:, i], cost[:, i - 1] + 1)

print(np.max(cost))

### FIXED CODE ###

import numpy as np

h, w = map(int, input().split())
grid = (np.array([list(input())
                  for _ in range(h)]) == "#")
cost = np.full((h, w), 10 ** 9, dtype=np.int64)
cost[grid[:, :]] = 0

for i in range(1, h):
    cost[i] = np.minimum(cost[i], cost[i - 1] + 1)

for i in range(h - 1)[::-1]:
    cost[i] = np.minimum(cost[i], cost[i + 1] + 1)

for i in range(1, w):
    cost[:, i] = np.minimum(cost[:, i], cost[:, i - 1] + 1)

for i in range(w - 1)[::-1]:
    cost[:, i] = np.minimum(cost[:, i], cost[:, i + 1] + 1)

print(np.max(cost))
a = int(input())

b = int(input())

print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
import sys
sys.setrecursionlimit(10**7)

def cur(p):
    for x in neighbor[p]:
        if x==par[p]: continue
        else:
            par[x]=p
            descend[p]+=cur(x)
    neighbor[p].remove(par[p])
    return descend[p]

n=int(input())
neighbor=[[]  for _ in range(n+1)]
descend=[1]*(n+1)
par=[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].append(b)
    neighbor[b].append(a)
neighbor[1].append(0)
cur(1)


x=[descend[n]-1]
t=n
while t!=1:
    t,pret=par[t],t
    x.append(descend[t]-descend[pret]-1)

l=len(x)
p,q=sum(x[:l//2]),sum(x[l//2:])
if l%2==0: print("Fennec" if p<q else "Snuke")
else: print("Fennec" if p<=q else "Snuke")

### FIXED CODE ###

a,b=map(int,input().split())
print("Possible" if a*b*(a+b)%3==0 else "Impossible")
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
result = []
for i in range(n-1):
    count = 1
    if all(d[x] == d[i] for x in range(i,n)):
        count = 1
    else:
        if d[i] == d[i+1]:
            count += 1
        for j in range(n-i-1):
            if d[j+i] > d[j+i+1]:
                count += 1
    result.append(count)
print(max(result))


### FIXED CODE ###

n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
count = 1
for i in range(n-1):
    if d[i]> d[i+1]:
        count += 1
print(count)
#7
A = [list(map(int,input().split())) for i in range(3)]

N = int(input())

B = [int(input()) for i in range(N)]

C = [[0,0,0],[0,0,0],[0,0,0]]
Ans = "No"

for i in range(3):
    for j in range(3):
        if A[i][j] in B:         #AijはリストBに含まれるかどうか
            C[i][j] = 1

for i in range(3):
    if C[i][1]+C[i][2]+C[i][3] == 3:
        Ans ="Yes"

for i in range(3):
    if C[1][i]+C[2][i]+C[3][i] == 3:
        Ans ="Yes"
        
if C[1][1]+C[2][2]+C[3][2] == 3 or C[1][3]+C[2][2]+C[3][1] == 3:
    Ans = "Yes"
    
print(Ans)
            
        

### FIXED CODE ###

#7
A = [list(map(int,input().split())) for i in range(3)]

N = int(input())

B = [int(input()) for i in range(N)]

C = [[0,0,0],[0,0,0],[0,0,0]]
Ans = "No"

for i in range(3):
    for j in range(3):
        if A[i][j] in B:         #AijはリストBに含まれるかどうか
            C[i][j] = 1

for i in range(3):
    if C[i][0]+C[i][1]+C[i][2] == 3:
        Ans ="Yes"

for i in range(3):
    if C[0][i]+C[1][i]+C[2][i] == 3:
        Ans ="Yes"
        
if C[0][0]+C[1][1]+C[2][2] == 3 or C[0][2]+C[1][1]+C[2][0] == 3:
    Ans = "Yes"
    
print(Ans)
while 1:
    x, y = map(int, raw_input().split())
    if x == 0 and y == 0:
        break
    print min(x, y), max(x, y))

### FIXED CODE ###

while 1:
    x, y = map(int, raw_input().split())
    if x == 0 and y == 0:
        break
    print min(x, y), 
    print max(x, y)
A,B = map(int,input().split())

len_ = A-*B

if len_<=0:
    print(0)
else:
    print(len_)

### FIXED CODE ###

A,B = map(int,input().split())

len_ = A-2*B

if len_<=0:
    print(0)
else:
    print(len_)
import math
a, b, q = map(int, input().split())
s = [-float("inf")] + [int(input()) for _ in range(a)] + [float("inf")]
t = [-float("inf")] + [int(input()) for _ in range(b)] + [float("inf")]

s.sort()
t.sort()

def near(x, buildings):
    left, right = 0, len(buildings) - 1

    while right - left > 1:
        center = (left + right) // 2
        value = buildings[center]
        if x < value:
            right = center
        elif x > value:
            left = center
        else:
            return center
    return left if abs(x - buildings[left]) < abs(x - buildings[right]) else right


for _ in range(q):
    near(x, s)
    near(x, t)
#     x = int(input())
# 
#     si = near(x, s)
#     spos = [si, si + 1] if s[si] < x else [si, si - 1]
#     ti = near(x, t)
#     tpos = [ti, ti + 1] if t[ti] < x else [ti, ti - 1]
# 
#     result = float("inf")
#     for sindex in spos:
#         for tindex in tpos:
#             v1 = abs(x - s[sindex]) + abs(s[sindex] - t[tindex])
#             v2 = abs(x - t[tindex]) + abs(t[tindex] - s[sindex])
#             result = min(
#                 float("inf") if math.isnan(v1) else v1,
#                 float("inf") if math.isnan(v2) else v2,
#                 result
#             )
# 
#     print(result)


### FIXED CODE ###

import bisect
import math
a, b, q = map(int, input().split())
inf = float("inf")
s = [-inf] + [int(input()) for _ in range(a)] + [inf]
t = [-inf] + [int(input()) for _ in range(b)] + [inf]

results = ""
for _ in range(q):
    x = int(input())
    si = bisect.bisect_right(s, x)
    spos = [s[si], s[si - 1]]

    ti = bisect.bisect_right(t, x)
    tpos = [t[ti], t[ti - 1]]

    result = float("inf")
    for svalue in spos:
        for tvalue in tpos:
            if svalue == tvalue == inf or svalue == tvalue == -inf:
                continue
            result = min(
                abs(x - svalue) + abs(svalue - tvalue),
                abs(x - tvalue) + abs(tvalue - svalue),
                result
            )

    results += str(result) + "\n"
print(results)
def main():
    H,W,K = map(int, input().split())
    S = [[int(i) for i in list(input())] for _ in range(H)]

    ans = float("inf")
    for state in range(2 ** (H - 1)):
        # 横棒のカウント
        yoko = 0
        for i in range(H - 1):
            if (state >> i) & 1:
                yoko += 1

        res = yoko

        # ホワイトチョコレートの個数
        cntHW = [0] * (yoko + 1)
        for j in range(W):
            # 今のグループ
            now = 0
            # 列を探索
            cntH = [0] * (yoko + 1)
            for i in range(H):
                if S[i][j] == 1:
                    cntH[now] += 1

                if (state >> i) & 1: # 区切り
                    now += 1
            # 個数の最大値
            MAX = max(cH + cHW for cH,cHW in zip(cntH,cntHW))
            if MAX > K:
                res += 1
                cntHW = cntH.copy()
            elif MAX == K:
                if j == W - 1: continue
                res += 1
                cntHW = [0] * (yoko + 1)
            else:
                for i in range(yoko + 1):
                    cntHW[i] += cntH[i]

        ans = min(ans, res)

    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

H,W,K = map(int, input().split())
S = [[int(i) for i in list(input())] for _ in range(H)]

ans = float("inf")
for state in range(2 ** (H - 1)):
    flag = True

    # 横棒のカウント
    yoko = 0
    for i in range(H - 1):
        if (state >> i) & 1:
            yoko += 1

    res = yoko

    # ホワイトチョコレートの個数
    cntHW = [0] * (yoko + 1)
    for j in range(W):
        # 今のグループ
        now = 0
        # 列を探索
        cntH = [0] * (yoko + 1)
        for i in range(H):
            if S[i][j] == 1:
                cntH[now] += 1

            if (state >> i) & 1: # 区切り
                now += 1
        
        for cH in cntH:
            if cH > K:
                flag = False

        # 個数の最大値
        MAX = max(cH + cHW for cH,cHW in zip(cntH,cntHW))
        if MAX > K:
            res += 1
            cntHW = cntH[::]
        else:
            for i in range(yoko + 1):
                cntHW[i] += cntH[i]

    if flag:
        ans = min(ans, res)

print(ans)
def main():
    n = int(input())
    matrix = [list(map(int, list(input()))) for i in range(2)]

    candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in range(n)]
    print(max(candies))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    matrix = []
    matrix.append([int(num) for num in input().split()])
    matrix.append([int(num) for num in input().split()])

    candies = [sum(matrix[0][:d+1]) + sum(matrix[1][d:]) for d in range(n)]
    print(max(candies))


if __name__ == '__main__':
    main()
N=map(int, input())
list=list(map(str, input().split()))
answer={}
for i in range(1, N+1):
  m=0
  for j in range(0, len(list)):
  	if list[j] is str(i):
      m=m+1
    else:
      m=m+0
answer.append(m)
a_s='\n'.join(answer)
print(a_s)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for a in A:
  ans[a-1]+=1
for n in ans:
  print(n)
import sys
import os
import bisect
from operator import itemgetter

N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
B = [ 0  for _ in range(M)]
for i in range(M):
    b,c = map(int,input().split())
    B[i] = [b,c]
B = sorted(B,key=itemgetter(1),reverse=True)
ans = 0
for i in range(M):
    id = bisect.bisect_left(A,B[i][1])
    if id > 0:
        for j in range(min(B[i][0],id+1)):
            if A[0] < B[i][1]:
                ans += B[i][1]
                del A[0]
    else:
        break
print(sum(A)+ans)


### FIXED CODE ###

import sys
import os
import bisect
from operator import itemgetter

N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
B = [ 0  for _ in range(M)]
for i in range(M):
    b,c = map(int,input().split())
    B[i] = [b,c]
B = sorted(B,key=itemgetter(1),reverse=True)
ans = 0
for i in range(M):
    id = bisect.bisect_left(A,B[i][1])
    if id > 0:
        for j in range(min(B[i][0],id+1)):
            if len(A) > 0 and A[0] < B[i][1]:
                ans += B[i][1]
                del A[0]
    else:
        break
print(sum(A)+ans)
a, b = map(int, input().split())
dp = []
dp[0] = 1
dp[1] = 2
for i in range(1000):
  dp[i] = dp[0] + dp[1+i]
  print(dp[i])

### FIXED CODE ###

a, b = map(int, input().split())
print(round((b-a)*(b-a+1)/2-b))
K = int(input())
k = K
A,B = map(int, input().split())
for i in range(1, B+1):
    k *= i
    if k > a and k < b:
        print('OK')
        a = True
        break
if not a:
    print('NG')


### FIXED CODE ###

K = int(input())
k = K
A,B = map(int, input().split())
for i in range(1, B+1):
    k *= i
    if k >= A and k <= B:
        print('OK')
        a = True
        break
    else:
        k = K
        a = False
        continue
if a != True:
    print('NG')
import heapq

N, M = map(int, input().split())
A = [-i for i in map(int, input().split())]
heapq.heapify(A)
for i in range(M):
  tmp = -((-heapq.heappop(A))//2)
  heapq.heappush(A, tmp)

print(-sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = [-i for i in map(int, input().split())]
heapq.heapify(A)
for i in range(M):
  tmp = -((-heapq.heappop(A))//2)
  heapq.heappush(A, tmp)

print(-sum(A))
i = 1
while True:
    x = int(input())
    if x == 0:
    break
    print("Case {}: {}".format(i, n))
    i += 1

### FIXED CODE ###

i = 1
while True:
    x = int(input().strip())
    if x == 0:
        break
    else:
        print ("Case {}: {}".format(i,x))
        i += 1
N = int(input())
x = {}
y = {}
h = {}
for i in range(N):
  x[i], y[i], h[i] = map(int, input().split())
  if h[i] != 0:
    x0, y0, h0 = x[i], y[i], h[i]
    break
for cx in range(101):
  for cy in range(101):
    H = h0 + abs(cx - x0) + abs(cy - y0)
    for i in range(N):
      if max(H - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]:
        break
    else:
      print(cx, cy, H)
      break
    continue
  else:
    continue
  break


### FIXED CODE ###

N = int(input())
x = {}
y = {}
h = {}
for i in range(N):
  x[i], y[i], h[i] = map(int, input().split())
  if h[i] != 0:
    x0, y0, h0 = x[i], y[i], h[i]
for cx in range(101):
  for cy in range(101):
    H = h0 + abs(cx - x0) + abs(cy - y0)
    for i in range(N):
      if max(H - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]:
        break
    else:
      print(cx, cy, H)
      break
    continue
  else:
    continue
  break
from collections import defaultdict
def factorial_memo(n, p):
  F = [1] * (n + 1)
  for i in range(n):
    F[i + 1] = F[i] * (i + 1) % p
  return F

def inverse(F, p):
  Finv = [x for x in F]
  Finv[-1] = pow(Finv[-1], p - 2, p)
  for i in range(len(F) - 2, 0, -1):
    Finv[i] = Finv[i + 1] * (i + 1) % p
  return Finv

def comb(*A):
  f = F[sum(A)]
  for a in A:
    f *= Finv[a]
    f %= p
  return f

def is_prime(n):
  for prime in prime_table:
    if n % prime == 0:
      return False
  else:
    return True

N, M = map(int, input().split())
p = 10 ** 9 + 7
prime_table = []
primes = defaultdict(int)
n = 2
while n <= M:
  if is_prime(n):
    prime_table.append(n)
    while M % n == 0:
      primes[n] += 1
      M //= n
  n += 1
F = factorial_memo(max(primes.values()) + N - 1, p)
Finv = inverse(F, p)
cnt = 1
for c in primes.values():
  cnt *= comb(c, N - 1)
  cnt  %= p
print(cnt)

### FIXED CODE ###

from collections import defaultdict
import math
def factorial_memo(n, p):
  F = [1] * (n + 1)
  for i in range(n):
    F[i + 1] = F[i] * (i + 1) % p
  return F

def inverse(F, p):
  Finv = [x for x in F]
  Finv[-1] = pow(Finv[-1], p - 2, p)
  for i in range(len(F) - 2, 0, -1):
    Finv[i] = Finv[i + 1] * (i + 1) % p
  return Finv

def comb(*A):
  f = F[sum(A)]
  for a in A:
    f *= Finv[a]
  return f % p

def eratosthenes(limit):
  E = [1] * (limit + 1)
  E[0], E[1] = 0, 0
  prime_table = []
  for i, e in enumerate(E):
    if e:
      prime_table.append(i)
      for j in range(i, limit + 1, i):
        E[j] = 0
  return prime_table

N, M = map(int, input().split())
p = 10 ** 9 + 7
limit = int(math.sqrt(M)) + 1
prime_table = eratosthenes(limit)
primes = defaultdict(int)
primes[1] = 0
for prime in prime_table:
  if prime > M:
    break
  while M % prime == 0:
    primes[prime] += 1
    M //= prime
if M > 1:
  primes[M] += 1
F = factorial_memo(max(primes.values()) + N, p)
Finv = inverse(F, p)
cnt = 1
for c in primes.values():
  cnt *= comb(c, N - 1)
print(cnt % p)
n = int(input())
a = 1
for i in range(1, n):
  a *= i
li = []
temp = 0
while a % 2 == 0:
  temp += 1
  a //= 2
else:
  li.append(temp+1)
for i in range(3, int(a**0.5)+1, 2):
  temp = 0
  while a % i == 0:
    temp += 1
    a //= i
  else:
    li.append(temp+1)
ans = 1
for i in li:
  ans *= i
else:
  print(ans)

### FIXED CODE ###

import collections
n = int(input())
li = []
for k in range(2, n+1):
  for i in range(2, int(k**0.5)+1):
    while k % i == 0:
      k //= i
      li.append(i)
  if k != 1:
    li.append(k)
c = collections.Counter(li)
ans = 1
for k, v in c.items():
  ans *= (v+1)
print(ans%(10**9+7))
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
ans = 2*sum(A[:N//2])-A[0]+(N%2==1)*A[N//2+1]
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
ans = 0
for i in range(1, N):
    ans += A[i//2]
print(ans)
List=[int(i) for i in input().split()] 
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)

### FIXED CODE ###

List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if int(i) != int(j):
		c1 += 1

for (i,j) in zip(List,b):
	if int(i) != int(j):
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)
from math import pi

r = int(input())
print(r ** 2 * pi, 2 * r * pi)


### FIXED CODE ###

from math import pi

r = float(input())
print(r ** 2 * pi, 2 * r * pi)
n, m, c = map(int, input().split())
b = [int(i) for i in input().split()]
a = [[int(input()) for _ in range(m)] for _ in range(n)]
ans = 0
ctn = 0
for j in range(n):
    for k in range(m):
        ctn += b[k] * a[j][k]
    if ctn + c > 0:
        ans += 1
    ctn = 0
print(ans)


### FIXED CODE ###

n, m, c = map(int, input().split())
b = [int(i) for i in input().split()]
a = [[int(j) for j in input().split()] for _ in range(n)]
ans = 0
for k in range(n):
    ct = c
    for l in range(m):
        ct += a[k][l] * b[l]
    if ct > 0:
        ans += 1
    ct = 0
print(ans)