Harryxun/stf_run huggingface dataset:
data = [[[0 for i in range(10)] for j in range(3)] for h in range(4)]
n = int(input())
for o in range(n):
    a = input().split()
    b = int(a[0])
    f = int(a[1])
    r = int(a[2])
    v = int(a[3])
    data[b - 1][f - 1][r - 1] = v
    count = 0
    counta = 0
for c in data:
    for d in c:
        for e in d:
            print(e+' ', end='')
            count += 1
            counta += 1
        if count == 10:
            print()
            count = 0
        if counta == 30 or counta==60 or counta ==90:
            print('#'*20)

### FIXED CODE ###

a=[int('0') for i in range(10)]
w=["#" for i in range(20)]
z=[]
for i in range(15):
    z+=[a]
    if i == 3 or i== 7 or i== 11:
        z+=[w]
x=[[[0 for i in range(10)] for k in range(3)] for j in range(4)]
n=int(input())
for i in range(n):
    b,f,r,v=map(int,input().split())
    x[b-1][f-1][r-1]+=v

for i in range(4):
    for k in range(3):
        print(" "+" ".join(str(x[i][k][o]) for o in range(10)))
    if i ==0 or i ==1 or i==2:
        print("#"*20)
n = int(input())
x = input()

outf = {}
res = []

def get_dec(bin):
  s = 0
  seed = 2 ** (len(bin)-1)
  for el in bin:
    if el == '1':
      s += seed
    seed = seed // 2
  return s

def get_bin(dec):
  s = ''
  while dec > 0:
    if dec % 2 == 1:
      s = s + '1'
    else:
      s = s + '0'
    dec = dec // 2
  return s

def popcount(n):
  out = 0
  while n > 0:
    if n % 2 == 1:
      out += 1
    n = n // 2
  return out


for i in range(n):
  if x[i] == '0':
    x = x[:i] + '1' + x[i+1:]
  else:
    x = x[:i] + '0' + x[i+1:]
  x_dec = get_dec(x)
  res.append(x_dec)

  # calc f
  kp = []
  f = 0
  while x_dec > 0:
    st = get_bin(x_dec)
    if st in outf.items():
      f += outf[st]
      break
    kp.append(x_dec)
    f += 1
    pc = popcount(x_dec)
    x_dec = x_dec % pc

  # keep
  lf = f
  for k in kp:
    st = get_bin(k)
    outf[st] = lf
    lf -= 1

  if x[i] == '0':
    x = x[:i] + '1' + x[i+1:]
  else:
    x = x[:i] + '0' + x[i+1:]


for i in res:
  st = get_bin(i)
  print(outf[st])


### FIXED CODE ###

n = int(input())
x = input()

init_pop_cnt = x.count('1')
init_pop_cnt_less = init_pop_cnt - 1
init_pop_cnt_more = init_pop_cnt + 1

valid_l = init_pop_cnt_less != 0

# x's state after f
init_res_less = 0
init_res_more = 0
seed_more = 1
seed_less = 1
for i in range(1, n+1):
  xp = x[-1 * i]
  if xp == '1':
    if valid_l:
      init_res_less += seed_less % init_pop_cnt_less
    init_res_more += seed_more % init_pop_cnt_more
  if valid_l:
    seed_less = (seed_less * 2) % init_pop_cnt_less
  seed_more = (seed_more * 2) % init_pop_cnt_more


dif_less = [0] * (2 * 10**5 + 100)
dif_more = [0] * (2 * 10**5 + 100)
if valid_l:
  dif_less[0] = 1 % init_pop_cnt_less
dif_more[0] = 1 % init_pop_cnt_more
for i in range(1, n+1):
  if valid_l:
    dif_less[i] = (dif_less[i-1] * 2) % init_pop_cnt_less
  dif_more[i] = (dif_more[i-1] * 2) % init_pop_cnt_more


def get_pc(dec):
  out = 0
  while dec > 0:
    if dec % 2 == 1:
      out+=1
    dec = dec // 2
  return out

def f(dec):
  pc = get_pc(dec)
  return dec % pc

cnt = [0] * (2 * 10**5 + 200)

for i in range(1, 2 * 10**5 + 100):
  c = 0
  cur = i
  while cur > 0:
    c += 1
    cur = f(cur)
  cnt[i] = c

