Harryxun/stf_run huggingface dataset:
N = int(input())
V = list(map(int, input().split()))
alist = []
tmp = 0

def cook(N, V, alist, tmp):
    if N = 1:
        print(V[0])
    
    else:
        V.sort()
        for i in range(0, N - 2, 2):
            if i + 1 > N - 1:
                alist.append(V[i])
                
            else:
                tmp = (V[i] + V[i +1]) / 2
                alist.append(tmp)
            
        N = len(alist)
        V = alist
        alist = []
        tmp = 0
        cook(N, V, alist, tmp)
        
cook(N, V, alist, tmp)

### FIXED CODE ###

N = int(input())
v = list(map(float, input().split()))

v.sort()

r = v[0]

for i in v[1::]:
    r = (r + i) / 2

print(r)
L,R=map(int,input().split())
if R - L > 2019:
      print(0)
else:
    D = R - L
    L = L % 2019
    R = L + D
    a = 2018
    for i in range(D):
        for j in range(i+1,D+1):
            if (L+i)*(L+j)%2019 < a:
                a =(L+i)*(L+j)%2019
print(a)



### FIXED CODE ###

L,R=map(int,input().split())
if R - L > 2019:
      print(0)
else:
    D = R - L
    L = L % 2019
    R = L + D
    a = 2018
    for i in range(D):
        for j in range(i+1,D+1):
            if (L+i)*(L+j)%2019 < a:
                a =(L+i)*(L+j)%2019
    print(a)
import itertools
ini = int(input().split(" ")[0])
negaset = [int(x) for x in input().split(" ")]
okset = sorted([str(i) for i in range (10) if i not in negaset]) 
#print(ini,okset)

for p in itertools.product(okset,repeat = 5):
    stp = int("".join(p))
    if stp >= ini:
        print(stp)
        break

### FIXED CODE ###

# coding: utf-8
# Here your code !
ipt = input().split(" ")
j,k =0,0
for i in [ int(i) for i in ipt]:
    if i == 5:
        k += 1
    elif i==7:
        j += 1
#    print(ipt,i,k,j)

if j == 1 and k == 2:
    print("YES")
else:
    print("NO")
import itertools
def calc_num(S,S_len):
  result = 0;
  l = [3,5,7];
  i = 3;
  while i <= S_len
  	for v in itertools.product(l,repeat=i):
   		if int("".join(map(str,v))) <= S and list(srt(v) & set(l)) == l;
        	result = result + 1;
    i = i + 1;
  return result
  
S = list(map(int,input()))
S_len = len(S)
S = int("".join(map(str, S)));
result = calc_num(S,S_len);
print(result)

### FIXED CODE ###

import itertools
def calc_num(S,S_len):
  result = 0;
  l = [3,5,7];
  i = 3;
  while i <= S_len:
    for v in itertools.product(l,repeat=i):
      if int("".join(map(str,v))) <= S and list(set(v) & set(l)) == l:
        result = result + 1;
    i = i + 1;
  return result
  
S = list(map(int,input()));
S_len = len(S);
S = int("".join(map(str, S)));
result = calc_num(S,S_len);
print(result)
入力 = input()
for i in range(len(入力)-1):
  if 入力[i]==入力[i+1]:
    print(i+1, i+2)
    exit()
  elif i<n-2 and 入力[i]==入力[i+2]:
    print(i+1, i+3)
    exit()
print(-1, -1)

### FIXED CODE ###

入力 = input()
for i in range(len(入力)-1):
  if 入力[i]==入力[i+1]:
    print(i+1, i+2)
    exit()
  elif i<len(入力)-2 and 入力[i]==入力[i+2]:
    print(i+1, i+3)
    exit()
print(-1, -1)
a, b = map(int, input().split())
if ((a * b) % 2 ) == 0:
    print("Even")
else
    print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if ((a * b) % 2 ) == 0:
    print("Even")
else:
    print("Odd")
n = int(input())
a = 1
b = 1
mx = 10 ** 10
while (a <= b and a * a <= n):
    if n % a == 0:
        b = int(n / a)
        mx = min(mx, max(a, b))
    a += 1
print(len(str(mx)))


### FIXED CODE ###

[a, b, ab, x, y] = [int(i) for i in input().split()]
price = []
price.append(a * x + b * y)
if x > y:
    price.append(2 * ab * y + a * (x-y))
else:
    price.append(2 * ab * x + b * (y-x))
