qyliang/CodeNanoFix huggingface dataset:
Buggy code:
while True:
    h, w = map(int, input().split())
    if w+h == 0:
        break
    line = ""
    for y in range(h):
        for x in range(w):
            if (y+x) % 2 == 0:
                line += "#"
            else:
                line += "."
        print(line)
    print()



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

Fixed code:
while(True):
    H, W = map(int, input().split())
    if(H == W == 0):
        break
    str = "#." * (W // 2 + 1)
    for i in range(H):
        if(i % 2 == 0):
            print(str[:W:])
        else:
            print(str[1:W + 1:])
    print()
Buggy code:
while(True):
    H, W = map(int, input().split())
    if(H == 0 and W == 0):
        break
    else:
        fir = "#"
        sec = "."
        for i in range(H):
            for k in range(W):
                if k%2:
                    print(fir, end = "")
                else:
                    print(sec, end = "")
            tmp = fir
            fir = sec
            sec = tmp
            print("")


Fixed code:
while(True):
    H, W = map(int, input().split())
    if(H == 0 and W == 0):
        break
    else:
        fir = "#"
        sec = "."
        for i in range(H):
            for k in range(W):
                if k%2:
                    print(sec, end = "")
                else:
                    print(fir, end = "")
            tmp = fir
            fir = sec
            sec = tmp
            print("")
        print("")
Buggy code:
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        for i in range(1, h+1):
            if i % 2 == 0:
                for j in range(1, w+1):
                    if j % 2 == 0:
                        print("#",end="")
                    else:
                        print(".",end="")
                print("")
            else:
                for j in range(1, w+1):
                    if 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(1, h+1):
            if i % 2 == 0:
                for j in range(1, w+1):
                    if j % 2 == 0:
                        print("#",end="")
                    else:
                        print(".",end="")
                print("")
            else:
                for j in range(1, w+1):
                    if j % 2 == 0:
                        print(".",end="")
                    else:
                        print("#",end="")
                print("")
        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:
h, w = map(int, input().split())
toggle = True
while h != 0:
    # print off the chess board
    for i in range(h):
        for j in range(w):
            char = "#" if (i+j) % 2 == 0 else "."
            print(char, end="")
        print()
    h, w = map(int, input().split())


Fixed code:
h, w = map(int, input().split())
toggle = True
while h != 0:
    # print off the chess board
    for i in range(h):
        for j in range(w):
            char = "#" if (i+j) % 2 == 0 else "."
            print(char, end="")
        print()
    h, w = map(int, input().split())
    print()
Buggy code:
while(True):
	H,W=list(map(int,input().split()))
	if H==0 and W==0:
		break
	l1=""
	for i in range(W):
		if i%2==0:
			l1+="#"
		else:
			l1+="."
	l1+="\n"
	l2=""
	for i in range(W):
		if i%2==0:
			l2+="."
		else:
			l2+="#"
	l2+="\n"

	l=""
	for i in range(N):
		if i%2==0:
			l+=l1
		else:
			l+=l2

	print(l)

Fixed code:
while(True):
	H,W=list(map(int,input().split()))
	if H==0 and W==0:
		break
	l1=""
	for i in range(W):
		if i%2==0:
			l1+="#"
		else:
			l1+="."
	l1+="\n"
	l2=""
	for i in range(W):
		if i%2==0:
			l2+="."
		else:
			l2+="#"
	l2+="\n"

	l=""
	for i in range(H):
		if i%2==0:
			l+=l1
		else:
			l+=l2

	print(l)
Buggy code:
list = []

while True:
    H, W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    list.append([H, W])

for i in range(len(list)):
    for j in range(list[i][0]):
        for k in range(list[i][1]):
            print('#', end='')
        print()
    print()

Fixed code:
list = []

while True:
    H, W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    list.append([H, W])

for i in range(len(list)):
    for j in range(list[i][0]):
        for k in range(list[i][1]):
            if j % 2 == 1:
                print('#',end='') if k % 2 == 1 else print('.',end='')
            else:
                print ('#',end='') if k % 2 == 0 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):
        s = ''
        for j in range(w):
            s += '#' if ((i + j) % 2 == 0) else s += '.'
        print(s)
    print()



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

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) = [int(i) for i in inpput().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 == 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:
    w,h = map(int,input().split())
    if w == 0 and h == 0:
        break
    for j in range(h):
        for i in range(w):
            if (i % 2 == 0 and j % 2 == 0) or (i % 2 == 1 and j % 2 == 1):
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()

Fixed code:
while True:
    h,w = map(int,input().split())
    if w == 0 and h == 0:
        break
    for j in range(h):
        for i in range(w):
            if (i % 2 == 0 and j % 2 == 0) or (i % 2 == 1 and j % 2 == 1):
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()
Buggy code:
import sys
for i in sys.stdin.readlines(): 
    nums = list(map(int,i.split()))
    h = nums[0]
    w = nums[1]
    if h == 0 and w == 0:
        break
    for j in range(1,h+1):
        if h == 1 and w == 1:
            print("#")
        elif j % 2 == 1:
            x = int(w/2)
            print("#."*x)
        elif j % 2 == 0:
            x = int(w/2)
            print(".#"*x)
    print("")

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


Fixed code:
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:break
    for i in range(a):
    	for j in range(b):
    		if (i + j)%2 == 0:print('#',end="")
    		else:print(".",end="")
    	print("")
    print("")
Buggy 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()

Fixed code:
while True:
    (H, W) = [int(i) for i in input().split()]
 
    if H == W == 0:
        break
 
    for i in range(H):
        for r in range(W):
            if (i + r) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')
            #print('#', end='') if (i + r) % 2 == 0 else print('.', end='')
        print()
    print()
Buggy code:
# -*- coding:utf-8 -*-
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 or (i+j)==0:
                print("#",end = '')
            else:
                print(".",end='')
        print()

Fixed code:
# -*- coding:utf-8 -*-
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 or (i+j)==0:
                print("#",end = '')
            else:
                print(".",end='')
        print()
    print()
Buggy code:
while True:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j)%2==0: print('#',end="")
            else: p0rint('.',end="")
        print('')
    print('')


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

