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: Accepted

Solution code:
a=list(map(int,input().split()))
n = a[0]
m = a[1]
l = a[2]

matrixA=[[] for i in range(n)] #A=n*m matrix
matrixB=[[] for i in range(m)] #B=m*l matrix
matrixC=[[0 for i in range(l)] for i in range(n)] #C=n*l matrix

#input
for i in range(n):
    values=list(map(int,input().split()))
    for j in range(m):
        matrixA[i].append(values[j])
for i in range(m):
    values=list(map(int,input().split()))
    for j in range(l):
        matrixB[i].append(values[j])

# start calc
for i in range(n):
    for j in range(l):
        for k in range(m):
            matrixC[i][j] += matrixA[i][k] * matrixB[k][j]
# print
for i in range(n):
    print(*matrixC[i])

Submission status: Accepted

Solution code:
numList = input().split()
n = int(numList[0])
m = int(numList[1])
l = int(numList[2])

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):
        arrayList = input().split()
        for j in range(m):
                a[i][j] = int(arrayList[j])

for i in range(m):
        arrayList = input().split()
        for j in range(l):
                b[i][j] = int(arrayList[j])

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):
                if j < l - 1:
                        print(c[i][j], "", end = "")
                else:
                        print(c[i][j], end = "")
        print()

Submission status: Accepted

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

a = []
for x in range(n):
    a.append(list(map(int, input().split())))

b = []
for x in range(m):
    b.append(list(map(int, input().split())))

for x in range(n):
    string = ""
    flag = False
    for y in range(l):
        if(flag):
            string += " "
        else:
            flag = True

        tmp = 0
        for z in range(m):
            tmp += a[x][z] * b[z][y]
        string += str(tmp)
    print(string)

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
A_list = [list(map(int, input().split())) for i in range(n)]
B_list = [list(map(int, input().split())) for j in range(m)]

for i in range(n):
    _list = [sum(A_list[i][j] * B_list[j][k] for j in range(m)) for k in range(l)]
    print(*_list)

Submission status: Accepted

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

A = [list(map(int, input().split())) for col in range(n)]
B = [list(map(int, input().split())) for col in range(m)]
C = []
for row in range(n):
    cRow = []
    for col in range(l):
        sumC = 0
        for cal in range(m):
            sumC += A[row][cal] * B[cal][col]
        cRow.append(sumC)
    C.append(cRow)

for row in range(n):
    print(*C[row])

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
a = [[int(i) for i in input().split()] for j in range(n)]
b = [[int(i) for i in input().split()] for j in range(m)]
for i in range(n):
    ans = []
    for j in range(l):
        ans.append(str(sum([a[i][k] * b[k][j] for k in range(m)])))
    print(' '.join(ans))

Submission status: Accepted

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

for i in range(n):
    for k in range(l):
        if k != 0:
            print(" ", end="")
        tmp = 0
        for j in range(m):
            tmp += a[i][j] * b[j][k]
        print(tmp, end="")
    print()

Submission status: Accepted

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)]
for i in a:
    result = []
    for j in zip(*b):
        result.append(sum([x * y for x, y in zip(i, j)]))
    print(*result)

Submission status: Accepted

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

matrix1 = []
matrix2 = []

for i in range(n):
    row1 = list(map(int, input().split()))
    matrix1.append(row1)

#print(matrix1)

for j in range(m):
    row2 = list(map(int, input().split()))
    matrix2.append(row2)

#print(matrix2)

matrix3 = []
for i in range(n):
    row3 =[]
    for k in range(l):
        a = 0
        for j in range(m):
            a += matrix1[i][j]*matrix2[j][k]
        row3.append(a)
    matrix3.append(row3)

for row in matrix3:
    print(*row)

Submission status: Accepted

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

Submission status: Accepted

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]*l for i in range(n)]
for i in range(n):
    for j in range(l):
        c[i][j]+=sum([a[i][k]*b[k][j] for k in range(m)])
