Problem:


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

Matrix Vector Multiplication

Write a program which reads a $ n \times m$ matrix $A$  and a $m \times 1$ vector $b$, and prints their product $Ab$.

  A column vector with m elements is represented by the following equation.

\[
  b = \left(
    \begin{array}{c}
      b_1  \\
      b_2  \\
      : \\ 
      b_m \\ 
    \end{array}
  \right)
\]

  A $n \times m$ matrix with $m$ column vectors, each of which consists of $n$ elements, is represented by the following equation.

\[
  A = \left(
    \begin{array}{cccc}
      a_{11} & a_{12} & ... & a_{1m} \\
      a_{21} & a_{22} & ... & a_{2m} \\
       :    &   :   &  :  &  : \\
      a_{n1} & a_{n2} & ... & a_{nm} \\
    \end{array}
  \right)
\]

  $i$-th element of a $m \times 1$ column vector $b$ is represented by $b_i$ ($i = 1, 2, ..., m$), and the element in $i$-th row and $j$-th column of a matrix $A$ is represented by $a_{ij}$ ($i = 1, 2, ..., n,$  $j = 1, 2, ..., m$).

The product of a $n \times m$ matrix $A$ and a $m \times 1$ column vector $b$ is a $n \times 1$ column vector $c$, and $c_i$ is obtained by the following formula:

\[
c_i = \sum_{j=1}^m a_{ij}b_j  = a_{i1}b_1 + a_{i2}b_2 + ... + a_{im}b_m
\]

Input

  In the first line, two integers $n$ and $m$ are given. In the following $n$ lines, $a_{ij}$ are given separated by a single space character. In the next $m$ lines, $b_i$ is given in a line.

Output

  The output consists of $n$ lines. Print $c_i$ in a line.

Constraints

$1 \leq n, m \leq 100$

$0 \leq b_i, a_{ij} \leq 1000$

Sample Input

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

Sample Output

5
6
9



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


Sample output:
5
6
9

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(m):
    B.append(int(input()))

for i in range(n):
    ans = 0
    for a, b in zip(A[i], B):
        ans += (a * b)
    print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n) ]
b = [int(input()) for i in range(m)]
for i in range(n):
    bi = 0
    for j in range(m):
        bi += A[i][j] * b[j]
    print(bi)

Submission status: Accepted

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

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


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

Submission status: Accepted

Solution code:
num_nm=list(map(int,input().split()))
A=[[0 for iA in range(num_nm[0])]for jA in range(num_nm[1])]
b=[0 for ib in range(num_nm[1])]
for i in range(num_nm[0]):
	num_A=list(map(int,input().split()))
	for j in range(num_nm[1]):
		A[j][i]=num_A[j]
for k in range(num_nm[1]):
	num_b=int(input())
	b[k]=num_b
for l in range(num_nm[0]):
	ans_1=0
	for m in range(num_nm[1]):
		ans_1=ans_1+A[m][l]*b[m]
	print(ans_1)

Submission status: Accepted

Solution code:
nxm = list(map(int,input().split()))

matrix = []
vector = []

for i in range(nxm[0]):
    matrix.append(list(map(int,input().split())))
    
for k in range(nxm[1]):
    vector.append(int(input()))
    

for n in range(nxm[0]):
    ans = 0
    for m in range(nxm[1]):
        ans += matrix[n][m]*vector[m]       
    print(ans)

Submission status: Accepted

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

A = []
b = []
result  = []

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

for i in range(0, n):
    temp = 0
    for j in range(0, m):
        temp += int(A[i][j]) * int(b[j])
    result.append(temp)

for i in result:
    print(i)

Submission status: Accepted

Solution code:
# n,mを取得
n,m = map(int, input().split())

# 配列a,bを初期化
a = [[] for i in range (0,n)]
b = [[0]*1 for i in range (0,m)]

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

for i2 in range(m):
    b[i2] = int(input())

# 戻り値の各要素を個々に計算し、戻り値tmpの要素に加える
for i4 in range(n):
    tmp = 0
    for i5 in range(m):
        tmp += a[i4][i5]*b[i5]
    print(tmp)