price.append(ab * 2 * max(x, y))
print(min(price))
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = []
D = []

for i in range(N):
    s = B[i] - A[i]
    if(s > 0):
        C.append(s)
    elif(s < 0):
        D.append(s)

D = sorted(D)

csum = sum(C)
dsum = sum(D)

if(csum + dsum > 0):
    print(-1)
elif(csum == 0):
    print(0)
else:
    ans = len(C)
    for i in D:
        csum += D
        ans += 1
        if(csum <= 0):
            break
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = [0]
D = [0]

for i in range(N):
    s = B[i] - A[i]
    if(s > 0):
        C.append(s)
    elif(s < 0):
        D.append(s)

D = sorted(D)

csum = sum(C)
dsum = sum(D)

if(csum + dsum > 0):
    print(-1)
elif(csum == 0):
    print(0)
else:
    ans = len(C) -1
    for i in D:
        csum += i
        ans += 1
        if(csum <= 0):
            break
    print(ans)
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
for i in range(0, 10**n):
    if len(str(i)) == n and all(str(i)[s-1] == str(c) for j in sc):
        print(i)
        break
else:
    print(-1)

### FIXED CODE ###

n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
for i in range(0, 10**n):
    if len(str(i)) == n and all(str(i)[s-1] == str(c) for s,c in sc):
        print(i)
        break
else:
    print(-1)
n = int(input())
a = len(str(n))
b = 0
j = 2*i
if a%2 == 0:
    for j in range(a//2):
        b += 10**(2*j+1)-10**(2*j)
    print(b)
else:
    for j in range(a//2):
        b += 10**(2*j+1)
    print(n-10**(a-1)+b)

### FIXED CODE ###

n = int(input())
a = len(str(n))
b = 0
c = a//2

if a%2 == 0:
    for j in range(c):
        b += 9*100**j
    print(b)
else:
    for j in range(c):
        b += 9*100**j
    print(n-10**(a-1)+1+b)
import numpy as np

n=int(input())
a1=[0,0]
a2=[0,0]
a3=[0,0]
a4=[0,0]

def d1(a):
    return np.sqrt((a[0])**2+(a[1])**2)

def d2(a,b):
    return np.sqrt((a[0]+b[0])**2+(a[1]+b[1])**2)

def d3(a,b,c):
    return np.sqrt((a[0]+b[0]+c[0])**2+(a[1]+b[1]+c[1])**2)

def d4(a,b,c,d):
    return np.sqrt((a[0]+b[0]+c[0]+d[0])**2+(a[1]+b[1]+c[1]+d[1])**2)

for i in range(n):
    x=list(map(int,input().split()))
    if ((x[0]<0 and x[1]<0)or(x[0]<0 and x[1]==0)or(x[0]==0 and x[1]<0)):
        a3[0] += x[0]
        a3[1] += x[1]
    if x[0]<0 and x[1]>0:
        a2[0] += x[0]
        a2[1] += x[1]
    if x[0]>0 and x[1]<0:
        a4[0] += x[0]
        a4[1] += x[1]
    if ((x[0]>0 and x[1]>0)or(x[0]>0 and x[1]==0)or(x[0]==0 and x[1]>0)):
        a1[0] += x[0]
        a1[1] += x[1]

k1=max(d1(a1),d1(a2),d1(a3),d1(a4))
k2=max(d2(a1,a4),d2(a1,a2),d2(a2,a3),d2(a3,a4))
k3=max(d3(a1,a2,a4),d3(a1,a2,a3),d3(a2,a3,a4),d2(a3,a4,a1))

k=max(k1,k2,k3,d4(a1,a2,a3,a4))

print('{:.12f}'.format(k))

### FIXED CODE ###

import numpy as np

n=int(input())

def div2(x,y):
    if x>0:
        return (1,y/x)
    elif x<0:
        return (-1,y/x)
    else:
        if y>0:
            return (-1,-float("inf"))
        else:
            return (1,-float("inf"))
    

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

L.sort(key=lambda x:div2(x[0],x[1]))

m=0
for i in range(n):
    for j in range(i,n):
        x0=y0=0
        x1=y1=0
        for k in range(n):
            if i<=k<=j:
                x0+=L[k][0]
                y0+=L[k][1]
            else:
                x1+=L[k][0]
                y1+=L[k][1]
        m=max(m,x0**2+y0**2,x1**2+y1**2)

print('{:.12f}'.format(np.sqrt(m)))
a , b , c , d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)

result = ""
while True :
	c -= b
	if c =< 0 :
		result ="Yse"
        break
		
	a -= d
	if a =< 0 :
		result = "No"
        break
print(result)
 
	
    
  

### FIXED CODE ###

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

a_hp = a
b_hp = c

result = ""
while True :
	b_hp -= b
	if b_hp <= 0 :
		result ="Yes"
		break
		
	a_hp -= d
	if a_hp <= 0 :
		result = "No"
		break
print(result)
N = int(input())

lis = []

lis = list(map(int,input().split()))

first = []

for i in range(N):
  num = lis[i]
  first[num] = i + 1
  
for i in range(N):
  print(first[i],end=' ')

### FIXED CODE ###


N = int(input())
lis = []
lis = list(map(int,input().split()))
first = [0]*N

for i in range(N):
    num = lis[i] - 1
    first[num] = i

for i in range(N):
    print(first[i]+1,end=' ')
print()
N = int(input())

t = input().split()
T = []
for i in range(N):
    T.append(int(t[i]))

M = int(input())

time = []
total = sum(T)
for k in range(M):
    p,x = (int(i) for i in input().split())
    time.append（total - T[p] + x)

