Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Matrix Multiplication

Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:

\[
c_{ij} = \sum_{k=1}^m a_{ik}b_{kj}
\]

  where $a_{ij}$, $b_{ij}$ and $c_{ij}$ are elements of $A$, $B$ and $C$ respectively.

Input

  In the first line, three integers $n$, $m$ and $l$ are given separated by space characters

  In the following lines, the $n \times m$ matrix $A$ and the $m \times l$ matrix $B$ are given.

Output

  Print elements of the $n \times l$ matrix $C$ ($c_{ij}$). Print a single space character between adjacent elements.

Constraints

$1 \leq n, m, l \leq 100$

$0 \leq a_{ij}, b_{ij} \leq 10000$

Sample Input

3 2 3
1 2
0 3
4 5
1 2 1
0 3 2

Sample Output

1 8 5
0 9 6
4 23 14

Note

      解説      

	



Sample input:
3 2 3
1 2
0 3
4 5
1 2 1
0 3 2


Sample output:
1 8 5
0 9 6
4 23 14

Submission status: Wrong Answer

Solution code:
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    for j in range(n):
        sum = 0
        for k in range(m):
            sum += a[i][k]*b[k][j]
        if j==n-1:print(sum)
        else:print(sum,end=" ")

Submission status: Wrong Answer

Solution 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)
        else:
            print(GOMI,end=" ")
    print()

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

Solution 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)
print()

Submission status: Wrong Answer

Solution 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)
        print()

Submission status: Wrong Answer

Solution 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)
    print()

Submission status: Wrong Answer

Solution 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!=0:
            print(GOMI,end=" ")
        else:
            print(GOMI)
    print()

Submission status: Wrong Answer

Solution 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!=1:
            print(GOMI,end=" ")
        else:
            print(GOMI)
    print()

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

Solution 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)

Submission status: Wrong Answer

Solution 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)
            print()

Submission status: Wrong Answer

Solution 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 == m -1:
            print("")

Submission status: Wrong Answer

Solution code:
#coding: UTF-8

n, m, l = list(map(int, input().split())) # 3 2 3

n_m = [[0]*(m) for d in range(n)]
m_l = [[0]*(l) for e in range(m)]
matrix = [[0]*(n) for f in range(l)]

for i in range(n):
    mat_1 = list(map(int, input().split()))
    for g in range(m):
        n_m[i][g] = mat_1[g]

for j in range(m):
    mat_2 = list(map(int, input().split()))
    for h in range(l):
        m_l[j][h] = mat_2[h]

for i in range(n):
    for j in range(l):
        for k in range(m):
            matrix[i][j] += n_m[i][k] * m_l[k][j]

for i in range(n):
    print("%d"%matrix[i][0], end = "")
    for j in range(l):
        print("%d  "%(matrix[i][j]), end = " ")
    print()

Submission status: Wrong Answer

Solution 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]))

Submission status: Wrong Answer

Solution code:
n,m,l = map(int,input().split())
a = [[0]*m for i in range(n)]
b = [[0]*l for i in range(m)]
[print(*x) for x in [[sum(j*k for j,k in zip(x,y)) for y in zip(*b)]for x in a]]

Submission status: Wrong Answer

Solution code:
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
b = [list(map(int,input().split())) for _ in range(m)]
b = [[0]*l for i in range(m)]
[print(*x) for x in [[sum(j*k for j,k in zip(x,y)) for y in zip(*b)]for x in a]]

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
A=[]
B=[]

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

for A_r in A:
  print("".join(map(str,[sum(x*y for x,y in zip(A_r,[B_r[k] for B_r in B])) for k in range(1)])))

Submission status: Wrong Answer

Solution code:
n,m,l=map(int,input().split())
A=[]
B=[]

for i in range(n):A.append(list(map(int,input().split())))
for i in range(m):B.append(list(map(int,input().split())))

for A_r in A:
  print("".join(map(str,[sum(x*y for x,y in zip(A_r,[B_r[k] for B_r in B])) for k in range(1)])))

Submission status: Wrong Answer

Solution code:
n, m, r= map(int, raw_input().split())
A = []
for i in range(n):
    a = map(int, raw_input().split())
    A.append(a)
B = []
for i in range(m):
    b = map(int, raw_input().split())
    B.append(b)
Ans = []
for i in range(n):
    for j in range(r):
        sum = 0
        for k in range(m):
            sum += A[i][k] * B[k][j]
        Ans.append(sum)
for i in range(n):
    for j in range(r - 1):
        print(Ans[n * i + j]),
    print(Ans[n * i + r - 1])

