Harryxun/stf_run huggingface dataset:
n,m = [int(i) for i in input().split()]
a = list(map(int,input().split()))

match = [0,2,5,5,4,5,6,3,7,6]

dig = [0] * (n+1)

inf = 10**9


for i in range(1,n+1):
    lst = []
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i-mat
        if bef >= 0:
            lst.append(dig[bef])
        if lst:
            dig[i] = max(lst) + 1

ans = ""
def dp(i):
    if i == 0:
        return
    global ans
    maxi = 0
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if bef >= 0:
            if dig[i] == 1:
                if bef == 0:
                    maxi = max(maxi,num)
                    k = 0
            else:
                if dig[bef] == dig[i]-1:
                    if num > maxi:
                        maxi = num
                        k = bef
    ans += str(maxi)
    dp(k)

dp(n)
print(ans)

### FIXED CODE ###

n,m = [int(i) for i in input().split()]
a = list(map(int,input().split()))

import sys
sys.setrecursionlimit(50000)

match = [0,2,5,5,4,5,6,3,7,6]

dig = [0] * (n+1)

inf = 10**9


for i in range(1, n + 1):
    lst = []
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if bef >= 0:
            if bef == 0:
                lst.append(dig[bef])
            else:
                if dig[bef] > 0:
                    lst.append(dig[bef])
        if lst:
            dig[i] = max(lst) + 1


ans = ""


def dp(i):
    k = -1
    if i == 0:
        return
    global ans
    maxi = 0
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if dig[i] == 1:
            if bef == 0:
                maxi = max(maxi, num)
                k = 0
        else:
            if bef >= 0:
                if dig[bef] == dig[i] - 1:
                    if num > maxi:
                        maxi = num
                        k = bef
    ans += str(maxi)
    if k >= 0:
        dp(k)


dp(n)
print(ans)
A = int(input())
B = int(input())
C = (A + B)

if(C%2 == 1):
    print("IMPOSSIBLE")
else:
    K = C / 2
    print(int(K))

### FIXED CODE ###

A,B=(int(x) for x in input().split())
C = int((A + B))

if(C%2 == 1):
    print("IMPOSSIBLE")
else:
    K = C / 2
    print(int(K))
import math

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

num_split = 1
sign = None
len_A_list = len(A_list)

for i in range(len_A_list-1):
    if sign == None:
        sign = (A_list[i+1] - A_list[i]) / math.fabs(A_list[i+1] - A_list[i])

    if (A_list[i+1] - A_list[i]) *  sign >= 0:
        continue

    num_split += 1
    sign = None

print(num_split)


### FIXED CODE ###

import math

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

num_split = 1
sign = None
len_A_list = len(A_list)

for i in range(len_A_list-1):
    if sign == None:
        if A_list[i+1] - A_list[i] == 0:
            continue
        sign = (A_list[i+1] - A_list[i]) / math.fabs(A_list[i+1] - A_list[i])

    if (A_list[i+1] - A_list[i]) *  sign >= 0:
        continue

    num_split += 1
    sign = None

print(num_split)
import math
from functools import reduce

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

l = []
for i in range(n):
    a_except_for_i = a[:i] + a[i + 1:]
    l.append(reduce(math.gcd, a_except_for_i))
print(max(l))

### FIXED CODE ###

import fractions
from functools import reduce

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

l = [0]
r = [0]
for i in range(n):
    l.append(fractions.gcd(l[i], a[i]))
    r.append(fractions.gcd(r[i], a[-(i + 1)]))

m = [fractions.gcd(l[i], r[-(i + 2)]) for i in range(n)]
print(max(m))
import math
from collections import defaultdict


def main():
    N, = [int(a) for a in input()]
    W = [input() for _ in range(N)]

    a = []
    for w in W:
        if w in a:
            print("No")
            return
        a.append(w)
        if len(a) == 1:
            continue
        if a[-2][-1] != a[-1][0]:
            print("No")
            return
    print("Yes")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


def main():
    N = int(input())
    W = [input() for _ in range(N)]

    if len(set(W)) != len(W):
        print("No")
        return
    W = [list(a) for a in W]

    for i in range(len(W) - 1):
        if W[i][-1] != W[i + 1][0]:
            print("No")
            return
    print("Yes")


