Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
from collections import deque

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]
ans = 0
for i, j in p:
    ans += distance[j][i]
    d = deque((j ,i ,distance[j][i]))
    check[j][i] = 0
    while len(d):
        x, y, dis = d.popleft()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

            if 0 <= nx < n and 0 <= ny < n:
                # 更新できるマスは更新
                if distance[nx][ny] > dis:
                    distance[nx][ny] = dis
                    d.append((nx, ny, dis + check[nx][ny]))

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]

def move(x,y,nx,ny):
    if distance[nx][ny] > distance[x][y] + check[x][y]:
        distance[nx][ny] = distance[x][y] + check[x][y]
        d.append((nx,ny))

ans = 0
for i, j in p:
    ans += distance[j][i]
    d=[]
    d.append((j,i))
    check[j][i] = 0
    while len(d):
        x, y = d.pop()
        if x!=0:
            move(x,y,x-1,y)
        if x!=n-1:
            move(x,y,x+1,y)
        if y!=0:
            move(x,y,x,y-1)
        if y!=n-1:
            move(x,y,x,y+1)

print(ans)
import math

a, b, c, d = map(int, input().split())
def func(x, i, j):
    lcm = (i * j) // math.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
print(func(b, c, d) - func(a-1, c, d))

### FIXED CODE ###

import fractions
def answer(x, i, j):
    lcm = (i * j) // fractions.gcd(i, j)
    xi = x // i
    xj = x // j
    xlcm = x // lcm
    return x - xi - xj + xlcm
a, b, c, d = map(int, input().split())
ans = answer(b, c, d) - answer(a-1, c, d)
print(ans)
s=''
for i in range(3):
  s=s+input()[i]
 print(s)

### FIXED CODE ###

s=''
for i in range(3):
  temp=input()
  s=s+temp[i]
print(s)
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

S = input()
T = input()

start = -1
for i in range(len(S)-len(T),-1,-1):
    flg = 1
    for j in range(len(T)):
        if S[i+j] != '?' and S[i+j] != T[j]:
            flg = 0
            break
    if flg:
        start = i
        break

if flg == -1:
    ans = 'UNRESTORABLE'
else:
    S = S.replace('?', 'a')
    ans = S[:start] + T + S[start+len(T)+1:]

print(ans)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

S = input()
T = input()
 
for i in reversed(range(len(S)-len(T)+1)):
    flag = 1
    for j in range(len(T)) :
        if S[i+j] != T[j] and S[i+j] != "?":
            flag = 0
    if flag:
        ans = S[:i] + T + S[i+len(T):]
        print(ans.replace("?", "a"))
        exit()
 
print("UNRESTORABLE")
import math
from functools import reduce

n = int(input())
arr = list(map(int, input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(arr))

### FIXED CODE ###

from functools import reduce
n = int(input())
arr = list(map(int, input().split()))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd_list(numbers):
    return reduce(gcd, numbers)

ans = gcd_list(arr)
print(ans)
import math

x1,y1,x2,y2 = input().split()

print(math.sqrt((x2-x1)^2 + (y2-y1)^2))

### FIXED CODE ###

import math

x1,y1,x2,y2 = map(float,input().split())

print(math.sqrt((x2-x1)**2 + (y2-y1)**2))
from operator import itemgetter

if __name__ == '__main__':
    n = int(input())
    input_list = [input() for i in range(n)]
    restaurant_list = []
    for index, _input in enumerate(input_list):
        _restaurant_data = {'id': index + 1, 'region': _input.split()[0], 'point': int(_input.split()[1])}
        restaurant_list.append(_restaurant_data)

    restaurant_list.sort(key=itemgetter('point'), reverse=True)
    restaurant_list.sort(key=itemgetter('region'))
    for restaurant in restaurant_list:
        print(restaurant['id'])


### FIXED CODE ###

if __name__ == '__main__':
    _input = input().split()

    pie = int((int(_input[0]) * 3 + int(_input[1]))/2)
    print(pie)
N,M =map(int,input().split())
a = list(map(int, input().split())) 
a.sort(reverse = True)

m = 4*M
c = 0 
for i  in range(0,M):
  if a[i] >=m:
    c +=1
   
  
  
if c = M:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
a.sort(reverse = True)
k = s/(4*m)
if a[m-1] < k:
  print("No")
else:
  print("Yes")
print((int(input())+int(input()))//2)


### FIXED CODE ###

a,b = map(int,input().split())
print(-(-(a+b)//2))
a = input()
b = 'Sunny'
c = 'Cloudy'
d = 'Rainy'
if a = b:
 print(c)
elif a = c:
 print(d)
elif a = d:
 print(b)


### FIXED CODE ###

a = input()
b = 'Sunny'
c = 'Cloudy'
d = 'Rainy'
if a == b:
 print(c)
if a == c:
 print(d)
if a == d:
 print(b)
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))


### FIXED CODE ###

r = int(input())
d = 3*(r**2)
print(d)
a=int(input())
s=int(input())
if a<3200:
  print("red")
else:
  print(s)

### FIXED CODE ###

a=int(input())
s=input()
if a<3200:
  print("red")
else:
  print(s)
def f(n, x):
	if n==0:
		return 0 if x<= 0 else 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])


