Harryxun/stf_run huggingface dataset:
import math
a, b = map(float, input().split())
print(math.floor(a*b))

### FIXED CODE ###

def main():
  ## IMPORT MODULE
  #import sys

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 2
    A = [1000000000, 1000000000]

  else:
    ##INPUT 
    n = input()
    A = list(map(int, input().split()))

  ## SUBMITION CODES HERE
  if 0 in A:
    print(0)
    exit()
  
  ans = 1
  for a in A:
    ans *= a
    if ans > 10**18:
      ans = -1
      break
  
  print(ans)
    
main()
A,B=map(int,input().split())
if (A<2*B):
    print(0)
    break
print(A-2*B)

### FIXED CODE ###

A,B=map(int,input().split())
if (A<2*B):
    print(0)
else:
    print(A-2*B)
from collections import*
(n,),*s=[tuple(t[:-1])for t in open(0)]
s=deque(s)
n=int(n)
c=0
for _ in range(n):
  c+=all(x==y for x,y in zip(s,zip(*s)))*n
  s.rotate(1)
print(c)

### FIXED CODE ###

n,*s=[t[:-1]for t in open(0)]
n=int(n)
c=0
for _ in range(n):
  c+=all(x==''.join(y)for x,y in zip(s,zip(*s)))*n
  s=s[1:]+s[:1]
print(c)
import math

