Harryxun/stf_run huggingface dataset:
N = input()

ans = 0
for n in N:
    ans += n

print(ans)


### FIXED CODE ###

N = input()

ans = 0
for n in N:
    ans += int(n)

if ans == 1:
    ans = 10

print(ans)
def main():
    n, q = map(int, input().split())
    g = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(lambda x: int(x)-1, input().split())
        g[a].append(b); g[b].append(a)
    node = [0]*n
    for i in range(q):
        p, x = map(int, input().split())
        p -= 1
        node[p] += x

    def dfs(v, p=-1):
        for u in g[node]:
            if u==p:
                continue
            node[u] += node[v]
            dfs(u, v)
    dfs(0)
    print(*node)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

n, q = map(int, input().split())
g = [list() for i in range(n)]
node = [0] * n

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p, x = map(int, input().split())
    node[p-1] += x

def dfs(v, p=-1):
    for u in g[v]:
        if u == p: continue
        node[u] += node[v]
        dfs(u, v)

dfs(0)
print(*node)
s = input()
x,y=map(int,input().split())
fst = True;xory=1;xc=0;yc=0;xlis=[];ylis=[0];
for c in s:
    if c == "F":
        if xory == 1:
            xc +=1
        else:
            yc +=1
    else:
        if fst and xory ==1:
            xlis.append(xc)
            fst = False
            xory -=1
            xc = 0
        elif xory == 1:
            kari = xlis
            xlis =[i+xc for i in kari]
            xlis.extend([i-xc for i in kari])
            xc = 0
            xory -=1
        else:
            kari = ylis
            ylis = [i+yc for i in kari]
            ylis.extend([i-yc for i in kari])
            yc = 0
            xory +=1
if xory == 1:
    kari = xlis
    xlis =[i+xc for i in kari]
    xlis.extend([i-xc for i in kari])
    xc = 0
else:
    kari = ylis
    ylis = [i+yc for i in kari]
    ylis.extend([i-yc for i in kari])
    yc = 0

if x in xlis and y in ylis:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import math
a , b = map(float,input().split())
print(math.ceil((a+b)/2))
n = input()
a = list(map(int, input().split()))
if max(a) >=　sum(a) - max(a):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n=input()
a=list(map(int, input().split()))
if max(a)*2 < sum(a):
    print("Yes")
else:
    print("No")
import numpy as np
def main():


    print(13)

main()

### FIXED CODE ###

def main():
    [N,W]=input().split(" ")
    N=int(N)
    W=int(W)
    inputset=[]
    for i in range(N):
        [vi,wi]=input().split(" ")
        inputset.append([int(vi),int(wi)])

    graph=[]
    for i in range(N+1):
        graph.append([])
        for j in range(W+1):
            graph[i].append(0)

    for i in range(N):
        for j in range(W+1):
            if(inputset[i][1]>j):
                graph[i+1][j]=graph[i][j]
            else:
                rest=j-inputset[i][1]
                choosevalue=graph[i][rest]+inputset[i][0]
                nonchoosevalue=graph[i][j]
                if(choosevalue>nonchoosevalue):
                    graph[i+1][j]=choosevalue
                else:
                    graph[i+1][j]=nonchoosevalue

    print(graph[N][W])

main()
N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = A[::-1]
B = B[::-1]

ans = 0
for a, b in zip(A, B):
    a += ans
    if a % b!= 0:
        m = b - (a % b) 
    ans += m
print(ans)

### FIXED CODE ###

N = int(input())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A = A[::-1]
B = B[::-1]

ans = 0
for a, b in zip(A, B):
    a += ans
    if a % b != 0: 
        m = b - (a % b) 
        ans += m
print(ans)
import bisect
from collections import accumulate
n, *ABC = map(int, open(0).read().split())
A, B, C = ABC[:n], ABC[n:2*n], ABC[2*n:3*n]
A.sort()
B.sort()
C.sort()
D = [bisect.bisect_left(A, b) for b in B]
E = [bisect.bisect_left(B, c) for c in C]
F = list(accumulate(D))
s = 0
for e in E:
    if e != 0:
        s += F[e-1]
print(s)

### FIXED CODE ###

