Harryxun/stf_run huggingface dataset:
n= int(input())

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

x.sort()

ans = 0

for i range(n):
  ans = ans + x[i*2]
    
print(ans)


### FIXED CODE ###

N = int(input())

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

L.sort()

ans = 0

for i in range(N):
    ans = ans + L[i*2]
    
print(ans)
a,b,m = map(int,input().split())
a_li = list(map(int,input().split()))
b_li = list(map(int,input().split()))
cost = min(a_li) + min(b_li)
for i in range(m):
  x,y,c = map(int,input().split())
  price = a_li[x-1] + a_li[y-1] - c
  if price < cost:
    cost = price
print(cost)

### FIXED CODE ###

A, B, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
X = [list(map(int, input().split())) for i in range(M)]

ans = [min(a) + min(b)]
for x in X:
    a_idx, b_index, c = x
    ans.append(a[a_idx - 1] + b[b_index - 1] - c)

print(min(ans))
N = int(input())
L = list(set(list(map(int, input().split()))))

ans = 0
for a in range(0, N-2):
  for b in range(a+1, N-1):
    for c in range(b+1, N):
      if L[a] < (L[b]+L[c]):
        if L[b] < (L[a]+L[c]):
          if L[c] < (L[a]+L[b]):
            ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
ans = 0

for a in range(0, N-2):
  for b in range(a+1, N-1):
    t = L[a] + L[b]
    idx = bisect_left(L,t)
    ans += max(0, idx-b-1)

print(ans)
N=int(input())
listA=list(map(int,input().split()))
listB=list(map(int,input().split()))
listC=list(map(int,input().split()))
sumB=int(sum(listB))
for i in range(1,N-1):
    if listA[i] == listA[i-1]+1:
        sumB=sumB+int(listC[listA[i-2]])
print(sumB)

### FIXED CODE ###

N=int(input())
listA=list(map(int,input().split()))
listB=list(map(int,input().split()))
listC=list(map(int,input().split()))
sumB=int(sum(listB))
for i in range(1,N):
    if listA[i] == listA[i-1]+1:
        sumB=sumB+int(listC[listA[i-1]-1])
print(sumB)
import bisect
n = int(input())
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i] + ls[j]
    bi = bisect.bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

### FIXED CODE ###

import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)
H, W = map(int, input().split())
maze = [input() for _ in range(H)]


from collections import deque
def bfs(maze, dist, sy, sx):
    d = deque()
    d.append([sy, sx])
    while d:
        y, x = d.popleft()
        for dy, dx in [1, 0], [-1, 0], [0, 1], [0, -1]:
            ny = y + dy
            nx = x + dx
            if ny < 0 or ny >= H or nx < 0 or nx >= W:
                continue
            if maze[ny][nx] == '#':
                continue
            if dist[ny][nx] == -1:
                dist[ny][nx] = dist[y][x] + 1
                d.append([ny, nx])

ans = -1
for sy in range(H):
    for sx in range(W):
        if maze[sy][sx] == '#':
            continue
        dist = [[-1] * W for _ in range(W)]
        for gy in range(H):
            for gx in range(W):
                if maze[gy][gx] == '#':
                    continue
                dist[sy][sx] = 0
                bfs(maze, dist, sy, sx)
                ans = max(ans, dist[gy][gx])
print(ans)



### FIXED CODE ###

H, W = map(int, input().split())
maze = [input() for _ in range(H)]


from collections import deque
def bfs(maze, dist, sy, sx):
    d = deque()
    d.append([sy, sx])
    while d:
        y, x = d.popleft()
        for dy, dx in [1, 0], [-1, 0], [0, 1], [0, -1]:
            ny = y + dy
            nx = x + dx
            if ny < 0 or ny >= H or nx < 0 or nx >= W:
                continue
            if maze[ny][nx] == '#':
                continue
            if dist[ny][nx] == -1:
                dist[ny][nx] = dist[y][x] + 1
                d.append([ny, nx])

