qyliang/CodeNanoFix huggingface dataset:
Buggy code:
r, c = map(int, input().split())
a = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    l = list(map(int, input().split()))
    for j in range(c):
        a[i][j] = l[j]
        a[i][c] += a[i][j]

for i in range(c+1):
    for j in range(r):
        a[r][i] += a[j][i]

for i in range(r+1):
    for j in range(c+1):
        print(str(a[i][j]) + " ", end="")
    print()
    

Fixed code:
r, c = map(int, input().split())
a = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    l = list(map(int, input().split()))
    for j in range(c):
        a[i][j] = l[j]
        a[i][c] += a[i][j]

for i in range(c+1):
    for j in range(r):
        a[r][i] += a[j][i]

for i in range(r+1):
    for j in range(c+1):
        if j == c:
            print(str(a[i][j]))
        else:
            print(str(a[i][j]) + " ", end="")
Buggy code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""
inp = input().strip().split(" ")
row = int(inp[0])
col = int(inp[1])

cells = [[0 for r in range(row+1)] for c in range(col+1)]
for r in range(row):
    inp = input().strip().split(" ")
    for c in range(col):
        cells[r][c] = int(inp[c])
        cells[row][c] += cells[r][c]
        cells[r][col] += cells[r][c]
    cells[row][col] += cells[r][col]

for r in range(row+1):
    print(" ".join(map(str,cells[r])))

Fixed code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""
inp = input().strip().split(" ")
row = int(inp[0])
col = int(inp[1])

cells = [[0 for r in range(col+1)] for c in range(row+1)]
for r in range(row):
    inp = input().strip().split(" ")
    for c in range(col):
        cells[r][c] = int(inp[c])
        cells[row][c] += cells[r][c]
        cells[r][col] += cells[r][c]
    cells[row][col] += cells[r][col]

for r in range(row+1):
    print(" ".join(map(str,cells[r])))
Buggy code:
r, c = [int(i) for i in input().split()]
data = []
sum_row = [0] * (c + 1)

for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))

Fixed code:
r, c = [int(i) for i in input().split()]
 
data = []
sum_row = [0] * (c + 1)
 
for ri in range(r):
    data.append([int(i) for i in input().split()])
    data[ri].append(sum(data[ri]))
    print(" ".join([str(d) for d in data[ri]]))
    for ci in range(c + 1):
        sum_row[ci] += data[ri][ci]
print(" ".join([str(s) for s in sum_row]))
Buggy code:
r,c = map(int,input().split())

a = [list(map(int,input().split(" "))) for i in range(r)]

for i in range(r):
    r_total = sum(a[i])
    a[i].append(r_total)

c_total = []

for j in range(c+1):
    s = 0
    for k in range(r):
        s += a[k][j]
    c_total.append(s)

a.append(c_total)

for z in range(r+1):
    for w in range(c+1):
        print(a[z][w],end=" ")
    print()

Fixed code:
r,c = map(int,input().split())

a = [list(map(int,input().split(" "))) for i in range(r)]

for i in range(r):
    r_total = sum(a[i])
    a[i].append(r_total)

c_total = []

for j in range(c+1):
    s = 0
    for k in range(r):
        s += a[k][j]
    c_total.append(s)

a.append(c_total)

for z in range(r+1):
    for w in range(c+1):
        print(a[z][w],end="")
        if w != c:
            print(" ",end="")
    print()
Buggy code:
# (c) midandfeed
r, c = [int(x) for x in input().split()]
q = []
sumr = [0]*c
tempr = 0
for i in range(r):
	col = [int(x) for x in input().split()]
	for j in range(c):
		sumr[j] += col[j]
	col.append(sum(col))
	q.append(col)
sumr.append(sum(sumr))
q.append(sumr)
for i in range(r+1):
	for j in range(c+1):
		print(q[i][j], end='')
		if (j != (c+1)):
			print(' ', end='')
	if (i != (r+1) ):
		print()

Fixed code:
# (c) midandfeed
r, c = [int(x) for x in input().split()]
q = []
sumr = [0]*c
tempr = 0
for i in range(r):
	col = [int(x) for x in input().split()]
	for j in range(c):
		sumr[j] += col[j]
	col.append(sum(col))
	q.append(col)