if __name__ == '__main__':
    main()
h,w = map(int,input().split())
s = [None]*h
for i in range(h):
    s[i]=list(input())

res = 0
ans = [[0]*w for i in range(h)]


def f(x,y):
    c = 0
    if x+1 < h and s[x+1][y] =="#" and ans[x+1][y] == 0:
        ans[x+1][y] = 1
        c += 1
        if x+2 < h and s[x+2][y] == ".":
            c += f(x+2,y)
        if y+1 < w and s[x+1][y+1] == ".":
            c += f(x+1,y+1)
    if y+1 < w and s[x][y+1] == "#" and ans[x][y+1] == 0:
        ans[x][y+1] = 1
        c += 1
        if x+1 <h and s[x+1][y+1] == ".":
            c += f(x+1,y+1)
        if y+2 < w and s[x][y+2] == ".":
            c += f(x,y+2)
    return c

def g(x,y):
    c = 0
    if x+1 < h and s[x+1][y] =="." and ans[x+1][y] == 0:
        ans[x+1][y] = 1
        c += 1
        if x+2 < h and s[x+2][y] == "#":
            c += g(x+2,y)
        if y+1 < w and s[x+1][y+1] == "#":
            c += g(x+2,y)
    if y+1 < w and s[x][y+1] == "." and ans[x][y+1] == 0:
        ans[x][y+1] = 1
        c += 1
        if x+1 <h and s[x+1][y+1] == "#":
            c += g(x+1,y+1)
        if y+2 < w and s[x][y+2] == "#":
            c += g(x,y+2)
    return c
res = 0
for i in range(h):
    for j in range(w):
        ans = [[0]*w for i in range(h)]
        if s[i][j] == ".":
            #print(f(i,j))
            res += f(i,j)
        else:
            #print(g(i,j))
            res += g(i,j)
            

print(res)

### FIXED CODE ###

h,w = map(int,input().split())
s = [None]*h
for i in range(h):
    s[i]=list(input())
    
###########
#Union Find
par = [] #親
rank = [] #木の深さ

#初期化
for i in range(h*w):
    #par[i]:i rank[i]:0
    par.append(i)
    rank.append(0)

#木の根を求める
def find(x,par):
    if par[x] == x:
        return x
    else:
        return find(par[x],par)

#xとyの属する集合の併合
def unite(x,y,par,rank):
    x = find(x,par)
    y = find(y,par)
    
    if x != y:
        #xとyの属している集合が異なる時
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x]==rank[y]:
                rank[x] += 1

#xとyが同じ集合に属するかの判定
def same(x,y,par):
    return find(x,par) == find(y,par)