n,x=map(int, input().split())
a,p=[1],[1]
for i in range(N):
	a.append(a[i] * 2 + 3)
	p.append(p[i] * 2 + 1)
    
print(f(n, x))

### FIXED CODE ###

def f(n, x):
	if n==0:
		return 0 if x<= 0 else 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])


n,x=map(int, input().split())
a,p=[1],[1]
for i in range(n):
	a.append(a[i] * 2 + 3)
	p.append(p[i] * 2 + 1)
    
print(f(n, x))
S = input()
T = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

setS = []
for i in range(len(S)):
  if S[i] not in setS:
    S = S.replace(S[i],al[i])
    setS.append(S[i])

setT = []
for i in range(len(T)):
  if T[i] not in setT:
    T = T.replace(T[i],al[i])
    setT.append(T[i])

if S == T:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S = input()
T = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

setS = []
cnt = 0
for i in range(len(S)):
  if S[i] not in setS:
    S = S.replace(S[i],al[cnt])
    cnt += 1
    setS.append(S[i])

setT = []
cnt = 0
for i in range(len(T)):
  if T[i] not in setT:
    T = T.replace(T[i],al[cnt])
    cnt += 1
    setT.append(T[i])

if S == T:
  print('Yes')
else:
  print('No')
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
fib = [None] * N
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if not i + 1 in a:
        fib[i] = fib[i-1] + fib[i-2]
    else:
        fib[i] = 0
# print(fib)
print(fib[N-1] % 1000000007)

### FIXED CODE ###

from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
if N == 1:
    print(1)
    exit()
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)
def g_longest_path(N, M, Edges):
    """
    N頂点M辺の有向グラフGが与えられる。Gは有向閉路を含まない。
    Gの有向パスのうち、最長のものについてその長さを求めよ。
    有向パスの長さとは、有向パスに含まれる辺の本数のことをいう。
    """
    # 隣接リストでグラフを持つ(0-based)
    graph = [[] for _ in range(N)]
    for x, y in Edges:
        graph[x - 1].append(y - 1)

    # メモ化再帰
    # ある頂点vから辿っていけるパスの長さは、vに着くまでにどのようにパスを
    # 辿ってきたかと無関係(有向閉路がないため)なので、この方法が使える
    def memorized_recursive(v):
        if dp[v] != -1:
            return dp[v]  # 頂点vはすでに更新済み

        ret = 0
        # 頂点vから1つ辺を通って行ける頂点の集合に対して同じ計算を行う
        for nv in graph[v]:
            ret = max(ret, memorized_recursive(nv) + 1)
        dp[v] = ret  # メモに追加
        return ret

    ans = 0
    dp = [-1] * N  # dp[v]: ノードvを始点としたときの、Gの有効パスの長さの最大値
    # 各頂点に対して調べる
    for v in range(N):
        ans = max(ans, memorized_recursive(v))
    return ans

N, M = [int(i) for i in input().split()]
Edges = [[int(i) for i in input().split()] for j in range(M)]
print(g_longest_path(N, M, Edges))

### FIXED CODE ###

