Harryxun/stf_run huggingface dataset:
from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  #穴をあける
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  
#bingoチェック
  
#たて
if True in [ not False in [A[j][i]==A[j+1][i] for j in range(len(A)-1)] for i in range(len(A[0]))]:
  print("Yes")
#よこ
elif True in [len(Counter(tmpA))==1 for tmpA in A]:
  print("Yes")
#ななめ
elif [A[i][i] == A[i+1][i+1]for i in range(len(A)-1)] or [A[len(A)-(i+1)][i] == A[len(A)-(i+2)][i+1]for i in range(len(A)-1)]
  print("Yes")
#ダメ
else:
  print("No")


### FIXED CODE ###

from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  #穴をあける
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  
#bingoチェック
#中央が空いている
if A[1][1]==-1:
  #ななめ
  if A[0][0] == A[2][2] or A[0][2]==A[2][0]:
    print("Yes")
  #たてよこ
  elif A[0][1]==A[2][1] or A[1][0]==A[1][2]:
    print("Yes")
#中央が空いていない
else:
  #たて
  if A[0][0]==A[1][0] and A[1][0]==A[2][0] or A[0][2]==A[1][2]and A[1][2]==A[2][2]:
    print("Yes")
   #よこ
  elif len(Counter(A[0]))==1or len(Counter(A[2]))==1:
    print("Yes")
  else:
    print("No")
n=int(input())
vector1=[int(x) for x in input().split()]
vector2=[int(x) for x in input().split()]
for i in range(1,4):
print("{0:.8f}".format(sum([abs(a-b)**p for a,b in zip(vector1,vector2)])**(1/p)))
print("{0:.8f}".format(max([abs(a-b) for a,b in zip(vector1,vector2)])))

### FIXED CODE ###

n=int(input())
vector1=[int(x) for x in input().split()]
vector2=[int(x) for x in input().split()]
for i in range(1,4):
    print("{0:.8f}".format(sum([abs(a-b)**i for a,b in zip(vector1,vector2)])**(1/i)))
print("{0:.8f}".format(max([abs(a-b) for a,b in zip(vector1,vector2)])))
N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in N :
    str = input()
    if str == 'AC' :
        C0 += 1
    if str == 'WA' :
        C1 += 1
    if str == 'TLE':
        C2 += 1
    if str == 'RE' :
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))


### FIXED CODE ###

N = int(input())
C0 = 0
C1 = 0
C2 = 0
C3 = 0

for A in range(N) :
    B = input()
    if B == 'AC' :
        C0 += 1
    if B == 'WA' :
        C1 += 1
    if B == 'TLE':
        C2 += 1
    if B == 'RE' :
        C3 += 1

print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))
# C - Typical Stairs

MOD = 10 ** 9 + 7
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
dp = [None] * (N + 1)

def f(i):
    if dp[i] != None:
        return dp[i]
    else:
        if i in A:
            dp[i] = 0
        elif i < 2:
            dp[i] = 1
        else:
            dp[i] = (f(i - 1) + f(i - 2)) % MOD
        return dp[i]

print(f(N))


### FIXED CODE ###

# C - Typical Stairs

MOD = (10 ** 9) + 7
N, M = map(int, input().split())
A = [False] * (N + 1)
for _ in range(M):
    A[int(input())] = True
dp = [0] * (N + 1)
dp[0] = 1
if A[1] == False:
    dp[1] = 1

for i in range(2, N + 1):
    if A[i] == True:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])
H,W = map(int, input().split())
h.w = map(int, input().split())
print(H*W -h*W-w*H+h*w)

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())
print(H*W-h*W-w*H+w*h)
N = int(input())
S = []

dic = dict()

for _ in range(N):
	s = ''.join(sorted(input()))
	
	if not s in dic:
		dic[s] = 0
	else:
		dic[s] += 1
	
ans = 0

for val in dic.values():
	if val > 1:
		ret += (val * (val - 1)) / 2
		
print(int(ans))

