Harryxun/stf_run huggingface dataset:
import sys
H,W = input().split()
H = int(H)
W = int(W)
s = []

s.append("."*(W+2))
for i in range(H):
    s.append("."+input()+".")

s.append("."*(W+2))


for j in range(1,1+H):
    for i in range(1,1+W):
#        print(j,i)
        if s[i][j] == "#":
            if s[i][j-1] != "#" and s[i][j+1] != "#" and s[i-1][j] != "#" and s[i+1][j] != "#":
                print("No")

                sys.exit()

print("Yes")


### FIXED CODE ###

import sys
H,W = input().split()
H = int(H)
W = int(W)
s = []

s.append("."*(W+2))
for i in range(H):
    s.append("."+input()+".")

s.append("."*(W+2))


for i in range(1,1+H):
    for j in range(1,1+W):
#        print(j,i)
        if s[i][j] == "#":
            if s[i][j-1] != "#" and s[i][j+1] != "#" and s[i-1][j] != "#" and s[i+1][j] != "#":
                print("No")

                sys.exit()

print("Yes")
N, T = map(int, input().split())
cage,cage2=[],[]
for i in range(N):
  c, t = map(int, input().split())
  if t<=T:
	cage.append(c)
if cage==None:
  print("TLE")
else:
  print(min(cage))

### FIXED CODE ###

a = int(input())
if a==1:
  print("Hello World")
else:
  A = int(input())
  B = int(input())
  print(A+B)
n = int(raw_input())
s = map(int, raw_input().split())
m = int(raw_input())
t = map(int, raw_input().split())

s = list(set(s))
s.sort()
l = s[len(s)-1]
a = [0 for i in range(l)]
for i in s:
    a[i] = 1

count = 0
for i in t:
    if i < l:
        count += a[i] 
print count

### FIXED CODE ###

n = int(raw_input())
s = map(int, raw_input().split())
m = int(raw_input())
t = map(int, raw_input().split())

s = list(set(s))
s.sort()
l = len(s)-1

count = 0
for i in t:
    low = 0
    high = l
    while low <= high:
        mid = (low+high)/2
        if s[mid] == i:
            count += 1
            break
        if s[mid] < i:
            low = mid+1
        else:
            high = mid-1

print count
s=input()
le=len(s)
lis=[]
for i in range(0,le):
  if s[i]!="A" and s[i]!="" and s[i]!="T" and s[i]!="G":
    lis.append(i)
lo=0
for j in range(0,len(lis)-1):
  if lis[j+1]-lis[j]-1>=lo:
    lo=lis[j+1]-lis[j]-1
if lis[0]>=lo:
  lo=lis[j]
if len(lis)-lis[-1]+1>=lo:
  lo=len(lis)-lis[-1]-1
print(lo)

### FIXED CODE ###

s=input()
le=len(s)
lis=[]
for i in range(0,le):
  if s[i]!="A" and s[i]!="C" and s[i]!="T" and s[i]!="G":
    lis.append(i)
lo=0
for j in range(0,len(lis)-1):
  if lis[j+1]-lis[j]-1>=lo:
    lo=lis[j+1]-lis[j]-1
if bool(lis):
  if lis[0]>=lo:
    lo=lis[0]
  if le-lis[-1]-1>=lo:
    lo=le-lis[-1]-1
  print(lo)
else:
  print(le)
S = input()
#S = str(1817181712114)
ans = 0
 
for a in range(len(S) - 3):
	for b in range(a+3, len(S)):
		if int(S[a:b+1]) % 2019 == 0:
			ans += 1        
print(ans)

### FIXED CODE ###

S,W = map(int,input().split())

if S <= W :
	print("unsafe")
else :
	print("safe")