def g_longest_path(N, M, Edges):
    """
    N頂点M辺の有向グラフGが与えられる。Gは有向閉路を含まない。
    Gの有向パスのうち、最長のものについてその長さを求めよ。
    有向パスの長さとは、有向パスに含まれる辺の本数のことをいう。
    """
    import sys
    sys.setrecursionlimit(10**6)

    # 隣接リストでグラフを持つ(0-based)
    graph = [[] for _ in range(N)]
    for x, y in Edges:
        graph[x - 1].append(y - 1)

    # メモ化再帰
    # ある頂点vから辿っていけるパスの長さは、vに着くまでにどのようにパスを
    # 辿ってきたかと無関係(有向閉路がないため)なので、この方法が使える
    def memorized_recursive(v):
        if dp[v] != -1:
            return dp[v]  # 頂点vはすでに更新済み

        ret = 0
        # 頂点vから1つ辺を通って行ける頂点の集合に対して同じ計算を行う
        for nv in graph[v]:
            ret = max(ret, memorized_recursive(nv) + 1)
        dp[v] = ret  # メモに追加
        return ret

    ans = 0
    dp = [-1] * N  # dp[v]: ノードvを始点としたときの、Gの有効パスの長さの最大値
    # 各頂点に対して調べる
    for v in range(N):
        ans = max(ans, memorized_recursive(v))
    return ans

N, M = [int(i) for i in input().split()]
Edges = [[int(i) for i in input().split()] for j in range(M)]
print(g_longest_path(N, M, Edges))
N=int(input())
K=int(input())
ans = 0
for i in range(K,N+1):
    ans += (N*i - i**2 + i +1)%(10**9 +7)
print(ans%(10**9 +7))


### FIXED CODE ###

N,K = map(int, input().split())
ans = 0
for i in range(K,N+1):
    ans += (N*i - i**2 + i +1)%(10**9 +7)
print(ans%(10**9 +7) +1)
def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()



    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        pass
    else:
        print('not coprime')
        return

    for i in A:
        tmp=[]
        for j in sosus:
            if j>i:
                break
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    print('setwise coprime')

resolve()


### FIXED CODE ###


import math
#素数列挙
def get_primes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        A = [i for i in A if i%prime!=0]

    P.extend(A)
          
    return P


def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()



    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        pass
    else:
        print('not coprime')
        return

    for i in A:
        tmp=[]
        for j in sosus:
            if j>i:
                break
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
            if i in sosus:
                
                tmp.append(i)
                i = 1
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    print('setwise coprime')

resolve()
s=input()
k=int(input())

if k==1:
    print(int(s[0]))

elif int(s[0])==1:
    if s[:k]=="1"*k:
        print(1)
    else:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

elif int(s[0])!=1:
    print(int(s[0]))

### FIXED CODE ###

s=input()
k=int(input())

if k==1:
    print(int(s[0]))

elif int(s[0])==1:

    if len(s)<k:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

    else:
        if s[:k]=="1"*k:
            print(1)
        else:
            num=1
            for i in range(1, len(s)):
                if int(s[i])!=1:
                    num=int(s[i])
                    break
            print(num)

elif int(s[0])!=1:
    print(int(s[0]))
N,K=map(int,input().split())
H=list(map(int,input().split()))
HP=sorted(H)
for i in range(K):
  del HP[0]
print(sum(HP))

### FIXED CODE ###

N,K=map(int,input().split())
H=list(map(int,input().split()))
if N==K:
  print(0)
else:
  HP=sorted(H,reverse=True)
  del HP[:K]
  print(sum(HP))
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = collections.Counter(list(map(int, input().rstrip('\n').split()))).most_common()
    b = collections.Counter(list(map(int, input().rstrip('\n').split()))).most_common()
    aa = []
    bb = []
    for i in range(n):
        if a[i][1] % 2 != 0:
            aa.append(a[i][0])
        if b[i][1] % 2 != 0:
            bb.append(b[i][0])
    t = 0
    for av in aa:
        for bv in bb:
            t = t ^ (av + bv)
    print(t)


if __name__ == '__main__':
    slove()


### FIXED CODE ###

import sys
import bisect

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


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


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


if __name__ == '__main__':
    solve()
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt

def main():
    n, a, b = map(int, input().split())
    ans_max = min(a, b)
    ans_min = max(a + b - n, 0)
    print(ans_max, ans_min)

    



if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np


def main():
    n, a, b = map(int, input().split())
    ans_max = min(a, b)
    ans_min = max(a + b - n, 0)
    print(ans_max, ans_min)

    



if __name__ == '__main__':
    main()
a, b = int(input())
if a*b % 2 == 1:
    print('Odd')
else:
    print('Even')

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")
n = int(input())
a = list(map(int, input().split()))
ans = [0 for in range(n)]
for i in range(n):
       ans[a[i]-1] = i+1