### FIXED CODE ###

N = int(input())
S = []

dic = dict()

for _ in range(N):
	s = ''.join(sorted(input()))
	
	if not s in dic:
		dic[s] = 1
	else:
		dic[s] += 1
	
ans = 0

for key, val in dic.items():
	if val > 1:
		ans += (val * (val - 1)) / 2
		
print(int(ans))
from collections import deque
K = int(input())
q = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]])
cnt = 0
while cnt != K:
    nums = q.popleft()
    last = nums[-1]
    if last == 9:
        tmp = nums.copy()
        tmp.append(8)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(9)
        q.append(tmp)
    elif last == 0:
        tmp = nums.copy()
        tmp.append(0)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(1)
        q.append(tmp)
    else:
        tmp = nums.copy()
        tmp.append(last-1)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last+1)
        q.append(tmp)

    cnt += 1
ans = 0
l = len(nums)
for i in range(l):
    ans += nums[i]*10**(l-i-1)
print(ans)

### FIXED CODE ###

from collections import deque
K = int(input())

dp = [[0]*10 for _ in range(17)]
for i in range(10):
    dp[0][i] = 1

for keta in range(1, 17):
    for i in range(10):
        if 1 <= i and i <= 8:
            dp[keta][i] += dp[keta-1][i-1]+dp[keta-1][i]+dp[keta-1][i+1]
        if i == 0:
            dp[keta][i] += dp[keta-1][0]+dp[keta-1][1]
        if i == 9:
            dp[keta][i] += dp[keta-1][9]+dp[keta-1][8]
SUM = 0
for keta in range(17):
    SUM += sum(dp[keta][1:])
    if SUM >= K:
        break
SUM = 0
for i in range(keta):
    SUM += sum(dp[i][1:])

r = K-SUM
tmp_r = 0
for i in range(1, 10):
    tmp_r += dp[keta][i]
    if tmp_r >= r:
        tmp_r -= dp[keta][i]
        r -= tmp_r
        break
keta += 1
if keta == 1:
    print(i)
else:
    l=[i]
    rr = 0
    for k in range(keta-1, 0, -1):
        q = deque()
        if i == 0:
            q.append(0)
            q.append(1)
        elif i == 9:
            q.append(8)
            q.append(9)
        else:
            q.append(i-1)
            q.append(i)
            q.append(i+1)
        while q:
            num = q.popleft()
            rr += dp[k-1][num]
            if rr >= r:
                rr -= dp[k-1][num]
                l.append(num)
                i = num
                break
    keta = len(l)
    ans = 0
    for i in range(keta):
        ans += l[keta-i-1]*10**i
    print(ans)
n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = int(str[0])
  k = int(str[1])
  for j in range(k):
    v = int(str[2+j])
    c = int(str[3+j])
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]

d[0] = 0
color[0] = 1

while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
    print minv
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])

### FIXED CODE ###

n = input()
inf = 1000000000
M = [[inf for i in range(n)] for i in range(n)]
for i in range(n):
  str = map(int, raw_input().split())
  u = str[0]
  k = str[1]
  for j in range(k):
    v = str[2+2*j]
    c = str[3+2*j]
    M[u][v] = c
d = [inf for i in range(n)]
color = [0 for i in range(n)]
 
d[0] = 0
color[0] = 1
 
while 1:
  minv = inf
  u = -1
  for i in range(n):
    if minv>d[i] and color[i]!=2:
      u = i
      minv = d[i]
  if u == -1:
    break
  color[u] = 2
  for v in range(n):
    if color[v]!=2 and M[u][v]!=inf:
      if d[v]>d[u]+M[u][v]:
        d[v] = d[u] + M[u][v]
        color[v] = 1
for i in range(n):
  if d[i]==inf:
    print '%d -1' % i
  else:
    print '%d %d' % (i, d[i])
import sys
input = sys.stdin.readline
import itertools

N = int(input())
A = [int(x) for x in input().split()]