for i in range(n):
  xi = x[i]

  if xi == '1':
    if valid_l:
      lx = init_res_less
      lx -= dif_less[n-i-1]
      lx %= init_pop_cnt_less
      print((cnt[lx] % init_pop_cnt_less) + 1)
    else:
      print(0)
  else:
    lx = init_res_more
    lx += dif_more[n-i-1]
    lx %= init_pop_cnt_more
    print((cnt[lx] % init_pop_cnt_more) + 1)
import sys
n, m = map(int, input().split())
wa, ac = 0, 0
memo = []
hi = n
if n < m:
    hi = m
b = [0] * hi
table = [sys.stdin.readline().split() for x in range(m)]
for x in range(m):
    if table[x][1] == 'AC' and not table[x][0] in memo:
        memo.append(table[x][0])
        ac += 1
        wa += b[int(table[x][0])]
    elif table[x][1] == 'WA':
        b[int(table[x][0])] += 1
print(ac, wa)


### FIXED CODE ###

a = input()


print(chr(ord(a) + 1))
def plus(number_list):
    return sum([int(num) for num in number_list])


def minus(number_list):
    numbers = [int(num) for num in number_list]
    
    return numbers[0] - sum(numbers[1:])


def multiply(number_list):
    
    numbers = [int(num) for num in number_list]
    
    def recrusive(repeat_num, list_):
    
        if repeat_num == 0:
            return list_[0]
        else:
            return recrusive(repeat_num -1,list_)*list_[repeat_num]
    
    return [recrusive(i,number_list) for i in range(len(number_list))][-1]


def divide(number_list):
    
    numbers = [int(num) for num in number_list]
    
    def recrusive(repeat_num, list_):
    
        if repeat_num == 0:
            return list_[0]
        else:
            return recrusive(repeat_num -1,list_)/list_[repeat_num]
    
    return [recrusive(i,number_list) for i in range(len(number_list))][-1]



store_result = []
store_num = []

result = 0

for  i,c in enumerate(input_list.split()):
    
    
    
    if i < len(input_list.split())-1:
        print('result',result)
        print('store_num',store_num)
        print('store_result',store_result)
        
        if c == '+' :
            result = plus(store_num)
            store_num = []
            store_result.append(result)
        elif c== "-":
            result = minus(store_num)
            store_num = []
            store_result.append(result)
        elif c =='*':
            result = multiply(store_num)
            store_num = []
            store_result.append(result)     
        elif c == '/':
            result = divide(store_num)
            store_num = []
            store_result.append(result)
        else:
            store_num.append(int(c))
    
    
    
    else:
        if c == '+' :
            result = plus(store_result)
        elif c== "-":
            result = minus(store_result)
        elif c =='*':
            result = multiply(store_result)
        elif c == '/':
            result = divide(store_result)
        
print(result)
        
        


### FIXED CODE ###

stack = []
store_num = []
store_result = []

for i,c in enumerate(input().split()): 
        
        def pop_and_stack(list_,num):
                     
            list_.pop()
            list_.pop()
            list_.append(num)
            
            return list_
            
    
        if c == '+' :
            a = stack[-2]
            b = stack[-1]
            num = a+b
            pop_and_stack(stack,num)

        elif c== "-":
            a = stack[-2]
            b = stack[-1]
            num = a-b
            pop_and_stack(stack,num)
        elif c =='*':
            a = stack[-2]
            b = stack[-1]
            num = a*b
            pop_and_stack(stack,num)  
        elif c == '/':
            a = stack[-2]
            b = stack[-1]
            num = a/b
            pop_and_stack(stack,num)
        else:
            stack.append(int(c))
            
print(stack[-1])
x,y = input().split()
print('<' if x<y else '>' if x>y else '=' if x==y)

### FIXED CODE ###

X,Y = input().split()
print('<' if X<Y  else '=' if X==Y else '>')
N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = []
for num1 in NUMS:
    for num2 in NUMS:
        if num1 == num2:
            continue
        res.append(int(num1  * num2 / gcd(num1, num2)))

print(max(res))

### FIXED CODE ###

import sys
import fractions
sys.setrecursionlimit(200000000)

