qyliang/CodeNanoFix huggingface dataset:
Buggy code:
while True:
    (H, W) = [int(i) for i in input().split()]

    if H == W == 0:
        break

    print("#" * W)

    for i in range(H - 2):
        print("#", "." * (W - 2), "#", sep='')

    print("#" * W)

Fixed code:
while True:
    (H, W) = [int(i) for i in input().split()]

    if H == W == 0:
        break

    print("#" * W)
    for i in range(H - 2):
        print("#", "." * (W - 2), "#", sep='')
    print("#" * W)
    print()
Buggy code:
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    print(('#' * w + '\n') + (('#' + '.' * (w - 2) + '#' + '\n') * h) + ('#' * w + '\n'))

Fixed code:
while True:
    h, w = list(map(int, input().split()))
    if h == w == 0:
        break
    print(('#' * w + '\n') + ('#' + '.' * (w - 2) + '#' + '\n') * (h - 2) + ('#' * w + '\n'))
Buggy code:
while True:
    W, H = map(int, input().split())
    if W == H == 0:
        break
    else:
        for i in range(H):
            if i == 0 or i + 1 == H:
                print('#' * W)
            else:
                print('#' + "." * (W - 2) + '#')
        print()

Fixed code:
while True:
    H, W = map(int, input().split())
    if H == W == 0: break
    print("#" * W)
    for i in range(H-2):
        print("#" + "." * (W-2) + "#")
    print("#" * W)
    print()
Buggy code:
while True:
  H,W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print("#"*W)

  for i in range(H-2):
    print("#"+"."*(W-2)+"#")
    
  print("#"*W)


Fixed code:
while True :
    H, W = map(int, input().split())
    if H == 0 and W == 0 :
        break
    print("#"*W)
    for x in range(H-2):
        print("#"+"."*(W-2)+"#")
    print("#"*W)
    print()
Buggy code:
while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        break
    else:
        for i in range(H):
            if i == 0 or i + 1 == H:
                print('#' * W)
            else:
                print('#' + "." * (W - 2) + '#')
        print()

Fixed code:
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:break
    print("#"*W)
    for i in range(H-2):
        print("#"+"."*(W-2)+"#")
    print("#"*W)
    print()
Buggy code:
while 1:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    print('#'*w)
    for i in range(h-2):
        print('#' + '.'*(w-2) + '#')
    print('#'*w)

Fixed code:
while True:
  h,w=map(int,input().split())
  if h==0 and w==0:
    break
  print("#"*w)
  for i in range (h-2):
      print("#"+"."*(w-2)+"#")
  print("#"*w)
  print()
Buggy code:
while True:
 H,W=map(int, input().split())
 if H==0 and W==0:
  break
 else:
  print(W*'#')
  for i in range(H-2):
   print('#'+'.'*(W-2)+'#')
  print(W*'#')

Fixed code:
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        print("#" * W)
        for h in range(H - 2):
            print("#" + "." * (W-2) + "#")
        print("#" * W)
        print ()
Buggy code:
while True:
    [h, w] = map(int, (input().split()))
    if h==0 and w==0:
        break
    else:   
        print("#"*w+"\n"+("#"+"."*(w-2)+"#\n")*(h-2)+"#"*w)

Fixed code:
while True:
    [h, w] = map(int, (input().split()))
    if h==0 and w==0:
        break
    else:   
        print("#"*w+"\n"+("#"+"."*(w-2)+"#\n")*(h-2)+"#"*w+"\n")
Buggy code:
while True:
    h,w = map(int,input().split())
    if h==0 and w==0:
        break
    print('#'*w)
    a=w-2
    for i in range(h-2):
        print('#' + '.' * a+ '#')
    print('#' * w)


Fixed code:
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:break
    print("#"*b)
    for i in range(a-2):
        print("#"+"."*(b-2)+"#")
    print("#"*b)
    print()
Buggy code:
while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    print('#'*W)
    for i in range(H-2):
        print('#'+'.'*(W-2)+'#')
    print('#'*W)
    print(' ')


Fixed code:
while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    print('#'*W)
    for i in range(H-2):
        print('#'+'.'*(W-2)+'#')
    print('#'*W)
    print('')
