Harryxun/stf_run huggingface dataset:
s = input()
print(s.sount('1'))

### FIXED CODE ###

print(input().count("1"))
N=int(input())
V=[int(input().split()) for i in range(N)]
C=[int(input().split()) for i in range(N)]

for i in range(N):
  if V[i] > C[i]:
    ans += V[i] - C[i]:
    print(ans)

### FIXED CODE ###

N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0

for i in range(N):
  ans += max(0,V[i] - C[i])
print(ans)
password = list(input())
for i in range(len(password)):
  for j in range(i+1, len(password)):
    if password[i] == password[j]:
      print("Bad")
      exit(1)
print("Good")
 

### FIXED CODE ###

password = list(input())
if password[0] == password[1] or password[1] == password[2] or password[2] == password[3]:
  print("Bad")
else:
  print("Good")
while True:
    m, f, r = [int(i) for i in input().solit()]

    if m == f == r == -1:
        break

    if m == -1 or f == -1:
        print("F")

    if m + f >= 80:
        print("A")

    if 65 <= m + f < 80:
        print("B")

    if 50 <= m + f < 65:
        print("C")

    elif 30 <= m + f < 50:
        if r > 50:
            print("C")
        else:
            print("D")

    if m + f < 30:
        print("F")

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    elif m == -1 or f == -1:
        print("F")

    elif m + f >= 80:
        print("A")

    elif 65 <= m + f < 80:
        print("B")

    elif 50 <= m + f < 65:
        print("C")

    elif 30 <= m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")

    elif m + f < 30:
        print("F")

    elif m + f < 30:
        print("F")
li = [str(input()) for i in range(5)]
tmp = []
tmp_2 = []
s = 0
for i in range(5):
    if 10-int(li[i][-1]) != 10:
        tmp.append(10-int(li[i][-1]))
    tmp_2.append(int(li[i]))
tmp.sort()
print(sum(tmp_2)+(sum(tmp)-tmp[-1]))

### FIXED CODE ###

li = [str(input()) for i in range(5)]
tmp = []
tmp_2 = []
s = 0
for i in range(5):
    if 10-int(li[i][-1]) != 10:
        tmp.append(10-int(li[i][-1]))
    tmp_2.append(int(li[i]))
tmp.sort()
if len(tmp) != 0:
    print(sum(tmp_2)+(sum(tmp)-tmp[-1]))
else:
    print(sum(tmp_2))
n=inout()
if n%2==0:
  print(n/2)
if n%2==1:
  print((n+1)/2)

### FIXED CODE ###

n=int(input())
if n%2==0:
  print(int(n/2))
elif n%2==1:
  print(int((n+1)/2))