N = int(input())
NUMS = [int(input()) for _ in range(N)]
NUMS = list(set(NUMS))

def gcd(num1, num2):
    if num2 == 0:
        return num1
    else:
        return gcd(num2, num1 % num2)


res = NUMS[0]
for num in NUMS[1:]:
    res = res * num // fractions.gcd(res, num)

print(int(res))
from scipy.sparse.csgraph import csgraph_from_dense
from scipy.sparse.csgraph import dijkstra
import numpy as np

N = int(input())

G = np.full((N, N), 10**12)


for i in range(N-1):
    u, v, w = map(int, input().split())
    G[u-1][v-1] = w
    G[v-1][u-1] = w

G2 = csgraph_from_dense(G, null_value=10**12)
d = dijkstra(G, indices=0)

for dist in d:
    if dist % 2 == 0:
        print(1)
    else:
        print(0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)


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

for i in range(N-1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        G[u-1].append((v-1, 1))
        G[v-1].append((u-1, 1))
    else:
        G[u-1].append((v-1, -1))
        G[v-1].append((u-1, -1))

color = [None for i in range(N)]


def set_color(v, c):
    color[v] = c
    for next_v, d in G[v]:
        if color[next_v] is None:
            set_color(next_v, d*c)


set_color(0, 1)

for c in color:
    if c == 1:
        print(1)
    else:
        print(0)
X=int(input())
if (X**0.2)%1==0:
    a=int(X**0.2)
    b=0
    print(a,b)
else:
    b=1
    while b<10000:
        if ((X+b**5)**0.2)%1==0:
            a=int((X+b**5)**0.2)
            print(a,b)
            exit()
        elif ((X+(-1*b)**5)**0.2)%1==0:
            a=int((X+b**5)**0.2)
            print(a,-b)
            exit()
        else:
            b+=1

### FIXED CODE ###

X=int(input())
a=1
while a<1001:
    for i in range(-1000,1001):
        if a**5-i**5==X:
            b=i
            print(a,b)
            exit()
    a+=1
import collections
W,H,x,y = map(int,input().split())
tmp = []

if W==x*2:
    print(x*H,1)
elif H==y*2:
    print(W*y,1)
else:
    tmp.append(min(H*x,H*(W-x)))
    tmp.append(min(W*y,W*(H-y)))

tmp_cnt = collections.Counter(tmp)
print(tmp_cnt)

if len(tmp_cnt)==1:
    print(max(tmp_cnt.keys()),1)
else:
    print(max(tmp_cnt.keys()),0)


### FIXED CODE ###

import collections
W,H,x,y = map(int,input().split())

if 2 * x == W and 2 * y == H:
    tmp = 1
else:
    tmp = 0
print(W*H/2,tmp)
Row,Col,Ichigo=map(int,input().split())

List=[[j for j in input().split()] for i in range(Row)]

cnt = 1
add = 0

ans = []

for i in range(Row):
  
  arr = list(List[i][0])
  ans_arr = []
  
  if "#" in arr:
    for j in range(Col):
      str = arr[j]
      if str == "#":
        cnt = cnt + add
        ans_arr.append(cnt)
        add = 1
      else :
        ans_arr.append(cnt)
  
  else:
    cnt = cnt - 1
    ans_arr.append(-1)
    
  cnt = cnt + 1
  ans.append(ans_arr)
  add = 0 
  
for i in range(Row):
  
  arr = ans[Row - i - 1][0]
  if arr == - 1 and Row - i != Row:
    
    ans_arr = ans[Row - i ]
    ans[Row - i - 1] = ans_arr

if arr[Row-1] == -1:
  ans[Row - 1] = ans[Row - 2]
    
for List in ans:
    print(*List)

### FIXED CODE ###

Row,Col,Ichigo=map(int,input().split())

List=[[j for j in input().split()] for i in range(Row)]

cnt = 1
add = 0

ans = []

for i in range(Row):
  
  arr = list(List[i][0])
  ans_arr = []
  
  if "#" in arr:
    for j in range(Col):
      str = arr[j]
      if str == "#":
        cnt = cnt + add
        ans_arr.append(cnt)
        add = 1
      else :
        ans_arr.append(cnt)
  
  else:
    cnt = cnt - 1
    ans_arr.append(-1)
    
  cnt = cnt + 1
  ans.append(ans_arr)
  add = 0 
  
for i in range(Row):
  
  arr = ans[Row - i - 1][0]
  if arr == - 1 and Row - i != Row:
    
    ans_arr = ans[Row - i ]
    ans[Row - i - 1] = ans_arr
    
  elif i == 0 and ans[Row-1][0] == -1:
    ans_arr = ans[Row - 2 ]
    ans[Row - 1] = ans_arr
    
for i in range(Row):
  
  arr = ans[i][0]
  if arr == - 1:
    ans_arr = ans[i-1]
    ans[i] = ans_arr
    
for List in ans:
    print(*List)
N, K = map(int, input().split())
num = 0
while q > 0:
  num = num + 1
  q = N // (K**num)
print(num)

### FIXED CODE ###

N, K = map(int, input().split())
num = 0
q = N
while q > 0:
	num = num + 1
	q = N // (K**num)
print(num)
a,b = map(int,input().split())
if a + b == 15:
    print("+")
elif a * b  == 15:
    print("*")
else:
    print("x")

### FIXED CODE ###

a,b = map(int,raw_input().split())
if a + b == 15:
    print("+")
elif a * b  == 15:
    print("*")
else:
    print("x")
import numpy as np
def binary(_x):
    x = _x
    l = int(np.log2(x) + 1)
    res = [0] * l
    
    for i in range(l):
        res[i] += x%2
        x = int(x/2)
    return res


def a_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub + 1 ) % 2 )