Buggy code:
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print('#' * W)
    for _ in range(H-2):
        print('#{0}#'.format('.' * (W-2)))
    print('#' * W)



Fixed code:
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print('#' * W)
    for _ in range(H-2):
        print('#{0}#'.format('.' * (W-2)))
    print('#' * W)
    print('')
Buggy code:
while True:
    m, n = list(map(int, input().split()))
    if m == n == 0:
        break
    print ("#" * n)
    for i in range(m-2):
        print ("#" + "." * (n-2) + "#")
    print ("#" * n)
    



Fixed code:
while True:
    m, n = list(map(int, input().split()))
    if m == n == 0:
        break
    print ("#" * n)
    for i in range(m-2):
        print ("#" + "." * (n-2) + "#")
    print ("#" * n)
    print ("")
Buggy code:
while(True):
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break

    print('#' * w)
    for i in range(0, h - 2):
        print('#' + '.' * (w - 2) + '#')
    print('#' * w)
    print()

Fixed code:
while True:
    h,w=map(int,input().split())
    if h==0 and w==0:
        break
    else:
        print("#"*w)
        for _ in range(h-2):
            print("#"+"."*(w-2)+"#")
        print("#"*w)
        print()
Buggy code:
while(True):
    w, h = map(int, input().split())
    if w == 0 and h == 0:
        break

    print('#' * w)
    for i in range(0, h - 2 + 1):
        print('#' + '.' * (w - 2) + '#')
    print('#' * w)
    print()

Fixed code:
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
        
    print("#" * w)
    for i in range(1, h- 1):
        print("#" + "." * (w - 2) + "#")
    print("#" * w)
    print()
Buggy code:
while True:

    W,H = tuple(map(int,input().split()))
    if W==0 & H==0:
        break
    print("#"*H)
    for i in range(1,W-1):
        print("#"+"."*(H-2)+"#")
    print("#"*H)
    print(\n)

Fixed code:
while True:

    W,H = tuple(map(int,input().split()))
    if W==0 & H==0:
        break
    print("#"*H)
    for i in range(1,W-1):
        print("#"+"."*(H-2)+"#")
    print("#"*H)
    print("")
Buggy code:
while True:
  H, W = map(int, input().split())
  if H == W == 0: break
  print('#' * W + '\n' + ('#' + '.' * (W - 2) + '#' + '\n') * (H - 2) + '#' * W)

Fixed code:
while True:
  H, W = map(int, input().split())
  if H == W == 0: break
  print('#' * W + '\n' + ('#' + '.' * (W - 2) + '#' + '\n') * (H - 2) + '#' * W + '\n')
Buggy code:
while True:
    x, y = (int(i) for i in input().split())
    if x ==0 and y == 0:
        break
    else:
        s = "#"
        line =  s * y
        print(line)
        for i in range(x):
            print("#"+"."*(y - 2)+"#")
        print(line)
        print()  

Fixed code:
while True:
    x, y = (int(i) for i in input().split())
    if x ==0 and y == 0:
        break
    else:
        s = "#"
        line =  s * y
        print(line)
        for i in range(x-2):
            print("#"+"."*(y - 2)+"#")
        print(line)
        print()
Buggy code:
while True:
    a, b = map(int, input().split())
    if a == 0: break
    print("#"*b)
    print()
    for i in range(a-2):
        print("#"+"."*(b-2)+"#")
    print()
    print("#"*b)
    print()
    print()


Fixed code:
while True:
    a, b = map(int, input().split())
    if a == 0: break
    print("#"*b)
    for i in range(a-2):
        print("#"+"."*(b-2)+"#")
    print("#"*b)
    print()
Buggy code:
s=input().split()
t=[int(i) for i in s]
H=t[0]
W=t[1]
while True:
    if H==0:
        break
    else:
        print("#"*W)
        for i in range(H-2):
            print("#"+"."*(W-2)+"#")
        print("#"*W)
        print()


Fixed code:
while True:
    s=input().split()
    t=[int(i) for i in s]
    H=t[0]
    W=t[1]
    if H==0:
        break
    else:
        print("#"*W)
        for i in range(H-2):
            print("#"+"."*(W-2)+"#")
        print("#"*W)
        print()
