Harryxun/stf_run huggingface dataset:
l=[int(input()) for in in range(3)]
a=l[0]
b=l[1]
h=l[2]
print((a+b)*h//2)

### FIXED CODE ###

l=[int(input()) for i in range(3)]
a=l[0]
b=l[1]
h=l[2]
print((a+b)*h//2)
import math
def lcm(x, y):
    return int((x * y) / math.gcd(x, y))

A,B = map( int ,input().split())
#print(math.gcd(A,B))
print(lcm(A,B))

### FIXED CODE ###

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    while x%y != 0:
        z = x%y
        x = y
        y = z
    else:
        return y
def lcm(m,n):
    return int(m * n /gcd(m,n))

A,B = map( int ,input().split())
print(lcm(A,B))
n = int(input())
for i in range(3,n+1):
  x = i
  if x % 3 == 0:
    print(' {0}'.format(i), end='')
    continue

  while x != 0:
    if x % 10 == 3:
      print(' {0}.format(i), end='')
    break
    x //= 10

print()

### FIXED CODE ###

n = int(input())
for i in range(3,n+1):
  x = i
  if x % 3 == 0:
    print(' {0}'.format(i), end='')
    continue

  while x != 0:
    if x % 10 == 3:
      print(' {0}'.format(i), end='')
      break
    x //= 10

print()
def main():
    import copy

    num, quantity = map(int, input().split())
    nums = list(map(int, input().split()))
    nums.sort()
    
    if quantity == 0:
        print(num)
        return
    
    i = 0

    minus_num = copy.copy(num)
    plus_num = copy.copy(num)

    while i = 1
        if num not in nums:
            print(num)
            return
        
        if minus_num not in nums:
            print(minus_num)
            return
        
        if plus_num not in nums:
            print(plus_num)
            return
        
        minus_num = minus_num - 1
        plus_num = plus_num + 1



main()

### FIXED CODE ###

def main():
    import copy

    num, quantity = map(int, input().split())
    nums = list(map(int, input().split()))
    nums.sort()
    
    if quantity == 0:
        print(num)
        return
    
    i = 0

    minus_num = copy.copy(num)
    plus_num = copy.copy(num)

    while i < len(nums):
        if num not in nums:
            print(num)
            return
        
        if minus_num not in nums:
            print(minus_num)
            return
        
        if plus_num not in nums:
            print(plus_num)
            return
        
        minus_num = minus_num - 1
        plus_num = plus_num + 1

main()
a = int(input())
b = int(input())
j = 0
if a == b:
    print("高橋は",a,"日")



### FIXED CODE ###

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

if a < b:
    print(a)

elif a > b:
    a = a - 1
    print(a)

elif a == b:
    print(a)
import math

def lcm(a,b):
    print((a * b) // math.gcd(a,b))

a,b = [int(x) for x in input().split()]

lcm(a,b)

### FIXED CODE ###

import fractions

def lcm(a,b):
    print((a * b) // fractions.gcd(a,b))

a,b = [int(x) for x in input().split()]
lcm(a,b)
A,B,C = input()

print("A"+B[0]+"C")

### FIXED CODE ###

S = input().split()

print(S[0][0]+S[1][0]+S[2][0])
A, B, K = map(int, input().split())

for i in range(A, min(A+K, B)):
    print(i)

for j in range(max(i+1, B-K+1), B+1): 
    print(j)

### FIXED CODE ###

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

if A+K > B:
    for i in range(A, B+1):
        print(i)

else:
    for i in range(A, A+K):
        print(i)
    
    for j in range(max(i, B-K), B):
        print(j+1)
n=int(input())
a=int(input())
if n%500 - a < 0:
  print("No")
else:
  prnt("Yes")

### FIXED CODE ###

n=int(input())
a=int(input())
if n%500 - a < 1:
  print("Yes")
else:
  print("No")
n=int(input())
l=[int(input()) for i in range(n)]
ans=0
for i in range(n):
  ans+=(l[i]-l[i]%2)//2
  l[i]%=2
  if l[i]==1
    ans+=1
    l[i]=0;l[i+1]-=1
print(ans)


### FIXED CODE ###

n=int(input())
ans=0
check=0
for i in range(n):
  s=int(input())
  if i==n-1:
    check+=s
    ans+=check//2
  elif s!=0:
    check+=s
  else:
    ans+=check//2
    check=0
print(ans)
x = str(raw_input()).split(" ")
 menseki = x[0] * x[1]
 syuu = x[0]*2 + x[1]*2
 
 print(menseki + " " + syuu) 

### FIXED CODE ###

a, b = map(int, raw_input().split(' '))
print(str(a*b)+(" ")+str((a+b)*2))
a,b=map(int,input().split())

if a-2b>=0:
  print a-2b
else:
  print 0

### FIXED CODE ###

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

if a-2*b>=0:
  print(a-2*b)
else:
  print(0)
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

n, m, l = map(int, input().split())
abc = []
for mi in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    abc.append([a, b, c])
    abc.append([b, a, c])
q = int(input())
st = []
for i in range(q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    st.append((s,t))


if m == 0:
    print(-1)
    sys.exit()

a, b, c = np.array(abc).T
adjacency_matrix = csr_matrix((c, (a,b)), (n, n))

shotest = dijkstra(adjacency_matrix)
fuel_once = np.where(shotest <= l, 1, 0)
once_dijkstra = dijkstra(fuel_once)
fuel_times = np.where(once_dijkstra > 0, once_dijkstra - 1, once_dijkstra).astype(int)

for tap in st:
    s, t = tap
    print(fuel_times[s][t])


### FIXED CODE ###

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

n, m, l = map(int, input().split())
abc = []
for _ in range(m):
    abc.append(map(int, input().split()))
q = int(input())
st = []
for _ in range(q):
    st.append(map(int, input().split()))

adjacency_matrix = np.zeros((n, n))
for a, b, c in abc:
    adjacency_matrix[a-1, b-1] = c
    adjacency_matrix[b-1, a-1] = c

shotest = dijkstra(adjacency_matrix)
fuel_once = np.where(shotest <= l, 1, 0)
fuel_times = dijkstra(fuel_once-np.eye(n))

for s, t in st:
    ans = fuel_times[s-1][t-1]
    if np.isinf(ans):
        print(-1)
    else:
        print(int(ans) - 1)
n.a,b = map(int,input().split())
def ten(i):
  wa = 0
  while i != 0:
     wa += i%10
     i = i//10
  print(wa)  

for i in range(n + 1):
  result = 0
  if a <= ten(i) and ten(i)<=b:
    result += i
print(result)    

### FIXED CODE ###

n,a,b = map(int,input().split())
def ten(i):
  wa = 0
  while i != 0:
     wa += i%10
     i = i//10
  return(wa)  

result = 0
for i in range(n + 1):
  if a <= ten(i) and ten(i)<=b:
    result += i
print(result)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

s1 = ''
for ss in s:
    s1 += ss
    s1 += 'A'*(m-1)

t1 = ''
for tt in t:
    t1 += tt
    t1 += 'A'*(n-1)

ok = 1
for k in range(len(s1)):
    if s1[k] != 'A' and t1[k] != 'A':
        if s1[k] != t1[k]:
            ok = -1
        if ok == -1:
            break
if ok == 1:
    print(int(m * n / gcd(m,n)))
else:
    print('-1')

### FIXED CODE ###

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

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

sdic = {}
for k in range(0, len(s)):
    sdic[k*m] = s[k]
tdic = {}
for k in range(0, len(t)):
    tdic[k*n] = t[k]
ok = 1
for skey in sdic.keys():
    try:
        if tdic[skey] != sdic[skey]:
            ok = -1
    except:
        pass
    
if ok == 1:
    print(int(m * n / gcd(m,n)))
else:
    print('-1')
N = int(input())
H = list(map(int,input().split()))

l = len(H)
L = [0]
for i in range(l-1):
    if H[i] < H[i+1]:
        L.append(i)

L.append(l-1)

jump = [L[i+1] - L[i] - 1 for i in range(len(L)-1)]
print(max(jump))


### FIXED CODE ###

S = list(input())
T = list(input())
ans = 0
for i in range(3):
  if S[i] == T[i]:
    ans += 1

print(ans)
a,b,c=input()

if a==b and b==c:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if a==b and b==c:
  print('Yes')
else:
  print('No')
import sys

readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))


def f(md, pos):
    res = 0
    fpos = -2
    for av in a:
        while True:
            if pos != -1 and av + b[pos] >= md:
                pos -= 1
            else:
                if fpos == -2:
                    fpos = pos
                res += pos + 1
                break
    return res, fpos


def solve():
    dp = [0] * 31
    for i in range(28, -1, -1):
        md = pow(2, i + 1)
        for j in range(n-1, -1, -1):
            b[j] %= md
            a[j] %= md
        a.sort()
        b.sort()
        pos = n - 1
    for i in range(31):
        t += pow(2, i) * dp[i]
    print(t)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import bisect

readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))


def f(md):
    pos = n - 1
    res = 0
    for av in a:
        while True:
            if pos != -1 and av + b[pos] >= md:
                pos -= 1
            else:
                res += pos + 1
                break
    return res


def solve():
    dp = [0] * 31
    for i in range(28, -1, -1):
        md = pow(2, i + 1)
        for j in range(n-1, -1, -1):
            b[j] %= md
            a[j] %= md
        a.sort()
        b.sort()
        res1, res2, res3 = f(md // 2), f(md // 2 * 2), f(md // 2 * 3)
        dp[i] += (n - (res1 + res3 - res2)) % 2
    t = 0
    for i in range(31):
        t += pow(2, i) * (dp[i] % 2)
    print(t)


if __name__ == '__main__':
    solve()
N, M = map(int, input().split())
S = []
C = []
for _ in range(N):
  s, c = map(int, input().split())
  S.append(s - 1)
  C.append(c)

num = ['*'] * N

for s, c in zip(S, C):
  if num[s] == '*':
    num[s] = str(c)
  elif num[s] != str(c):
    print(-1)
    exit()

if num[0] == '*':
  num[0] = '1'
elif num[0] == '0':
  print(-1)
  exit()
print(''.join(num).replace('*', '0'))

### FIXED CODE ###

N, M = map(int, input().split())
S = []
C = []
for _ in range(M):
  s, c = map(int, input().split())
  S.append(s - 1)
  C.append(c)

num = ['*'] * N

for s, c in zip(S, C):
  if s == 0 and c == 0 and N != 1:
    print(-1)
    exit()
  if num[s] == '*':
    num[s] = str(c)
  elif num[s] != str(c):
    print(-1)
    exit()

if num[0] == '*' and N != 1:
  num[0] = '1'
print(''.join(num).replace('*', '0'))
A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
v=V-W
l=B-A
if l>0:
  if l <= v*T:
    if l%v==0:
      print("YES")
    else:
      print("NO")
  else:
    print("NO")
else:
  if l <= v*T:
    if l%v==0:
      print("YES")
    else:
      print("NO")
  else:
    print("NO")

### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

print('YES' if abs(b-a) <= (v-w) * t else 'NO')
N = int(input())
An = list(map(int, input().split()))
done = 0
for i in An:
    if done+1 == i:
        done = i
    print(done,An,i)

if done == 0:
    print(-1)
else:
    print(N-done)


### FIXED CODE ###

N = int(input())
An = list(map(int, input().split()))
done = 0
for i in An:
    if done+1 == i:
        done = i
if done == 0:
    print(-1)
else:
    print(N-done)
N,M = map(int,input().split())
score = list(map(int,input().split()))
score = sorted(score,reverse=True)
if score[M]*4*M >= sum(score):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N,M = map(int,input().split())
score = list(map(int,input().split()))
score = sorted(score,reverse=True)
if score[M-1]*4*M < sum(score):
    print("No")
else:
    print("Yes")
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

### FIXED CODE ###

import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	if x==0:
		print(0)
		continue
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)
A,B,C,K = int(input().split(' '))
out = 0
if A>K:
  print(K)
else:
  out += A
  K -= A
  if B > K:
    print(out)
  else:
    K -= B
    out -= K
    print(out)

### FIXED CODE ###

A,B,C,K = map(int,input().split(' '))
out = 0
if A>K:
  print(K)
else:
  out += A
  K -= A
  if B > K:
    print(out)
  else:
    K -= B
    out -= K
    print(out)
N = list(map(int,input()))
K = int(input())
L = len(N)

def comb(n,k):
    if n < 0 or k < 0 or k > n:
        return 0
    ans = 1
    for i in range(k):
        ans *= n-i
    for i in range(k):
        ans //= i+1
    return ans

i = 0
D = [0] * K
M = K
for k in range(K):
    while N[i] == 0 and i < L:
        i += 1
    if i < L:
        D[k] = i
        i += 1
    else:
        M = k

ans = 0
for k in range(M):
    i = D[k]
    ans += comb(L-1-i,K-k)*(9**(K-k))
    ans += (N[i]-1) * comb(L-1-i,K-1-k)*(9**(K-1-k))
if K == M:
    ans += 1

print(ans)


### FIXED CODE ###

N = list(map(int,input()))
K = int(input())
L = len(N)

def comb(n,k):
    if n < 0 or k < 0 or k > n:
        return 0
    ans = 1
    for i in range(k):
        ans *= n-i
    for i in range(k):
        ans //= i+1
    return ans

i = 0
D = [0] * K
M = K
for k in range(K):
    while i < L and N[i] == 0:
        i += 1
    if i < L:
        D[k] = i
        i += 1
    else:
        M = k
        break

ans = 0
for k in range(M):
    i = D[k]
    ans += comb(L-1-i,K-k)*(9**(K-k))
    ans += (N[i]-1) * comb(L-1-i,K-1-k)*(9**(K-1-k))
if K == M:
    ans += 1

print(ans)
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a[::2])
a.sort()
now = 0
ans = 0
br = (n+1) // 2
for k,v in enumerate(a):
  if b[now] == v:
    ans += abs(k-now*2)
    now += 1
  if now == br:
    break
print(ans)

### FIXED CODE ###

n = set(list(input()))
if n == set(["N","S"]) or n == set(["W","E"]) or n == set(["N","S","W","E"]):
  print("Yes")
else:
  print("No")
def f1():
	L.sort(key = (lambda x: - x[1]/(w1 - x[0] + 1)))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans

def f2():
	dp = [[0] * (W + 1) for i in range(N + 1)]
	for n in range(1,N + 1):
		w,v = L[n - 1]
		if w > W:
			continue
		for m in range(w):
			dp[n][m] = dp[n - 1][m]
		for m in range(w,W + 1):
			dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
	return max(dp[-1])
	
N,W = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
w1 = L[0][0]
if w1 > 10000:
	print(f1())
else:
	print(f2())


### FIXED CODE ###

def f1():
	L.sort(key = (lambda x: - x[1]//(x[0] - w1 + 40)))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
	
def f3():
	L.sort(key = (lambda x: - x[1]//x[0]))
	ans = 0
	w2 = 0
	i = 0
	while i < N:
		w2 = w2 + L[i][0]
		if w2 > W:
			break
		ans = ans + L[i][1]
		i = i + 1
	
	return ans
def f2():
	dp = [[0] * (W + 1) for i in range(N + 1)]
	for n in range(1,N + 1):
		w,v = L[n - 1]
		if w > W:
			continue
		for m in range(w):
			dp[n][m] = dp[n - 1][m]
		for m in range(w,W + 1):
			dp[n][m] = max(dp[n - 1][m - w] + v, dp[n - 1][m])
	return max(dp[-1])
	
N,W = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
w1 = L[0][0]
if w1 > 10000000:
	print(f1())
elif W > 10000000:
	print(f3())
else:
	print(f2())
n, m, x = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]

def generate_n_bit(n):
    bins= []
    for i in range(2**n):
        bins.append(list(str(format(i,'b').zfill(n))))
    
    return bins

min_price = 10**9
bins = generate_n_bit(10)
del bins[0]

for bin in bins:
    a = [0 for k in range(m)]
    price = 0
    for i in range(n):
        if bin[i] == '1':
            for j in range(m):
                a[j] += l[i][j+1]
            
            price += l[i][0]
    
   
    
    if min(a) >= x:
        min_price = min(price, min_price)
        print(min_price)


print(min_price)



### FIXED CODE ###

n, m, x = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]

def generate_n_bit(n):
    bins= []
    for i in range(2**n):
        bins.append(list(str(format(i,'b').zfill(n))))
    
    return bins

min_price = 10**9
bins = generate_n_bit(n)
bins = bins[1:]

for bin in bins:
    a = [0 for k in range(m)]
    price = 0
    for i in range(n):
        if bin[i] == '1':
            for j in range(m):
                a[j] += l[i][j+1]
            
            price += l[i][0]
    
   
    
    if min(a) >= x:
        min_price = min(price, min_price)
        

if min_price == 10**9:
    print(-1)
    exit()
    
print(min_price)
N = int(input())
A = []
B = []
C = {}
m = 1000000007
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    if a/b in C.keys():
        C[a/b] +=1
    else: C[a/b] = 1
    
used = set()
ans = 1
for c in C.keys():
    if c in used: continue
    if -1/c in C.keys():
        used.add(-1/c)
        score = pow(2, C[c]) + pow(2, C[-1/c])- 1
        
        ans = (ans * score)%m

    else:
        
        ans = (ans*pow(2, C[c]))%m

print(ans-1)






### FIXED CODE ###

import math
N = int(input())
A = 0
B = 0
Z = 0
C = {}
m = 1000000007

def mypow(dummy, num):
    ans = 1
    for i in range(num):
        ans = (ans*2)%1000000007
    return ans

def rNum(a, b):
    g = math.gcd(a, b)
    if a <0 and b<0:
        a *= -1
        b *= -1
    if a >0 and b <0:
        return (-1*(a//g), -1*(b//g))
    else:
        return (a//g, b//g)


for i in range(N):
    a, b = map(int, input().split())
    
    if a == 0 and b==0:
        Z += 1
        continue
    elif a==0:
        A += 1
        continue
    elif b==0:
        B +=1
        continue
    
    r = rNum(a, b)
    if r in C.keys():
        C[r] +=1
    else: C[r] = 1


used = set()
ans = 1
ans *= (mypow(2, A) + mypow(2, B) -1)%m


for c in C.keys():
    if c in used: continue
    a, b = c
    r = rNum(b, -1*a)
    if r in C.keys():
        if c == r: continue
        used.add(r)
        score = (mypow(2, C[c]) + mypow(2, C[r])- 1)
        ans *= score

    else:
        ans *= mypow(2, C[c])

ans += Z

print((ans-1)%m)
from itertools import product

A, B, C, D = input()
for op1, op2, op3 in product("+-", repeat=3):
    expr = f"{A}{op1}{B}{op2}{C}{op3}{D}"
    if eval(expr) == 7:
        print(f"{A}{op1}{B}{op2}{C}{op3}{D}=7")
        break


### FIXED CODE ###

from itertools import product

A, B, C, D = input()
for op1, op2, op3 in product("+-", repeat=3):
    expr = "{}{}{}{}{}{}{}".format(A, op1, B, op2, C, op3, D)
    if eval(expr) == 7:
        print("{}{}{}{}{}{}{}=7".format(A, op1, B, op2, C, op3, D))
        break
raw_input ( )
numList = map ( int , raw_input ( ) .split ( ) )
raw_input ( )
quesList = map ( int , raw_input ( ) .split ( ) )
ans = 0
for x in quesList :
    if int ( x ) in numList :
        ans += 1
print ans

### FIXED CODE ###

N = int ( raw_input ( ) )

numList = map ( int , raw_input ( ) .split ( ) )
numList = sorted ( numList )
for x in numList :
    print x ,
print
o, e = input().split()

i = 0
res = []
while True:
    res.append(o[i])
    if e[i]:
        res.append(e[i])
        i += 1
    else:
        break

print(''.join(res))

### FIXED CODE ###

o = input()
e = input()

lo = len(o)
le = len(e)
i = 0
res = []
while True:
    if i == len(o):
        break
    else:
        res.append(o[i])
    if i == len(e):
        break
    else:
        res.append(e[i])
        i += 1

print(''.join(res))
big_ple=X//500*1000
remain=X%500
small_ple=remain//5*5
Sum=big_ple+small_ple

if X<5:
    print(0)
elif X<500:
    print(small_ple)
else:
     print(Sum)

### FIXED CODE ###

X=int(input())
big_ple=X//500*1000
remain=X%500
small_ple=remain//5*5
Sum=big_ple+small_ple
 
if X<5:
    print(0)
elif X<500:
    print(small_ple)
else:
     print(Sum)
n=int(input())
a=[[]for i in range(n)]
for i in range(n-1):
    c,d=map(int,input().split())
    a[c-1].append([d-1,i])
c=[0]*(n-1)
def f(x,y):
    r=1
    for i in a[x]:
        if r==y:
            r+=1
        c[i[1]]=r
        f(i[0],r)
        r+=1
f(1,0)
print(max(c))
for i in c:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n=int(input())
s=[[]for i in range(n+1)]
t=[0]*(n-1)
for i in range(n-1):
    a,b=map(int,input().split())
    s[a-1].append([b-1,i])
def f(x,r):
    c=1
    for (i,j) in s[x]:
        if c==r:
            c+=1
        t[j]=c
        f(i,c)
        c+=1
f(0,0)
print(max(t))
for i in t:
    print(i)
N=int(input())
A=list(map(int,input().split()))
re=0
for i in A:
  re+=1/A[i]
print(1/re)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
re=0
for i in range(N):
  re+=1/A[i]
print(1/re)
from functools import reduce

N = int(input())
S = input()
K = int(input())

print(reduce(lambda x, y: x + (y if y == S[K] else '*'), S, ''))


### FIXED CODE ###

from functools import reduce

N = int(input())
S = input()
K = int(input()) - 1

print(reduce(lambda x, y: x + (y if y == S[K] else '*'), S, ''))
n,k = map(int,input().split())



for i in range(1,k+1):
    if (n-k < i):
        print(1)

    else:
        total = 1
        total2 = 1
        total3 = 1
        for j in range(i+1):
            total *= n-k+1-j
            total2 *= j+1
            total3 = int(total/total2)
            
        ww = i**(k-i-2)
        ans = ww * total3

        ans2 = ans % 1000000007

        print(ans2)
    


### FIXED CODE ###

s = input()

a = []
for i in s:
    a.append(i)

cnt1 = 0
cnt2 = 0
memo =24
for i in range(1,4):
    if a[0] == a[i]:
        memo = i
        break;
    

ans = "No"
if(memo != 24):
    for i in range(1,4):
        for j in range(i+1,4):
            if (i != memo and j != memo):
                if a[i] == a[j]:
                    if a[0] != a[i]:
                        ans = "Yes"
                        break;


print(ans)
a = input()
b = input()
c = 0
for i in range(3):
    if a[i] == b[i]
        c +=1
print(c)

### FIXED CODE ###

a = input()
b = input()
c = 0
for i in range(3):
    if a[i] == b[i]:
    
        c +=1
print(c)
S=input()
money=700
for i in S.count("o"):
  money+=100
print(money)

### FIXED CODE ###

S=input()
money=700
counter=0
while counter < S.count("o"):
  money+=100
  counter+=1
print(money)
S = input()
ans = 0
now = 0
for i in S:
  if i in "ACGT":
    now += 1
  else:
    ans = max(now)
    now = 0
print(ans)

### FIXED CODE ###

S = input()
ans = 0
now = 0
for i in S:
  if i in "ACGT":
    now += 1
  else:
    ans = max(ans,now)
    now = 0
ans = max(ans,now)
print(ans)
sl = list(input())
k = int(input())

for i in range(len(sl)):
    ord_s = ord(sl[i])
    use = 123 - ord_s
    if k - use >= 0:
        sl[i] = "a"
        k -= use

if k > 0:
    sl[-1] = chr(ord(sl[-1]) + k)

print("".join(sl))



### FIXED CODE ###

sl = list(input())
k = int(input())

for i in range(len(sl)):
    ord_s = ord(sl[i])
    use = 123 - ord_s
    if k - use >= 0 and sl[i] != "a":
        sl[i] = "a"
        k -= use

if k > 0:
    sl[-1] = chr((ord(sl[-1]) + k - 97) % 26 + 97)

print("".join(sl))
x1, y1, x2, y2 = map(int, raw_input().split())
num = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)
xi = num
for _ in range(100):
   xi = (xi + (num / xi)) / 2.0
print xi

### FIXED CODE ###

x1, y1, x2, y2 = map(float, raw_input().split())
num = (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)
if num == 0:
    print 0
else:
    xi = num
    for _ in range(100):
        xi = (xi + (num / xi)) / 2.0
    print xi