# B_x = max {A_y | y\subset x}
# と思ったが、2元ずつ持つ必要がある。
# (値、何番から来たか)
B = []
for n,a in enumerate(A):
    se = set([(a,n)])
    m = n
    while m:
        bit = m & (-m)
        se |= set(B[n - bit])
        m -= bit
    B.append(sorted(se, reverse=True)[:2])

answer = itertools.accumulate([x+y for (x,i),(y,j) in B[1:]], max)
print('\n'.join(map(str,answer)))

### FIXED CODE ###

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

N = int(input())
A = [int(x) for x in input().split()]

# B_x = max {A_y | y\subset x}
# と思ったが、2元ずつ持つ必要がある。
# (値、何番から来たか)
B = []
for n,a in enumerate(A):
    arr = [(0,0),(a,n)]
    m = n
    while m:
        bit = m & (-m)
        (x,i),(y,j) = B[n-bit]
        if (x,i) != arr[-1]:
            heappushpop(arr,(x,i))
        if (y,j) != arr[-1]:
            heappushpop(arr,(y,j))
        m -= bit
    B.append(arr)

answer = [0]
for (x,i),(y,j) in B[1:]:
    z = answer[-1]
    if z < x + y:
        z = x + y
    answer.append(z)
print('\n'.join(map(str,answer[1:])))
n = int(input())
s = str(input())

ans_s = s
ans_head = 0
ans_tail = 0

def remove(s):
    while True:
        if len(s) <= 0:
            break
        pre_len = len(s)
        s = s.replace("()", "")
        if len(s) == pre_len:
            break
    return s

while len(s) > 0:
    s = remove(s)
    if s[0] == ')':
        ans_head += 1
        s = remove('(' + s)
    else:
        ans_tail += 1
        s = remove(s + ')')
    # print(s)
print('('*ans_head + ans_s + ')' * ans_tail)



### FIXED CODE ###

n = int(input())
s = str(input())

ans_s = s
ans_head = 0
ans_tail = 0

def remove(s):
    while True:
        if len(s) <= 0:
            break
        pre_len = len(s)
        s = s.replace("()", "")
        if len(s) == pre_len:
            break
    return s

s = remove(s)
while len(s) > 0:
    s = remove(s)
    if s[0] == ')':
        ans_head += 1
        s = remove('(' + s)
    else:
        ans_tail += 1
        s = remove(s + ')')
    # print(s)
print('('*ans_head + ans_s + ')' * ans_tail)
d = int(input())
a=['Christmas']
for i in range(25-d):
  a.append('Eve')
print(' '.join())

### FIXED CODE ###

d = int(input())
a=['Christmas']
for i in range(25-d):
  a.append('Eve')
print(' '.join(a))
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for i in A[:-1]:
    a+=B[i-1]   
if A[-1]==N:
    a+=B[A[-1]]
else:
    a+=B[A[-1]-1]+C[A[-2]-1]
print(a)

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C=list(map(int, input().split()))
a=0
for co,i in enumerate(A):
    if co==0 :
        a+=B[i-1]
    if co>=1 :
        if A[co-1]+1==A[co]:
            a+=B[i-1]
            a+=C[A[co-1]-1]
        else:
            a+=B[i-1]
print(a)
import math
S = input()
K = int(input())
i = 0
while True:
    d = int(math.log(int(S[i]))*10**15)
    if d<K:K-=d
    else:break
    i += 1
print(S[i])

### FIXED CODE ###

S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        break
print(S[i])
does not name a type

### FIXED CODE ###

N = int(input())

def main():
    if N%2 == 0:
        print(int(N/2))
    
    else:
        print(int(N/2)+1)

                
if __name__ == "__main__":
    main()
n, m = map(int, input().split())
ans = [i for i in range(1, n + 1)]

for _ in range(m):
    x, y = map(int, input().split())
    tmp = [i for i in range(x, y + 1)]
    for ele in tmp:
        ans.remove(ele)
print(n - len(ans))

### FIXED CODE ###