def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
d1 = L//N
d2 = L//M
d = lcm(d1,d2)
l = list(range(L))
l = l[::d]
b = True
for i in l:
    if S[i//d1] != T[i//d2]:
        print(-1)
        sys.exit()

print(L)


### FIXED CODE ###

import sys

def gcd(a,b):
    if b==0:
        return a
    return(gcd(b, a%b))

def lcm(a,b):
    return (a*b)//gcd(a,b)

N, M = map(int,input().split())
S = input()
T = input()
d = gcd(N,M)
L = lcm(N,M)
for i in range(d):
    if S[i*(N//d)] != T[i*(M//d)]:
        print(-1)
        sys.exit()

print(L)
n=int(input())
a=0
l=[]
for a in range(1,n+1):
            for i in range(1,n):
                        if a==i**2:
                                    #print(a,i)
                                    l.append(a)
                               
print(max(l))                        


### FIXED CODE ###

n = int(input())
m = 1
for i in range(1, n):
    if i ** 2 > n:
        break
    m = i ** 2
print(m)
n = int(input())
d = []
for i in range(n+1):
    d.append(int(input()))
ans = len(set(d))
print(ans)

### FIXED CODE ###

n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
ans = len(set(d))
print(ans)
n,m=map(int,input().split())
L=list(map(int,input().split()))
L.sort()
if m!=1:

  d=[[L[i+1]-L[i],i] for i in range(m-1)]
  d.sort()
  d.reverse()
  ans=L[m-1]-L[0]

  for i in range(n-1):
    a=d[i][1]
    d[a]=0
    ans-=(L[a+1]-L[a])
  print(ans)
  

else:
  print(0)






### FIXED CODE ###

n,m=map(int,input().split())
L=list(map(int,input().split()))
L.sort()
if n>=m:
  print(0)
elif m!=1:

  d=[L[i+1]-L[i] for i in range(m-1)]
  d.sort()
  d.reverse()
  ans=L[-1]-L[0]


  ans-=sum(d[:n-1])
  print(ans)
  

else:
  print(0)
from sys import stdin

def main():
    s = [int(x) if x != "?" else "?" for x in stdin.readline().rstrip()]

    dp = [1] + [0]*12
    mul = 1
    mod = 10 ** 9 + 7
    s.reverse()

    for i in (range(0,len(s))):
        next_dp = [0]*13
        if s[i] == "?":
            for k in range(0, 10):
                for j in range(0, 13):
                    next_dp[(k*mul+j)%13] += dp[j]
                    next_dp[(k*mul+j)%13] %= mod

        else:
            k = s[i]
            for j in range(0, 13):
                    next_dp[k*mul+j)%13] += dp[j]
                    next_dp[k*mul+j)%13] %= mod

        mul = mul * 10 % 13
        dp = next_dp

    print(dp[5])

if __name__ == '__main__':
    main()


### FIXED CODE ###

from sys import stdin

def main():
    s = [int(x) if x != "?" else "?" for x in stdin.readline().rstrip()]

    dp = [1] + [0]*12
    mod = 10 ** 9 + 7

    for i in (range(0,len(s))):
        next_dp = [0]*13
        if s[i] == "?":
            for k in range(0, 10):
                for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

        else:
            k = s[i]
            for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

    #    mul = mul * 10 % 13
        dp = next_dp

    print(dp[5])

if __name__ == '__main__':
    main()
inputs = input().split("\n")
N = int(inputs[0])
V = list(map(int, inputs[1].split(" ")))
C = list(map(int, inputs[2].split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: z += v-c
print(Z)

### FIXED CODE ###

N = int(input())
V = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: Z += v-c
print(Z)
import sys
sys.setrecursionlimit(2000000)

N = int(input())
D = []
dp = []
for _ in range(N):
    a,b,c = map(int, input().split())
    D.append([a,b,c])
    dp.append([-1]*3)

def dfs(n, activity):#n日目にactivityを選んだ場合の最大幸福
    if dp[n][activity]!=-1:
        return dp[n][activity]
    if n==1:
        ans = 0
        for i in range(3):
            if i!=activity:
                ans = max(ans, D[1][activity]+D[0][i])
            dp[n][activity] = ans
        return ans
    ans = 0
    for i in range(3):
        if i!=activity:
            ans =max(ans, D[n][activity]+dfs(n-1, i))
    dp[n][activity] = ans
    return ans
ans = 0
for i in range(3):
    ans = max(ans, dfs(N-1, i))
print(ans)




### FIXED CODE ###

N = int(input())

vacation = []

for i in range(N):
    a,b,c = map(int, input().split())

    vacation.append([a,b,c])

dp = []*N

for i in range(N):
    dp.append([0, 0, 0])

dp[0][0]=vacation[0][0]
dp[0][1]=vacation[0][1]
dp[0][2]=vacation[0][2]

for i in range(0, N-1, 1):

    for j in range(3):
        for k in range(3):
            if j==k:
                continue
            dp[i+1][j] = max(dp[i+1][j], dp[i][k]+vacation[i+1][j])

print(max(dp[N-1]))
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
numk={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
dp=[0]+[-1]*(N+1)
for i in range(N):
    for j in A:
        if i+numk[j]<=N:
            dp[i+numk[j]]=max(dp[i+numk[j]],dp[i]+1)
m=N
ans=[]
while m>0:
    for i in A:
        if dp[m-numk[i]]==dp[m]-1 and m-numk[i]>=0:
            ans.append(str(i))
            m-=numk[i]
            break
print(''.join(ans))

### FIXED CODE ###

N,M=map(int,input().split())
num={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
A=list(map(int,input().split()))
A.sort(reverse = True)
dp = [0]+[-1]*(N+1)
for i in range(N):
    for j in A:
        if i+num[j]<=N:
            dp[i+num[j]] = max(dp[i+num[j]],dp[i]+1)
ans = []
m=N
while m>0:
    for i in A:
        if m-num[i]>=0 and dp[m-num[i]]==dp[m]-1:
          m-=num[i]
          ans.append(str(i))
          break
print("".join(ans))
n = int(input())
Taro = 0
Hanako = 0
for i in range(n):
    t,h = input().split()
    for j in range(min(len(t),len(h))):
        if t == h:
            Hanako += 1
            Taro += 1
            break
        elif ord(t[j:j+1]) > ord(h[j:j+1]):
            Taro += 3
            break
        elif ord(t[j:j+1]) < ord(h[j:j+1]):
            Hanako += 3
            break
	

print("{} {}".format(Taro,Hanako))

### FIXED CODE ###

while True:
    s = input()
    if s == "-":
        break
    s = list(s)
    m = int(input())
    for i in range(m):
        h = int(input())
        st = s[h:]
        for i in range(h):
            st.append(str(s[i]))
        s = st
    print("".join(s))
n=int(input())

count_1=9
count_3=900
count_5=90000

count=0

if n = 100000:
  count+=90909

if 10000 <= n and n < 100000:
  m=n-9999
  count+=m
  count+=909

if 1000 <= n and n < 10000:
  count+=909

if 100 <=n and n < 1000:
  l=n-99
  count+=l
  count+=9

if 10 <= n and n < 100:
  count +=9

if n < 10:
  count+=n

print(count)

### FIXED CODE ###

n=int(input())
 
count=0
 
if n == 100000:
  count+=90909

if 10000 <= n and n < 100000:
  m=n-9999
  count+=m
  count+=909

if 1000 <= n and n < 10000:
  count+=909

if 100 <=n and n < 1000:
  l=n-99
  count+=l
  count+=9

if 10 <= n and n < 100:
  count +=9

if n < 10:
  count+=n

print(count)
n = int(input())
a = list(map(int,input().split()))

q = int(input())

m = {}

for i in range(100000):
  m[i] = 0

for e in a:
  m[e] += 1
  
ans = sum(a)

for i in range(q):
  b,q = map(int,input().split())
  diff = (q-b) * m[b]
  
  m[q] += m[b]
  m[b] = 0
  
  ans += diff
  print(ans)
  

### FIXED CODE ###

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

q = int(input())

m = {}

for i in range(1000000):
  m[i] = 0

for e in a:
  m[e] += 1
  
ans = sum(a)

for i in range(q):
  b,q = map(int,input().split())
  diff = (q-b) * m[b]
  
  m[q] += m[b]
  m[b] = 0
  
  ans += diff
  print(ans)
n=int(input());A=input().split();print(*A[-1::-2],*A[n%2::2])

### FIXED CODE ###

n = input()
A = raw_input().split()
B = A[0::2]
C = A[1::2]
if n % 2 == 1:
    print " ".join(B[::-1] + C)
else:
    print " ".join(C[::-1] + B)
n=1
turi=1000*n

while N<1000*n:
  if N<1000*n:
    return turi=1000*n-N
  else:
    n+=1
  

### FIXED CODE ###

N=int(input())

n=1
kane=1000*n

while True:
    if N<=kane:
        print(kane-N)
        break
    else:
        n+=1
        kane=1000*n
posi_list = []
for _ in range(5):
  posi_list.append(int(input()))
k = int(input())

flag=True
for i in range(5):
  temp_posi_list = posi_list.copy()
  posi = temp_posi_list[i]
  del temp_posi_list[i]
  temp_posi_list = np.array(temp_posi_list)
  max_dist = max(np.abs(temp_posi_list - posi))
  if max_dist > k:
    flag=False
    break
if flag:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

import numpy as np

posi_list = []
for _ in range(5):
  posi_list.append(int(input()))
k = int(input())

flag=True
for i in range(5):
  temp_posi_list = posi_list.copy()
  posi = temp_posi_list[i]
  del temp_posi_list[i]
  temp_posi_list = np.array(temp_posi_list)
  max_dist = max(np.abs(temp_posi_list - posi))
  if max_dist > k:
    flag=False
    break
if flag:
  print("Yay!")
else:
  print(":(")
n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1),0)

### FIXED CODE ###

n, m = map(int, input().split())
ls = []
rs = []
for i in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)

print(max(min(rs)-max(ls)+1, 0))
N,K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
lm = []
lp = []
while l:
    x = l.pop(0)
    if x >= 0:
        lp.append(x)
    else:
        lm.append(-x)
ans = 100000000000
if lm and lp:
  for i in range(min(len(lp),K)):
    if K - i - 1 > 0:
      ans = min(ans,2*lp[i] + lm[-(K-i-1)],lp[i] + 2*lm[-(K-i-1)])
    else:
      ans = min(ans,lp[i])
elif lp:
  ans = lp[K-1]
else:
  ans = lm[1-K]
print(ans)

### FIXED CODE ###

N,K = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
ans = 100000000000
for i in range(N-K+1):
  le = l[i]
  ri = l[i+K-1]
  ans = min(ans,abs(le)+abs(ri-le),abs(ri)+abs(ri-le))
print(ans)
#tempt
h,w=map(int,input().split())
s=[]
for i in range(h):
    g=list(map(str,input().split()))
    s.append(g)

revs=[]
for i in range(h):
    tmp=s[i][::-1]
    revs.append(tmp)

cnta=[]
for i in range(h):
    left=[0]*w
    count = 0
    if s[i][0]=='.':
        left[0]=1
        count+=1

    for j in range(1,w-2):
        if s[i][1]=='.':
            left[j]=left[j-1]+1
            count+=1
        else:
            left[j]=0
            count=0
    cnta.append(left)

cntb=[]

for i in range(h):
    right=[0]*w
    count = 0
    if revs[i][0]=='.':
        right[0]=1
        count+=1

    for j in range(1,w):
        if revs[i][j]=='.':
            right[j]=right[j-1]+1
            count+=1
        else:
            right[j]=0
            count=0
    cntb.append(right)

print(cntb)


### FIXED CODE ###

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

ans=0
tate=[]

for i in range(W):
    c=0
    ad=[]
    while(c<H):
        ad.append(S[c][i])
        c+=1
    tate.append(ad)

left=[]
right=[]
up=[]
down=[]

for i in range(H):
    tmp=S[i]
    cnt=0
    al = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j]==".":
            cnt+=1
            al[j]=cnt
        else:
            cnt=0
    left.append(al)

for i in range(H):
    tmp = S[i]
    tmp=tmp[::-1]
    cnt = 0
    ar = [0 for _ in range(W)]
    for j in range(W):
        if tmp[j] == ".":
            cnt += 1
            ar[j] = cnt
        else:
            cnt = 0
    ar=ar[::-1]
    right.append(ar)

for j in range(W):
    tt=tate[j]
    cnt=0
    bl=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            bl[k]=cnt
        else:
            cnt=0
    up.append(bl)

for j in range(W):
    tt=tate[j]
    tt=tt[::-1]
    cnt=0
    br=[0 for i in range(H)]
    for k in range(H):
        if tt[k]==".":
            cnt+=1
            br[k]=cnt
        else:
            cnt=0
    br=br[::-1]
    down.append(br)

for i in range(H):
    for j in range(W):
        gh=left[i][j]+right[i][j]+up[j][i]+down[j][i]-3
        ans=max(gh,ans)

print(ans)
n=int(input())

def CanReach(t,x,y,now_t,now_x,now_y):
    if now_x<0 or now_y<0:
        return False

    if t==now_t:
        if x==now_x and y==now_y:
            return True
        else:
            return False

    if CanReach(t,x,y,now_t+1,now_x+1,now_y) or \
       CanReach(t,x,y,now_t+1,now_x-1,now_y) or \
       CanReach(t,x,y,now_t+1,now_x,now_y+1) or \
       CanReach(t,x,y,now_t+1,now_x,now_y-1):
        return True
    return False

now_t,last_x,last_y=0,0,0
for _ in range(n):
    ti,xi,yi=map(int,input().split())
    if CanReach(ti,xi,yi,now_t,last_x,last_y)==False:
        print('No')
        exit()
    now_t,last_x,last_y=ti,xi,yi
print('Yes')

### FIXED CODE ###

n=int(input())
tn,xn,yn=0,0,0
for _ in range(n):
    ti,xi,yi=map(int,input().split())
    td,xd,yd=ti-tn,xi-xn,yi-yn
    if td<xd+yd or (td+xd+yd)%2!=0:
        print('No')
        exit()
    tn,xn,yn=ti,xi,yi
print('Yes')
import sys

N = sys.argv[1]

dev_type = ""
  
if (N%10 == 2) or (N%10 == 4) or (N%10 == 5)or (N%10 == 7)or (N%10 == 9):
  dev_type == "hon"
elif (N%10 == 0) or (N%10 == 1) or (N%10 == 6)or (N%10 == 8):
  dev_type == "pon"
else:
  dev_type = "bon"

print(dev_type)



### FIXED CODE ###

n = input()
if (n[-1] == "2")or(n[-1] == "4")or(n[-1] == "5")or(n[-1] == "7")or(n[-1] == "9") :
    print("hon")
elif (n[-1] == "0")or(n[-1] == "1")or(n[-1] == "6")or(n[-1] == "8"):
    print("pon")
else:
    print("bon")
list1 = input().split(" ")
if int(list1[0]) <= int(list1[1]) * int(list[2]):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

list1 = input().split(" ")
if int(list1[0]) <= int(list1[1]) * int(list1[2]):
    print("Yes")
else:
    print("No")
H, W= [int(i) for i in input().split()]
for i in range(0,H):
    if W ==0 and H ==0:
        break
    elif i == 0:
        print('#'*W)
    elif i == (y-1):
        print('#'*W)
    elif H == 1:
        break
    else:
        print('#','.'*(W-2),'#',sep='')

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if W == 0 and H == 0:
        break
    for i in range(0, H):
        if i == 0:
            print('#' * W)
        elif i == (H - 1):
            print('#' * W)
        elif H == 1:
            break
        else:
            print('#', '.' * (W - 2), '#', sep='')
    print()
numset = set([])
q = int(input())
for i in range(q):
    query, x = list(map(int, input().split(' ')))
    if query == 0:
        numset.add(x)
        print(len(numset))
    elif query == 1:
        if set([x]).issubset(numset):
            print(1)
        else:
            print(0)
    else:
        numset.remove(x)


### FIXED CODE ###

numset = set([])
q = int(input())
for i in range(q):
    query, x = list(map(int, input().split(' ')))
    if query == 0:
        numset.add(x)
        print(len(numset))
    elif query == 1:
        if set([x]).issubset(numset):
            print(1)
        else:
            print(0)
    else:
        if set([x]).issubset(numset):
            numset.remove(x)
a = input()
lst = input().split(" ")
lst.sort()
ans=0
for i in range(int(len(lst))):
  ans += lst[len(lst)-2*i-2]

print(ans)

### FIXED CODE ###

a = input()
lst = list(map(int,input().split(" ")))
lst.sort()
ans=0
for i in range(int(len(lst)/2)):
  ans += lst[len(lst)-2*i-2]
 
print(ans)
N=int(input())
L=list(map(int,input().split()))
a=1
for i in range(N):
  a=a*L[i]
if a>10**18:
  print(-1)
else:
  print(a)
  


### FIXED CODE ###

A,B=map(int,input().split())
print(A*B)
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(n)/2)))
  b=list("01"*int((int(n)/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(n)-1)/2))+"1")
  bb=list("01"*int(((int(n)-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))

### FIXED CODE ###

n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(len(n))/2)))
  b=list("01"*int((int(len(n))/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(len(n))-1)/2))+"1")
  bb=list("01"*int(((int(len(n))-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))
n,m=list(map(int,input().split()))
road=[[] for i in range(m)]
#隣接行列表現だとo(n^2)で間に合わないので隣接リスト表現でいく
for i in range(m):
  a,b=list(map(int,input().split()))
  road[a-1].append(b)
  road[b-1].append(a)
from collections import deque
q=deque([1])
check=[0 for i in range(n)]
check[0]=1
ans=[0 for i in range(n)]
while len(q)>0:
  p=q.popleft()
  for i in range(len(road[p-1])):
    if check[road[p-1][i]-1]==0:
      q.append(road[p-1][i])
      check[road[p-1][i]-1]=1
      ans[road[p-1][i]-1]=p
print("Yes")

for i in range(1,n):
  print(ans[i])
  

      
  
  

### FIXED CODE ###

n,m=list(map(int,input().split()))
road_input=[]
for i in range(m):
    road_input.append(list(map(int,input().split())))

#隣接リスト
road=[[] for i in range(n+1)]
for i in range(m):
    road[road_input[i][0]].append(road_input[i][1])
    road[road_input[i][1]].append(road_input[i][0])

from collections import deque
q=deque([1])
ans=[-1 for i in range(n)]
while len(q)>0:
  p=q.popleft()
  for i in road[p]:
    if ans[i-1]== -1:
      ans[i-1]=p
      q.append(i)

print("Yes")
for j in range(1,n):
    print(ans[j])
g,r=map(int,input().split())
A=["."]*(r+2)
for i in range(g):
  w="."+input()+"."
  A.append(w)
A.append("."*(r+2))
for i in range(1,g+1):
  for j in range(1,r+1):
    if A[i][j]==".":
      B=[]
      for m in [i-1,i,i+1]:
        for k in [j-1,j,j+1]:
          B.append(A[m][k])
      A[i]=A[i][1:r+1:].replace(".",str(B.count("#")),1)
      A[i]="."+A[i]+"."
for i in range(1,g+1):
  print(A[i][1:r+1:])


### FIXED CODE ###

g,r=map(int,input().split())
A=["."*(r+2)]
for i in range(g):
    w="."+input()+"."
    A.append(w)
A.append("."*(r+2))
for i in range(1,g+1):
    for j in range(1,r+1):
        if A[i][j]==".":
            B=[]
            for m in [i-1,i,i+1]:
                for k in [j-1,j,j+1]:
                    B.append(A[m][k])
            A[i]=A[i][1:r+1:].replace(".",str(B.count("#")),1)
            A[i]="."+A[i]+"."
for i in range(1,g+1):
    print(A[i][1:r+1:])
n=int(input())
p=list(map(int,input().split()))

for i in range(n-2):
    if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:
        count+=1

print(count)



### FIXED CODE ###

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

count=0

for i in range(n-2):
    if p[i]<p[i+1]<p[i+2] or p[i]>p[i+1]>p[i+2]:
        count+=1

print(count)
import collections
H,W,M=map(int,input().split())
h=[None]*M
w=[None]*M
for i in range(M):
    h[i],w[i]=map(int,input().split())
c1=collections.Counter(h)
c2=collections.Counter(w)
ans=0
cnt=0
while cnt<len(c1)-1:
    cnt2=0
    while cnt2<len(c2)-1:
        flag=True
        for x in range(M):
            if h[x]==c1.most_common()[cnt][0] and w[x]==c2.most_common()[cnt2][0]:
                ans=max((ans,c1.most_common()[cnt][1]+c2.most_common()[cnt2][1]-1))
                flag=False
                break
        if flag:
            ans=max((ans,c1.most_common()[cnt][1]+c2.most_common()[cnt2][1]))
        if c2.most_common()[cnt][1]>c2.most_common()[cnt+1][1]:
            break
        cnt2+=1
    if c1.most_common()[cnt][1]>c1.most_common()[cnt+1][1]:
        break
    cnt+=1
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H, W, M = map(int, readline().split())
bomb = [tuple(map(lambda x: int(x) - 1, s.split())) for s in readlines()]
X = [0] * H 
Y = [0] * W 
for h, w in bomb:
    X[h] += 1
    Y[w] += 1
maxX = max(X)
maxY = max(Y)

R = [h for h, x in enumerate(X) if x == maxX]  
C = [w for w, y in enumerate(Y) if y == maxY] 

bomb = set(bomb)
for r in R:
    for c in C:
        if (r, c) not in bomb:
            print(maxX + maxY)
            exit()
print(maxX + maxY - 1)
l = []

count = 0

for s in input():
    if s == "R":
        count += 1
    else:
        l.append(count)
        count = 0

print(max(l))


### FIXED CODE ###


flag = True
count = 0
l = []

for s in input():
    if flag:
        if s == "R":
            count += 1
            l.append(count)
        else:
            l.append(0)
            count = 0


print(max(l))
s1=input()
s2=input().split()
a=sorted(s2,reverse=True)

max=a[0]
cnt=a[1:]
all=sum(int(i) for i in cnt)

if(max<all){
  print('Yes')
}else{
  print('No')
}


### FIXED CODE ###

s1=input()
s2=input().split()
n2=[int(i) for i in s2]
a=sorted(n2,reverse=True)

max=a[0]
cnt=a[1:]
all=sum(cnt)

if(max<all):
  print('Yes')
else:
  print('No')
R, G, B, N = map(int, input().split())
cnt = 0

for i in range(N // R + 1):
    for j in range(N // G + 1):
        if (N - R * i - G * j) % B == 0:
            cnt += 1
print(cnt)

### FIXED CODE ###

n, k = map(int, input().split())
print(n-k+1)
a = int(input())
b = int(input())
sum = 1
result = 0
while sum < b:
     sum = sum -1 + a
     result += 1

print(result)

### FIXED CODE ###

a,b = map(int, input().split())
sum = 1
result = 0
while sum < b:
     sum = sum -1 + a
     result += 1

print(result)