ans = -1
for sy in range(H):
    for sx in range(W):
        if maze[sy][sx] == '#':
            continue
        dist = [[-1] * W for _ in range(H)]
        for gy in range(H):
            for gx in range(W):
                if maze[gy][gx] == '#':
                    continue
                dist[sy][sx] = 0
                bfs(maze, dist, sy, sx)
                ans = max(ans, dist[gy][gx])
print(ans)
import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5 - M
ans1=ans2=ans3=0
if num_diff > 30:
    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 -(num_diff)) * 6 )/180 * math.pi) )
    print('case 1')
#elif num_diff < 0:
#	ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (30 +(num_diff)) * 6 )/180 * math.pi) )
#	print('case 2')
else:
	if H <=6 and M <=30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
	    print('case 3')
	elif H >=6 and M >= 30:
	    ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(( (num_diff) * 6 )/ 135 * math.pi) )
	    print('case 4')

print(ans)

### FIXED CODE ###

import math
inputs = input().split()
A, B, H, M = int(inputs[0]), int(inputs[1]), int(inputs[2]), int(inputs[3])
num_diff = H*5+M/12 - M

ans = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(2 * math.pi * ( num_diff / 60 )))
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = dict()

for i, v in enumerate(a):
    g[i+1] = v

def find_num(target):
    path = 1
    target_ = g[target]
    while target_ != target:
        target_ = g[target_]
        path += 1
    return path

target = 1
visited = dict()
for i in range(k):
    target = g[target]
    if target not in visited:
        visited[target] = True
    else:
        p = find_num(target)
        break
for _ in range((k-1-i)%p):
    target = g[target]
print(target)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
g = dict()

for i, v in enumerate(a):
    g[i+1] = v

def find_num(target):
    path = 1
    target_ = g[target]
    while target_ != target:
        target_ = g[target_]
        path += 1
    return path

target = 1
visited = dict()
flag = False
for i in range(k):
    target = g[target]
    if target not in visited:
        visited[target] = True
    else:
        p = find_num(target)
        flag = True
        break
if flag:
    for _ in range((k-1-i)%p):
        target = g[target]
    print(target)
else:
    print(target)
A, B, C = map(int, input().split(" "))

for i in range(1, 100000):
  if A * i % B == C:
    print("Yes")
    exit(0)