Submission status: Accepted

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

# ITP1_6_D

matrix=list()
col=list()
y,x=map(int,input().split())

for _ in range(y):
    matrix.append(list(map(int,input().split())))

for _ in range(x):
    col.append(int(input()))

for j in range(y):
    result=0
    for i in range(x):
        result+=matrix[j][i]*col[i]
    print(result)

Submission status: Accepted

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

ans = [sum([a[i]*b[i] for i in range(len(b))]) for a in A]
for xj in ans:
    print(xj)

Submission status: Accepted

Solution code:
r,c=map(int,input().split())
A=[ list(map(int,input().split())) for i in range(r) ]
B=[ list(map(int,input().split())) for i in range(c) ]
C=[ [0] for i in range(r) ]
for i in range(r):
	for j in range(c):
		C[i][0]+=A[i][j]*B[j][0]
for i in range(r):
	print(str(C[i][0]))

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

for i in range(n):
    tmp = 0
    for j in range(m):
        tmp+=a[i][j] * b[j]
        pass
    print(tmp)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n, m = 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(int(input()))

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

for i in range(n):
    print(C[i])

Submission status: Accepted

Solution code:
dim = input().split()
m = int(dim[0])
n = int(dim[1])
matrix = [input().split() for i in range(m)]
vector = [int(input()) for i in range(n)]
for i in range(m):
    result = 0
    for j in range(n):
        result += int(matrix[i][j]) * vector[j]
    print(result)

Submission status: Accepted

Solution code:
m, n = map(int,input().split())
M = []
for i in range(m):
    a_ik = list(map(int, input().split()))
    M.append(a_ik)
N = []
for i in range(n):
    b_i1 = int(input())
    N.append(b_i1)

for i in range(m):
    sum = 0
    for k in range(n):
            c_ij = M[i][k]*N[k]
            sum = sum + c_ij
    print(sum)

Submission status: Accepted

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

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

b = [int(input()) for _ in range(m)]

c = [ 0 for _ in range(n)]


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

Submission status: Accepted

Solution code:
h, w = [int(i) for i in input().split()]
A = [0] * h
for i in range(h):
    A[i] = [int(j) for j in input().split()]
b = []
for i in range(w):
    b.append(int(input()))
for i in range(h):
    num = 0
    for j in range(w):
        num += A[i][j] * b[j]
    print(num)

Submission status: Accepted

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

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

b = [0 for _ in range(m)]
for i in range(m):
    b[i] = int(input())

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

Submission status: Accepted

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

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

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

    for i in range(n):
        print sum([A[i][j]*B[j][0] for j in range(m)])

Submission status: Accepted

Solution code:
n, m = list(map(int, input().split()))
A = [[0]*m for _ in range(n)]
B = [0]*m
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[i] = int(input())
for i in range(n):
  ans = 0
  for j in range(m):
    ans += A[i][j]*B[j]
  print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, tuple(input().split(' ')))
a = [[int(s) for s in input().split(' ')] for _ in range(n)]
b = [int(input()) for i in range(m)]
for i in range(n):
	ci = 0
	for j in range(m): ci += a[i][j] * b[j]
	print(ci)

Submission status: Accepted

Solution code:
arg1,arg2 = map(int, input().split())
data = []
data2 = []
tmp = []
for x in range(0,arg1):
    tmp = input().split()
    data.append([int(tmp[i]) for i in range(arg2)])
for x in range(0,arg2):
    data2.append(int(input()))
for x in range(0,arg1):
    sum = 0
    for y in range(0,arg2):
        sum = sum + data[x][y] * data2[y]
    print(sum)

Submission status: Runtime Error

Solution code:
def main():

m, n = tuple(map(int, input().split()))
a = [[0 for j in range(n)] for i in range(m)]
b = [0 for j in range(n)]
c = [0 for i in range(m)]

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

for j in range(n):
    b[j] = int(input())

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



if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

ans = [sum([a[j][i] * b[i] for i in range(4)]) for j in range(3)]
print(*ans, sep='\n')

