Harryxun/stf_run huggingface dataset:
line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for i in range(b):
    axb_text = f"{axb_text}{a}"

bxa_text = ''
for i in range(a):
    bxa_text = f"{bxa_text}{b}"

print(axb_text if axb_text < bxa_text else bxa_text)

### FIXED CODE ###

line = input().split(' ')
a = int(line[0])
b = int(line[1])

axb_text = ''
for _ in range(b):
    axb_text += str(a)

bxa_text = ''
for _ in range(a):
    bxa_text += str(b)


print(axb_text if axb_text < bxa_text else bxa_text)
from functools import lru_cache
2.@lru_cache(maxsize=1000)
3.def fib(n):
4.    if n < 2:
5.        return n
6.    else:
7.        return fib(n - 1) + fib(n - 2)
8. 
9.n,m = map(int,input().split())
10.a = []
11.a.append(0)
12.for i in range(m):
13.    b = int(input())
14.    b -= 1
15.    a.append(b)
16.a.append(n)
17.b = []
18. 
19.for i in range(n):
20.    b.append(fib(i))
21. 
22.c = []
23.#if a[1] == 0:
24.    #c.append(1)
25.#else:
26.    #c.append(b[a[1] - a[0] ])
27.i = 0
28.while i <= m:
29.    #if a[i + 1] - a[i] - 2 >= 0:
30.    c.append(b[a[i + 1] - a[i]  - 2])
31.    i += 1
32.    #elif a[i + 1] - a[i] - 2 == 0:
33.        #c.append(1)
34.    #else:
35.        #c.append(0)
36.        #break
37.#print(c)
38.d = c[0] 
39.i = 1
40.#print(d)
41.while i < len(c):
42.    d = d * c[i]
43.    i += 1
44.e = 1000000007
45.print(d % e)
46.#print(b[0])


### FIXED CODE ###

n,m = map(int,input().split())
mod = 10**9 + 7
a = [1] * (n+1)
for i in range(m):
    b = int(input())
    a[b] = 0

        
for i in range(2,n+1):
    if a[i] != 0:
        a[i] = a[i-1] + a[i-2]
#print(a)
print(a[n] % mod)
K, S = map(int, input().split())
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K
        count += 1
print(count)


### FIXED CODE ###

K, S = map(int, input().split())
count = 0
for X in range(K+1):
  for Y in range(K+1):
    Z = S - X - Y
    if 0 <= Z and Z <= K:
        count += 1
print(count)
s,t=map(int,input().split())
print("No" if t>=s else "Yes")

### FIXED CODE ###

s=input()
t=input()
if s==t[:-1]:
	print("Yes")
else:
  	print("No")
ryouri = [int(input()) for i in range(5)]

order_1 = [i*0.1 - int(i*0.1) for i in ryouri]
min_v = sorted(order_1)[0]
min_id = 0
for i, v in enumerate(order_1):
    if v == min_v:
        min_id = i

goukei = 0
for i, (price, order) in enumerate(zip(ryouri, order_1)):
    if i == min_id:
        goukei = goukei + ryouri
    else:
        goukei = goukei + ryouri + 10



### FIXED CODE ###

import math
ryouri = [int(input()) for i in range(5)]

order_1 = [(i-1)*0.1 - int((i-1)*0.1) for i in ryouri]
min_v = 999
min_id = 0
for i, v in enumerate(order_1):
    if v < min_v:
        min_v = v
        min_id = i

goukei = 0
for i, (price, order) in enumerate(zip(ryouri, order_1)):
    if i == min_id:
        goukei = goukei + price
    else:
        goukei = goukei + math.ceil(price*0.1)*10

print(goukei)
n = int(input())
s = input()
t = input()
for i in range(n):
  if s[i:] == t[:n-i]:
    ans = n + i
    break
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
t = input()
for i in range(n):
  cnt = 0
  for j in range(i, n):
    if s[j] != t[j-i]:
      break
    cnt += 1
  if cnt == n-i:
    ans = n+i
    break