h, a = input().split()
print(h // a)

### FIXED CODE ###

h, a = input().split()
h = int(h)
a = int(a)
ans = h // a + (0 if h % a == 0 else 1)
print(ans)
import math

S =  list(map(int,input().split()))
N = S[0]
M = S[1]
A =  list(map(int,input().split()))
ans = N-sum(A)
if ans < 0:
    ans = -1
    
print(ans)

### FIXED CODE ###

import math

X = int(input())
A = X*2*math.pi
print(A)
# -*- coding: utf-8 -*-

# スペース区切りの整数の入力
a, b = map(int, input().split())

c = a*b

# 出力
if c%2==0:
	print "Even"
else
	print "Odd"


### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
s,w = map(int,input().split())

if s =< w:
    print('unsafe')
elif s > w:
    print('safe')
    

### FIXED CODE ###

s, w = map(int,input().split())

if s <= w:
    print('unsafe')
else:
    print('safe')
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    A=tupin()
    
    from math import gcd

    temp=A[0]
    for i in range(N-1):
          temp=gcd(temp,A[i])
    print(temp)
#%%submit!
resolve()

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions
from functools import reduce
def pin(type=int):
    return map(type,input().split())


N, =pin()
m = list(pin())




def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

print(gcd_list(m))
import numpy as np
n, m = map(int, input().split())
h = list(map(int, input().strip().split()))

g = np.zeros((n+1,n+1),dtype='uint64')
for i in range(1,n+1):
    g[i][i] = i


for i in range(m):
    a, b = map(int, input().split())
    g[a][b] = h[b-1]
    g[b][a] = h[a-1]

#for i in range(1,n+1):
#    print(g[i,:])


ans = 0
for i in range(1,n+1):
    if np.argmax(g[i,:]) == i:
        #print(i)
        ans += 1

print(ans)

### FIXED CODE ###

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

f = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    if h[a-1] == h[b-1]:
        f[a-1] = 1
        f[b-1] = 1
    elif h[a-1] > h[b-1]:
        f[b-1] = 1
    elif h[a-1] < h[b-1]:
        f[a-1] = 1

#print(h0)
#print(h)


ans = 0
for i in range(n):
    if f[i] <= 0:
        #print(i)
        ans += 1

print(ans)
def f(n):
  if n==0:return 0
  else:return f(pc[n])+1
n=int(input())
x=input()
pc=[0]
m=10**5
for i in range(1,m+1):
  cnt=0
  j=i
  while i:
    cnt+=i%2
    i//=2
  pc+=[j%cnt]
cnt=x.count('1')
ix=int(x,2)
d=2**(n-1)
for i in range(n):
  if x[i]=='0':print(f((ix+d)%(cnt+1))+1)
  else:
    if ix-d>m:print(f((ix-d)%(cnt-1))+1)
    else:print(f(ix-d))
  d//=2

### FIXED CODE ###

n=int(input())
x=input()
pc=[0]
m=2*10**5
for i in range(1,m+2):
  cnt=0
  j=i
  while i:
    cnt+=i%2
    i//=2
  pc+=[j%cnt]
f=[0]*(m+2)
for i in range(1,m+2):
  if pc[i]==0:f[i]=1
  else:f[i]=f[pc[i]]+1
cnt=x.count('1')
ix=int(x,2)
ixp=ix%(cnt+1)
ixm=ix%(cnt-1) if cnt-1 else 0
d=1<<(n-1)
for i in range(n):
  dp=pow(2,n-i-1,cnt+1)
  if cnt-1:dm=pow(2,n-i-1,cnt-1)
  if x[i]=='0':print(f[(ixp+dp)%(cnt+1)]+1)
  else:
    if cnt-1:print(f[(ixm-dm)%(cnt-1)]+1)
    else:print(0)
n = (input()
print('ABC'+n)

### FIXED CODE ###

n = input()
print('ABC'+n)
n, m = [int(i) for i in input().split()]
am = sorted([int(i) for i in input().split()],reverse=True)
c = [2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [0 for i in range(n+1)]

for i in range(n+1):
    max_tmp = -float("inf")
    for j in am:
        if i-c[j-1]>=0:
            max_tmp = max(dp[i-c[j-1]]+1, max_tmp)
    dp[i] = max(dp[i],max_tmp)



flag = True
result = 0
tmp_n = n
x = 0
y = x
while flag==True:

    if tmp_n-c[am[x]-1] >= 0 and dp[tmp_n-c[am[x]-1]] == dp[tmp_n] - 1:
        result = result * 10 + am[x]
        tmp_n = tmp_n-c[am[x]-1]
        x = 0
    elif tmp_n-c[am[x]-1]<0:
        x = x + 1
        if x == len(am):
            one = result%10
            result = int((result-one)/10)
            tmp_n +=c[one-1]
            x = am.index(one)+1

    elif x < len(am):
         x+=1

    if tmp_n==0:
        break


print(result)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]
am = sorted([int(i) for i in input().split()],reverse=True)
c = [2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1 for i in range(n+1)]
dp[0]=0
for i in range(n+1):
    #max_tmp = -float("inf")
    for j in am:
        if i+c[j-1]<=n:
            dp[i+c[j-1]] = max(dp[i+c[j-1]], dp[i]+1)
#print(dp)
tmp_n = n
ans =""
for i in range(dp[n]):
    for j in range(m):
        if i==dp[n]-1 and tmp_n- c[am[j]-1] != 0:
            continue
        if tmp_n - c[am[j]-1] >= 0 and dp[tmp_n - c[am[j]-1]] == dp[tmp_n] -1:
            ans+=(str(am[j]))
            tmp_n -= c[am[j]-1]
            break


print(ans)
a=list(map(int, input()))

print(a.count(1))


### FIXED CODE ###

a, b=map(int,input().split())
if a*b%2==0:
  print("Even")
else:
  print("Odd")
try:
	a,b = input().split()
    if(a>(b*2)):
  		print(a-(b*2))
    else:
    	print(0)
except:
  print(0)



### FIXED CODE ###

a,b = input().split()
a,b = int(a),int(b)
print(max(a-2*b,0))
N = int(input())
A = 10000 - N
a = str(A)
if int(a[-3]) > 0:
 print(a[-3]+a[-2]+a[-1])
else:
 if int(a[-2]) > 0:
     print(a[-1])

### FIXED CODE ###

N = input()
if len(N) >= 3:
    A = int(N[-3])*100 + int(N[-2])*10 + int(N[-1])
    if A == 0:
        print(0)
    else:
        print(1000 - A)
elif len(N) == 2:
    A = int(N[-2])*10 + int(N[-1])
    print(1000 - A)
elif len(N) == 1:
    A = int(N[-1])
    print(1000 - A)
import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa


A = np.zeros((n, n), dtype=np.int)

for i in range(n-1):
    A[i][i] = 1
    A[i][i+1] = 1
exit()
A[n-1][n-1] = 1
A[n-1][0] = 1

exit()



### FIXED CODE ###

import numpy as np
import sys

n = int(input())

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

a_sum = sum(a)
# x[i]はi番目のダムに溜まった水の半分
x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

for wa in x:
    print(wa*2, end=' ')
from math import gcd
n=int(input())
a=[int(i) for i in input().split()]
p=gcd(a[0],a[1])
l=[a[0],p]
c=list(reversed(a))
q=gcd(c[0],c[1])
r=[q]
for i in range(1,n-1):
    p=gcd(p,a[i+1])
    l.append(p)
    q=gcd(q,c[i+1])
    r.append(q)

r=r[::-1]+[a[-1]]
r=r[1:]+[0]
l=[0]+l

print(max(gcd(s,t)for s,t in zip(r,l)))

### FIXED CODE ###

from fractions import*
n,*a=map(int,open(0).read().split())
p=gcd(a[0],a[1])
l=[a[0],p]
c=list(reversed(a))
q=gcd(c[0],c[1])
r=[q]
for i in range(1,n-1):
    p=gcd(p,a[i+1])
    l.append(p)
    q=gcd(q,c[i+1])
    r.append(q)

r=r[::-1]+[a[-1]]
r=r[1:]+[0]
l=[0]+l

print(max(gcd(s,t)for s,t in zip(r,l)))
n,m = map(int, input().split())

lmin = 1
rmax = n
for i in range(m):
    l, r = map(int, input().split())

    if l > lmin:
        lmin = l

    if r < rmax:
        rmax = r

if rmax	< lmin:
    print(0)
else:
    print(rmax - lmin + 1)

### FIXED CODE ###

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

if a >= 13:
    print(b)
elif a >= 6:
    print(int(b/2))
else:
    print(0)
W,H,x,y,r=map(int,input().split())
W=-r;H=-r;
if min([x,y])>=r and x<=W and y<=H:
    print(Yes)
else:
    print(No)


### FIXED CODE ###

W,H,x,y,r=map(int,input().split())
if min([x,y])>=r and x<=(W-r) and y<=(H-r):
    print("Yes")
else:
    print("No")
s = input()
t = input()

cnt = []
for i in range(len(t)):
    for k in range(i + 1, len(t) + 1):
        if t[i:k] in s[i:]:
            cnt.append(k - i)
            print(t[i:k], k - i)
#print(cnt)
print(len(t) - max(cnt))


### FIXED CODE ###

s = input()
t = input()

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            #print(t[i:k], s[i:], k-i)
    else:
        cnt.append(0)
            #print(t[i:k], k - i)
#print(cnt)
print(len(t) - max(cnt))
#! -*- coding:utf-8 -*-

def search(values,hp,vp,fruit):
    if not (0<=hp<len(values)): return
    if not (0<=vp<len(values[hp])): return
    if fruit!=values[hp][vp]: return
    values[hp][vp]=0
    search(values,hp-1,vp,fruit)
    search(values,hp+1,vp,fruit)
    search(values,hp,vp-1,fruit)
    search(values,hp,vp+1,fruit)

def solve(values):
    count=0
    for i in range(len(values)):
        for j in range(len(values[i])):
            if values[i][j] in ['@','#','*']:
                search(values,i,j,values[i][j])
                count+=1
    return count

def main():
    line,values=input(),list()
    while line!='0 0':
        H,W = list(map(int,line.strip().split(' ')))
        value = list()
        for _ in range(H):
            value.append([x for x in input().strip()])
        values.append(value)
        line = input()
    for value in values:
        print(solve(value))

if __name__=='__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**6)

def search(field,hp,vp,item):
	if not (0<=hp<len(field)): return
	if not (0<=vp<len(field[hp])): return
	if item!=field[hp][vp]: return
	field[hp][vp]=True
	for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
		search(field,hp+dh,vp+dv,item)
#	search(field,hp-1,vp,item)
#	search(field,hp+1,vp,item)
#	search(field,hp,vp-1,item)
#	search(field,hp,vp+1,item)

def solve(field):
	count,valid_items=0,set(['@','#','*'])
	for i in range(len(field)):
		for j in range(len(field[i])):
			if field[i][j] in valid_items:
				search(field,i,j,field[i][j])
				count+=1
	return count

def main():
	line = input().strip()
	while line!='0 0':
		H,W = list(map(int,line.split(' ')))
		field = list()
		for _ in range(H):
			field.append(list(input().strip()))
		print(solve(field))
		line = input().strip()

if __name__=='__main__':
	main()
s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if k>=i:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
    
print(min(v))

### FIXED CODE ###

s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if i<=k<=i+len(t)-1:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
if v==[]:
    print('UNRESTORABLE')
else:
    print(min(v))
X,Y = list(map(int,input().split()))
if Y <= (4 * X) and (Y / 2 == 0):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x = list(map(int,input().split()))
i = 0
for i in range(len(x)):
    if x[i] == 0:
        print (i+1)
        break
n = int(input())
a = list(map(int, input().split()))

ans = 1
if 0 in a:
    ans = 0
    print(ans)
    exit()
else:
    for i in a:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
print(ans)


### FIXED CODE ###

a,b=map(str, input().split())
A = int(a)
B = 100*int(b[0])+10*int(b[2])+ 1*int(b[3])
ans = A*B // 100
print(ans)
def canbuy(n):
    for i in range(int(100/7)):
        if (n-7*i)%4 == 0:
            return 'Yes'
    return 'No'

n=input()
print(canbuy(n))


### FIXED CODE ###

def canbuy(n):
    for i in range(int(100/7)):
        tmp = n-7*i
        if tmp==0 or (tmp>3 and tmp%4==0):
            return 'Yes'
    return 'No'

n=int(input())
print(canbuy(n))
A = [int(input()) for _ in range(5)]
k = int(input())
cnt = 0
for i in range(n-1):
    if A[i+1] - A[i] > k:
        cnt += 1
if cnt:
    print(':(')
else:
    print('Yay!')

### FIXED CODE ###

A = [int(input()) for _ in range(5)]
k = int(input())

if A[-1] - A[0] > k:
    print(':(')
else:
    print('Yay!')
L,R = map(int,input()split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break
print(x)

### FIXED CODE ###

L,R = map(int,input().split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break
print(x)
A,B=input().split()
A=int(A)
B=int(B)

p=A+B
m=A-B
a=A*B

if p>=m and p>=a:
    print(p)
else if m>=p and m>=a:
    print(m)
else:
    print(a)

### FIXED CODE ###

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

p=A+B
q=A-B
r=A*B

print(max(p,q,r))
def solve(string):
    ins = string.split("\n")
    h, w = map(int, ins[0].split(" "))
    # a = [list(map(lambda x: int(x) % 2 == 1, input().strip().split(" "))) for _i in range(h)]
    a = []
    for i in range(h):
        # tmp = input()
        tmp = ins[i + 1]
        print(repr(tmp))
        a.append(list(map(lambda x: int(x) % 2 == 1, tmp.strip().split(" "))))
    move = []
    for i in range(h):
        for j in range(w):
            if not a[i][j]:
                continue
            if j < w - 1:
                a[i][j + 1] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 1, j + 2))
            elif i < h - 1:
                a[i + 1][j] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 2, j + 1))
    move.insert(0, str(len(move)))
    return "\n".join(move)


