Harryxun/stf_run huggingface dataset:
input()
H = list(map(int, input()))

max = 0
cnt = 0

for h in H:
  if h >= max:
    cnt += 1
    max = h

print(cnt)

### FIXED CODE ###

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

max_ = 0
cnt = 0

for h in H:
  if h >= max_:
    cnt += 1
    max_ = h

print(cnt)
n=int(input())
for i in range(n):
	s=input.split()
	for j in range(len(s)):
		s[j]=int(s[j])
	s.sort()
	print("YES" if(pow(s[0],2)+pow(s[1],2)==pow(s[2],2)) else "NO")


### FIXED CODE ###

t = int(input())
i = 0
def Right_Tri(m,n,o):
    a = (n**2+o**2)**(0.5)
    if m == a:
        return True

while(i<t):
    m,n,o = map(int, input().split())
    if (Right_Tri(m,n,o) or Right_Tri(n,o,m) or Right_Tri(o,m,n) == True):
        print("YES")
    else:
        print("NO")
    i += 1
import math
a, b = map(int, input().split())
gcd = math.gcd(a, b)
ans = a*b/gcd
print(int(ans))


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))
a,b=map( raw_input(), int)
ans=max([a+a-1,b+b-1,a+b])
print ans



### FIXED CODE ###

a,b=map(int, raw_input().split())
ans=max([a+a-1,b+b-1,a+b])
print ans
import numpy as np

N, K = [int(i) for i in input().split(' ')]
A = np.array([int(i) for i in input().split(' ')])
A.sort()

minus = A[A<0]
zero = A[A==0]
plus = A[A>0]