if cnt == 0:
  ans = 2*n
print(ans)
N, M = map(int, input().split())
G = [[1]*M for _ in range(N)]

x = (-1, 0, 1)
y = (-1, 0, 1)
for i in range(N):
    for j in range(M):
        for dx in x:
            for dy in y:
                if 0 <= i+dy <= N-1 and 0 <= j+dx <= M-1:
                    G[i+dy][j+dx] *= -1

ans = 0
for g in G:
    ans += g.count(-1)
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
if N <= 2 or M <= 2:
    if N == 1 and M ==1:
        ans = 1
    elif N == 1 or M == 1:
        ans = max(N-2, M-2)
    else:
        ans = 0
else:
    ans = (N-2)*(M-2)
print(ans)
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    if a[0]<a[i]:
        up=True
        nin=a[0]
        break
    elif a[0]>a[i]:
        up=False
        break
    if i==n-1:
        print(1000)
        exit()

total=1000

for i in range(1,n-1):
    if up:
        if a[i-1]<=a[i] and a[i]>a[i+1]:
            total+=(total//nin)*(a[i]-nin)
            up=False
    else:
        if a[i-1]>=a[i] and a[i]<a[i+1]:
            nin=a[i]
            up=True
if nin<a[n-1]:
    total+=(total//nin)*(a[n-1]-nin)
print(total)

### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))
ave=[0 for i in range(n-k+1)]


for i in range(n-k):
    if A[i+k]>A[i]:
        print('Yes')
    else:
        print('No')
import fractions
from functools import reduce

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

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

b = lcm_list(a)

m -= int((b/2))
if m < 0:
    print(0)
    exit()

ans = (m//b) + 1
print(int(ans))

### FIXED CODE ###

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

from fractions import gcd
from functools import reduce

a = [i >> 1 for i in a]

def applied_lcm(x, y):
    g = gcd(x, y)
    x //= g
    y //= g
    if x %2 == 0:
        return 0
    if y %2 == 0:
        return 0
    n = x * y * g
    if n >> 10**9:
        return 0

    return n

p = reduce(applied_lcm, a)
if p == 0:
    ans = 0
else:
    ans = (m//p) - (m//(p+p))
print(ans)
from math  import gcd
n, m = map(int, input().split())
s = input()
t = input()

ans = n*m//gcd(n, m)

"""
最小公倍数の長さで収まらない場合は、何をやってもダメ
"""
dp = [0] * ans
for i in range(n):
    dp[i*ans//n] = s[i]

for i in range(m):
    if dp[i*ans//m] == 0: 
        dp[i*ans//m] = t[i]
    else:
        if dp[i*ans//m] != t[i]:
            print(-1)
            exit(0)
print(ans)

### FIXED CODE ###

from math  import gcd
n, m = map(int, input().split())
s = input()
t = input()

g = gcd(n, m)
ans = n*m//g

"""
最小公倍数の長さで収まらない場合は、何をやってもダメ
"""
for i in range(g):
    if not s[i*n//g] == t[i*m//g]:
        print(-1)
        exit(0)
print(ans)
#AIsing2020 d
 
N = int(input())
X = input()
X10 = int('0b'+X,2)
X10_num1 = X.count('1')
X10_pulse = X10%(X10_num1+1)
X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


for i in range(N,0,-1):
    a = X10
    if a>>(i-1) & 1:
        a -= 2**(i-1)
        amari = (X10_ninus - (2**(i-1))%(X10_num1-1))%(X10_num1-1)
    else:
        a += 2**(i-1)
        amari = (X10_pulse + (2**(i-1))%(X10_num1+1))%(X10_num1+1)
    nc = amari
    if a ==0:
        co = 0
    else:
        co = 1
        while nc >0:
            bin_str = bin(nc)
            cou1 = bin_str.count('1')
            nc = nc%cou1
            co +=1
    
    print(co)

### FIXED CODE ###

#AIsing2020 d

def f(n):
        cnt = 0
        while n:
            cnt+= 1
            n = n%bin(n).count('1')
        return cnt

def main():
    N = int(input())
    X = input()
    X10 = int(X,2)
    X10_num1 = X.count('1')
    X10_pulse = X10%(X10_num1+1)
    X10_ninus = X10%(X10_num1-1) if X10_num1 >1 else 0


    for i in range(N,0,-1):
        j = N-i
        if (X[j] == '1') and X10_num1 >1:
            mod = X10_num1-1
            amari = (X10_ninus - pow(2,i-1,mod))%(mod) 
        elif (X[j] == '1') and X10_num1 ==1:
            print(0)
            continue
        else:
            mod = X10_num1+1
            amari = (X10_pulse + pow(2,i-1,mod))%(mod)

        print(1+f(amari))


main()
from collections import Counter

n = int(input())
q_list = []
a_list = []
for i in range(n):
    q = []
    x, y = map(int, input().split())
    q.append(x)
    q.append(y)
    q_list.append(q)
    if i != 0:
        for j in range(i):
            difx1 = q_list[j][0] - q_list[i][0]
            dify1 = q_list[j][1] - q_list[i][1]
            difx2 = q_list[i][0] - q_list[j][0]
            dify2 = q_list[i][1] - q_list[j][1]
            a_list.append(f"{difx1}{dify1}")
            a_list.append(f"{difx2}{dify2}")
if n != 1:
    zero = Counter(a_list).most_common()[0][1]
    print(n-zero)
else:
    print(1)

### FIXED CODE ###

from collections import Counter

n = int(input())
q_list = []
a_list = []
for i in range(n):
    q = []
    x, y = map(int, input().split())
    q.append(x)
    q.append(y)
    q_list.append(q)
    if i != 0:
        for j in range(i):
            difx1 = q_list[j][0] - q_list[i][0]
            dify1 = q_list[j][1] - q_list[i][1]
            difx2 = q_list[i][0] - q_list[j][0]
            dify2 = q_list[i][1] - q_list[j][1]
            a_list.append(str(difx1)+str(dify1))
            a_list.append(str(difx2)+str(dify2))
if n != 1:
    zero = Counter(a_list).most_common()[0][1]
    print(n-zero)
else:
    print(1)
N = input()
for i in N:
  ans += int(i)
print(ans)


### FIXED CODE ###

N = input()
ans = 0
for i in N:
  ans += int(i)
print('Yes' if int(N)%ans == 0 else 'No')
x = int(input())
a = [list(map(int,input().split()))]
b = sorted(a)
y = 0
for i in range(x):
  y += b[i-0]*2**i
print(y/(2**(x+1)))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
sum = a[0]
for i in range(1,n):
    sum = (sum + a[i])/2
print(sum)
W=input()
s=0
while True:
 T=list(input().split())
 for i in T:
  if T=='END_OF_TEXT':
    break
  else:
   if i==W:
        s+=1
 print(s)
     
 

### FIXED CODE ###

W=input()
s=0
while True:
 T=list(input().split())
 if T==['END_OF_TEXT']:
   break
 else:
   for i in T:
     if i.lower()==W.lower():
        s+=1
print(s)
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(a[0::2] - a[1::2])

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
Alice = []
Bob = []
while a != []:
    get = max(a)
    Alice.append(get)
    a.remove(get)
    if a != []:
        get = max(a)
        Bob.append(get)
        a.remove(get)
print(sum(Alice) - sum(Bob))
X=int(input())
from math import cail
print(ceil(360/X))

### FIXED CODE ###

from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
X=int(input())
from math import ceil
print(lcm(360,X)//X)
N=int(input())

if N<2:
	print(0)
ellif N==2:
	print(2)
else:
	without=10**(N-2)
	considered=(without+2)*(without+1)
	considered=considered%(1000000007)
	print(considered)
	


### FIXED CODE ###

MOD=10**9+7
N=int(input())
 
all=pow(10,N,MOD)
sub9=pow(9,N,MOD)
sub8=pow(8,N,MOD)
print((all-2*sub9+sub8)%MOD)
#126_D
n=int(input())
edges=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=map(int,input().split())
    edges[u-1].append((v-1,w))
    edges[v-1].append((u-1,w))
visit=[False for _ in range(n)]
d=[0 for i in range(n)]

def dfs(i):
    visit[i]=True
    if all(visit[i] for i in range(n)):
        print(*d,sep='\n')
        exit()
    for v,w in edges[i]:
        if visit[v]==False:
            d[v]=(d[i]+w)%2
            dfs(v)
            
dfs(0)

### FIXED CODE ###

#126_D
import sys
sys.setrecursionlimit(500000)

n=int(input())
edges=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w=map(int,input().split())
    edges[u-1].append((v-1,w))
    edges[v-1].append((u-1,w))
visit=[False for _ in range(n)]
d=[0 for i in range(n)]

def dfs(i):
    visit[i]=True
    if all(visit[i] for i in range(n)):
        print(*d,sep='\n')
        exit()
    for v,w in edges[i]:
        if visit[v]==False:
            d[v]=(d[i]+w)%2
            dfs(v)
            
dfs(0)
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
c=0
for i in b[a[1]]:
  c+=b[i]
  return c
print(c)


### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))
S = set(input())
n = 'N' in S
s = 'S' in S
e = 'E' in S
w = 'W' in S
if n^s or e^w:
    print('No')
else:
    print('Yes')

n = int(input())
l = list(map(int, input().split()))
l.sort()
print(sum([l[i] for i in range(2*n) if i%2==0]))

### FIXED CODE ###

S = set(input())
n = 'N' in S
s = 'S' in S
e = 'E' in S
w = 'W' in S
if n^s or e^w:
    print('No')
else:
    print('Yes')
N = int(input())

s = sum(map(int,list(N)))
if N % s == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()

s = sum(map(int,list(N)))
if int(N) % s == 0:
  print("Yes")
else:
  print("No")
n = int(input())
a = list(map(int,input().split()))
ans = 10**9
for ai in range(min(a),max(a)+1):
    w = 0
    for aj in a:
        w += (ai-aj)**2
    ans = min(w,ans)
print(ans)

### FIXED CODE ###

n = int(input())
sum = 0
for i in range(n+1):
    sum = sum + i
    
print(sum)
H,W = map(int,input().split())
m = ["" for _ in range(H)] 
import queue
import numpy as np
q = queue.Queue()

#sharps = []
for i in range(H):
    m[i] = input()
    for j in enumerate(m[i]):
        if j[1] == "#":
            q.put((i,j[0]))
            
times_map = np.zeros(H*W)
bool_map = np.zeros(H*W)

counter = -1
while sum(bool_map) != H*W:
    counter +=1
    sharps = [q.get() for _ in range(q.qsize())]
    for one in sharps:
        if one[0] < 0 or one[0] >= H or one[1] < 0 or one[1] >= W:
            continue
        index = one[0]*(H)+one[1]
        if bool_map[index] == 0:
            times_map[index] = counter
            bool_map[index] = 1
            q.put((one[0]+1,one[1]))
            q.put((one[0]-1,one[1]))
            q.put((one[0],one[1]+1))
            q.put((one[0],one[1]-1))
            
print(counter)

### FIXED CODE ###

import numpy as np
import sys
# https://atcoder.jp/contests/agc033/submissions/6021787
buf = sys.stdin.buffer
H,W = map(int,buf.readline().split())
# +1周分だけ
black = np.zeros((H+2,W+2),dtype=np.bool)
# \nがあることに注意
black[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'#').reshape(H,W+1)

INF = 10 ** 4
dist = np.zeros((H,W),dtype=np.int16)
# .のところは０それ以外はINFで初期化
dist[~black[1:-1,1:-1]] = INF
# 右、左、下、上と展開させていく感じ
for n in range(1,H):
    np.minimum(dist[n-1]+1,dist[n],out=dist[n])
for n in range(H-2,-1,-1):
    np.minimum(dist[n+1]+1,dist[n],out=dist[n])
for n in range(1,W):
    np.minimum(dist[:,n-1]+1,dist[:,n],out=dist[:,n])
for n in range(W-2,-1,-1):
    np.minimum(dist[:,n+1]+1,dist[:,n],out=dist[:,n])

print(dist.max())
X, Y, A, B, C = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a = sorted(a, reverse=True)
b = sorted(b, reverse=True)
c = sorted(c, reverse=True)
a2 = a[:]
b2 = b[:]
c2 = c[:]
sum1 = 0
for i in range(X):
    if a[0] < c[0]:
        sum1 += c.pop(0)
    else:
        sum1 += a.pop(0)
for i in range(Y):
    if b[0] < c[0]:
        sum1 += c.pop(0)
    else:
        sum1 += b.pop(0)
sum2 = 0
for i in range(Y):
    if b2[0] < c2[0]:
        sum2 += c2.pop(0)
    else:
        sum2 += b2.pop(0)
for i in range(X):
    if a2[0] < c2[0]:
        sum2 += c2.pop(0)
    else:
        sum2 += a2.pop(0)        
if sum1 > sum2:
    print(sum1)
else:
    print(sum2)


### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a = sorted(a, reverse=True)[:X]
b = sorted(b, reverse=True)[:Y]
print(sum(sorted(a + b + c, reverse=True)[:X+Y]))
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
for i in
for i in range (n):
  if ans>abs(ans-2*a[i]):
    ans=abs(ans-2*a[i])
print(ans)


### FIXED CODE ###

n=int(input())
b=list(map(int,input().split()))
ans=sum(b)
ansl=[]
for i in range(n-1,0,-1):
  ans-=2*b[i]
  ansl.append(abs(ans))
print(min(ansl))
h,w = map(int, input().split())
field = [input() for _ in range(h)]

# 行を圧縮 
for hi in range(h-1):
    all_white = True
    if field[hi].count("#") > 0:
        all_white = False
    
    if all_white:
        del field[hi]
    
        
field_char = [list(field[hi]) for hi in range(len(field))]
# 列を圧縮
has_black_list = []
for wj in range(w):
    has_black = False
    for hi in range(len(field)):
        if field_char[hi][wj] == "#":
            has_black = True
            
    
    if has_black:
        has_black_list.append(wj)
        
field_ans = [["" for wj in range(len(has_black_list))] for hi in range(len(field))]
for j, wj in enumerate(has_black_list):
    for hi in range(len(field)):
        field_ans[hi][j] = field[hi][wj]
        
        

for hi in range(len(field)):
    print("".join(field_ans[hi]))

### FIXED CODE ###

import sys
sdin = sys.stdin.readline

h,w = map(int, sdin().split())
field = []
for hi in range(h):
    field.append(sdin())
    
f2 = []
for hi in range(h):
    if field[hi].count("#") > 0:
        f2.append(field[hi])
    
f2_char = [list(f2[hi]) for hi in range(len(f2))]

# 列を圧縮
has_black_list = []
for wj in range(w):
    has_black = False
    for hi in range(len(f2)):
        if f2_char[hi][wj] == "#":
            has_black = True    
    
    if has_black:
        has_black_list.append(wj)
        
field_ans = [["" for wj in range(len(has_black_list))] for hi in range(len(f2))]
for j, wj in enumerate(has_black_list):
    for hi in range(len(f2)):
        field_ans[hi][j] = f2_char[hi][wj]
    

for hi in range(len(f2)):
    print("".join(field_ans[hi]))
N,Q = map(int,input().split())
graph = [[] for _ in range(N)]
#グラフをリストで表現
for _ in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)#リストの番号で頂点を表示するため-1
    graph[b-1].append(a-1)
point = [0]*N
for _ in range(Q):
    a,b = map(int,input().split())
    point[a-1] += b#根にあたる部分にだけコストをプラス


#再帰定義
def dfs(now, prev = -1):#prev,now,nextの三段階を扱う
    for next in graph[now]:#今見ている頂点に連結されているものを見る
        if next == prev:#親だったら飛ばす
            continue
        point[next] += point[now]#子の得点をプラス
        dfs(next,now)#nextが親だけになると自分を呼ぶ前に飛ばされて終わる

dfs(0)#根頂点を指定してスタート
print(*point)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
import sys
N,Q = map(int,input().split())
graph = [[] for _ in range(N)]
#グラフをリストで表現
for _ in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append(b-1)#リストの番号で頂点を表示するため-1
    graph[b-1].append(a-1)
point = [0]*N
for _ in range(Q):
    a,b = map(int,input().split())
    point[a-1] += b#根にあたる部分にだけコストをプラス


#再帰定義
def dfs(now, prev = -1):#prev,now,nextの三段階を扱う
    for next in graph[now]:#今見ている頂点に連結されているものを見る
        if next == prev:#親だったら飛ばす
            continue
        point[next] += point[now]#子の得点をプラス
        dfs(next,now)#nextが親だけになると自分を呼ぶ前に飛ばされて終わる

dfs(0)#根頂点を指定してスタート
print(*point)
from collections import OrderedDict
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = collections.Counter(a)
ans = 0
num_keys = len(b.keys())

if num_keys > k:
    if k != 0:
        c = sorted(b.items(),key=lambda x:x[1])
        for i in range(len(c)):
            num_keys -= c[i][1]
            ans += c[i][1]
            if num_keys <= k:
                break
    else:
        ans += k
            
print(ans)


### FIXED CODE ###

from collections import Counter
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
x = len(set(a))
if x <= k:
    print(ans)
else:
    b = Counter(a).most_common(x)
    for i in range(x-1,k-1,-1):
        ans += b[i][1]
    print(ans)
N,M = map(int, input().split())
PY = [[0] * 2 for i in range(M)]

for i in range(M):
    p,y = map(int,input().split())
    PY[i][0] = p
    PY[i][1] = y

indices = [*range(len(PY))]
sorted_indices = sorted(indices, key=lambda i: PY[i])
PY.sort()

def calc(x):
    n = len(str(x))
    res = ""
    if n < 6:
        for i in range(6-n):
            res += "0"
    res += str(x)
    return res

before = 0
num = 1
ans = [0]*M
for i in range(M):
    if before != PY[i][0]:
        num = 1
        ans[sorted_indices[i]] = calc(PY[i][0])+calc(num)
        num += 1
        before = PY[i][0]
    else:
        ans[sorted_indices[i]] = calc(PY[i][0])+calc(num)
        num += 1
        before = PY[i][0]

for i in range(M):
    print(ans[i])

### FIXED CODE ###

N,M = map(int, input().split())
PY = [[0] * 2 for i in range(M)]

for i in range(M):
    p,y = map(int,input().split())
    PY[i][0] = p
    PY[i][1] = y

indices = list(range(M))
sorted_indices = sorted(indices, key=lambda i: PY[i])
PY.sort()

def calc(x):
    n = len(str(x))
    res = ""
    if n < 6:
        for i in range(6-n):
            res += "0"
    res += str(x)
    return res

before = 0
num = 1
ans = [0]*M
for i in range(M):
    if before != PY[i][0]:
        num = 1
        ans[sorted_indices[i]] = calc(PY[i][0])+calc(num)
        num += 1
        before = PY[i][0]
    else:
        ans[sorted_indices[i]] = calc(PY[i][0])+calc(num)
        num += 1
        before = PY[i][0]

for i in range(M):
    print(ans[i])
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
import numpy as np
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
matrix = np.zeros((N,N),dtype=np.int)
for idx, iterator in enumerate(s[1:]):
    W_list = [x for x in iterator.split()]
    for w_idx in range(W):
        if W == "#":
            matrix[idx, w_idx] = 1
ch_matrix = matrix.copy()
for i in range(N):
    zero_index_list = np.where(matrix == 0)
    if len(zero_index_list[0]) == 0:
        print(i + 1)
        break
    for i in range(len(zero_index_list[0])):
        row = zero_index_list[0][i]
        col = zero_index_list[1][i]
        bw_checker = 0
        if row != 0:
            bw_checker += matrix[row - 1][col]
        if row != N - 1:
            bw_checker += matrix[row + 1][col]
        if col != 0:
            bw_checker += matrix[row][col - 1]
        if col != W - 1:
            bw_checker += matrix[row][col + 1]
        if bw_checker == 1:
            ch_matrix[x][y] = 1
    matrix = ch_matrix.copy()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from scipy import ndimage
s = sys.stdin.readlines()
N, W = map(int, s[0].split())
W_matrix = [list(line.strip()) for line in s[1:N + 1]]
matrix_like_list = [[1 if x == "." else 0 for x in W_list] for W_list in W_matrix]
dist = ndimage.distance_transform_cdt(matrix_like_list, metric="taxicab")
print(dist.max())
import numpy as np

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

table = np.zeros(10**5+1, dtype=np.int)
chan = [[] for _ in range(c+2)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chan[c].append([s,t])

# 同チャンネルの連続番組を統合する
times = []
for i in range(c+2):
    arr = chan[i]
    if chan[i]==[] : continue
    for i in range(len(arr)):
        if i == len(arr)-1 : break
        if arr[i][1] == arr[i+1][0]:
            arr[i+1] = [arr[i][0], arr[i+1][1]]
            arr[i] = [1,0]
    times += arr

# いもす法
for s,t in times:
    table[s] += 1
    table[t+1] -= 1

# 累積和の計算
ans = table.cumsum().max()

print(ans)



### FIXED CODE ###

import numpy as np

n,c = map(int,input().split())
table = np.zeros(10**5+2, dtype=np.int32)
chs = [[] for _ in range(c+1)]

for _ in range(n):
    s,t,c = map(int,input().split())
    chs[c].append([s,t])

# 同チャンネル内の連続番組を合体
times = []
for ch in chs:
    if not ch: continue
    ch.sort()
    for i in range(len(ch)):
        if i == 0: continue
        if ch[i-1][1] == ch[i][0]:
            ch[i] = [ch[i-1][0], ch[i][1]]
            ch[i-1] = []
    for arr in ch:
        if not arr: continue
        times.append(arr)

# いもす法
for arr in times:
    table[arr[0]] += 1
    table[arr[1]+1] -= 1

# 累積和の最大値
ans = table.cumsum().max()

print(ans)
n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

if s[0] == "L" and s[1] == "L":
    # if s[-1] == "R" and s[-2] == "R":
        init -= 1

print(init + (2 * k))

### FIXED CODE ###

n, k = map(int, input().split())
s = input()

def count_diff(a,b):
    cnt = 0
    for c1,c2 in zip(a, b):
        if c1 != c2:
            cnt += 1
    return cnt

s2 = s[1:]
cnt = count_diff(s[:-1], s2)
init = n - cnt - 1

ans = min(n-1, init + (2 * k))

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

print((A-1)*(B-1))

### FIXED CODE ###

A,B = map(int,(input().split()))
ans = (A-1)*(B-1)
print(ans)