Harryxun/stf_run huggingface dataset:
N = input()
H = map(int, input().split())

Hk = set()
for h in H:
  Hk.add(h)

def po(h, s, e):
  if h >= Hk[-1]:
    return 1
  posS = s
  hit = False
  cnt = 0
  for posE in range(s, e+1):
    if posE >= e or H[posE] <= Hk[h]:
      hit or= (posE < e)
	if posS < posE:
      cnt += po(h+1, posS, posE)
  if hit:
    cnt += 1
  return cnt



### FIXED CODE ###

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

Hk = set([0])
for h in H:
  Hk.add(h)
Hk = sorted(Hk)

def po(h, s, e):
  if h >= len(Hk)-1:
    return Hk[h] - Hk[h-1]
  posS = s
  cnt = 0
  for posE in range(s, e+1):
    if posE >= e or H[posE] <= Hk[h]:
      if posS < posE:
        cnt += po(h+1, posS, posE)
      posS = posE + 1
  if h > 0:
    cnt += Hk[h] - Hk[h-1]
  return cnt

print(po(0, 0, len(H)))
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[0 for i in range(m)]
c=0
d=0
for i in range(m):
    c,d=map(int,input().split())
    e=[d,c]
    b[i]=e
a.sort()
b.sort(reverse=True)
f=[]
g=n
for i in range(m):
    if(b[i][1]>=g):
        for j in range(g):
            f.append(b[i][0])
            break
    else:
        for k in range(b[i][1]):
            f.append(b[i][0])
        g=g-b[i][1]
f.sort(reverse=True)
for i in range(len(f)):
    if(f[i]>=a[i]):
        a[i]=f[i]
    else:
        break
print('{0}'.format(sum(a)))



### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a=[(1,z)for z in a]
b=[tuple(map(int,input().split()))for i in range(m)]
b+=a
b.sort(key=lambda x:x[1])
cnt=0
ans=0
while True:
    c=b.pop()
    if cnt+c[0]<=n:
        ans+=c[0]*c[1]
        cnt+=c[0]
    else:
        ans+=c[1]*(n-cnt)
        break
print('{0}'.format(ans))
s = input()
if s.endwith('s'):
	print(s + 'es')
else:
	print(s + 's')

### FIXED CODE ###

s = input()
if s.endswith('s'):
  print(s + 'es')
else:
  print(s + 's')
N=int(input())
H=list(map(int,input().split()))

count_list=[]
count=0

for i in range(N-1):
  if  H[i]>=H[i+1]:
    count+=1
  else:
    count_list.append(count)
    count=0
else:
  countlist.apend(count)

print(max(count_list))

### FIXED CODE ###

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

count_list = []
count = 0

for i in range(N-1):
  if H[i] >= H[i+1]:
    count += 1
  else:
    count_list.append(count)
    count = 0
else:
  count_list.append(count)
    
print(max(count_list))
def solve(n,l,dp):
    if n==0:
        return l[0]
    elif n==1:
        return abs(l[n-1]-l[n-2])
    if n in dp:
        return dp[n]
    dp[n]= min((abs(l[n-1]-l[n-2])+solve(n-1,l,dp)),abs(l[n-1]-l[n-3])+solve(n-2,l,dp))
    return dp[n]
n=int(input())
l=[int(x) for x in input().split()]
if n==1:
    print(0)
else:
    ans=solve(n,l,{})
    print(ans)

### FIXED CODE ###

n=int(input())
l=[int(x) for x in input().split()]
dp=[0]*n
for i in range(n):
    if i==0:
        dp[i]=0
    elif i==1:
        dp[i]=abs(l[i]-l[i-1])
    else:
	    dp[i]=min(dp[i-1]+abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))
print(dp[n-1])
N,X = map(int,input().split())
l = list(map(int,input().split()))

sum=0
for i in range(N-1):
    sum += l[i]
    if sum>X:
        ans = i+1
print(ans)


### FIXED CODE ###

N,X = map(int,input().split())
l=[0]
l += list(map(int,input().split()))
sum=0
for i in range(N+1):
    sum += l[i]
    if sum>X:
        print(i)
        exit()