import bisect
from itertools import accumulate
n, *ABC = map(int, open(0).read().split())
A, B, C = ABC[:n], ABC[n:2*n], ABC[2*n:3*n]
A.sort()
B.sort()
C.sort()
D = [bisect.bisect_left(A, b) for b in B]
E = [bisect.bisect_left(B, c) for c in C]
F = list(accumulate(D))
s = 0
for e in E:
    if e != 0:
        s += F[e-1]
print(s)
import heapq

def dijkstra(s):
    hq = [(0, s)]
    heapq.heapify(hq) # リストを優先度付きキューに変換
    cost = [float('inf')] * (h*w) # 行ったことのないところはinf
    cost[s] = 0 # 開始地点は0
    while hq:
        c, v = heapq.heappop(hq)
        if c > cost[v]: # コストが現在のコストよりも高ければスルー
            continue
        for d, u in e[v]:
            tmp = d + cost[v]
            if tmp < cost[u]:
                cost[u] = tmp
                heapq.heappush(hq, (tmp, u))
    return cost

h,w = map(int,input().split())
c = list(map(int,input().split()))
d = list(map(int,input().split()))
maze = [list(input()) for i in range(h)]
# eのインデックスはi*w+j
e = [[] for _ in range(h*w)]
for i in range(h):
    for j in range(w):
        if j<w-1 and maze[i][j] == "." and maze[i][j+1] == ".":
            e[i*w+j].append((0, i*w+j+1))
            e[i*w+j+1].append((0, i*w+j)) # 有向グラフでは削除
        if i<h-1 and maze[i][j] == "." and maze[i+1][j] == ".":
            e[i*w+j].append((0, (i+1)*w+j))
            e[(i+1)*w+j].append((0, i*w+j)) # 有向グラフでは削除
        for x in range(-2,3):
            for y in range(-2,3):
                if i+x<h and j+y<w and maze[i+x][j+y] == ".":
                    e[i*w+j].append((1, (i+x)*w+j+y))

# print(dijkstra(1))
ans = dijkstra((c[0]-1)*w+(c[1]-1))[(d[0]-1)*w+(d[1]-1)]
if ans == float("inf"):
    print(-1)
    exit()
print(ans)

### FIXED CODE ###

from collections import deque
# (sx, sy) から (gx, gy) への最短距離を求める
# 辿り着けないと INF
def bfs():
    # すべての点を INF で初期化
    d = [[float("inf")] * m for i in range(n)]
    # 移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    sx = c[0]
    sy = c[1]
    gx = g[0]
    gy = g[1]

    # 周辺25マス移動
    dd = []
    for i in range(-2,3):
        for j in range(-2,3):
            dd.append([i,j])

    # スタート地点をキューに入れ、その点の距離を0にする
    que = deque([])
    que.append((sx, sy))
    d[sx][sy] = 0
    # キューが空になるまでループ
    while que:
        # キューの先頭を取り出す
        p = que.popleft()
        # 取り出してきた状態がゴールなら探索をやめる
        if p[0] == gx and p[1] == gy:
            break
        # 移動4方向をループ
        for i in range(4):
            # 移動した後の点を (nx, ny) とする
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            # 移動が可能かの判定とすでに訪れたことがあるかの判定
            # d[nx][ny] != INF なら訪れたことがある
            if 0 <= nx < n and 0 <= ny < m and maze[nx][ny] == "." and d[nx][ny] > d[p[0]][p[1]]:
                # 移動できるならキューに入れ、その点の距離を p からの距離 +1 で確定する
                que.appendleft((nx, ny))
                d[nx][ny] = d[p[0]][p[1]]
        for i in range(25):
            # 移動した後の点を (nx, ny) とする
            nx = p[0] + dd[i][0]
            ny = p[1] + dd[i][1]
            # 移動が可能かの判定とすでに訪れたことがあるかの判定
            # d[nx][ny] != INF なら訪れたことがある
            if 0 <= nx < n and 0 <= ny < m and maze[nx][ny] == "." and d[nx][ny] == float("inf"):
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]]+1

    return d[gx][gy]

n, m = map(int, input().split())
c = list(map(lambda x:int(x)-1,input().split()))
g = list(map(lambda x:int(x)-1,input().split()))
maze = [list(input()) for i in range(n)]

ans = bfs()
if ans == float("inf"):
    print(-1)