n, m = map(int, input().split())
ans = [i for i in range(1, n + 1)]

l_max = 0
r_min = n

for _ in range(m):
    x, y = map(int, input().split())
    l_max = max(l_max, x)
    r_min = min(r_min, y)

print(len([i for i in range(l_max, r_min + 1)]))
import numpy as np;
from numba import jit
import warnings
from operator import mul
from functools import reduce
warnings.simplefilter('ignore')
    

if __name__ == '__main__':
    N = int(input())
    A = map(int, input().split())
    ans = reduce(mul, A)
    if ans > 10 ** 18:
        print(-1)
        quit()
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 1
for a in A:
    ans *= a
    if ans > 1000000000000000000:
            print(-1)
            quit()
print(ans)
N,M=map(int,input().split())
ans = list(input().split() for i in range(M))
count = 0
hantei = []
cnt = 0
for i in range(len(ans)):
    if ans[i][1]=="AC":
        count += 1
        hantei.append(ans[i][0])

    else:
        cnt += 1
kotae = set(hantei)
kari=[ans[i][1] for i in range(len(ans))]
kari.reverse()

print(count-(count-len(kotae)),cnt-kari.index("AC"))

### FIXED CODE ###

N,M=map(int,input().split())
PS=[input().split() for i in range(M)]
ACzumi=set()
WA_count=[]
for i in range(M):
    if not PS[i][0] in ACzumi:
        if PS[i][1]=="AC":
            ACzumi.add(PS[i][0])
        else:
            WA_count.append(PS[i][0])
yokei=0            
for i in range(len(WA_count)):
    if not WA_count[i] in ACzumi:
        yokei+=1
        
#print(ACzumi)
print(len(ACzumi),len(WA_count)-yokei)
x,D,xx=map(int,input().split())
for i for range(10):
  xx = x*xx-D
  print(xx)

### FIXED CODE ###

x,D,xx=map(int,input().split())
for i in range(10):
  xx = x*xx-D
  print(xx)
ui = input()

A, B = int(ui.split()[0]), int(ui.split()[1])

def return_ans(A, B):
    if A > 8 or B > 8:
        return ':('
    else:
        return 'Yay!'

a = return_and(A,B)
print(a)

### FIXED CODE ###

ui = input()
D, N = int(ui.split()[0]), int(ui.split()[1])
if D <= 8 and N <= 8:
    print('Yay!')
else:
    print(':(')
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
booka = 0
bookb = 0
booknum = 0
time = 0
ba=0
bb=0
lim = 0
while True:
    if booka >= N:
        while time<=K and bookb<M:
            bb += 1
            time += B[bookb]
            bookb += 1
        break
    if bookb>=M:
        while time<=K and booka<N:
            ba += 1
            time += A[booka]
            booka += 1
        break
    if A[booka]<B[bookb]:
        if A[booka]+A[booka+1] > B[bookb]+B[bookb+1]:
            time += B[bookb]
            bookb += 1
        else:
            time += A[booka]
            booka += 1
    else:
        if A[booka]+A[booka+1] <= B[bookb]+B[bookb+1]:
            time += A[booka]
            booka += 1
        else:
            time += B[bookb]
            bookb += 1
    if time >K:
        break
    booknum += 1
    while (booka == N-1 or bookb == M-1):
        if A[booka]<B[bookb]:
            time += A[booka]
            booka += 1
            if time > K:
                booknum += 1
        else:
            time += B[bookb]
            bookb += 1
            if time > K:
                booknum += 1
if time > K and (bb!=0 or ba!=0):
    booknum-=1
booknum += (ba+bb)

print(booknum)


### FIXED CODE ###

def getmax(x,y):
    if x>y:
        return x
    else:
        return y
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a,b = [0],[0]
for i in range(N):   #a[i]にはAの本をi冊読んだ時の時間がそれぞれ保存されている．
    a.append(a[i]+A[i])  #計算量を減らすため，a[i]（1冊前までにかかる時間）を用いる
