Harryxun/stf_run huggingface dataset:
n,q=map(int,input().split())
ab = [list(map(int, input().split())) for _ in range(n-1)]
px = [list(map(int, input().split())) for _ in range(q)]

graph=[[] for _ in range(n+1)]
for a,b in ab:
    graph[a].append(b)
    graph[b].append(a)

value=[0]*(n+1)

for p,x in px:
    value[p]+=x

# print(value)
# print(graph)

def dfs(v,parent,add):
    value[v] += add
    # print(value)
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

ans=' '.join(map(str,value[1:]))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
# 遅延評価で加えてあげるだけ
 
N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x
 
def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])
 
dfs(1,0,0)
 
answer = ' '.join(map(str,value[1:]))
print(answer)
import math

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

for i in range(n):
    p = A.pop(0)
    ans = A[0]
    for j in range(1, n-1):
        ans = math.gcd(ans, A[j])
    ans_list.append(ans)
    A.append(p)

print(max(ans_list))

### FIXED CODE ###

import fractions

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

L = [0]
R = [0]
ans_list = []

for i in range(n-1):
    L.append(fractions.gcd(L[i], A[i]))
    R.append(fractions.gcd(R[i], A[n-1-i]))

for j in range(n):
    ans_list.append(fractions.gcd(L[j], R[-j-1]))

print(max(ans_list))
N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

def check(L):
    return sum(a // L for a in A) <= K

answer=max(A)
lo = 1
hi = answer+1
while lo < hi:
    m = (lo + hi)//2
    ok = check(m)
    if not ok: # 
        lo=m+1
    else:
        answer=min(m, answer)
        hi=m
print(answer))


"""
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x: lo = mid+1
        else: hi = mid
    return lo

    while lo < hi:
        mid = (lo+hi)//2
        if x < a[mid]: hi = mid
        else: lo = mid+1
    return lo
"""


### FIXED CODE ###

import math

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

def check(L):
    return sum(math.ceil(a / L)-1 for a in A) <= K

answer=max(A)
lo = 1
hi = answer+1
while lo < hi:
    m = (lo + hi)//2
    ok = check(m)
    if ok: 
        answer=min(m, answer)
        hi=m
    else:
        lo=m+1
print(answer)
import sys


def euc(n,m):
    if n == m:
        return m
    elif m == 1 or n == 1:
        return 1
    else:
        return euc(min(n,m), max(n,m)-min(n,m))


for line in sys.stdin:
    a,b = [int(i) for i in line.split()]
    print(euc(a,b),int(a*b/euc(a,b)))



### FIXED CODE ###

import sys


def euc(n,m):
    if max(n,m)%min(n,m) == 0:
        return min(n,m)
    else:
        return euc(min(n,m), max(n,m)%min(n,m))


for line in sys.stdin:
    a,b = [int(i) for i in line.split()]
    print(euc(a,b),int(a*b/euc(a,b)))
def dfs(i,p):
    
    for j in edges[i]:
        if(j!=p):
            
            num[j] += num[i]
            
            dfs(j,i)
    

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


a=[]
b=[]

p=[]
x=[]

#隣接リスト
edges = [ [] for i in range(N)]
num = [0]*N


for i in range(N-1):
    a0,b0 = map(int,input().split())
    a.append(a0)
    b.append(b0)
    
    edges[a0-1].append(b0-1)
    edges[b0-1].append(a0-1)
    
for i in range(Q):
    p0,x0 = map(int,input().split())
    p.append(p0)
    x.append(x0)
    num[p0-1] += x0
    
dfs(0,-1)
    
for i in range(N):
    print(num[i], end=" ")

### FIXED CODE ###

# https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
sys.setrecursionlimit(2*2*10**5)

def dfs(i,p,edges,num):
    
    for j in edges[i]:
        if(j!=p):
            
            num[j] += num[i]
            
            dfs(j,i,edges,num)
    
def input():
    return sys.stdin.readline()[:-1]

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


#隣接リスト
edges = [ [] for i in range(N)]
num = [0]*N


for i in range(N-1):
    a0,b0 = map(int,input().split())

    edges[a0-1].append(b0-1)
    edges[b0-1].append(a0-1)
    