###############
for i in range(h*w):
    if i//w + 1 < h and s[i//w][i%w] != s[i//w+1][i%w]:
        unite(i,i+w,par,rank)
    if i%w +1 < w and s[i//w][i%w] != s[i//w][i%w+1]:
        unite(i,i+1,par,rank)

res = [[0,0] for i in range(w*h)] #[".","#"]
for i in range(h*w):
    r = find(i,par)
    if s[i//w][i%w] ==".":
        res[r][0]+=1
    else:
        res[r][1]+=1

ans = 0
for i in range(h*w):
    ans += res[i][0]*res[i][1]
print(ans)
a,b,c,k=(int(x) for x in input().split())

a1 = a
nokori = 0
nokori_1 = 0
nokori_2 = 0
tensuu = 0

if k-a1 > 0:
   tensuu +=a1
   nokori = k-a


if nokori > 0:
   tensuu +=0
   nokori2 =nokori - b 
if nokori2 > 0:
    tensuu -= nokori2

print(tensuu)

### FIXED CODE ###

a,b,c,k=(int(x) for x in input().split())

a1 = a
nokori = 0
nokori_1 = 0
nokori_2 = 0
tensuu = 0

if k-a1 > 0:
   tensuu +=a1
   nokori = k-a

if nokori > 0:
   tensuu +=0
   nokori2 =nokori - b
   if nokori2 > 0:
        tensuu -= nokori2
if k - a1 <= 0:
    tensuu = k
print(tensuu)
from collections import defaultdict
n = int(input())
s = [list(map(int,input().split())) for i in range(n-1)]
t = defaultdict(list)
for i in range(n-1):
    p = [s[i][1],s[i][2]]
    q = [s[i][0],s[i][2]]
    t[s[i][0]] += [p]
    t[s[i][1]] += [q]

a = [-1]*n
a[0] = 0

def Tree(dic,a,x,lo):
    for i in range(len(dic[x])):
        if a[dic[x][i][0]-1] != -1:
            continue
        else:
            save = lo
            lo += dic[x][i][1]
            a[dic[x][i][0]-1] = lo
            a = Tree(dic,a,dic[x][i][0],lo)
            lo = save
    return a

lis = Tree(t,a,1,0)
for i in range(n):
    if lis[i] % 2 == 0:
        print(0)
    else:
        print(1)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

n = int(input())
s = [list(map(int,input().split())) for i in range(n-1)]
t = defaultdict(list)
for i in range(n-1):
    p = [s[i][1],s[i][2]]
    q = [s[i][0],s[i][2]]
    t[s[i][0]] += [p]
    t[s[i][1]] += [q]

a = [-1]*n
a[0] = 0

def Tree(dic,a,x,lo):
    for i in range(len(dic[x])):
        if a[dic[x][i][0]-1] != -1:
            continue
        else:
            save = lo
            lo += dic[x][i][1]
            a[dic[x][i][0]-1] = lo
            a = Tree(dic,a,dic[x][i][0],lo)
            lo = save
    return a

lis = Tree(t,a,1,0)
for i in range(n):
    if lis[i] % 2 == 0:
        print(0)
    else:
        print(1)
w, h, x, y = map(int, input().split())
multi = 1 if 2*x == w and 2**y == h else 0
print(w*b/2, multi)

### FIXED CODE ###

w, h, x, y = map(int, input().split())
multi = 1 if 2*x == w and 2*y == h else 0
print(w*h/2, multi)
def main():
    def DFS(v):
        if DP[v] == -1:
            res = 0
            for i in G[v]:
                res = max(res, DFS(i) + 1)

            DP[v] = res

        return DP[v]


    N, M = map(int, input().split())
    xy = [list(map(int, input().split())) for _ in range(M)]

    G = [[] for _ in range(N + 1)]
    for x, y in xy:
        G[x - 1].append(y - 1)

    DP = [-1] * (N + 1)
    for v in range(N):
        DFS(v)

    print(max(DP))


if __name__ == '__main__':
    main()

exit()


### FIXED CODE ###

from collections import deque


def main():
    N, M = map(int, input().split())
    xy = [list(map(int, input().split())) for _ in range(M)]

    G = [[] for _ in range(N)]
    ins = [0] * N
    for i in range(M):
        G[xy[i][0] - 1].append(xy[i][1] - 1)
        ins[xy[i][1] - 1] += 1

    DP = [0] * N
    queue = deque()
    for i in range(N):
        if ins[i] == 0:
            queue.append(i)

    while queue:
        v = queue.popleft()
        for i in G[v]:
            ins[i] -= 1
            if ins[i] == 0:
                DP[i] = max(DP[i], DP[v] + 1)
                queue.append(i)

    print(max(DP))


if __name__ == '__main__':
    main()

exit()
def nroot(a, n, x=1.0, eps=1e-10000000000):
    while abs(a - x**n) > eps:
        x = ( (n-1)*x + a/(x**(n-1)) ) / n
    return x

a,b,c =map(int,input().split())
d=nroot(a,2)
e=nroot(b,2)
f=nroot(c,2)

if d+e<f:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = input()
K = int(K)
K -= 1
print(a[K])
n = int(input())
s = input()
cnt=0
for i in range(n-2):
  if s[i] == "a" && s[i+1] == "b" && s[i+2] == "c":
    cnt+=1
print(cnt)

### FIXED CODE ###

n = int(input())
s = input()
cnt=0
for i in range(n-2):
  if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
    cnt+=1
print(cnt)
'''
l = input().split()

l = list(map(int, l))
a,b,c = l[0],l[1],l[2]
'''
a,b,c = map(int, input().split)
if a > b:
	a,b = b,a

if b > c:
	b,c = c,b
	
if a > b:
	a,b = b,a
	
print(a,b,c)


### FIXED CODE ###


'''
l = input().split()

l = list(map(int, l))
a,b,c = l[0],l[1],l[2]
'''
a,b,c = map(int, input().split())
if a > b:
	a,b = b,a

if b > c:
	b,c = c,b
	
if a > b:
	a,b = b,a
	
print(a,b,c)
import collections
N, M = map(int, input().split())
groups = [0] * (N + 1)
group_num_list = [[0]]
group_num = 1
for _ in range(M):
    A, B = map(int, input().split())
    if groups[A] != 0 and groups[B] != 0:
        if groups[A] != groups[B]:
            group_num -= 1
            lower = min(groups[A], groups[B])
            higher = max(groups[A], groups[B])
            for i in group_num_list[higher]:
                groups[i] = lower
            tmp = group_num_list[higher]
            group_num_list[lower].extend(tmp)
            del group_num_list[higher]
    elif groups[A] != 0:
        groups[B] = groups[A]
        group_num_list[groups[A]].append(B)
    elif groups[B] != 0:
        groups[A] = groups[B]
        group_num_list[groups[B]].append(A)
    else:
        groups[A] = group_num
        groups[B] = group_num
        group_num_list.append([A, B])
        group_num += 1
collection = collections.Counter(groups)
# print(collection)
# print(group_num_list)
print(collection.most_common()[0][1] if collection.most_common()[
      0][0] != 0 else collection.most_common()[1][1])


### FIXED CODE ###

from collections import Counter
N, M = map(int, input().split())
groups = [0] * (N + 1)
group_num_list = [[0]]
group_num = 1
for _ in range(M):
    A, B = map(int, input().split())
    if groups[A] != 0 and groups[B] != 0:
        if groups[A] != groups[B]:
            lower = min(groups[A], groups[B])
            higher = max(groups[A], groups[B])
            for i in group_num_list[higher]:
                groups[i] = lower
            tmp = group_num_list[higher]
            group_num_list[lower].extend(tmp)
            # del group_num_list[higher]
    elif groups[A] != 0:
        groups[B] = groups[A]
        group_num_list[groups[A]].append(int(B))
    elif groups[B] != 0:
        groups[A] = groups[B]
        group_num_list[groups[B]].append(int(A))
    else:
        groups[A] = group_num
        groups[B] = group_num
        group_num_list.append([int(A), int(B)])
        group_num += 1
counter = Counter(groups)
# print(collection)
# print(group_num_list)
if len(group_num_list) == 1:
    print(1)
elif int(counter.most_common()[0][0]) != 0:
    print(counter.most_common()[0][1])
else:
    print(counter.most_common()[1][1])
import collections
def f(s):
  	h = {('R','G'): 'B', ('B','G'): 'R', ('R','B'): 'G', }
    for k in h:
      	h[k[::-1]] = h[k]
    c = collections.Counter()
    cc = [None] * (len(s)+1)
    cc[-1] = c
    for jj in range(len(s)-1,-1,-1):
      	c[s[jj]]+=1
        cc[jj] = c
	res = 0
    for i in range(len(s)):
		for j in range(i+1, len(s)):
          	if s[j] != s[i]:
              	res += cc[j+1][h[(s[i],s[j])]]
                
	return res
raw_input()
print f(raw_input())

### FIXED CODE ###

import copy
import collections
def f(s):
    h = {('R','G'): 'B', ('B','G'): 'R', ('R','B'): 'G',('R','G')[::-1]: 'B', ('B','G')[::-1]: 'R', ('R','B')[::-1]: 'G', }
    c = collections.Counter()
    cc = [None] * (len(s)+1)
    cc[-1] = copy.deepcopy(c)
    for jj in range(len(s)-1,-1,-1):
        c[s[jj]]+=1
        cc[jj] = copy.deepcopy(c)


    res = 0
    for i in range(len(s)):
        for j in range(i + 1, len(s)):
            if s[j] != s[i]:
                res += cc[j+1][h[(s[i],s[j])]] 
                
                k = j + (j - i)
                if k < len(s) and s[k] == h[(s[i],s[j])]:
                    res -=1
    return res
raw_input()
print f(raw_input())
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(int(pow(P,(1/N))))+1):
    tmp=i**N
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)