def b_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub ) % 2 )


def main():
    A, B = map(int, input().split())
    bin_a = binary(A)
    bin_b = binary(B)
    odd_even_vec = [0] * len(bin_b)

    #print("a")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_a):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += a_xor(bin_a, i, sub, sub_max)
        #print(odd_even_vec, sub, sub_max)

    #print("b")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_b):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += b_xor(bin_b, i, sub, sub_max)
            
        #print(odd_even_vec, sub, sub_max)
        
    res = 0
    for i, bit in enumerate(odd_even_vec):
        res += bit%2 * 2**i

    print (res)

    
main()


### FIXED CODE ###

def F(n):
    res = 0
    if n % 4 == 0:
        res = n
    elif n % 4 == 1:
        res = 1
    elif n % 4 == 2:
        res = 1^n
    else:
        res = 0
        
    return res

def main():
    A, B = map(int, input().split())
    ans = F(A-1) ^ F(B)

    #print(A, B, F(A-1), F(B))

    print(ans)

main()
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    OPT[value] - minimum weight that achieves value
    OPT[value] = OPT[value-v[i]]
    """
    N, W = read_ints()
    max_value = 1000*N+1
    dp = [math.inf]*max_value
    dp[0] = 0
    for i in range(N):
        w, v = read_ints()
        for j in range(max_value-1, -1, -1):
            if j >= v:
                dp[j] = min(dp[j], dp[j-v]+w)
    #for j in range(max_value):
        #if dp[j] != math.inf:
            #print(j, 'can be achieved with weight', dp[j])
    ans = 0
    for j in range(max_value):
        if dp[j] <= W:
            ans = j
    return ans


if __name__ == '__main__':
    print(solve())


### FIXED CODE ###



def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    OPT[value] - minimum weight that achieves value
    OPT[value] = OPT[value-v[i]]
    """
    N, W = read_ints()
    max_value = 1000*N+1
    dp = [10**12+1]*max_value
    dp[0] = 0
    for i in range(N):
        w, v = read_ints()
        for j in range(max_value-1, -1, -1):
            if j >= v:
                dp[j] = min(dp[j], dp[j-v]+w)
    ans = 0
    for j in range(max_value):
        if dp[j] <= W:
            ans = j
    return ans