Submission status: Wrong Answer

Solution code:
n, m, L = map(int, input().split())

a = [list(map(int, input().split())) for _ in range(m)]
b = [list(map(int, input().split())) for _ in range(L)]
c = [[sum(ak * bk for ak, bk in zip(ai,bj)) for bj in zip(*b)] for ai in a]

for ci in c:
    print(*ci)

Submission status: Wrong Answer

Solution 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]))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	c,tmp=[],[]
	n,m,l=map(int,raw_input().split())
	a=[map(int,raw_input().split()) for _ in xrange(n)]
	b=zip(*[map(int,raw_input().split()) for _ in xrange(m)])
	sums=[i[k]*j[k] for i in a for j in b for k in xrange(m)]
	c=[sums[i]+sums[i+1] for i in [j for j in xrange(len(sums)) if j%2==0]]
	for i in xrange(len(c)):
		if (i+1)%n==0: print c[i]
		else: print c[i],

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	n,m,l=map(int,raw_input().split())
	a=[map(int,raw_input().split()) for _ in xrange(n)]
	b=zip(*[map(int,raw_input().split()) for _ in xrange(m)])
	sums=[i[k]*j[k] for i in a for j in b for k in xrange(m)]
	print sums
	c=[sum(sums[i:i+m]) for i in [j for j in xrange(len(sums)) if j%m==0]]
	for i in xrange(len(c)):
		if (i+1)%l==0: print c[i]
		else: print c[i],

Submission status: Wrong Answer

Solution code:
import sys

n,m,l=map(int,raw_input().split())
list1 = [[0 for i in range(m)]for i in range(n)]
list2 = [[0 for i in range(l)]for i in range(m)]
list3 = [[0 for i in range(n)]for i in range(n)]
for i in range(n):
	list1[i] = map(int,raw_input().split())
for i in range(m):
	list2[i] = map(int,raw_input().split())
for i in range(n):
	for j in range(n):
		for k in range(m):
			list3[i][j] += list1[i][k] * list2[k][j]
for i in range(n):
	for j in range(n):
		if j==n-1:
			print'%d' %list3[i][j]
		else:
			sys.stdout.write(str(list3[i][j]))
			sys.stdout.write(' ')

Submission status: Wrong Answer

Solution code:
import sys

n,m,l=map(int,raw_input().split())
list1 = [[0 for i in range(m)]for i in range(n)]
list2 = [[0 for i in range(l)]for i in range(m)]
list3 = [[0 for i in range(l)]for i in range(n)]
for i in range(n):
	list1[i] = map(int,raw_input().split())
for i in range(m):
	list2[i] = map(int,raw_input().split())
for i in range(n):
	for j in range(l):
		for k in range(m):
			list3[i][j] += list1[i][k] * list2[k][j]
for i in range(n):
	for j in range(l):
		if j==n-1:
			print'%d' %list3[i][j]
		else:
			sys.stdout.write(str(list3[i][j]))
			sys.stdout.write(' ')

Submission status: Wrong Answer

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

mat1 = {}
mat2 = {}

n, m, l = map(int, raw_input().split())
for i in range(1, n+1):
    list = map(int, raw_input().split())
    for j in range(1, m+1):
        mat1[(i, j)] = list[j-1]

for j in range(1, m+1):
    list = map(int, raw_input().split())
    for k in range(1, l+1):
        mat2[(j, k)] = list[k-1]

for i in range(1, n+1):
    buf = ""
    for k in range(1, l+1):
        res = 0
        for j in range(1, m+1):
            res += mat1[(i, j)]*mat2[(j, k)]
        buf += str(res) +" "
    buf = buf.rsplit()
    print buf

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    print(" ".join(map(str, C[i][:])),end = "")

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(n):
    for j in range(l):
        print("{0}".format(C[i][j]), end=" ")
    print("\b")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
#for i in range(n):
#    print(" ".join(map(str, C[i][:])))

Submission status: Wrong Answer

Solution code:
(n, m, l) = [int(i) for i in input().split()]
print(n)
A = []
for nc in range(n):
    A.append([int(i) for i in input().split()])
B = []
for mc in range(m):
    B.append([int(i) for i in input().split()])

product = [[0 for d in range(l)] for dd in range(n)]

for nc in range(n):
    for lc in range(l):
        for mc in range(m):
            product[nc][lc] += A[nc][mc] * B[mc][lc]

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

Submission status: Wrong Answer

Solution code:
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(l)] for j in range(n)]
print(C)
#??\?????????????????????????´?
for i in range(n):
    #swap_list = input().split()
    #A.append(swap_list)
    A.append([int(i) for i in input().split()])
