Harryxun/stf_run huggingface dataset:
import sys

sys.setrecursionlimit(100000)

class Node():
    def __init__(self, p, l, r):
        self.p = p
        self.l = l
        self.r = r


def rec(u, p):
    D[u] = p
    if T[u].r != -1:
        rec(T[u].r, p)
    if T[u].l != -1:
        rec(T[u].l, p + 1)


N = int(input())
T = [Node(-1, -1, -1) for _ in range(N)]
D = [-1] * N
for i in range(N):
    i, k, *cs = map(int, input().split())
    for j, c in enumerate(cs):
        if j == 0:
            T[i].l = c
        else:
            T[l].r = c
        l = c
        T[c].p = i
for i, t in enumerate(T):
    if t.p == -1:
        r = i
rec(r, 0)
for i, t in enumerate(T):
    cs = []
    c = t.l
    while c != -1:
        cs.append(c)
        c = T[c].r
    if t.p == -1:
        print('node {}: parent = {}, depth = {}, root, {}'
              .format(i, t.p, D[i], cs))
    elif t.l == -1:
        print('node {}: parent = {}, depth = {}, leaf, {}'
              .format(i, t.p, D[i], cs))
    else:
        print('node {}: parent = {}, depth = {}, internal node, {}'
              .format(i, t.p, D[i], cs))



### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

class Node():
    def __init__(self, p, l, r):
        self.p = p
        self.l = l
        self.r = r


def rec(u, p):
    D[u] = p
    if T[u].r != -1:
        rec(T[u].r, p)
    if T[u].l != -1:
        rec(T[u].l, p + 1)


N = int(input())
T = [Node(-1, -1, -1) for _ in range(N)]
D = [-1] * N
for i in range(N):
    i, k, *cs = map(int, input().split())
    for j, c in enumerate(cs):
        if j == 0:
            T[i].l = c
        else:
            T[l].r = c
        l = c
        T[c].p = i
for i, t in enumerate(T):
    if t.p == -1:
        r = i
rec(r, 0)
for i, t in enumerate(T):
    cs = []
    c = t.l
    while c != -1:
        cs.append(c)
        c = T[c].r
    if t.p == -1:
        print('node {}: parent = {}, depth = {}, root, {}'
              .format(i, t.p, D[i], cs))
    elif t.l == -1:
        print('node {}: parent = {}, depth = {}, leaf, {}'
              .format(i, t.p, D[i], cs))
    else:
        print('node {}: parent = {}, depth = {}, internal node, {}'
              .format(i, t.p, D[i], cs))
import collections
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
s = [""]*N
S = []
for i in range(N):
    s[i] = input()
    test = [*s[i]]
    test.sort()
    S.append("".join(test))
ana = sorted(collections.Counter(S).values())
count = 0
for i in ana:
    if i >= 2:
        count += combinations_count(i,2)
print(count)

### FIXED CODE ###

import collections
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
s = [""]*N
S = []
for i in range(N):
    s[i] = input()
    test = list(s[i])
    test.sort()
    S.append("".join(test))
ana = sorted(collections.Counter(S).values())
count = 0
for i in ana:
    if i >= 2:
        count += combinations_count(i,2)
print(count)
x = raw_input()
print (x**3)

### FIXED CODE ###

x = raw_input()
print int(x)**3
実装無理
import math
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
ind = A.index(1)
if (ind%(K-1) + (N-ind-1)%(K-1))%(K-1) == 0:
    print(math.floor(ind/(K-1)) + math.floor((N-ind-1)/(K-1))+1)
else:
    print(math.ceil(ind/(K-1)) + math.ceil((N-ind-1)/(K-1)))

### FIXED CODE ###

import math
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
ind = A.index(1)
print(math.ceil((ind + (N-ind-1))/(K-1)))
a = int(input())

c = a*a * 3.14
r = (a*2) * 3.14

print (c,r)

### FIXED CODE ###

import math

a = float(input())

c = a*a * math.pi
r = (a+a) * math.pi