print(time)

### FIXED CODE ###

N = int(input())

t = input().split()
T = []
for i in range(N):
    T.append(int(t[i]))

M = int(input())

time = []
total = sum(T)
for k in range(M):
    p,x = (int(i) for i in input().split())
    time.append(total - T[p-1] + x)

for i in range(M):
    print(time[i])
s = input()
ans = 'Yes'

if s == "AAA" or a == "BBB":
  ans = "No"

print(ans)


### FIXED CODE ###

s = input()
ans = 'Yes'

if s == "AAA" or s == "BBB":
  ans = "No"

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

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

while len(stack) > 0:
    x = stack.pop()
    p = ans[x-1]
    g = len(G[x])
    for i in range(g):
        y = G[x][i][0]
        z = G[x][i][1]
        a = ans[y-1]
        if a == -1:
            stack.append(y)
            if z == 0:
                ans[y-1] = p
            else:
                ans[y-1] = 1-p
for i in range(N):
    print(ans[i])
                
        

### FIXED CODE ###

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

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

while len(stack) > 0:
    x = stack.pop()
    p = ans[x-1]
    g = len(G[x-1])
    for i in range(g):
        y = G[x-1][i][0]
        z = G[x-1][i][1]
        a = ans[y-1]
        if a == -1:
            stack.append(y)
            if z == 0:
                ans[y-1] = p
            else:
                ans[y-1] = 1-p
for i in range(N):
    print(ans[i])
import numpy as np
N, M = map(int, input().split())
lists = []
for _ in range(M):
    lists.append(list(map(int, input().split()))[1:])
p_list = list(map(int, input().split()))
num = 0
len_m = N
for n in range(2 ** N):
    flag = True
    for p, lis in zip(p_list, lists):
        flag = flag & ((sum([f'{n:0{len_m}b}'[l - 1] == '1' for l in lis]) % 2) == p)
    num += flag
print(num)

### FIXED CODE ###

N, M = map(int, input().split())
lists = []
for _ in range(M):
    lists.append(list(map(int, input().split()))[1:])
p_list = list(map(int, input().split()))
num = 0
len_m = N
for n in range(2 ** N):
    flag = True
    for p, lis in zip(p_list, lists):
        flag = int(flag) * int((sum([str(bin(n)[2:]).zfill(len_m)[l - 1] == '1' for l in lis]) % 2) == p)
    num += flag
print(num)
import numpy as np

p = 998244353

a,b,c,d = map(int,input().split())
dp = np.zeros((c+1, d+1), dtype=np.int64)
for i in range(a, c+1):
	for j in range(b, d+1):
		if i == a:
			if j == b:
				dp[i][j] = 1
			else:
				dp[i][j] = dp[i][j-1] * i % p
		elif j == b:
			dp[i][j] = dp[i-1][j] * j % p
		else:
			dp[i][j] = (dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1)) % p

print(dp[c][d])

### FIXED CODE ###


p = 998244353