Submission status: Runtime Error

Solution code:
package main

import (
	"fmt"
)

func main(){
	var h, w, b int
	fmt.Scan(&h, &w)
	A := make([][]int, h)
	for i:=0; i<h; i++{
		i = make([]int, w)
	}
	x := make([]int, w)
	for i:=0; i<h; i++{
		for j:=0; j<w; j++{
			fmt.Scan(&A[i][j])
		}
	}
	for i:=0; i<w; i++{
		fmt.Scan(&x[i])
	}

	for i:=0; i<h; i++{
		b = 0
		for j:=0; j<w; j++{
			b += A[i][j] * x[j]
		}
		fmt.Println(b)
	}
}

Submission status: Runtime Error

Solution code:
import numpy as np
n,m = map(int,input().split())
a = np.zeros((n,m))
b = np.zeros(m)
for i in range(n):
    x = list(map(int,input().split()))
    for j in range(m):
        a[i][j] = x[j]
for i in range(m):
    b[i] = int(input())
c = np.dot(a,b)
for x in c:
    print(int(x))

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
m = int(input())

A = [[input() for i in range(n)] for i in range(m)]
b = [input() for i in range(m)]

c = A.dot(b)
print(c)

Submission status: Runtime Error

Solution code:
import numpy as np
n = int(input())
m = int(input())

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

c = A.dot(b)
print(c)

Submission status: Runtime Error

Solution code:
from sys import stdin
import numpy as np