if __name__ == '__main__':
    print(solve())
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 17 11:58:20 2019
DP_G
@author: maezawa
"""
memo = [-1] * (10**5+1)

def rec(nx):
    if memo[nx] > -1:
        return memo[nx]
    depth = 0
    for edge in edges[nx]:
        nrec = rec(edge) + 1
        if nrec > depth:
            depth = nrec
    memo[nx] = depth
    return depth

n, m = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for i in range(m):
    x, y = list(map(int, input().split()))
    edges[x-1].append(y-1)
    
maxdepth = 0
for node in range(n):
    depth = rec(node)
    if maxdepth < depth:
        maxdepth = depth
        
print(maxdepth)



### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 16:05:26 2019
DP_G
@author: maezawa
"""
import sys
sys.setrecursionlimit(10**5)

n, m = list(map(int, input().split()))
v = [-1]*(n+1)
adj = [[] for _ in range(n+1)]
for _ in range(m):
    i, j = list(map(int, input().split()))
    adj[i].append(j)
    
def dfs(vi):
    if v[vi] != -1:
        return v[vi]
    res = 0
    for nb in adj[vi]:
        res0 = dfs(nb) +1
        if res < res0:
            res = res0
    v[vi] = res
    return res

ans = 0
for node in range(1, n+1):
    current = dfs(node)
    if current > ans:
        ans = current
print(ans)
N = int(input())
S = input()
print("Yes" if N[0:N/2-1] == N[N/2+1:] else "No")

### FIXED CODE ###

N = int(input())
S = input()
if N%2 != 0:
  print("No")
elif S[:int(N/2)] == S[int(N/2):]:
  print("Yes")
else:
  print("No")
a,b,c=map(jnt,input().split())
if a=b:
    print(c)
elif b=c:
    print(a)
else:
    print(b)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b:
    print(c)
elif b==c:
    print(a)
else:
    print(b)
k = int(input())
s = input()
x = len(s)

if k >= x:
  print(s)

else:
  print(s + "...")


### FIXED CODE ###

n = input()

x = len(n)-1


if n[x] == "2" or n[x] == "4" or n[x] == "5" or n[x] == "7" or n[x] == "9":
  print("hon")
  
elif n[x] == "0" or n[x] =="1" or n[x] == "6" or n[x] == "8":
  print("pon")
else:
  print("bon")
import numpy as np
n, m = map(int, input().split())
graph = np.zeros((n+1,n+1))
for i in range(m):
    u, v = map(int, input().split())
    graph[u][v] = 1
start, goal = map(int, input().split())
graph2 = np.zeros((n+1,n+1))
np.dot(graph,graph,out = graph2)
np.dot(graph2,graph,out = graph)
#一回けんけんぱした後のグラフがgraph
for i in range(1,n+1):
    if graph[start][goal] >= 1:
        print(i)
        exit()
    np.dot(graph,graph,out = graph)
print(-1)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
inf = 10**9
def bfs(start):
    dist = [inf for i in range((n+1) * 3)]
    que = deque()
    que.append(start)
    finished = set()
    dist[start] = 0
    while que:
        node = que.popleft()
        if node not in finished:
            finished.add(node)
            for i in adjacent_list[node]:
                dist[i] = min(dist[i], dist[node] + 1)
                que.append(i)
    return dist

adjacent_list = [[] for i in range((n+1)*3)]
for _ in range(m):
    u, v = map(int, input().split())
    for i in range(3):
        adjacent_list[u*3 + i].append(v*3 +((i+1)%3))
start, goal = map(int, input().split())
graph = bfs(start*3)
if graph[goal*3] != inf:
    print(int(graph[goal*3]) // 3)
else:
    print(-1)
N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p] = 1
  elif(AC[p] == 0):
    WA[p] += 1
print(sum(AC), sum(WA))

### FIXED CODE ###

N, M = list(map(int, input().split()))
AC = [0] * N
WA = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if(S == "AC"):
    AC[p-1] = 1
  elif(AC[p-1] == 0):
    WA[p-1] += 1
for i in range(N):
  if(AC[i] == 0):
    WA[i] = 0
print(sum(AC), sum(WA))
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(s,a,b):
    c = 0
    for i in s:
        if i=='-':
            c+=1
    if  s[a]=='-' and c==1:
        return 'yes'
    else:
        return 'No'

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n, i, s):
    c = 0
    for i in s:
        if i=='-':
            c+=1
    if  s[n]=='-' and c==1:
        return 'Yes'
    else:
        return 'No'

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split()))
 
A.sort()
rslt = A[0]
 
