Harryxun/stf_run huggingface dataset:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b = map(int, input().split())
print(lcm(a, b))

### FIXED CODE ###

import fractions
a, b = map(int, input().split())
print((a*b) // fractions.gcd(a, b))
n, x = map(int, input().split())
a = map(int, input().split())
num = len(a)
a.sort(reverse=True)
for i in range(num):
    x -= a.pop()
    if x < 0:
        print(i)
        exit()
    if x == 0:
        print(i + 1)
        exit()
print(num - 1)

### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
num = len(a)
a.sort(reverse=True)
for i in range(num):
    x -= a.pop()
    if x < 0:
        print(i)
        exit()
    if x == 0:
        print(i + 1)
        exit()
print(num - 1)
n = int(input())
ans = (n * (n + 1) / 2) - n
print(int(ans))

### FIXED CODE ###

s = input()
t = input()

count = 0
for i in range(len(s)):
    if s[i] == t[i]:
        count += 1
        
print(count)
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n =< K:
    answer = k * x
    else answer = k * y:
print answer 

### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n <= k:
    answer = n * x
else: 
    answer = (n-k) * y + k*x

print(answer)
s = list(map(int,input().split()))
t = 0
h = 0
a = s.pop(0)
b = s.pop(0)
print(a)
print(b)
d = 0
for i in range(a+1,a+2+b):
  c = 1
  for k in range(0,b):
    if i == s[k]:
      c = 0
      break
  if c==1:
    t = i
    break
for i in range(a-1,a-2-b,-1):
  c = 1
  for k in range(0,b):
    if i == s[k]:
      c = 0
      break
  if c==1:
    h = i
    break
if abs(t-a)>=abs(h-a):
  print (h)
else:
  print(t)
    

### FIXED CODE ###

x,n=map(int,input().split())
l=list(map(int,input().split()))
a=0
for i in range(100):
    if x-i not in l:
        ans=x-i
        a=i+1
        break
for i in range(100):
    if x+i not in l:
        ansb=x+i
        ab=i+1
        break
if a>ab:
    print(ansb)
else:
    print(ans)
def main():
    while True:
        numlst = []
        numlst = list(map(int, input().split()))
        
        print(min(numlst), max(numlst), sum(numlst))

if __name__ == '__main__':
    main()



### FIXED CODE ###

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

minX = min(X)
maxX = max(X)
sumX = sum(X)
print(minX, maxX, sumX)
inputted = int(raw_input())
l = list(raw_input())
x = 0
record = []
record.append(x)
for i in range(len(l)):
    if l[i] == "I":
        x+=1

    elif l[i] == "D":
        x-=1
    record.append(x)
print max(record)


### FIXED CODE ###

l = map(int, raw_input().split())
if (l[0] * l[1]) > (l[2] * l[3]):
    print (l[0] * l[1])
    exit()
else:
    print (l[2] *  l[3])
n = int(input())
def dfs(s):
  if int(s) > n:
    return 0
  ret = 1 if all([s.count(c) > 0 for c in '753']) else 0
  for c in '753':
    ret += dfs(s+c)
  return ret
print(ret('0'))

### FIXED CODE ###

n = int(input())
def dfs(s):
  if int(s) > n:
    return 0
  ret = 1 if all([s.count(c) > 0 for c in '753']) else 0
  for c in '753':
    ret += dfs(s+c)
  return ret
print(dfs('0'))
h,w=map(int,input().split())
A=[[0]*w for i in range(h)]
for i in range(h):
  A[i]=list(map(int,input().split()))
B=[[0]*w for i in range(h)]
for i in range(h):
  B[i]=list(map(int,input().split()))
C=[[0]* w for i in range(h)]
for i in range(h):
  for j in range(w):
    C[i][j]=abs(A[i][j]-B[i][j])
dp=[[[0]*6401 for j in range(h+1)] for i in range(h+w+1)]
dp[0][0][C[0][0]]=1
for i in range(h+w):
  for j in range(max(0,i-w),min(i,h)+1):
    for k in range(6401):
      if dp[i][j][k]==1:
        if i-j<w-1:
          if k+C[j][i-j]<6400:
            dp[i+1][j][k+C[j][i-j+1]]=1
          dp[i+1][j][abs(k-C[j][i-j+1])]=1
        if j<h-1:
          if k+C[j+1][i-j]<6400:
            dp[i+1][j+1][k+C[j+1][i-j]]=1
          dp[i+1][j+1][abs(k-C[j+1][i-j])]=1
for k in range(6400):
  if dp[h+w-2][h-1][k]==1:
    print(k)
    exit()

### FIXED CODE ###

h,w=map(int,input().split())
A=[[0]*w for i in range(h)]
for i in range(h):
  A[i]=list(map(int,input().split()))
B=[[0]*w for i in range(h)]
for i in range(h):
  B[i]=list(map(int,input().split()))
C=[[0]* w for i in range(h)]
for i in range(h):
  for j in range(w):
    C[i][j]=abs(A[i][j]-B[i][j])
dp=[[[0]*6401 for j in range(h+1)] for i in range(h+w+1)]
dp[0][0][C[0][0]]=1
for i in range(h+w):
  for j in range(max(0,i-w),min(i,h)+1):
    for k in range(6401):
      if dp[i][j][k]==1:
        if i-j<w-1:
          if k+C[j][i-j+1]<6400:
            dp[i+1][j][k+C[j][i-j+1]]=1
          dp[i+1][j][abs(k-C[j][i-j+1])]=1
        if j<h-1:
          if k+C[j+1][i-j]<6400:
            dp[i+1][j+1][k+C[j+1][i-j]]=1
          dp[i+1][j+1][abs(k-C[j+1][i-j])]=1
for k in range(6400):
  if dp[h+w-2][h-1][k]==1:
    print(k)
    exit()
while 1: 
	h,w=map(int, input().split())
	if (h==0) and (w==0): break

	else:
		print("#"*w)
		for I in  range(h-2):
		print("#"+"."*(w-2)+"#")
		print("#"*w)
 


### FIXED CODE ###

while 1:
        (H,W)=[int(i) for i in input().split()]
        if H==W==0:
                break
        print('#'*W)
        for i in range(H-2):
                print('#'+'.'*(W-2)+'#')
        print('#'*W)
        print('')
n = int(input())
s = input()
c = n/2
stt = s[: c]
end = s[c :]
if stt == end:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
s = input()

if s[ :n//2 ] == s[ n//2: ]:
  print("Yes")
else:
  print("No")
a,b,c=map(int,input().split())
if a<c<b or b<c<a
  print('Yes')
else:
  print('No')


### FIXED CODE ###

a,b,c=map(int,input().split())
if a<c<b or b<c<a:
  print('Yes')
else:
  print('No')
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    val = 0
    for j in range(i, len(S1)):
        val += 10000 ** (ord(S1[j]) - ord('a'))
        m[hash(val)] = j - i + 1

ans = 0

for i in range(len(S2)):
    val = 0
    for j in range(i, len(S2)):
        val += 10000 ** (ord(S2[j]) - ord('a'))
        t = hash(val)
        if t in m:
            ans = max(ans, m[t])

print ans


### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

S1 = raw_input()
S2 = raw_input()

m = {}

for i in range(len(S1)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S1)):
        lst[(ord(S1[j]) - ord('a'))] += 1
        m[hash(tuple(lst))] = j - i + 1

ans = 0

for i in range(len(S2)):
    lst = [0 for j in range(26)]
    for j in range(i, len(S2)):
        lst[(ord(S2[j]) - ord('a'))] += 1
        t = hash(tuple(lst))
        if t in m:
            ans = max(ans, m[t])

print ans
N = int(input())
X, U = [], []
for i in range(N):
    x, u = input().split(" ")
    X.append(float(x))
    U.append(u)

ans = 0
for i in range(N):
    if u == 'BTC':
        ans += x * 380000
    else:
        ans += x
print(ans)

### FIXED CODE ###

N = int(input())
X, U = [], []
for i in range(N):
    x, u = input().split(" ")
    X.append(float(x))
    U.append(u)

ans = 0
for i in range(N):
    if U[i] == 'BTC':
        ans += X[i] * 380000
    else:
        ans += X[i]
print(ans)
S=str(input())

T=str(input())

if S=T-(T-S):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S=list(input())
 
T=list(input())
Judge = True 
 
for i in range(len(S)):
  if S[i]==T[i]:
    continue
  else:
    Judge = False

if Judge:
  print("Yes")
else:
  print("No")
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
print('Yes' sum([max(A[i] - B[i], 0) for i in range(N)]) <= sum(B) - sum(A) if else 'No')

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
d = sum(B) - sum(A)
for i in range(N):
  if A[i] % 2 != B[i] % 2:
    B[i] += 1
    d -= 1
print('Yes' if sum([max(A[i] - B[i], 0) for i in range(N)]) <= d else 'No')
S=input()
n=len(S)-1
ans=0
def dfs(i,f):
  if i==n:
    return sum(map(int,f.split("+")))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])