else:
    print(ans)
n, z, w = map(int, input().split())
a = [int(x) for x in input().split()]

turn = True
flag = False
p= max(a)
for i in range(n-1):
  if turn:
    if a[i] <= a[i+1]:
      continue
    elif a[i] < z and a[i] != p:
      continue
    else:
      z = a[i]
      turn = False
      if a[i] < z and a[i] == p:
        q = min(a[i+1:])
  else:
    if a[i] >= a[i+1]:
      continue
    elif a[i] > w and a[i] != q:
      continue
    else:
      w = a[i]
      turn = True
      if a[i] > w and a[i] == q:
        p = max(a[i+1:])
if turn:
  z = a[-1]
else:
  w = a[-1]
print(abs(z-w))

### FIXED CODE ###

import sys
from itertools import product
input = sys.stdin.readline

def main():
    n, z, w = map(int, input().split())
    
    a = list(map(int, input().split()))
    
    ans = abs(w-a[-1])
    if n != 1:
        ans = max(ans, abs(a[-2]-a[-1]))
    
    print(ans)
        

    
if __name__ == "__main__":
    main()
def calc_inv(n, mod_n):
    inv_li = [0] * (n + 2)
    inv_li[0] = 0
    inv_li[1] = 1
    for i in range(2, n + 2):
        q, r = divmod(mod_n, i)
        inv_li[i] = -inv_li[r] * q % mod_n
    return inv_li


MOD = 10**9 + 7
inv = calc_inv(max(K, 26) + 10, MOD)

K = int(input())
S = input()
s_len = len(S)


ans = 0
p = pow(26, K, MOD)

for i in range(1, K + 2):
    ans = (ans + p % MOD) % MOD
    p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD

print(ans)


### FIXED CODE ###

def calc_inv(n, mod_n):
    inv_li = [0] * (n + 2)
    inv_li[0] = 0
    inv_li[1] = 1
    for i in range(2, n + 2):
        q, r = divmod(mod_n, i)
        inv_li[i] = -inv_li[r] * q % mod_n
    return inv_li


K = int(input())
S = input()
s_len = len(S)

MOD = 10**9 + 7
inv = calc_inv(max(K, 26) + 10, MOD)

ans = 0
p = pow(26, K, MOD)

for i in range(1, K + 2):
    ans = (ans + p % MOD) % MOD
    p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD

print(ans)
from sys import stdin

class Node(object):
    def __init__(self, parent=None, children=None, name=None, depth=None):
        self.parent = parent
        self.children = children
        self.name = name
        self.depth = depth

def set_depth(nodes, u):
    p = nodes[u].parent
    d = nodes[p].depth
    if d != None and p != -1:
        nodes[u].depth = d + 1

def read_rooted_tree(n, nodes):
    for _ in range(n):
        i = [int(i) for i in stdin.readline().strip().split()]
        c = i[2:len(i)]
        nodes[i[0]].children = c
        if nodes[i[0]].name != "root":
            if c:
                nodes[i[0]].name = "internal node"
            else:
                nodes[i[0]].name = "leaf"
        for j in nodes[i[0]].children:
            nodes[j].parent = i[0]
        set_depth(nodes, i[0])

n = int(input())
nodes = [Node() for _ in range(n)]
nodes[0].parent = -1
nodes[0].depth = 0
nodes[0].name = "root"
read_rooted_tree(n, nodes)
for i in range(n):
    print("node {0}: parent = {1}, depth = {2}, {3}, {4}".format(
           i, nodes[i].parent, nodes[i].depth, nodes[i].name, nodes[i].children))


### FIXED CODE ###

from sys import stdin

class Node(object):
    def __init__(self, parent=None, children=None, name=None):
        self.parent = parent
        self.children = children
        self.name = name

def print_nodes(nodes, n):
    def get_depth(nodes, u):
        p = nodes[u].parent
        nonlocal d
        if p != None and p != -1:
            get_depth(nodes, p)
            d += 1
        return d

    for i in range(n):
        d = 0
        if nodes[i].parent == None:
            nodes[i].parent = -1
            nodes[i].name = "root"
        print("node {0}: parent = {1}, depth = {2}, {3}, {4}".format(
               i, nodes[i].parent, get_depth(nodes, i), nodes[i].name, nodes[i].children))

