Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B,K = map(int, lines.pop(0).split(' '))
    NLIST = list(range(A,B+1))
    res = list(set(NLIST[:K] +  NLIST[-K:]))
    res.sort()
    for i in res:
        print(i)

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    A,B,K = map(int, lines.pop(0).split(' '))
    NLIST = set()
    for i in range(K):
        if A+i <= B:
            NLIST.add(A+i)
        if A <= B-i:
            NLIST.add(B-i)

    NLIST = list(NLIST)
    NLIST.sort()
    for i in NLIST:
        print(i)

#
# main
#
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    return cover
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover

def count(cover, min_cover):
    ret = 0
    return ret
    for y in xrange(n):
        for x in xrange(m):
            if cover[y][x] < min_cover[y][x]:
                ret += 1
    return ret
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    return max(count(func(pos[1] - 1, pos[0] - 1), min_cover) for pos in tpos)
 
while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
def main():
    A, M, K = map(int, input().split())
    bookA = list(map(int, input().split()))
    bookB = list(map(int, input().split()))

    if len(bookA) != len(bookB):
        if len(bookA) > len(bookB):
            diff = len(bookA) - len(bookB)
            for i in range(diff + 1):
                bookB.append(1000000000)
            bookA.append(1000000000)
        else:
            diff = len(bookB) - len(bookA)
            for j in range(diff + 1):
                bookA.append(1000000000)
            bookB.append(1000000000)
    
    C = 0
    Ai = 0
    Bi = 0

    while K > -1:
        if bookA[Ai] < bookB[Bi]:
            K = K - bookA[Ai]
            if K == 0:
                C = C + 1
                break
            elif K < 1:
                break
            Ai = Ai + 1
            C = C + 1
        else:
            K = K - bookB[Bi]
            if K == 0:
                C = C + 1
                break
            elif K < 1:
                break
            Bi = Bi + 1
            C = C + 1
    print(C)
    

main()

### FIXED CODE ###

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    a, b = [0], [0]
    for i in range(N):
        a.append(a[i] + A[i])

    for i in range(M):
        b.append(b[i] + B[i])

    ans, j = 0, M
    for i in range(N + 1):
        if a[i] > K:
            break
        while b[j] > K - a[i]:
            j -= 1
        ans = max(ans, i + j)

    print(ans)
main()
n=int(input())

for i in range(1,3501):
    for j in range(j,3501):
        if 4*i*j-n*i-n*j>0 and n*i*j%(4*i*j-n*i-n*j)==0:
            w=n*i*j//(4*i*j-n*i-n*j)
            print(i,j,w)
            quit()
        else:
            continue

### FIXED CODE ###

n=int(input())

for i in range(1,3501):
    for j in range(i,3501):
        if (4*i*j-n*i-n*j)>0 and n*i*j%(4*i*j-n*i-n*j)==0:
            w=n*i*j//(4*i*j-n*i-n*j)
            print(i,j,w)
            quit()
        else:
            continue
# A - Painting
import sys

debug = lambda message: sys.stderr.write(message)


