Harryxun/stf_run huggingface dataset:
def root(x):#親のrootはマイナスのサイズ、子のrootは親のindex
  if par[x]<0:
    return x
  else:
    return par[x]=root(par[x])

def unit(x,y):#xとyをくっつける
  rx=root(x)
  ry=root(y)
  if rx==ry:
    return False
  if par[rx]>par[ry]:#親のサイズの大小比較
    rx,ry=ry,rx#xのサイズのほうが大きくする
  par[rx]+=par[ry]#xのサイズにyのサイズを足す(サイズの変換)
  par[ry]=x#親じゃなくなったroot(y)の値をxの根にする
  return True

def same(x,y):
  rx=root(x)
  ry=root(y)
  return rx==ry#真偽を返す

def size(x):
  return -par[root(x)]#親のrootはマイナスのサイズなため

N,M,K=map(int,input().split())
par=[-1]*N
deg=[0]*N
bro=[[]*N for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  a-=1
  b-=1
  deg[a]+=1
  deg[b]+=1
  unit(a,b)
for i in range(K):
  a,b=map(int,input().split())
  a-=1
  b-=1
  bro[a].append(b)
  bro[b].append(a)

for i in range(N):
  ans=size[i]-deg[i]-1
  for j in bro[i]:
    if same(i,j):
      ans-=1
  print(ans,end=" ")


### FIXED CODE ###

class Union_Find():
    def __init__(self,n):
        self.n=n
        self.par=[-1]*n
    def root(self,x):
        if self.par[x]<0:
            return x
        else:
            self.par[x]=self.root(self.par[x])
            return self.par[x]
    def union(self,x,y):
        rx=self.root(x)
        ry=self.root(y)
        if rx==ry:
            return
        if self.par[rx]>self.par[ry]:
            rx,ry=ry,rx
        self.par[rx]+=self.par[ry]
        self.par[ry]=rx

    def size(self,x):
        return -self.par[self.root(x)]

    def same(self,x,y):
        return self.root(x)==self.root(y)
N,M,K=map(int,input().split())
deg=[0]*N
bro=[[]*N for _ in range(N)]
uf=Union_Find(N)
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    deg[a]+=1
    deg[b]+=1
    uf.union(a,b)
for j in range(K):
    a,b=map(int,input().split())
    a-=1
    b-=1
    bro[a].append(b)
    bro[b].append(a)

for q in range(N):
    ans=uf.size(q)-deg[q]-1
    for w in bro[q]:
        if uf.same(q,w):
            ans-=1
    print(ans,end=" ")
n, k = map(int,input())
print(n - (k-1))

### FIXED CODE ###

n, k = map(int,input().split())
print(n - (k-1))
n, m = map(int, input().split())
abc = [list(map(int, input().split())) for x in range(m)]
 
nodemap = [[] for x in range(n + 1)]
 
for a, b, c in abc:
    nodemap[a].append([a, b, c])

changed = False

calced = [None for x in range(n + 1)]
calced[1] = 0

for i in range(n - 1):
    changed = False
    for nodes in nodemap:
        for node in nodes:
            now, nextnode, addvalue = node
            if calced[nextnode] == None or calced[nextnode] < calced[now] + addvalue:
                calced[nextnode] = calced[now] + addvalue
                changed = True
print("inf" if changed else calced[n])


### FIXED CODE ###

n, m = map(int, input().split())
abc = [list(map(int, input().split())) for x in range(m)]
nodes = [[] for x in range(n + 1)]

for a, b, c in abc:
    nodes[a].append([a, b, -c])

costs = [None for x in range(n + 1)]
costs[1] = 0
flg = True
for i in range(n):
    for a, b, c in abc:
        if costs[a] == None:
            continue
        if costs[b] == None or costs[b] < costs[a] + c:
            flg = False
            costs[b] = costs[a] + c
    # for node in nodes[1:]:
    #     for a, b, c in node:
    #         if costs[a] == None:
    #             continue
    #         if costs[b] == None or costs[b] > costs[a] + c:
    #             flg = False
    #             costs[b] = costs[a] + c
#     if flg:
#         print(costs[n])
#         break
#     flg = True
# else:
#     print("inf")

ans = costs[n]
negative = [False for x in range(n + 1)]
for i in range(n - 1):
    for a, b, c in abc:
        if costs[a] == None:
            continue
        if costs[b] == None or costs[b] < costs[a] + c:
            costs[b] = costs[a] + c
            negative[b] = True

        if negative[a] == True:
            negative[b] = True

print(negative[n] and "inf" or ans)
N = int(input())

count = 0
for a in range(1, N):
    ans, mod = divmod(N, a)
    if mod == 0:
        count += ans - 1
    else:
        count += ans

print(count)

### FIXED CODE ###

a = input()

if a[-1] == "s":
    print(a + "es")
else:
    print(a + "s")
A,B,C = [int(i) for i in input().split(' ')]


A, B = B, A
A, C = C, A

print(f'{A} {B} {C}')



### FIXED CODE ###

A,B,C = [int(i) for i in input().split(' ')]


A, B = B, A
A, C = C, A

print('{} {} {}'.format(A, B, C))
N,L=map(int,input().split())
LL=[L+i for i in range(N)]
LLL=[abs(L+i) for i in range(N)]

if N+L<0:
  print(sum(LL)+min(LLL))
elif N+L=0:
  print(sum(LL))
else:
  print(sum(LL)-min(LLL))

### FIXED CODE ###

N,L=map(int,input().split()) 
LL=[L+i for i in range(N)]
if L>=1:
  print(sum(LL)-min(LL))
elif N+L>0:
  print(sum(LL))
else:
  print(sum(LL)-max(LL))
N, M = map(int, input().split())
L = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    L[a].append(b)
    L[b].append(a)

ans = [0 for _ in range(N+1)]
now = [1]
next = []

while len(now):
    for x in now:
        for y in L[x]:
            if (ans[y] == 0):
                ans[y] = x
                next.append(y)
    now = next.copy()
    next = []

print("Yes")
for x in range(2, N+1):
    print(ans[x])


### FIXED CODE ###

N = input()
ans = ""
if N[-1] in ("2", "4", "5", "7", "9"):
    ans = "hon"
elif N[-1] in ("0", "1", "6", "8"):
    ans = "pon"
elif N[-1] in ("3"):
    ans = "bon"

print(ans)
#!/usr/bin/env python3

H, W = map(int, input().split(' '))
matrix = []
for _ in range(W):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        flag = True
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    print('No')
                    exit(0)

print('Yes')


### FIXED CODE ###

H, W = map(int, input().split(' '))
matrix = []
for _ in range(H):
    tmp = [0 if j == '.' else 1 for j in input()]
    matrix.append(tmp)

flag = 'Yes'
for i, row in enumerate(matrix):
    for j, s in enumerate(row):
        if s == 1:
            if (j > 0 and row[j-1] == 0) and (j < W - 1 and row[j+1] == 0):
                if (i > 0 and matrix[i-1][j] == 0) and (i < H - 1 and matrix[i+1][j] == 0):
                    flag = 'No'
                    break

print(flag)
H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    S.append(s)
for i in range(H):
    for j in range(W):
        if S[j][i]==".":
            continue
        l=[(j-1,i),(j+1,i),(j,i+1),(j,i-1)]
        koritu=True
        for y,x in l:
            if 0<=y<=H-1 and  0<=x<=W-1:
                koritu=koritu and S[y][x]=="."
        if koritu:
            print("No")
            quit()
print("Yes")


### FIXED CODE ###

H,W=map(int,input().split())
S=[]
for i in range(H):
    s=input()
    S.append(s)
for i in range(H):
    for j in range(W):
        if S[i][j]==".":
            continue
        l=[(j-1,i),(j+1,i),(j,i+1),(j,i-1)]
        koritu=True
        for x,y in l:
            if 0<=y<=H-1 and  0<=x<=W-1:
                koritu=koritu and S[y][x]=="."
        if koritu:
            print("No")
            quit()
print("Yes")
N, K = input().split()
N = int(N)
K = int(K)
S = input()
A = []
for i in range(len(S)-1):
    if (S[i]=="0" and S[i+1]=="1") or (S[i]=="1" and S[i+1]=="0"):
        A.append(i+1)
A.insert(0, 0)
A.append(N)
if K > len(A)//2:
    K = len(A)//2
M = []
while K > 0:
    if S[0] == "0":
        M.append(A[K*2]-A[0])
        a = 1
        b = a + K*2 + 1
    elif S[0] == "1":
        a = 0
        b = a + K*2 + 1
    if S[-1] == "1":
        while b <= len(A):
            M.append(A[b]-A[a])
            a += 2
            b = a + K*2 + 1
    elif S[-1] == "0":
        while b <= len(A)-1:
            M.append(A[b]-A[a])
            a += 2
            b = a + K*2 + 1
        M.append(A[-1]-A[-1-K*2])
    K -= 1
    print(max(M))

### FIXED CODE ###

N, K = input().split()
N = int(N)
K = int(K)
S = input()
A = []
for i in range(len(S)-1):
    if (S[i]=="0" and S[i+1]=="1") or (S[i]=="1" and S[i+1]=="0"):
        A.append(i+1)
A.insert(0, 0)
A.append(N)
M = []
if S == "0"*N:
    M.append(len(S))
elif S[0] == "0":
    if K > len(A)//2:
        K = len(A)//2
    M.append(A[K*2]-A[0])
    a = 1
    b = a + K*2 + 1
elif S[0] == "1":
    if K > (len(A)-1)//2:
        K = (len(A)-1)//2
    a = 0
    b = a + K*2 + 1
if S == "0"*N:
    pass
elif S[-1] == "1":
    while b <= len(A):
        M.append(A[b]-A[a])
        a += 2
        b = a + K*2 + 1
elif S[-1] == "0":
    while b <= len(A)-1:
        M.append(A[b]-A[a])
        a += 2
        b = a + K*2 + 1
    M.append(A[-1]-A[-1-K*2])
print(max(M))
n = int(input())
x, y = [], []
for i in range(n)
  x_, y_ = map(int, input().split())
  x.append(x_)
  y.append(y_)
for i in range(n-2)
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    print("Yes")
    break
  else:
    print("No")

### FIXED CODE ###

n = int(input())
x, y = [], []
for i in range(n):
  x_, y_ = map(int, input().split())
  x.append(x_)
  y.append(y_)
for i in range(n-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    print("Yes")
    break
else:
  print("No")
import sys
sys.setrecursionlimit(10000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

N, M = map(int, input().split())
if M % 2 == 1:
  print(-1)
  exit()
  
E = []
A = [[] for _ in range(N)]
for _ in range(M):
  i, j = map(int, input().split())
  E.append([i-1, j-1])
  A[i-1].append(j-1)
  A[j-1].append(i-1)

tree = [[] for _ in range(N)]
visited = [False] * N
queue = [0]
visited[0] = True
while queue:
  i = queue.pop()
  for j in A[i]:
    if not visited[j]:
      tree[i].append(j)
      tree[j].append(i)
      visited[j] = True
      queue.append(j)

D = [0] * N
for i, j in E:
  if i not in tree[j]:
    print(i+1, j+1)
    D[i] += 1

def f(parent, i):
  for j in tree[i]:
    if j == parent:
      continue
    f(i, j)
    if D[j] % 2 == 0:
      print(i+1, j+1)
      D[i] += 1
    else:
      print(j+1, i+1)
      D[j] += 1
  return

f(0, 0)
def input_num(infile,outfile):
	num = int(infile.readline())
	return num

def makedict(infile,outfile,n):
	dict = {}
	for i in range(n):
		key,val = infile.readline().split()
		dict[key] = val
	return dict

def replace(infile,outfile,dict,m):
	for i in range(m):
		x = infile.readline().sprit()[0]
		x = dict.get(x,x)
		outfile.write(x)
	print >> outfile

if __name__ == "__main__"
	import sys
	while True:
		n = input_num(sys.stdin,sys.stdout)
		if n == 0:
			break
		dict = makedict(infile,outfile,n)
		# dict.update(makedict(infile,outfile,n))
		m = input_num(sys.stdin,sys.stdout)
		replace(infile,outfile,dict,m)

### FIXED CODE ###

def convert(infile, outfile, n):
    dictionary = {}
    for i in range(n):
        key, val = infile.readline().split()
        dictionary[key]=val
    m = int(infile.readline())
    for j in range(m):
        x = infile.readline().split()[0]
        outfile.write(dictionary.get(x, x))
    print >> outfile
 
def run(infile, outfile):
    while True:
        n = int(infile.readline())
        if n == 0:
            break
        convert(infile, outfile, n)
 
if __name__ == "__main__":
    import sys
    run(sys.stdin, sys.stdout)
n = int(input())  # nは入力回数
str_list = [input() for _ in range(n)]
print(str_list)   # 出力を確認

a=0
b=0
c=0                
d=0                
                
for num in range(1, n)
    if str_list[num] == 'AC':
                a += 1
    elif str_list[num] == 'WA':
                b += 1
    elif str_list[num] == 'TLE':
                c +=1
    else str_list[num] == 'RE':
                d +=1
    	continue;

print('AC x'+ a)
print('WA x'+ b)
print('TLE x'+ c)
print('RE x'+ d)


### FIXED CODE ###

n = int(input())
str_list = [input() for _ in range(n)]


a=0
b=0
c=0                
d=0                
                
for i in range(n):
    if str_list[i] == 'AC':
    	a += 1
    elif str_list[i] == 'WA':
    	b += 1
    elif str_list[i] == 'TLE':
    	c +=1
    else :
    	d +=1

print('AC x '+ str(a))
print('WA x '+ str(b))
print('TLE x '+ str(c))
print('RE x '+ str(d))
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def calc_sum_of_power(N, coord):
    spot = round(sum(coord)/N)
    return sum([(x - spot)**2 for x in coord])

def main():
    N = int(input())
    X = map(int, input().split())
    print( (n))

if __name__ == "__main__":
    try:
        assert calc_sum_of_power(2, [1, 4]) == 5
        assert calc_sum_of_power(7, [14, 14, 2, 13, 56, 2, 37]) == 2354
    except:
        import traceback
        traceback.print_exc()
        exit()
    main()


### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def calc_sum_of_power(N, coord):
    spot = round(sum(coord)/N)
    return sum([(x - spot)**2 for x in coord])

def main():
    N = int(input())
    coord = list(map(int, input().split()))
    print(calc_sum_of_power(N, coord))

if __name__ == "__main__":
    try:
        assert calc_sum_of_power(2, [1, 4]) == 5
        assert calc_sum_of_power(7, [14, 14, 2, 13, 56, 2, 37]) == 2354
    except:
        import traceback
        traceback.print_exc()
        exit()
    main()
import numpy as np
n = int(input())
aa = np.array(list(map(int,input().split())))

ans = float('inf')
for i in range(min(aa),max(aa)+1):
  ans = min(ans,sum((aa-i)**2))
  
print(ans)  

### FIXED CODE ###

import numpy as np
n = int(input())
aa = np.array(list(map(int,input().split())))

ans = float('inf')
for i in range(min(aa),max(aa)+1):
  ans = min(ans,sum((aa-i)**2))
  
print(ans)
def count(b, total, N):
    remain = N%total
    if remain < b:
        return remain
    else:
        return b

data = input()
N, b, r = [int(i) for i in data.split()]
 
ball = int(N/total) * b + count(b, b+r, N)
print(ball)

### FIXED CODE ###

def count(b, total, N):
  r = N%total
  if r < b:
    return r
  else:
    return b

data = input()
N, b, r = [int(i) for i in data.split()]

total = b + r

ball = int(N/total) * b + count(b, total, N)
print(ball)
s = input()
# s = "R"+"RL"*10000+"L"
step = np.max(list(map(len, s.split("RL"))))

n = len(s)
pop = [1]*n

if step%2 == 1:
    step = step+1
else:
    step = step

for t in range(step):
    new_pop = [0]*n
    for i in range(n):
        if s[i] == "R":
            new_pop[i+1] += pop[i]
        else:
            new_pop[i-1] += pop[i]
    pop = new_pop
print(" ".join(map(str, pop)))

### FIXED CODE ###

import numpy as np
s = input()
n = len(s)

pop = [0]*n

lastR = 0
for i in range(n):
    if s[i] == "L":
        if (lastR - i)%2 == 1:
            pop[lastR+1] += 1
        else:
            pop[lastR] += 1
    else:
        lastR = i
            
lastL = n
for i in range(n-1, -1, -1):  
    if s[i] == "R":
        if (lastL - i)%2 == 1:
            pop[lastL-1] += 1
        else:
            pop[lastL] += 1
    else:
        lastL = i
        
print(" ".join(map(str, pop)))
n,T = map(int,input().split())
ct = [[map(int,input().split())] for _ in range(n)]
cost = 9999
for i in range(n):
  c,t = ct[i][0],ct[i][1]
  if t<=T:
    cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')

### FIXED CODE ###

n,T = map(int,input().split())
ct = [list(map(int,input().split())) for _ in range(n)]
cost = 9999
for i in range(n):
    c,t = ct[i][0],ct[i][1]
    if t<=T:
        cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')
def solve(li):
    if len(li) == n:
        ans.append(li)
        return
    tmp = max(li)
    for i in range(1, tmp + 2):
        solve(li + [i])

ans = []
n = int(input())
solve([1])
res = []
alph = "abcdefghijklmnopq"

for ptn in ans:
    for i in range(n):
        ptn[i] = alph[ptn[i] - 1]
    res.append("".join(ptn))
res = sorted(res)
for i in res:
    print(i)  

### FIXED CODE ###

MAX_N = 2000
a = [ord(char) for char in input()]
b = [ord(char) for char in input()]
c = [ord(char) for char in input()]


len_a = len(a)
len_b = len(b)
len_c = len(c)

a = a + [63] * (MAX_N - len_a + 10)
b = b + [63] * (MAX_N - len_b + 10)
c = c + [63] * (MAX_N - len_c + 10)

ab = [True] * (2 * MAX_N + 10)
ba = [True] * (2 * MAX_N + 10)
bc = [True] * (2 * MAX_N + 10)
cb = [True] * (2 * MAX_N + 10)
ca = [True] * (2 * MAX_N + 10)
ac = [True] * (2 * MAX_N + 10)


for length in range(MAX_N + 1):
    for i in range(MAX_N + 1):
        if i + length > MAX_N:
            break

        if a[i + length] != b[i] and a[i + length] != 63 and b[i] != 63:
            ab[length] = False
        if b[i + length] != a[i] and b[i + length] != 63 and a[i] != 63:
            ba[length] = False

        if b[i + length] != c[i] and b[i + length] != 63 and c[i] != 63:
            bc[length] = False
        if c[i + length] != b[i] and c[i + length] != 63 and b[i] != 63:
            cb[length] = False

        if c[i + length] != a[i] and c[i + length] != 63 and a[i] != 63:
            ca[length] = False
        if a[i + length] != c[i] and a[i + length] != 63 and c[i] != 63:
            ac[length] = False


ans = MAX_N * 6
for len1 in range(MAX_N + 1):
    for len2 in range(MAX_N + 1):
        if ab[len1] and bc[len2] and ac[len1 + len2]:
            tmp = max(len_a, len_b + len1, len_c + len1 + len2)
            ans = min(ans, tmp)
        if ba[len1] and ac[len2] and bc[len1 + len2]:
            tmp = max(len_b, len_a + len1, len_c + len1 + len2)
            ans = min(ans, tmp)

for len1 in range(MAX_N + 1):
    for len2 in range(MAX_N + 1):
        if bc[len1] and ca[len2] and ba[len1 + len2]:
            tmp = max(len_b, len_c + len1, len_a + len1 + len2)
            ans = min(ans, tmp)
        if cb[len1] and ba[len2] and ca[len1 + len2]:
            tmp = max(len_c, len_b + len1, len_a + len1 + len2)
            ans = min(ans, tmp)

for len1 in range(MAX_N + 1):
    for len2 in range(MAX_N + 1):
        if ca[len1] and ab[len2] and cb[len1 + len2]:
            tmp = max(len_c, len_a + len1, len_b + len1 + len2)
            ans = min(ans, tmp)
        if ac[len1] and cb[len2] and ab[len1 + len2]:
            tmp = max(len_a, len_c + len1, len_b + len1 + len2)
            ans = min(ans, tmp)

print(ans)
N = int(input())
A = list(map(int,input().split()))
A.sort()
cnt = 0
onaji = 0

#数列Aを昇順に並べ替えた後、AjがAiの倍数になっていた時Ajをリストから削除する方針です。
for i in range(len(A)):
    if i >= len(A)-1:   #数列が小さくなって行くので当初のループ量は必要ないので。
        break
    for j in range(len(A)-1,i,-1):　#大きい数字から順番にみていく。
        if A[i] == A[j]:
            onaji = 1
        if A[j] % A[i] == 0:
            del A[j]
            
    if onaji == 1:　#同じ数字があった時Aiも削除。
        del A[i]
        onaji = 0

print(len(A))


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
OKlist = [0]*(10**6+100)
A.sort()
for i in range(len(A)-1):
    if A[i] == A[i+1]:
        OKlist[A[i]] += 1
    else:
        for j in range(10**6+10):
            if A[i]*j > 10**6:
                break
            else:
                OKlist[A[i]*j] += 1
OKlist[max(A)] += 1
cnt = 0
for i in A:
    if OKlist[i] == 1:
        cnt += 1
        
print(cnt)
print("Hello World!" if input()==1 else int(input())+int(input()))

### FIXED CODE ###

print("Hello World" if input()=='1' else int(input())+int(input()))
num = int(input())
for i in range(1, 9):
    if num / i in lst:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

num = int(input())
lst = list(range(1, 10))
count = 0
for i in lst:
    if num / i in lst:
        count += 1
if count > 0:
    print('Yes')
else:
    print('No')
a,b,c=input().split()
s[0]=int(a)+int(b)
s[1]=int(b)+int(c)
s[2]=int(c)+int(a)
print(min(s))

### FIXED CODE ###

a,b,c=input().split()
s=[0,0,0]
s[0]=int(a)+int(b)
s[1]=int(b)+int(c)
s[2]=int(c)+int(a)
print(min(s))
import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

H, W = map(int, input().split())
aHW = [list(input()) for _ in range(H)]
naHW = np.array(aHW)
# naHW = np.array(input(), object)
# print(naHW)

res = []
for h in aHW:
    if '#' in h:
        res.append(h)

res = list(zip(*res))
res2 = []
for h in res:
    if '#' in h:
        res2.append(h)

res2 = list(zip(*res2))

for h in res2:
    print(''.join(h))

### FIXED CODE ###

# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

H, W = map(int, input().split())
aHW = [list(input()) for _ in range(H)]

res = []
for h in aHW:
    if '#' in h:
        res.append(h)

res = list(zip(*res))
res2 = []
for h in res:
    if '#' in h:
        res2.append(h)

res2 = list(zip(*res2))

for h in res2:
    print(''.join(h))
a,b,c = map(int, raw_input().split)

count=0
for x in range(a,b+1):
    if  c%x == 0:
       count += 1
print(count)     
       

### FIXED CODE ###

a,b,c = map(int, raw_input().split())

count=0
for x in range(a,b+1):
    if  c%x == 0:
       count += 1
print(count)
import math
N, A, B = map(int, input().split())

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x // = 10
    if A <= SUM <= B:
        ans += num
        
print(ans)

### FIXED CODE ###

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

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x //= 10
    if A <= SUM <= B:
        ans += num
        
print(ans)