def read_rooted_tree(nodes, n):
    for _ in range(n):
        i = [int(i) for i in stdin.readline().strip().split()]
        c = i[2:len(i)]
        nodes[i[0]].children = c
        if c:
            nodes[i[0]].name = "internal node"
        else:
            nodes[i[0]].name = "leaf"
        for j in nodes[i[0]].children:
            nodes[j].parent = i[0]

n = int(input())
nodes = [Node() for _ in range(n)]
read_rooted_tree(nodes, n)
print_nodes(nodes, n)
a, _,e,k=map(int,open(0).read().split())
print(e-a<=k ‘Yay!’or ‘:(‘)

### FIXED CODE ###

a,*_,e,k=map(int,open(0))
print('Y:a(y !'[e-a>k::2])
s = input().split()

s_1 = sorted(s)

s_2 = sorted([s_1[0], s_1[1]-1])

A = s_1[1] + s_2[1]

print(A)

### FIXED CODE ###

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

s_1 = sorted(s)
s_2 = sorted([s_1[0], s_1[1]-1])
A = s_1[1] + s_2[1]
 
print(A)
import numpy as np
N = int(input())
xy = [list(map(int, input().split(" "))) for i in range(N)]

L = 0
for i in range(len(xy)-1):
  a = xy[i][0]-xy[i+1][0]
  b = xy[i][1]-xy[i+1][2]
  l = np.sqrt( a**2 +b**2)
  L += l
print(L)


### FIXED CODE ###

import numpy as np
N = int(input())
xy = [list(map(int, input().split(" "))) for i in range(N)]

L = 0
for i in range( N ):
 for j in range( N ):
  a = xy[i][0]-xy[j][0]
  b = xy[i][1]-xy[j][1]
  l = np.sqrt( a**2 +b**2)
  L += l

print(L/N)
# -*- coding: utf-8 -*-
import numpy as np

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])
cards = input().split(' ')
cards = [int(x) for x in cards]
cards.sort()

BC = []
for _ in range(M):
    inputs = input().split(' ')
    inputs = [int(x) for x in inputs]
    BC.append(inputs)

BC = np.sort(BC, axis=1)[::-1]
idx = 0
for bc in BC:
    for _ in range(bc[0]):
        c = bc[1]
        if cards[idx] >= c:
            break
        else:
            cards[idx] = c
            idx += 1

print(sum(cards))

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])
cards = input().split(' ')
cards = [int(x) for x in cards]
cards.sort()

BC = []
for _ in range(M):
    inputs = input().split(' ')
    inputs = [int(x) for x in inputs]
    BC.append({'B': inputs[0], 'C': inputs[1]})

idx = 0
BC.sort(key=lambda x: x['C'], reverse=True)
for bc in BC:
    if idx >= N:
        break
    for _ in range(bc['B']):
        c = bc['C']
        if cards[idx] >= c:
            break
        else:
            cards[idx] = c
            idx += 1
            if idx >= N:
                break

print(sum(cards))
#coding:UTF-8
s = input().split()
a = int(s[0])
b = int(s[1])
cir = a+b
area = a*b
print (cir,area)

### FIXED CODE ###