Buggy code:
while True:
    a,b=map(int,input().split())
    if a ==0 and b==0:
        break
    print("#"*b)
    for i in range(a):
        print("#"+"."*(b-2)+"#")
    print("#"*b)
    print("")


Fixed code:
while True:
    a,b=map(int,input().split())
    c=a-2
    d=b-2
    if a ==0 and b==0:
        break
    print("#"*b)
    for i in range(c):
        print("#"+"."*d+"#")
    print("#"*b)
    print("")
Buggy code:
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    for i in range(h):
        if i == 0 or i == h - 1:
            print('#'* w)
        else:
            print('#'+ '.'*(w - 2) +'#')

Fixed code:
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        print('#'*w)
        for i in range(h-2):
            print('#'+'.'*(w-2)+'#')
        print('#'*w)
        print()
Buggy code:
import sys
for line in sys.stdin:
    H, W = map(int, line.split())
    if H == 0 and W == 0:
        break
    print('#' * W)
    print(('#' + '.' * (W - 2) + '#\n') * (H - 2), end='')
    print('#' * W)

Fixed code:
import sys
for line in sys.stdin:
    H, W = map(int, line.split())
    if H == W == 0:
        break
    print('#' * W)
    print(('#' + '.' * (W - 2) + '#\n') * (H - 2), end='')
    print('#' * W)
    print()
Buggy code:
flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    if a==0 and b==0:
        flag=1
        break
    else:
        print("#"*b)
        for i in range(a-2):
            print("#",end="")
            print("."*(b-2),end="")
            print("#")
        print("#"*b)

Fixed code:
flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    if a==0 and b==0:
        flag=1
        break
    else:
        print("#"*b)
        for i in range(a-2):
            print("#",end="")
            print("."*(b-2),end="")
            print("#")
        print("#"*b)
    print("")
Buggy code:
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    p = a - 2
    c = ""
    for _ in range(a):
        c += "#"
    c += "\n"
    for _ in range(b - 2):
        c += "#"
        for __ in range(p):
            c += "."
        c += "#"
    c += "\n"
    for _ in range(a):
        c += "#"
    c += "\n"
    print(c)


Fixed code:
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    p = b - 2
    c = ""
    for _ in range(b):
        c += "#"
    c += "\n"
    for _ in range(a - 2):
        c += "#"
        for __ in range(p):
            c += "."
        c += "#"
        c += "\n"
    for _ in range(b):
        c += "#"
    c += "\n"
    print(c)
Buggy code:
while True:
  h,w=map(int,input().split())
  if h==0 & w==0:
    break
  print("#" * w)
  for i in range(h-2):
    print("#"+"."*(h-2)+"#")
  print("#" * w)
  print()


Fixed code:
while True:
  h,w=map(int,input().split())
  if h==0 & w==0:
    break
  print("#" * w)
  for i in range(h-2):
    print("#"+"."*(w-2)+"#")
  print("#" * w)
  print()
Buggy code:
while 1:
  h, w = map(int, input().split())
  if h == w == 0:
    break
  for i in  range(h):
    if i == 0 or i == h-1:
      print "#" * w
    else:
      print "#" + "."*(w - 2) + "#"
  print ""

Fixed code:
while(1):
	h,w = map(int,input().split())
	if(h==w==0):
		break;
	else:
		print('#'*w)
		for i in range(h-2):
			print('#'+'.'*(w-2)+'#')
		print('#'*w)
		print()
Buggy code:
while True:
	(x,y)=[int(i) for i in input().split()]
	if x==y==0:break
	print("#"*y)
	for i in range(1,x-1):
		print("#"+"."*(y-2)+"#")
	print("#"*y)

Fixed code:
while True:
	(x,y)=[int(i) for i in input().split()]
	if x==y==0:break
	print("#"*y)
	for i in range(1,x-1):
		print("#"+"."*(y-2)+"#")
	print("#"*y)
	print()
Buggy code:
while True:
    h,w = [int(x) for x in input().split( )]
    if h == w == 0:
        break
    else:
        print('#'*w)
        for i in range(h-2):
            print('{0}{1}{0}'.format('#','.'*(w-2)))
        print('#'*w)
        print(' ')