def main():
    H, W, N = map(int, open(0))
    debug(max(H, W))
    print((N + max(H, W) - 1) // max(H, W))


if __name__ == "__main__":
    main()


### FIXED CODE ###

# A - Painting
import sys

debug = lambda message: print("DEBUG:", message, file=sys.stderr)


def main():
    H, W, N = map(int, open(0))
    debug(max(H, W))
    print((N + max(H, W) - 1) // max(H, W))


if __name__ == "__main__":
    main()
n=int(input())
a=list(map(int,input().split()))
cnt=0
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cnt=0
ch=True
#print(cnt,a)
while True:
    my_bool=True
    for i in range(n):
        if my_bool:
            if a[i]!=0:
                my_bool=False
                ch2=True
                a[i]-=1
        else:
            if a[i]!=0:
                a[i]-=1
                ch=True
                ch2=True
            else:
                if ch2:
                    cnt+=1
                ch=False
                ch2=False
    if ch:
        if my_bool:
            pass
        else:
            #print("ch",cnt,a)
            cnt+=1
    #print(cnt,a)
    if my_bool:
        break
print(cnt)
import math
import itertools

n = int(input())
l = list(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

pi = 0
qi = 0

for i in range(n):
	l[i] = i+1
  
m = itertools.permutations(l, n)
 
for i in range(n):
	if m[i] == p:
  		pi = i+1
	if m[i] == q:
    	qi = i+1

print(abs(pi-qi))

### FIXED CODE ###

import itertools
 
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
 
l = [i for i in range(1,n+1)] 
 
x = 0
y = 0
 
m = list(itertools.permutations(l))
 
for i in range(len(m)):
	if m[i] == p:
  		x = i+1
	if m[i] == q:
 		y = i+1
        
print(abs(x-y))
N = input()
n_even = int(N / 2)
n_odd = n_even + 1
chance = float(n_odd / N)
print(chance)

### FIXED CODE ###

N = int(input())

if N % 2 == 0 :
    n_even = int(N / 2)
    n_odd = n_even
    chance = n_odd / N
    print(chance)
    
else :
    n_even = int(N / 2)
    n_odd = n_even + 1
    chance = n_odd / N
    print(chance)
N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")

### FIXED CODE ###

#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))





N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")
a = input()
2a = 3 * (a ** a)

print (2a)


### FIXED CODE ###

r = int(input())
print(3*r*r)
n, k = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1], reverse=True)
#print(sushi)
num = 0
kind = set()
changable = []
for i in range(k):
	num += sushi[i][1]
	if sushi[i][0] in kind:
		changable.append(sushi[i][1])
	else:
		kind.add(sushi[i][0])

num += len(kind)**2
changable.reverse()
#print(changable)
ans = num

for i in range(k, n):
	if sushi[i][0] not in kind:
		num += sushi[i][1] + 2*len(kind)+1 - changable.pop()
		#print(num, kind)
		kind.add(sushi[i][0])
		ans = max(ans, num)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
sushi = [list(map(int, input().split())) for _ in range(n)]
sushi.sort(key=lambda x: x[1], reverse=True)
#print(sushi)
num = 0
kind = set()
changable = []
for i in range(k):
	num += sushi[i][1]
	if sushi[i][0] in kind:
		changable.append(sushi[i][1])
	else:
		kind.add(sushi[i][0])

num += len(kind)**2
#changable.reverse()
#print(changable)
ans = num

for i in range(k, n):
	if not changable:
		break

	if sushi[i][0] not in kind:
		num += sushi[i][1] + 2*len(kind)+1 - changable.pop()
		#print(num, kind)
		kind.add(sushi[i][0])
		ans = max(ans, num)


print(ans)
import sys
def input():
    return sys.stdin.readline()[:-1]
import heapq
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
f.sort()
ans=[]
for i in range(n):
    ans.append([f[i]*a[n-i-1]*-1,a[n-i-1]*-1])
heapq.heapify(ans)
# print(ans)
for i in range(k):
    tmp=heapq.heappop(ans)
    # print(tmp)
    if tmp[1]==0:
        heapq.heappush(ans,tmp)
        break
    tmp[0]=tmp[0]//tmp[1]
    tmp[1]+=1
    tmp[0]=tmp[0]*tmp[1]
    heapq.heappush(ans,tmp)
cnt=0
for i in range(n):
    cnt=max(cnt,ans[i][0]*-1)
print(cnt)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)
import math
        
def koch(n, h, i, j, k):
 if n == 0:
  return
         
 s.x = (h*2+j)/3
 s.y = (i*2+k)/3
 t.x = (h+j*2)/3
 t.y = (i+k*2)/3
 u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
 u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
        
 koch(n-1, h, i, s.x, s.y)
 print s.x, s.y
 koch(n-1, s.x, s.y, u.x, u.y)
 print u.x, u.y
 koch(n-1, u.x, u.y, t.x, t.y)
 print t.x, t.y
 koch(n-1, t.x, t.y, j, k)
 
n = input()
        
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
        
print px, py
koch(n, px, py, qx, qy)
print qx, qy

### FIXED CODE ###

import math
          
def koch(n, h, i, j, k):
 if n == 0:
  return
           
 sx = (h*2+j)/3
 sy = (i*2+k)/3
 tx = (h+j*2)/3
 ty = (i+k*2)/3
 ux = (tx-sx)*math.cos(math.pi/3) - (ty-sy)*math.sin(math.pi/3) + sx
 uy = (tx-sx)*math.sin(math.pi/3) + (ty-sy)*math.cos(math.pi/3) + sy
          
 koch(n-1, h, i, sx, sy)
 print sx, sy
 koch(n-1, sx, sy, ux, uy)
 print ux, uy
 koch(n-1, ux, uy, tx, ty)
 print tx, ty
 koch(n-1, tx, ty, j, k)
   
n = input()
          
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
          
print px, py
koch(n, px, py, qx, qy)
print qx, qy
N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
if M > N//2:
    print(0)
    quit()

A = list(int(input()) for _ in range(M))
idx = 0
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
a = -1
if len(A):
    if 1 == A[idx]:
        dp[1] = 0
        idx += 1