if __name__ == '__main__':
    line = input().strip()
    # """
    ins = [input() for _ in range(int(line[0]))]
    ins.insert(0, line)
    print(solve("\n".join(ins)))
    # """
    # print(solve(line))


### FIXED CODE ###

h,w = map(int,input().split())
a = []
for i in range(h):
    tmp = list(map(lambda x:int(x)%2,input().split()))
    a.append(tmp)
result = []
 
for i in range(h):
    for j in range(w-1):
        if a[i][j] == 1:
            #a[i][j] == 0
            a[i][j+1] = 1 ^ a[i][j+1]
            result.append((i+1,j+1,i+1,j+2)) 
for i in range(h-1):
    if a[i][w-1] == 1:
        a[i+1][w-1] = 1 ^ a[i+1][w-1]
        result.append((i+1,w,i+2,w))
print(len(result))
for row in result:
    print("{} {} {} {}".format(row[0],row[1],row[2],row[3]))
def main():
    n,k = map(int, input().split())
    X = list(map(int, input().split()))

    for i,x in enumerate(X):
        if max(X) < 0:
            array_m = X.copy()
            array_p = []
            break
        if x >= 0:
            array_m = X[:i]
            array_p = X[i:]
            break
    inf = 10**9
    array_m = [inf] + array_m
    array_p += [inf]
    array_m2 = [abs(2*x) for x in array_m]
    array_p2 = [abs(2*x) for x in array_p]
    count = 0
    array_m_tmp = []
    array_p_tmp = []
    for _ in range(k):
        if array_m2[-1] < array_p[0]:
            array_m_tmp.append(array_m2.pop(-1))
        else:
            array_p_tmp.append(array_p.pop(0))
    array_m_tmp.append(0)
    array_p_tmp.append(0)
    ans = max(array_m_tmp) + max(array_p_tmp)
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n,k = map(int, input().split())
    X = list(map(int, input().split()))

    tmp = []
    for i in range(n-k+1):
        l = X[i]
        r = X[i+k-1]
        tmp.append(abs(l)+abs(r-l))
        tmp.append(abs(r)+abs(r-l))
    print(min(tmp))


