Harryxun/stf_run huggingface dataset:
import collections
from scipy.special import comb

n = int(input())
d_list = []
cnt_list = collections.defaultdict(lambda:1)
for i in range(n):
    s = str(input())
    
    d = collections.Counter(s)

    if i >= 1:
        if d in list(d_list):
            idx = d_list.index(d)
            cnt_list[idx] += 1
        else:
            d_list.append(d)
    else:
        d_list.append(d)

ans = 0
cnt_list = list(cnt_list.values())
for i in range(len(cnt_list)):
    ans += comb(cnt_list[i], 2, exact=True)
print(ans)

### FIXED CODE ###


from collections import Counter

N = int(input())
S = [''.join(map(str,(sorted(str(input()))))) for i in range(N)]
counter = Counter(S)

answer = sum(x*(x-1)//2 for x in counter.values())
print(answer)
s = list(input())
print(s)
if s[2] == s[3] && s[4] == s[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = list(input())
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
A, B, T = input.split(' ')
print(T / A * B)

### FIXED CODE ###

A, B, T = input().split(' ')
A = int(A)
B = int(B)
T = int(T)
print(int(T / A) * B)
N = int(input())
A = list(map(int, input().split()))

def up(i,pre):
  if i == len(A) - 1:
    return abs(A[pre] - A[i])
  res1 = res2 = 0
  if i + 2 <=len(A) -1:
    res1 = up(i + 1,i)
    res2 = up(i + 2,i)
   # print(min(abs(A[pre] - A[i]) + res1, abs(A[pre] - A[i]) + res2))
    return min(abs(A[pre] - A[i]) + res1, abs(A[pre] - A[i]) + res2)
  elif  i + 1 <=len(A) -1:
    res1 = up(i + 1,i)
    #print(abs(A[pre] - A[i]) + res1)
    return abs(A[pre] - A[i]) + res1
  
if N>=2:
 print(min(up(1,0),up(2,0)))
else:
  print(up(1,0))
    


  

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
dp = [0 for _ in range(len(A))]
dp[0] = 0 
for i in range(1,N):
    if i - 2>=0:
        dp[i] = min(dp[i-1] + abs(A[i] - A[i-1]),dp[i-2] + abs(A[i] - A[i-2]))
    else:
        dp[i] =dp[i-1] + abs(A[i] - A[i-1])

print(dp[len(A)-1])
n = int(input())
A,B = map(int,input().split())


if n == 1:
    print("Hello World")
else :
    print("A+B")

### FIXED CODE ###

n = int(input())


if n == 1:
    print("Hello World")
else :
    A = int(input())
    B = int(input())
    print(A+B)
#E https://atcoder.jp/contests/abc142/submissions/7853616
def main():
    n, m = map(int, input().split())
    inf = 10**9 #この10億は何に使う？->とにかくデカい数字。
    bit_dp = [inf for _ in range(2**(n))] #10億を2**n個並べる配列を作る。n=12 => 4096個
    bit_dp[0] = 0
    for i in range(m):
        a, b = map(int, input().split())
        c = list(map(int, input().split()))#鍵1個につきa,b,c1~cbを決める
        bit_n = 0
        for i in c:
            bit_n |= 1 << i - 1 #ここで何番目をあけられるのかをbit_nで定義する。1と3ならbit_n=(5)101、2と3なら110(6)
        for i in range(2**n):
            if bit_dp[i|bit_n] > bit_dp[i] + a:
                bit_dp[i|bit_n] = bit_dp[i] + a
    if bit_dp[-1] >= inf:
        print(-1)
    else:
        print(bit_dp[-1])
                
if __name__ == "__main__":
    main()

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    print(1 / 2)
else:
    print((N - (((N + 1) / 2) -1)) / N)
import copy

kaisu = int(input())

s_suji_list = input().split(' ')
suji_list = []
count = 0
cotinule_flg = true
for suji in s_suji_list:
  i_suji = int(suji)
  if suji % 2 == 0:
    suji_list.append(suji / 2)
  else:
    continue_flg = false
    break
count = 1

while(continue_flg):
  temp_list = copy.copy(suji_list)
  suji_list.clear()
  count += 1
  for suji in temp_list:
    if suji % 2 == 0:
      suji_list.append(suji / 2)
    else:
      count -= 1
      continue_flg = false
      break

print(count)

### FIXED CODE ###

import copy
 
kaisu = int(input())
 
s_suji_list = input().split(' ')
suji_list = []
count = 1
continue_flg = True
for suji in s_suji_list:
  i_suji = int(suji)
  if i_suji % 2 == 0:
    suji_list.append(i_suji / 2)
  else:
    continue_flg = False
    count = 0
    break
 
while(continue_flg):
  temp_list = copy.copy(suji_list)
  suji_list.clear()
  count += 1
  for suji in temp_list:
    if suji % 2 == 0:
      suji_list.append(suji / 2)
    else:
      count -= 1
      continue_flg = False
      break
 
print(count)
N = int(input())
A = list(map(int,input().split()))
A.sort()
D = [A[i+1]-A[i] for i in range(len(A)-1)]
 
if N == 2:
  print(max(A))
elif len(set(A))==1:
  print(A[0])
else:
  for d in D:
    cnt = 0
    for a in A:
      if a%d != 0:
        cnt = cnt+1
    if cnt <=1:
      print(i)
      break
    

### FIXED CODE ###

A,B,T =  map(int,input().split())
print((T//A)*B)
n=int(input())
A=sorted(list(map(int,input().split())))
print(sum(A[n//2:])-sum(A[:n//2]))

  
while len(A)!=3:  
  a=A[0]
  b=A[len(A)-1]
  print("{} {}".format(b,a))
  del A[0]
  del A[len(A)-1]
  A.append(b-a)
print("{} {}".format(A[0],A[1]))
print("{} {}".format(A[2],A[0]-A[1]))
    
    

### FIXED CODE ###

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

if n==2:
    print(abs(A[0]-A[1]))
    print(*A)
    exit()
A.sort()
menos=[] ; plus=[]
for i in range(len(A)):
    if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i])
if menos==[]:
    print(sum(plus)-plus[0]*2)
    res=plus[0]
    for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
    print(A[n-1], res);exit()
        
elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
    

print(sum(plus)-sum(menos))
m=len(menos); p=len(plus)
if p==1:
    res=plus[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
if m==1:
    res=menos[0]
    for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
    print(plus[-1], res);exit()

Q= plus[1:]+ [menos[0]]
W= menos[1:]+[plus[0]] ;#print(Q,W)

res=W[-1]
for i in range(len(W)-1):
    print(res,W[i])
    res=res-W[i]
rec=Q[-1]
for i in range(len(Q)-1):
    print(rec, Q[i])
    rec=rec-Q[i]
print(res,rec)
import sys
import numpy as np

input = sys.stdin.readline

h, w = map(int, input().split())
map_arr1d = np.array([0 if s == '#' else 1 for _ in range(h) for s in input()[:-1]])
map_2d = map_arr1d.reshape(h, w)

h_map = []
for h_arr in map_2d:
    cnt = 0
    tmp_list = []
    for a in h_arr:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    h_map.extend(tmp_list)
h_map = np.array(h_map).reshape(h, w)

w_map = []
for w_arr in map_2d.T:
    cnt = 0
    tmp_list = []
    for a in w_arr:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    w_map.extend(tmp_list)
w_map = np.array(w_map).reshape(w, h).T
print((h_map + w_map).max()-1)


### FIXED CODE ###

import sys

input = sys.stdin.readline

h, w = map(int, input().split())
map_list = [[0 if s == '#' else 1 for s in input()[:-1]] for _ in range(h)]

h_map = []
for h_list in map_list:
    cnt = 0
    tmp_list = []
    for a in h_list:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    h_map.append(tmp_list)

w_map = []
for w_arr in [list(x) for x in zip(*map_list)]:
    cnt = 0
    tmp_list = []
    for a in w_arr:
        if a == 0:
            if cnt > 0:
                tmp_list.extend([cnt]*cnt)
                cnt = 0
            tmp_list.append(0)
        else:
            cnt += 1
    if cnt > 0:
        tmp_list.extend([cnt]*cnt)
    w_map.append(tmp_list)
w_map = [list(x) for x in zip(*w_map)]
max_l = 0
for h_list, w_list in zip(h_map, w_map):
    for h_num, w_num in zip(h_list, w_list):
        max_l = max(max_l, h_num + w_num)
print(max_l - 1)
from heapq import heappush, heappop


def solve(X, Y, Z, K, As, Bs, Cs):
    As.sort()
    Bs.sort()
    Cs.sort()
    ADs = [a2 - a1 for a1, a2 in zip(As, As[1:])][::-1]
    BDs = [a2 - a1 for a1, a2 in zip(Bs, Bs[1:])][::-1]
    CDs = [a2 - a1 for a1, a2 in zip(Cs, Cs[1:])][::-1]

    m = As[-1] + Bs[-1] + Cs[-1]
    h = []
    ans = [m]
    heappush(h, (ADs[0], (0, -1, -1)))
    heappush(h, (BDs[0], (-1, 0, -1)))
    heappush(h, (CDs[0], (-1, -1, 0)))
    taken = set()
    for i in range(K - 1):
        p, stacks = heappop(h)
        taken.add(stacks)
        ans.append(m - p)
        if stacks[0] + 1 < len(ADs):
            d = (p + ADs[stacks[0] + 1]), (stacks[0] + 1, stacks[1], stacks[2])
            if d not in h and d not in taken:
                heappush(h, d)
        if stacks[1] + 1 < len(BDs):
            d = (p + BDs[stacks[1] + 1]), (stacks[0], stacks[1] + 1, stacks[2])
            if d not in h and d not in taken:
                heappush(h, d)
        if stacks[2] + 1 < len(CDs):
            d = (p + CDs[stacks[2] + 1]), (stacks[0], stacks[1], stacks[2] + 1)
            if d not in h and d not in taken:
                heappush(h, d)

    return "\n".join([str(a) for a in ans])


if __name__ == "__main__":
    X, Y, Z, K = tuple(map(int, input().split(" ")))
    As = list(map(int, input().split(" ")))
    Bs = list(map(int, input().split(" ")))
    Cs = list(map(int, input().split(" ")))
    print(solve(X, Y, Z, K, As, Bs, Cs))


### FIXED CODE ###

from heapq import heappush, heappop


def solve(X, Y, Z, K, As, Bs, Cs):
    As.sort()
    Bs.sort()
    Cs.sort()
    ADs = [a2 - a1 for a1, a2 in zip(As, As[1:])][::-1]
    BDs = [a2 - a1 for a1, a2 in zip(Bs, Bs[1:])][::-1]
    CDs = [a2 - a1 for a1, a2 in zip(Cs, Cs[1:])][::-1]

    m = As[-1] + Bs[-1] + Cs[-1]
    h = []
    ans = [m]
    if ADs:
        heappush(h, (ADs[0], (0, -1, -1)))
    if BDs:
        heappush(h, (BDs[0], (-1, 0, -1)))
    if CDs:
        heappush(h, (CDs[0], (-1, -1, 0)))
    taken = set()

    for i in range(K - 1):
        p, stacks = heappop(h)
        while (p, stacks) in taken:
            p, stacks = heappop(h)
        taken.add((p, stacks))
        ans.append(m - p)

        if stacks[0] + 1 < len(ADs):
            heappush(h, ((p + ADs[stacks[0] + 1]), (stacks[0] + 1, stacks[1], stacks[2])))
        if stacks[1] + 1 < len(BDs):
            heappush(h, ((p + BDs[stacks[1] + 1]), (stacks[0], stacks[1] + 1, stacks[2])))
        if stacks[2] + 1 < len(CDs):
            heappush(h, ((p + CDs[stacks[2] + 1]), (stacks[0], stacks[1], stacks[2] + 1)))

    return "\n".join([str(a) for a in ans])

if __name__ == "__main__":
    X, Y, Z, K = tuple(map(int, input().split(" ")))
    As = list(map(int, input().split(" ")))
    Bs = list(map(int, input().split(" ")))
    Cs = list(map(int, input().split(" ")))
    print(solve(X, Y, Z, K, As, Bs, Cs))
a = int(input(""))
b = int(input(""))

print(str(a * b) + " " + str(2 * a + 2 * b))


### FIXED CODE ###

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

print(str(a * b) + " " + str(2 * a  + 2 * b))
i=input
n=int(i())
a=eval('eval("list(map(int,i().split())),"*int(i())),'*n)
print(max(all(y==i>>x-1&1for j,t in enumerate(a)if i>>j&1for x,y in t)*bin(i).count('1')for i in range(2**n)))

### FIXED CODE ###

n=int(input())
a=[[list(map(int,input().split()))for _ in'_'*int(input())]for _ in'_'*n]
m=0
for i in range(2**n):
  *s,=map(int,bin(i)[2:].zfill(n))
  f=1
  for j,t in enumerate(a):
    if s[~j]:
      for x,y in t:f&=s[-x]==y
  m=max(m,sum(s)*f)
print(m)
N = int(input())
L = [int(input()) for L in range(N)]
if max(L) < (sum(L) - max(L)):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
if max(L) < (sum(L) - max(L)):
    print('Yes')
else:
    print('No')
N=int(input())
W=list(map(int,input().split()))

res=0
s=sum(W)
ans=100000000000
for i in range(N):
  res+=W[i]
  ans=min(abs(s-res*2)

### FIXED CODE ###

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

res=0
s=sum(W)
ans=100000000000
for i in range(N):
  res+=W[i]
  ans=min(ans,abs(s-res*2))
print(ans)
n = int(input())
*args, = [int(input()) for _ in range(n)]

worst = min(args)

print(6 + n // worst)

### FIXED CODE ###

import math

n = int(input())
traffic_list = [int(input()) for _ in range(5)]

print(4 + math.ceil(n/min(traffic_list)))
N,K = map(int,input().split())
A = list(map(int,input().split()))
b,c,d = 0,0,0
mod = 10**9+7
B = []
C = []
D = []
for a in A:
    if a < 0:
        b += 1
        B.append(a)
    elif a == 0:
        c += 1
        C.append(a)
    else:
        d += 1
        D.append(a)
if B:
    B.sort()
if D:
    D.sort(reverse = True)
if K > b+d:
    print(0)
elif K == b+d and K< N and b%2 == 1:
    print(0)
elif K == N:
    ans = 1
    for i in range(N):
        ans = ans * A[i] % mod
    print(ans)
elif b == N and K % 2 == 1:
    ans = 1
    for i in range(1,K+1):
        ans = ans*B[-i]%mod
    print(ans)
else:
    bi = 0
    di = 0
    ans = 1
    while(K>1):
        if (bi >= b) or (di+1< d and D[di]*D[di+1] > B[bi]*B[bi+1]):
            ans = ans*D[di]%mod
            ans = ans*D[di+1]%mod
            di += 2
        else:
            ans = ans*B[bi]%mod
            ans = ans*B[bi+1]%mod
            bi += 2
        K -= 2
    if K == 1:
        ans = ans * D[di] % mod
    print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
b,c,d = 0,0,0
mod = 10**9+7
B = []
C = []
D = []
for a in A:
    if a < 0:
        b += 1
        B.append(a)
    elif a == 0:
        c += 1
        C.append(a)
    else:
        d += 1
        D.append(a)
if B:
    B.sort()
if D:
    D.sort(reverse = True)
if K > b+d:
    print(0)
elif K == b+d and K< N and b%2 == 1:
    print(0)
elif K == N:
    ans = 1
    for i in range(N):
        ans = ans * A[i] % mod
    print(ans)
elif b == N and K % 2 == 1:
    ans = 1
    for i in range(1,K+1):
        ans = ans*B[-i]%mod
    print(ans)
elif K<b and d == 0 and K%2 == 1:
    print(0)
else:
    bi = 0
    di = 0
    ans = 1
    while(K>1):
        if (bi >= b-1) or (di+1< d and D[di]*D[di+1] > B[bi]*B[bi+1]):
            ans = ans*D[di]%mod
            ans = ans*D[di+1]%mod
            di += 2
        else:
            ans = ans*B[bi]%mod
            ans = ans*B[bi+1]%mod
            bi += 2
        K -= 2
    if K == 1:
        ans = ans * D[di] % mod
    print(ans)
i = 0
while x=int(input()):
 i++
 print("Case {i}:{x}", i, x)

### FIXED CODE ###

i=0
x=int(input())
while x != 0:
 i = i+1
 print("Case " + str(i) + ": " + str(x))
 x=int(input())
a,b=map(str,input().split())
count = 0
for i in range(a,b):
  if i[0]==i[4] and i[1]==i[3]:
    count+=1
print(count)

### FIXED CODE ###

a,b=map(int,input().split())
count = 0
for i in range(a,b+1):
  if str(i)[0]==str(i)[4] and str(i)[1]==str(i)[3]:
    count+=1
print(count)
N,K = map(int,input().split())
A = list(map(int,input().split()))

d = [0]*40
for a in A:
    for k in range(len(bin(a))-1):
        d[k] += min(a&2**k,1)

dd = [0]*len(bin(K))
for k in range(len(dd)-1):
    dd[k] = dd[k-1]+max(d[k],N-d[k])*2**k

dp = [0]*(len(bin(K))-1)

for k in range(len(dp)):
    if K&2**k == 0:
        dp[k] = dp[k-1]+d[k]*2**k
    else:
        dp[k] = max(dp[k-1]+(N-d[k])*2**k,dd[k-1]+d[k]*2**k)

print(dp[-1])

### FIXED CODE ###

from collections import defaultdict
N,K = map(int,input().split())
A = list(map(lambda x:bin(int(x))[2:],input().split()))
l = 0
for i in range(N):
    l = max(l,len(A[i]))
count = defaultdict(lambda:0)
for i in range(N):
    for j in range(len(A[i])):
        if A[i][-j-1] == '1':
            count[j] += 1
l = max(count.keys())

def rec(x):
    if x=='':
        return 0
    if '0' not in x:
        res = 0
        for i in range(len(x)):
            res += max(count[i],N-count[i])*2**i
        return res
    if x[0] == '1':
        return max(rec('1'*(len(x)-1))+count[len(x)-1]*2**(len(x)-1),rec(x[1:])+(N-count[len(x)-1])*2**(len(x)-1))
    else:
        return rec(x[1:])+count[len(x)-1]*2**(len(x)-1)
ans = rec(bin(K)[2:])
for i in range(len(bin(K)[2:]),l+1):
    ans += count[i]*2**i
print(ans)
data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
	

### FIXED CODE ###

data = input().split()
a = int(data[0])
b = int(data[1])
while(a != 0 or b != 0):
	if a > b:
		temp = a
		a = b
		b = temp
	print(str(a) + " " + str(b))
	data = input().split()
	a = int(data[0])
	b = int(data[1])
def main():

	s = str(input())
	t = str(input())
	l = []
	for i in range(len(s)-len(t)):
		l.append(s[i:i+len(t)])
	ans = []
	for c in l:
		counter = 0
		for i in range(len(c)):
			if list(c)[i] == t[i]:
				counter += 1
		ans.append(counter)
	print(len(t)-max(ans))





	

if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	s = str(input())
	t = str(input())
	
	
	if len(s) == len(t):
		ans = 0
		for i in range(len(t)):
			if list(s)[i] == list(t)[i]:
				ans += 1
		print(len(t)-ans)

	else:
		l = []
		for i in range(len(s)-len(t)):
			l.append(s[i:i+len(t)])
		
		ans = []
		for c in l:
			counter = 0
			for i in range(len(c)):
				if list(c)[i] == list(t)[i]:
					counter += 1
			ans.append(counter)

		if not ans:
			print(len(t))
		else:
			print(len(t)-max(ans))





	

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

def BIT_update(tree,x):
  while x <= n:
    tree[x] += 1
    x += x&(-x)
def BIT_sum(tree,x):
  s = 0
  while x:
    s += tree[x]
    x -= x&(-x)
  return s

  
n,k = map(int, input().split())
a = list(map(int, input().split()))
sorted_a = sorted(a)
d = 0
tree = [0] * (n+1)
 

ans = n*(n-1)//2

for x in a:
  ans -= BIT_sum(tree,x)
  BIT_update(tree,x)
  
mod = 10 ** 9 + 7
ans = (ans * k) % mod

for i in a:
  d += bisect.bisect_left(sorted_a, i)

ans += (d*((k*(k-1))//2)) % mod 
print(ans%mod)


### FIXED CODE ###

import bisect

class BinaryIndexedTree:
    # http://hos.ac/slides/20140319_bit.pdf
    def __init__(self, size):
        self._bit = [0 for _ in range(size)]
        self._size = size
 
    def add(self, i, w):
        x = i + 1
        while x <= self._size:
            self._bit[x - 1] += w
            x += x & -x
 
    def sum(self, i):
        ret = 0
        x = i + 1
        while x > 0:
            ret += self._bit[x - 1]
            x -= x & -x
        return ret
 
    def __len__(self):
        return self._size
 
 
def count_inversions(li, max=None):
    if not max:
        max = __builtins__.max(li)
    bit = BinaryIndexedTree(size=max + 1)
    ret = 0
    for i in range(len(li)):
        ret += i - bit.sum(li[i])
        bit.add(li[i], 1)
    return ret

  
n,k = map(int, input().split())
a = list(map(int, input().split()))
sorted_a = sorted(a)
d = 0
tree = [0] * (n+1) 
mod = 10 ** 9 + 7
ans = (count_inversions(a, max=max(a)) * k) % mod

for i in a:
  d += bisect.bisect_left(sorted_a, i)

ans += (d*((k*(k-1))//2)) % mod 
print(ans%mod)
from collections import deque, Counter, defaultdict

n, m, k = map(int, input().split())
F = [[] for _ in range(n+1)]
B = [[] for _ in range(n+1)]

for _ in range(m):
    a, b = map(int, input().split())
    F[a].append(b)
    F[b].append(a)

rks = [0]*(n+1)

def dfs(s,r):
    if rks[s] == 0:
        rks[s] = r
    else:
        return
    for i in F[s]:
        dfs(i,r)

r = 0
for i in range(1,n+1):
    if rks[i] == 0:
        r += 1
        dfs(i,r)

for _ in range(k):
    c, d = map(int, input().split())
    if rks[c] == rks[d]:
        B[c].append(d)
        B[d].append(c)

counter = Counter(rks)
for i in range(1,n+1):
    print(counter[rks[i]] - len(F[i]) - len(B[i]) - 1)




### FIXED CODE ###

import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, m, k = map(int, input().split())
    fgraph = [list() for i in range(n)]
    bgraph = [list() for i in range(n)]
    cgraph = [list() for i in range(n)]
    
    rks = [None] *n
    sys.setrecursionlimit(10**9)
    # r: どの連結成分に存在するかをメモするid
    def dfs(graph,s,r):
        if rks[s] is None:
            rks[s] = r
        for i in range(len(graph[s])):
            if rks[graph[s][i]-1] is not None:
                continue
            dfs(graph, graph[s][i]-1,r)

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

    # print(fgraph)
    #print(bgraph)
    # 連結成分に対してid的なindexをつける
    c = -1
    for i in range(n):
        if rks[i] is None:
            c += 1
            dfs(fgraph, i, c)
    
    for i in range(k):
        c,d = map(int, input().split())
        if rks[c-1] == rks[d-1]:
            bgraph[d-1].append(c)
            bgraph[c-1].append(d)

    counter = Counter(rks)
    for i in range(n):
        # counter[rks[i]] 連結成分のサイズ
        # len(fgraph[i]) 友達の数
        # len(bgraph[i]) 連結成分内のブロックの数
        # 1 自分
        print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

if __name__ == '__main__':
    main()
import numpy as np
N,K = (int(i) for i in input().split())  
AB = [[int(i) for i in input().split()] for i in range(N-1)] 

Tree = [[] for _ in range(N+1)]
d = []

for i in range(N-1):
    a, b = AB[i]
    Tree[a].append(b)
    Tree[b].append(a)

answer = K

for i in range(len(Tree[1])):
    answer = (answer * (K - 1 - i))%(int(10**9)+7)
    d.append([1, Tree[1][i]])

Tree[1] = []

while d != []:
    for i in range(len(d)):
        parent, child = d[0]
        Tree[child].pop(Tree[child].index(parent))
        for j in range(len(Tree[child])):
            d.append([child, Tree[child][j]])
            answer = (answer * (K - 2 - j))%(int(10**9)+7)
        d.pop(0)
        Tree[child] = []
print(answer)

### FIXED CODE ###

import numpy as np
from collections import deque

N,K = (int(i) for i in input().split())  
AB = [[int(i) for i in input().split()] for i in range(N-1)] 

Tree = [[] for _ in range(N+1)]
d = deque()

for i in range(N-1):
    a, b = AB[i]
    Tree[a].append(b)
    Tree[b].append(a)

answer = K

for i in range(len(Tree[1])):
    answer = (answer * (K - 1 - i))%(int(10**9)+7)
    d.append([1, Tree[1][i]])

Tree[1] = []

while d != deque():
    for i in range(len(d)):
        parent, child = d[0]
        Tree[child].pop(Tree[child].index(parent))
        for j in range(len(Tree[child])):
            d.append([child, Tree[child][j]])
            answer = (answer * (K - 2 - j))%(int(10**9)+7)
        d.popleft()
print(answer)
s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
	if s[i] is not t[i]:
		ans += 1
print(ans)

### FIXED CODE ###

s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
	if s[i] is not t[i]:
		ans += 1
print(ans)
a,b=input().split()
if s==b:
  print('Yes')
 else:
  print('No')

### FIXED CODE ###

a,b=input().split()
if a==b:
  print('Yes')
else:
  print('No')
I = input().split()

N = int(I[0])
K = int(I[1])

if K != N:
  print(1)
elif K = N:
  print(0)

### FIXED CODE ###

I = input().split()

N = int(I[0])
K = int(I[1])

if N % K == 0:
  print(0)
else:
  print(1)
N = int(input())
if N < 10 ** 1:
    print(N)
elif N < 10 ** 2:
    print(9)
elif N < 10 ** 3:
    print(N - 90)
elif N < 10 ** 4:
    print(909)
elif N < 10 ** 5:
    print(N - 9090)
else:
     print(90909)

### FIXED CODE ###

A, B, C = map(int, input().split())
if A >= 1 and A <=20 and B >= 1 and B <=20 and A >= B and C >= 1 and C <=20:
    if C - (A - B) >= 0:
        print(C - (A - B))
    else:
        print(0)