a,b,c,d = map(int,input().split())
dp = [[0 for _ in range(d+1)] for k in range(c+1)]
for i in range(a, c+1):
	for j in range(b, d+1):
		if i == a:
			if j == b:
				dp[i][j] = 1
			else:
				dp[i][j] = dp[i][j-1] * i % p
		elif j == b:
			dp[i][j] = dp[i-1][j] * j % p
		else:
			dp[i][j] = (dp[i-1][j]*j + dp[i][j-1]*i - dp[i-1][j-1]*(i-1)*(j-1)) % p

print(dp[c][d])
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))

### FIXED CODE ###

x = sorted(list(map(int, input().split())))
if (x[0]==x[1]==5) and x[2]==7:
    print('YES')
else:
    print('NO')
mod = 10**9 + 7

def sgn(v):
    return (v > 0) - (v < 0)

def compute_answer():
    v.sort(key=abs, reverse=True)
    prod = 1
    sg = 1
    for a in xrange(k):
        prod *= v[a]
        prod %= mod
        sg *= sgn(v[a])

    if sg >= 0:
        return prod

    if max(v) <= 0:
        prod = 1
        for a in xrange(-k,0):
            prod *= v[a]
            prod %= mod
        return prod

    def find_pair(comp):
        i = k-1
        while i >= 0 and comp(v[i]): i -= 1
        j = k
        while j < n and not comp(v[j]): j += 1
        if j == n: j = i
        return i, j
    i, j = find_pair(lambda w: w >= 0)
    I, J = find_pair(lambda w: w <= 0)
    if I >= 0 and v[j] * v[I] < v[i] * v[J]:
        i = I
        j = J

    prod = v[j]
    for a in xrange(k):
        if a != i:
            prod *= v[a]
            prod %= mod
    return prod

for cas in xrange(input()):
    n, k = map(int, raw_input().strip().split())
    v = map(int, raw_input().strip().split())
    print compute_answer()

### FIXED CODE ###

mod = 10**9 + 7

def sgn(v):
    return (v > 0) - (v < 0)

def compute_answer():
    v.sort(key=abs, reverse=True)
    prod = 1
    sg = 1
    for a in xrange(k):
        prod *= v[a]
        prod %= mod
        sg *= sgn(v[a])

    if sg >= 0:
        return prod

    if max(v) <= 0:
        prod = 1
        for a in xrange(-k,0):
            prod *= v[a]
            prod %= mod
        return prod

    def find_pair(comp):
        i = k-1
        while i >= 0 and comp(v[i]): i -= 1
        j = k
        while j < n and not comp(v[j]): j += 1
        if j == n: j = i
        return i, j
    i, j = find_pair(lambda w: w >= 0)
    I, J = find_pair(lambda w: w <= 0)
    if I >= 0 and v[j] * v[I] < v[i] * v[J]:
        i = I
        j = J

    prod = v[j]
    for a in xrange(k):
        if a != i:
            prod *= v[a]
            prod %= mod
    return prod

n, k = map(int, raw_input().strip().split())
v = map(int, raw_input().strip().split())
print compute_answer()
dat =list(input().split())

for i in dat:
   i = int(i)

dat.sort()
dat.reverse()

asum = 0
bsum = 0

length = len(dat)

#for i in range(length):
#	if i%2==0:
#		asum = asum + dat[i]
#	else:
#		bsum = bsum + dat[i]
		
print(lengrh)

### FIXED CODE ###

n = int(input())
dat = list(input().split())

dat = list(map(int,dat))

dat.sort(reverse=True)

asum = 0
bsum = 0

for i in range(n):
	if i % 2 == 0:
		asum = asum + dat[i]
	else:
		bsum = bsum + dat[i]
		
print(asum-bsum)
a,b = map(int, input().split())
total = 0
ans = 0
for i in range(1,1000):
    total += i
    if total - b => 0:
        ans = total -b
        break
        
print(ans)

### FIXED CODE ###

a,b = map(int, input().split())
s = b -a
ans = 0
for i in range(1,s):
  ans += i
  
print(ans - a)
A, B = map(int, input().split())

import math

g = math.gcd(A, B)
ans = 1

for i in range(2, int(math.sqrt(g))+1):
    if g % i == 0:
        ans += 1
        
        while True:
            g //= i
            if g % i != 0:
                break
                
if g != 1:
    ans += 1
    
print(ans)

### FIXED CODE ###

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

import math

if A < B:
    A, B = B, A
    
while A % B != 0:
    A, B = B, A%B
    
ans = 1

for i in range(2, int(math.sqrt(B))+1):
    if B % i == 0:
        ans += 1
        
        while B % i == 0:
            B //= i
            