for i in range(m):
    #swap_list = input().split()
    #B.append(swap_list)
    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 i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))

Submission status: Wrong Answer

Solution code:
#Input
n,m,l = map(int,input().split())
A = [list(map(int,input().split())) for i in range(n)]
B = [list(map(int,input().split())) for i in range(m)]

c = [list(sum([A[i][k] * B[k][j] for k in range(m)]) for j in range(l)) for i in range(n)]

#Output
for i in c:
    print(*c)

Submission status: Wrong Answer

Solution code:
n,m,l=map(int,raw_input().split())
a=[]
b=[]
c=[[0 for k in range(l)] for i in range(n)]

for i in range(n):
	a.append(map(int,raw_input().split()))
for j in range(m):
	b.append(map(int,raw_input().split()))

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

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split()) # n = 3, c = 2, l = 3

a_matrix = [list(map(int, input().split())) for row in range(n)] # [[1, 2], [0, 3], [4, 5]]
b_matrix = [list(map(int, input().split())) for row in range(m)] # [[1, 2, 1], [0, 3, 2]]

result_matrix = [[0 for x in range(l)] for y in range(n)] # [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
print(result_matrix)
for i in range(n):
	for j in range(l):
		for k in range(m):
			result_matrix[i][j] += a_matrix[i][k] * b_matrix[k][j]

for i in range(n):
	print(' '.join(map(str, result_matrix[i])))

Submission status: Wrong Answer

Solution code:
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []
for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

Submission status: Wrong Answer

Solution code:
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

Submission status: Wrong Answer

Solution code:
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []
D = []


for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

print(A)
print(B)

for j in range(n):
    for h in range(l):
        for f in range(m):
            C.append((A[j][f])*(B[f][h]))

for a in range(0,len(C),m):
    D.append(C[a]+C[a+m-1])

for b in range(0,len(D)):
    if (b+1) % n == 0:
        print(D[b],end=' \n')
    else:
        print(D[b], end=' ')

Submission status: Wrong Answer

Solution code:
n, m, l, = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for li in range(n):
    print(" ".join([str(s) for s in C[ni]]))

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())

A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for j in range(m)]
C = [ [sum([A[k][j] * B[j][i] for j in range(m)]) for i in range(n)] for k in range(n)]

for i in range(n):
    C[i] = map(str, C[i])
    print(" ".join(C[i]))

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
C = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            print(A[i][k], B[k][j])
            C[i][j] += A[i][k]*B[k][j]
for i in range(n):
    print(" ".join(map(str, C[i])))

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
C = [[0 for i in range(n)] for j in range(l)]
for i in range(n):
    for j in range(l):
        for k in range(m):
            print(A[i][k], B[k][j])
            C[i][j] += A[i][k]*B[k][j]
for i in range(n):
    print(" ".join(map(str, C[i])))

Submission status: Wrong Answer

Solution code:
[n,m,l] = map(int, input().split())
a = []
b = []
c = [[0 for k in range(l)] for i in range(n)]
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 i in range(n):
    for k in range(l):
        s = 0
        for j in range(m):
            s += a[i][j] * b[j][k]
        c[i][k] = s

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

Submission status: Wrong Answer

Solution code:
n,m,l = map(int,input().split())

a = [[0 for i in range(m)] for j in range(n)]
b = [[0 for i in range(l)] for j in range(m)]
c = [[0 for i in range(l)] for j in range(n)]

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

for i in range(m):
    mat_tmp = list(map(int,input().split()))
    for j in range(l):
        b[i][j] = mat_tmp[j]

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

for i in range(n):
    print(' '.join(str(x) for x in c[i]))

Submission status: Wrong Answer

Solution code:
def c(a,b,m,i,j):
	sum=0
	for k in range(m):sum+=a[i][k]*b[k][j]
	return sum
n,m,l,=map(int,raw_input().split())
a,b=[],[]
for i in range(n):
	a.append(map(int,raw_input().split()))
for i in range(m):
	b.append(map(int,raw_input().split()))
for i in range(n):
	for j in range(m):
		print c(a,b,m,i,j),
	print ''

Submission status: Wrong Answer

Solution code:
n, m, l = [int(i) for i in input().split(" ")]

a = [ [ int(i) for i in input().split(" ") ] for _ in range(n) ]
b = [ [ int(i) for i in input().split(" ") ] for _ in range(m) ]