for i in c:print(*i)

Submission status: Accepted

Solution code:
def input_mat(r, c):
    mat = []
    for _ in range(r):
        row = [int(s) for s in input().split()]
        assert len(row) == c
        mat.append(row)
    return mat

def mat_prod(A, B, n, m, l):
    mat = []
    for i in range(n):
        row = []
        for j in range(l):
            v = sum((A[i][x] * B[x][j] for x in range(m)))
            row.append(v)
        mat.append(row)
    return mat

def print_mat(mat):
    for r in mat:
        print(" ".join(map(str, r)))

if __name__ == '__main__':
    n, m, l = [int(s) for s in input().split()]
    A = input_mat(n, m)
    B = input_mat(m, l)
    #T = [[2,3],[1,4]]
    #E = [[1,0],[0,1]]
    #print_mat((mat_prod(T, E, 2, 2, 2)))
    C = mat_prod(A, B, n, m, l)
    print_mat(C)

Submission status: Accepted

Solution code:
nml = [int(s) for s in input().split()]
A = []
for n in range(nml[0]):
    a_n = [int(s) for s in input().split()]
    A.append(a_n)
B = []
for m in range(nml[1]):
    b_m = [int(s) for s in input().split()]
    B.append(b_m)

for i in range(nml[0]):
    c_i = []
    for j in range(nml[2]):
        c_ij = 0
        for k in range(nml[1]):
            c_ij += A[i][k] * B[k][j]
        c_i.append(str(c_ij))
    print(' '.join(c_i))

Submission status: Accepted

Solution code:
import sys

n, m, o = map(int, sys.stdin.readline().strip().split())

mat1 = []
for _ in range(n):
    mat1.append(list(map(int, sys.stdin.readline().strip().split())))

mat2 = []
for _ in range(m):
    mat2.append(list(map(int, sys.stdin.readline().strip().split())))

for i in range(n):
    row = (sum(mat1[i][k] * mat2[k][j] for k in range(m)) for j in range(o))
    print(' '.join(map(str, row)))

Submission status: Accepted

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):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = list(map(int, 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(c[i][j], end="")
        if j != l-1:
            print(" ", end="")
    print("")

Submission status: Accepted

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

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

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

trans_B = [x for x in zip(*B)]

for i in A:
    c = []
    for j in trans_B:
        tmp = 0
        for k, l in zip(i, j):
            tmp += k * l
        c.append(tmp)
    C.append(c)

for i in C:
    print(*i)

Submission status: Accepted

Solution code:
def main():
    n, m, l = map(int, input().split())
    nm_arr = [list(map(int, input().split())) for _ in range(n)]
    ml_arr = [list(map(int, input().split())) for _ in range(m)]

    nml_arr = [[0 for _ in range(l)] for __ in range(n)]

    for j in range(n):
        for i in range(l):
            nml_arr[j][i] = sum([nm_arr[j][x] * ml_arr[x][i] for x in range(m)])
            
    [print(*nml_arr[x]) for x in range(n)]

main()

Submission status: Accepted

Solution code:
nml=list(map(int,input().split()))
n=nml[0]
m=nml[1]
l=nml[2]

A=[]
B=[]
for i in range(n+m):
    if i<n:
        A.append(list(map(int,input().split())))
    else:
        B.append(list(map(int,input().split())))

for i in range(n):
    for k in range(l):
        c=0
        for j in range(m):
            c=c+A[i][j]*B[j][k]
        if k<l-1:
            print(str(c)+" ",end="")
        else:
            print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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):
  data = input().split()
  for j in range(m):
    A[i][j] = int(data[j])

for i in range(m):
  data = input().split()
  for j in range(l):
    B[i][j] = int(data[j])

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):
  print(*C[i])

Submission status: Accepted

Solution code:

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

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

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

for i in range(0,n):
    t = []
    for j in range(0,l):
        sum = 0
        for k in range(0,m):
            sum += g1[i][k]*g2[k][j]
        t.append(sum)
    print (' '.join(map(str,t)))