### FIXED CODE ###

import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(round(math.pow(P,(1/N)))+1)):
    tmp=math.pow(i,N)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)
#d  tree
n,k =  [int(i) for i in input().split()]
a   =  [int(i)-1 for i in input().split()]

#this is directed tree so every node is not reached yet
def dfs(u, d):
    change = 0
    if d>k:
        d = 1
        change += 1
    for v in edges[u]:
        if u==v:
            continue
        change += dfs(v, d+1)
    return change


cnt = 0
if a[0]!=0:
    a[0] = 0
    cnt += 1

edges = [[] for _ in range(n)]
for i in range(0,n):
    pa = a[i]
    edges[a[i]].append(i)   

cnt += dfs(0,0)    
print(cnt)

### FIXED CODE ###

#d  tree
#code自体はあっている。ただ、そもそもアルゴリズムが違う。
#下から調べていかないと最適でない。
#Right Answer. 
import sys
sys.setrecursionlimit(2 * 10 ** 5 + 10)

n,k =  [int(i) for i in input().split()]
a   =  [int(i)-1 for i in input().split()]

#this is directed tree so every node is not reached yet
#return the depth from its lowest bottom
def dfs(u):
    global cnt
    depth = 0 #default, this value is used when bottom
    
    for v in edges[u]:
        depth = max(depth, (dfs(v)+1)%k) #apply the maximum depth
        #because the edge was alerady cut, by the following procedure
    
    if depth==k-1 and u!=0 and a[u] != 0:
        cnt += 1
        
    return depth