sumr.append(sum(sumr))
q.append(sumr)
for i in range(r+1):
	for j in range(c+1):
		print(q[i][j], end='')
		if (j != (c)):
			print(' ', end='')
	# if (i != (r) ):
	print()
Buggy code:
n, m = map(int, input().split())
mat = [[0 for x in range(m+1)] for y in range(n+1)]

for i in range(n):
    r = list(map(int,input().split()))
    for j in range(m):
        mat[i][j] = r[j]

for i in range(n):
    for j in range(m):
        mat[i][-1] += mat[i][j]
        mat[-1][j] += mat[i][j]
    mat[-1][-1] += mat[i][-1]

for i in range(n+1):
    for j in range(m+1):
        print(mat[i][j],end = ' ')
    print('')




Fixed code:
n, m = map(int, input().split())
mat = [[0 for x in range(m+1)] for y in range(n+1)]

for i in range(n):
    r = list(map(int,input().split()))
    for j in range(m):
        mat[i][j] = r[j]

for i in range(n):
    for j in range(m):
        mat[i][-1] += mat[i][j]
        mat[-1][j] += mat[i][j]
    mat[-1][-1] += mat[i][-1]

for i in range(n+1):
    print(*mat[i])
Buggy code:
r, c = map(int, input().split())
table = []
for i in range(r):
    table.append(list(map(int, input().split())))
for i in table:
    i.append(sum(i))
b = []
for i in range(c):
    b.append(sum(list(table[k for k in range(r)][i])))
b.append(sum(b))
for i in table:
    print(" ".join(map(str, i)))
print(" ".join(map(str, b)))


Fixed code:
r, c = map(int, input().split())
table = []
for i in range(r):
    table.append(list(map(int, input().split())))
for i in table:
    i.append(sum(i))
b = []
for i in range(c):
    x = 0
    for k in range(r):
        x += table[k][i]
    b.append(x)
b.append(sum(b))
for i in table:
    print(" ".join(map(str, i)))
print(" ".join(map(str, b)))
Buggy code:
r,c = map(int,input().split())
num=[]
r_sum =[]
for i in range(r):
    num.append([int(i) for i in input().split()])
for i in range(r):
    line_sum = 0
    for j in range(c):
        line_sum += num[i][j]
    num[i].append(line_sum)
for i in range(c+1):
    row_sum = 0
    for j in range(r):
        row_sum += num[j][i]
    r_sum.append(row_sum)
num.append(r_sum)
for i in range(len(num)):
    print(' '+' '.join(str(i) for i in num[i]))


Fixed code:
r,c = map(int,input().split())
num=[]
r_sum =[]
for i in range(r):
    num.append([int(i) for i in input().split()])
for i in range(r):
    line_sum = 0
    for j in range(c):
        line_sum += num[i][j]
    num[i].append(line_sum)
for i in range(c+1):
    row_sum = 0
    for j in range(r):
        row_sum += num[j][i]
    r_sum.append(row_sum)
num.append(r_sum)
for i in range(len(num)):
    print(' '.join(str(i) for i in num[i]))
Buggy code:
# -*- coding: utf-8 -*-

r, c = list(map(int, input().split()))
a = []
line_sum = 0

for i in range(r):
    a.append(list(map(int, input().split())))

for i in range(r):
    for j in range(c + 1):
        if j == c:
            print('{0}'.format(sum(a[i])))
            line_sum += sum(a[i])
        else:
            print('{0} '.format(a[i][j]), end='')

for i in range(c + 1):
    column_sum = 0
    for j in range(r):
        column_sum += a[j][i]

    print('{0} '.format(column_sum), end='')

print(line_sum)


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

r, c = list(map(int, input().split()))
a = []
line_sum = 0

for i in range(r):
    a.append(list(map(int, input().split())))

for i in range(r):
    for j in range(c + 1):
        if j == c:
            print('{0}'.format(sum(a[i])))
            line_sum += sum(a[i])
        else:
            print('{0} '.format(a[i][j]), end='')

for i in range(c):
    column_sum = 0
    for j in range(r):
        column_sum += a[j][i]

    print('{0} '.format(column_sum), end='')

print(line_sum)
Buggy code:
r, c = map(int, input().split())
matrix = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    a = list(map(int, input().split()))
    for j in range(c):
        matrix[i][j] = a[j]
    matrix[i][c] = sum(a)
for l in range(c+1):
    for m in range(r):
        matrix[r][l] += matrix[m][l]