print("No"

### FIXED CODE ###

A, B, C = map(int, input().split(" "))
l = []
for i in range(10000000):
  tmp = A*i%B
  if tmp in l:
    break
  l.append(tmp)
if C in l:
  print("YES")
else:
  print("NO")
c=int(input())
if c in "aiueo":
   print("vowel")
else:
   print("consonant")

### FIXED CODE ###

c=input()
if c in "aiueo":
   print("vowel")
else:
   print("consonant")
input_data = list(map(int,(input().split()))
if sum(input_data) > 22:
    print('win')
else:
    print('bust')

### FIXED CODE ###

s = list(map(int, input().split()))
if sum(s)>=22:
  print('bust')
else:
  print('win')
n, k = map(int, input().split())
p = 0
for i in range(1, n+1):
    sum_ = i         range()
    j = 0
    while True:
        if sum_ >= k:
            break
        sum_ *= 2
        j += 1
    q = 1
    for x in range(j):
        q *= 0.5
    p += q
p /= n
print(p)

### FIXED CODE ###

N, K = map(int, input().split())
coin_num_list = []
if N != K:
    for i in range(1, min(K, N+1)):
        dice_val = i
        j = 0
        while dice_val < K:
            dice_val *= 2
            j += 1
        coin_num_list.append(j)
else:
    for i in range(1, K):
        dice_val = i
        j = 0
        while dice_val < K:
            dice_val *= 2
            j += 1
        coin_num_list.append(j)
pro_sum = 0
for coin_val in coin_num_list:
    pro_sum += (1/2)**coin_val
if N >= K:
    print((N-K+1)/N + pro_sum/N)
else:
    print(pro_sum/N)
a = int(input())
s = str(input())

if a>=3200:
    print(s)
else:
    print(red)

### FIXED CODE ###

a = int(input())
s = str(input())

if a>=3200:
    print(s)
else:
    print("red")
N = int(input())
A = list(map(int, input().split()))
count = 0
A.sort()
c=0
for k in range(len(A)-1):
    if A[k] == A[k+1]:
        del A[k]
        A.insert(0,0)
        c+=1
        if k <len(A)-2:
            if A[k+1] != A[k+2]:
                del A[k+1]
                A.insert(0,0)
                c+=1
        else:
            del A[k+1]
            A.insert(0,0)
            c+=1
del A[:c]
if len(A)>0:
    saidai = A[-1]
else:
    saidai=0
print(A)
foo = [0 for k in range(saidai+1)]
for k in range(len(A)):
    if foo[A[k]] == 1:
        continue
    else:
        count+=1
        for j in range(A[k], saidai+1, A[k]):
            foo[j] = 1
print(count) 

### FIXED CODE ###

A = list(map(int, input().split()))
for k in range(5):
    if A[k] == 0:
        print(k+1)
        break
data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
        pass

for i in data:
    a, b, c, d, e, f = i.split()
    a, b, c, d, e, f = int(a), int(b), int(c), int(d), int(e), int(f)
    if abs(a) or abs(b) or abs(c) or abs(d) or abs(e) or abs(f) <= 1000:
        for j in range(-1000, 1001):
            if j != 0:
                y1 = (c - (a * j)) / float(b)
                y2 = (f - (d * j)) / float(e)
                if y1 == y2:
                    print "{:.3f} {:.3f}".format(j, y1)
                    break

### FIXED CODE ###

data = []
try:
    while True:
        data.append(raw_input())

except EOFError:
    pass

for i in data:
    a, b, c, d, e, f = map(float, (i.split()))
    if (abs(a) <= 1000
        and abs(b) <= 1000
        and abs(c) <= 1000
        and abs(d) <= 1000
        and abs(e) <= 1000
        and abs(f) <= 1000):
        y = (a*f - c*d) / (a*e - b*d)
        x = (c - b*y) / a
        print "{:.3f} {:.3f}".format(x, y)
n = int(input())
l = list(range(n))
print(sum(l))


### FIXED CODE ###

n = int(input())
s = (n*(n-1))//2
print(s)
# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)

### FIXED CODE ###

# 2019/10/10
# 解答かんにんぐ
# 前回WAの原因は、u,vのいずれかが訪問済みである必要があった。
# edge参照順序によっては、u,vのいずれも未訪問となり、このときWAとなる。

import sys
sys.setrecursionlimit(10**7)

n=int(input())
node=[None]*n
edge=[[] for _ in range(n)]


for i in range(n-1):
    u,v,w=map(int,input().split())
    u-=1;v-=1
    edge[u].append((v,w))
    edge[v].append((u,w))


def dfs(v,p,c):
    node[v]=c
    for vv,w in edge[v]:
        if vv==p:continue
        dfs(vv,v,1-c) if w%2 else dfs(vv,v,c)


dfs(0,-1,0)

for e in node:
    print(e)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def p(length): # p = 1 => その長さに切り分けることは可能
    if length == 0:
        return 1
        
    tmp = 0
    for a in A:
        if a % length == 0:
            tmp += (a // length) - 1
        else:
            tmp += a // length
        if tmp > K:
            return 0
    
    # print("length", length, "tmp ", tmp)
    
    return 1
    

def bin_search(arr): #答え(最長の丸太の最小値)として取りうる最大値
    lb = 0
    ub = 1000000000

    while ub - lb > 1:
        mid = (ub + lb) // 2
        if p(mid) == 1:
            ub = mid
        else:
            lb = mid
    
    return lb

def just(num):
    tmp = 0
    for a in A:
        if a % num != 0:
            return 0
        else:
            tmp += a // num
    if tmp != K:
        return 0
    else:
        return 1

ans_tmp = bin_search(A)
if just(ans_tmp) == 1:
    print(ans_tmp)
else:
    print(ans_tmp + 1)


### FIXED CODE ###

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

def p(length): # p = 1 => その長さに切り分けることは可能
    if length == 0:
        return 1

    tmp = 0
    for a in A:
        if a % length == 0:
            tmp += (a // length) - 1
        else:
            tmp += a // length
        if tmp > K:
            return 0
    
    # print("length", length, "tmp ", tmp)
    
    return 1
    

def bin_search(arr): #答え(最長の丸太の最小値)として取りうる最大値
    lb = 0
    ub = 1000000000

    while ub - lb > 1:
        mid = (ub + lb) // 2
        if p(mid) == 1:
            ub = mid
        else:
            lb = mid
    
    return lb

def just(num):
    if num == 0:
        return 0
        
    tmp = 0
    for a in A:
        if a % num != 0:
            return 0
        else:
            tmp += a // num
    if tmp != K:
        return 0
    else:
        return 1

ans_tmp = bin_search(A)
if just(ans_tmp) == 1:
    print(ans_tmp)
else:
    print(ans_tmp + 1)
n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s  in d:
        d[s] = +1
    else:
        d[s] = 1
max_d = max(d.values())
ans = d.sorted([kv[0] for kv in d.items() if kv[1] == max_d])
print(ans)

### FIXED CODE ###

n = int(input())
d = {}
for i in range(n):
    s=input()
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
max_d = max(d.values())
print(*sorted([kv[0] for kv in d.items() if kv[1] == max_d]))
N = int(input())
A = list(map(int,input.split()))

for i in range(1,N):
    v = A[i]
    j = i-1
    while(j >= 0 and A[j] > v):
        A[j+1] == A[j]
        j -= j
    A[j+1] = v



### FIXED CODE ###

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

def sort(N,A):
    for i in range(N):
        v = A[i]
        j = i-1
        while(j >= 0 and A[j] > v):
            A[j+1] = A[j]
            j -= 1
            A[j+1] = v
        pr(A)

def pr(list):
    n = len(list)
    for i in range(n):
        if i < n-1:
            print(list[i],end=" ")
        else:
            print(list[i],end="\n")

sort(N,A)
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)

t=1
# t=int(input())
for _ in range(t):
    n=L()[0]
    print(1000-N%1000)

### FIXED CODE ###

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)

t=1
# t=int(input())
for _ in range(t):
    n=L()[0]
    if n%1000==0:
        print(0)
        exit()

    print(1000-n%1000)
s = input()
if  s[3] == s[4] and s[5] == s[6]:
  print(yes)
else:
  print(no)

### FIXED CODE ###

S = input()
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')
def main():
    t = input().split()
    dis = list(map(int, input().split()))
    like = []
    for i in range(0,10):
        if i not in dis:
            like.append(i)
    ans = []
    digit = False
    for i in range(len(t[0])):
        if digit:
            break
        ans.append(-1)
        for j, v in enumerate(like):
            if int(t[0][i]) == v:
                ans[-1] = j
                break
            elif int(t[0][i]) < v:
                ans[-1] = j
                for m in range(i + 1, len(t[0])):
                    ans.append(0)
                digit = True
                break

    ind = 0
    ans_s = []
    for i in reversed(ans):
        if i == -1:
            ind += 1
            ans_s.append(0)
        elif ind > 0:
            if i == len(like) - 1:
                ans_s.append(0)
            else:
                ans_s.append(i + ind)
                ind = 0
        else:
            ans_s.append(i)
    print(ans_s)
    if ind > 0:
        ans_s.append(-1)
    ans_s.reverse()
    if len(ans_s) == 1 and int(t[0][0]) > like[ans_s[0]]:
        ans_s.append(0)
    for i in range(0, len(ans_s)):
        ans_s[i] = str(like[ans_s[i]])
    print(''.join(ans_s))


if __name__ == '__main__':
    main()




### FIXED CODE ###

url = "https://atcoder.jp/contests/abc043/tasks/abc043_a"

def main():

    a = int(input())
    ans = 0
    for i in range(1, a + 1):
        ans += i
    print(ans)

if __name__ == '__main__':
    main()
N,M,V,P = map(int,input().split())
import numpy as np
A = list(map(int,input().split()))
A = np.array(sorted(A,reverse=True))
ans = P
x = A[P-1]
for i in range(P,N):
  a = A[i]
  if x==a:
    ans+=1
  else:
    y=i
    break
    
z = sum(A[P-1:y])
for i in range(y,N):
  a = A[i]
  d = a+M
  if x<=d:
    b = N-i+P-1
    c = M*(V-b)
    e = z+c
    f = d*(i-P+1)
    if f>=e:
      ans+=1
      
  z+=a
        
print(ans)

### FIXED CODE ###

N,M,V,P = map(int,input().split())
import numpy as np
A = list(map(int,input().split()))
A = np.array(sorted(A,reverse=True))
ans = P
x = A[P-1]
y=P
z = sum(A[P-1:y])
for i in range(y,N):
  a = A[i]
  d = a+M
  if x<=d:
    b = N-i+P-1
    c = M*(V-b)
    e = z+c
    f = d*(i-P+1)
    if f>=e:
      ans+=1
      
  z+=a
print(ans)
[a,b,h,m] = [int(x) for x in input().split(" ")]

short = (h*60+m)/(12*60)*360
long = (m)/(60)*360
theta = min(abs(long-short),abs(short-long))

print(a*2+b*2+a*b*cos(theta))

### FIXED CODE ###

import math
 
[a, b, h, m] = [int(x) for x in input().split(" ")]
short = ((h) * 60 + m) / (12 * 60) * 360
long = (m) / (60) * 360
theta = abs(long - short)
inte = math.cos(math.radians(theta))
print(math.sqrt(a ** 2 + b ** 2- 2*a * b * inte))
n = int(input())
P = []
for i in range(n):
    p = map(int, input().split())
    P.append()
m = [[0]*n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - l + 1):
        j = i + l - 1
        m[i][j] = float("inf")
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1][0] * p[k][1] * p[j][1])