if __name__ == '__main__':
    main()
N,x=map(int,input().split())

lst=[0 for i in range(2*N-1)]
if x==1 or x==2*N-1:
    print("No")
else:
    nlst=set([i for i in range(1,2*N)])
    if x>=N:
        lst[N-1]=x
        lst[N]=x+1
        lst[N+1]=x-1
        lst[N-2]=x-2
        nlst.remove(x)
        nlst.remove(x+1)
        nlst.remove(x-1)
        nlst.remove(x-2)
    else:
        lst[N-1]=x
        lst[N]=x-1
        lst[N+1]=x+1
        lst[N-2]=x+2
        nlst.remove(x)
        nlst.remove(x-1)
        nlst.remove(x+1)
        nlst.remove(x+2)

    idxlst=set([i for i in range(2*N-1)])
    idxlst.remove(N-2)
    idxlst.remove(N-1)
    idxlst.remove(N)
    idxlst.remove(N+1)

    nlst=list(nlst)
    idxlst=list(idxlst)
    for n,i in zip(nlst,idxlst):
        lst[i]=n
    print(" ".join([str(i) for i in lst]))


### FIXED CODE ###

N,x=map(int,input().split())


if x==1 or x==2*N-1:
    print("No")
elif N==2:
    print("Yes")
    for i in range(1,4):
        print(i)