for cv in range(r+1):
    for fv in range(c+1):
        print(matrix[cv][fv], end='')
        if fv != c:
        print(" ", end='')
    print()


Fixed code:
r, c = map(int, input().split())
matrix = [[0 for i in range(c+1)] for j in range(r+1)]
for i in range(r):
    a = list(map(int, input().split()))
    for j in range(c):
        matrix[i][j] = a[j]
    matrix[i][c] = sum(a)
for l in range(c+1):
    for m in range(r):
        matrix[r][l] += matrix[m][l]

for cv in range(r+1):
    for fv in range(c+1):
        print(matrix[cv][fv], end='')
        if fv != c:
            print(" ", end='')
    print()
Buggy code:
r, c = map(int,input().split())
a=[]
for i in range(r):
    a.append(list(map(int,input().split())))
    a[i].append(0)
    aic = 0
    for k in range(c):
        aic = aic + a[i][k]
    a[i][c] = aic
a.append([0for i in range(c+1)])
for k in range(c):
    ark = 0
    for i in range(r):
        ark = ark + a[i][k]
    a[r][k] = ark
arc = 0
for i in range(r):
    arc = arc +a[i][c]
a[r][c] = arc

for i in range(r+1):
    for k in range(c+1):
        print('{} '.format(a[i][k]), end = "")
    print()


Fixed code:
r, c = map(int,input().split())
a=[]
for i in range(r):
    a.append(list(map(int,input().split())))
    a[i].append(0)
    aic = 0
    for k in range(c):
        aic = aic + a[i][k]
    a[i][c] = aic
a.append([0for i in range(c+1)])
for k in range(c):
    ark = 0
    for i in range(r):
        ark = ark + a[i][k]
    a[r][k] = ark
arc = 0
for i in range(r):
    arc = arc +a[i][c]
a[r][c] = arc

for i in range(r+1):
    for k in range(c+1):
        if k == c:
            print('{}'.format(a[i][k]), end = "")
        else:
            print('{} '.format(a[i][k]), end = "")
    print()
Buggy code:
r, c = [int(i) for i in input().split(" ")]
s_row = [0 for x in range(c + 1)]

for i in range(r):
    row = [int(n) for n in input().split(" ")]
   row =  row.append(sum(row))
    print(" ".join( [ str(s) for s in row ] ) )
    s_row = [ x + y for x, y in zip(s_row, row)]
print(" ".join( [str(s1) for s1 in s_row] ))

Fixed code:
r , c = [int(x) for x in input().split()]
s_row = [0 for x in range(c+1)]
for i in range(r):
    row = [int(x) for x in input().split()]
    row.append(sum(row))
    print(" ".join([str(x) for x in row]))
    s_row = [x+y for x,y in zip(s_row,row)]
print(" ".join([str(x) for x in s_row]))
Buggy code:
r,c=map(int,input().split())
a=[]
for i in range(r):
    a+=[list(map(int,input().split()))]
    a[i].append(sum(a[i]))
for i in range(len(a)):
    print(" ".join(list(map(str,a[i]))))
b=[]
t=[]
d=0
for i in range(c+1):
    for j in range(r):
        b+=[a[j][i]]
    t+=[sum(b)] 
print(" ".join(list(map(str,t))))
    
    
    

Fixed code:
r, c = map(int,input().split())
a = []
for i in range(r):
    b = list(map(int,input().split()))
    a.append(b)
    a[i].append(sum(a[i]))
a.append([])
    
for j in range(c+1):
    d = 0
    for k in range(r):
        d += a[k][j]
    a[r].append(d)
for i in range(r+1):
    print(' '.join(map(str,a[i])))
Buggy code:
r, c = map(int, input().strip().split())
l = [[] for i in range(r)].append([0 for j in range(c+1)])
for i in range(r):
    l[i] = list(map(int, input().strip().split()))
    l[i].append(sum(l[i][0:c]))
    l[r] = [l[r][j] + l[i][j] for j in range(c+1)]
    print(' '.join(map(str,l[i])))
print(' '.join(map(str,l[r])))

Fixed code:
r,c=map(int,input().split())
l=[list(map(int,input().split())) for i in range(r)]

for i in range(r):
    l[i].append(sum(l[i]))