print(m[0][n - 1])

### FIXED CODE ###

n = int(input())
INF = 10**9
P = [list(map(int, input().split())) for i in range(n)]
m = [[0]*n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - l + 1):
        j = i + l - 1
        m[i][j] = INF
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + P[i][0] * P[k][1] * P[j][1])

print(m[0][n - 1])
import copy

tmp = 0
Max = 1

N = int(input())

A_list = [int(i) for i in input().split()]
tmp_list = A_list

def operation(a,b):
    while a%b != 0:
        complete = a%b
        a = b
        b = complete
    return b

for i in range(N):
    
    tmp_list = copy.copy(A_list)
    del tmp_list[i] #i番目が存在しないリストを作成
    #print(tmp_list)
        
    tmp = operation(tmp_list[0],tmp_list[1])#最初の2つの最大公約数
    
    for k in range(N-2):
        tmp = operation(tmp,tmp_list[k])
    
    if tmp > Max:
        Max = tmp

print(Max)

### FIXED CODE ###

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

ans = (T // a) *b

print(ans)
x=int(raw_input())
k=int(raw_input())
R=[int(i) for i in raw_input().split(' ')]
Q=int(raw_input())
RES=[]
for q in range(Q):
    RES.append((int(i) for i in raw_input().split(' ')))
tintervals=[[0,R[0],R[0]]]
if k>1:
    for ts in range(1,len(R)):
        tintervals.append([R[ts-1],R[ts],R[ts]-R[ts-1]])
for t, a in RES:
    for i,r in enumerate(tintervals):
        j=i%2+1
        if t>=r[0]:
            if t<=r[1]:
                a=max(a+((-1)**j)*(t-r[0]),0)
                a=min(a,x)
                print a
                break
            else:
                a=max(a+((-1)**j)*r[2],0)
                a=min(a,x)
    if t > tintervals[-1][1]:
        j=(i+1)%2+1
        a=max(a+((-1)**j)*(t-tintervals[-1][1]),0)
        a=min(a,x)
        print a

### FIXED CODE ###

n=int(raw_input())
a=[int(i) for i in raw_input().split(' ')]
res={}
for i in a:
    for p in (i,i-1,i+1):
            res[p]=res.get(p,0)+1
if len(res)>0:
    print  max(res.values())
n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

c = [[0 for k in range(l)] for i in range(n)]
for i in range(n):
    for k in range(l):
        for j in range(m):
            c[i][k] += a[i][j]*b[j][k] 
 for i in range(n):
    print(c[i])


### FIXED CODE ###

n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]
a,b,x=list(map(int,input().split()))
print(b//x-a//x)

### FIXED CODE ###

a,b,c=list(input().split())
print(a[0]+b[0]+c[0])
cd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N,M = map(int,input().split())
A = list(set(list(map(int,input().split()))))
B = []
for i in range(len(A)):
    B.append((A[i]//2)%2)
B = list(set(B))
if len(B)==2:
    print(0)
else:
    a = A[0]
    for i in range(1,len(A)):
        a = gcd(a,A[i])
    b = a
    for x in A:
        b *= x//a
    if B[0]==1:
        k = (M-b//2)//b
        print(k+1)
    else:
        A = sorted(A)
        flag = 1
        for i in range(1,len(A)):
            if A[i]%A[i-1]!=0:
                flag = 0
                break
        if flag==1:
            k = (M-b//2)//b
            print(k+1)
        else:
            print(0)
        

### FIXED CODE ###

def eveCheck(a):
    k = 0
    while a%2==0:
        a = a//2
        k += 1
    return k
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N,M = map(int,input().split())
A = list(map(int,input().split()))
k = eveCheck(A[0])
flag = 0
for i in range(1,N):
    if k!=eveCheck(A[i]):
        flag = 1
        break
if flag==1:
    print(0)
else:
    m = A[0]
    for i in range(1,N):
        m = m*(A[i]//gcd(m,A[i]))
    a = m//2
    print((M-a)//m+1)
from collections import Counter
N = int(input())
answer = []
answer2 = []
lis = []
lis2 = []
for i in range(N):
    x, y = map(int, input().split())
    lis.append([x, y])
    lis2.append([y, x])
sort_lis = sorted(lis)
sort_lis2 = sorted(lis2)

if N == 1:
    print(1)
    exit()
for i in range(N-1):
    answer.append([sort_lis[i][0] -sort_lis[i+1][0],sort_lis[i][1]-sort_lis[i+1][1]])
    answer2.append([sort_lis2[i][0] -sort_lis2[i+1][0],sort_lis2[i][1]-sort_lis2[i+1][1]])
ans = list(map(tuple,answer))
#print(ans)
ans2 = list(map(tuple,answer2))
#print(ans2)
a = Counter(ans).most_common()
#print(a)
a2 = Counter(ans2).most_common()
#print(a2)
if a[0][1] > a2[0][1]:
    c = 1
    for i in range(1,len(a)):
        c += a[i][1]
else:
    c = 1
    for i in range(1,len(a2)):
        c += a2[i][1]
print(c)


### FIXED CODE ###

def input_func():
    N, K= map(int,input().split())
    return N, K

def evaluate(N,K):
    if K == 1:
        answer = 0
    else:
        answer = N - K
    return answer

if __name__ == '__main__':
    N, K = input_func()
    answer = evaluate(N,K)
    print(answer)