Fixed code:
while True:
    h,w = [int(x) for x in input().split( )]
    if h == w == 0:
        break
    else:
        print('#'*w)
        for i in range(h-2):
            print('{0}{1}{0}'.format('#','.'*(w-2)))
        print('#'*w)
        print('')
Buggy code:
while True:
    x = [int(i) for i in input().split()]
    if x[0] == 0 and x[1] == 0:
        break
    for w in range(x[1]):
        print("#",end="")
    print("")
    for h in range(x[0] - 2):
        print("#", end="")
        for w in range(x[1] - 2):
            print(".", end="")
        print("#", end="")
        print("")
    for w in range(x[1]):
        print("#",end="")
    print("")



Fixed code:
while True:
    x = [int(i) for i in input().split()]
    if x[0] == 0 and x[1] == 0:
        break
    for w in range(x[1]):
        print("#",end="")
    print("")
    for h in range(x[0] - 2):
        print("#", end="")
        for w in range(x[1] - 2):
            print(".", end="")
        print("#", end="")
        print("")
    for w in range(x[1]):
        print("#",end="")
    print("\n")
Buggy code:
while True :
  H,W = map(int,input().split())
  if W == 0 and H == 0 :
    break
  for i in range(H) : 
      if i == 0 and i == H-1 :       
        print('#'*W)
      else  :
        print('#' + '.'*(W-2) + '#')
      print('')


Fixed code:
while True:
    H,W = map(int,input().split())
    if  H ==0 and W ==0:
        break
    else:
        print('#'*W)
        for i in range(H-2):
            print('#','.'*(W-2),'#',sep="")
        print('#'*W)
        print()
Buggy code:
while True :
  H,W = map(int,input().split())
  if W == 0 and H == 0 :
    break
  for i in range(H) : 
      if i == 0 or i == H-1 :       
        print('#'*W)
      else  :
        print('#' + '.'*(W-2) + '#')
   print('')


Fixed code:
while 1:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    else:
        print("#"*W)
        for i in range(H-2):
            print("#"+"."*(W-2)+"#")
        print("#"*W)
    print("")
Buggy code:
while True:
    H,W = map(int, input().split())
    if H == W == 0: break
    print("#"*W)
    print(("#"+"."*(W-2)+"#\n")*(H-2),end="")
    print("#"*W)

Fixed code:
while True:
    H,W = map(int, input().split())
    if H == W == 0: break
    print("#"*W)
    print(("#"+"."*(W-2)+"#\n")*(H-2),end="")
    print("#"*W+"\n")
Buggy code:
figure = ''
height, width = [int(x) for x in input().split()]
while height or width:
    side = ('#' * width) + '\n'
    fill = '#' + ('.' * (width-2)) + '#\n'
    rect = side + (fill * (height-2)) + side
    figure += rect + '\n'

print(figure)

Fixed code:
figure = ''
height, width = [int(x) for x in input().split()]
while height or width:
    side = ('#' * width) + '\n'
    fill = '#' + ('.' * (width-2)) + '#\n'
    rect = side + (fill * (height-2)) + side
    figure += rect + '\n'
    height, width = [int(x) for x in input().split()]
  
print(figure[:-1])
Buggy code:
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        print("#","."*(w-2),"#",sep="")
    print("")

Fixed code:
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        print('#'*w)
        for hline in range(h-2):
            print('#', '.'*(w-2), '#', sep='')
        print('#'*w)
        print('')
Buggy code:
while True:
    h,w=map(int, input().split())
    if h==w== 0:break
    print('#' * w + '\n' +'#' + '.'*(w-2) + '#\n')*(h-2) +'#'* w + '\n')

Fixed code:
while True:
    h, w = map(int, input().split())
    if h == 0:
        break
    print('#'*w+'\n' + ('#'+'.'*(w-2)+'#\n')*(h-2) + '#'*w+'\n')
Buggy code:
while True:
    H,W = map(int,raw_input().split())
    if H == 0 and W == 0:
        break
    print "#"*W
    for i in range(2,H):
        print "#"+"."*(W-2)
    print "#"*W
    print ""