m=[0]*(c+1)
for i in range(r):
    for j in range(c+1):
        m[j]+=l[i][j]

for i in range(r):
    print(' '.join(map(str, l[i])))
print(*m)
Buggy code:
r, c = map(int, input().split())
a = []
for i in range(r):
    a.append(list(map(int, input(),split())))
for line in arr:
    line.append(sum(line))
arr.append([sum([line[i] for line in arr]) for i in range(c+1)])
for line in arr:
    print(line)
    


Fixed code:
r, c = map(int, input().split())
arr = []
for i in range(r):
    arr.append(list(map(int, input().split())))

for line in arr:
    line.append(sum(line))
    
arr.append([sum([line[i] for line in arr]) for i in range(c  + 1)])

for line in arr:
    print(*line)
Buggy code:
r,c=list(map(int,input().split()))
l=[]
for i in range(r):
	a=list(map(int,input().split()))
	l.append(a.append(sum(a)))
b=[]
for i in range(c+1):
	c=0
	for j in range(r):
		c+=l[j][i]
	b.append(c)
l.append(b)

for i in l:
	print(" ".join(i))

Fixed code:
r,c = map(int,input().split())
a = []

for i in range(r):
 a.append(list(map(int,input().split())))
 a[i].append(sum(a[i]))

b = []
for j in range(c+1):
 s = 0
 for i in range(r):
   s += a[i][j]
 b.append(s)

a.append(b)

for i in range(r+1):
    print(" ".join(list(map(str, a[i]))))
Buggy code:
H,W = map(int,input().split())
table = [[0]*(W+1) for i in range(H+1)]

for row in range(H):
    work = list(map(int,input().split()))
    for col in range(W):
        table[row][col] = work[col]

for row in range(H):
    for col in range(W):
        table[row][W] += table[row][col]

for col in range(W):
    for row in range(H):
        table[H][col] += table[row][col]

for row in range(H+1):
    print("%d"%(table[row][0]),end="")
    for col in range(1,W+1):
        print(" %d"%(table[row][col]),end="")
    print()
    



Fixed code:
H,W = map(int,input().split())

table = [[0]*(W+1) for i in range(H+1)]

for row in range(H):
    work = list(map(int,input().split())) 
    for col in range(W):
        table[row][col] = work[col]


for row in range(H):
    for col in range(0,W):
        table[row][W] += table[row][col]


for col in range(0,W+1):
    for row in range(0,H):
        table[H][col] += table[row][col]


for row in range(0,H+1):
    print("%d"%(table[row][0]),end="")
    for col in range(1,W+1):
        print(" %d"%(table[row][col]),end = "")
    print()
Buggy code:
r,c=map(int,input().split())
a,b=[],[0]*c
for i in range(r):
    x=list(map(int,input().split()))
    b+=x
    print(*x, end=' ')
    print(sum(x))
print(*b, end=' ')
print(sum(b))

Fixed code:
r,c=map(int,input().split())
a=[0]*c
for i in range(r):
    x=list(map(int,input().split()))
    for j in range(c):
        a[j]+=x[j]
    print(*x, end=' ')
    print(sum(x))
print(*a, end=' ')
print(sum(a))
Buggy code:
r, c= map(int, input().split())
list = [list(map(int,input().split())) for i in range(r)]
for i in range(r):
    list[i].append(sum(list[i]))
for i in range(r):
    for j in range(c + 1):
        print(list[i][j], end = ' ')
    print()
for i in range(c + 1):
    a = 0
    for j in range(r):
        a += list[j][i]
    print(a, end = ' ')


Fixed code:
r, c= map(int, input().split())
list = [list(map(int,input().split())) for i in range(r)]
for i in range(r):
    list[i].append(sum(list[i]))
for i in range(r):
    for j in range(c):
        print(list[i][j], end = ' ')
    print(list[i][c])
for i in range(c):
    a = 0
    for j in range(r):
        a += list[j][i]
    print(a, end = ' ')
a = 0
for j in range(r):
    a += list[j][c]
print(a)
Buggy code:
r,c = map(int,input().split())
table = [[0]*(c+1) for i in range(r+1)]

for i in range(r):
    table[i] = list(map(int,input().split()))
    table[i].append(sum(table[i]))
    for j in range(c+1):
        table[r][j] += table[i][j]

for i in range(r+1):
    for j in range(c+1):
        print("%d " %(table[i][j]),end="")
    print()