for i in range(Q):
    p0,x0 = map(int,input().split())

    num[p0-1] += x0
    
dfs(0,-1, edges, num)
    
for i in range(N):
    print(num[i], end=" ")
n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append((x,y))
x={}
for i in l:
    for j in l:
        if i!=j:
            t=(i[0]-j[0],i[1]-j[1])
            if t in x:
                x[t]+=1
            else:
                x[t]=1
print(n-max(x.values()))

### FIXED CODE ###

n=int(input())
l=[]
if n==1:
    print(1)
    exit()
else:
    for i in range(n):
        x,y=map(int,input().split())
        l.append((x,y))
    x={}
    for i in l:
        for j in l:
            if i!=j:
                t=(i[0]-j[0],i[1]-j[1])
                if t in x:
                    x[t]+=1
                else:
                    x[t]=1
    print(n-max(x.values()))
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N = I()
cou = int(0)
color = []
a = int(input())
maxcolor =[]
maxcolor.append(a)

for i in range(N-1):
    a = int(input())
    if a<=min(maxcolor):
        maxcolor.append(a)
    else:
        aupper = len(maxcolor)
        alower = int(0)
        acandi = (aupper+1)//2
        while (True):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = (aupper+acandi)//2 + 1
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2


#print(maxcolor)
ans = len(maxcolor)
print(ans)


### FIXED CODE ###

from collections import deque
import bisect
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
ans = int(0)

N = I()
color = []
a = I()
maxcolor =deque()
maxcolor.append(a)
lena = 1
for i in range(N-1):
    minmaxcolor = maxcolor[0]
    a = I()
    if a<=minmaxcolor:
        maxcolor.appendleft(a)
#        maxcolor.append(a)
        lena += 1
    else:
        acandi = bisect.bisect_left(maxcolor, a)
        maxcolor[acandi-1] = a
        """
        aupper = lena-1
        alower = int(0)
        acandi = aupper//2
        
        for _ in range(aupper+1):
            if maxcolor[acandi]>=a:
                alower = acandi
                acandi = (aupper+acandi+1)//2
            else:
                if aupper - alower <= 1:
                    maxcolor[acandi] = a
                    break
                else:
                    aupper = acandi
                    acandi = (acandi + alower) // 2
        """

#print(maxcolor)
ans = len(maxcolor)
print(ans)
x,y = map(input().split())

if x < y:
  print('<')
elif x > y:
  print('>')
else:
  print('=')

### FIXED CODE ###

x,y = input().split()

if x < y:
  print('<')
elif x > y:
  print('>')
else:
  print('=')