def f(x):
    cnt = 0
    if x>0:
        cnt += len(zero) * N
    cnt += np.searchsorted(A,x//plus,side='right').sum()
    cnt += (N - np.searchsorted(A,-(x//-minus),side='left')).sum()
    cnt -= np.count_nonzero(A*A<=x)

    assert cnt%2 == 0
    return cnt//2

left = -10**18
right = 10**18
while left + 1 < right:
    mid = (left+right) // 2
    if f(mid) >= K:
        right = mid
    else:
        left = mid

print(right)

### FIXED CODE ###

import numpy as np
N,K = [int(i) for i in input().split(' ')]

A = np.array([int(i) for i in input().split(' ')])

A.sort()
zero = A[A==0]
minus = A[A<0]
plus = A[A>0]

def index_count(x):
    cnt = 0
    if x >= 0:
        cnt += len(zero) * N
    cnt += np.searchsorted(A,x//plus,side='right').sum()
    cnt += (N - np.searchsorted(A,-(-x//minus),side='left')).sum()
    cnt -= np.count_nonzero(A*A <= x)

    assert cnt % 2 == 0
    return cnt //2


left = -10**18
right = 10**18

while left + 1 < right:
    mid = (left +right) //2
    a = index_count(mid)
    if a >= K:
        right = mid
    else:
        left = mid

print(right)
N = int(input())
C = list(input())
N1 = int(N/2)
C1 = C[0:N1]
C2 = C[N1:N]
count = 0
if (C1.count('W') == C2.count('R')):   #左右対象のとき
    count = C1.count('W')
elif(C1.count('R') == C2.count('W')):
    count = C.count('W')
print(count)

### FIXED CODE ###

N = int(input())
if(N >= 30):
  print("Yes")
else:
  print("No")
a, b, c = map(int, input().split())
print( sum(a,b,c) - max(a,b,c) )

### FIXED CODE ###

a, b, c = map(int, input().split())
print( a+b+c - max(a,b,c) )
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N - K + 1):
    m.append(h[i+2] - h[i])
print(min(m))



### FIXED CODE ###

N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h)

m = []
for i in range(N-K+1):
    m.append(h[i+K-1] - h[i])
print(min(m))
N,M = map(int,input().split())
Alist = list(map(int, input().strip().split()))
r = list(range(len(Alist)))
r[0] = Alist[0]
for i in range(1,len(Alist)-1):
    r[i] = r[i-1] + Alist[i]
for i in range(len(r)):
    r[i] = r[i]%M
p = [0] * M
for i in range(len(r)):
    p[r[i]] = p[r[i]] + 1
def kaijou(n):
    if n == 0:
        return 1
    else:
        v = n
        for i in range(1,n):
            v = v*i
        return v      
def combi(n):
    if n == 0:
        return 0
    if n == 1:
        return 0
    else:
        return kaijou(n)/((kaijou(n-2))*2)
s = 0
for i in range(len(p)):
    s = s + combi(p[i])
    print(s)
s = s + p[0]
print(int(s))

### FIXED CODE ###

N,M = map(int,input().split())
Alist = list(map(int, input().strip().split()))
r = [0]*N
r[0] = Alist[0]
for i in range(1,len(Alist)):
    r[i] = r[i-1] + Alist[i]
for i in range(len(r)):
    r[i] = r[i]%M
r.sort()
p = []
m = 0
for i in range(len(r)-1):
    m = m+1
    if r[i] != r[i+1]:
        p.append(m)
        m = 0
    if i == len(r)-2:
        p.append(m+1)
x = 0
for i  in range(len(r)):
    if r[i] == 0:
        x = x +1
def combi(n):
    if n == 0:
        return 0
    if n == 1:
        return 0
    else:
        return (n*(n-1))/2
s = 0
for i in range(len(p)):
    s = s + combi(p[i])
s = s + x
print(int(s))
N, K = map(int, input().split())
x = list(map(int, input().split()))

import bisect

idx_r = bisect.bisect_left(x, 0)

if x[idx_r] == 0:
    idx_l = idx_r
else:
    idx_l = idx_r - 1

ans = 1000000007
    
# right
if 0 <= idx_r + K - 1 < N:
    ans_tmp = x[idx_r + K - 1]
    ans = min(ans, ans_tmp)

# left
if 0 <= idx_l - K + 1 < N:
    ans_tmp = -x[idx_l - K + 1]
    ans = min(ans, ans_tmp)

# right -> left
for i in range(N):
    if 0 <= idx_r - K + 1 + i < idx_r + i < N:
        ans_tmp = 2 * x[idx_r + i] - x[idx_r - K + 1 + i]
        ans = min(ans, ans_tmp)

# left -> right
for i in range(N):
    if 0 <= idx_l - i < idx_l + K - 1 - i < N:
        ans_tmp = x[idx_l + K - 1 - i] - 2 * x[idx_l - i]
        ans = min(ans, ans_tmp)

print(ans)

### FIXED CODE ###

# encoding: utf-8
import math
N, K = map(int, input().split())
x = list(map(int, input().split()))

# find position of Mr.Sunuke
for i_snk, xi in enumerate(x):
    if xi >= 0: break

# (left, right) * K patterns, left + right = K
min_dist = (x[-1] - x[0]) * K
for left in range(K + 1):
    right = K - left
    # skip
    # print("#", i_snk, left, right)
    if i_snk - left < 0: continue
    elif right + i_snk > N: continue
    # calc dist
    left_x = x[i_snk - left]
    right_x = x[i_snk + right - 1]
    tocorner = int(min(math.fabs(left_x), math.fabs(right_x)))
    side2side = right_x - left_x
    # print("##", i_snk, left_x, right_x, tocorner + side2side)
    if tocorner + side2side < min_dist: min_dist = tocorner + side2side

print(min_dist)
S = input()

print(S.replace(2017, 2018))


### FIXED CODE ###

S = input()
print(S.replace("2017", "2018"))
import sys
n = int(input())
n2 = n
while n>0:
    if n % 4 == 0 or n % 7 == 0:
        print("Yes")
        sys.exit(1)
    n -= 7
while n2>0:
    if n2 % 4 == 0 or n2 % 7 == 0:
        print("Yes")
        sys.exit(1)
    n2 -= 4
print("No")

### FIXED CODE ###

import sys
n = int(input())
n2 = n
while n>0:
    if n % 4 == 0 or n % 7 == 0:
        print("Yes")
        sys.exit()
    n -= 7
while n2>0:
    if n2 % 4 == 0 or n2 % 7 == 0:
        print("Yes")
        sys.exit()
    n2 -= 4
print("No")
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
if n >= 2:
  for i in range(n, 0, -2):
    print(A[i-1], end=" ")
  for i in range(n % 2, n - 2, 2):
    print(A[i], end=" ")
  print(A[n-2])
if n == 1:
  print(*A)
# -*- coding: utf-8 -*-                                                                              

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

min_i =	0
min_temp = abs(T - H[0] * 0.006 - A)

for i in range(1, N):
    if abs(T-H[i]*0.006-A) < min_temp:
	min_temp = abs(T-H[i]*0.006-A)
        min_i =	i

print(min_i+1)


### FIXED CODE ###

# -*- coding: utf-8 -*-                                                                              

N = int(input())
T, A = map(int, input().split())

import numpy as	np

ans = (T-A) / 0.006

h = np.abs(np.array(list(map(int, input().split()))) - ans)

print(np.argmin(h) + 1)
W,H,x,y = list(map(int,input().split(" ")))
#print(W,H,x,y)
#横にラインを引く
if x ==0 or x == W:
    tatemax = 0
    yokomax = W*H/2.0
if y== 0 or y == H:
    tatemax = W*H/2.0
    yokomax = 0
if x !=0 and x != W and y!= 0 and y != H:       
    if float(y) > float(H)/2.0:
        yokomax = float(W) * float((H-y))
    elif float(y) < float(H)/2.0:
        yokomax = float(W) * float(y)
    elif float(y) == float(H)/2.0:
        yokomax = float(W) * float(y)

    if float(x) > float(W)/2.0:
        tatemax = float(H) * float((W-x))
    elif float(x) < float(W)/2.0:
        tatemax = float(H) *float(x)
    elif float(x) == float(W)/2:
        tatemax = float(H) * float(x)
if yokomax == tatemax: 
    print(max(yokomax,tatemax),'1')   
#    print('{:.12e}'.format(max(yokomax,tatemax)),'1')
else:
    print(max(yokomax,tatemax),'0')
#    print('{:.12e}'.format(max(yokomax,tatemax)),'0')


### FIXED CODE ###

x,a = list(map(int,input().split()))
if x < a:
    print(0)
elif x >= a:
    print(10)
n = input()
l = [int(input()) for _ in range(n)]
print(sum(l)-max(l)/2)

### FIXED CODE ###

n = int(input())
l = [int(input()) for _ in range(n)]
print(sum(l)-int(max(l)/2))
n,m = map(int,input().split())
a = list(int(input()) for i in range(m))

mod = 1000000007
b = [0]*(m + 1)

b[0] = a[0] - 1
b[m] = n - a[m - 1] - 1

for i in range(1,m):
    b[i] = a[i] - a[i-1] - 2

b.sort()
ans = 1
if b[0] == -1:
    ans = 0
else:
    pattern = [0]*(b[m]+1)
    pattern[0] = 1
    pattern[1] = 1
    for i in range(2,b[m]+1):
        pattern[i] = pattern[i-1] + pattern[i-2]
    for i in range(m + 1):
        ans *= pattern[b[i]]

print(ans % mod)


### FIXED CODE ###

n,m = map(int,input().split())
a = list(int(input()) for i in range(m))

mod = 1000000007
b = [0]*(m + 1)
if m != 0:
    b[0] = a[0] - 1
    b[m] = n - a[m - 1] - 1
else:
    b[0] = n

for i in range(1,m):
    b[i] = a[i] - a[i-1] - 2

b.sort()
ans = 1
if b[0] == -1:
    ans = 0
else:
    pattern = [0]*(max(b[m]+1,2))
    pattern[0] = 1
    pattern[1] = 1
    for i in range(2,b[m]+1):
        pattern[i] = pattern[i-1] + pattern[i-2]
    for i in range(m + 1):
        ans *= pattern[b[i]]

print(ans % mod)
import math
a, b, x = list(map(int, input().split()))

# %%
# a, b, x = [3, 1, 8]
if x/a > a*b/2:
    # 台形
    y = 2*x/(a**2) - b
    print(90-math.degrees(math.atan(   (a/(b-y))  )))
else:
    # 三角形
    print(90-math.degrees(math.atan( (2*x/(a*b)) / b  )))

### FIXED CODE ###

import math
a, b, x = list(map(float, input().split()))

# %%
# a, b, x = [3, 1, 8]
if x/a > a*b/2:
    # 台形
    y = 2*x/(a**2) - b
    # print(90-math.degrees(math.atan(   (a/(b-y))  )))
    print(90-math.degrees(math.atan2(a, b-y)))
else:
    # 三角形
    # print(90-math.degrees(math.atan( (2*x/(a*b)) / b  )))
    print(90-math.degrees(math.atan2(2*x/(a*b), b)))
import sys

args = sys.argv
if(args[0] <= args[1]):
    ans = "1"
else:
    ans = int(args[1]) / int(args[0])

print(str(ans))

### FIXED CODE ###

import math

hp , attack = map(int,input().split())

if(hp <= attack):
    ans = "1"
else:
    ans = str(math.ceil(hp / attack))

print(int(ans))
n=int(input())
if n[-1]==7 or n[-3]==7 or n[-2]==7
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=str(input())
if n[-1]=="7" or n[-3]=="7" or n[-2]=="7":
    print("Yes")
else:
    print("No")
from math import gcd
n = int(input())
a = list(map(int, input().split()))

pre = [0]
for i in range(n - 1):
    pre.append(gcd(pre[-1], a[i]))

post = [0]
for i in range(n - 1):
    post.append(gcd(post[-1], a[n - 1 - i]))

res = 0
for i in range(n):
    res = max(gcd(pre[i], post[n - 1 - i]), res)

print(res)


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
    
n = int(input())
a = list(map(int, input().split()))

pre = [0]
for i in range(n - 1):
    pre.append(gcd(pre[-1], a[i]))

post = [0]
for i in range(n - 1):
    post.append(gcd(post[-1], a[n - 1 - i]))

res = 0
for i in range(n):
    res = max(gcd(pre[i], post[n - 1 - i]), res)

print(res)
A, B, C = map(int, input().split())

print(A[0]+B[0]+C[0])

### FIXED CODE ###

A, B, C = map(str, input().split())
 
print(A[0]+B[0]+C[0])
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors

N = int(input())
list =  make_divisors(N)
ans = 10**9
for i in range(0,len(list),2):
  tmp1 = len(str(list[i]))
  tmp2 = len(str(list[i+1]))
  ans = min(ans,max(tmp1,tmp2))
print(ans)


### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors

N = int(input())
list =  make_divisors(N)
ans = 10**9
if len(list)%2==1:
    list.append(list[-1])
for i in range(0,len(list),2):
    tmp1 = len(str(list[i]))
    tmp2 = len(str(list[i+1]))
    ans = min(ans,max(tmp1,tmp2))
print(ans)
input_list=list(input())

#A,B,C,K
a = int(input_list[3]) - int(input_list[0])
b = int(input_list[3]) - int(input_list[1])- int(input_list[0])
c = int(input_list[3]) - int(input_list[2])- int(input_list[1])- int(input_list[0])
if b <= 0:
  calc = input_list[0]
else:
  calc = input_list[0] - input_list[2]


### FIXED CODE ###

input_list=list(input().split(" "))
#2000000000 0 0 2000000000
#A,B,C,K
a = int(input_list[3]) - int(input_list[0])
b = int(input_list[3]) - int(input_list[1])- int(input_list[0])
c = int(input_list[3]) - int(input_list[2])- int(input_list[1])- int(input_list[0])
if a < 0:
    calc = int(input_list[3])
elif b <= 0 and a >=0:
  calc = int(input_list[0])
else:
  calc = int(input_list[0]) - b
print(calc)
import math

a,b = map(int,input().split())
print(a * b // math.gcd(a,b))

### FIXED CODE ###

import fractions

a,b = map(int,input().split())
print(a * b // fractions.gcd(a,b))
import sys
n, m = map(int, input().split())
A = [input() for _ in range(n)]
B = [input() for _ in range(m)]
count = 0
idx = 0
position = []
for b in B:
    if idx == 0:
        for i, a in enumerate(A[:-m]):
            if b in a:
                position.append(a.find(b))
                if a.count(b) > 1:
                    position.append(a.rfind())
                    position.append(a.find(b, a.find(b)))
                count += 1
                idx = i
                break
        if count == 0:
            print('No')
            sys.exit()
    else:
        for i, a in enumerate(A[idx+1:]):
            for p in position:
                if b == a[p:p + m]:
                    break
                print('No')
                sys.exit()
print('Yes')

### FIXED CODE ###

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
flag = 0
for i in range(n-m+1):
    for j in range(n-m+1):
        c = [x[j:j+m] for x in a[i:i+m]]
        if c == b:
            flag = 1
            break
print('Yes') if flag == 1 else print('No')
import numpy as np
n,m = map(int,input().split())
A = np.zeros((n,n),dtype=np.int8)
for i in range(m):
    a,b = map(int,input().split())
    A[a-1,b-1] = 1
if 1 in A[np.where(A[0] == 1),n-1]:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

import numpy as np
n,m = map(int,input().split())
A1 = np.zeros(n,dtype=bool)
Ai = np.zeros(n,dtype=bool)
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        A1[b-1] = True
    if b == n:
        Ai[a-1] = True
if np.any(Ai[A1]):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]

tilt_map = {}

for i in range(N):
    for j in range(i+1, N):
        a = xy[i]
        b = xy[j]
        tilt_x = a[0] - b[0]
        tilt_y = a[1] - b[1]
        key = str(tilt_x) + ":" + str(tilt_y)
        if key in tilt_map:
            tilt_map[key] += 1
        else:
            tilt_map[key] = 1


most_key = sorted(tilt_map.items(), key=lambda x: x[1], reverse=True)[0][0]

idx = most_key.index(":")
m_dx = int(most_key[:idx])
m_dy = int(most_key[idx+1:])

if m_dx == 0:
    if m_dy < 0:
        m_dy *= -1
    xy.sort(key=lambda x: x[1])
else:
    if m_dx < 0:
        m_dx *= -1
        m_dy *= -1
    xy.sort(key=lambda x:x[0])

pos = xy.pop(0)
cost = 1

while len(xy) > 0:
    next_x = pos[0] + m_dx
    next_y = pos[1] + m_dy
    for _xy in xy[::]:
        if _xy[0] == next_x and _xy[1] == next_y:
            xy.remove([next_x, next_y])
            pos = [next_x, next_y]
            break
    else:
        pos = xy.pop(0)
        cost += 1
print(cost)


### FIXED CODE ###


N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]
xy.sort(key=lambda x: x[0])
tilt_map = {}

if N == 1:
    print(1)
else:
    for i in range(N):
        for j in range(i+1, N):
            a = xy[i]
            b = xy[j]
            tilt_x = a[0] - b[0]
            tilt_y = a[1] - b[1]
            if tilt_x == 0 and tilt_y < 0:
                tilt_y *= -1
            key = str(tilt_x) + ":" + str(tilt_y)
            if key in tilt_map:
                tilt_map[key] += 1
            else:
                tilt_map[key] = 1


    most_tilt = sorted(tilt_map.items(), key=lambda x: x[1], reverse=True)[0][1]
    print(N-most_tilt)
N,M = map(int,input().split())
lis = []
path = ["1"]

for i in range(M):

    a,b = map(int,input().split())
    lis.append([a,b])

for i in range(N-1):

    i += 1

    npath = []

    for p in path:


        for j in lis:

            if j[0] == int(p[-1]) and str(j[1]) not in p:

                npath.append(p + str(j[1]))

            if j[1] == int(p[-1]) and str(j[0]) not in p:

                npath.append(p + str(j[0]))

    path = npath.copy()


print (len(path))


### FIXED CODE ###


N,M = map(int,input().split())
lis = []
path = ["1"]

for i in range(M):

    a,b = map(int,input().split())
    lis.append([a,b])

for i in range(N-1):

    i += 1

    npath = []

    for p in path:


        for j in lis:

            if j[0] == int(p[-1]) and str(j[1]) not in p:

                npath.append(p + str(j[1]))

            if j[1] == int(p[-1]) and str(j[0]) not in p:

                npath.append(p + str(j[0]))

    path = npath.copy()


print (len(path))
a, b = input().split()
    an, bn = map(int, input().split())
    s = input()

    d = {a: an, b:bn}
    d[s] -= 1

    print("{} {}".format(d[a], d[b]))

### FIXED CODE ###

a, b = input().split()
an, bn = map(int, input().split())
s = input()

d = {a: an, b:bn}
d[s] -= 1

print("{} {}".format(d[a], d[b]))
import sys

def solve(n):
    a = 0
    for s in str(n):
        a += int(s)
    if n%a == 0:
        return("Yes")
    else:
        return("No")

def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a] = line.split(' ')
    return (int(str_a)

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def solve(n):
    a = 0
    for s in str(n):
        a += int(s)
    if n%a == 0:
        return("Yes")
    else:
        return("No")

def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a] = line.split(' ')
    return (int(str_a))

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()
K = [IL() for i in range(M)]
p = IL()

data = []
for i in range(2**M):
    d = []
    for j in range(M):
        if ((i >> j) & 1) == 1:
            d.append(K[j])
    else:
        data.append(d)

ans = 0
for s in data:
    cnt = [0]*M
    for i in s:
        for j in i[1:]:
            cnt[j-1] += 1
    else:
        for k in range(M):
            if cnt[k]%2 == p[k]:
                continue
            else:
                break
        else:
            ans += 1

print(ans)

### FIXED CODE ###

import numpy as np
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()
K = [IL()[1:] for i in range(M)]
p = np.array(IL())

switch = np.array([[0]*M for i in range(N)])
for i in range(M):
    while K[i]:
        num = K[i].pop()
        switch[num-1][i] = 1

ans = 0
for i in range(1 << N):
    cnt = np.array([0]*M)
    for j in range(N):
        if ((i >> j) & 1) == 1:
            cnt += switch[j]
    else:
        if (p == (cnt%2)).all():
            ans += 1
print(ans)
n = int(input())
k = int(input())
nums = list(map(int, input().split()))
a = 0
for i in n:
  a += (2 * min(k-nums[i], nums[i]))
print(a)
  

  

### FIXED CODE ###

n = int(input())
k = int(input())
nums = list(map(int, input().split()))
print(2 * sum([min(k - i, i) for i in nums]))
import math
n,k = map(int,input().split())
def com(x,y):
  return math.factorial(x)//math.factorial(x-y)*math.factorial(y)

for i in range(1,k-1):
  t = int(com(n-k+i,i)*com(k-1.i-1))
  s = int(t%(10**9+7))
  print(s)

### FIXED CODE ###

import math
 
def combination_count(n,k):
    if k > n or k < 0:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())
 
mod = 10**9 + 7
 
for i in range(1,k+1):
    x = combination_count(n-k+1,i) * combination_count(k-1, i-1)
    print(x%mod)