Submission status: Accepted

Solution code:
n,m,l=map(int,input().split())
a={i+1:list(map(int,input().split())) for i in range(n)}
b={i+1:list(map(int,input().split())) for i in range(m)}
for i in range(n):
    cl=[]
    for j in range(l):
        ci=0
        for k in range(m):
            cij=a[i+1][k]*b[k+1][j]
            ci+=cij
        cl.append(ci)
    print(" ".join(map(str,cl)))

Submission status: Accepted

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

for i in range(n):
  line = []
  for j in range(l):
    c = 0
    for k in range(m):
      c += a[i][k]*b[k][j]
    line.append(str(c))
  print(' '.join(line))

Submission status: Accepted

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

matrix1=[]*m
matrix2=[]*n
matrix3=[[0]*l for i in range(m)]

for row1 in range(m):
    line = list(map(int, input().split()))
    matrix1.append(line)
for row2 in range(n):
    line = list(map(int,input().split()))
    matrix2.append(line)

a = matrix1
b = list(map(list, zip(*matrix2)))

for row3 in range(m):
    for col in range(l):
        matrix3[row3][col]=sum([x*y for x,y in zip(a[row3],b[col])])
    print(*matrix3[row3], sep=" ")

Submission status: Accepted

Solution code:
def create_list(col):
    result = []

    for _ in range(col):
        result.append(list(map(int,input().split())))
    return result

n,m,l = map(int,input().split())
a_list = create_list(n)
b_list = create_list(m)
ans_list = []

for i in range(n):
    temp_list =[]
    for j in range(l):
        ans = 0
        for k in range(m):
            ans += a_list[i][k]*b_list[k][j]
        temp_list.append(str(ans))
    ans_list.append(temp_list)

for ans in ans_list:
    print(' '.join(ans))

Submission status: Accepted

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

Submission status: Accepted

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] * L for i in range(N)]

for n in range(N):
    for l in range(L):
        for m in range(M):
            C[n][l] += A[n][m] * B[m][l]
for row in C:
    print(*row)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# ITP1_7_D
# import numpy as np
# import io

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


# 旧来の書き方だとこう
# for k in range(n):
#     list1=list()
#     for j in range(l):
#         sum=0
#         for i in range(m):
#             sum+=A[k][i]*B[i][j]
#         list1.append(str(sum))
#     print(" ".join(list1))


# これが、結果の(0,0)のセルに当たる。
# sum([A[0][k] * B[k][0] for k in range(m)])

# これが０行目のリストに当たる
# print( [ sum([A[0][k] * B[k][j] for k in range(m)]) for j in range(l) ] )

for i in range(n):
    t = [ str(sum([A[i][k] * B[k][j] for k in range(m)])) for j in range(l) ]
    print(" ".join(t))

Submission status: Accepted

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

a=[list(map(int,input().split())) for _ in range(n)] # n x m                    
b=[list(map(int,input().split())) for _ in range(m)] # m x l                    
c=[[0 for _ in range(l)] for _ in range(n)]

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 c:
    print(' '.join(map(str, i)))

Submission status: Accepted

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):
            C[i][j] += A[i][k]*B[k][j]
for i in range(n):
    print(" ".join(map(str, C[i])))

Submission status: Accepted

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

for i in range(0, n):
    A.append(input().split())

for i in range(0, m):
    B.append(input().split())

for i in range(0, n):
    temp_A = A[i]
    # temp_C = []
    for j in range(0, l):
        temp = 0
        for k in range(0, len(temp_A)):
            temp += int(temp_A[k]) * int(B[k][j])
        if (j < l - 1):
            print(temp, end = ' ')
        else :
            print(temp)
#         temp_C.append(temp)        
#     C.append(temp_C)

# for i in range(0, n):
#     for j in range(0, l):
#         if (j < l - 1):
#             print(C[i][j], end = ' ')
#         else :
#             print(C[i][j])