print(N+1)
S=input()
K=int(input())
if S[0]!='1':
    print(S[0])
else:
    for i in range(len(S)):
        if S[i]!='1':
            if K<=i:
                print('1'):
            else:
                print(S[i])
            break

### FIXED CODE ###

S=input()
K=int(input())
if S[0]!='1':
    print(S[0])
else:
    flag=True
    for i in range(len(S)):
        if S[i]!='1':
            if K<=i:
                print('1')
            else:
                print(S[i])
            flag=False
            break
    if flag:
        print(1)
n,m=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(n+1)
ans=[0]*(n+1)
num=[0,2,5,5,4,5,6,3,7,6]
INF=10**18
for i in range(1,n+1):
  stack=[]
  for j in m:
    if i-num[j]>=0:
      stack.append(dp[i-num[j]])
    else:
      stack.append(-INF)
  dp[i]=max(stack)+1
  if dp[i]>0:
    ans[i] += ans[i-num[stack.index(max(stack))]]+num[stack.index(max(stack))]*10**(dp[i]-1)
print(ans[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
dp=[0]*(n+1)
ans=[0]*(n+1)
num=[0,2,5,5,4,5,6,3,7,6]
INF=10**18
for i in range(1,n+1):
  stack=[]
  chance=[]
  for j in a:
    if i-num[j]>=0:
      stack.append(dp[i-num[j]])
      chance.append([dp[i-num[j]],ans[i-num[j]]])
    else:
      stack.append(-INF)
      chance.append([-1,-1])
  dp[i]=max(stack)+1
  if dp[i]>0:
    for v in range(len(stack)):
      if stack[v]==max(stack):
        ans[i] += chance[v][1]+a[v]*10**(dp[i]-1)
        break
print(ans[n])
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

AA = list(reversed(A))
BB = list(reversed(B))

rest = K
ans = 0

def dfs(cost, aindex, bindex, score):

    if K == cost:
        # print("1:", score, cost)
        return score
    elif K < cost:
        # print("2:", score, cost)
        # return score - 2
        return -1
    
    if aindex == N and bindex == M:
        # print("3:", score, cost)
        return score

    if aindex >= N:
        return dfs(cost + B[bindex], aindex, bindex+1, score + 1)
    
    elif bindex >= M:
        return dfs(cost + A[aindex], aindex+1, bindex, score + 1)

    else:
        return max(dfs(cost + A[aindex], aindex+1, bindex, score + 1), dfs(cost + B[bindex], aindex, bindex + 1, score + 1))

print(max(dfs(A[0], 1, 0, 1), dfs(B[0], 0, 1, 1)))

### FIXED CODE ###

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

a, b = [0], [0]
for ai in A:
    a.append(a[-1] + ai)

for bi in B:
    b.append(b[-1] + bi)

# print(a, b)
ans = 0
bs = M
for i in range(N+1):
    if a[i] > K:
        break
    for j in reversed(range(bs+1)):
        if a[i] + b[j] <= K:
            ans = max(ans, i + j)
            bs = j
            break

print(ans)
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 j in range(m):
    b_.append(b_[j] + b[j])

ans = 0
j = 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)

### FIXED CODE ###

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)
n, k = map(int, input().split())
s = list(map(int, input().split()))
s.sort()
print(sum(s[len(n) - k:]))

### FIXED CODE ###

n, k = map(int, input().split())
s = list(map(int, input().split()))
s.sort()
print(sum(s[n-k:]))
s = int(input())

b = s % 100
a = int((s-b)/100)

if a ==0 or b == 0:
    print(‘NA’)
elif a> 12 and b>12:
    print(‘NA’)
elif a>12:
    print(‘YYMM’)
elif b>12:
    print(‘MMYY’)
else:
    print(‘AMBIGUOUS’)



### FIXED CODE ###

s = int(input())

b = s % 100
a = int((s-b)/100)

flaga = False
flagb = False

if a > 0 and a < 13:
    flaga = True
if b > 0 and b < 13:
    flagb = True