for a in A[1:]:
  result *= a
  if rslt > 10**18:
    print(-1)
    exit()
print(rslt)

### FIXED CODE ###

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

limit = 10 ** 18
A.sort()
result = A[0]
for a in A[1:]:
    result *= a
    if result > limit:
        print(-1)
        exit()
print(result)
a, b = map(int, raw_input().split())

if a > b:
	print 'a > b'
elif a < b:
	print 'a < b'
else
	print 'a == b'

### FIXED CODE ###

a, b = map(int, raw_input().split())

if a > b:
	print 'a > b'
elif a < b:
	print 'a < b'
else:
	print 'a == b'
a = int(input())
b = int(input())
  
print(str(a*b)+" "+str(a*2 + b*2))

### FIXED CODE ###

z = input()
m,l = z.split()
s = int(m) * int(l)
n = int(m)*2 + int(l)*2

print("{} {}".format(str(s),str(n)))
x = input()

if x.islower():
	an = x.upper()
else:
    an = x.lower()

 print(an)

### FIXED CODE ###

a = input()

if a.islower():
  print('a')
else:
  print('A')
def find(A,x) -> int:
    p = A[x]
    if p == x:
        return x
    a = find(A,p)
    A[x] = a
    return a

def union(A, x, y):
    if find(A,x) > find(A,y):
        bx, by = find(A,y), find(A,x)
    else:
        bx, by = find(A,x), find(A,y)
    A[y] = bx
    A[by] = bx
    
    def examD():
    N = I()
    x = [[] for _ in range(N)]; y = [[] for _ in range(N)]
    for i in range(N):
        a, b = LI()
        x[i] = (a-1,i)
        y[i] = (b-1,i)
    v = [ i for i in range(N)]
    x.sort(); y.sort()
    H = []
    heapify(H)
    for i in range(N - 1):
        x1, j1 = x[i]
        x2, j2 = x[i + 1]
        y1, k1 = y[i]
        y2, k2 = y[i + 1]
        heappush(H, (x2 - x1, j1, j2))
        heappush(H, (y2 - y1, k1, k2))
    ans = 0
#    print(H)
#    print(v)
    while H:
        w, s, t = heappop(H)
        if find(v, s) != find(v, t):
            union(v, s, t)
            ans += w
    print(ans)

import sys
import copy
import bisect
from heapq import *
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


### FIXED CODE ###

def examA():
    X, A, B = LI()
    if (B-A)<=0:
        ans = "delicious"
    elif (B-A)<=X:
        ans = "safe"
    else:
        ans = "dangerous"
    print(ans)


import sys
import copy
import bisect
import heapq
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()
import sys
N, Q = [int(i) for i in input().split()]
tree = [[] for i in range(N)]
cost_ls = [0 for i in range(N)]
for i in range(N-1):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    a -= 1
    b -= 1
    tree[a].append(b)

def plus(node, num):
    cost_ls[node] += num
    if len(tree[node]) == 0:
        return
    for child in tree[node]:
        plus(child, num)

for i in range(Q):
    p, x = [int(i) for i in sys.stdin.readline().split()]
    plus(p-1, x)

print(" ".join([str(cost) for cost in cost_ls]))

### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())
V = {i: [] for i in range(1, N + 1)}
for _ in range(N - 1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)

C = {i: 0 for i in range(1, N + 1)}

for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x


def propagate(u, p):
    for v in V[u]:
        if v == p:
            continue
        C[v] += C[u]
        propagate(v, u)


propagate(1, 0)

print(' '.join(str(C[i]) for i in range(1, N + 1)))
n=input()
n=int(n)
input_h=input().split()# 2 4 5のような入力
input_h=[int(num) for num in input_h]#intへ変換

for idx in range(n-1):

    if input_h[idx]<=input_h[idx+1]:
        continue
    elif input_h[idx]-1==input_h[idx+1]:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
    


### FIXED CODE ###

input_num=input().split()# 2 4 5のような入力
input_num=[int(num) for num in input_num]#intへ変換

A,B,C=input_num

cup_1=B
cup_2=C

cup_1=B+cup_2
cup_2=0

if cup_1>=A:
    cup_1=A
    cup_2=B+C-cup_1
    print(cup_2)
else:
    print(0)