qyliang/CodeNanoFix huggingface dataset:
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)
    print()


Fixed code:
while True:
    H,W= list(map(int, input().split()))
    if H == 0 and W == 0:
        break
    x = "#" * W
    y = "#" + "." * (W-2) + "#"
    print(x)
    for i in range(H-2):
        print(y)
    print(x)
    print()
Buggy code:
while True:
    H,W = map(int,input().split())
    if H ==0 and W==0: break
    for i in range(0,H) :
        
        if(i==0 and i == 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(0,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
    for i in range(0,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
    print("#" * W)
    for i in range(1, H - 1):
        print("#", end="")
        print("." * (W - 2), end="")
        print("#")
    print("#" * W)
    print()
Buggy code:
while 1:
 H, W = map(int, input().split())
 if H == 0 and W == 0:
  break
 print("#"*W)
 line = '#' + ('.' * (W - 2)) + '#'
 for i in range(0, H - 2):
  print(line)
 print("#"*W,'\n')

Fixed code:
while 1:
 H, W = map(int, input().split())
 if H == 0 and W == 0:
  break
 print("#"*W)
 line = '#' + ('.' * (W - 2)) + '#'
 for i in range(0, H - 2):
  print(line)
 print("#"*W)
 print()
Buggy code:
while 1:
 H, W = map(int, input().split())
 if H == 0 and W == 0:
  break
 print("#"*W)
 line = '#' + ('.' * (W - 2)) + '#'
 for i in range(0, H - 2):
  print(line)
 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 W == 0 and H == 0:
    break
  print "#"*W
  for i in range(1, H-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:
	H,W = list(map(int, input().split()))
	if (H == 0 and W == 0):
		break
	else:
		for n in range(H):
			s = ""
			for m in range(W):
				if ((n % 2 == 1) and (m % 2 == 0)) or5 6 ((n % 2 == 0) and (m % 2 == 1)):
					s += "."
				else:
					s += "#"
			print(s)
		print("")

Fixed code:
while True:
	H,W = list(map(int, input().split()))
	if (H == 0 and W == 0):
		break
	else:
		for n in range(H):
			s = ""
			for m in range(W):
				if ((n % 2 == 1) and (m % 2 == 0)) or ((n % 2 == 0) and (m % 2 == 1)):
					s += "."
				else:
					s += "#"
			print(s)
		print("")
Buggy code:
while True:
     (H, W) = [int(x) for x in input().split()]
     if H == Q == 0:
         break
    
     for hc in range(H):
            for wc in range(W):
                  if (hc + wc) % 2 == 0:
                       print('#', end='')
                  else:
                       print('.',end='')
            print()
     print()

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

        for j in range(w):
            if j%2 == 1:
                print(sym1,end="")
            else:
                print(sym2,end="")
        print("")
    
    print("")

Fixed code:
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        if i%2 == 1:
            sym1 = "#"
            sym2 = "."
        else:
            sym1 = "."
            sym2 = "#"

        for j in range(w):
            if j%2 == 1:
                print(sym1,end="")
            else:
                print(sym2,end="")
        print("")
    
    print("")
Buggy code:
y,x = [int(x) for x in input().split()]
even = "#." * 151
odd  = ".#" * 151
while(x > 0 or y > 0):
    for i in range(y):
        if(y % 2 == 0):
            print(even[:x])
        else:
            print(odd[:x])
    print()          
    y,x = [int(x) for x in input().split()]

Fixed code:
y,x = [int(x) for x in input().split()]
even = "#." * 151
odd  = ".#" * 151
while(x > 0 or y > 0):
    for i in range(y):
        if(i % 2 == 0):
            print(even[:x])
        else:
            print(odd[:x])
    print()          
    y,x = [int(x) for x in input().split()]
Buggy code:
import sys
num = []
for i in sys.stdin:
    H, W = i.split()
    if H == W == '0':
        break
    num.append((int(H), int(W)))

before = '.'
for cnt in range(len(num)):
    for h in range(num[cnt][0]):
        if before == '#':
            before = '.'
        elif before == '.':
            before = '#'
        for w in range(num[cnt][1]):
            if before == '.':
                print('#',end='')
                before = '#'
            elif before == '#':
                print('.',end='')
                before = '.'
        print()
    print()

Fixed code:
import sys
num = []

for i in sys.stdin:
    H, W = i.split()
    if H == W == '0':
        break
    num.append((int(H), int(W)))

for cnt in range(len(num)):
    output = []
    for h in range(num[cnt][0]):
        before = '#'
        for w in range(num[cnt][1]):
            if h == 0:
                if before == '.':
                    before = '#'
                elif before == '#':
                    before = '.'
                output.append(before)

        for z in range(num[cnt][1]):
            if output[z] == '#':
                output[z] = '.'
            elif output[z] == '.':
                output[z] = '#'
                
        for y in range(num[cnt][1]):
            print(output[y],end='')

        print()
    print()
Buggy code:
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    
    c = ""
    for i in range(H):
        if i % 2 == 0:
            for j in range(W):
                if j % 2 == 0:
                    c += "#"
                else:
                    c += "."
            c += "\n"
        else:
            for k in range(W):
                if k % 2 == 0:
                    c += "."
                else:
                    c += "#"
            c += "\n"
    print(c)
    print()


Fixed code:
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    
    c = ""
    for i in range(H):
        if i % 2 == 0:
            for j in range(W):
                if j % 2 == 0:
                    c += "#"
                else:
                    c += "."
            c += "\n"
        else:
            for k in range(W):
                if k % 2 == 0:
                    c += "."
                else:
                    c += "#"
            c += "\n"
    print(c)
Buggy code:
while True:
    H, W = [int(x) for x in input().split(" ")]
    if H == W == 0:
        break
    for i in range(H):
        if (H + 1) % 2 == 1:
            print( "#." * (W // 2) + "#" * (W % 2))
        else:
            print(".#" * (W // 2) + "." * (W % 2))
    print("")

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


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


Fixed code:
a, b = map(int,input().split())
while a != 0:
    cnt = 1
    while cnt <= a:
        if cnt%2 == 1:
            if b%2 == 0:
                print('#.'*(b//2))
            else:
                print('#.'*(b//2)+'#')
        else:
            if b%2 == 0:
                print('.#'*(b//2))
            else:
                print('.#'*(b//2)+'.')
        cnt += 1
    print()
    a, b = map(int,input().split())
Buggy code:
H, W = map(int, input().split())
while true:
 if H ==0 and W == 0:
  break
 for h in range(H):
  if h%2 == 0:
   print("#."*(W//2) + "#"*(W%2))
  else:
   print(".#"*(W//2) + "."*(W%2))
 print()

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

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

 H, W = map(int, input().split())
Buggy code:
while True:
    s=input().split()
    h=int(s[0])
    w=int(s[1])
    if h==0:
        break
    for i in range(1,h+1):
        if i%2==1:
            if w%2==0:
                print("#."*(w//2))
            else:
                print("#."*(w//2)+".")
        else:
            if w%2==0:
                print(".#"*(w//2))
            else:
                print(".#"*(w//2)+".")
        print()


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

Fixed code:
while True:
 
    H,W =[int(i) for i in input().split()]
 
    if H == W == 0:
        break
 
    for h in range(H):
        for w in range(W):
            if (h+w) % 2 ==0:
                print('#', end='')
            else :
                print('.' ,end='')
        print()
    print()
Buggy code:
import sys
while True:
	x,y = map(int,input().split())
	if x==y==0:
		break
	cnt = 0
	for i in range(y):
		for j in range(x):
			if cnt%2 == 0:
				sys.stdout.write("#")
			else:
				sys.stdout.write(".")
			cnt+=1
		print()
	print()

Fixed code:
import sys
while True:
	y,x = map(int,input().split())
	if x==y==0:
		break
	for i in range(y):
		for j in range(x):
			if (i+j)%2==0:
				sys.stdout.write("#")
			else:
				sys.stdout.write(".")
		print()
	print()
Buggy code:
while True:
    a = list(map(int, input().split()))
    b = a[0]
    c = a[1]
    if b == c == 0:
        break
    for i in range(1, b+1):
        if i % 2 != 0:
            if c % 2 == 0:
                print('#.' * (c / 2))
            else:
                print('#.' * (c // 2) + '#')
        else:
            if c % 2 == 0:
                print('.#' * (c / 2))
            else:
                print('.#' * (c // 2) + '.')
    print()

Fixed code:
while True:
    a = list(map(int, input().split()))
    b = a[0]
    c = a[1]
    if b == c == 0:
        break
    for i in range(1, b+1):
        if i % 2 != 0:
            if c % 2 == 0:
                print('#.' * (c // 2))
            else:
                print('#.' * (c // 2) + '#')
        else:
            if c % 2 == 0:
                print('.#' * (c // 2))
            else:
                print('.#' * (c // 2) + '.')
    print()
Buggy code:
while True:
    H,W = [int(x) for x in input().split()]
    if H == 0 and W == 0: break
    for i in range(H):
        for j in range(W):
            if (i+j)%2 == 0: print("#", end="")
            else: print(".", end="")
    print()


Fixed code:
while True:
    H,W = [int(x) for x in input().split()]
    if H == 0 and W == 0: break
    for i in range(H):
        for j in range(W):
            if (i+j)%2 == 0: print("#", end="")
            else: print(".", end="")
        print()
    print()
Buggy code:
from sys import stdin

while True:
    h, w = (int(n) for n in stdin.readline().rstrip().split())
    
    if h == w == 0:
        break

    for cnt in range(h):
        print(('#.' * ((w + 2) // 2))[cnt % 2: w + cnt % 2])



Fixed code:
from sys import stdin

while True:
    h, w = (int(n) for n in stdin.readline().rstrip().split())

    if h == w == 0:
        break

    for cnt in range(h):
        print(('#.' * ((w + 2) // 2))[cnt % 2: w + cnt % 2])

    print()
Buggy code:
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    for i in range(h):
        if i % 2 == 1:
            if w % 2 == 0:
                print('.#'*(w//2))
            elif w % 2 == 1:
                print('{}.'.format(".#"*(w//2)))
        if i % 2 == 0:
            if w % 2 == 0:
                print('#.'*(w//2))
            elif w % 2 == 1:
                print('{}#'.format('.#'*(w//2)))
    print()


Fixed code:
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    for i in range(h):
        if i % 2 == 1:
            if w % 2 == 0:
                print('.#'*(w//2))
            elif w % 2 == 1:
                print('{}.'.format(".#"*(w//2)))
        if i % 2 == 0:
            if w % 2 == 0:
                print('#.'*(w//2))
            elif w % 2 == 1:
                print('{}#'.format('#.'*(w//2)))
    print()
Buggy code:
def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
    
def main():
    while True:
        a = numinput()
        if a[0] == 0 and a[1] == 0: break
        H = a[0];  W = a[1]
        for i in range(H):
            bar = ""
            for j in range(W):
                if i + j == 0: bar += "#"
                else: bar += "."
            if i < H - 1: print(bar)
            else: print(bar + '\n')
    
if __name__ == "__main__":
    main()


Fixed code:
def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
    
def main():
    while True:
        a = numinput()
        if a[0] == 0 and a[1] == 0: break
        H = a[0];  W = a[1]
        for i in range(H):
            bar = ""
            for j in range(W):
                if (i + j) % 2 == 0: bar += "#"
                else: bar += "."
            if i < H - 1: print(bar)
            else: print(bar + '\n')
    
if __name__ == "__main__":
    main()
Buggy code:
while True:
    h,w = map(int,input().split())
    if h==0 and w==0:
        break
    for i in range(h):
        for j in range(w):
           if (i+j)%2==0:
               print('#',end='')
           else:
               print('.',end='')
        print()


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

	for hc in range(H):
		for wc in range(W):
			if (hc + wc) % 2 ==0:
				print('#', end='')
			else:
				print(',', end='')
		print()
	print()

Fixed code:
while True:
    (H, W) = [int(i) for i in input().split()]
    if  (H == 0 == W):
        break
    for hc in range(H):
        for wc in range(W):
            if(hc + wc) %  2 == 0:
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()
Buggy code:
while True:
    a,b=input().split()
    h = int(a)
    w=int(b)
    if h==0 and w==0:
        break
    odd = "#."*300
    even= ".#"*300
    for i in range(h):
        if (i%2)==0:
            print(even[:w])
        else:
            print(odd[:w])
    print("")

Fixed code:
while True:
    a,b=input().split()
    h = int(a)
    w=int(b)
    if h==0 and w==0:
        break
    odd = "#."*300
    even= ".#"*300
    for i in range(h):
        if (i%2)==0:
            print(odd[:w])
        else:
            print(even[:w])
    print("")
Buggy code:
from itertools import cycle, islice

gen = lambda w: cycle(("".join(islice(cycle("#."), w)),
                       "".join(islice(cycle(".#"), w))))

def print_lines(h, w):
    for line in islice(gen(w), h):
        print(line)
    print(h, w)

while True:
    s = input()

    if s == "0 0":
        break
    else:
        h, w = list(map(int, s.split()))
        print_lines(h, w)

Fixed code:
from itertools import cycle, islice

gen = lambda w: cycle(("".join(islice(cycle("#."), w)),
                       "".join(islice(cycle(".#"), w))))

def print_lines(h, w):
    for line in islice(gen(w), h):
        print(line)
    print()

while True:
    s = input()

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

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

Fixed code:
while 1:
 h,w=map(int,input().split())
 if h==0:break
 for i in range(h):print(('#.'*w)[i%2:][:w])
 print()
Buggy code:
while True:
    line = input()
    data = line.split()
    h = int(data[0])
    w = int(data[1])
    if h == 0 and w == 0:
        break

    for i in range(h):   
        for j in range(w):
            if i%2 == 1:
                if j%2 == 0: 
                    print("#", end="")
                elif j%2 == 1:
                    print(".", end="")
            elif i%2 == 0:
                if j%2 == 0:
                    print(".", end="")
                elif j%2 == 1:
                    print("#", end="")
        print("")
    print("")







Fixed code:
while True:
    line = input()
    data = line.split()
    h = int(data[0])
    w = int(data[1])
    if h == 0 and w == 0:
        break

    for i in range(h):   
        for j in range(w):
            if i%2 == 0:
                if j%2 == 0: 
                    print("#", end="")
                elif j%2 == 1:
                    print(".", end="")
            elif i%2 == 1:
                if j%2 == 0:
                    print(".", end="")
                elif j%2 == 1:
                    print("#", end="")
        print("")
    print("")
Buggy code:
a = []
while True:
    d = list(map(int,input().split()))
    if d == [0,0]:
        break
    a.append(d)

for H,W in a:
    for i in range(0,W):
        s = ''
        for j in range(0,H):
            if (i - j) % 2 == 0:
                s += '#'
            else:
                s += '.'
        print(s)
    print('')

Fixed code:
a = []
while True:
    d = list(map(int,input().split()))
    if d == [0,0]:
        break
    a.append(d)

for H,W in a:
    for i in range(0,H):
        s = ''
        for j in range(0,W):
            if (i - j) % 2 == 0:
                s += '#'
            else:
                s += '.'
        print(s)
    print('')
Buggy code:
# -*- coding: utf-8 -*-

a = ['#', '.']

while True:
    n = list(map(int, input().split()))
    if n[0] == 0 & n[1] == 0:
        break

    for i in range(n[0]):
        for j in range(n[1]):
            print('{0}'.format(a[(i + j) % 2]))

        print()

    print()



Fixed code:
# -*- coding: utf-8 -*-

a = ['#', '.']

while True:
    n = list(map(int, input().split()))
    if n[0] == 0 & n[1] == 0:
        break

    for i in range(n[0]):
        for j in range(n[1]):
            print('{0}'.format(a[(i + j) % 2]), end='')

        print()

    print()
Buggy code:
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    else:
        for i, _ in enumerate(range(a)):
            if i % 2 == 1:
                if b % 2 == 1:
                    print('#.' * (b // 2) + '#')
                else:
                    print('#.' * (b // 2))
            else:
                if b % 2 == 1:
                    print('.#' * (b // 2) + '.')
                else:
                    print('.#' * (b // 2))
        print()


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

	if (H == 0 and W == 0) : break
	for i in range(W):
		if (i % 2 == 0) : a = a + "#"
		else : a = a + "."
	for i in range(W):
		if (i % 2 == 0) : b = b + "."
		else : b = b + ???#???

	for j in range(H):
		if j % 2 == 0: print(a)
		else : print(b)

	print()

Fixed code:
while True:
	a = ""
	b = ""
	H, W = map(int, input().split())

	if H == 0 and W == 0 : break

	for i in range(W):
		if i % 2 == 0 : a = a + "#"
		else : a = a + "."
	for i in range(W):
		if i % 2 == 0 : b = b + "."
		else : b = b + "#"

	for j in range(H):
		if j % 2 == 0: print(a)
		else : print(b)

	print()
Buggy code:
def chess(H,W):
  if(H+W) % 2 == 0:
    return '#'
  return '.'

while True:
  H , W = map(int, input().split())
  if H == 0 and W == 0:
    break
    for i in range(H):
      for j in range(W):
        print(chess(i,j), end='')
        print()
        print()


Fixed code:
def chess(H,W):
  if(H+W) % 2 == 0:
    return '#'
  return '.'

while True:
  H , W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(i,j), end='')
    print()
  print()
Buggy code:
while True:
    [H,W]=[int(x) for x in input().split()]
    if [H,W]==[0,0]:
        break
    unit="#."
    for i in range(0,H):
        print(unit*(W/2)+unit[0]*(W%2))
        unit=unit[1]+unit[0]
    print("")

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

Fixed code:
while True:
    h, w = map (int,input().split(" "))
    if h == w == 0 : break
    for y in range(h):
        print(''.join('#.'[(x+y) %2] for x in range(w)))
    print("")