for i in range(2, N+1):
    if i != A[idx]:
        dp[i] = (dp[i-1] + dp[i-2]) % P
    else:
        dp[i] = 0
        if idx < M-1:
            idx += 1
print(dp[N])

### FIXED CODE ###

N, M = map(int, input().split())
if N == 1:
    print(1)
    quit()
if M > N//2:
    print(0)
    quit()

A = list(int(input()) for _ in range(M))
idx = 0
P = 10**9 + 7

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
a = -1
if len(A):
    if 1 == A[idx]:
        dp[1] = 0
        if idx < M-1:
            idx += 1

if len(A):
    for i in range(2, N+1):
        if i != A[idx]:
            dp[i] = (dp[i-1] + dp[i-2]) % P
        else:
            dp[i] = 0
            if idx < M-1:
                idx += 1
else:
    for i in range(2, N+1):
        dp[i] = (dp[i-1] + dp[i-2]) % P
print(dp[N])
n, x = map(int, input().split())
l = [int(x) for x in input().split()]
ans = 0
d = 0
for i in l:
    d += i
    ans += 1
    if d > x:
        print(ans)
        exit(1)



### FIXED CODE ###

n, x = map(int, input().split())
l = [int(x) for x in input().split()]
ans = 1
d = 0
for i in l:
    d += i
    if d <= x:
        ans += 1
print(ans)
w,h,x,y,r = input().split()
print(['No','Yes'][r<=x & x<=w-r & r<=y & y<=h-r]


### FIXED CODE ###

w,h,x,y,r = map(int,input().split())
print(['No','Yes'][r<=x<=w-r and r<=y<=h-r])
N = int(input())
c = input()
rlist = []
wlist = []
for i in range(N):
    if c[i] == 'R':
        rlist.append(i)
    else:
        wlist.append(i)

cnt = 0
for i in range(len(wlist)):
    if wlist[i] < rlist[-cnt - 1]:
        cnt += 1
    else:
        break
print(cnt)

### FIXED CODE ###

N = int(input())
c = input()
rlist = []
wlist = []
for i in range(N):
    if c[i] == 'R':
        rlist.append(i)
    else:
        wlist.append(i)

cnt = 0
if len(rlist) == 0:
    print(0)
    exit()
for i in range(len(wlist)):
    if wlist[i] < rlist[-cnt - 1]:
        cnt += 1
    else:
        break
print(cnt)
S = int()
h = m * 60
m = s * 60
s = m / 60
print(h, m, s, sep=':')

### FIXED CODE ###

S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep=':')
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
d=[mod]*(n+1)
d[0]=1;d[1]=1
for i in a:
  d[a]=0
for i in range(2,n+1):
  d[i]=min(d[i],(d[i-1]+d[i-2])%mod)