if B > 1:
    ans += 1
    
print(ans)
variable = input().split(" ")
n = int(variable[0])
x = int(variable[1])
l = input().split(" ")
d = 0
i = 0

while d <= x:
  d += int(l[i])
  i += 1
  
print(i)

### FIXED CODE ###

inp = input().split(" ")
n = int(inp[0])
x = int(inp[1])
l = input().split(" ")
d = 0
count = 1

for i in range(n):
  d += int(l[i])
  if d <= x:
    count += 1
  else:
    break
  
print(count)
s = sorted(list(set(list(input()))))
i = 0
while i <= 25 and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

### FIXED CODE ###

s = sorted(list(set(list(input()))))
i = 0
while i < len(s) and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")
n, m = map(int, input().split())
a = [0] * m
MOD = 10 ** 9 + 7

for i in range(m):
    a[i] = int(input())

dp = [0] * (n + 1)

for i in range(1, 3):
    if (i not in a):
        dp[i] = dp[i-1] + 1
    else:
        pass

flag = True

for i in range(3, n + 1):
    if (i not in a):
        if (dp[i - 1] == 0 and dp[i - 2] == 0):
            flag = False
            break
        else:
            dp[i] = dp[i - 1] + dp[i - 2]

    else:
        pass


if (flag is True):
    ans = dp[n] % MOD
else:
    ans = 0


#ans %= 10 ** 9 + 7
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])
'''
a = [0] * (10 ** 5)
for i in range(m):
    a[int(input())] = 1
'''

MOD = 10 ** 9 + 7
# ---------------------------
dp = [0] * (n + 1)
dp[0] = 1
if (1 in a):
    # if (a[1] == 1):
    dp[1] = 0
else:
    dp[1] = 1
# dp approach

for i in range(2, n + 1):
    if (i in a):
        # if (a[i] == 1):
        # (x in list)で探索すると、時間がかかるっぽい
        #dp[i] = 0
        continue
    elif (dp[i - 1] == 0 and dp[i - 2] == 0):
        print(0)
        exit()
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD


#print(dp[n] % MOD)
print(dp[n])
x = input()
if x ==0:
  print(1)
else x == 1:
  print(0)

### FIXED CODE ###

x = input()
y=int(x)
if y==0:
  print("1")
elif y==1:
  print("0")
from fraction import gcd
a=int(input())
s=int(input())
k=s
for i in range(a-1):
    d=int(input())
    k=(k*d)//gcd(k,d)
print(k)

### FIXED CODE ###

from fractions import gcd
a=int(input())
s=int(input())
k=s
for i in range(a-1):
    d=int(input())
    k=(k*d)//gcd(k,d)
print(k)
import math
n,a,b= map(int, input().split())
mod = 10 ** 9 + 7
def power_func(a,n,mod):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r=min(r,n-r)

    return g1[n] * g2[r] * g2[n - r] % mod


N =10 ** 6 # 出力の制限
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

ans=(power_func(2,n,mod)-1-cmb(n,a,mod)-cmb(n,b,mod))%mod
print(ans)

### FIXED CODE ###

import math
n,c,d= map(int, input().split())
mod = pow(10,9)+7

def comb(n,k):
    x=1
    y=1
    for i in range(1,k+1):
        x*=(n+1-i)
        x%=mod
        y*=i
        y%=mod
    return x*pow(y,mod-2,mod)


ans=(pow(2,n,mod)-1-comb(n,c)-comb(n,d))%mod
print(ans)
N, T = map(int, input().split())
i = 0
min_cost = 1000
fg = False
while i < N:
    i += 1
    c, t = map(int, input().split())
    if t <= T:
        if c <= min_cost:
            fg = True
            min_cost = c

if fg:
    print(min_cost)
else:
    print('TLE')

### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)
ina = input()
inb = input()
N, K = ina.split()
N = int(N)
K = int(K)

a = inb.split()
a = [int(elem) for elem in a]

total = 0
for i in range(len(a)):
  for j in range(i+1, len(a)+1):
    if sum(a[i:j]) >= K:
      total += 1 + len(a)-j
      break
print(total)

### FIXED CODE ###

ina = input()
ina = ina.split()
X = ina[0]
A = ina[1]
if X<A:
  print("0")
else:
  print("10")
n,q = map(int,input().split())

road = [[] for _ in range(n)]
cnt  = [0 for _ in range(n)]

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