if flaga == True and flagb == True:
    print('AMBIGUOUS')
if flaga == False and flagb == True:
    print('YYMM')
if flaga == True and flagb == False:
    print('MMYY')
if flaga == False and flagb == False:
    print('NA')
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    seisulist = list(map(int, input().split()))
    if max(seisulist) > x:
        size = max(seisulist) + 1
    else:
        size = x + 1
    numlist = [i for i in range(1,size) if i not in seisulist]
    xretu = [x]*len(numlist)
    hikizan = [abs(s-t) for (s, t) in zip(numlist, xretu)]
    sa = min(hikizan)
    if x-sa not in seisulist:
        print(x-sa)
    else:
        print(x+sa)

### FIXED CODE ###

#ABC170 C 通せず
x, n = map(int, input().split())
seisulist = list(map(int, input().split()))
numlist = [i for i in range(0,102) if i not in seisulist]
xretu = [x]*len(numlist)
hikizan = [abs(s-t) for (s, t) in zip(numlist, xretu)]
sa = min(hikizan)
if x-sa not in seisulist:
    print(x-sa)
else:
    print(x+sa)
def get_input_row():
      return [int(i) for i in input().split(" ")]
     
    inp = get_input_row()
    N = inp[0]
    M = inp[1]
    item_dict = {}
    num = 0
    for i in range(N):
      a, b = get_input_row()
      if a in item_dict:
        item_dict[a] += b
      else:
      	item_dict[a] = b
    sorted_list = [k for k in item_dict.keys()]
    sorted_list.sort()
    money = 0
    for price in sorted_list:
      if M > item_dict[price]:
        M -= item_dict[price]
        money += price * item_dict[price]
      else:
        money += price * M
        break
    print(money)

### FIXED CODE ###

def get_input_row():
  return [int(i) for i in input().split(" ")]
     
inp = get_input_row()
N = inp[0]
M = inp[1]
item_dict = {}
num = 0
for i in range(N):
  a, b = get_input_row()
  if a in item_dict:
    item_dict[a] += b
  else:
    item_dict[a] = b

sorted_list = [k for k in item_dict.keys()]
sorted_list.sort()
money = 0
for price in sorted_list:
  if M > item_dict[price]:
    M -= item_dict[price]
    money += price * item_dict[price]
  else:
    money += price * M
    break
print(money)
text = input()
N, W = text.split("\n")[0], text.split("\n")[1]

N = int(N[0])
W = [int(i) for i in W.split(" ")]

ans = 100 * 100

for T in range(N):
  ans_tmp = abs(sum(W[:T]) - sum(W[T:]))
  if ans_tmp < ans:
    ans = ans_tmp

print(ans)


### FIXED CODE ###

n_text = input()
w_text = input()

N = int(n_text)
W = w_text.split()

W = [int(i) for i in W]

ans = 100 * 100

for T in range(N):
  ans_tmp = abs(sum(W[:T]) - sum(W[T:]))
  if ans_tmp < ans:
    ans = ans_tmp

print(ans)
N = int(input())
A = int(input())

if N % 500 < A:
    return "YES"
else:
    return "NO"



### FIXED CODE ###

N = int(input())
A = int(input())

if N % 500 <= A:
    print("Yes")
else:
    print("No")
A,B = int(input()), int(input())
if max(A,B)-min(A,B) >= 1:
  print(2*max(A,B)-1)
else:
  print(A+B)

### FIXED CODE ###

AB = input().split()
A,B=int(AB[0]), int(AB[1])
if max(A,B)-min(A,B) >= 1:
  print(2*max(A,B)-1)
else:
  print(A+B)
N = int(input())
L = list(map(int,input().split()))
L_max = max(L)

L_sum = sum(L)

if L_sum - L_max > L_max:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

input_data = input().split()
input_int = list(map(int,input_data))
T = input_int[0]
X = input_int[1]