for x in range(n):
    result = 0
    for y in range(m):
        for z in range(l):
            result += a[x][y] * b[y][z]
    print(result)

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split(' '))

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


B = []
for i in range(m):
    B.append(list(map(int, input().split(' '))))

C = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            print((i, j),(i, k), (k ,j))
            C[i][j] += A[i][k] * B[k][j]

for c in C:
    print(' '.join([str(x) for x in c]))

Submission status: Wrong Answer

Solution code:
a, b = ([[0 for i in range(100)] for j in range(100)],) * 2
#b = [[0 for i in range(100)] for j in range(100)]
n, m, l = map(int, input().split())
for i in range(n):
    a[i][:m] = map(int, input().split())
for i in range(m):
    b[i][:l] = map(int, input().split())
for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += a[i][k] * b[k][j]
        print(c, end='')
        if j < l - 1:
            print(' ', end='')
        else:
            print()

Submission status: Wrong Answer

Solution code:
n,m,l=[int(i) for i in input().split()]
x=[[int(0) for i in range(m)]for j in range(n)]
z=[[int(0) for i in range(n)]for j in range(n)]
y=[[int(0)for i in range(n)]for j in range(m)]
for i in range(n):
    k=input().split()
    for j in range(m):
        x[i][j]=int(k[j])
for i in  range(m):
    k=input().split()
    for j in range(n):
        y[i][j]=int(k[j])
        
for i in range(n):
    for j in range(n):
        count=int(0)
        for v in range(m):
            count=count+x[i][v]*y[v][j]
        z[i][j]=count
for i in range(n):
    for j in range(n-1):
        print(z[i][j],"",end="")
    print(z[i][n-1])

Submission status: Wrong Answer

Solution code:
n,m,l=[int(i) for i in input().split()]
x=[[int(0) for i in range(m)]for j in range(n)]
z=[[int(0) for i in range(l)]for j in range(n)]
y=[[int(0)for i in range(l)]for j in range(m)]
for i in range(n):
    k=input().split()
    for j in range(m):
        x[i][j]=int(k[j])
for i in  range(m):
    k=input().split()
    for j in range(n):
        y[i][j]=int(k[j])
        
for i in range(n):
    for j in range(l):
        count=int(0)
        for v in range(m):
            count=count+x[i][v]*y[v][j]
        z[i][j]=count
for i in range(n):
    for j in range(l-1):
        print(z[i][j],"",end="")
    print(z[i][l-1])

Submission status: Wrong Answer

Solution code:
n,m,l=list(map(int,input().split()))

m_A=[list(map(int,input().split())) for i in range(n)]

m_B=[list(map(int,input().split())) for i in range(m)]

for i in range(n):
    for k in range(l):
        s=0
        for j in range(m):
            s+=m_A[i][j]*m_B[j][k]
        print(s)

Submission status: Wrong Answer

Solution code:
n,m,l=map(int,input().split())
a=[]
b=[]
for i in range(n):
    a+=[list(map(int,input().split()))]

for i in range(m):
    b+=[list(map(int,input().split()))]
print(a,b)    
c=[]
c=[[sum(a[i][k]*b[k][j] for k in range(m))for j in range(l)] for i in range(n)]
[print(" ".join(list(map(str,c[i])))) for i in range(n)]

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())

nm = []
ml = []

for _ in range(n):
	lista = list(map(int, input().split()))
	nm.append(lista)

for _ in range(m):
	lista = list(map(int, input().split()))
	ml.append(lista)
	
matrix = []

print(nm)
print(ml)

for i in range(n):
	lista = []
	for j in range(l):
		sum = 0
		for k in range(m):
			sum += nm[i][k]*ml[k][j]
		lista.append(sum)
	matrix.append(lista)

for i in range(n):
	text = ""
	for j in range(l):
		text += str(matrix[i][j]) + " "
	print(text[:-1])

Submission status: Wrong Answer

Solution code:
def main():

    n, m, l = map(int, input().split())
    matrix_a = [list(map(int, input().split())) for i in range(n)]
    matrix_b = [list(map(int, input().split())) for j in range(m)]
    matrix_c = [[0 for i in range(n)] for j in range(n)]
    
    for i in range(n):
        for j in range(n):
            matrix_c[i][j] = sum(matrix_a[i][k] * matrix_b[k][j] for k in range(m))
            print(sum(matrix_a[i][k] * matrix_b[k][j] for k in range(m)), end='')
            if j != n-1: print(' ', end='')
        print('')

main()

Submission status: Wrong Answer

Solution code:
n, m, l = [int(s) for s in input().split()]
A = []
B = []