N = int(input())
P = list(map(float, input().split()))
import numpy as np
def prob_ret():
  prob = [0.0]*(N+1)
  prob[0] = 1
  prob=np.array(prob)
  for n in range(N):
    p = prob[:n]*P[n]
    prob[:n] = prob[:n] * (1-P[n])
    prob[1:] = prob[1:] + p
  return sum(prob[N//2+1:])
print(prob_ret())


### FIXED CODE ###

N = int(input())
P = list(map(float, input().split()))
import numpy as np
def prob_ret():
  prob = [0.0]*(N+1)
  prob[0] = 1
  prob=np.array(prob)
  for n in range(N):
    p = prob[:N]*P[n]
    prob = prob * (1-P[n])
    prob[1:] = prob[1:] + p
  return sum(prob[N//2+1:])
print(prob_ret())
import sys
readline = sys.stdin.readline

class UnionFind(object):
    def __init__(self, n):
        self._par = list(range(n))
        self.size = [1]*n

    def root(self, v):
        if self._par[v] == v:
            return v
        self._par[v] = self.root(self._par[v])
        return self._par[v]
    
    def unite(self, u, v):
        u, v = self.root(u), self.root(v)
        if u==v:
            return False
        if self.size[u] > self.size[v]:
            u, v = v, u
        self.size[v] += self.size[u]
        self._par[u] = v

    def is_connected(self, u, v):
        return self.root(u)==self.root(v)

n, m = map(int, readline().split())
P = list(map(lambda x:int(x)-1, readline().split()))
uf = UnionFind(n)
for _ in range(m):
    x, y = map(lambda x:int(x)-1, readline().split())
    uf,unite(x,y)

ans = 0
for i in range(n):
    if uf.is_connected(i, p[i]):
        ans += 1
print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

class UnionFind(object):
    def __init__(self, n):
        self._par = list(range(n))
        self.size = [1]*n

    def root(self, v):
        if self._par[v] == v:
            return v
        self._par[v] = self.root(self._par[v])
        return self._par[v]
    
    def unite(self, u, v):
        u, v = self.root(u), self.root(v)
        if u==v:
            return False
        if self.size[u] > self.size[v]:
            u, v = v, u
        self.size[v] += self.size[u]
        self._par[u] = v

    def is_connected(self, u, v):
        return self.root(u)==self.root(v)

n, m = map(int, readline().split())
P = list(map(lambda x:int(x)-1, readline().split()))
uf = UnionFind(n)
for _ in range(m):
    x, y = map(lambda x:int(x)-1, readline().split())
    uf.unite(x,y)

ans = 0
for i in range(n):
    if uf.is_connected(i, P[i]):
        ans += 1
print(ans)
N = int(input())
buildings = [[[0]*10]*3]*4
for i in range(N):
 b, f, r, num = map(int, input().split())
 buildings[b-1][f-1][r-1] += num

for i in range(4):
 for j in range(3):
  for k in range(10):
   print(" {0}".format(buildings[k][j][i]), end="")
  print()
 if i!=3:
  print("####################")

### FIXED CODE ###

N = int(input())
buildings = [[[0 for V in range(10)] for F in range(3)] for B in range(4)]
for i in range(N):
 b, f, r, num = map(int, input().split())
 buildings[b-1][f-1][r-1] += num

for i in range(4):
 for j in range(3):
  for k in range(10):
   print(" {0}".format(buildings[i][j][k]), end="")
  print()
 if i!=3:
  print("####################")
import sys

input = sys.stdin.readline
N, M = map(int, input().split())
pair = {}
rank = {}
def root(x):
    if x == pair[x]:
        return x
    else:
        pair[x] = root(pair[x])
    return pair[x]

def unite(x, y):
    rx = root(x)
    ry = root(y)
    if rank[rx] < rank[ry]:
        pair[rx] = ry
    else:
        pair[ry] = rx
        if rx == ry:
            rank[rx] += 1

for i in range(1, N+1):
    pair.setdefault(i, i)

for i in range(1, N+1):
    rank.setdefault(i, 0)

for i in range(M):
    x, y, z = map(int, input().split())
    unite(x, y)

cnt = set()
for k, y in pair.items():
    y = root(y)
    cnt.add(y)
print(len(cnt))


### FIXED CODE ###

import sys

input = sys.stdin.readline
N, M = map(int, input().split())
pair = {}
rank = {}
def root(x):
    if x == pair[x]:
        return x
    else:
        pair[x] = root(pair[x])
    return pair[x]

def unite(x, y):
    rx = root(x)
    ry = root(y)
    if rx > ry:
        pair[rx] = pair[ry]
    else:
        pair[ry] = pair[rx]

for i in range(1, N+1):
    pair.setdefault(i, i)

for i in range(1, N+1):
    rank.setdefault(i, 0)

tmp = []
for i in range(M):
    tmp.append(list(map(int, input().split())))
tmp.sort()
for i in range(M):
    x, y = tmp[i][0], tmp[i][1]
    if x < y:
        unite(x, y)
    else:
        unite(y, x)

cnt = set()
for k, y in pair.items():
    y = root(y)
    cnt.add(y)
print(len(cnt))
N,A,B=map(int,input().split())


sum=0

if A==0:
    print(0)
else:
    a=N//(A+B)
    b=N%(A+B)

    # print(a)
    # print(b)
    if b>A:
        sum=A*a+A
        print(sum)
    else:
        sum=A*a+b
        print(sum)

### FIXED CODE ###

S=list(map(str,input()))

if S[0]!=S[1]:
    print("Yes")

elif S[0]!=S[2]:
    print("Yes")

elif S[1]!=S[2]:
    print("Yes")

else:
    print("No")
if __name__ == '__main__':
  n = int(input())
  heights = map(int, input().split(' '))

  prev = -100
  answer = 'Yes'

  for height in heights:
    if (height >= prev + 1):
      height = height -1
    elif height == prev:
      height = height
    else:
      answer = 'No'
      print(answer)
      exit()
    prev = height
  print(answer)

### FIXED CODE ###

if __name__ == '__main__':
  str = input()
  strList = [c for c in str]
  strList.append('e')
  strLength = len(strList)
  rLength = 0
  lLength = 0
  i = 0
  changePoint = 0

  child = [0 for i in range(strLength-1)]

  c = 'R'
  
  while(c != 'e'):
    c = strList[i]
    while(c == 'R'):
      i += 1
      c = strList[i]
      rLength += 1
    
    changePoint = i
    
    while(c == 'L'):
      i += 1
      c = strList[i]
      lLength += 1

    rRight = int(rLength/2)
    rLeft = rLength - rRight

    lLeft = int(lLength/2)
    lRight = lLength - lLeft

    child[changePoint-1] += rLeft + lLeft
    child[changePoint] += rRight + lRight

    rLength = 0
    lLength = 0
  
  for numOfChild in child:
    print(numOfChild, end="")
    print(' ', end="")
a = int(inpu())
b = int(inpu())
c = int(inpu())
x = int(inpu())
res = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      total = i * 500 + j * 100 + c * 50
      if total == x:
        res += 1
print(res)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      total = i*500 + j*100 + k*50
      if total == x:
        res += 1
print(res)
n = int(input())
nums = list(map(int, input().split()))

values = {}
for i in nums:
  if i in values: values[i] += 1
  else: values[i] = 1

sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数（ボールがないとき版
allsum = 0
for k,v in values.items():
  sums[k] = v * (v - 1) / 2
  undersum = (v - 2) * (v - 1) / 2 if v > 1 else 0
  subsums[k] = sums[k] - undersum
  allsum += sums[k]

# res={} # 各値のない時版 + 他の合計
# for k,v in sums.items():

for i in nums:
  print(int(allsum - subsums[i]))


### FIXED CODE ###

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

print(int(n * (n-1) / 2 + m * (m - 1) / 2))
s=list(input())
t=list(input())
dp=[[0]*(30) for j in range(30)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i>0 and j>0 :
    if dp[i-1][j-1]!=dp[i][j]:
        answer.append(chr(s[i-1]))
        i-=1
        j-=1
    elif dp[i-1][j]==dp[i][j]:
        i-=1
    elif dp[i][j-1]==dp[i][j]:
        j-=1
print("".join(reversed(answer)))

### FIXED CODE ###

s=list(input())
t=list(input())
dp=[[0]*(3030) for j in range(3030)]
ans=[]
memo=-1
for i in range(len(s)):
    for j in range(len(t)):
        if s[i]==t[j]:
             dp[i+1][j+1] = dp[i][j]+1
             if memo < i:
                 ans.append(t[j])
                 memo = i

        else:
            dp[i+1][j+1] =max(dp[i][j+1],dp[i+1][j])

#print(dp[len(s)][len(t)])
answer=[]
i,j=len(s),len(t)
d=dp[i-1][j-1]
while i>=0 and j>=0:

    if dp[i-1][j]==dp[i][j]:
        i-=1
    elif dp[i][j-1]==dp[i][j]:
        j-=1
    else:
        answer.append(s[i - 1])
        i -= 1
        j -= 1
print("".join(reversed(answer)))
import fractions
N,M = map(int,input().split())
S = input()
T = input()
L = (N * M) // fractions.gcd(N,M)
div_N = L // N
div_M = L // M
tag = (div_N * div_M) // fractions.gcd(div_N,div_M)
count = tag // div_M
s = [""] * L
t = [""] * L

for ss in range(N):
  if ss == 0:
    s[0] = S[0]
    if s[0] != T[0]:
      print(-1)
      exit()
  else:
    s[ss * (div_N)] = S[ss]
#print(L)
#print(s)
#print(tag)
while tag <= L:
  if s[tag] != "" and s[tag] != T[count]:
      print(-1)
      exit()
  tag += tag
  count += count
print(L)

### FIXED CODE ###

import fractions
N,M = map(int,input().split())
S = input()
T = input()
G = fractions.gcd(N,M)
L = (N * M) // G
div_N = N // G
div_M = M // G

i = 0
j = 0

while i < N and j < M:
  if S[i] != T[j]:
    print(-1)
    exit()
  else:
    i += div_N
    j += div_M
print(L)
a, b, c = input().split()

if (a[-1] == B[0]) and (B[-1] == C[0]):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a, b, c = input().split()
 
if (a[-1] == b[0]) and (b[-1] == c[0]):
    print("YES")
else:
    print("NO")
a = input()
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print(Yes)
else:
	print(No)

### FIXED CODE ###

a = int(input())
b1 = a // 10
b2 = a % 1000
if (b1 * b2) % 111 == 0:
	print("Yes")
else:
	print("No")
import fractions
N,M = map(int,input().split())
S = input()
T = input()
flag = True
X = (N * M) // fractions.gcd(N,M)

div_N = X // N
div_M = X // M  
s = [""] * X

for ss in range(N):
  if ss == 0:
    s[0] = S[0]
  else:
    s[ss * (div_N)] = S[ss]

for tt in range(M):
  if tt == 0:
    if s[0] != T[tt]:
      print(-1)
      exit()
  else:
    pro = tt * (div_M)
    if s[pro] != "" and s[pro] != T[tt]:
      print(-1)
      exit()
print(X)

### FIXED CODE ###

import fractions
N,M = map(int,input().split())
S = input()
T = input()
G = fractions.gcd(N,M)
L = (N * M) // G
div_N = N // G
div_M = M // G

i = 0
j = 0

while i < N and j < M:
  if S[i] != T[j]:
    print(-1)
    exit()
  else:
    i += div_N
    j += div_M
print(L)
count_50 = int(inpiut())
count_100 = int(inpiut())
count_500 = int(inpiut())
target = int(input())
count = 0

for num_50 in range(0, count_50 + 1):
    total = num_50 * 50
    if total == target:
        count += 1
        continue
    for num_100 in range(0, count_100 + 1):
        total_2 = num_50 * 50 + num_100 * 100
        if total_2 == target:
            count += 1
            continue
        for num_500 in range(0, count_500+1):
            total_3 = num_50 * 50 + num_100 * 100 + num_500 * 500
            if total_3 == target:
                count += 1
                continue
print(count)

### FIXED CODE ###

count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())
count = 0

for num_50 in range(0, count_50 + 1):
    total = num_50 * 50
    if total == target:
        count += 1
        continue
    for num_100 in range(0, count_100 + 1):
        total_2 = num_50 * 50 + num_100 * 100
        if total_2 == target:
            count += 1
            continue
        for num_500 in range(0, count_500+1):
            total_3 = num_50 * 50 + num_100 * 100 + num_500 * 500
            if total_3 == target:
                count += 1
                continue
print(count)
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
c = 0
max_dif = 0
for i in range(n):
    for j in range(i, n):
        if a[j] - a[i] > max_dif:
            c = 1
            max_dif = a[j] - a[i]
        elif: a[j] - a[i] == max_dif:
            c += 1
print(c)


### FIXED CODE ###

n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
min_a = 1000000000
max_dif = 0
max_dif_c = 0
for i in range(n):
    if a[i] < min_a:
        min_a = a[i]
    elif a[i] - min_a > max_dif:
        max_dif = a[i] - min_a
        max_dif_c = 1
    elif a[i] - min_a == max_dif:
        max_dif_c += 1
print(str(max_dif_c))
n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x2, y2, h2 = map(int, input().split())
    x[i] = x2
    y[i] = y2
    h[i] = h2
ans = [0,0,0]
for i in range(101):
    for j in range(101):
        l = 0
        while h[l] == 0:
            l += 1
        #print(l)
        val = h[l] + abs(i-x[l]) + abs(j-y[l])
        flg = True
        for k in range(n):
            if val != h[k] + abs(i-x[k]) + abs(j-y[k]) and h[k] != 0:
                flg = False
            if h[k] == 0 and val != abs(i-x[k]) + abs(j-y[i]) and val - abs(i-x[k]) - abs(j-y[k]) == 0:
                flg == False
        if flg == True:
            ans = [i,j,val]
print(' '.join(map(str,ans)))


### FIXED CODE ###

n = int(input())
x = [0] * n
y = [0] * n
h = [0] * n
for i in range(n):
    x2, y2, h2 = map(int, input().split())
    x[i] = x2
    y[i] = y2
    h[i] = h2
ans = [0,0,0]
for i in range(101):
    for j in range(101):
        l = 0
        while h[l] == 0:
            l += 1
        #print(l)
        val = h[l] + abs(i-x[l]) + abs(j-y[l])
        flg = True
        for k in range(n):
            if val != h[k] + abs(i-x[k]) + abs(j-y[k]) and h[k] != 0:
                flg = False
            if h[k] == 0 and abs(i-x[k]) + abs(j-y[k]) < val:
                flg = False
        if flg == True:
            ans = [i,j,val]
print(' '.join(map(str,ans)))
H,A=map(int,input().split())
if H%A==0:
    print(H//A)
else:
    print((H/A,0)+1)

### FIXED CODE ###

H,A=map(int,input().split())
if H%A==0:
    print(H//A)
else:
    print((H//A)+1)
l=list(map,(int,input().split()))
l=sorted(l)

ans=l[0]+l[1]+10*l[2]

print(ans)

### FIXED CODE ###

l=list(map(int,input().split()))
l=sorted(l)

ans=l[0]+l[1]+10*l[2]

print(ans)
a,b=map(int,input().split())
if a<b:
	print(a < b)
elif a>b:
	print(a > b)
else a==b:
	print(a == b)


### FIXED CODE ###

a,b=map(int,input().split())
if a<b:
	print("a < b")
elif a>b:
	print("a > b")
else:
	print("a == b")
x=int(input())

print(x//3600,x/60%60,x/60.sep=" ")


### FIXED CODE ###

x=int(input())


print(x//3600,x//60%60,x%60,sep=':')
from sys import stdin

s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
sa = ''.join(sorted(s))
ts = ''.join(sorted(t,reverse=True))
ans = 'No'
for i in range(len(s)):
  if ord(sa[i]) < ord(ts[i]):
   ans = 'Yes'
   break
  elif sa[i] == ts[i]:
    if len(s) == i+1:
      if len(t) > len(s):
       ans = 'Yes'
      
  else:
   continue

print(ans)

### FIXED CODE ###

from sys import stdin
 
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
s = sorted(s)
t = sorted(t,reverse =True)
tmp1 =("".join(s))
tmp2 =("".join(t))
if tmp1 < tmp2 :print('Yes')
else:print('No')
#dp[i][j]:S[i-x:i]==S[j-x:j]となる最大のx
import numpy as np

def solve(NS):
    N = NS[0]
    S = NS[1:]
    dp=np.zeros((N+1,N+1),dtype=int)
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1) if S[i] == S[j] else 0
    return dp.max()

def main():
    NS = np.array([int(input())] + [ord(_) for _ in input()])
    print(solve(NS))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
num = map(int, raw_input().split())

print num[1] * num[2]

### FIXED CODE ###

num = map(int, raw_input().split())

print num[0] * num[1], 2*num[0] + 2*num[1]
a, b, c = map(int, input())

if c >= a:
  c -= a
  b -= c
  print(0, b)
else:
  print(a-c, b)

### FIXED CODE ###

a, b, c = map(int, input().split(' '))
 
if c >= a:
  c -= a
  b = max(0, b-c)
  print(0, b)
else:
  print(a-c, b)
n, a, b = map(int, input.split())

print(min(n*a, b))

### FIXED CODE ###

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

print(min(n*a, b))
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
    
N,M = map(int,Input().split())
s = input()
t = input()
g = gcd(N,M)
l = N*M//g

n = N//g
m = M//g

ans = l

for i in range(g):
    if s[i*n]!=t[i*m]:
        ans = -1
        break
print(ans)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
    
N,M = map(int,input().split())
s = input()
t = input()
g = gcd(N,M)
l = N*M//g

n = N//g
m = M//g

ans = l

for i in range(g):
    if s[i*n]!=t[i*m]:
        ans = -1
        break
print(ans)