Fixed code:
while(True):
  h,w=map(int,input().split())
  if h==0 and w==0:
    break
  rect=''
  for i in range(h):
    for j in range(w):
      if (i+j)%2  == 0:
        rect+='#'
      else:
        rect+='.'
    rect+='\n'
  print(rect)
Buggy code:
while 1:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:print('#',end='')
            else print('.',end='')
        print()
    print()

Fixed code:
while 1:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:print('#',end='')
            if (x+y)%2==1: print('.',end='')
        print()
    print()
Buggy code:
import sys
lines=sys.stdin.readlines()
for line in lines:
    H,W=map(int,line.split())
    if H == W == 0: break
    for i in range(H):
        unit='#.' if i % 2 == 0 else '.#'
        print((unit*(W+1)//2)[1:W])
    print('')

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

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

   for i in range(H/2):
      if H % 2 == 0:
         for j in range(W/2):
            if W % 2 == 0:
               print("#." * (W/2))
               print("")
               print(".#" * (W/2))
            else:
               print("#."*(W/2) + "#")
               print("")
               print(".#"*(W/2) + ".")
         print("")

      else:
         for j in range(W/2):
            if W % 2 == 0:
               print("#." * (W/2))
               print("")
               print(".#" * (W/2))
            else:
               print("#."*(W/2) + "#")
               print("")
               print(".#"*(W/2) + ".")
         if W % 2 == 0:
            print("#." * (W/2))
         else:
            print("#."*(W/2) + "#")
         print("")


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

Fixed code:
while True:
	h,w = map(int, input().split())
	if h == 0 and w == 0:
		break
	for y in range(h):
		print(''.join('#.'[(x + y) % 2] for x in range(w)))
	print()
Buggy code:
while True:
    a=input().split()
    h=int(a[0])
    w=int(a[1])
    if h==0 and w==0:
        break
    count=0
    count2=0
    for i in range(h):
        count+=1
        if count2%2==1:
            count==0
        count2+=1
        for i in range(w):
            if count%2==1:
                print("#",end="")
            else:
                print(".",end="")
            count+=1
        print()
    print()
        



Fixed code:
while True:
    a=input().split()
    h=int(a[0])
    w=int(a[1])
    if h==0 and w==0:
        break
    count=0
    count2=0
    for i in range(h):
        count=1
        if count2%2==1:
            count=0
        count2+=1
        for i in range(w):
            if count%2==1:
                print("#",end="")
            else:
                print(".",end="")
            count+=1
        print()
    print()
Buggy code:

while True:
    h, w = map(int, input().split())
    if h == 0: break

    for i in range(h):
        for j in range(w):
            if (i+j) % 2 == 0 : print("#")
            else : print(".")
        print() 
    print()


Fixed code:

while True:
    h, w = map(int, input().split())
    if h == 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:
while True:
	flag = 0
	line = input().split()
	h = int(line[0])
	w = int(line[1])
	
	if h == 0 and w == 0:
		break
	
	for i in range(h):
		if i % 2 == 0:
			for j in range(w):
				if(j%2==0):
					print("#",end='')
				else:
					print(".",end='')
		else:
			for j in range(w):
				if(j%2==0):
					print(".",end='')
				else:
					print("#",end='')
		print()
                print()


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

while True:
    h, w = map(int, input().split())
    if h == 0: break

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



Fixed code:
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0:
        break
    for j in range(h):
        if j % 2 == 0:
            for i in range(w):
                if i % 2 == 0:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
        else:
            for i in range(w):
                if i % 2 == 1:
                    print("#", end="")
                else:
                    print(".", end="")
            print()
    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 % 2 == 1 and j % 2 == 1) or (i % 2 == 0 and 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 % 2 == 1 and j % 2 == 1) or (i % 2 == 0 and j % 2 == 0):
                print ('#', end='')
            else:
                print ('.', end='')
        print ('')
    print ('')
Buggy code:
H=1
W=1
while H!=0 or W!=0:
	H,W = [int(i) for i in input().split()]
	if H!=0 or W!=0:
		for i in range(H):
			if i%2 == 0:
				for j in range(W):
					if j%2 == 0:
						print('#', end='')
					else:
						print('.', end='')
				print()
			else:
				for j in range(W):
					if j%2 == 0:
						print('#', end='')
					else:
						print('.', end='')
				print()
		print()

Fixed code:
H=1
W=1
while H!=0 or W!=0:
	H,W = [int(i) for i in input().split()]
	if H!=0 or W!=0:
		for i in range(H):
			if i%2 == 0:
				for j in range(W):
					if j%2 == 0:
						print('#', end='')
					else:
						print('.', end='')
				print()
			else:
				for j in range(W):
					if j%2 == 0:
						print('.', end='')
					else:
						print('#', end='')
				print()
		print()
Buggy code:
def listToStr(list):
    return ''.join(list)

def getChar(h, w):
    h_parity = h % 2
    w_parity = w % 2
    total_parity = (h_parity + w_parity) % 2
    
    if total_parity == 0:
        return "#"
    else:
        return "."

def getMatrix(h, w):
    result = []
    for i in range(h):
        result.append([])
        for j in range(w):
            result[i].append(getChar(i, j))
    return result

def input_parse():
    inputs = []
    while True:
        input_HW = input().split(",")
        (h, w) = (int(input_HW[0]),int(input_HW[1]))
        if h == 0 and w == 0:
            break
        inputs.append((h, w))
    return inputs

def output_matrix(matrix):
    for line in matrix:
        print(listToStr(line))
    print()

inputs = input_parse()
for input in inputs:
    matrix = getMatrix(input[0], input[1])
    output_matrix(matrix)

Fixed code:
def listToStr(list):
    return ''.join(list)

def getChar(h, w):
    h_parity = h % 2
    w_parity = w % 2
    total_parity = (h_parity + w_parity) % 2
    
    if total_parity == 0:
        return "#"
    else:
        return "."

def getMatrix(h, w):
    result = []
    for i in range(h):
        result.append([])
        for j in range(w):
            result[i].append(getChar(i, j))
    return result

def input_parse():
    inputs = []
    while True:
        input_HW = input().split(" ")
        (h, w) = (int(input_HW[0]),int(input_HW[1]))
        if h == 0 and w == 0:
            break
        inputs.append((h, w))
    return inputs

def output_matrix(matrix):
    for line in matrix:
        print(listToStr(line))
    print()

if __name__ == "__main__":
    inputs = input_parse()
    for input in inputs:
        matrix = getMatrix(input[0], input[1])
        output_matrix(matrix),0
Buggy code:
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k)%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
    for i in range(H):
        for j in range(W):
            if (i+j)%2 == 0:
                print('#',end='')
            else:
                print('.',end='')
        print()
        
    print()