cnt = 0
if a[0]!=0:
    cnt += 1

edges = [[] for _ in range(n)]
for i in range(1,n):
    pa = a[i]
    edges[a[i]].append(i)   

dfs(0)    
print(cnt)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 06:30:41 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


def main():
  L, R = list(map(int, input().split()))

  if R-L+1 >= 2019:
    print(0)
  else:
    mods = []
    for i in range(L, R+1):
      mods.append(i % 2019)
  mods = sorted(mods)
  print((mods[0]*mods[1]) % 2019)


if(__name__ == '__main__'):
  main()


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 06:30:41 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


def main():
  L, R = list(map(int, input().split()))

  if R-L+1 >= 2019:
    print(0)
    return
  else:
    mods = []
    for i in range(L, R+1):
      mods.append(i)
  mods = sorted(mods)
  min_ = float('inf')
  for i in mods:
    for j in mods:
      if i==j:
        continue
      min_ = min(min_, (i*j) % 2019)

  print(min_)


if(__name__ == '__main__'):
  main()
a = {x:0 for x in range(ord('a'), ord('z') + 1)}

while True:
    text = input()
    if text == ' ':
        break
    for x in text:
        a[ord(x.lower())] += 1

    for x in range(ord('a'), ord('z') + 1):
        print(chr(x), ':', a[x])

### FIXED CODE ###

a = {x:0 for x in range(ord('a'), ord('z') + 1)}

while True:
    try:
        text = input()
        for x in text:
            if ord('a') <= ord(x) <= ord('z') or ord('A') <= ord(x) <= ord('Z'):
                a[ord(x.lower())] += 1
    except EOFError:
        break

for x in range(ord('a'), ord('z') + 1):
    print(chr(x), ':', a[x])
A，B，C = list(map(int, input().split()))
vincent = [A,B,C]
vincent1 = set(vincent)
if len(vincent1) == 2:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

A, B, C = list(map(int, input().split()))
vincent = [A,B,C]
vincent1 = list(set(vincent))
if len(vincent1) == 2:
    print("Yes")
else:
    print("No")
N=input()
s=0
for i in N:
  if i=="1":
    s++

print(s)    


### FIXED CODE ###