n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = np.asarray([[int(x) for x in stdin.readline().rstrip().split()] for _ in range(n)])
b = np.asarray([[int(stdin.readline().rstrip())] for _ in range(m)])
c = a.dot(b)
for i in range(n):
    print(*c[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = [[None] * m for _ in range(n)]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for _ in range(n):
    c = 0
    for i in range(m):
        c += a[i] * b[i]
    print(c)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = [[None] * m for _ in range(n)]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = None
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = [[None] * n]
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(columnNum)]
inColumnVec = [[0] for i in range(columnNum)]
for row in range(rowNum):
    inMat[row] = [int(i) for i in input().split()]
for column in range(columnNum):
    inColumnVec[column] = int(input())

timesAns = [[0] for i in range(rowNum)]

#行列計算
for row in range(rowNum):
    timesAns[row] = 0
    for column in range(columnNum):
        timesAns[row] = timesAns[row] + inMat[row][column] * inColumnVec[column]

for row in range(rowNum):
    print(timesAns[row])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = 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(n):
    b[i] = int(input())

for i in range(m):
    ret = 0
    for j in range(n):
        ret += a[i][j] * b[j]    
    print(ret)

Submission status: Runtime Error

Solution code:
import numpy as np

n, m = map(int, input().split())
a = []
b = []
for i in range(n):
    a += [list(map(int, input().split()))]
for i in range(m):
    b += [int(input())]
a = np.array(a)
b = np.array(b)
b.reshape(4, 1)

c = np.dot(a, b)
for i in range(len(c))
    print(c[i])

Submission status: Runtime Error

Solution code:
import numpy as np

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

c = np.dot(a, b)
for i in range(len(c))
    print(c[i])

Submission status: Runtime Error

Solution code:
import numpy as np

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

c = np.dot(a, b)
for i in range(len(c)):
    print(c[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
n_l = []
ans = [0, 0, 0]

for _ in range(n):
    l = list(map(int, input().split()))
    n_l.append(l)
for x in range(m):
    p = int(input())
    n_l[:,0] * p
for i in n_l:
    print(sum(i))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
n_l = []
ans = [0, 0, 0]

for _ in range(n):
    l = list(map(int, input().split()))
    n_l.append(l)
for x in range(m):
    p = int(input())
    n_l[0:][x]
for i in n_l:
    print(sum(i))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
n_l = []
ans = [0, 0, 0]

for _ in range(n):
    l = list(map(int, input().split()))
    n_l.append(l)
for x in range(m):
    p = int(input())
    n_l[:][:][x]
for i in n_l:
    print(sum(i))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
n_l = []
ans = [0, 0, 0]

for _ in range(n):
    l = list(map(int, input().split()))
    n_l.append(l)
for x in range(m):
    p = int(input())
    for o in n:
        n_l[o] *= p
for i in n_l:
    print(sum(i))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
A=[[0 for j in range(m)]for i in range(n)]
B=[[0 for j in range(1)]for i in range(m)]
C=[[0 for j in range(1)]for i in range(n)]
for i in range(n):
  A1,A2,A3,A4=map(int,input().split())
  A[i][0]=A1
  A[i][1]=A2
  A[i][2]=A3
  A[i][3]=A4
for i in range(m):
  B[i][0]=int(input())
S=int(0)
for j in range(n):
  for i in range(m):
    S=S+(A[j][i]*B[i][0])
  C[j][0]=S3
for i in range(n):
  print(C[j][0])

Submission status: Runtime Error

Solution code:
#ITP1_6_D
n,m=map(int,input().split())
A=[[0 for j in range(m)]for i in range(n)]
B=[[0 for j in range(1)]for i in range(m)]
C=[[0 for j in range(1)]for i in range(n)]
for i in range(n):
  A1,A2,A3,A4=map(int,input().split())
  A[i][0]=A1
  A[i][1]=A2
  A[i][2]=A3
  A[i][3]=A4
for i in range(m):
  B[i][0]=int(input())
S=int(0)
for j in range(n):
  for i in range(m):
    S=S+(A[j][i]*B[i][0])
  C[j][0]=S
  S=0
for i in range(n):
  print(C[i][0])

Submission status: Runtime Error

Solution code:
from sys import stdin

n, m = (int(n) for n in stdin.readline().rstrip().split())

a = []
for cnt in range(n):
    a.append([int(n) for n in stdin.readline().rstrip().split()])

b = []
for cnt in range(m):
    b.append([int(n) for n in stdin.readline().rstrip().split()])


from numpy import dot

c = dot(a, b)

for cn in c:
    print(int(cn))

Submission status: Runtime Error

Solution code:
a = [[0]*4 for i in range(3)]
b = [0]*4

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

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

for i in c:
    print(i)

Submission status: Runtime Error

Solution code:
a = [[0]*4 for i in range(3)]
b = [0]*4

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

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

for i in c:
    print(i)

Submission status: Runtime Error

Solution code:
a = [[0]*4 for i in range(3)]
b = [0]*4

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

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

for i in c:
    print(i)

Submission status: Runtime Error

Solution code:
a = [[0]*4 for i in range(3)]
b = [0]*4

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

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

for i in c:
    print(i)

Submission status: Runtime Error

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

a = [[] for _ in range(n)]
for i in range(n):
  a[i] = list(map(int, input().split()))
  b = [0 for _ in range(m)]
  for i in range(m):
    b[i] = int(input())
    for i in range(n):
      d = 0
      for j in range(m):
        d += a[i][j]*b[j]
        
      print(d)

Submission status: Runtime Error

Solution code:
import scipy as np

def az18_2():
    n,m = map(int,raw_input().split())
    a = np.array([map(int, raw_input().split()) for i in range(n)])
    b = np.array([input() for i in range(m)])
    for i in range(n):
        print a.dot(b)[i]
az18_2()

Submission status: Runtime Error

Solution code:
import numpy as np

def az18_2():
    n,m = map(int,raw_input().split())
    a = np.array([map(int, raw_input().split()) for i in range(n)])
    b = np.array([input() for i in range(m)])
    for i in range(n):
        print a.dot(b)[i]
az18_2()

Submission status: Runtime Error

Solution code:
import numpy as np

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

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

b = np.zeros(m)
for i in range(m):
    b[i] = int(input())

c = a.dot(b)
for i in c:
    print(i)

Submission status: Runtime Error

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

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

product = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc][mc] * b[mc]

    product.append(total)

[print(p) for p in product]

Submission status: Runtime Error

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

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

product = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc] [mc] * b[mc]

    product.append(total)

[print(p) for p in product]

Submission status: Runtime Error

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

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 = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc][mc] * b[mc]

    product.append(total)