for i in range(n):
    A.append([int(s) for s in input().split()])
for i in range(m):
    B.append([int(s) for s in input().split()])

for i in range(n):
    r = []
    for j in range(n):
        total = 0
        for k in range(m):
            total += A[i][k] * B[k][j]
        r.append(total)
    
    print(' '.join([str(v) for v in r]))

Submission status: Wrong Answer

Solution code:
import sys

(n, m, l) = sys.stdin.readline().rstrip('\r\n').split(' ')
n = int(n)
m = int(m)
l = int(l)

a = []
b = []
c = []
for ii in range(n):
  a.append([int(x) for x in input().rstrip('\r\n').split(' ')])

for ii in range(m):
  b.append([int(x) for x in input().rstrip('\r\n').split(' ')])

for ii in range(n):
  c.append([])
  for jj in range(l):
    c[ii].append(0)
    for kk in range(m):
      c[ii][jj] += a[ii][kk] * b[kk][jj]
    print(str(c[ii][jj]) + ' ', end='')

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
a = []
b = []
c = []
for i in range(n):
    c.append([0 for k in range(l)])
for i in range(n):
    a.append(list(map(int, input().split())))
for i in range(m):
    b.append(list(map(int, input().split())))
for s in range(n):
    for t in range(m):
        elm = 0
        for u in range(l):
            elm += a[s][t] * b[t][u]
        c[s][t] = elm
for i in c:
    print(" ".join(map(str, i)))

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
mat_a = []
mat_b = []

for i in range(n):
    mat_a.append(list(map(int, input().split())))
    
for j in range(m):
    mat_b.append(list(map(int, input().split())))
    
for p in range(n):
    sum = 0
    mat_c = []
    for q in range(l):
        for r in range(m):
            sum += mat_a[p][r] * mat_b[r][q]
        mat_c.append(sum)
    print(' '.join(map(str, mat_c)))

Submission status: Wrong Answer

Solution code:

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
a = []
b = []
for _ in range(n):
  a.append(list(map(int, input().split())))
for _ in range(m):
  b.append(list(map(int, input().split())))
b = list(zip(*b))
for i in range(n):
  for j in range(l):
    t = 0
    for k, l in zip(a[i], b[j]):
      t += k * l
    print(t, end = " ")
  print("")

Submission status: Wrong Answer

Solution 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())))

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

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
B = [list(map(int, input().split())) for i in range(m)]
Sum = []
key = 0
for i in range(n):
    Sum_s = []
    for j in range(l):
        key = 0
        for k in range(m):
            key += A[i][k] * B[k][j]
        Sum_s.append(key)
    Sum.append(Sum_s)
print(Sum)
for i in range(n):
    for j in range(l - 1):
        print(Sum[i][j], end = ' ')
    print(Sum[i][l - 1])

Submission status: Wrong Answer

Solution code:
import sys
e=[list(map(int,e.split()))for e in sys.stdin]
n=e[0][0]+1
for c in e[:n]:print(*[sum(s*t for s,t in zip(c,l))for l in zip(*e[n:])])

Submission status: Wrong Answer

Solution code:
import sys
e=[list(map(int,e.split()))for e in sys.stdin]
n=e[0][0]+1
t=''
for c in e[1:n]:
 for l in zip(*e[n:]):t+=f'sum(s*t for s,t in zip(c,l)) '
 t=t[:-1]+'\n'
print(t)

Submission status: Wrong Answer

Solution code:
n, m, l = map(int, input().split())
A = [[int(num) for num in input().split()] for i in range(n)]
B = [[int(num) for num in input().split()] for i in range(m)]
B = list(zip(*B)) # 列を行に置き換える
C = [[0 for i in range(l)] for j in range(n)]
for i, A_line in enumerate(A):
    for j, B_line in enumerate(B):
        for A_element, B_element in zip(A_line, B_line):
            C[i][j] += A_element * B_element

for line in C:
    for i, element in enumerate(line):
        if i == n - 1:
            print(element)
        else:
            print(element, end=' ')

Submission status: Time Limit Exceeded

Solution code:
from itertools import islice

def make_gen():
    n, m, l = list(map(int, input().split()))

    m1 = [list(map(int, input().split())) for _ in range(n)]
    m2 = [list(map(int, input().split())) for _ in range(m)]

    def g():
        for r1 in m1:
            for r2 in zip(*m2):
                yield str(sum(i*j for i, j in zip(r1, r2)))

    return (n, l, g)

n, l, g = make_gen()
for i in range(n):
    print(" ".join(islice(g(), i*l, (i+1)*l)))