N=input()
s=0
for i in N:
  if i=="1":
    s=s+1

print(s)
import sys
N = int(input())
s = str(input())
t = str(input())

word = s + t

if s == t:
  print(N)
  sys.exit()

for letter in s:
  if letter not in letter_list:
    letter_list.append(letter)
    
for letter in t:
  if letter not in list(letter_dict.keys()):
    letter_dict[letter] = 1
    
print(len(letter_dict))

### FIXED CODE ###

import sys
N = int(input())
s = str(input())
t = str(input())

answer = 2 * N
for i in range(N, 2 * N + 1):
    if s[len(s) - (2 * N - i):] == t[:2 * N - i]:
        answer = i
        break
    
print(answer)
n,m,c=map(int,input().split())
B=list(map(int,input().split())) 
A=[list(map(int,input().split()))for i in range(n)] 
cnt=0 
for i in range(n):
    total = 0
  for j in range(m):
      total+=B[j]*A[i][j]
  total+=c
  if total>0:
          cnt+=1  
print(cnt)

### FIXED CODE ###

n,m,c=map(int,input().split())
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)] #二次元配列でとっています
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)
n=int(input())
a=input().strip()
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))


### FIXED CODE ###

n=int(input())
a=input().strip()
x=""
x+=a[0]
for i in range(1,n):
  if a[i]!=a[i-1]:
    x+=a[i]
print(len(x))
x=imput()
y=x**3
print int(y)


### FIXED CODE ###

x=int(input())
print(x**3)
N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 

if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break


if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')
if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1

Ans = step(A,C) and step(B,D)
 
if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
    Ans = step(A,C) and step(B,D) and  pass_path


if Ans == True:
    print('Yes')
else:
    print('No')
n = int(input())
num = n
f = 0
while True:
    if num == 0:
        break
    f += num%10
    num = num//10

if n%num==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = int(input())
num = n
f = 0
while True:
    if num == 0:
        break
    f += num%10
    num = num//10

if n%f==0:
    print("Yes")
else:
    print("No")
def input():
  return sys.stdin.readline()[:-1]

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)

  divisors.sort(reverse=True)
  return divisors

N,K =　map(int, input().split())
A =　list(map(int, input().split()))

sumA = sum(A)
kouho = make_divisors(sumA)

for i in kouho:
  if sumA%i != 0:
    continue
  r = [0]*N
  for j in range(N):
    r[j] = A[j]%i
  sumr = sum(r)
  if sumr%i != 0:
    continue
  r.sort(reverse=True)
  num = 0
  for k in range(sumr//i):
    num += i-r[k]
  if num <= K:
    print(i)
    exit()

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
    if i != n // i:
      divisors.append(n//i)

  divisors.sort(reverse=True)
  return divisors

N,K = II()
A = III()

sumA = sum(A)
kouho = make_divisors(sumA)

for i in kouho:
  if sumA%i != 0:
    continue
  r = [0]*N
  for j in range(N):
    r[j] = A[j]%i
  sumr = sum(r)
  if sumr%i != 0:
    continue
  r.sort(reverse=True)
  num = 0
  for k in range(sumr//i):
    num += i-r[k]
  if num <= K:
    print(i)
    exit()
H, W = map(int, input().split())
f = [input() for _ in range(H)]
while True:
  flag = False
  for y in range(H):
    if '#' not in f[y]:
      del f[y]
      H -= 1
      flag = True
      break
  for x in range(W):
    for y in range(H):
      if f[y][x] == '#':
        break
    for y in range(H):
      del f[x][y]
    flag = True
    break
  if not flag:
    break

for i in range(H):
  print(f[i])
	

### FIXED CODE ###

H, W = map(int, input().split())
f = [list(input()) for _ in range(H)]
Y, X = [False for _ in range(H)], [False for _ in range(W)]
for y in range(H):
    for x in range(W):
        Y[y] |= f[y][x] == '#'
        X[x] |= f[y][x] == '#'
for y in range(H):
    flag = False
    for x in range(W):
        if Y[y] and X[x]:
            print(f[y][x], end = "")
            flag = True
    if flag:
        print()