[print(p) for p in product]

Submission status: Runtime Error

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

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

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

product = []
for nc in range(n):
    total = 0
    for mc in range(m):
        total += A[nc][mc] * b[mc]

    product.append(total)

[print(p) for p in product]

Submission status: Runtime Error

Solution code:
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
A = np.array(A)

b = []
for _ in xrange(m):
    b.append(input())
b = np.array(b)

Ab = np.dot(A, b)
for x in Ab:
    print x

Submission status: Runtime Error

Solution code:
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
A = np.array(A)
# print A

b = []
for _ in xrange(m):
    b.append(input())
b = np.array(b)
# print b

Ab = np.dot(A, b)
# print Ab
for x in Ab:
    print x

Submission status: Runtime Error

Solution code:
# coding=utf-8

import numpy as np

A = []
n, m = map(int, raw_input().split())
for _ in xrange(n):
    A.append(map(int, raw_input().split()))
# print A

b = []
for _ in xrange(m):
    b.append(input())
# print b

Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
# print Ab
for x in Ab:
    print x

Submission status: Runtime Error

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

A = [[]]
b = []


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

for i in range(m):
    b.append(int(input())


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

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
a = [[]]
b = []
for i in range(n):
    A.append([int(j) for j in input().split()]

for i in range(m):
    b.append(int(input()))

c = []
for i range(n):
    s = 0
    for j in range(m):
        m += A[i][j] * b[j]
    print(m)

Submission status: Runtime Error

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

A = [[]]
b = []


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

for i in range(m):
    b.append(int(input())


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

Submission status: Runtime Error

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

for i in range(m):
    B.append(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        m += A[i][j] * B[j]
    print(s)

Submission status: Runtime Error

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

A = [[]]
b = []


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

for i in range(m):
    b.append(int(input())


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

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
a = [[]]
b = []
for i in range(n):
    A.append([int(j) for j in input().split()]

for i in range(m):
    b.append(int(input()))

c = []
for i range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
A = [[]]
b = []
for i input range(n):
    A.append([int(j) for j in input().split()])
  
for i in range(m):
    b.append(int(input()))
  
c = []
for i in range(n):
    s = 0
    for j in range(m)
        s += A[n][m] * b[m]

Submission status: Runtime Error

Solution code:
(n,m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
 
for i in range(m):
    b.append(int(input()))
 
print(A)
print(b)

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

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
a = [[]]
b = []
for i in range(n):
    A.append([int(j) for j in input().split()]

for i in range(m):
    b.append(int(input()))

c = []
for i range(n):
    s = 0
    for j in range(m):
        m += A[i][j] * b[j]
        print(s)

Submission status: Runtime Error

Solution code:
(n,m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.oppend([int(j) for j in input().split()])

for i in range(m):
    b.oppend(int(input()))

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

Submission status: Runtime Error

Solution code:
(m, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(m):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.apped(int(input()))

c = []
for i in range(n):
    s = 0
    for j in range(m):
        m += A[n][m] * b[m]
    print(m)

Submission status: Runtime Error

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

A = [[]]
b = []


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

for i in range(m):
    b.append(int(input()))


for i in range(n):
    c = 0

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

    print(c)

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
 A = [[]]
 b = []
 for i input range(n):
     A.append([int(j) for j in input().split()])
  
 for i in range(m):
     b.append(int(input()))
  
 c = []
 for i in range(n):
     s = 0
     for j in range(m)
           s += A[n][m] * b[m]

Submission status: Runtime Error

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

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

for i in range(m):
    b.append(int(input()))

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

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A. append([int(j) for j in input().split() ])

for i in ronge(m):
    b.append(int(input()))


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

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
????????A.append([int(j) for j in input().split()])

for i in range(m):
????????b.append(int(input()))

for i in range(n):
????????s = 0
????????for j in range(m):
????????????????s += A[i][j] * b[j]
????????print(s)

Submission status: Runtime Error

Solution code:
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
A.append([int(j) for j in input().split()])

for i in range(m):
b.append(int(input()))

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