Submission status: Accepted

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):
			C[i][j]+=A[i][k]*B[k][j]
for i in range(n):
	for j in range(l):
		print(str(C[i][j]),end="")
		if j<l-1:
			print(" ",end="")
		else:
			print("")

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
arrA = [[0 for i in range(m)] for j in range(n)]
arrB = [[0 for i in range(l)] for i in range(m)]
arrC = [[0 for i in range(l)] for j in range(n)]

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

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

for i in range(n):
    for j in range(l):
        c = 0
        for k in range(m):
            c += arrA[i][k] * arrB[k][j]
        arrC[i][j] = c

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

Submission status: Accepted

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

for i in range(n):
    ans = [str(sum([A[i][k] * B[k][j] for k in range(m)])) for j in range(l)]
    print(' '.join(ans))

Submission status: Accepted

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

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 i in range(n):
    row = []
    for j in range(l):
        sigma = 0
        for k in range(m):
            sigma += A[i][k] * B[k][j]
        row.append(sigma)
    C.append(row)

for row in C:
    print(*row)

Submission status: Accepted

Solution code:
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


N,M,L = map(int,input().split())

A = [list(map(int,input().split())) for i in range(N)] #N*M配列の取得
B = [list(map(int,input().split())) for i in range(M)] #M*L配列の取得
ANS = [[0]*L for i in range(N)] #N*L


for x in range(N):
    for y in range(L):
        for z in range(M):
            ANS[x][y] += B[z][y]*A[x][z]

for row in range(N):
    print("%d"%ANS[row][0],end = "")
    for col in range(1,L):
        print(" %d"%(ANS[row][col]),end = "")
    print()

Submission status: Accepted

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

A = [0] * n
B = [0] * m

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

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


for i in range(n):
    list = []
    for j in range(l):
        o = 0
        for k in range(m):
            o += A[i][k] * B[k][j]
        list.append(o)
    c = map(str, list)
    d = ' '.join(c)
    print(d)

Submission status: Accepted

Solution code:
n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
    a_i = list(map(int, input().split()))
    a.append(a_i)
for i in range(m):
    b_i = list(map(int, input().split()))
    b.append(b_i)
c = []
for i in range(n):
    c_i = []
    for j in range(l):
        c_ij = 0
        for k in range(m):
            c_ij = c_ij + a[i][k]*b[k][j]
        c_i.append(c_ij)
    c.append(c_i)



for i in range(n):
    word = str(c[i][0])
    for k in range(1,l):
        if k < l:
            word = word +" "+str(c[i][k])
        else:
            word = word + str(c[i][k])
    print(word)

Submission status: Accepted

Solution code:
def matrixMultiplication(n, m, l, A, B):
	result = list()
	for i in range(n):
		temp = list()
		for j in range(l):
			temp2 = list()
			for k in range(m):
				temp2.append(A[i][k] * B[k][j])
			temp.append(sum(temp2))
		result.append(temp)
	return result

nml = [int(x) for x in input().split()]
A = list()
for i in range(nml[0]):
	A.append([int(x) for x in input().split()])
B = list()
for i in range(nml[1]):
	B.append([int(x) for x in input().split()])

C = matrixMultiplication(nml[0], nml[1], nml[2], A, B)
for i in range(len(C)):
	for j in range(len(C[i])):
		print(C[i][j], end=' ' if j < len(C[i]) - 1 else '\n')

Submission status: Accepted

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

a = [[]for _ in range(n)]
b = [[]for _ in range(m)]

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

for i in range(n):
    c = []
    for j in range(l):
        num = 0
        for k in range(m):
            num += a[i][k] * b[k][j]
        c.append(str(num))
    print(' '.join(c))

Submission status: Accepted

Solution code:
#!/usr/bin/env python