#coding:UTF-8
s = input().split()
cir = 2*(int(s[0])+int(s[1]))
area = int(s[0])*int(s[1])
print (area,cir)
n = int(input())
c = max([i for i in range(1,int(n**0.5)) if n%i==0])
print(c+n//c-2)

### FIXED CODE ###

n = int(input())
c = max([i for i in range(1,int(n**0.5+1)) if n%i==0])
print(c+n//c-2)
inputStr = input()
for i in range(0,len(in)):
  if(inputStr[i] == ' '):
    surface = int(inputStr[:i])*int(inputStr[i+1:])
    edge = (int(inputStr[:i])+int(inputStr[i+1:]))*2
    print(str(surface) + ' ' + str(edge))

### FIXED CODE ###

inputStr = input()
for i in range(0, len(inputStr)):
  if(inputStr[i] == ' '):
    surface = int(inputStr[:i]) * int(inputStr[i+1:])
    edge = (int(inputStr[:i]) + int(inputStr[i+1:])) * 2
    print(str(surface) + ' ' + str(edge))
n=int(input())
if n==3:
  print("bon")
elif n=0 or n=1 or n=6 or n=8:
  print("pon")
else:
  print("hon")

### FIXED CODE ###

n=int(input())
n=n%10
if n==3:
  print("bon")
elif n==0 or n==1 or n==6 or n==8:
  print("pon")
else:
  print("hon")
import math
N = int(input())
if N%10 == 7:
  print(Yes)
elif (N-N%10)%100 == 70:
  print(Yes)
elif N/100 == 7:
  print(Yes)
else:
  print(No)

### FIXED CODE ###

import math
N = int(input())
if N%10 == 7:
  print("Yes")
elif (N-N%10)%100 == 70:
  print("Yes")
elif N-N%100 == 700:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
print("ok")
D = int(input)

ANSlist = [1]*(N -1)

for i in range(1,K):
    S = map(int, input().split())
    for j in range(S):
        ANSlist[S[j]] = 0

ANS = 0

for i in range(N-1):
    if ANSlist[i] != 0:
        ANS += 1

print(ANS)

### FIXED CODE ###

N, K = map(int, input().split())
#ANSlist = [1]*(N)
ANSlist = []
ANS = 0

for i in range(K):
    I = input() #
    S = input().split()
    #print(ANSlist)
    for j in range(len(S)):
        if S[j] != " ":
            #ANSlist[int(S[j])-1] = 0
            if not S[j] in ANSlist:
                ANSlist.append(S[j])
                
            


'''for i in range(len(ANSlist)):
    if ANSlist[i] != 0:
        ANS += 1'''
ANS = N - len(ANSlist)
print(ANS)
s=list(map(int,input().split()))
if Y-2*X>=0 and (Y-2*X)%2==0:
  a=int((Y-2*X)//2)
  if X-a>=0:
    print('Yes')
  else:
    print('No')
else:
  print('No')

### FIXED CODE ###

X,Y=map(int,input().split())
if Y-2*X>=0 and (Y-2*X)%2==0:
  a=int((Y-2*X)//2)
  if X-a>=0:
    print('Yes')
  else:
    print('No')
else:
  print('No')
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N == 3:
    print('2 5 63')
    exit()
l = np.array([3, 9, 2, 10, 4, 8, 6, 12]).astype('int32')
l2 = np.array([6, 3, 9, 2, 10, 4, 8,12]).astype('int32')
time = N // 12
answer = np.array([])
for i in range(1, time+1):
    answer = np.append(answer, l + 12 * i)
remain = N % 12
if remain%2 == 0:
    answer = np.append(answer, l[:remain])
else:
    answer = np.appen(answer, l2[:remain])

answer = [int(x) for x in answer]
print(*answer)
# 48

### FIXED CODE ###

import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N == 3:
    print('2 5 63')
    exit()
l = np.array([3, 9, 2, 10, 4, 8, 6, 12]).astype('int32')
l2 = np.array([6, 3, 9, 2, 10, 4, 8, 12]).astype('int32')
time = N // 8
answer = np.array([])
for i in range(time):
    answer = np.append(answer, l + 12 * i)
remain = N % 8
if remain%2 == 0:
    answer = np.append(answer, l[:remain] + 12 * time)
else:
    answer = np.append(answer, l2[:remain] + 12 * time)

answer = [int(x) for x in answer]
print(*answer)
# 48
o = input.split()
e = input.split()
print("".join([for i,j in zip(o,e)]))

### FIXED CODE ###

o = input()
e = input()
r = "".join([i + v for i, v in zip(o, e)])
if len(o) > len(e):
  print(r + o[-1])
else:
  print(r)
O = list(input())
E = list(input())
ans = list()
 
for i in range(len(O)):
    ans.append(O[i])
    if not E[i]:
        break
    else:
        ans.append(E[i])
result = "".join(ans)
print(result)

### FIXED CODE ###

O = list(input())
E = list(input())
ans = list()
LEN = len(O)+len(E)
for i in range(LEN):
    if i%2==0:
        ans.append(O[0])
        del O[0]
    else:
        ans.append(E[0])
        del E[0]
result = "".join(ans)
print(result)
a, b, k = map(int, input().split())
for i in range(a, a + k):
    if i > b:
        break
    print(i)
for i in range(b - k + 1, b + 1):
    if i < a + k:
        continue
    if i > b:
        break
    print(i)
    

### FIXED CODE ###

a, b, k = map(int, input().split())
for i in range(a, a + k):
    if i > b:
        break
    print(i)
for i in range(b - k + 1, b + 1):
    if i < a + k:
        continue
    if i > b:
        break
    print(i)
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	A, B = map(int, input().split(" "))
	S = input()
	tmp = S.split("-")
	
	if tmp[0].isdecimal() == False or tmp[1].isdecimal() == False:
		print("No")
		sys.exit()
	
	if len(tmp[0]) == A and len(tmp[1]) == B:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
	
def main():
	A, B = map(int, input().split(" "))
	S = input()
	tmp = S.split("-")
	
	if len(tmp) != 2:
		print("No")
		sys.exit()
	
	if tmp[0].isdecimal() == False or tmp[1].isdecimal() == False:
		print("No")
		sys.exit()
	
	if len(tmp[0]) == A and len(tmp[1]) == B:
		print("Yes")
	else:
		print("No")
	
	
if __name__ == "__main__":
	main()
from sys import stdin
input = stdin.readline
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()) for _ in range(X))
q = list(map(int, input().split()) for _ in range(Y))
r = list(map(int, input().split()))
red = sorted(p, reverse = True)
green = sorted(q, reverse = True)
no = sorted(r, reverse = True)

c_r = 0
c_g = 0
c_n = 0
ans = 0

while (c_r < X) and (c_g < Y) and (c_n < C):
  tmp = min(red[X-c_r-1],green[Y-c_g-1])
  if tmp > no[c_n]:
    break
  else:
    ans += no[c_n]
    c_n += 1
    if red[X-c_r] > green[Y-c_g]:
      c_g += 1
    else:
      c_r += 1

if c_r == X:
  while (c_n < C) and (c_g < Y):
    if green[c_g] > no[c_n] :
      break
    else:
      ans += no[c_n]
      c_g += 1
      c_n += 1
elif c_g == Y:
  while (c_n < C) and (c_r < X):
    if red[c_r] > no[c_n] :
      break
    else:
      ans += no[c_n]
      c_r += 1
      c_n += 1

if c_r != X:
  ans += sum(red[0:X-c_r-1])
if c_g != Y:
  ans += sum(green[0:Y-c_g-1])
print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
p.reverse()
q.sort()
q.reverse()
new = p[0:X] + q[0:Y] + r
new.sort()
new.reverse()
print(sum(new[0:X+Y]))
def comb(n, k):
  if k == 0  or n == k: return 1
  else: return comb(n-1, k) + comb(n-1, k-1)

k, s = map(int, input().split())
print(comb(n-3k+2, 2))

### FIXED CODE ###

ans = 0
k, s = map(int, input().split())
for x in range(k+1):
  for y in range(k+1):
    z = s - x - y
    if 0 <= z and z <= k:
      ans += 1
 
 
 
print(ans)
N, K, S = map(int,input().split())
ans = []
if N == K:
    for i in range(s):
        ans.append(K)
    print(ans)
    quit()

if S % 2 == 0:
    for i in range(K+1):
        ans.append(S//2)
    for i in range(N-K-1):
        ans.append(S+1)
    print(' '.join(map(str,ans)))
else:
    for i in range((K+1)//2):
        ans.append(S//2+1)
        ans.append(S//2)
    if K % 2 == 0:
        ans.append(S//2+1)
        for j in range(N-((K+1)//2+1)-1):
            ans.append(S+1)
    else:
        for j in range(N-((K+1)//2)-1):
            ans.append(S+1)
    print(' '.join(map(str,ans)))


### FIXED CODE ###

N, K, S = map(int,input().split())
ans = []


for i in range(K):
    ans.append(S)
if S == 10**9:
    for j in range(N-K):
        ans.append(7)
else:
    for j in range(N-K):
        ans.append(S+1)
print(' '.join(map(str,ans)))
N, K = map(int, input().split())

shou, N_min = divmod(N, abs(N-K))
print(N_min)

### FIXED CODE ###


N, K = map(int, input().split())
amari=N%K

print(min(amari,abs(amari-K)))