for i in range(q):
    idx,v = map(int,input().split())
    cnt[idx-1] = v

dist = [-1]*n
que  = deque()
dist[0] = 0
que.append(0)

while(len(que)!=0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r]!=-1:
            continue
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)

print(*cnt)

### FIXED CODE ###

from collections import deque
# from collections import Counter
# from itertools import accumulate
# from fractions import gcd # >=Python3.5 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # <Python3.5
# from math import sqrt

# input = sys.stdin.readline
# def main():

#---------------------------------------------------------

n,q = map(int,input().split())

road = [[] for _ in range(n)]
cnt  = [0 for _ in range(n)]

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

for i in range(q):
    idx,v = map(int,input().split())
    cnt[idx-1] += v

dist = [-1]*n
que  = deque()
dist[0] = 0
que.append(0)

while(len(que)!=0):
    # BFS/DFS
    v = que.pop()
    for r in road[v]:
        if dist[r]!=-1:
            continue
        dist[r] = dist[v] + 1
        cnt[r] += cnt[v]
        que.append(r)

print(*cnt)
n, m = list(map(int, input().split()))
root_list = []
for _ in range(m):
    root_list.append(list(map(int, input().split())))

answer_list = [0] * (n-1)
done_list = [1]
already_list = [1]
while len(root_list) > 0 and 0 in answer_list:
    if len(done_list) == 0:
        break
    tmp_list = []
    copy_root_list = root_list.copy()
    for num in done_list:
        for l in root_list:
            if l[1] == num:
                if answer_list[int(l[0]-2)] == 0:
                    answer_list[int(l[0]-2)] = num
                    tmp_list.append(l[0])
                    already_list.append(l[1])
                    copy_root_list.remove(l)
                else:
                    copy_root_list.remove(l)
            elif  l[0] == num and l[0] != l[1]:
                if answer_list[int(l[1]-2)] == 0:
                    answer_list[int(l[1]-2)] = num
                    tmp_list.append(l[1])
                    already_list.append(l[1])
                    copy_root_list.remove(l)
                else:
                    copy_root_list.remove(l)
    root_list = copy_root_list
    done_list = tmp_list

if 0 not in answer_list:
    print("Yes")
    for i in answer_list:
        print(int(i))
else:
    print("No")
    

### FIXED CODE ###

from collections import deque

n, m = list(map(int, input().split()))
root_dict = {}

for _ in range(m):
    a, b = list(map(int, input().split()))
    if a not in root_dict:
        root_dict[a] = deque([b])
    else:
        root_dict[a].append(b)
    if b not in root_dict:
        root_dict[b] = deque([a])
    else:
        root_dict[b].append(a)

visited = [1] + [-1] * (n-1)

done = deque([1])

while done:
    x = done.popleft()
    while root_dict[x]:
        i = root_dict[x].popleft()
        if visited[i-1] < 0:
            visited[i-1] = x
            done.append(i)

if -1 in visited:
    print("No")
else:
    print("Yes")
    for i in range(1, n):
        print(visited[i])
n = int(input())
l = [[0,0,0]]
l.append([[list(map(int, input().split())) for i in range(n)]])
for i in range(n):
    if abs(l[i+1][1] + l[i+1][2] - l[i][1] - l[i][2]) != 1:
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2:
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")
x = input()
for i in range(1,10,1):
    if x%i == 0 and x/i < 10 and x/i > 0:
        print("Yes")
        break
    if i == 9:
        print("No")

### FIXED CODE ###

x = int(input())
for i in range(1,10,1):
    if x%i == 0 and x/i < 10 and x/i > 0:
        print("Yes")
        break
    if i == 9:
        print("No")
a, b = map(input().split(" "))
i = 1
while i >=1:
  d = (a-1)*i +1
  if d >= b:
    print(i)
    break

### FIXED CODE ###

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

for i in range(20):
  d = (a-1)*i +1
  if d >= b:
    print(i)
    break
N, M = map(int, input().split())
a = [ int(input()) for _ in range(N)]

ans = 0

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = (step[i - 2] + step[i - 1]) % N

print (ans % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())

step = [0 for _ in range(N + 2)]
step[1] = 1

for _ in range(M):
  i = int(input()) + 1
  step[i] = -1

for i in range(2, N + 2):
  if step[i] == -1:
    step[i] = 0
  else:
    step[i] = step[i - 2] + step[i - 1]

print (step[-1] % 1000000007)