for i in range(M):
    b.append(b[i]+B[i])

ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j] > K-a[i]:    #Bの本を読んだ場合の処理はここで実行される．
        j -=1
    ans = max(ans, i+j)
print(ans)
def resolve():
    a, b, k = map(int, input().split())
    L = []
    i = 1
    while len(L) < k:
        if a%i == 0 and b%i == 0:
            L.append(i)
        i += 1
    print(L[K-1])
resolve()    

### FIXED CODE ###

def resolve():
    a, b, k = map(int, input().split())
    t = []
    for i in range(1, min(a,b)+1):
        if a % i == 0 and b % i == 0:
            t.append(i)
    print(t[-k])
resolve()
N = int(input())
cnt = 0
for i in range(1, N + 1):
  k = 0
  for j in range(1, N + 1):
   	if i % j == 0:
      k += 1
  if k == 8:
    cnt += 1

print(cnt)
  

### FIXED CODE ###

N = int(input())
cnt = 0
for i in range(1, N + 1, 2):
    k = 0
    for j in range(1, i + 1):
        if i % j == 0:
            k += 1
    if k == 8:
        cnt += 1
print(cnt)
S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + 10 ** i * int(x) % 2019
 #   print(tmp % 2019)
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  return n * (n - 1) // 
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
#print(L,c)
print(int(ans))

### FIXED CODE ###

S = input()
S = S[::-1]
L = [0]
i = 0
for x in S:
    tmp = L[-1] + pow(10, i , 2019) * int(x) 
    L.append(tmp % 2019)
    i += 1
L = sorted(L[1::])
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(L)
from math import factorial
def comb(n,r):
    if n == 1: return 0
    return  n * (n - 1) // 2
ans = 0
for x in c:
    if x[0] == 0: ans += x[1]
    ans += comb(x[1],2)
print(int(ans))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(1,min(a)+1):
	if i in b:
		b.remove(i)
for i in range(1,min(b)+1):
	if i in c:
		c.remove(i)
count=0
for i in range(n):
	for j in range(n):
		if a[i]<b[j]:
			for k in range(n):
				if b[j]<c[k]:
					count+=1
print(count)			

### FIXED CODE ###

import bisect
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in B:
  a=bisect.bisect_left(A,i)
  b=N-bisect.bisect_right(C,i)
  ans+=a*b
print(ans)
print('Input x')
x = int(input())

while x <1 | x > 100
     print('Input x again:')
     x = int(input())

print(x ** 3)

### FIXED CODE ###

x = int(input())

print(x **3)
N = int(input())
A = list(map(int,input().split()))
def yabaton(A):
  for i in range(0,n-1):
    for j in range(i+1,n):
      if A[i] == A[j]:
        return 'NO'
  return 'YES'
yabaton(A)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = "YES"
for i in range(1,N):
    if A[i-1] == A[i]:
        ans = "NO"
        break
print(ans)
S=input()
if S=="ABC":
  print("ARC")
if S=="ARC"
  print("ABC")

### FIXED CODE ###

S=input()
if S=="ABC":
  print("ARC")
else:
  print("ABC")
x,y = map(int, input().split())
import math
print(math.celi((x+y)/2))

### FIXED CODE ###

x,y = map(int, input().split())
z =x+y
import math
print(math.ceil(z/2))
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
TXY.insert(0,[0,0,0])

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point += 1

for i in range(N):
    if point_a == 0 and (TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
TXY.insert(0,[0,0,0])

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point_a += 1

for i in range(N):
    if point_a == 0 and ((TXY[i+1][0] - TXY[i][0]) % 2 != (abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2])) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')
Row,Col,Ichigo=map(int,input().split())

List=[[j for j in input().split()] for i in range(Row)]

cnt = 1
add = 0

ans = []