r= float(input().rstrip().split(' ')

a = r * pi

b = r * pi

print(a, b)

### FIXED CODE ###

import math

r= float(input())

a = r * r * math.pi

b = 2 * math.pi * r

print(a, b)
print('{0[0]} {0[1]} {0[2]}'.format(
      (lambda a, b: (a // b, a % b, a / b))(
       *map(int, input().split())))

### FIXED CODE ###

from __future__ import division, print_function
from sys import stdin
a, b = (int(s) for s in stdin.readline().split())
print(a // b, a % b, '{:.6f}'.format(a / b))
While True:
  s = raw_input().split()
  a = int(s[0])
  op = s[1]
  b = int(s[2])
  if op == '+':
    print a+b
  elif op == '-':
    print a-b
  elif op == '*':
    print a*b
  elif op == '/':
    print a/b
  elif op == '?'
    break

### FIXED CODE ###

while True:
  s = raw_input().split()
  a = int(s[0])
  op = s[1]
  b = int(s[2])
  if op == '?':
    break
  elif op == '+':
    print (a+b)
  elif op == '-':
    print (a-b)
  elif op == '*':
    print (a*b)
  elif op == '/':
    print (a/b)
B = int(s[1])
 
sum = A
cnt = 1
flg = True
 
while flg:
  if B ==0 or B == 1:
    cnt = 0
    break
  if sum >= B:
    break
  sum += A -1
  cnt += 1
 
print(cnt)

### FIXED CODE ###

s = input().rstrip().split(' ')
A = int(s[0])
B = int(s[1])
 
sum = A
cnt = 1
flg = True
 
while flg:
  if B ==0 or B == 1:
    cnt = 0
    break
  if sum >= B:
    break
  sum += A -1
  cnt += 1
 
print(cnt)
import collections
N = int(input())
e = [[int(i) for i in input().split()] for i in range(N)]
x = 0
y = 0
tupleArray = []
for i in range(N-1):
    for j in range(i+1, N):
        x = e[i][0] - e[j][0]
        y = e[i][1] - e[j][1]
        t1 = (x, y)
        tupleArray.append(t1)
c = collections.Counter(tupleArray)
print(N - c.most_common()[0][1])


### FIXED CODE ###

from collections import defaultdict
n = int(input())
s = [list(map(int,input().split())) for i in range(n)]
s.sort()
c = []
if n == 1:
    print(1)
else:
    for i in range(n):
        for j in range(i+1,n):
            x = s[j][0] - s[i][0]
            y = s[j][1] - s[i][1]
            c.append(str(x) + " " + str(y))
    r = defaultdict(int)
    for g in c:
        r[g] += 1
    q = list(r.values())
    q1 = max(q)
    print(n-q1)
N = int(input())
edges = []
count = [0 for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  edges.append([a, b])
  count[a-1] += 1
  count[b-1] += 1
  
MAX = max(count)

color = [0 for _ in range(N-1)]
used = [set() for _ in range(N)]

for k, [i,j] in enumerate(edges):
  for l in range(MAX):
    c = l+1
    if c in used[i-1] or c in used[j-1]:
      continue
    used[i-1].add(c)
    used[j-1].add(c)
    color[k] = c
    break

print(MAX)
for i in color:
  if i == 0:
    print(input())
  print(i)


### FIXED CODE ###

N = int(input())
edges = []
node = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  edges += (a-1, b-1),
  node[a-1] += b-1,
  node[b-1] += a-1,

stuck = [(0,0)]
f = [1]+[0]*N
color_dic = dict()
while stuck:
  v, color = stuck.pop()
  i = 0
  for w in node[v]:
    if f[w]:
      continue
    f[w] = 1
    i += 1
    if i == color:
      i += 1
    stuck += (w,i),
    color_dic[v,w] = i

ans = []
for a,b in edges:
  if (a,b) in color_dic:
    ans += color_dic[a,b],
  else:
    ans += color_dic[b,a],

print(max(ans))
for i in ans:
  print(i)
print(M-input())

### FIXED CODE ###

print(48-int(input()))
d,t,s =map(int,input().split())
if d%s <=t :
    print(Yes)
else :
    print(No)

### FIXED CODE ###

d,t,s =map(int,input().split())
if d/s <=t :
    print('Yes')
else :
    print('No')
import sys
input = sys.stdin.readline

def main():
  N = input()
  N = '0'+N
  dp= [[float('inf') for _ in range(2)] for _ in range(len(N)+1)]
  dp[0][0] = 0
  for i in range(len(N)):
    n = int(N[len(N)-1-i])
    for j in range(2):
      # jが1のときは繰り下がりあり。
      # 引かれる数から1を引く代わりに、引く数xに1を足す。
      x = n+j
      # xが10のとき、必ず繰り下がりが起こる。
      if x < 10:
        dp[i+1][0] = min(dp[i+1][0],dp[i][j]+x)
      # xが0のとき、繰り下がりは起こせない。
      if x > 0:
        dp[i+1][1] = min(dp[i+1][1],dp[i][j]+10-x)
  print(dp[len(N)][0])  
  # print(dp)
  
if __name__ == '__main__':
  main()


### FIXED CODE ###

def main():
  N = input()
  N = '0'+N
  dp= [[float('inf') for _ in range(2)] for _ in range(len(N)+1)]
  dp[0][0] = 0
  for i in range(len(N)):
    n = int(N[len(N)-1-i])
    for j in range(2):
      # jが1のときは繰り下がりあり。
      # 引かれる数から1を引く代わりに、引く数xに1を足す。
      x = n+j
      # xが10のとき、必ず繰り下がりが起こる。
      if x < 10:
        dp[i+1][0] = min(dp[i+1][0],dp[i][j]+x)
      # xが0のとき、繰り下がりは起こせない。
      if x > 0:
        dp[i+1][1] = min(dp[i+1][1],dp[i][j]+10-x)
  print(dp[len(N)][0])  
  # print(dp)
  
if __name__ == '__main__':
  main()
N=int(input())
P=list(map(int,input().split()))
ans=0
flag=True
for i in range(N):
  for j in range(i):
    if(P[i]>P[j]):
      flag=False
      break
  if flag:ans+=1
  flag=True
print(ans)

### FIXED CODE ###

A,B=map(int,input().split())
if A==B:
  print("Yes")
else:
  print("No")
N,M = map(int,input().split())
bool = [True]*(N+1)
dp = [0]*(N+1)
for i in range(M):
    a = int(input())
    bool[a] = False
dp[0]=dp[1]=1
for i in range(2,N+1):
    if bool[i-1]:
        dp[i] += dp[i-1]
        dp[i] %= mod
    if bool[i-2]:
        dp[i] += dp[i-2]
        dp[i] %= mod
print(dp[-1])

### FIXED CODE ###

from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
c = [0]*(N+1)
c[0] = 1
c[1] = 1
ans = 1
a = []
al = 0
for i in range(2,N+1):
    c[i] = c[i-1]+c[i-2]
    c[i] %= mod
for i in range(M):
    ai = int(input())
    if i == 0:
        a.append(ai)
    else:
        if ai - al == 1:
            print(0)
            exit()
        else:
            a.append(ai)
    al = ai
if M == 0:
    print(c[N])
    exit()
for i in range(M):
    if i == 0:
        ans *= c[a[i]-1]
        ans %= mod
    if i == M-1:
        ans *= c[N-a[i]-1]
        ans %= mod
    else:
        if a[i+1] != a[i]:
            ans *= c[a[i+1]-a[i]-2]
            ans %= mod
print(ans)
class Combination:
    def __init__(self, n_max, mod=10 ** 9 + 7):
        # O(n_max + log(mod))
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max + 1):
            f = f * i % mod
            fac.append(f)
        f = pow(f, mod - 2, mod)
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    # "n 要素" は区別できる n 要素
    # "k グループ" はちょうど k グループ

    def __call__(self, n, r):  # self.C と同じ
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def nCr(self, n, r):
        if not 0 <= r <= n:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

def resolve():
    def f(r, c):
        return cmb.nCr(r+c+2, r+1) - 1

    MOD = 10**9+7
    r1,c1,r2,c2 = map(int, input().split())
    r1 -= 1
    c1 -= 1

    cmb = Combination(10**6+5)
    ans = f(r2, c2)
    ans -= f(r1, c2)
    ans -= f(r2, c1)
    ans += f(r1, c1)
    print(ans)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###



class Combination:
    def __init__(self, n_max, mod=10 ** 9 + 7):
        # O(n_max + log(mod))
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max + 1):
            f = f * i % mod
            fac.append(f)
        f = pow(f, mod - 2, mod)
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    # "n 要素" は区別できる n 要素
    # "k グループ" はちょうど k グループ

    def __call__(self, n, r):  # self.C と同じ
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def nCr(self, n, r):
        if not 0 <= r <= n:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

def resolve():
    def f(r, c):
        return cmb.nCr(r+c+2, r+1) - 1

    MOD = 10**9+7
    r1,c1,r2,c2 = map(int, input().split())
    r1 -= 1
    c1 -= 1

    cmb = Combination(r2+c2+5)
    ans = f(r2, c2)
    ans -= f(r1, c2)
    ans -= f(r2, c1)
    ans += f(r1, c1)
    print(ans % MOD)


if __name__ == "__main__":
    resolve()
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def getComb(n, k, MOD):
    if n < k:
        return 0
    if n-k < k:
        k = n-k
    # n!/(n-k)!
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD
    # k!
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    # n!/((n-k)!*k!)
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

def main():
    N,K = map(int,input().split())
    A = sorted([int(i) for i in input().split()])

    mod = 10**9+7

    cmb = [0] * N
    for i in range(N):
        cmb[i] = getComb(i,K-2,mod)

    answer = 0
    for i in range(N):
        for j in range(i+(K-1), N):
            answer = (answer + cmb[j-i-1] * ((A[j] - A[i]) % mod)) % mod

    print(answer)

if __name__ == "__main__":

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def getComb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p


N,K = map(int,input().split())
A = sorted([int(i) for i in input().split()])

# ref: https://www.planeta.tokyo/entry/5195/
mod = 10**9+7
fact = [1, 1]
factinv = [1, 1] 
inv = [0, 1]
for i in range(2,N+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)

cmb = [0] * (N-K+1)
for i in range(N-K+1):
    cmb[i] = getComb(i+(K-1),K-1,mod)

sum_max = 0
for i in range(K-1,N):
    sum_max = (sum_max + cmb[i-(K-1)] * A[i]) % mod

sum_min = 0
for i in range(N-K,-1,-1):
    sum_min = (sum_min + cmb[(N-K)-i] * A[i]) % mod

answer = sum_max - sum_min
print(answer % mod)
from bisect import bisect_left

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

G = [[] for _ in range(N)]

for _ in range(N - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)


root = 0

ans = [0] * N
check = [False] * N
check[root] = True

memo = [None] * N

INF = 10 ** 10
dp = [INF] * N

def dfs(x):
    tmp = bisect_left(dp, A[x])
    memo[x] = (tmp, dp[tmp])
    dp[tmp] = A[x]
    ans[x] = bisect_left(dp, INF)
    for next_ in G[x]:
        if check[next_]:
            continue
        check[next_] = True
        dfs(next_)
    j, a = memo[x]
    dp[j] = a

dfs(root)

print (*ans, sep = '\n')



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

from bisect import bisect_left

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

G = [[] for _ in range(N)]

for _ in range(N - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)


root = 0

ans = [0] * N
check = [False] * N
check[root] = True

memo = [None] * N

INF = 10 ** 10
dp = [INF] * N

def dfs(x):
    tmp = bisect_left(dp, A[x])
    memo[x] = (tmp, dp[tmp])
    dp[tmp] = A[x]
    ans[x] = bisect_left(dp, INF)
    for next_ in G[x]:
        if check[next_]:
            continue
        check[next_] = True
        dfs(next_)
    j, a = memo[x]
    dp[j] = a

dfs(root)

print (*ans, sep = '\n')
n = input()

ans = 1000-int(n[1:])
if(ans%1000==0):
    print(0)
else:print(ans)

### FIXED CODE ###

n = int(input())
while n > 999:
    n = n % 1000
if n ==0:
    print(0)
else:
    print(1000-n)
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(10000000)

def preDatasets():
	datas = sys.stdin.readlines()
	for i in range(len(datas)):
		datas[i] = datas[i].strip('\n')
	return datas

def dfs(x, y, sym):
	tile[x][y] = '.'
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if(nx>=0 and nx<N and ny>=0 and ny<M and tile[nx][ny]==sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			if not tile[i][j] == '.':
				if tile[i][j] == '@':
					dfs(i, j, '@')
					res += 1
				elif tile[i][j] == '#':
					dfs(i, j, '#')
					res += 1
				elif tile[i][j] == '*':
					dfs(i, j, '*')
					res += 1
	print(res)

index = 0	
while True:
	datas = preDatasets()
	DX = [-1, 0, 1, 0]
	DY = [0, -1, 0, 1]

	N = int(datas[index].split(' ')[0])
	M = int(datas[index].split(' ')[1])
	tile = [[0 for i in range(N)]for j in range(M)]
	
	for i in range(len(tile)):
		tile[i] = list(datas[index+i+1])

	if N == 0:
		break
	else:
		solve()
		index += N+1

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
from collections import defaultdict
import sys
import math
from datetime import datetime
from typing import List


class TreeNode:
    def __init__(self):
        self.val = 0
        self.vertex = []

def make_trees(n, A, B):
    trees = []
    for i in range(n):
        trees.append(TreeNode())
    for i in range(len(A)):
        a = A[i]-1
        b = B[i]-1
        trees[a].vertex.append(b)
    return trees

def dfs(node: TreeNode, x: int, trees):
    if node:
        node.val += x
        for i in node.vertex:
            dfs(trees[i], x, trees)


def sol(n, q, A, B, P, X):
    trees = make_trees(n, A, B)
    for i in range(len(P)):
        p = P[i]-1
        x = X[i]
        t = trees[p]
        # dfs, give point x
        dfs(t, x, trees)
    #
    return " ".join([str(t.val)  for t in trees])
    #return n, q, A, B, P, X



do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    q = int(parsed_lines[0][1])
    A = []
    B = []
    P = []
    X = []
    for i in range(1, n-1+1):
        a = int(parsed_lines[i][0])
        b = int(parsed_lines[i][1])
        A.append(a)
        B.append(b)
    for i in range(n, 1+n+q-1):
        p = int(parsed_lines[i][0])
        x = int(parsed_lines[i][1])
        P.append(p)
        X.append(x)

    # S = parsed_lines[1][0]
    # return n, k, S
    return n, q, A, B, P, X


if not do_submit:
    n, q, A, B, P, X = input_parse("""
    4 3
    1 2
    2 3
    2 4
    2 10
    1 100
    3 1
    """)
    print(sol(n, q, A, B, P, X))

else:
    # n = int(input().strip())
    # q = int(input().strip())
    n, q = list(map(int, input().split()))
    A = []
    B = []
    P = []
    X = []
    for i in range(n-1):
        a, b = list(map(int, input().split()))
        # a = int(input().strip())
        # b = int(input().strip())
        A.append(a)
        B.append(b)
    for i in range(q):
        p, x = list(map(int, input().split()))
        # p = int(input().strip())
        # x = int(input().strip())
        P.append(p)
        X.append(x)
    print(sol(n, q, A, B, P, X))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
n, q = map(int, input().split())
 
ki = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ki[a].append(b)
    ki[b].append(a)
# print(ki)
 
cnt = [0] * (n + 1)
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x
 
 
# print(cnt)
 
 
def d(y, parent):
    for i in ki[y]:
        if i == parent:
            continue
        cnt[i] += cnt[y]
        d(i, y)
 
 
d(1, -1)
print(*cnt[1:])
import functools
import math

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

x = functools.reduce(math.gcd, A)

flag = 0
i = 0

while flag == 0:
    if x % pow(2,i) == 0:
        i += 1
    else :
        flag = 1

print(i-1)

### FIXED CODE ###

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

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

Z = A[0]

for i in range(N):
    Z = gcd(Z ,A[i])

flag = 0
i = 0

while flag == 0:
    if Z % pow(2,i) == 0:
        i += 1
    else :
        flag = 1

print(i-1)
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2];:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=list(map(int,input().split()))
a1=l1[0]
b2=l1[1]-a1
b3=l1[2]-a1
a2=l2[0]
a3=l3[0]
if a2+b2==l2[1] and a2+b3==l2[2] and a3+b2==l3[1] and a3+b3==l3[2]:
  print("Yes")
else:
  print("No")
from fractionsimport gcd
n,x=map(int,input().split())
print(3*(n-gcd(n,x)))


### FIXED CODE ###

N = int(input())
kushi = sorted(list(map(int,input().split())))
sum = 0
for i in range(2*N):
    if i % 2 == 0:
        sum += kushi[i]
print(sum)
import numpy as np

N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

points = [K] * N

for value in A:
    for i in range(len(points)):
        if i != value - 1:
            points[i] = points[i] - 1

for point in points:
    if point > 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

points = [K - Q] * N

for value in A:
    points[value - 1] += 1

for point in points:
    if point <= 0:
        print('No')
    else:
        print('Yes')
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

oni = a + (v*t)
child = b + (w*t)

if oni = child:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

A, V = [int(n) for n in input().split()]
B, W = [int(n) for n in input().split()]
T = int(input())
 
if V <= W:
    print('NO')
    exit()
    
d = abs(A - B)

if V > W and d <= (V - W) * T:
    print('YES')
else:
    print('NO')
N, Q = map(int, input().split())

v = [[] for i in range(N)]  #もともとの木構造
for i in range(N-1):
  a, b = map(int, input().split())
  #vのindexが頂点番号、各indexの要素が繋がっている要素を表す
  v[a-1].append(b-1) #頂点idが1から始まっているため0にずらす
  v[b-1].append(a-1)

f = [0] * N #足し算するもの
for i in range(Q):
  p, x = map(int, input().split())
  f[p-1] += x  #それぞれの頂点に足すべき項目をあらかじめ追加して整理

print(v)
print(f)

#再帰関数dfsの定義:終了条件はd[y]==0となったら
def dfs(x, d, s): # x:計算する頂点, d:計算了否配列(まだ1完了0), s:頂点xの値
  for y in v[x]:  #頂点xとつながる各頂点yの計算
    if d[y]:      #計算される頂点yが計算未了の場合
      s += f[y]   #頂点xの値sにf[y](頂点yの値)を足す
      ans[y] = s  #頂点yの値をsに確定
      d[y] = 0    #計算済に変更
      dfs(y,d,s)  #頂点yの下層についても再帰的に計算
      s -= f[y]   #頂点yの下層の計算が終わったのでsを頂点xの値に戻す

ans = [0] * N
d = [1] * N #全部未計算にセット
d[0] = 0 #0が"根" 0は計算済(※f[0]が答えだから)
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans) #*と配列でスペース区切りで表示

### FIXED CODE ###

import sys
input = sys.stdin.readline   #sys.std.readlineのほうが10倍速い
N, Q = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(N-1)]
PX = [tuple(map(int, input().split())) for i in range(Q)]
es = [[] for _ in range(N)]  #グラフ配列

for a,b in AB:
  a -= 1
  b -= 1
  es[a].append(b)
  es[b].append(a)
ps = [0] * N   #処理配列(当該のものをプラスする)
for p,x in PX:
  ps[p-1] += x
  
#print(es)
#print(ps)

ans = [0] * N #回答配列
ans[0] = ps[0]
stack = [0]  #待ち配列
visited = [0] * N #訪れたかどうか配列、最初は0、訪れたら1
visited[0] = 1
while stack: #空であればFalse、中身が入ってればTrueを返す性質
  v = stack.pop()
  for i in es[v]:
    if visited[i]:
      continue
    visited[i] = 1
    ans[i] = ans[v] + ps[i]
    stack.append(i)
print(*ans)
import queue
h, w = map(int, input().split())
m = []
for i in range(h):
  m.append(input())
#print(h, w)
#print(m)
q = queue.Queue()
a = []
def init():
  global a, q
  q = queue.Queue()
  a = []
  for i in range(h):
    a.append([-1] * w)

def bfs(cx, cy):
  nxs = [1, 0, -1, 0]
  nys = [0, -1, 0, 1]
  for i in range(4):
    nx = cx + nxs[i]
    ny = cy + nys[i]
    if 0 <= nx and nx < w and 0 <= ny and ny < h and m[ny][nx] == '.' and a[ny][nx] == -1:
      a[ny][nx] = a[cy][cx] + 1
      q.put([nx, ny])
  
def check(start_x, start_y, end_x, end_y):
  if m[start_y][start_x] == '#' or m[end_y][end_y] == '#':
    return 0
  if start_x == end_x and start_y == end_y:
    return 0
  
  global a, q
  init()
  q.put([start_x, start_y])
  a[start_y][start_x] = 0
  while not q.empty():
    cx, cy = q.get()
    bfs(cx, cy)
  return a[end_y][end_x]

ans = 0
for start_y in range(h):
  for start_x in range(w):
    for end_y in range(h):
      for end_x in range(w):
        ans = max(ans, check(start_x, start_y, end_x, end_y))
  
print(ans)

### FIXED CODE ###

import queue
h, w = map(int, input().split())
m = []
for i in range(h):
  m.append(input())
#print(h, w)
#print(m)
q = queue.Queue()
a = []
def init():
  global a
  a = []
  for i in range(h):
    a.append([-1] * w)

def bfs(cx, cy):
  nxs = [1, 0, -1, 0]
  nys = [0, -1, 0, 1]
  for i in range(4):
    nx = cx + nxs[i]
    ny = cy + nys[i]
    if 0 <= nx and nx < w and 0 <= ny and ny < h and m[ny][nx] == '.' and a[ny][nx] == -1:
      a[ny][nx] = a[cy][cx] + 1
      q.put([nx, ny])
  
def check(start_x, start_y):
  if m[start_y][start_x] == '#':
    return 0
  
  global a, q
  init()
  q.put([start_x, start_y])
  a[start_y][start_x] = 0
  end_x = -1
  end_y = -1
  while not q.empty():
    cx, cy = q.get()
    bfs(cx, cy)
    end_x = cx
    end_y = cy
  return a[end_y][end_x]

ans = 0
for i in range(h * w - 1):
    start_x = i % w
    start_y = i // w
    ans = max(ans, check(start_x, start_y))
    
print(ans)
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes"

### FIXED CODE ###

N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")