print(def(0,S[0])  
    


### FIXED CODE ###

S=input()
n=len(S)
ans=0

for bit in range(1<<(n-1)):
  f=S[0]
  for i in range(n-1):
    if bit & (1<<i):
      f+="+"
    f+=S[i+1]
  ans+=sum(map(int,f.split("+")))
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n>k:
    s=p[0]+p[1]+p[2]
    print(s)
    exit()

if n==k and k==len(p):
        print(sum(p))


### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
if n==k and k==len(p):
        print(sum(p))
        exit()

if n>k:
    s=0
    for i in range(k):
        s+=p[i]
        
print(s)
import math
N, M = map(int, input().split())

if int(math.sqrt(M)) > N:
    for i in range(N,int(math.sqrt(M))):
        if M%i == 0:
            ans = M//i
            break
        else:
            continue
else:
    for i in range(M//N,0,-1):
        if M%i == 0:
            ans = i
            break
        else:
            continue

print(ans)

### FIXED CODE ###

G = int(input())
if G == 1:
    print('Hello World')
if G == 2:
    ANS = 0
    for i in range(2):
        ANS += int(input())
    print(ANS)
def answer():
    input = sys.stdin.readline
    M = int(input())

    part = ''
    for i in range(M):
        d, c = input().split()
        part += d * int(c)

    _round = 0
    while len(part) > 1:
        _round += 1
        # 和10以上を探索
        mt10 = 0
        for i in range(1, len(part)):
            s1 = part[-i]
            s2 = part[-i-1]
            if int(s1) + int(s2) >= 10:
                mt10 = - i - 1
                break

        if mt10 == 0:
            s1 = part[0]
            s2 = part[1]
            s3 = part[2:]
            part = str(int(s1) + int(s2)) + s3
        else:
            s1 = part[:mt10]
            s2 = part[mt10]
            s3 = part[mt10+1]
            s4 = ''
            if mt10 < -2:
                s4 = part[mt10+2:]
            part = s1 + str(int(s2)+int(s3)) + s4

    print(_round)


if __name__ == '__main__':
    answer()


### FIXED CODE ###

import sys

def answer():
    input = sys.stdin.readline
    M = int(input())

    Ds = [0] * M
    Cs = [0] * M
    total = 0

    for i in range(M):
        c, d = map(int, input().split())
        Cs[i] = c
        Ds[i] = d
        total += d * c

    digits = sum(Ds)

    ans = (digits-1) + (total-1) // 9

    print(ans)


if __name__ == '__main__':
    answer()
a,b=map(str,input().split())
n=int(a+b)
for i in range(0,110):
  if i**2==n:
    print('Yes')
	exit()
print('No')
  

### FIXED CODE ###

a,b=map(str,input().split())
n=int(a+b)
for i in range(0,1000):
    if i**2==n:
        print('Yes')
        exit()
print('No')
import numpy  as np
N,M=map(int,input().split())
high_list=list(map(int,input().split()))
pathlist=[]
for i in range(M):
    pathlist.append(list(map(int,input().split())))
waylist=np.array([[0]*N]*N)
#i行目にi番目から行ける展望台をすべて入れる
for n in range(1,N+1):
    for m in pathlist:
        if(n in m):#もし経路に入っていたら
            if(m[0]==n):#自身じゃない方の高さを代入
                waylist[n-1][m[1]-1]=high_list[m[1]-1]
            else:
                waylist[n-1][m[0]-1]=high_list[m[0]-1]

answer=0
for n in range(N):
    if(waylist[n].max()<high_list[n]):
        answer=answer+1

print(answer)




### FIXED CODE ###

x=input()
print('ARC' if x == 'ABC' else 'ABC')
n = int(input())
ans = 1 + n
if n % 2 == 0:
    max = n / 2 + 1
else:
    max = (n + 1) / 2

for i in range (1, max):
    if max % i == 0 and i + max / i < ans:
        ans = i + max /i

print(int(ans - 2))


### FIXED CODE ###

import math
n = int(input())
ans = 1 + n

max = math.ceil(n**0.5)

for i in range (2, max+1):
    if n % i == 0 and i + n / i < ans:
        ans = i + n / i

print(int(ans - 2))
A,B = map(int,input())

print((A+B)%24)

### FIXED CODE ###

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

print((A+B)%24)
a = int(input())
priint(a*a)

### FIXED CODE ###

a = int(input())
print(a*a)
import sys
sys.setrecursionlimit(10**6)

M = 10**9 + 7
K = int(input())
D = int(input())

dp = [[None] * 100 for _ in range(10**5 + 1)]
def f(k, i):
    if dp[i][k] is not None:
        return dp[i][k]

    if i == 0:
        r = (k % D) == 0
        dp[i][k] = r
        return r
    r = sum(f((k + x) % D, i - 1) for x in range(0, 10)) % M
    dp[i][k] = r
    return r

sk = str(K)
dig = len(sk)
answer = 0
s = sum(map(int, list(sk)))
for j in range(int(sk[-1]) + 1):
    if (s - j) % D == 0:
        answer += 1

if dig > 1:
    s -= int(sk[-1])
    for i in range(dig - 1, 1, -1):
        if sk[i - 1] == "0":
            continue
        for j in range(int(sk[i - 1])):
            answer += f(s - 1 - j, dig - i)
        s -= int(sk[i - 1])

    for k in range(1, int(sk[0])):
        answer += f(k, dig - 1)

    if dig > 1: # 先頭0固定
        for k in range(10):
            answer += f(k, dig - 2)


print((answer - 1) % M)

### FIXED CODE ###

string = input()
d = int(input())

nums = [int(v) for v in string]
length = len(string) - 1
k = int(string)

M = 10**9 + 7
def mod(v):
    if v >= M:
        return v % M
    return v

dp = [[[None] * 2 for _ in range(d)] for _ in range(length + 2)]
def dfs(i=0, s=0, border=True):
    if dp[i][s][border] is not None:
        return dp[i][s][border]

    if i > length:
        r = int(not bool(s))
        dp[i][s][border] = r
        return r

    cnt = 0
    for n in range(max(9 * (not border), nums[i]) + 1):
        cnt = mod(cnt + dfs(i + 1, (s + n) % d, border and nums[i] == n))
    dp[i][s][border] = cnt
    return cnt
# print(mod(dfs() - 1))

for i in reversed(range(length + 2)):
    for s in reversed(range(d)):
        for border in [False, True]:
            if i > length:
                dp[i][s][border] = int(not bool(s))
                continue

            cnt = 0
            for n in range(max(9 * (not border), nums[i]) + 1):
                cnt = mod(cnt + dp[i + 1][(s + n) % d][border and nums[i] == n])
            dp[i][s][border] = cnt

print(mod(dp[0][0][1] - 1 + M))
n=int(input())
x=list(map(int, input().split()))
import numpy as np

y=np.repeat([1,-1]*(n-1))
y.append([1])
print(y)

for i in range(n):
	if i%2!=0:
		y[i]=-1

x2=np.array(x).T

for i in range(n):
	y2=np.roll(y,i)
	res=np.dot(y2,x2)
	print(res)

### FIXED CODE ###

n, a, b=map(int, input().split())
res=min(n*a,b)
print(res)
#coding:utf-8
a, b = map(int, input().split())

if a >= b:
    print(1)
else:
    #1つタップを増やすとa-1口増えるので、b-1口増やすことを考える
    tap = -(-（((b-1)//(a-1)))
    print(tap)

### FIXED CODE ###

#coding:utf-8
a, b = map(int, input().split())

#1つタップを増やすとa-1口増えるので、b-1口増やすことを考える
tap = -(-(b-1)//(a-1))
print(tap)
cha=str(input())
if(cha==SUN):
  print(7)
if(cha==SAT):
  print(1)
if(cha==FRI):
  print(2)
if(cha==THR):
  print(3)
if(cha==WED):
  print(4)
if(cha==TUE):
  print(5)
if(cha==MON):
  print(6)

### FIXED CODE ###

s=input()
if(s=="SUN"):
  print(7)
if(s=="MON"):
  print(6)
if(s=="TUE"):
  print(5)
if(s=="WED"):
  print(4)
if(s=="THU"):
  print(3)
if(s=="FRI"):
  print(2)
if(s=="SAT"):
  print(1)
N = int(input())
H = list(map( int, input().split()))
def solve():
  for i in range(N-1, 0, -1):
    if H[i-1]-H[i]>1>
    return False
  return True

print('Yes' if solve() else 'No')

### FIXED CODE ###

N = int(input())
H = list(map( int, input().split()))
def solve():
  for i in range(N-1, 0, -1):
    if H[i-1]-H[i]>1:
      return False
    if H[i-1]-H[i]==1:
      H[i-1]-=1
  return True

print('Yes' if solve() else 'No')
n,a,b=map(int,input().split())

list_a=[]
for i in range(a):
    list_a+="a"
list_b=[]
for i in range(b):
    list_a+="b"

list=[]
for i in range(10**100):
    if len(list)>=n:
        break
    else:
        if i%2==0:
            list+=list_a
        else:
            list+=list_b
ans=0
for i in range(n):
    if list[i]=="a":
        ans+=1
    else:
        ()
print(ans)

### FIXED CODE ###

S=input()
list=[]
ans=['*', '*', '*']
for s in S:list+="*" if s==S[0] else s

if list==ans :
    print('No')
else :
    print('Yes')
import sys
sys.setrecursionlimit(10000)

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

red = n - blue

waru = 10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


for i in range(1, blue+1):
    ans = cmb(red+1, i) * cmb(blue-1, i-1)
    print(ans%waru)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

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

red = n - blue

waru = 10**9+7

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for i in range(1, blue+1, 1):
    if red + 1 < i:
        print(0) 
    else:
        ans = cmb(red+1, i) * cmb(blue-1, i-1)
        #print(i)
        print(ans%waru)
s=int(input())
S=str(s)
w=len(str(s))-1
l=[]
L=[]
for i in range(2**w):
    l.append(format(i, '0{}b'.format(w)))
for e in l:
    q=[]
    x=int(S[0])
    for i in range(len(e)):
        if e[i]=='0':
            x=x*10+int(S[i+1])
        else:
            q.append(x)
            x=int(S[i+1])
    q.append(x)
    L.append(sum(q))
print(sum(L)

### FIXED CODE ###

s=int(input())
S=str(s)
w=len(str(s))-1
l=[]
L=[]
if w==0:
    print(s)
else:
    for i in range(2**w):
        l.append(format(i, '0{}b'.format(w)))
    for e in l:
        q=[]
        x=int(S[0])
        for i in range(len(e)):
            if e[i]=='0':
                x=x*10+int(S[i+1])
            else:
                q.append(x)
                x=int(S[i+1])
        q.append(x)
        L.append(sum(q))
    print(sum(L))
a=int(input(1))
b=int(input(2))

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")
s = input()
ans = 0
ans_l = []

if len(s) == 1:
    print(1)
    quit()
for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        ans += 1
    else:
        ans_l.append(ans)
        ans = 0
print(max(ans_l))


### FIXED CODE ###

s = input()
ans = 0
ans_l = [0]*len(s)


for i in range(len(s)):
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        ans_l[ans] += 1
    else:
        ans += 1
print(max(ans_l))
n = int(input())
for i in range(1,10):
  for j in range(1,10):
    if i*j == n:
      print(Yes)
      return;
print(No)

### FIXED CODE ###

n = int(input())
for i in range(1,10):
  for j in range(1,10):
    if i*j == n:
      print("Yes")
      exit()
print("No")
price, hate = input().split()
no_num = set([x for x in input().split()])
ok_num = sorted(list({'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} - no_num))

result = []
f = True
exe = True
for i in price:
    f = True
    for j in ok_num:
        if i <= j:
            print(j)
            result.append(j)
            f = False
            break
    if f and exe:
        exe = False
        result[-1] = str(int(result[-1]) + 1)
        for i in ok_num:
            if result[-1] < i:
                result[-1] = i
                break
        result.append(ok_num[-1])
    

print(''.join(result))


### FIXED CODE ###

kingaku, n = input().split()
no_num = input().split()
result = []
ok_num = []
kuriage_num = [-1, 0]

def kuriage(l):
    for i in ok_num:
        if result[l] < i:
            kuriage_num = [l, i]
            return
    if l <= 0:
        return
    return kuriage(l-1)

#使える数字のリストを作成
for i in range(10):
    if not str(i) in no_num:
        ok_num.append(str(i))

set_flg = False
for i in kingaku:
    set_flg = True
    for j in ok_num:
        if i == j:
            set_flg = False
            result.append(j)
            break
        elif i < j:
            result.append(j)
            print("".join(result).ljust(len(kingaku), ok_num[0]))
            exit()
            break
    
    if set_flg:
        n = 0
        if ok_num[0] == '0':
            n = 1
        print(ok_num[n].ljust(len(kingaku)+1, ok_num[0]))
        exit()

print(''.join(result))
def tag(a,b,v,w,t):
    if w>=v:
        return "NO"
    elif w==v:
        res = a+(v*(t+1))-b(w+t)
        if res>-1:
            return "YES"
        return "NO"
    else:
        res = a+(v*t)-b(w+t)
        if res>-1:
            return "YES"
        return "NO"

if __name__ == "__main__":
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())
    print(tag(a,b,v,w,t))

### FIXED CODE ###

def tag(a,b,v,w,t):
    res = (v*t)-(abs(b-a)+(w*t))
    if res>=0:
        return "YES"
    return "NO"

if __name__ == "__main__":
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())
    print(tag(a,b,v,w,t))
A,B=map(int,input().split())
sum =0
for i in range(2)
  if A >= B:
     sum+=A
     A-=1
  else:
     sum+=B
     B-=1
print(sum)

### FIXED CODE ###

A,B=map(int,input().split())
sum =0
for i in range(2):
  if A >= B:
     sum+=A
     A-=1
  else:
     sum+=B
     B-=1
print(sum)
S = int(input())
in = divmod(S,3600)
h = in[0] 
in = divmod(in[1],60)
m = in[0]
s = in[1]

### FIXED CODE ###

S = int(input())
h, mod = divmod(S,3600)
m, mod = divmod(mod,60)
s = mod
print(h,m,s, sep=":")
def m():
	return map(int,input().split())


def oon(x,n,nn,k):
	global a
	for i in range(len(x[n])):
		if x[n][i][0] != nn:
			p = (k + x[n][i][1]) % 2
			if p == 0:
				a[x[n][i][0]] = 0
				oon(x,x[n][i][0],n,p)
			else:
				oon(x,x[n][i][0],n,p)
		else:
			continue


nnn = int(input())

a = [1 for i in range(nnn)]
a[0] = 0
b = [[] for i in range(nnn)]

for i in range(nnn-1):
	z,x,c = m();
	b[z-1].append([x-1,c])
	b[x-1].append([z-1,c])

oon(b,0,0,0)

for i in range(nnn):
	print(a[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
nnn = int(input())

a = [-2 for i in range(nnn)]
a[0] = 0

def m():
	return map(int,input().split())


def oon(x,n,nn,k):
	global a
	for i in range(len(x[n])):
		if x[n][i][0] != nn and a[nn] != -2:
			p = (k + x[n][i][1]) % 2
			if p == 0:
				a[x[n][i][0]] = 0
			else:
				a[x[n][i][0]] = 1
			oon(x,x[n][i][0],n,p)



b = [[] for i in range(nnn)]

for i in range(nnn-1):
	z,x,c = m();
	b[z-1].append([x-1,c])
	b[x-1].append([z-1,c])

oon(b,0,0,0)

for i in range(nnn):
	print(a[i])
n, q = list(map(int, input().split()))
#n = 4
#q = 3

ans = [0]*n-1
ki = {}
for i in range(1,n+1):
    ki[i] = []

#z = ["1 2", "2 3", "2 4"]

for i in range(n-1):
    e = list(map(int, input().split()))
    #e = list(map(int, z[i].split()))
    ki[e[0]].append(e[1])

#print(ki)

def df(graph, start, point):
    stack = [start]
    visited = []
    while stack:
        v = stack.pop(0)
        ans[v - 1] += point
        if v not in visited:
            visited.append(v)
            stack = graph.get(v, []) + stack

#y = ["2 10", "1 100", "3 1"]
for i in range(q):
    p = list(map(int, input().split()))
    #p = list(map(int, y[i].split()))
    df(ki, p[0], p[1])

for n in ans:
    print(n, end=" ")



### FIXED CODE ###

import sys

def main():
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    n, q = map(int, input().split())
    #n, q = map(int, "4 3".split())
    g = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        #a, b = map(int, ["1 2", "2 3", "2 4"][i].split())
        g[a-1].append(b-1)
        g[b-1].append(a-1)


    add = [0] * n
    for i in range(q):
        p, v = map(int, input().split())
        #p, v = map(int, ["2 10", "1 100", "3 1"][i].split())
        #dfs(p-1, v)
        add[p-1] += v

    ans = [0] * n
    def dfs(v,p,value): #p: parent of v
        value += add[v]
        ans[v] = value
        for c in g[v]:
            if c == p: continue
            dfs(c,v,value)
    dfs(0, -1, 0)
    """
    def dfs(start, point):
        stack = [start]
        while stack:
            x = stack.pop()
            ans[x] += point
            stack += g[x]
    """

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

if __name__ == '__main__':
    main()