Fixed code:
while True:
    H,W=map(int,input().split())
    
    
    if H==0 and W==0:
        break
    else:
        print("#"*W)
        
        for i in range (H-2): 
            print("#"+"."*(W-2)+"#")
        
        print("#"*W)
    print()
Buggy code:
while True:
   H,W = map(int, input().split())
   if H == 0 and W == 0:
       break
   print('#' * W)
   for i in range(H - 2):
       print('#'+('.' * (W - 2))+ '#')
   print('#' * W)


Fixed code:
while True:
    H, W = map(int, input().split())
    if (H, W) ==(0, 0):
        break
    print("#" * W)
    for i in range(H-2):
        print("#" + "." * (W-2) + "#")
    print("#" * W)
    print()
Buggy code:
while True:
    h, w = [int(i) for i in input().split()]
    if w == h == 0:
        break
    print("#" * w, end="")
    print(("\n#" + "." * (w - 2) + "#") * (h - 2))
    print("#" * w)



Fixed code:
while True:
    h, w = [int(i) for i in input().split()]
    if w == h == 0:
        break
    print("#" * w, end="")
    print(("\n#" + "." * (w - 2) + "#") * (h - 2))
    print("#" * w, end="\n\n")
Buggy code:
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:break
    print('#'*w)
    print(('#'*(w-2) + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')

Fixed code:
while True:
    h,w = map(int,input().split())
    if h == w == 0:break
    print('#'*w)
    print(('#' + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')
Buggy code:
whlie True:
  HW=input().split()
  HW=[int(x) for x in HW]
  if HW[0] == 0: break
  print('#'*HW[1])
  for i in range(HW[0]-2):
    print('#',end='')
    print('.'*(HW[1]-2),end='#')
  print('#'*HW[1])
  print()

Fixed code:
while True:
  HW=input().split()
  HW=[int(x) for x in HW]
  if HW[0] == 0: break
  print('#'*HW[1])
  for i in range(HW[0]-2):
    print('#',end='')
    print('.'*(HW[1]-2),end='#')
    print()
  print('#'*HW[1])
  print()
Buggy code:
while True:
    h, w= list(map(int,input().split()))
    if h!=0 or w!=0:
        print("#"*w)
        for i in range(h-2):
            print("#"+"."*(w-2)+"#")
        print("#"*w,"\n")
    else:
        break

Fixed code:
while True:
    h, w= list(map(int,input().split()))
    if h!=0 or w!=0:
        print("#"*w)
        for i in range(h-2):
            print("#"+"."*(w-2)+"#")
        print("#"*w)
        print()
    else:
        break
Buggy code:
while True:
    H, W = [int(x) for x in input().split()]
    if H == 0 and W == 0:
        break
    print("#" * W)
    for i in range(0, H-2):
        print("#", "."*(W-2), "#")
    print("#" * W)
    print("")



Fixed code:
while True:
    H, W = [int(x) for x in input().split()]
    if H == 0 and W == 0:
        break
    print("#" * W)
    for i in range(0, H-2):
        print("#", "."*(W-2), "#",sep="")
    print("#" * W)
    print("")
Buggy code:
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:
        break
    print("#"*W)
    for i in range(H-2):
        print("#","."*(W-2),"#",sep=' ')
    print("#"*W)
    print()


Fixed code:
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:
        break
    print("#"*W)
    for i in range(H-2):
        print("#"+"."*(W-2)+"#")
    print("#"*W)
    print()
Buggy code:
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:
        break
    print("#"*W)
    for i in range(H-2):
        print("#","."*(W-2),"#".split())
    print("#"*W)
    print()


Fixed code:
import sys

while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0: break

    print("#" * W)
    for i in range(H - 2):
        print("#" + ("." * (W - 2)) + "#")
    print("#" * W)
    print()
Buggy code:
while True:
  h,w=map(int,input().split())
  if h==w==0:
      break

  print("#"*w)
  for i in range(h-2):
    print("#"+" . "*(w-2)+"#")

  print("#"*w)



Fixed code:

while True:
    h,w = map(int,input().split())
    if h == 0:break
    print ("#"*w)
    for i in range(h-2):
        print ("#"+"."*(w-2)+"#")
    print ("#"*w)
    print ()
Buggy code:
ans=[]

while True:
    H,W=map(int,input().split())
    if W==H==0:
        break
    ans.append('#'*W+'\n')

    for i in range(H-2):
        ans.append('#'+'.'*(W-2)+'#\n')

    ans.append('#'*W+'\n')

print('\n'.join(ans))


Fixed code:
ans=[]

while True:
    H,W=map(int,input().split())
    if W==H==0:
        break
    r=''
    r+='#'*W+'\n'

    for i in range(H-2):
        r+='#'+'.'*(W-2)+'#\n'

    r+='#'*W+'\n'
    ans.append(r)

print('\n'.join(ans))
Buggy code:
l = []
while True:
  h,w = map(int,input().split())
  if (h,w) == (0,0):
    break
  else:
    l.append([h,w])
for i in l:
  print('#'*i[1])
  for j in range(i[0]-2):
    print('#'+' '*(i[1]-2)+'#')
  print('#'*i[1])
  print()

Fixed code:
l = []
while True:
  h,w = map(int,input().split())
  if (h,w) == (0,0):
    break
  else:
    l.append([h,w])
for i in l:
  print('#'*i[1])
  for j in range(i[0]-2):
    print('#'+'.'*(i[1]-2)+'#')
  print('#'*i[1])
  print()
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
	boxes = []
	while True:
		h, w = [int(i) for i in input().split(" ")]
		if h == 0 and w == 0:
			break
		boxes.append([h, w])
	for i in boxes:
		print("#"* i[1])
		for j in range(i[0] - 2):
			print("#"+ "." * (i[1] - 2) + "#")
		print("#"* i[1],"\n")
	return
if __name__ == '__main__':
  main()

Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
	boxes = []
	while True:
		h, w = [int(i) for i in input().split(" ")]
		if h == 0 and w == 0:
			break
		boxes.append([h, w])
	for i in boxes:
		print("#"* i[1])
		for j in range(i[0] - 2):
			print("#"+ "." * (i[1] - 2) + "#")
		print("#"* i[1])
		print()
	return
if __name__ == '__main__':
  main()
Buggy code:
'''
ITP-1_5-B
 ?????¬???????????????
??\????????????????????????H cm ?????? W cm ???????????????????????°?????????????????????????????????
##########
#........#
#........#
#........#
#........#
##########
?????????????????? 6 cm ?????? 10 cm ???????????¨??????????????????
???Input
??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????
H W
H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????
???Output
?????????????????????????????????????????? H cm ?????? W cm ?????????????????????????????????
?????????????????????????????????????????????????????\??????????????????
'''
# import
import sys

for line in sys.stdin:
    # ?????°??????????????????
    H, W = map(int, line.split())
    if H == 0 and W == 0:
        break
    # ?????¢??????
    print('#' * W)
    for a in range(H-2):
        print('#'+'.'*(W-2)+'#')
    print('#' * W)

Fixed code:
'''
ITP-1_5-B
 ?????¬???????????????
??\????????????????????????H cm ?????? W cm ???????????????????????°?????????????????????????????????
##########
#........#
#........#
#........#
#........#
##########
?????????????????? 6 cm ?????? 10 cm ???????????¨??????????????????
???Input
??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????
H W
H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????
???Output
?????????????????????????????????????????? H cm ?????? W cm ?????????????????????????????????
?????????????????????????????????????????????????????\??????????????????
'''
# import
import sys

for line in sys.stdin:
    # ?????°??????????????????
    H, W = map(int, line.split())
    if H == 0 and W == 0:
        break
    # ?????¢??????
    print('#' * W)
    for a in range(H-2):
        print('#'+'.'*(W-2)+'#')
    print('#' * W)
    print('')
Buggy code:
while True:    
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        print("#"*W)
        while H > 2:
            print("#"+"."*(W-2)+"#")
            H -= 1
        print("#"*W)
        

Fixed code:
while True:    
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    else:
        print("#"*W)
        while H > 2:
            print("#"+"."*(W-2)+"#")
            H -= 1
        print("#"*W)
        print("")