if __name__ == '__main__':
    n, m, l = map(int, raw_input().split())

    A = [map(int, raw_input().split()) for _ in range(n)]
    B = [map(int, raw_input().split()) for _ in range(m)]

    for i in range(n):
        print ' '.join(map(str, [sum([A[i][k]*B[k][j] for k in range(m)]) for j in range(l)]))

Submission status: Accepted

Solution code:
n, m, l = list(map(int, input().split()))
A = [[0]*m for i in range(n)]
B = [[0]*l for i in range(m)]
C = [[0]*l for i in range(n)]
for i in range(n):
  a = list(map(int, input().split()))
  for j in range(m):
    A[i][j] = a[j]
for i in range(m):
  b = list(map(int, input().split()))
  for j in range(l):
    B[i][j] = b[j]
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):
  print(" ".join(map(str, C[i])))

Submission status: Accepted

Solution code:
n,m,l = map(int, tuple(input().split(' ')))
A = [[int(s) for s in input().split(' ')] for _ in range(n)]
B = [[int(s) for s in input().split(' ')] for _ in range(m)]
rslt = []
for i in range(n):
	wl = []
	for j in range(l):
		wa = 0
		for k in range(m):
			wa += A[i][k] * B[k][j]
		wl.append(wa)
	rslt.append(wl)
for row in rslt: print(' '.join(map(str, row)))

Submission status: Accepted

Solution code:
n,m,l = map(int, input().split())
data = []
data2 = []
tmp = []
for x in range(0,n):
    tmp = input().split()
    data.append([int(tmp[i]) for i in range(m)])
for x in range(0,m):
    tmp = input().split()
    data2.append([int(tmp[i]) for i in range(l)])
output = []
for x in range(n):
    output.append([sum(data[x][i] * data2[i][j] for i in range(m)) for j in range(l)])
for x in range(0,n):
    for y in range(0,l):
        if y != l-1:
            print(output[x][y],end=' ')
        else:
            print(output[x][y])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
A_ele = []
B_ele = []
ele = [int(x) for x in input().split()]
for i in range(ele[0]):
    A_ele.append([int(x) for x in input().split()])
A_ele = np.array(A_ele)
for i in range(ele[1]):
    B_ele.append([int(x) for x in input().split()])
B_ele = np.array(B_ele)
C_ele = A_ele.dot(B_ele)

for i in range(ele[0]):
    print(' '.join(map(str,C_ele[i])))

Submission status: Runtime Error

Solution code:
import numpy as np
A_ele = []
B_ele = []
ele = [int(x) for x in input().split()]
for i in range(ele[0]):
    A_ele.append([int(x) for x in input().split()])
A_ele = np.array(A_ele)
for i in range(ele[1]):
    B_ele.append([int(x) for x in input().split()])
B_ele = np.array(B_ele)
C_ele = A_ele.dot(B_ele)

for i in range(ele[0]):
    print(' '.join(map(str,C_ele[i])))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy
A_ele = []
B_ele = []
ele = [int(x) for x in input().split()]
for i in range(ele[0]):
    A_ele.append([int(x) for x in input().split()])
A_ele = numpy.array(A_ele)
for i in range(ele[1]):
    B_ele.append([int(x) for x in input().split()])
B_ele = numpy.array(B_ele)
C_ele = A_ele.dot(B_ele)

for i in range(ele[0]):
    print(' '.join(map(str,C_ele[i])))

Submission status: Runtime Error

Solution code:
a = input().split()
x = []
y = []
z = []
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
for i in range(a[0]):
    b = input().split()
    for j in range(a[1]):
        b[j] = int(b[j])
    x.append(b)
    z.append([])
for i in range(a[1]):
    b  = input().split()
    for j in range(a[2]):
        b[j] = int(b[j])
    y.append(b)
for i in range(a[0]):
    for j in range(a[2]):
        z[i].append(0)    
for i in range(a[0]):
    for j in range(a[2]):
        for k in range(a[1]):
            z[i][j] += x[i][k]*y[k][j]
