Harryxun/stf_run huggingface dataset:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    l = 29
    val = 0
    from bisect import bisect_left as bll, bisect_right as brr
    def bl(bb, ind):
        if ind in dl:
            return dl[inte]
        else:
            tmp = bll(bb, ind)
            dl[ind] = tmp
            return tmp
    def br(bb, ind):
        if ind in dr:
            return dr[inte]
        else:
            tmp = brr(bb, ind)
            dr[ind] = tmp
            return tmp    

    for k in range(l):
        # i桁目を求める
        tmp = pow(2, k+1)
        bb = [item%(tmp) for item in b]
        bb.sort()
        ans = 0
        dl = {}
        dr = {}
        for item in a:
            aa = item%tmp
            if aa<=tmp//2:
                ans += (br(bb, tmp-1-aa) - bl(bb, tmp//2-aa))%2
            else:
                ans += (br(bb, tmp-1-aa) + (n - bl(bb, tmp//2*3-aa)))%2
        if ans%2:
            val += pow(2, k)
    print(val)
main()

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 29
val = 0

def lcount(a,b,x):
    """ソート済a,bに対して, a[i]+b[j]<=xなるi,jの個数
    """
    la = len(a)
    lb = len(b)
    j = -1
    ans = 0
    for i in range(la-1, -1, -1):
        while j+1<lb and a[i]+b[j+1]<=x:
            j += 1
        ans += (j+1)
    return ans
for k in range(l):
    # i桁目を求める
    tmp = pow(2, k+1)
    bb = [item%(tmp) for item in b]
    aa = [item%(tmp) for item in a]
    aa.sort()
    bb.sort()
    ans = n**2 - lcount(aa,bb,tmp//2*3-1) + lcount(aa,bb,tmp-1) - lcount(aa,bb,tmp//2-1)
    if ans%2:
        val += pow(2, k)
print(val)
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 2019
X = []
if L-R >= 2019:
    x=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            #x = min(x,(i%2019)*(j%2019))
            X.append((i*j)%2019)
x = min(X)
print(x)

### FIXED CODE ###

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

print(min(N*A,B))
import sys
sys.setrecursionlimit(1000000)

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

def f(A):
    p = 0
    if min(A)==0 and max(A)==0:
        return 0
    if min(A)>0:
        minA = min(A)
        for i in range(len(A)):
            A[i] -= minA
        p += f(A) + minA
    else:
        for i in range(len(A)):
            if A[i]>0:
                A = A[i:]
                break
        for i in range(len(A)):
            if A[len(A)-1-i]>0:
                A = A[:len(A)-i]
                break
        x = [-1]
        for i in range(len(A)):
            if A[i]==0:
                x.append(i)
        x.append(len(A))
        for i in range(len(x)-1):
            p += f(A[x[i]+1:x[i+1]:])
    return p

print(f(H))

### FIXED CODE ###

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

ans = 0
st = "0"
while H!=[0]*N:
    for i in range(N):
        if H[i]>0:
            st = "+"
            H[i] -= 1
        elif st=="+" and H[i]==0:
            st = "0"
            ans += 1
    if st=="+":
        ans += 1
    st = "0"

print(ans)
from statistics import pstdev

while True:
    if input() == 0: break
    v_list = (int(x) for x in input().split())
    print(pstdev(v_list))

### FIXED CODE ###

from statistics import pstdev

while True:
    if input() == '0': break
    v_list = (int(x) for x in input().split())
    print(pstdev(v_list))
x = list(map(int, input().split()))
s = list(input())
y = len(s)
rank = 0
frank = 0

for i in  s:
    if i == "a":
        if rank <= x[1] + x[2]:
            rank += 1 
            print("Yes")
            
    else:
        print("No")
        
        
    elif i == "b":
        if rank <= x[1] + x[2]:
            rank += 1
            if frank <= x[2]:
                frank += 1
                print("Yes")
            
            else:
                print("No")
            
        else:
            print("No")
            
    else:
        print("No")

### FIXED CODE ###

li = list(map(int,input().split()))
s=list(input())
cnt = 0
b = 0
for i in s:
    if i == "a":
        if cnt < li[1] + li[2]:
            cnt += 1
            print("Yes")
        else:
            print("No")
    elif i == "b":
        b += 1
        if cnt < li[1] + li[2]:
            if b <= li[2]:
                cnt += 1
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        #cnt -= 1
        print("No")
def knapsack(nums, KLeap):
    n = len(nums)
    if n == 0 or n == 1:
        return 0

    if n < KLeap:
        return abs(nums[0] - nums[-1])
    # dp[i] is min cost when reaching stone i
    dp = [0] * n
    for i in range(1, KLeap):
        dp[i] = abs(nums[0] - nums[i])

    for i in range(K+1, n):
        dp[i] = min([dp[i - k] + abs(nums[i - k] - nums[i]) for k in range(1, KLeap)])

    return dp[-1]


if __name__ == "__main__":
    _, K = [int(x) for x in input().split()]
    nums = [int(x) for x in input().split()]
    print(knapsack(nums, K))


### FIXED CODE ###

def knapsack(nums, k):
    n = len(nums)

    # dp[i] is min cost when reaching stone i
    dp = [float('Inf')] * n
    dp[0] = 0
    for i in range(1, n):
        dp[i] = min([
            dp[i-j] + abs(nums[i] - nums[i-j])
            for j in range(1, k+1) if i - j >= 0]
        )
    return dp[-1]


if __name__ == "__main__":
    _, k = [int(x) for x in input().split()]
    nums = [int(x) for x in input().split()]
    print(knapsack(nums, k))
X,Y=map(int,input().split())
if X<Y:
  print('<')
elif X>Y:
  print('>')
else:
  print('=')

### FIXED CODE ###

X,Y=map(str,input().split())
if X<Y:
  print('<')
elif X>Y:
  print('>')
else:
  print('=')
N = int(input())
W = [input() for i in range(N)]

word_stock = []

for word in word_list:
    #同じワード確認
    if word in word_stock:
        print('No')
    #最後の文字確認
    try:
        if word_stock[-1][-1] != word[0]:
            print('No')
    except:
        pass
    word_stock.append(word)

print('Yes')

### FIXED CODE ###

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

stock = []
last = W[0][0]

for i in range(0,len(W)):
    #過去の発言に含まれない
    if W[i] in stock:
        print('No')
        break
    #前の単語の最後と次の単語の最初が一致する
    if W[i][0] != last:
        print('No')
        break
    stock.append(W[i])
    last = W[i][-1]
    #最後まで回り切ったらyesを表示
    if i+1 == len(W):
        print('Yes')
N = int(input())
sum = 0
for i in range[1,N+1]:
  if len(str(i)) % 2 == 1:
    sum += 1
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0
for i in range(1,N+1):
  if len(str(i)) % 2 == 1:
    sum += 1
print(sum)
from sys import stdin

d_num = int(stdin.readline().strip())

graph = [[] for _ in range(d_num+1)]
for _ in range(d_num):
    u, k, *neighbors = map(int, stdin.readline().split())
    for v in neighbors:
        graph[u].append(v)

visited = set()
timestamps = [None for _ in range(d_num+1)]

def dfs(u, stmp):
    visited.add(u)
    entry = stmp

    stmp += 1
    for v in graph[u]:
        if v not in visited:
            stmp = dfs(v, stmp)

    timestamps[u] = entry, stmp
    return stmp+1

dfs(1, 1)

for num, (entry, leave) in enumerate(timestamps[1:], 1):
    print(num, entry, leave)

### FIXED CODE ###

from sys import stdin

d_num = int(stdin.readline().strip())

graph = [[] for _ in range(d_num+1)]
for _ in range(d_num):
    u, k, *neighbors = map(int, stdin.readline().split())
    for v in neighbors:
        graph[u].append(v)

visited = set()
timestamps = [None for _ in range(d_num+1)]

def dfs(u, stmp):
    visited.add(u)
    entry = stmp

    stmp += 1
    for v in graph[u]:
        if v not in visited:
            stmp = dfs(v, stmp)

    timestamps[u] = entry, stmp
    return stmp+1

stmp = 1
for v in range(1, d_num+1):
    if v not in visited: stmp = dfs(v, stmp)

for num, (entry, leave) in enumerate(timestamps[1:], 1):
    print(num, entry, leave)
import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = []
for i in range(0,n-1):
    if(a[i]==a[i+1]):
        ans.append(a[i])
if (ans[0]==ans[1] and ans[1]!=ans[2]):
    print(ans[0]*ans[2])
    sys.exit()
if len(ans) <2:
    print(0)
    sys.exit()
print(ans[0]*ans[1])

### FIXED CODE ###

import sys
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = []
for i in range(0,n-1):
    if(a[i]==a[i+1]):
        ans.append(a[i])
if len(ans) <2:
    print(0)
    sys.exit()
        
if (ans[0]==ans[1] and ans[1]!=ans[2]):
    print(ans[0]*ans[2])
    sys.exit()

print(ans[0]*ans[1])
a,b,c,d = map(int,input().split())
e = abs(a - c)
f = abs(a - b)
g = abs(b - c)
if e <= d:
  print("Yes")
elif f <= d and g <= d
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a,b,c,d = map(int,input().split())
e = abs(a - c)
f = abs(a - b)
g = abs(b - c)
if e <= d:
  print("Yes")
elif f <= d and g <= d:
  print("Yes")
else:
  print("No")
k = int(input())
n = input()

if len(n)<=k:
  print(n)
  else:
    print(n[:k] + '...')
  
  

### FIXED CODE ###

k = int(input())
n = input()
 
if len(n)<=k:
  print(n)
else:
  print(n[:k] + '...')
a, b= map(int, input().split())

print a*b, a*2 + b*2


### FIXED CODE ###

a, b = map(int, input().split())
c=a*b
d=a*2+b*2
print(c, d)
LIM=200002
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200002
for i in range(1,200002):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
d=bin_sum2(Y)+1
c=bin_sum2(Y)-1
e=int(Y,2)%d
f=int(Y,2)%c
for i in range(X):
    if Y[i]=="0":
        b=d
        g=(e+2**(X-1-i))%d
    else:
        b=c
        g=(f-2**(X-1-i)%c+c)%c
        if g<0:
            g+=c
    if d==1:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)

### FIXED CODE ###

from collections import deque
LIM=200004
L=[0]*LIM

def bin_sum(Y):
    S=bin(Y)[2:]
    count=0
    for i in range(len(S)):
        count+=int(S[i])
    return count

def bin_sum2(Y):
    count=0
    for i in range(len(Y)):
        count+=int(Y[i])
    return count

for i in range(1,LIM):
    L[i]+=bin_sum(i)

def pop_num(N,b,L):
    if N==0:
        return 0
    v=N%b
    return pop_num(v,L[v],L)+1
    
M=[0]*200005
for i in range(1,200004):
    M[i]+=pop_num(i,L[i],L)
X=int(input())
Y=input()
d=bin_sum2(Y)
e=int(Y,2)%(d+1)
f=int(Y,2)%max(1,(d-1))
O=[1]*(X+2)
P=[1]*(X+2)
q=max(d-1,1)
for i in range(1,X+1):
    O[i]=O[i-1]*2%q
    P[i]=P[i-1]*2%(d+1)
for i in range(X):
    
    if int(Y[i])==1:
        b=max(d-1,1)
        flag=max(0,d-1)
        g=(f-O[X-1-i]+b)%b
    else:
        b=d+1
        flag=1
        g=(e+P[X-1-i])%b

    if flag==0:
        print(0)
    elif g==0:
        print(1)
    else:
        print(M[g]+1)
N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in range(N):
  if Flag[List[i]] ==1:
    res +=1
    for j in range(List[i],K,List[i]):
      Flag[j] = 0
    if List[i] == List[i+1]:
      res += -1
print(res)

### FIXED CODE ###

N = int(input())
List = list(map(int, input().split()))
res = 0
List.sort()
K = List[N-1]+1
Flag = [1]*K
for i in range(N):
  if Flag[List[i]] ==1:
    res +=1
    for j in range(List[i],K,List[i]):
      Flag[j] = 0
    if i != N-1 and List[i] == List[i+1]:
      res += -1
print(res)
n,q=map(int,input().split())

tree = [[] for _ in range(n)]
ret=[0]*n

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

#print(tree)

def counter(target,num):
    global ret
    ret[target]+=num
    if not tree[target]:
        return
    for i in tree[target]:
        counter(i,num)
for _ in range(q):
    p,x=map(int,input().split())
    counter(p-1,x)

print(*ret)

### FIXED CODE ###

n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(1,n):
    al[k] += al[rl[k]]
print(*al)
#Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成（初期値は0）
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

#print(dp)

#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
    v,w = map(int,input().split())
    value.append(v)
    weight.append(w)

#print(values)
#print(weights)

#アイテムは１個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
    for j in range(W+1):
        if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
            dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N+1][W+1])


### FIXED CODE ###

#Nはアイテム数、Wはナップサックサイズ
N,W = map(int,input().split())
#dpテーブルを作成（初期値は0）
dp = [[0 for i in range(W + 1)] for j in range(N + 1)]

#print(dp)

#N個のアイテムのvalueとweightを入れるリストを用意する
value = []
weight = []
for i in range(N):
    v,w = map(int,input().split())
    value.append(v)
    weight.append(w)

#print(values)
#print(weights)

#アイテムは１個目からN個まで、重さのレンジは0からWまで
for i in range(1,N+1):
    for j in range(W+1):
        if j >= weight[i-1]: #iは1から始めているので、weightやvalueのリストを参照するときは添字を1つ下げる
            dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weight[i-1]])
        else:
            dp[i][j] = dp[i-1][j]
print(dp[N][W])
import sys
import collections

n = int(input())
a = [int(i) for i in input().split()]

nega = sorted([i for i in a if i < 0])
posi = sorted([i for i in a if i > 0])
#print(nega,posi)

if len(posi) > 0:
    top = posi.pop(-1)
else:
    top = nega.pop(-1)
if len(nega) == 0:
    nega.append(posi.pop(0))

process = []

for _ in range(len(posi)):
    x = nega.pop(0)
    y = posi.pop(0)
    nega.append(x - y)
    process.append([x, y])
x = top
y = nega.pop(0)
process.append([x, y])
x -= y
for _ in range(len(nega)):
    y = nega.pop(0)
    process.append([x, y])
    x -= y
ans = x

print(ans)
for i in range(len(process)):
    print('{} {}'.format(process[i][0], process[i][1]))


### FIXED CODE ###

import sys
import collections

n = int(input())
a = sorted([int(i) for i in input().split()])
# print(a)
top = a.pop(-1)

nega = sorted([i for i in a if i < 0])
posi = sorted([i for i in a if i >= 0])
#print(nega,posi)

if len(nega) == 0:
    nega.append(posi.pop(0))

process = []

for _ in range(len(posi)):
    x = nega.pop(0)
    y = posi.pop(0)
    nega.append(x - y)
    process.append([x, y])
x = top
y = nega.pop(0)
process.append([x, y])
x -= y
for _ in range(len(nega)):
    y = nega.pop(0)
    process.append([x, y])
    x -= y
ans = x

print(ans)
for i in range(len(process)):
    print('{} {}'.format(process[i][0], process[i][1]))
N, M = map(int, input().split())
valuesDict = {}
for i in range(N):
  A, B = map(int, input().split())
  valuesDict[i+A] += B

print(valuesDict[M])

### FIXED CODE ###

import heapq
N, M = map(int,input().split())
reward = [[] for _ in range(M)]
for i in range(N):
  A,B = map(int,input().split())
  if A <= M:
    reward[A-1].append(B)
q = []
ans = 0
for day in range(M):
  for r in reward[day]:
    heapq.heappush(q,-r)
  if len(q) >0:
    ans += -heapq.heappop(q)
print(ans)
d, t, s = map(int, input().split())
x = d // s
if x < t:
    print('Yes')
elif x == y:
  print('Yes')
else:
    print('No')

### FIXED CODE ###

d, t, s = map(int, input().split())
if d/s <= t:
  print('Yes')
else:
  print('No')
a,b,c=map(int,input(),split())
d=0
 
for n in range(1,b+1):
    if n*a%b==c:
        d=d+1
    else:
        d=d:
if d>0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
d=0
 
for n in range(1,b+1):
    if n*a%b==c:
        d=d+1
    else:
        d=d
if d>0:
    print("YES")
else:
    print("NO")
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P,X  = [],[]
for i in range(M):
	p,x = map(int,input().split())
	P.append(p - 1)
	X.append(x)
sumA = sum(T)
for lack in range(M):
	print(T + X[i] + T[P[i]] )

### FIXED CODE ###

n = int(input())
t = list(map(int,input().split()))
sumt = sum(t)
m = int(input())
l = []
for i in range(m):
    p, x = map(int,input().split())
    a = sum(t)+x-t[p-1]
    l.append(a)
for o in l:
    print(o)
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
m1,m2 = y[n//2-1],y[n//2]
for i in x:
    if i<=m1: print(m2)
    else: print(m1)

### FIXED CODE ###

a = list(map(int,input().split()))
a.sort()
if (a[2]-a[1])%2==0 and (a[2]-a[0])%2==0:
    print((a[2]-a[1])//2+(a[2]-a[0])//2)
elif (a[2]-a[1])%2==1 and (a[2]-a[0])%2==1:
    print((a[2]-a[1])//2+(a[2]-a[0])//2+1)
else:
    print((a[2]-a[1])//2+(a[2]-a[0])//2+2)
import sys
input = sys.stdin.readline
N = int(input())
a = [0]
reva = [[] for _ in range(N + 1)]
for _ in range(N - 1): a.append(int(input()))
for i in range(N):
  if a[i] == 0: continue
  reva[a[i]].append(i + 1)

dp = [-1] * (N + 1)
def dfs(x):
  global dp
  if len(reva[x]) == 0:
    dp[x] = 1
    return 1
  t = []
  for i in range(len(reva[x])):
    y = reva[x][i]
    t.append(dfs(y))
  t.sort(reverse = True)
  for i in range(len(t)):
    t[i] += i + 1
  dp[x] = max(t)
  return dp[x]

print(dfs(1) - 1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(input())
a = [0]
reva = [[] for _ in range(N + 1)]
for _ in range(N - 1): a.append(int(input()))
for i in range(N):
  if a[i] == 0: continue
  reva[a[i]].append(i + 1)
dp = [-1] * (N + 1)
def dfs(x):
  global dp
  if len(reva[x]) == 0:
    dp[x] = 1
    return 1
  t = []
  for y in reva[x]:
    t.append(dfs(y))
  t.sort(reverse = True)
  for i in range(len(t)):
    t[i] += i + 1
  dp[x] = max(t)
  return dp[x]
print(dfs(1) - 1)
N = int(input())
aaa = 0
box = []
for i in range(0, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1
        print("yes")
if aaa ==0:
    print("no")

### FIXED CODE ###

N = int(input())
aaa = 0 
box = []
for i in range(1, 10):
    if N % i == 0:
        box.append(int(N/i))
for k in box:
    if k>=1 and k<=9:
        aaa = 1 
        break
    else:
        aaa = 0 
if aaa == 1:
    print("Yes")
else:
    print("No")
a,b = map(int,input()split())
c =  a*b
if c%2 ==0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b = map(int,input().split())
c =  a*b
if c%2 ==0:
  print('Even')
else:
  print('Odd')
import sys


sys.setrecursionlimit(100000)


MAX_N = 100001

memo = [-1] * MAX_N


def f(n):
    # 残り金額が0なら引き出す必要がないので0(再帰の終端条件)
    if n == 0:
        return 0
    # すでに探索済みならメモを参照する
    if memo[n] != -1:
        return memo[n]

    res = sys.maxsize

    pow9 = 1
    while pow9 <= N:
        if n - pow9 < 0:
            break
        # print(n)
        # print(pow9)
        res = min(res, f(n-pow9)+1)
        pow9 *= 9

    pow6 = 1
    while pow6 <= N:
        if n - pow6 < 0:
            break
        res = min(res, f(n-pow6)+1)
        pow6 *= 6

    # メモ
    memo[n] = res

    return res


if __name__ == '__main__':
    N = int(input())

    print(f(N))



### FIXED CODE ###

import sys


sys.setrecursionlimit(1000000)


MAX_N = 100001

memo = [-1] * MAX_N


def f(n):
    # 残り金額が0なら引き出す必要がないので0(再帰の終端条件)
    if n == 0:
        return 0
    # すでに探索済みならメモを参照する
    if memo[n] != -1:
        return memo[n]

    res = sys.maxsize

    pow9 = 1
    while pow9 <= N:
        if n - pow9 < 0:
            break
        res = min(res, f(n-pow9)+1)
        pow9 *= 9


    pow6 = 1
    while pow6 <= N:
        if n - pow6 < 0:
            break
        res = min(res, f(n-pow6)+1)
        pow6 *= 6

    # メモ
    memo[n] = res

    return res


if __name__ == '__main__':
    N = int(input())

    print(f(N))
word=list(map.string().split())
check=True
for i in range(len(word)//2)
    if word[i]==word[len(word)-1]:
        continue:
    else:
          check=False
          braek:
if check==True:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S=list(input())
N=len(S)
check=True
for i in range(N//2):
    if S[i]!=S[N-1-i]:
        check=False
        break
if check==False:
    print("No")
else:
    C=False
    for i in range((N//2)//2):
        if S[i]!=S[N//2-1-i]:#0123456
          C=True
          break
    if C==True:
        print("No")
    else:
        print("Yes")
h,w = map(int,input().split())
raw = ['/' * (w+2)]
for hi in range(h):
  raw.append('/' + input() + '/')
raw += ['/' * (w+2)]
#print(raw)
for hi in range(h):
  ans = ''
  pre = raw[hi]
  now = raw[hi+1]
  pst = raw[hi+2]
  for wi in range(w):
    if now[wi+1] == '#':
      cnt = '#'
    else:
      cnt = 0
      can = pre[wi:wi+3] + now[wi:wi+3] + pst[wi:wi+3]
      for j in range(9):
        if can[j] == '#':
          cnt += 1
    ans += str(cnt)
  print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
raw = []
ans = 0
for i in range(m):
  raw.append(list(map(lambda x:int(x)-1,input().split())))
for i in range(m):
  ab = [[] for _ in range(n)]
  for mi in range(m):
    if mi != i:
      try:
        here = raw[mi]
        ab[here[0]].append(here[1])
        ab[here[1]].append(here[0])
      except:
        print(ab,here,here[0],here[1])
  for ni in range(n):
    now = [ni]
    rest = [j for j in range(n)]
    for _ in range(50):
      nex = []
      for x in now:
        if x in rest:
          rest.remove(x)
        nex += ab[x]
      now = list(set(nex))
      if rest == []:
        break
    else:
      continue
    break
  else:
    ans += 1
print(ans)
# encoding:utf-8
import copy
import numpy as np
import random

n,q = map(int,input().split())
s = list(str(input()))
L = []
for i in range(q):
    l,r = map(int,input().split())
    L.append([l,r])

# count_ac = np.zeros([n])
count_ac = []
count = 0
i = 0
while (i<n):
    if s[i] == "A" and s[i+1] == "C":
        count_ac.append(count)
        count += 1
        count_ac.append(count)
        i += 2
    else:
        count_ac.append(count)
        i += 1


print(count_ac)
for i in range(q):
    ans = count_ac[L[i][1]-1]-count_ac[L[i][0]-1]
    print(int(ans))


### FIXED CODE ###

# encoding:utf-8
import copy
import numpy as np
import random

n,q = map(int,input().split())
s = list(str(input()))
L = []
for i in range(q):
    l,r = map(int,input().split())
    L.append([l,r])

# count_ac = np.zeros([n])
count_ac = []
count = 0
i = 0
while i < n-1:
    if s[i] == "A" and s[i+1] == "C":
        count_ac.append(count)
        count += 1
        count_ac.append(count)
        i += 2
    else:
        count_ac.append(count)
        i += 1

count_ac.append(count)


# print(count_ac)
for i in range(q):
    ans = count_ac[L[i][1]-1]-count_ac[L[i][0]-1]
    print(int(ans))
a,b,cd = map(int,input().split())
while a>=0 and b>=0:
  b-=c
  d-=a
if d == 0 and b==0:
  print('Yes')
elif b == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
while a>0 and b>0:
  a-=d
  c-=b

if a <= 0 and c<=0:
  print('Yes')
elif c <= 0:
  print('Yes')
else:
  print('No')
l=list(map(int(input().split())))
l=sorted(l)
a=l[0]
b=l[1]
c=l[2]
count=0
count+=c-b
if (b-a)%2==0:
  count+=(b-a)//2
else:
  count+=(b-a+1)//2+1
print(count)
  
  
          

### FIXED CODE ###

l=list(map(int,input().split()))
l=sorted(l)
a=l[0]
b=l[1]
c=l[2]
count=0
count+=c-b
if (b-a)%2==0:
  count+=(b-a)//2
else:
  count+=(b-a+1)//2+1
print(count)