Fixed code:
r, c = map(int, input().split())

table = list()


for i in range(r):
    table.append(list(map(int, input().split())))
    table[i].append(sum(table[i]))

table.append([])
for j in range(c+1):
    sum = 0
    for i in range(r):
        sum += table[i][j]
    table[r].append(sum)

for i in range(r+1):
    print("%d"%table[i][0],end = "")
    for j in range(1, c+1):
        print(" %d"%table[i][j],end = "")
    print("")
Buggy code:
i,j=map(int,input().split())
listA=[]
for i in range(i):
    listA.append(list(map(int,input().split())))
    listA[n].append(sum(listA[n]))
listA.append([])
for n in range(j+1):
    number =0
    for m in range(i):
        number+=listA[m][n]
    listA[i].append(number)
for n in range(i+1):
    print(''.join(map(str,listA[n])))
   


Fixed code:
n,m = map(int, input().split())
A = [[]for i in range(n)]
b = [0 for i in range(m)]

for i in range(n):
   A[i] = list(map(int, input().split()))
   A[i].append(sum(A[i]))

for i in range(m):
    for j in range(n):
        b[i] += A[j][i]

b.append(sum(b))

for i in range(n):
    print(' '.join(map(str, A[i])))
print(' '.join(map(str, b)))
Buggy code:
r,c = map(int,input().split())

A = [list(map(int,input().split())) for i in range(c)]
for i in range(c):
    for j in range(r):
        print(A[i][j],end=" ")
    print(sum(A[i]))
for i in range(c):
    ans = 0
    for j in range(r):
        ans += A[j][i]
    print(ans,end=" ")
print(sum(map(sum,A)))



Fixed code:
r,c = map(int,input().split())
spread = [list(map(int,input().split())) for i in range(r)]
for i in range(r):
    for j in range(c):
        print(spread[i][j],end=" ")
    print(sum(spread[i]))
for i in range(c):
    ans = 0
    for j in range(r):
        ans +=spread[j][i]
    print(ans,end=" ")
print(sum(map(sum,spread)))
Buggy code:
r,c = [int(i) for i in input().split()]

table = [[0 for j in range(c+1)] for i in range(r+1)]

for i in range(r):
    temp = [int(x) for x in input().split()]
    for j in range(c+1):
        if not j == c:
            table[i][j] = temp[j]
            table[i][c] += temp[j]
        table[r][j] += table[i][j]

for i in range(r+1):
    for j in range(c+1):
        if j == c:
            print(table[i][j],end=' ')
        else:
            print(table[i][j],end=' ')
    print()

Fixed code:
r,c = [int(i) for i in input().split()]

table = [[0 for j in range(c+1)] for i in range(r+1)]

for i in range(r):
    temp = [int(x) for x in input().split()]
    for j in range(c+1):
        if not j == c:
            table[i][j] = temp[j]
            table[i][c] += temp[j]
        table[r][j] += table[i][j]

for i in range(r+1):
    for j in range(c+1):
        if j != c:
            print(table[i][j],end=' ')
        else:
            print(table[i][j])