for j in range(len(ans):
       print(ans[i] , end = " ")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
       ans[a[i]-1] = i+1
for j in range(len(ans)):
       print(ans[j] , end = " ")
#encoding:utf-8

import numpy as np
# import sys
# sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
S = []
for i in range(H):
    s = list(input())
    S.append(s)

S_ = np.array(S)

def count_answer(x,y,num_b,num_w):
    # print(used)
    # global num_b,num_w
    if S_[x][y] == "#":
        num_b += 1
    else:
        num_w += 1
    used[x][y] = 1
    dx = [0,0,1,-1]
    dy = [1,-1,0,0]
    # print("x,y:",x,y)
    for i in range(4):
        next_x = x + dx[i]
        next_y = y + dy[i]
        # print(next_x,next_y)
        if next_x == -1 or next_y == -1 or next_x >= H or next_y >= W or used[next_x,next_y] == 1:
            continue
        if S_[next_x][next_y] != S_[x][y]:
            num_b,num_w = count_answer(next_x,next_y,num_b,num_w)
    return num_b,num_w

answer = 0
used = np.zeros((H,W))
for i in range(H):
    for j in range(W):
        if used[i][j] == 1:
            continue
        num_b = 0
        num_w = 0
        num_b,num_w  = count_answer(i,j,num_b,num_w)
        answer += num_b*num_w
print(answer)


### FIXED CODE ###

#encoding:utf-8

import numpy as np
import sys
sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
S = []
for i in range(H):
    s = list(input())
    S.append(s)


def count_answer(x,y,num_b,num_w):
    # print(used)

    if S[x][y] == "#":
        num_b += 1
    else:
        num_w += 1
    used[x][y] = 1
    dx = [0,0,1,-1]
    dy = [1,-1,0,0]
    # print("x,y:",x,y)
    for i in range(4):
        next_x = x + dx[i]
        next_y = y + dy[i]
        # print(next_x,next_y)
        if next_x == -1 or next_y == -1 or next_x >= H or next_y >= W:
            pass
        elif used[next_x,next_y] == 1:
            pass
        elif S[next_x][next_y] != S[x][y]:
            num_b,num_w = count_answer(next_x,next_y,num_b,num_w)
    return num_b,num_w

answer = 0
used = np.zeros((H,W))
for i in range(H):
    for j in range(W):
        if used[i][j] == 1:
            continue
        num_b = 0
        num_w = 0
        if S[i][j] == "#":
            num_b,num_w  = count_answer(i,j,num_b,num_w)
            answer += num_b*num_w
print(answer)
n,*a=map(int,open(0).read().split())
d=[j-i for i,j in zip(a,a[1:]+[a[0]])]
M=max(d)
dd=[M-x for x in d]
if n==1 or (all(x%n==0 for x in dd) and sum(x//n for x in dd)==M and sum(a)//M==n*(n+1)//2):
	print("YES")
else:
	print("NO")

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
d=[j-i for i,j in zip(a,a[1:]+[a[0]])]
M=max(d)
dd=[M-x for x in d]
if n==1:
	print("YES")
elif (n==2 and sum(a)%3) or any(x%n for x in dd) or sum(x//n for x in dd)!=M or sum(a)//M!=n*(n+1)//2:
	print("NO")
else:
	print("YES")
str1 = input()
str2 = 'R'
str3 = 'RR'
str4 = 'RRR'
ans = 0
if str4 in str1
ans = 3
elif str3 in str1
ans = 2
elif str3 in str1
ans = 2
else
ans=0

print(ans)

### FIXED CODE ###

a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:
  print(0)
import sys
from heapq import *
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, 1, x))
        key.append((r, -1, x))

    key.sort()
    judge = []
    now = set()
    already = dict()
    
    index = 0
    ans = -1
    for i in range(q):
        d = int(input())
        for i in range(index, 2*n):
            s, j, x = key[i]
            if s > d:
                index = i
                break
            if j == 1:
                heappush(judge, x)
                now.add(x)
            else:
                now.remove(x)
                if x in already:
                    already[x] += 1
                else:
                    already[x] = 1
                    
                    
        while judge:
            if judge[0] in already and already[judge[0]] > 0:
                already[judge[0]] -= 1
                heappop(judge)
            else:
                break
        if judge:
            ans = judge[0]
        else:
            ans = -1      
            
        print(ans)

    
if __name__ == "__main__":
    main()





### FIXED CODE ###

import sys
from heapq import *
input = sys.stdin.readline

def main():
    n, q = map(int, input().split())
    
    key = []
    for i in range(n):
        s, t, x = map(int, input().split())
        l, r = max(0, s-x), max(0, t-x)
        key.append((l, 1, x))
        key.append((r, -1, x))
    
    for i in range(q):
        d = int(input())
        key.append((d, 2))

    key.sort()
    judge = []
    already = dict()
    
    for i in range(2*n+q):
        k = key[i]
        if k[1] == -1:
            if k[2] in already:
                already[k[2]] += 1
            else:
                already[k[2]] = 1
        elif k[1] == 1:
            heappush(judge, k[2])
        else:
            while judge:
                if judge[0] in already and already[judge[0]] > 0:
                    already[judge[0]] -= 1
                    heappop(judge)
                else:
                    break
            if judge:
                print(judge[0])
            else:
                print(-1)
    

    
if __name__ == "__main__":
    main()
n = int(input())
*a0, = map(int, input().split())
m = int(input())
for _ in range(m):
    k, b = map(int, input().split())
    a = a0[:]
    a[k] = b
    print(sum(a))


### FIXED CODE ###

n = int(input())
*a0, = map(int, input().split())
m = int(input())
for _ in range(m):
    k, b = map(int, input().split())
    a = a0[:]
    a[k-1] = b
    print(sum(a))
i = input()
i = 24+i
print("{}".format(i))

### FIXED CODE ###

print("{}".format(24 - int(input()) + 24))
s=str(input())
l=[0,0]
i=0
for n in range(0,len(s)):
  if s[n]==' ':
    l[i]=n
    i+=1
  if i==2:
    break
X=int(s[0:l[0]-1])
Y=int(s[l[0]+1,l[1]-1])
Z=int(s[l[1]+1,len(s)-1])
temp1=X
X=Y
Y=temp1
temp2=X
X=Z
Z=temp2
print(X,' ',Y,' ',Z)

### FIXED CODE ###

s=str(input())
l=[0,0]
i=0
for n in range(0,len(s)):
  if s[n]==' ':
    l[i]=n
    i+=1
  if i==2:
    break
X=int(s[0:l[0]])
Y=int(s[l[0]+1:l[1]])
Z=int(s[l[1]+1:len(s)])
temp1=X
X=Y
Y=temp1
temp2=X
X=Z
Z=temp2
print(X,' ',Y,' ',Z)
A, B = map(int, input().split())
print(A+B -24*((A+B)//24) if A+B > =24 else A+B)

### FIXED CODE ###

A, B = map(int, input().split())
print(A+B -24*((A+B)//24) if A+B >=24 else A+B)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n, q = getList()

vtxs = [[] for i in range(n)]
already = [0 for i in range(n)]

for i in range(n - 1):
    a, b = getList()
    vtxs[a-1].append(b -1)
    vtxs[b-1].append(a - 1)

count = [0 for i in range(n)]
for i in range(q):
    x, v = getList()
    count[x-1] += v

ans = [0 for i in range(n)]

def rep(vx, val):
    # print(vx,val)
    tgt = vtxs[vx]
    already[vx] = 1
    for tg in tgt:
        if already[tg] == 0:
            app = count[tg]
            ans[tg] = val+app
            rep(tg, val+app)

rep(0, count[0])
# print(vtxs)
ans[0] = count[0]
print(*ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n, q = getList()

vtxs = [[] for i in range(n)]
already = [0 for i in range(n)]

for i in range(n - 1):
    a, b = getList()
    vtxs[a-1].append(b -1)
    vtxs[b-1].append(a - 1)

count = [0 for i in range(n)]
for i in range(q):
    x, v = getList()
    count[x-1] += v

ans = [0 for i in range(n)]

def rep(vx, val):
    # print(vx,val)
    tgt = vtxs[vx]
    already[vx] = 1
    for tg in tgt:
        if already[tg] == 0:
            app = count[tg]
            ans[tg] = val+app
            rep(tg, val+app)

rep(0, count[0])
# print(vtxs)
ans[0] = count[0]
print(*ans)
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if cage==None:
  print("TLE")
else:
  print(min(cage))

### FIXED CODE ###

N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
      cage.append(c)
if len(cage)==0:
  print("TLE")
else:
  print(min(cage))
# coding: utf-8
S = input().rstrip().split("")
T = input().rstrip().split("")
 
tekichu = 0
 
for i in range(3):
	if S[i] == T[i]:
		tekichu += 1
 
print(tekichu)

### FIXED CODE ###

s = list(input())
t = list(input())

cnt = 0
for i in range(3):
  if s[i] == t[i]:
    cnt += 1

print(cnt)