print(d[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
d=[mod]*(n+1)
d[0]=1;d[1]=1
for i in a:
  d[i]=0
for i in range(2,n+1):
  d[i]=min(d[i],(d[i-1]+d[i-2])%mod)
print(d[n])
s = input()
if len(s)%2==1 or s[:len(s)//2]==s[len(s)//2:]:
    print("No")
else:
    print("Yes")
return 0

### FIXED CODE ###

n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")
n=int(input())
ans="No"
while n>=0
  if n%4==0:
    ans="Yes"
    break
  else:
    n-=7
print(ans)

### FIXED CODE ###

n=int(input())
ans="No"
while n>=0:
  if n%4==0:
    ans="Yes"
    break
  else:
    n-=7
print(ans)
N, T = map(int, input().split())
A = list(map(int, input().split()))

D = []

def f(a):
  if a <= N:
    M = max(A[a:N+1])
    Mi = A.index(M)
    m = min(A[a-1:Mi])
    D.append(M - m)
    f(Mi+2)
  else:
    pass

f(1)

result = D.count(max(D))
print(result)


### FIXED CODE ###

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

B = []
Amin = A[0]

for i in range(1, N):
  if A[i] < Amin:
    Amin = A[i]
  else:
    B.append(A[i] - Amin)

result = B.count(max(B))
print(result)
N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0

for i in range(N - 1):
  print(cnt)
  if H[i] < H[i + 1]:
    ans.append(cnt)
    cnt = 0
  else:
    cnt += 1
print(max(ans))

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0

for i in range(N - 1):
  if H[i] < H[i + 1]:
    ans.append(cnt)
    cnt = 0
  else:
    cnt += 1
ans.append(cnt)
print(max(ans))
def make_divisors(n,m):
    divisors = []
    for i in range(1, (m//n)+1):
        if m % i == 0:
            divisors.append(i)
            if i != m // i and m//i<=m//n:
                divisors.append(m//i)
    return divisors
n,m=map(int,input().split())
print(max(make_divisors(n,m)))


### FIXED CODE ###

i=input()
if i=="2":
  n=int(input())
  m=int(input())
  print(n+m)
else:
  print("Hello World")
def next_array(array):#辞書式に次の配列を与える関数
	s = -1
	for x in array[::-1]:
		if x < M:
			break
		else:
			s -= 1
    #Mより小さい最後の項を取得
    
    if s >= -N:
    	array[s] += 1#その項を１増やす
    	if s < -1:
      		for i in range(s+1,0):#以降の項を全て同じ値に
      			array[i] = array[s]
        
	return array
 
def score(array, rules):#点数計算
	scr = 0
    for rule in rules:
		if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
    		scr += rule[3]
    return scr
 
 
# input
N, M, Q = map(int, input().split())
rules = []
for i in range(Q):
    a, b, c, d = map(int, input().split())
    rules.append([a, b, c, d])
    
array　= [1] * N
max_scr = 0
 
while True:
	max_scr = max(max_scr, score(array,rules)) 
	if array[0] == M:#全探索完了
		break 
	array = next_array(array)#次の配列へ
    
print(max_scr)

### FIXED CODE ###

def next_array(array):#辞書式に次の配列を与える関数
  s = -1
  for x in array[::-1]:
    if x < M:
      break
    else:
      s -= 1
    #Mより小さい最後の項を取得
  
  if s >= -N:
    array[s] += 1#その項を１増やす
    if s < -1:
      for i in range(s+1,0):#以降の項を全て同じ値に
        array[i] = array[s]

  return array
 
def score(array, rules):#点数計算
  scr = 0
  for rule in rules:
    if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
      scr += rule[3]
      
  return scr
 
# input
N, M, Q = map(int, input().split())
rules = []
 
for i in range(Q):
  a, b, c, d = map(int, input().split())
  rules.append([a, b, c, d])
  
array = [1] * N
max_scr = 0
 
while True:
  max_scr = max(max_scr, score(array,rules)) 
  if array[0] == M:#全探索完了
    break 
  array = next_array(array)#次の配列へ
    
print(max_scr)
A,B,Q=map(int,input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]

#二分探索関数
def bin_search(x,seq):
    width=[0,len(seq)-1]
    while(width[1]-width[0]>1):
        center=(sum(width)//2)
        if x>=seq[center]:
            width=[center,width[1]]
        else:
            width=[width[0],center]
if x<=seq[width[0]]:
    return [width[0],width[0]]
elif x>=seq[width[1]]:
    return [width[1],width[1]]
else:
    return width

for i in range(Q):
    x=int(input())
    Nb_s=bin_search(x,s)
    Nb_t=bin_search(x,t)
    Nb_s0=s[Nb_s[0]]
    Nb_s1=s[Nb_s[1]]
    Nb_t0=t[Nb_t[0]]
    Nb_t1=t[Nb_t[1]]

    k1=abs(Nb_s0-x)+abs(Nb_t0-Nb_s0)
    k2=abs(Nb_s1-x)+abs(Nb_t0-Nb_s1)
    k3=abs(Nb_s0-x)+abs(Nb_t1-Nb_s0)
    k4=abs(Nb_s1-x)+abs(Nb_t1-Nb_s1)
    k5=abs(Nb_t0-x)+abs(Nb_t0-Nb_s0)
    k6=abs(Nb_t1-x)+abs(Nb_t1-Nb_s1)
    k7=abs(Nb_t0-x)+abs(Nb_t0-Nb_s1)
    k8=abs(Nb_t1-x)+abs(Nb_t1-Nb_s0)
    print(min(k1,k2,k3,k4,k5,k6,k7,k8))

### FIXED CODE ###

inf=10**11
A,B,Q=map(int,input().split())
s=[-inf]+[int(input()) for _ in range(A)]+[inf]
t=[-inf]+[int(input()) for _ in range(B)]+[inf]
x=[[i,int(input())] for i in range(Q)]

x.sort(key=lambda x:x[1])
i,s_i,t_i=0,0,0
ans=[]

for i in range(Q):
    while(1):
        if x[i][1]>=s[s_i]:
            s_i+=1
        else:
            break
    while(1):
        if x[i][1]>=t[t_i]:
            t_i+=1
        else:
            break
    ans.append([x[i][0],x[i][1],s[s_i-1],s[s_i],t[t_i-1],t[t_i]])
ans.sort(key=lambda x:x[0])
for i in range(Q):
    xx=ans[i][1]
    Nb_s0=ans[i][2]
    Nb_s1=ans[i][3]
    Nb_t0=ans[i][4]
    Nb_t1=ans[i][5]

    p1=abs(Nb_s0-xx)
    p2=abs(Nb_s1-xx)
    p3=abs(Nb_t0-xx)
    p4=abs(Nb_t1-xx)
    q1=abs(Nb_t0-Nb_s0)
    q2=abs(Nb_t0-Nb_s1)
    q3=abs(Nb_t1-Nb_s0)
    q4=abs(Nb_t1-Nb_s1)
    print(min(p1+q1,p2+q2,p1+q3,p2+q4,p3+q1,p4+q4,p3+q2,p4+q3))
n, k = map(int, input().split())
prices = list(map(int, input().split()))

prices = prices.sorted()

answer = 0
for i in range(0, k, 1):
  answer = answer + prices[i]
print(answer)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
prices = list(map(int, input().split()))
prices.sort()

prices_arr = np.array(prices)
answer = prices_arr[0:k].sum()

print(answer)
import sys
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    repn = [[] for _ in range(N)]
    for _ in range(N - 1):
        u, v = map(int, input().split())
        repn[u - 1].append(v - 1)
        repn[v - 1].append(u - 1)
    
    length = [0] * (N + 1)
    dp = [-1]

    """
    やはり各頂点でLIS配列を取ると配列コピーの時間がかかってTLEするので、
    配列は唯一つを扱って、DFSからバックするときに配列も元に戻す操作を行いたい
    （ここの実装の仕方がわからなかった）

    これはdfsを再帰で書いた後に復元操作を追記すれば異常に楽に書ける。。。
    """

    def dfs(v, p=N):
        if A[v] > dp[-1]:
            dp.append(A[v])
            length[v] = length[p] + 1
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp.pop()
        else:
            idx = bisect_right(dp, A[v])
            old = dp[idx]
            dp[idx] = A[v]
            length[v] = length[p]
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp[idx] = old
        #print("v={}, len={}, dp={}".format(v, length[v], dp))

    dfs(0)
    length.pop()
    for ans in length:
        print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(2*10**5)
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    repn = [[] for _ in range(N)]
    for _ in range(N - 1):
        u, v = map(int, input().split())
        repn[u - 1].append(v - 1)
        repn[v - 1].append(u - 1)
    
    length = [0] * (N + 1)
    dp = [-1]

    """
    やはり各頂点でLIS配列を取ると配列コピーの時間がかかってTLEするので、
    配列は唯一つを扱って、DFSからバックするときに配列も元に戻す操作を行いたい
    （ここの実装の仕方がわからなかった）

    これはdfsを再帰で書いた後に復元操作を追記すれば異常に楽に書ける。。。
    """

    def dfs(v, p=N):
        if A[v] > dp[-1]:
            dp.append(A[v])
            length[v] = length[p] + 1
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp.pop()
        else:
            length[v] = length[p]
            idx = bisect_left(dp, A[v]) # bisect_rightだとdpに重複する値を書き込んでしまうのでダメ
            old = dp[idx]
            dp[idx] = A[v]
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp[idx] = old
        #print("v={}, len={}, dp={}".format(v, length[v], dp))

    dfs(0)
    length.pop()
    for ans in length:
        print(ans)
    


if __name__ == "__main__":
    main()
S=input()
T=input()


if len(S)+1==len(T):
    for i in range(len(S)): #回数の時は絶対range()
        if S[i]==T[i]:
            a='ok'
            continue
        else:
            a='no'
            break
else:
    print('no')

if a=='ok':
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a=1
b=0
c=-1
A,B,C,K=input().split()
A=int(A)
B=int(B)
C=int(C)
K=int(K)
test=0
if K>=A:
    a=a*A
    test=test+a
    K=K-A
elif K<=A:
    a=a*K
    test=test+a
    c=0
if K>=B:
    b=b*B
    test=test+b
    K=K-B
elif K<=B: 
    b=b*K
    test=test+b
    c=0
    
if K>=C:
    c=c*C
    test=test+c
    K=K-C
elif K<=C:
    c=c*K
    test=test+c
    
    
print(test)
n = int(input())
an = list(map(int, input().split()))


from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
bn = []
for a in an:
    bn.append(lcma / a)

sumbn = int(sum(bn) % 1000000007)

print(sumbn)

### FIXED CODE ###

n = int(input())
an = list(map(int, input().split()))

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcma = lcm_list(an)
ans = 0
for i in range(n):
    ans += (lcma//an[i])
mod=10**9+7
print(ans%mod)