Buggy code:
def main():
    n, m, l = tuple(map(int, input().split()))
    matA = [[0 for j in range(m)] for i in range(n)]
    matB = [[0 for k in range(l)] for j in range(m)]
    matC = [[0 for k in range(l)] for i in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        for j in range(m):
            matA[i][j] = tmp[j]

    for j in range(m):
        tmp = list(map(int, input().split()))
        for k in range(l):
            matB[j][k] = tmp[k]


    for i in range(n):
        for k in range(l):
            for j in range(m):
                matC[i][k] += matA[i][j] * matB[j][k]

    for i in range(n):
        for k in range(l):
            print(matC[i][k], end=' ')
        print()

if __name__ == '__main__':
    main()


Fixed code:
def main():
    n, m, l = tuple(map(int, input().split()))
    matA = [[0 for j in range(m)] for i in range(n)]
    matB = [[0 for k in range(l)] for j in range(m)]
    matC = [[0 for k in range(l)] for i in range(n)]

    for i in range(n):
        tmp = list(map(int, input().split()))
        for j in range(m):
            matA[i][j] = tmp[j]

    for j in range(m):
        tmp = list(map(int, input().split()))
        for k in range(l):
            matB[j][k] = tmp[k]


    for i in range(n):
        for k in range(l):
            for j in range(m):
                matC[i][k] += matA[i][j] * matB[j][k]

    for i in range(n):
        for k in range(l):
            if k == l-1:
                print(matC[i][k])
            else:
                print(matC[i][k], end=' ')

if __name__ == '__main__':
    main()
Buggy code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l:
            print(GOMI,end=" ")
        else:
            print(GOMI,end="")
    print()


Fixed code:
n,m,l = map(int,input().split())
YEAH = [list(map(int,input().split())) for i in range(n)]
FUCK = [list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for j in range(l):
        GOMI = 0
        for k in range(m):
            GOMI += FUCK[k][j]*YEAH[i][k]
        if j!=l-1:
            print(GOMI,end=" ")
        else:
            print(GOMI,end="")
    print()
Buggy code:
n,m,l = map(int,input().split())
matrixL = [[0]*m for i in range(n)]
matrixR = [[0]*l for i in range(m)]
for row in range(n):
    matrixL[row] = [int(i) for i in input().split()]

for row in range(m):
    matrixR[row] = [int(i) for i in input().split()]
c = [[0] * l for i in range(n)]
for ansColumn in range(l):
    for row in range(n):
        for column in range(m):
            c[row][ansColumn] = c[row][ansColumn] + matrixL[row][column] * matrixR[column][ansColumn]
for row in range(n):
    for column in range(l):
        print("%d " %c[row][column], end ="")
        if column == l -1:
            print("")


Fixed code:
n,m,l = map(int,input().split())
matrixL = [[0]*m for i in range(n)]
matrixR = [[0]*l for i in range(m)]
for row in range(n):
    matrixL[row] = [int(i) for i in input().split()]

for row in range(m):
    matrixR[row] = [int(i) for i in input().split()]
c = [[0] * l for i in range(n)]
for ansColumn in range(l):
    for row in range(n):
        for column in range(m):
            c[row][ansColumn] = c[row][ansColumn] + matrixL[row][column] * matrixR[column][ansColumn]
for row in range(n):
    for column in range(l):
        if column == l -1:
            print(c[row][column])
        else:
            print("%d " %c[row][column], end ="")
Buggy code:
n,m,l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))
for  k in range(n):
    for o in range(l):
        sum = 0
        for p in range(m):
            sum += a[n][m] * b[m][l]
        print(sum, end = "")
        if o != l-1:
            print(" ", end = "")
    print()


Fixed code:
n,m,l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))
for  k in range(n):
    for o in range(l):
        sum = 0
        for p in range(m):
            sum += (a[k][p] * b[p][o])
        print(sum, end = "")
        if o != l-1:
            print(" ", end = "")
    print()
Buggy code:
x, y, z = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(x)]
B = [list(map(int, input().split())) for _ in range(y)]
ans_s = []
ans = []

for i in range(x):
    for j in range(z):
        p = 0
        for k in range(y):
            p += A[i][k] * B[k][j]
        ans_s.append(p)
    ans.append((ans_s))

for i in ans:
    print(' '.join([str(v) for v in ans]))


Fixed code:
x, y, z = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(x)]
B = [list(map(int, input().split())) for _ in range(y)]
ans_s = []
ans = []

for i in range(x):
    ans_s = []
    for j in range(z):
        p = 0
        for k in range(y):
            p += A[i][k] * B[k][j]
        ans_s.append(p)
    ans.append((ans_s))

for i in ans:
    print(' '.join([str(v) for v in i]))
Buggy code:
(n,m,l) = [int(x) for x in input().split()]
a = []
b = []
c = [[0 for x in range(l)] for y in range(n)]

for nc in range(n):
    a.append([int(i) for i in input().split()])

for mc in range(m):
    b.append([int(i) for i in input().split()])

for i in range(n):
    for j in range(m):
        for k in range(l):
            c[k][i] += a[i][j] * b[j][k]

for r in c:
    print(' '.join([str(d) for d in r]))

Fixed code:
(n,m,l) = [int(x) for x in input().split()]
a = []
b = []
c = [[0 for x in range(l)] for y in range(n)]

for nc in range(n):
    a.append([int(i) for i in input().split()])

for mc in range(m):
    b.append([int(i) for i in input().split()])

for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]

for r in c:
    print(' '.join([str(d) for d in r]))