Buggy 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()

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:
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        a = ""
        b = ""
        for i in range(w):
            if i%2 == 0:
                a += "#"
                b += "."
            else:
                a += "."
                b += "#"
        for j in range(h):
            if i%2 == 0:
                print(a)
            else:
                print(b)
    print()


Fixed code:
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    for i in range(a):
        for j in range(b):
            if (i+j)%2==0:
                print('#',end='')
            else:
                print('.',end='')
        print()    
    print()
Buggy code:
while True:
    H, W = map(int, input().split())
    if H == 0:
        break
   
    for i in range(H):
        S=''
        for j in range(W):
          if (i+j) %2 == 0:
            S += '#'
          else:
            S += '.'
        print(S)
      



Fixed 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('')
    print('')
Buggy code:
import sys
for l in sys.stdin:
  H, W = map(int,l.split())
  if H == 0 and W == 0:
    break
  for i,h in enumerate(range(H)):
    if i % 2 == 0:
      print (('.#' * (int(W/2)))[:W])
    else:
      print(('#.' * (int(W/2)))[:W])
  print ('')

Fixed code:
import sys
for l in sys.stdin:
  H, W = map(int,l.split())
  if H == 0 and W == 0:
    break
  for i,h in enumerate(range(H)):
    if i % 2 == 0:
      print (('#.' * (int(W/2)+1))[:W])
    else:
      print(('.#' * (int(W/2)+1))[:W])
  print ('')