else:
    lst=[0 for i in range(2*N-1)]
    nlst=set([i for i in range(1,2*N)])
    if x>=N:
        lst[N-1]=x
        lst[N]=x+1
        lst[N+1]=x-1
        lst[N-2]=x-2
        nlst.remove(x)
        nlst.remove(x+1)
        nlst.remove(x-1)
        nlst.remove(x-2)
    else:
        lst[N-1]=x
        lst[N]=x-1
        lst[N+1]=x+1
        lst[N-2]=x+2
        nlst.remove(x)
        nlst.remove(x-1)
        nlst.remove(x+1)
        nlst.remove(x+2)

    idxlst=set([i for i in range(2*N-1)])
    idxlst.remove(N-2)
    idxlst.remove(N-1)
    idxlst.remove(N)
    idxlst.remove(N+1)

    nlst=list(nlst)
    idxlst=list(idxlst)
    for n,i in zip(nlst,idxlst):
        lst[i]=n
    print("Yes")
    for i in lst:
        print(i)
N = int(input())
blist = list(map(int, input().split()))
ans = []
for i in range(N):
    for index in range(N-1, -1, -1):
        if blist[index] == index + 1:
            ans.append(blist.pop(index))
            break
    else:
        print(-1)
        break
else:
    for num in ans:
        print(num)


