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) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
   
for r 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: Accepted

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

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):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

Submission status: Accepted

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

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

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):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
rc = [list(map(int,input().split())) for i in range(n)]
vector = [int(input()) for i in range(m)]
[print(sum([j*k for j,k in zip(rc[i],vector)])) for i in range(n)]

Submission status: Accepted

Solution code:
input = raw_input().split(" ")
n = int(input[0])
m = int(input[1])

i = 0
vec_a = []
while i < n:
  line = map(int, raw_input().split(" "))
  vec_a.append(line)
  i += 1
i = 0
vec_b = []
while i < m:
  line = int(raw_input())
  vec_b.append(line)
  i += 1
# print vec_a
# print vec_b

vec_c = []
for i in vec_a:
  sum = 0
  for j in xrange(m):
    sum += i[j] * vec_b[j]
  vec_c.append(sum)

for i in vec_c:
  print i

Submission status: Accepted

Solution code:
n,m=map(int,raw_input().split())
A,B=[],[]
c=0
for i in xrange(n):
	A.append(map(int,raw_input().split()))
for i in xrange(m):
	B.append(int(raw_input()))
for i in xrange(n):
	for j in xrange(m):
		c+=A[i][j]*B[j]
	print c
	c=0

Submission status: Accepted

Solution code:
n,m=map(int,raw_input().split())
A,B=[],[]
c=0
A=[map(int,raw_input().split()) for _ in [0]*n]
B=[int(raw_input()) for _ in [0]*m]
for i in xrange(n):
	print sum([A[i][j]*B[j] for j in xrange(m)])

Submission status: Accepted

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

bigArray = []
smallArray = []
for i in range ( n ) :
    bigArray.append( list(map(int, input().split())) )
for i in range ( m ) :
    smallArray.append( int(input()) )

for i in range ( n ) :
    answerPerRow = 0
    for j in range ( m ) :
        answerPerRow += bigArray[ i ][ j ] * smallArray[ j ]
    print( answerPerRow )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, raw_input().split())
matrix = []
array = []
for n in range(N):
    tmp = map(int, raw_input().split())
    if len(tmp) > M:
        print 'error'
    matrix.append(tmp)

for m in range(M):
    tmp = input()
    array.append(tmp)

for n in range(N):
    multi = 0
    for m in range(M):
        multi += matrix[n][m] * array[m]
    print multi

Submission status: Accepted

Solution code:
N, M = map(int, raw_input().split())
matrix = [map(int, raw_input().split()) for n in range(N)]
array = [input() for m in range(M)]

for n in range(N):
    c = 0
    for m in range(M):
        c += matrix[n][m] * array[m]
    print c

Submission status: Accepted

Solution code:
nm = list(map(int, input().split(" ")))
n = nm[0]
m = nm[1]

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

vector_b = [int(input()) for i in range(m)]

for i in range(n):
    c_i = sum([matrix_A[i][j] * vector_b[j] for j in range(m)])
    print(c_i)

Submission status: Accepted

Solution code:
import sys