for i in range(Row):
  
  arr = list(List[i][0])
  ans_arr = []
  
  if "#" in arr:
    for j in range(Col):
      str = arr[j]
      if str == "#":
        cnt = cnt + add
        ans_arr.append(cnt)
        add = 1
      else :
        ans_arr.append(cnt)
  
  else:
    cnt = cnt - 1
    ans_arr.append(-1)
    
  cnt = cnt + 1
  ans.append(ans_arr)
  add = 0 
  
for i in range(Row):
  
  arr = ans[Row - i - 1][0]
  if arr == - 1 :
    ans_arr = ans[Row - i ]
    ans[Row - i - 1] = ans_arr
  
for List in ans:
    print(*List)

### FIXED CODE ###

Row,Col,Ichigo=map(int,input().split())

List=[[j for j in input().split()] for i in range(Row)]

cnt = 1
add = 0

ans = []

for i in range(Row):
  
  arr = list(List[i][0])
  ans_arr = []
  
  if "#" in arr:
    for j in range(Col):
      str = arr[j]
      if str == "#":
        cnt = cnt + add
        ans_arr.append(cnt)
        add = 1
      else :
        ans_arr.append(cnt)
  
  else:
    cnt = cnt - 1
    ans_arr.append(-1)
    
  cnt = cnt + 1
  ans.append(ans_arr)
  add = 0 
  
for i in range(Row):
  
  arr = ans[Row - i - 1][0]
  if arr == - 1 and Row - i != Row:
    
    ans_arr = ans[Row - i ]
    ans[Row - i - 1] = ans_arr
    
  elif i == 0 and ans[Row-1][0] == -1:
    ans_arr = ans[Row - 2 ]
    ans[Row - 1] = ans_arr
    
for i in range(Row):
  
  arr = ans[i][0]
  if arr == - 1:
    ans_arr = ans[i-1]
    ans[i] = ans_arr
    
for List in ans:
    print(*List)
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = a*k
cnt = 0
for i in range(len(b)-1):
  for j in range(i+1,len(b)):
    if b[i] > b[j]:
      cnt += 1
x = 10**9 + 7
print(cnt%x)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n,k = map(int,input().split())
a = list(map(int,input().split()))
cnt1 = 0
for i in range(n-1):
  for j in range(i+1,n):
    if a[i] > a[j]:
      cnt1 += 1
cnt1 = cnt1*k

cnt2 = 0
for l in range(n):
  for m in range(n):
    if a[l] > a[m]:
      cnt2 += 1
cnt2 = cnt2*k*(k-1)//2

cnt = cnt1 + cnt2

x = 10**9 + 7
print(int(cnt%x))
N, A, B = map(int, input().split())

sum = 0
for i in range(1, N+1):
    if A <= sum(list(map(int, str(i)))) <= B:
        sum += i

print(sum)

### FIXED CODE ###

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

total = 0
for i in range(1, n+1):
    if a <= sum(list(map(int, str(i)))) <= b:
        total += i

print(total)
a, b = map(int, input.split())
print(int(a * b))


### FIXED CODE ###

sa, sb = input().split()
a = int(sa)
b = int(sb.replace('.', ''))
print(a * b // 100)
N=int(input())
LA=list(map(int,input().split()))

p_m=1
for n in range(N):
    p_m*=LA[n]
    
LA_absolute=[i*(-1) if i<0 else i for i in LA]


if p_m>=0:
    print(sum(LA_absolute))
else:
    print(sum(LA_absolute)-2*min(LA_absolute))

### FIXED CODE ###

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

print(B*(T//A))
# -*- coding: utf-8 -*-

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

def comp(a, b):
        if a>b:
                return "a > b"
        elif a<b:
                return "a < b"
        else:
                return "a == b"

print(demp(a,b))

### FIXED CODE ###

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

def comp(a, b):
        if a>b:
                return "a > b"
        elif a<b:
                return "a < b"
        else:
                return "a == b"

print(comp(a,b))
def main():
    a,b = map(int, input().split())
    print(int(a*b))
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    a,b = input().split()
    a = int(a)
    b = int(b.replace('.', ''))
    print(a*b//100)
if __name__ == "__main__":
    main()