for i in range(len(z)):
    for j in range(a[0]):
        z[i][j] = str(z[i][j])
for i in z:
    gam = " ".join(i)
    print(gam)

Submission status: Runtime Error

Solution code:
a = input().split()
x = []
y = []
z = []
a[0] = int(a[0])
a[1] = int(a[1])
a[2] = int(a[2])
for i in range(a[0]):
    b = input().split()
    x.append(b)
    z.append([])
for i in range(a[1]):
    b  = input().split()
    y.append(b)
for i in range(a[0]):
    for j in range(a[2]):
        z[i].append(0)    
for i in range(a[0]):
    for j in range(a[2]):
        for k in range(a[1]):
            z[i][j] += int(x[i][k])*int(y[k][j])
for i in range(len(z)):
    for j in range(a[0]):
        z[i][j] = str(z[i][j])
for i in z:
    gam = " ".join(i)
    print(gam)

Submission status: Runtime Error

Solution code:
import numpy as np
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())))
x = np.array(a); y = np.array(b); z = x.dot(y)
for i in z: print(*i)

Submission status: Runtime Error

Solution code:
import numpy as np
n,m,l = map(int,input().split())
a = np.array([list(map(int,input().split())) for i in range(n)])
b = np.array([list(map(int,input().split())) for i in range(m)])
c = np.dot(a,b)
for i in range(n):
    for j in range(n):
        if j == n-1:print(c[i][j])
        else:print(c[i][j],end=" ")

Submission status: Runtime Error

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

n = int(n)
m = int(m)
l = int(l)

matrix_A = [[0]*m for i in range(n)]
matrix_B = [[0]*n for j in range(l)]
matrix_C = [[0]*l for k in range(n)]
box_a = []
box_b = []
box_c = 0

for a in range(n):
    
    box_a = input().split()
    
    for b in range(m):
        
        matrix_A[a][b] = int(box_a[b])
        
    
for c in range(m):
    
    box_b = input().split()
    
    for d in range(l):
        
        matrix_B[c][d] = int(box_b[d])
        
            
for e in range(n):
    
    for f in range(l):
        
        for g in range(m):
            box_c += matrix_A[e][g] * matrix_B[g][f]
        
        
        matrix_C[e][f] = box_c
        box_c = 0
    
    print(" ".join(map(str,matrix_C[e])))

Submission status: Runtime Error

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)]
c = [[0 for _ in range(l)]for _ in range(n)]

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 h in c:
    print(''.join(str, c))

Submission status: Runtime Error

Solution code:
import numpy as np
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: Runtime Error

Solution code:
n,m,l = map(int,input().split())
YEAH = list(map)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]
        print(GOMI,end=" ")
    print()

Submission status: Runtime Error

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

Submission status: Runtime Error

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)]
C = [[0] * n for i in range(l)]
for i in range(n):
    A[i] = [int(i) for i in input().split()]
for i in range(m):
    B[i] = [int(i) for i in input().split()]

for i in range(n):
    for j in range(l):
        tmp = 0
        for k in range(m):
            tmp += A[i][k] * B[k][j]
        C[i][j] = tmp
    print(' '.join(map(str, C[i])))

Submission status: Runtime Error

Solution code:
n,m,l=map(int,input().split())
lst=[[]for i in range(n)]
for i in range(n):
    lst[i]=list(map(int,input().split()))
lst2=[[]for j in range(m)]
for i in rnage(m):
    lst2[j=list(map(int,input().split()))
for i in range(n):
    x=0
    for j in range(m):
         x =x+lst[i][j]*lst2[j][i]
    print(x)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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]*l for i in range(n)]

for x in range(n):
    for y in range(m):
        for z in range(l):
            C[x][y] += A[x][z]*B[z][y]

for row in range(n):
    print("%d"%(C[row][0]).end="")
    for col in range(1,l):
        print(" %d"%(C[row][col]),end="")
    print()