n,m=map(int,raw_input().split())
list1 = [[0 for i in range(m)]for i in range(n)]
list2 = [[0 for i in range(1)]for i in range(m)]
list3 = [[0 for i in range(1)]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(1):
		for k in range(m):
			list3[i][j] += list1[i][k] * list2[k][j]
for i in range(n):
	for j in range(1):
			print'%d' %list3[i][j]

Submission status: Accepted

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

a = []
b = []

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

for j in range(0, m):
    b.append(int(input()))

c = []

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m = map(int,raw_input().split())
matrix = [[0 for x in xrange(m)] for y in xrange(n)]
vector = [0 for x in xrange(m)]
for x in xrange(n):
    matrix[x] = map(int,raw_input().split())
for x in xrange(m):
    vector[x] = input()
for x in xrange(n):
    ans = 0
    for y in xrange(m):
        ans += matrix[x][y]*vector[y]
    print ans

Submission status: Accepted

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

for i in range(n):
  A+=[map(int, raw_input().split())]
for j in range(m):
  b+=[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:
n,m = map(int,input().split())
a = []
b = []
c = []
for i in range(n):
  a.append([int(j) for j in input().split()])
for k in range(m):
  b.append(int(input()))
for x in range(n):
  z = 0
  for y in range(m):
    z += a[x][y] * b[y]
  c.append(z)
for i in c:
  print(i)

Submission status: Accepted

Solution code:
input_line = raw_input().split()
n = int(input_line[0])
m = int(input_line[1])
a = []
b = []
for i in range(0,n):
    line = raw_input().split()
    a.append([])
    for c in line:
        a[i].append(int(c))
for i in range(0,m):
    line = int(raw_input())
    b.append(line)
for i in range(0,n):
    out_sum = 0
    for j in range(0,m):
        out_sum += a[i][j]*b[j]
    print out_sum

Submission status: Accepted

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

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


for row in range(n):
    p = 0
    for i, j in zip(A[row], b):
        p += i * j
    print(p)

Submission status: Accepted

Solution code:
n, m = map(int, raw_input().split(" "))
a = [[0 for j in range(m)] for i in range(n)]
b = [0 for j in range(m)]
for i in range(n):
    a[i] = map(int, raw_input().split(" "))
for j in range(m):
    b[j] = 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:
x=[]
y=[]
n,m=map(int,input().split())
for i in range(n):
    x.append([])
for i in range(n):
    y=list(map(int,input().split()))
    x[i].extend(y)

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

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

Submission status: Accepted

Solution code:
# coding:utf-8

# ??\???
n,m = map(int, input().split())
matrix = []
for i in range(n):
    matrix.append([0] * m)

for i in range(n):
    col = input().split()
    for j in range(m):
        matrix[i][j] = int(col[j])

vector = [0] * m
for j in range(m):
    vector[j] = int(input())

for i in range(n):
    row_sum = 0
    for j in range(m):
        row_sum += matrix[i][j] * vector[j]
    print(row_sum)

Submission status: Accepted

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

A = [[0 for w in range(m)] for h in range(n)]
B = [0 for h in range(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: Accepted

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

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

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

for row in A:
    s = 0
    for i, elm in enumerate(row):
        s += (elm*b[i])
    print(s)

Submission status: Accepted

Solution code:
from operator import mul

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

for ai in a:
    print(sum(map(mul, ai, b)))

Submission status: Accepted

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

for i in range(n):
    matrix.append([int(x) for x in input().split()])
for i in range(m):
    vector.append(int(input()))

for i in range(n):
    sum = 0
    for j in range(m):
        sum += matrix[i][j] * vector[j]
    print(sum)

Submission status: Accepted

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

A = [[0 for j in xrange(m)] for i in xrange(n)]

B = [0 for i in xrange(m)]

for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
        A[i][j] = tmp[j]
        
for i in xrange(m):
    B[i] = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b  = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(a)]
B = [input() for _ in xrange(b)]
C = [sum([A[i][j] * B[j] for j in xrange(b)]) for i in xrange(a)]
for x in C:
    print x

Submission status: Accepted

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

a = [[0 for i in xrange(m)] for j in xrange(n)]
b = [0 for i in xrange(m)]

for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
        a[i][j] = tmp[j]
for k in xrange(m):
    b[k] = int(raw_input())

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

Submission status: Accepted

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

A = [[0 for q in range(m)] for w in range(n)]
B = [0 for e in range(m)]

for i in range(n):
	A[i] = list(map(int, input().split()))
for j in range(m):
	B[j] = 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:
n, m = map( int , raw_input().split() )
A = []
b = []
 
for i in range(n):
  A += [ map( int , raw_input().split() ) ]
for j in range(m):
  b += [ 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:

n, m = map(int, raw_input().split())
 
a = [[0 for i in xrange(m)] for j in xrange(n)]
b = [0 for i in xrange(m)]
 
for i in xrange(n):
    tmp = map(int, raw_input().split())
    for j in xrange(m):
       a[i][j] = tmp[j]
for k in xrange(m):
    b[k] = int(raw_input())
 
for i in xrange(n):
    ans = 0
    for j in xrange(m):
        ans += a[i][j]*b[j]
    print ans

Submission status: Accepted

Solution code:
n, m = map(int, raw_input().split());
i = 0
ar = [0] * n
vc = [0] * m
while i < n:
    ar[i] = map(int, raw_input().split());
    i += 1
i = 0
while i < m:
    vc[i] = input();
    i += 1
for el in ar:
    ans = 0
    for el2, el3 in zip(vc, el):
        ans += el2 * el3
    print ans

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, raw_input().split())

A = [[0 for j in range(M)]for i in range(N)]
B = [0 for j in range(M)]
C = [0 for i in range(N)]

# Input
for i in range(N):
    Ai = map(int, raw_input().split())
    for j in range(M):
        A[i][j] = Ai[j]

for j in range(M):
    B[j] = input()

# Calc
for i in range(N):
    for j in range(M):
        C[i] = C[i] + A[i][j]*B[j]

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

Submission status: Accepted

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

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

for i in range(n):
    A[i]=map(int, raw_input().split())
for j in range(m):
    b[j]=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:
n, m = map(int, raw_input().split())
A = [None] * n
for i in xrange(n):
    A[i] = map(int, raw_input().split())
b = [None] * m
for j in xrange(m):
    b[j] = input()

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

Submission status: Accepted

Solution code:
n, m = map(int, raw_input().split(" "))
a = [[0 for j in range(m)] for i in range(n)]
b = [0 for j in range(m)]
for i in range(n):
    a[i] = map(int, raw_input().split(" "))
for j in range(m):
    b[j] = 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,raw_input().split())
a = []
b = []

for i in range(n):
    a.append(map(int, raw_input().split()))
for i in range(m):
    b.append(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,raw_input().split())
a = [[0 for i in range (m)]for j in range(n)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]

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

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

Submission status: Accepted

Solution code:
n,m = 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(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,raw_input().split())
a = []
b = []
 
for i in range(n):
  a.append(map(int, raw_input().split()))
for i in range(m):
  b.append(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, raw_input().split())
a = []
b = []
c = [0 for i in range(n)]
for i in range(n):
  a.append(map(int, raw_input().split()))
for i in range(m):
  b.append(input())
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:
row , col = [int(x) for x in input().split()]
A = [0] * row

for i in range(row):
    A[i] = [int(x) for x in input().split()]
B = []
for i in range(col):
    B.append(int(input()))

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

Submission status: Accepted

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

Matrix = [[0 for j in range(m)]for i in range(n)]
Vector = [0 for i in range(m)]
Ans = [0 for i in range(n)]

for i in range(n):
    M_element = map(int, raw_input().split())
    for j in range(m):
        Matrix[i][j] = M_element[j]

for i in range(m):
    Vector[i] = int(raw_input())

for i in range(n):
    for j in range(m):
        Ans[i] += Matrix[i][j] * Vector[j] 
for i in range(n):
    print Ans[i]

Submission status: Accepted

Solution code:

m = map(int, raw_input().split())
a = [map(int, raw_input().split()) for i in xrange(m[0])]
b = [int(raw_input()) for i in xrange(m[1])]
for i in xrange(m[0]):
    print sum(a[i][j] * b[j] for j in xrange(m[1]))

Submission status: Accepted

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

Submission status: Accepted

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

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

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


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

Submission status: Accepted

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

a = []
b = [0]*m
for i in xrange(n):
    x = map(int,raw_input().split(" "))
    a.append(x)

for i in xrange(m):
    b[i] = input()

result = [0]*n

for i in xrange(n):
    for j in xrange(m):
        result[i] += a[i][j]*b[j]

    print result[i]

Submission status: Accepted

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

mat = {}
vec = {}

n, m = 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):
        mat[(i, j)] = list[j-1]

for i in range(1, m+1):
    vec[i] = input()

for i in range(1, n+1):
    c = 0
    for j in range(1, m+1):
        c += mat[(i, j)]*vec[j]
    print c

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = []
B = []
for line in range(n):
    A.append(list(map(int, input().split())))
for line in range(m):
    B.append(int(input()))
#print(A,B)

ret = []
for i in range(n):
    ret.append(sum(A[i][j] * B[j] for j in range(m)))
print('\n'.join(map(str, ret)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,raw_input().split())
a = [map(int,raw_input().split()) for _ in range(n)]
b = [input() for _ in range(m)]
for vec in a:
    sum=0
    for i in range(len(vec)):
        sum = sum + (vec[i] * b[i])
    print sum

Submission status: Accepted

Solution code:
a,b = map(int, raw_input().split())
num1, num2, ans = [], [], 0

for i in xrange(a):
    num1.append(map(int,raw_input().split()))
for i in xrange(b):
    num2.append(input())
for i in xrange(a):
    for j in xrange(b):
        ans += num1[i][j]*num2[j]
    print ans
    ans = 0

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 ni in range(n):
    ans = 0
    for mi in range(m):
        ans += A[ni][mi] * b[mi]
    print(ans)

Submission status: Accepted

Solution code:
matrix = []
vector = []

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

for i in xrange(n):
	matrix.append(map(int, raw_input().split()))

for i in xrange(m):
	vector.append(input())

for i in xrange(n):
	ans = 0
	for j in xrange(m):
		ans += matrix[i][j] * vector[j]
	print ans

Submission status: Accepted

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

Solution code:
n,m=map(int,raw_input().split())
a=[]
b=[]
c=0

for i in range(n):
	a.append(map(int,raw_input().split()))
		
for i in range(m):
	b.append(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:
n, m = list(map(int, input().split()))
A = [[0 for w in range(m)] for h in range(n)]
B = [0 for h in range(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: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

n, m = map(int, raw_input().split())
A = []
b = []

for i in xrange(n) :
    A.append(map(int, raw_input().split()))

for i in xrange(m) :
    b.append(input())

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

Submission status: Accepted

Solution code:
A=map(int,raw_input().split(" "))
vec=A[0]
col=A[1]

def zero(n):
	zerolist=list()
	for i in range(n):
		zerolist+=[0]
	return(zerolist)
A=list()
for i in range(vec):
	A+=[zero(col)]



for i in range(vec):
	k=map(int,raw_input().split(" "))
	for j in range(col):
		A[i][j]=k[j]

#ok

v=zero(col)

for i in range(col):
	v[i]=int(raw_input())

k=0
for i in range(vec):
	for j in range(col):
		k+=A[i][j]*v[j]
	print k
	k=0

Submission status: Accepted

Solution code:
ichi = input().split()
n = int(ichi[0])
m = int(ichi[1])
a = [[0 for j in range(m)] for i in range(n)]
for i in range(n):
    input_a = input().split()
    for j in range(m):
       a[i][j] = int(input_a[j])
b = []
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: Accepted

Solution code:
# -*- coding: utf-8 -*-
A = []
B = []
n,m = [int(i) for i in input().split(' ')]

for i in range(n):
    A.append([int(j) for j in input().split(' ')])
for j in range(m):
    B.append(int(input()))
#print(A)
#print(B)
c =0
for i in range(n):
    for j in range(m):
        c +=A[i][j] * B[j]
    print(c) 
    c =0

Submission status: Accepted

Solution code:
col,row = map(int,input().split())
matrix = []
vector = []
for _ in range(col):
	matrix.append([int(j) for j in input().split()])

for _ in range(row):
	vector.append(int(input()))

for i in range(col):
	ans = 0
	for x,y in zip(matrix[i],vector):
		ans += x * y
	print(ans)

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 = []

for x in range(n):
    ci = 0
    for y in range(m):
        ci += A[x][y] * b[y]
    c.append(ci)

print(*[ci for ci in c], sep = "\n")

Submission status: Accepted

Solution code:
nm=list(map(int,input().split()))
a=[[0 for x in range(nm[1])]for x in range(nm[0])]
b=[0 for x in range(nm[1])]
for x in range(nm[0]):
    code=list(map(int,input().split()))
    for y in range(nm[1]):
        a[x][y]=code[y]
for x in range(nm[1]):
    b[x] = int(input())

for x in range(nm[0]):
    result=0
    for y in range(nm[1]):
        result+=a[x][y]*b[y]
    print(result)

Submission status: Accepted

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

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

b = [0 for j in range(m)]
for j in range(m):
    b[j] = 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]
    print(c[i])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
	combined = [a * b for (a, b) in zip(a_matrix[i], b_matrix)]
	result = 0
	for x in combined:
		result += x
	print(result)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
mat = list()
vec = list()
ans = [0 for _ in range(n)]
for _ in range(n):
    mat.append(list(map(int,input().split())))
for _ in range(m):
    vec.append(int(input()))

for i in range(n):
    for j in range(m):
        ans[i] += mat[i][j]*vec[j]

for k in ans :
    print(k)

Submission status: Accepted

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

Submission status: Accepted

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)]
c = [0]*m

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

Submission status: Accepted

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

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

vec = []
for i in range(m):
	vec.append(int(input()))

for i in range(n):
	e = 0
	for j in range(m):
		e += mat[i][j] * vec[j]
	print(e)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(n):
    a.append([int(s) for s in input().split()])
for j in range(m):
    b.append([int(input())])

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
x, y = [int(i) for i in input().split()]
date = [[int(i) for i in input().split()]for i in range(1,x+1)]
date2 =[int(input())for i in range(1,y+1)]
date3 =[]
for a in range(0,x):
    for b in range(0,y,):
        date3 += [date2[b]*date[a][b]]
for d in range(0,len(date3),y):
    print(sum(date3[d:d+y]))

Submission status: Accepted

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

matrix = []
for ni in range(n):
    matrix.append([int(a) for a in input().split()])

vector = []
for mi in range(m):
    vector.append(int(input()))

b = []
for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)