### FIXED CODE ###

N = int(input())
blist = list(map(int, input().split()))
ans = []
for i in range(N):
    for index in range(N-i-1, -1, -1):
        if blist[index] == index + 1:
            ans.append(blist.pop(index))
            break
    else:
        print(-1)
        break
else:
    for num in ans[::-1]:
        print(num)
S=input()
print(S[0]+int(len(S)-2)+S[-1])

### FIXED CODE ###

s=input()
print(s[0]+str(len(s)-2)+s[-1])
s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
flg1 = False
flg2 = False
if n < m:
    for i in range(n):
        if sl[i] != tl[i]:
            flg1 = False
            break
        flg1 = True
for i in range(n):
    if sl[i] < tl[i]:
        flg2 = True
        break
    if sl[i] > tl[i]:
        flg2 = False
        break
if flg1 or flg2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=input()
t=input()
sl = [s[i] for i in range(len(s))]
tl = [t[i] for i in range(len(t))]
n = len(sl)
m = len(tl)
sl.sort()
tl.sort(reverse=True)
s_ans = ''.join(sl)
t_ans = ''.join(tl)
if s_ans < t_ans:
    print("Yes")
else:
    print("No")
n, k = list(map(int, input().split()))


from functools import reduce
from operator import mul

def cmb(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    # なんでn + 1じゃないのか？
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

TEISU = 10 ** 9 + 7

for i in range(k):
    print(int(cmb(n - k + 1, i + 1) * cmb(k - 1, i)) % TEISU)



### FIXED CODE ###

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


from functools import reduce
from operator import mul

def cmb(n, r):
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    # なんでn + 1じゃないのか？
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under

TEISU = 10 ** 9 + 7

for i in range(k):
    print(int(cmb(n - k + 1, i + 1) * cmb(k - 1, i)) % TEISU)
a=list(map(int,input().split()))

a.sort()

s=0
i=0

if sum(a)<=x:
    print(n)
    exit()
elif min(a)>x:
    print(0)
    exit()
else:
    while s<x:
        s+=a[i]
        i+=1

print(s)
print(i-1)

### FIXED CODE ###

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

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

a.sort()

count=0
 
if x<a[0]:
    print(0)
    exit()


for i in range(n):
    if x>=a[i]:
        x-=a[i]
        count+=1
    else:
        print(count)
        exit()

if x>0:
    print(count-1)
else:
    print(count)
N = int(input())
V = [float(v) for v in input().split()]
V.sort(revese=True)
for i in range(N):
    if len(V) == 1:
        print(V[0])
        exit()
    v1 = V.pop()
    v2 = V.pop()
    V.append((v1 + v2) / 2)


### FIXED CODE ###

def solve(string):
    n, *v = map(int, string.split())
    v = sorted(v, reverse=True)
    return str(sum(_v / 2**i for i, _v in enumerate(v[:-1], start=1)) + v[-1] / 2**(n - 1))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
a,b=map(int,input().split())print('P'if a*b*(a+b)%3<0else'Imp'+'ossible')

### FIXED CODE ###

a,b=map(int,input().split());print(['P','Imp'][a*b*(a+b)%3>0]+'ossible')
N, M = map(int, input().split())
A = [int(i) for i in input().split()]


if sum(M) > N:
    print(-1)
else:
    print(N-sum(A))


### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]


if sum(A) > N:
    print(-1)
else:
    print(N-sum(A))
x = input()
y = input()
z = len(y)
if z <= x:
  print(y)
else:
  print(y[:x]

### FIXED CODE ###

x = input()
y = input()
z = len(y)
if z <= int(x):
  print(y)
else:
  print(y[:int(x)]+'...')