A = T / X
print(A)
n = int(input())
names = []
for i in range(n):
  names.appen(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += i*j*k
print(ans)

### FIXED CODE ###

n = int(input())
names = []
for i in range(n):
  names.append(input())
names = [i[0] for i in names]
nm = ["M","A","R","C","H"]
ks = [names.count(nm[i]) for i in range(5)]
ans = 0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans += ks[i] * ks[j] * ks[k]
print(ans)
n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
  
q=int(input())
ans=0
 
for j in range(q):
 x,y=map(int,input().split())
 sum+=(y-x)*cnt[x]
 cnt[y]+=cnt[b]
 cnt[x]=0
 print(sum)

### FIXED CODE ###

import re
a=input()
if re.sub(r'[A-Z]',"",a)=="":
  print('A')
else:
  print('a')
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

import numpy as np

INF = float('inf')
NIL = - 1

L, R = map(int, input().split())
k = np.arange(L, R + 1, dtype=np.int64)
k = k % 2019
print(k[0] * k[1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

L, R = map(int, input().split())
if (R - L) > 3000:
    print(0)
    exit()
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
    print(ans)
print('YES' if (lambda poles=input().split(): True if (int(poles[1])-input(poles[0]))==(int(poles[2])-input(poles[1])) else False)() else 'NO')

### FIXED CODE ###

a, b, c = map(int, input().split())
print('YES' if (b - a) == (c - b) else 'NO')
array = input().split().sort())

for i in array:
    print(i, end="")


### FIXED CODE ###

#
# 2c
#

def main():
    l = list(map(int, input().split()))
    l.sort()
    print(*l)


if __name__ == '__main__':
    main()
import math

sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
    if p[i]:
        s[k] = i+1+s[k-1]
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print (n)

### FIXED CODE ###

import math

r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]

s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
    if p[i]:
        s[k] = i+1+s[k-1]
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print s[n-1]
from collections import deque


def dfs(maze, start):
    move = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    q = deque([0, start])
    dist = [[-1] * w for _ in range(h)]

    depth, i, j = -1, -1, -1

    while q:
        depth, (i, j) = q.popleft()
        if dist[i][j] != -1:
            continue
        dist[i][j] = depth
        for di, dj in move:
            ni, nj = i + di, j + dj

            outside = not 0 <= ni < h or not 0 <= nj < w
            is_wall = maze[ni][nj] == "#"
            visited = dist[ni][nj] != -1

            if outside or is_wall or visited:
                continue

            q.append((depth + 1, (ni, nj)))

    return depth, i, j


h, w = list(map(int, input().split()))

maze = []

for _ in range(h):
    maze.append(input())

answer = 0

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            depth, i, j = dfs(maze, (i, j))
            answer = max(answer, depth)

print(answer)

### FIXED CODE ###

from collections import deque


def dfs(maze, start):
    move = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    q = deque([(0, start)])
    dist = [[-1] * w for _ in range(h)]

    depth, i, j = -1, -1, -1

    while q:
        depth, (i, j) = q.popleft()
        if dist[i][j] != -1:
            continue
        dist[i][j] = depth
        for di, dj in move:
            ni, nj = i + di, j + dj

            if (not 0 <= ni < h) or (not 0 <= nj < w):
                continue

            if maze[ni][nj] == "#" or dist[ni][nj] != -1:
                continue

            q.append((depth + 1, (ni, nj)))

    return depth, i, j


h, w = list(map(int, input().split()))

maze = []

for _ in range(h):
    maze.append(input())

answer = 0

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            depth, i, j = dfs(maze, (i, j))
            answer = max(answer, depth)

print(answer)
import math

def lcm(x, y):
	return int((x * y) / math.gcd(x, y))

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcm(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = int(i * lcm / n + 1)
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = int(i * lcm / m + 1)
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print(-1)
		flg = 1
		break

if flg == 0:
	print(lcm)

### FIXED CODE ###

def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a = b
		b = c
	else:
		return c

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

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

# str1 = ""
# for i in range(lcm):
# 	str1 += "-"

flg = 0
for i in range(n):
	index = i * lcm // n + 1
	if (index - 1) % (lcm // m) == 0:
		j = (index - 1) // (lcm // m)
		if s[i] != t[j]:
			print("-1")
			flg = 1
			break
if flg == 0:
	print(lcm)


# 	str1 = str1[:index] + s[i] + str1[index+1:]

# flg = 0
# for i in range(m):
# 	index = i * lcm // m + 1
# 	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
# 		print("-1")
# 		flg = 1
# 		break

# if flg == 0:
# 	print(lcm)
A=int(input())
B=int(input())

if A>8 or B>8 or A<0 or B<0:
  print(":(")
else:
  print("Yay!")

### FIXED CODE ###

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

if a>8 or b>8 or a<0 or b<0:
  print(":(")
else:
  print("Yay!")
s = input()
c=0
for i in range(len(s)):
  if s[i] != t[i]:
    c += 1
print(c)

### FIXED CODE ###

s = input()
t = input()
c=0
for i in range(len(s)):
  if s[i] != t[i]:
    c += 1
print(c)
n = int(input())
people = {}

for i in range(n):
    sentenses = int(input())
    if sentenses > 0:
        for j in range(sentenses):
            v = list(map(int, input().split()))
            if i in people.keys():
                people[i].append(v)
            else:
                people[i] = [v]
            
ans = 0

for i in range(2**n):
    speaker = []
    p_list = [0] * n
    for j in range(n):
        if ((i >> j) % 2) == 1:
            speaker.append(j)
            p_list[j] = 1

    continue_flag = True
    for s in speaker:
        if continue_flag:
            sentenses = people[s]
            for sent in sentenses:
                if p_list[sent[0]-1] == sent[1]:
                    p_list[sent[0]-1] = sent[1]
                else:
                    continue_flag = False
                    break
        else:
            break
        
    if continue_flag:
        temp_ans = len(speaker)
        ans = max(temp_ans, ans)

print(ans)


### FIXED CODE ###


n = int(input())
people = {}

for i in range(n):
    sentenses = int(input())
    if sentenses > 0:
        for j in range(sentenses):
            v = list(map(int, input().split()))
            if i in people.keys():
                people[i].append(v)
            else:
                people[i] = [v]
            
ans = 0

for i in range(2**n):
    speaker = []
    p_list = [0] * n
    for j in range(n):
        if ((i >> j) % 2) == 1:
            speaker.append(j)
            p_list[j] = 1

    continue_flag = True
    for s in speaker:
        if continue_flag:
            if s in people.keys():
                sentenses = people[s]
            else:
                continue
            for sent in sentenses:
                if p_list[sent[0]-1] == sent[1]:
                    p_list[sent[0]-1] = sent[1]
                else:
                    continue_flag = False
                    break
        else:
            break
        
    if continue_flag:
        temp_ans = len(speaker)
        ans = max(temp_ans, ans)

print(ans)
a, b, c = map(int, input().split())
ab = a+b
bc = b+c
ca = c+a
flg = False
if ab == c:
    flg = True
if bc == a:
    flg = True
if ca == b:
    flg = True

if flg = True:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())
ab = a+b
bc = b+c
ca = c+a
flg = False
if ab == c:
    flg = True
if bc == a:
    flg = True
if ca == b:
    flg = True

if flg == True:
    print("Yes")
else:
    print("No")
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
if a<=b:
  print(0)

else:
  f=0
  d=0

  c.sort()
  e=-1
  f=0
  for i in range(a):
    d+=c[i]
  

  for i in range(b):
    if b>0:
      b-=1
      f+=1
      
      d-=c[e]
      e-=1
      if d<=0:
        print(f)
        sys.exit()
      
for i in range(a+e+1):
  f+=c[i]

print(f)



### FIXED CODE ###

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

if N - K < 0:
  print(0)
else:
  print(sum(H[:N-K]))
a = input().split()
n = a[0]
l = a[1]

sum_ = 0
for i in range(n-1):
    sum_ = sum_ + (l + i - 1)

taste = [] #各パイの味

for i in range(n):
    taste = sum_ - (l + i - 1)

min_sa = 0
sa = 0

for i in range(n):
    sa = sum_ - teste[i]
    if sa < min_sa:
        min_sa = sa

for i in range(n):
    if (sum_ - taste[i]) == min_sa:
        print(taste[i])
        return

### FIXED CODE ###

num = input()
#num = str(code)

if num[0] == num[1] or num[1] == num[2] or num[2] == num[3]:
    print('Bad')
else:
    print('Good')
A,B,C = intput().split()
A,B,C = int(A),int(B),int(C)

print(max([C-(A-B),0])

### FIXED CODE ###

A,B,C = input().split()
A,B,C = int(A),int(B),int(C)

print(max([C-(A-B),0]))
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000)
mod = 10**9+7

def comb(n, r):
    if 2*r > n: comb(n, n-r)
    return fac[n] * inv[r] * inv[n-r] % mod

def dfs(v, Pa=-1):
    for u in to[v]:
        if u == Pa: continue
        dfs(u, v)
        size[v] += size[u]
        dp[v] *= dp[u] % mod
        dp[v] *= comb(size[v], size[u]) % mod
    size[v] += 1

def bfs(v, Pa=-1, P_val=1, P_sz=0):
    ans[v] = P_val * dp[v] * comb(n-1, P_sz) % mod
    for u in to[v]:
        if u == Pa: continue
        val = ans[v] * INV(dp[u]*comb(n-1, size[u])) % mod
        bfs(u, v, val, n-size[u])

n = int(input())
to = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(lambda x : int(x)-1, input().split())
    to[a].append(b)
    to[b].append(a)

fac = [1] * (n+2)
inv = [1] * (n+2)

for i in range(2, n+1):
    fac[i] = fac[i-1] * i % mod
INV = lambda x: pow(x, mod-2, mod)
inv[n] = INV(fac[n])
for i in range(n-1, 1, -1):
    inv[i] = inv[i+1] * (i+1) % mod

dp = [1] * n
size = [0] * n
ans = [0] * n

dfs(0)
bfs(0)
print(*ans, sep='\n')

### FIXED CODE ###

import sys

def solve():
    input = lambda: sys.stdin.readline().rstrip()
    sys.setrecursionlimit(10 ** 7)
    mod = 10 ** 9 + 7

    def comb(n, r):
        if r > n: return 0
        return fac[n] * inv[r] * inv[n - r] % mod

    def dfs(v, Pa=-1):
        for u in to[v]:
            if u == Pa: continue
            dfs(u, v)
            size[v] += size[u]
            dp[v] *= dp[u] % mod
            dp[v] *= inv[size[u]] % mod
        dp[v] *= fac[size[v]] % mod
        size[v] += 1

    def bfs(v, Pa=-1, P_val=1, P_sz=0):
        ans[v] = P_val * dp[v] * comb(n - 1, P_sz) % mod
        for u in to[v]:
            if u == Pa: continue
            val = ans[v] * INV(dp[u] * comb(n - 1, size[u])) % mod
            bfs(u, v, val, n - size[u])

    n = int(input())
    to = [[] for _ in range(n)]
    for _ in range(n - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        to[a].append(b)
        to[b].append(a)

    fac = [1] * (n + 2)
    inv = [1] * (n + 2)

    for i in range(2, n + 1):
        fac[i] = fac[i - 1] * i % mod
    INV = lambda x: pow(x, mod - 2, mod)
    inv[n] = INV(fac[n])
    for i in range(n - 1, 1, -1):
        inv[i] = inv[i + 1] * (i + 1) % mod

    dp = [1] * n
    size = [0] * n
    ans = [0] * n

    dfs(0)
    bfs(0)
    print(*ans, sep='\n')

if __name__ == '__main__':
    solve()
L = list(input().split())

s = L[0]
S = list(s)
t = L[1]
T = list(t)

N = len[S]
i = 1

while N != i:
    if S[i] != T[i]:
        S[i] = T[i]
        i += 1

### FIXED CODE ###

s,t = input(), input()

S = list(s)
T = list(t)

N = len(s) - 1
i = 0
counter = 0

while N + 1 != i:
    if S[i] != T[i]:
        S[i] = T[i]
        counter += 1
    i += 1

print(counter)