print (float(c),float(r))
x,y=map(int(input().split())
print(x+y//2)


### FIXED CODE ###

x,y=map(int,input().split())
print(x+y//2)
#!/usr/bin/env python3

import sys

P_NUM = 1000000007


def solv(n, m, a):
    comb_m2 = 1
    if 1 in a:
        comb_m1 = 0
    else:
        comb_m1 = 1

    for i in range(2, n+1):
        if i in a:
            comb = 0
        else:
            comb = (comb_m1 + comb_m2) % P_NUM
        
        comb_m1, comb_m2 = comb, comb_m1

    return comb


if __name__ == '__main__':

    n, m = map(int, input().split())
    if m:
        a = set(map(int, sys.stdin))
    else:
        a = set()

    ans = solv(n, m, a)

    print(ans)


### FIXED CODE ###

#!/usr/bin/env python3

import math
from functools import lru_cache


def ncr(n, r):
    r = min(r, n - r)
    # 桁が小さいときは直接 math.factorial を使ったほうが早い
    if n + r < 4000:
        return math.factorial(n) // math.factorial(n-r) // math.factorial(r)
    if r == 0:
        return 1
    if r == 1:
        return n
    numerator = list(range(n - r + 1, n + 1))
    denominator = list(range(1, r+1))
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    result = 1
    for k in range(r):
        result *= numerator[k]
    return result


# 穴なしで n step 離れている場合の組み合わせ
def no_hole(n):
    count = 0
    m = n // 2
    for i in range(0, m+1):
        count += ncr(n-i, i)
    return count


# 穴なしで n step 離れている場合の組み合わせ(高速化版)
@lru_cache(maxsize=8192)
def no_hole2(n):
    if n <= 5:
        return (1, 1, 2, 3, 5, 8)[n]
    if n % 2:
        h = (n-1) // 2
        m1 = no_hole2(h-1)
        m0 = no_hole2(h)
        return 2 * m1 * m0 + m0 * m0
    else:
        h = n // 2
        m2 = no_hole2(h-2)
        m1 = no_hole2(h-1)
        m0 = no_hole2(h)
        return m1 * m1 + m2 * m0 + m1 * m0


def solv(n, m, a):
    ans = 1
    current_pos = 0
    for pos in a:
        dist = pos - 1 - current_pos
        if dist < 0:
            return 0
        ans *= no_hole2(dist)
        current_pos = pos + 1
    dist = n - current_pos
    ans *= no_hole2(dist)
    return ans


if __name__ == '__main__':

    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]

    ans = solv(n, m, a)

    P_NUM = 1000000007
    print(ans % P_NUM)
N, *x = map(int, input(0))
print(5 + (N // min(x)))

### FIXED CODE ###

N, *x = map(int, open(0))
print(4 - (-N // min(x)))
A,B,C=map(int,input().split())
print('Yes' if a<=C<=B else 'No')

### FIXED CODE ###

A,B,C=map(int,input().split())
print('Yes' if A<=C<=B else 'No')
s = input()
n = len(s)
k = int(input())
ans = "1"
for i in range(min(n, k)+1):
    ss = s[i]
    if ss != "1":
        ans = ss
        break
print(ans)

### FIXED CODE ###

s = input()
n = len(s)
k = int(input())
ans = "1"
for i in range(min(n, k)):
    ss = s[i]
    if ss != "1":
        ans = ss
        break
print(ans)
# -*- coding: utf-8 -*-

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    maxi = []

    for i in range(0,len(l)):
        if i == piv:
            continue
        if l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    #mini = qui(mini)
    maxi = qui(maxi)
    return mini+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))

### FIXED CODE ###

# -*- coding: utf-8 -*-

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    middlei = []
    maxi = []

    for i in range(0,len(l)):
        if l[i] == l[piv]:
            middlei.append(l[i])
        elif l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    mini = qui(mini)
    maxi = qui(maxi)
    return mini+ middlei+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))
import math
N,M=map(int,input().split())
def combination(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
if N>=2 and M>=2:
    print(combination(N,2)+combination(M,2))
elif N>=2 and M<=2:
    print(combination(N,2))
else:
    print(combination(M,2))

### FIXED CODE ###

N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
while True:
    inp = input()
    if inp == '0': break

    num = 1
    for i in range(1, int(inp)):
        num = num * i

    cnt = 0
    while True:
        if num % 10 == 0:
            cnt = cnt + 1
            num = int(num / 10)
        else:
            break

    print(cnt)

### FIXED CODE ###

while True:
    inp = input()
    if inp == '0': break

    num = 1
    for i in range(1, int(inp)+1):
        num = num * i

    cnt = 0
    strnum = str(num)
    while True:
        if strnum[-1] == '0':
            cnt = cnt + 1
            strnum = strnum[:-1]
        else:
            break

    print(cnt)
import math
a, b, c, d = map(int, input().split())

def main():
    cd = c * d / math.gcd(c, d)
    print(b - a - (f(c) + f(d) - f(cd)) + 1)

def f(x):
    return math.floor((b - x * math.ceil(a / x)) / x) + 1

main()

### FIXED CODE ###

from fractions import gcd

a, b, c, d = map(int, input().split())
a -= 1

def main():
    cd = c * d // gcd(c, d)
    print(b - a - f(c) - f(d) + f(cd))

def f(x):
    return b // x - a // x

main()
import math
n = int(input())
ans=[0]*n
for x in range(1, int(math.sqrt(n))):
    for y in range(1, int(math.sqrt(n))):
        for z in range(1, int(math.sqrt(n))):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans,sep="\n")

### FIXED CODE ###

n = int(input())
ans=[0]*(n+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            a = x * x + y * y + z * z + x * y + y * z + z * x
            if n >= a >= 1:
                ans[a] += 1
print(*ans[1:],sep="\n")
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def gcd_l(l):
    if len(l) <= 1:
        return l[0]
    elif len(l) == 2:
        return gcd(l[0], l[1])
    else:
        return gcd(gcd_l(l[:-1]), l[-1])

gcd_max = 1
for i in range(n):
    if i == 0:
        i_gcd = gcd_l(a[i+1:])
    elif i == n-1:
        i_gcd = gcd_l(a[:i])
    else:
        i_gcd = gcd(gcd_l(a[:i]), gcd_l(a[i+1:]))
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


### FIXED CODE ###

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

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

l = [0]
r = [0]
for i in range(n):
    l.append(gcd(l[i], a[i]))
    r.append(gcd(r[i], a[n-i-1]))

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)
import numpy as np

p = int(input())
a = list(map(int,input().split()))

b = []
for i in range(p):
    if a[i] ==  1:
        b.append(i)

ans = [0]*p

for i in range(0,p):
    for j in b:
        ans[p-1-i] -= pow(j,i,p)
    ans[p-1-i] %= p
 
ans[0] += -len(b)*(p-1)
ans[0] %= p

print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

p = int(input())
a = [int(i) for i in input().split()]

ans = [0]*p

for i,j in enumerate(a):
    if j == 0:
        continue
    ans[0] -= p-1
    m = 1
    for k in range(p):
        ans[p-1-k] -= m
        ans[p-1-k] %= p
        m *= i
        m %= p

print(*ans)
print(3*int(input())**2

### FIXED CODE ###

print(3*int(input())**2)
import heapq

n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
q=[]
dic={}
for i in range(n):
  heapq.heappush(q,-arr2[i])
  dic[arr2[i]]=i
cnt=0
while len(q)!=0:
  val=-heapq.heappop(q)
  pos=dic[val]
  if val==arr1[pos]:
    continue
  diff=arr2[pos-1]+arr2[(pos+1)%n]
  if val-diff<arr1[pos]:
    continue
  move=(val-arr1[pos])//diff
  cnt+=move
  tmp=arr2[pos]-diff*move
  arr2[pos]=tmp
  heapq.heappush(q,-tmp)
  dic[tmp]=pos
for i in range(n):
  if arr1[i]!=arr2[i]:
    print(-1)
    break
else:
  print(cnt)

### FIXED CODE ###

import heapq

n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
q=[]
for i in range(n):
  if arr2[i]!=arr1[i]:
    heapq.heappush(q,(-arr2[i],i))
cnt=0
while q:
  val,pos=heapq.heappop(q)
  val*=-1
  diff=arr2[pos-1]+arr2[(pos+1)%n]
  move,tmp=divmod(val-arr1[pos],diff)
  if move==0:
    break
  cnt+=move
  tmp+=arr1[pos]
  arr2[pos]=tmp
  if tmp!=arr1[pos]:
    heapq.heappush(q,(-tmp,pos))
for i in range(n):
  if arr1[i]!=arr2[i]:
    print(-1)
    break
else:
  print(cnt)
#ABC138-E Strings of Impurity
"""
sの好きなだけのループに対する部分文字列tを求める
tにあってsにない文字がある時点でno
そうでないならば必ず達成可能で、
tに対してループを回し(i)、
sのj文字目に関して、それより後に初めて出てくるt[i+1]の場所をindexで返し,i+=1,j=そのindex
にする。
そのようなindexがないならば、j=0とし、またはじめから回す。
"""
import sys
import bisect
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')
t = readline().rstrip().decode('utf-8')
s_s = set(list(s))
t_s = set(list(t))
flag = 1 if s_s & t_s == t_s else 0

if not flag:
    raise Exception
"""    print(-1)
    exit()
"""
#2進数で、
lst1 = [[] for _ in range(26)]
kijun = ord("a")
for idx,i in enumerate(s):
    lst1[ord(i)-kijun].append(idx)

i = 0
roop = 0
count = 0
while True:
    if i >= len(t):
        print(roop*len(s)+count+1) #countは0-indexedの為
        break
    now = ord(t[i])-kijun
    res = bisect.bisect_left(lst1[now],count)
    if res == len(lst1[now]):
        roop += 1
        count = 0
        res = bisect.bisect_left(lst1[now],count)
        count = lst1[now][res]
    else:
        count = lst1[now][res]
    i += 1
    

### FIXED CODE ###

#ABC138-E Strings of Impurity
"""
sの好きなだけのループに対する部分文字列tを求める
tにあってsにない文字がある時点でno
そうでないならば必ず達成可能で、
tに対してループを回し(i)、
sのj文字目に関して、それより後に初めて出てくるt[i+1]の場所をindexで返し,i+=1,j=そのindex
にする。
そのようなindexがないならば、j=0とし、またはじめから回す。
"""
import sys
import bisect
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')
t = readline().rstrip().decode('utf-8')
s_s = set(list(s))
t_s = set(list(t))
flag = 1 if s_s & t_s == t_s else 0

if not flag:
    print(-1)
    exit()

#2進数で、
lst1 = [[] for _ in range(26)]
kijun = ord("a")
for idx,i in enumerate(s):
    lst1[ord(i)-kijun].append(idx)

i = 0
roop = 0
count = 0
while True:
    if i >= len(t):
        print(roop*len(s)+count) #countは0-indexedの為
        break
    now = ord(t[i])-kijun
    res = bisect.bisect_left(lst1[now],count)
    if res == len(lst1[now]):
        roop += 1
        count = 0
        res = bisect.bisect_left(lst1[now],count)
        count = lst1[now][res]+1 #その次の文字から
    else:
        count = lst1[now][res]+1
    i += 1
a1,b1=map(int,input().split())
a2,b3=map(int,input().split())
a2,b3=map(int,input().split())
m = [a1,b1,a2,b2,a3,b3]

n={1:0,2:0,3:0,4:0}
for x in m:
    n[x]+=1
    
t=0
for i in range(3):
    i+=1
    if n[i] != 1 and n[i] != 2:
        t=1
        
if t == 0:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a1,b1=map(int,input().split())
a2,b2=map(int,input().split())
a3,b3=map(int,input().split())
m = [a1,b1,a2,b2,a3,b3]

n={1:0,2:0,3:0,4:0}
for x in m:
    n[x]+=1
    
t=0
for i in range(4):
    i+=1
    if n[i] != 1 and n[i] != 2:
        t=1
        
if t == 0:
    print("YES")
else:
    print("NO")
r = int(input())
a = r * r * 3.14
l = r * 2 * 3.14
print('{} {}'.format(a, l))


### FIXED CODE ###

r = float(input())
pi = 3.14159265359
a = r * r * pi
l = r * 2 * pi
print('{:f} {:f}'.format(a, l))
a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = map(int, input().split())
 
d = abs(b_index - a_index)
d_v = abs(b_v - a_v)
 
if d == 0 :
  print("YES")
elif d_v != 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")

### FIXED CODE ###

a_index, a_v = map(int, input().split())
b_index, b_v = map(int, input().split())
t = int(input())
 
d = abs(b_index - a_index)
d_v = a_v - b_v
 
if d == 0 :
  print("YES")
elif d_v > 0 and d / d_v <= t :
  print("YES")
else :
  print("NO")
n = list(input())
n = int(''.join(n))
if n % 4 == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

n = input().split()
n = int(''.join(n))
if n % 4 == 0:
    print('YES')
else:
    print('NO')
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(s: str, K: int):
    N = len(s)
    for i in range(ord('a'), ord('z')+1):
        c = chr(i)
        l = -1
        subs = []
        while c in s[l+1:]:
            l = s.index(c, l+1)
            for r in range(l+1, N+1):
                subs.append(s[l:r])
        subs = sorted(list(set(subs)))
        if len(subs) > K:
            break
        else:
            K -= len(subs)
            continue
    print(subs[K-1])
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(s: str, K: int):
    N = len(s)
    for i in range(ord('a'), ord('z')+1):
        c = chr(i)
        l = -1
        subs = []
        while c in s[l+1:]:
            l = s.index(c, l+1)
            for r in range(l+1, min(N+1, l+1+K)):
                subs.append(s[l:r])
        subs = sorted(list(set(subs)))
        if len(subs) > K-1:
            break
        else:
            K -= len(subs)
            continue
    print(subs[K-1])
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    K = int(next(tokens))  # type: int
    solve(s, K)


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

input = sys.stdin.readline

d = []
ABC = []


def solve(i, dis):
    global d
    global ABC
    d[i] = dis

    for n, c in ABC[i]:
        if d[n] == -1:
            solve(n, dis + c)


def main():
    N = int(input())
    global ABC
    ABC = [[] for _ in range(N + 1)]
    global d
    d = [-1] * (N + 2)
    for _ in range(N - 1):
        a, b, c = [int(x) for x in input().split()]
        ABC[a - 1].append([b - 1, c])
        ABC[b - 1].append([a - 1, c])

    Q, K = [int(x) for x in input().split()]

    solve(K - 1, 0)

    for _ in range(Q):
        x, y = [int(x) for x in input().split()]
        print(d[x - 1] + d[y - 1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline

d = []
ABC = []

sys.setrecursionlimit(10 ** 8)


def solve(i, dis):
    global d
    global ABC
    d[i] = dis

    for n, c in ABC[i]:
        if d[n] == -1:
            solve(n, dis + c)


def main():
    N = int(input())
    global ABC
    ABC = [[] for _ in range(N + 1)]
    global d
    d = [-1] * (N + 2)
    for _ in range(N - 1):
        a, b, c = [int(x) for x in input().split()]
        ABC[a - 1].append([b - 1, c])
        ABC[b - 1].append([a - 1, c])

    Q, K = [int(x) for x in input().split()]

    solve(K - 1, 0)

    for _ in range(Q):
        x, y = [int(x) for x in input().split()]
        print(d[x - 1] + d[y - 1])


if __name__ == '__main__':
    main()
l=[int(input() for i in range(3))]
l.sort()
if l[2]==(l[0]+l[1]+l[2])/2:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c = map(int,input().split())
if a+b == c or b+c == a or c+a == b:
    print('Yes')
else:
    print('No')
from scipy.special import comb
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
def fact(n, k=1):
    if n == 0:
        return 1
    if n <= k:
        return 1
    return n*fact(n-1)
def comb(n, k):
    if n-k > k:
        return fact(n,k)/fact(n-k)
    else:
        return fact(n,n-k)/fact(k)
for k in range(K-2,N):
    nCk_2[k] = int(comb(k, K-2))%MOD
for i in range(N):
    for j in range(N):
        if N-i-j >= K:
            res += int((A[N-1-j]-A[i])*nCk_2[N-j-2-i]%MOD)
        if N-1-j < i:
            break
print(res)


### FIXED CODE ###

N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1)
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,N+1):
    fac[i] = fac[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD
def comb(n, k):
    return (fac[n]*((finv[k]*finv[n-k])%MOD))%MOD
s = [1,-1]
for m in range(2):
    for i in range(K-1,N):
        res = (res + s[m]*int((A[i])*comb(i,K-1)))%MOD
    A = sorted(A, reverse=True)
print(res)
N = map(int, input())
 
s = "abcdefghijklmnopqrstuvwxyz"
m = 0
ans = ""
 
for i in range(1,1000):
  m += 26**i
  if N <= m:
    M = N + 26**i　- m
    n = i-1
    break

for i in reversed(range(n)):
  a, b = divmod(M, 26**i)
  M = b
  ans = ans + s[a]

print(ans)

### FIXED CODE ###

N = int(input())

s = "abcdefghijklmnopqrstuvwxyz"
ans = ""
n, m = 0, 0

for i in range(1, 1000):
    m += 26 ** i
    if N <= m:
        n = i
        break

for i in range(n):
    a, b = divmod(N, 26)
    N = a
    if b == 0:
        ans += s[25]
        N -= 1
    else:
        ans += s[b-1]

ans1 = ''.join(list(reversed(ans)))
print(ans1)
import sys


sys.setrecursionlimit(100000)


MAX_N = 100000

memo = [-1] * MAX_N


def f(n):
    # 残り金額が0なら引き出す必要がないので0(再帰の終端条件)
    if n == 0:
        return 0
    # すでに探索済みならメモを参照する
    if memo[n] != -1:
        return memo[n]

    res = sys.maxsize

    pow9 = 1
    while pow9 <= N:
        if n - pow9 < 0:
            break
        # print(n)
        # print(pow9)
        res = min(res, f(n-pow9)+1)
        pow9 *= 9

    pow6 = 1
    while pow6 <= N:
        if n - pow6 < 0:
            break
        res = min(res, f(n-pow6)+1)
        pow6 *= 6

    # メモ
    memo[n] = res

    return res


if __name__ == '__main__':
    N = int(input())

    print(f(N))



### FIXED CODE ###

import sys


sys.setrecursionlimit(1000000)


MAX_N = 100001

memo = [-1] * MAX_N


def f(n):
    # 残り金額が0なら引き出す必要がないので0(再帰の終端条件)
    if n == 0:
        return 0
    # すでに探索済みならメモを参照する
    if memo[n] != -1:
        return memo[n]

    res = sys.maxsize

    pow9 = 1
    while pow9 <= N:
        if n - pow9 < 0:
            break
        res = min(res, f(n-pow9)+1)
        pow9 *= 9


    pow6 = 1
    while pow6 <= N:
        if n - pow6 < 0:
            break
        res = min(res, f(n-pow6)+1)
        pow6 *= 6

    # メモ
    memo[n] = res

    return res


if __name__ == '__main__':
    N = int(input())

    print(f(N))
a=input("A")
b=input("B")
c=input("C")
i=int(a)-int(b)
j=int(c)-int(i)
if j > 0:
    print(j)
else:
    print('0')


### FIXED CODE ###

A, B, C = map(int, input().split())
print(max(C - A + B, 0))