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 for _ in range(m)] for _ in range(n)]
B = [0 for _ in range(m)]
for y in range(n):
    column = list(map(int, input().split()))
    for x in range(m):
        A[y][x] = column[x]

for x in range(m):
    B[x] = int(input())

for a in A:
    c = 0
    for i in range(m):
        c += a[i]*B[i]
    print(c)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list()
for i in range(n):
	a.append(list(map(int, input().split())))
b = list()
for i in range(m):
	b.append(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_str=input().split()
n_m=list(map(lambda i : int(i),n_m_str))
n,m=n_m[0],n_m[1]
a=[input() for i in range(n)]
A=[]
for i in a:
    A.append(i.split())
b=[input() for i in range(m)]
Ab=[]
for i in range(n):
    Ab.append(0)
for i in range(n):
    for j in range(m):
        Ab[i]+=int(A[i][j])*int(b[j])
for i in Ab:
    print(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 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:
readline = open(0).readline
N, M = map(int, readline().split())
A = [list(map(int, readline().split())) for i in range(N)]
B = [int(readline()) for i in range(M)]
print(*map((lambda Ai: sum(a*b for a, b in zip(Ai, B))), A), sep='\n')

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:
from sys import stdin

n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(n)]
b = [[int(stdin.readline().rstrip())] for _ in range(m)]
c = [[0] for _ in range(n)]
for i in range(n):
    for j in range(m):
    	c[i][0] += (a[i][j]*b[j][0])

for i in range(n):
    print(*c[i])

Submission status: Accepted

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

Solution code:
n, m = 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(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, 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:
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 zip(i, b):
        c += j * k
    print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = []
b = []

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

# with open('input_itp1_6_d_1.txt', mode='r', encoding='utf8') as f:
#     n, m = map(int, next(f).split())
#     try:
#         for i in range(n):
#                 A.append([int(i) for i in next(f).split()])
#         for i in range(m):
#             b.append(int(next(f)))
#     except StopIteration:
#         raise ValueError('入力データがおかしい')

c = []
for i in range(len(A)):
    tmp = 0
    for j in range(len(A[i])):
        tmp += A[i][j] * b[j]
    c.append(tmp)
for i in range(len(c)):
    print(c[i])

Submission status: Accepted

Solution code:
A = []
b = []

# 送信用の入力処理
n, m = map(int, input().split())
for i in range(n):
    A.append([int(i) for i in input().split()])
for i in range(m):
    b.append(int(input()))

# # テスト用にファイルから入力する処理
# with open('input_itp1_6_d_1.txt', mode='r', encoding='utf8') as f:
#     n, m = map(int, next(f).split())
#     try:
#         for i in range(n):
#                 A.append([int(i) for i in next(f).split()])
#         for i in range(m):
#             b.append(int(next(f)))
#     except StopIteration:
#         raise ValueError('入力データがおかしい')

c = []
for row in range(len(A)):
    tmp = 0
    for col in range(len(A[row])):
        tmp += A[row][col] * b[col]
    c.append(tmp)
for i in range(len(c)):
    print(c[i])

Submission status: Accepted

Solution code:
A = []
b = []

# 送信用の入力処理
n, m = map(int, input().split())
for i in range(n):
    A.append([int(i) for i in input().split()])
for i in range(m):
    b.append(int(input()))

# # テスト用にファイルから入力する処理
# with open('input_itp1_6_d_1.txt', mode='r', encoding='utf8') as f:
#     n, m = map(int, next(f).split())
#     try:
#         for i in range(n):
#                 A.append([int(i) for i in next(f).split()])
#         for i in range(m):
#             b.append(int(next(f)))
#     except StopIteration:
#         raise ValueError('入力データがおかしい')

for row in range(len(A)):
    tmp = 0
    for col in range(len(A[row])):
        tmp += A[row][col] * b[col]
    print(tmp)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
#データ入力
rowNum, columnNum = map(int, input().split())
inMat = [[0] * columnNum for i in range(rowNum)]
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: Accepted

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

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):
    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())
tbl=[[] for i in range(n)]
for i in range(n):
    tbl[i] = list(map(int,input().split()))
tbl2=[[]*1 for i in range(m)]
for i in range(m):
    tbl2[i] = int(input())
for k in range(n):
    x=0
    for l in range(m):
        x +=tbl[k][l]*tbl2[l]
    print("%d"%(x))

Submission status: Accepted

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]=int(input())
for i in range(n):
    x=0
    for j in range(m):
        x=x+lst[i][j]*lst2[j]
    print("%d"%(x))

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

for a in A:
    multi_list = [x * y for (x, y) in zip(a, b)]  # 書き方:リストの要素同士の積
    arg = 0
    for k in multi_list:
        arg += k
    print(arg)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
m,n=map(int,input().split())
a=[]
b=[]
for _ in range(m):
    a.append(map(int, input().split()))
for _ in range(n):
    b.append(int(input()))
for ai in a:
    sum = 0
    for index, mi in enumerate(ai):
        sum += mi*b[index]
    print(sum)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
a = list()
for i in range(n) :   #1行ずつn行まで読み込みlistに格納
  a.append(list(map(int, input().split())))
b = list()
for j 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(x) for x in input().split())

table = [[0] for i in range(n)]
vector = [0 for j in range(m)]

# input table
i = 0
while i < n:
  table[i] = list(int(x) for x in input().split())
  i += 1

# input vector
i = 0
while i < m:
  vector[i] = int(input())
  i += 1

# calc C
for i in table:
  sum = 0
  for idx,j in enumerate(i):
    sum += j * vector[idx]
  print (sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Solution code:
x,y = map(int,input().split(" "))

line_1 = [[0 for _ in range(y)] for _ in range(x)]
for i in range(x):
	line_1[i] = list(map(int,input().split(" ")))

line_2 = [int(input()) for _ in range(y) ]

[print(sum([line_1[k][m] * line_2[m] for m in range(y)])) for k in range(x)]

Submission status: Accepted

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 range(n):
        n_l[o][x] *= p
for i in n_l:
    print(sum(i))

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:
#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):
  D=list(map(int,input().split()))
  for j in range(m):
    A[i][j]=D[j]
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: Accepted

Solution code:
def my_dot(lhs, rhs):
    return [sum(a[i][j] * b[j][0] for j in range(len(rhs))) for i in range(len(lhs))]


if __name__ == '__main__':
    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()])

    c = my_dot(a, b)

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

Submission status: Accepted

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

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

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

n =  [[] for i in range(N)]

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

m = [ 0 for k in range(M)]

for k in range(M):
    m[k] = int(input())

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

Submission status: Accepted

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

m2 = m

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

b=[]
while m2 > 0:
  b_data = int(input())
  b.append(b_data)
  m2 = m2-1

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

Submission status: Accepted

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

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

b = [0]*M
for i in range(M):
  b[i]= int(input())

c = [0]*N
for i in range(N):
  for aj, bj in zip(a[i], b):
    c[i] += aj * bj
    
for ci in c:
  print(ci)

Submission status: Accepted

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

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

for i in range(n):
    print(sum([x * y for (x, y) in zip(A[i], bt)]))

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

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

Submission status: Accepted

Solution code:
def az18():
    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)]
    for i in range(n):
        a[i] = map(int,raw_input().split())
    for i in range(m):
        b[i] = input()
    for i in range(n):
        t = map(lambda (x,y): x*y, zip(a[i],b))
        print sum(t)
        
    
    
az18()

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:
[r,c] = raw_input().split()
r = int(r)
c = int(c)
M = []
V = []
for y in range(0,r):
    s = raw_input().split()
    k = []
    for x in range(0,c):
        v = int(s[x])
        k.append(v)
    M.append(k)
    
for y in range(0,c):
    s = int(raw_input())
    V.append(s)
    

for y in range(0,r):
    ss = 0
    for x in range(0,c):
        ss = ss + M[y][x] * V[x]
    print ss

Submission status: Accepted

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

Submission status: Accepted

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

for obj in matrix:
    print(sum(obj[i] * b[i] for i in range(m)))

Submission status: Accepted

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

a = list()
b = list()

count = nm[0]
while count > 0:
    a += list(map(lambda x:int(x), input().split(" ")))
    count -= 1

count = nm[1]
while count > 0:
    b += {int(input())}
    count -= 1

for m in range(nm[0]):
    c = 0
    for k in range(nm[1]):
        c += a[k+m*nm[1]]*b[k]
    print(c)

Submission status: Accepted

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

A = []
for i in xrange(0,n):
	line = map(int, raw_input().split())
	A.append(line)

b = []
for j in xrange(0,m):
	temp = int(raw_input())
	b.append(temp)

result = []
for x in xrange(0,n):
	temp = 0
	for y in xrange(0,m):
		temp = temp + A[x][y] * b[y]
	result.append(temp)

for k in xrange(0,n):
	print result[k]

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

Submission status: Accepted

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

for a in gyoretu:
    i = 0
    for b in range(len(bekutoru)):
        i = i + (a[b] * bekutoru[b])
    print i

Submission status: Accepted

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

for i in range(n):
    print(sum([array[i][j] * vec[j] for j in range(m)]))

Submission status: Accepted

Solution code:
def f():return map(int,raw_input().split())
n,m = f()
A = [f() for _ in [0]*n]
B = [input() for _ in [0]*m]
for i in range(n):
  print sum([A[i][j]*B[j] for j in range(m)])

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n,m = tuple([int(x) for x in raw_input().split(" ")])

A = []
for i in range(n):
    A.append([int(x) for x in raw_input().split(" ")])

v=[]
for i in range(m):
    v.append(int(raw_input()))

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

Submission status: Accepted

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

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

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

c = [0] * n    
for i in range(n):
    for aj, bj in zip(a[i], b):
        c[i] += aj * bj
    
for ci in c:
    print(ci)

Submission status: Accepted

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

matrix = []
vector = []
product = [0 for d in range(n)]

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

for mc in range(m):
    vector.append(int(input()))

for nc in range(n):
    for mc in range(m):
        product[nc] += matrix[nc][mc] * vector[mc]

[print(product[nc]) for nc in range(n)]

Submission status: Accepted

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

matrix = []
vector = []
product = [0 for d in range(n)]

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

for mc in range(m):
    vector.append(int(input()))

for nc in range(n):
    for mc in range(m):
        product[nc] += matrix[nc][mc] * vector[mc]

[print(product[nc]) for nc in range(n)]

Submission status: Accepted

Solution code:
n, m = map(int, raw_input().split())
A = {}
for i in range(n):
    temp = map(int, raw_input().split())
    for j in range(m):
        A[(i,j)] = temp[j]
b = {}
for j in range(m):
    b[(j)] = input()
c = {}
for i in range(n):
    c[(i)] = 0
    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:
import sys
(n, m) = [int(i) for i in sys.stdin.readline().split()]
matrix = []
for i in range(0, n):
    a_i = [int(j) for j in sys.stdin.readline().split()]
    matrix.append(a_i)
vector = []
for i in range(0, m):
    b_i = int(sys.stdin.readline())
    vector.append(b_i)

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

Submission status: Accepted

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

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

Solution code:
n,m = map(int,raw_input().split())
mat = []
for k in range(n):
    mat.append(map(int,raw_input().split()))
b = []
for j in range(m):
    b.append(int(raw_input()))

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n, m = [int(i) for i in input().split()]
    A = [[int(i) for i in input().split()] for j in range(n)]
    b = [int(input()) for i in range(m)]
    c = [sum(map(lambda x,y: x*y, A[i], b)) for i in range(n)]
    print('\n'.join([str(i) for i in c]))

Submission status: Accepted

Solution code:
#coding:utf-8
#1_6_D 2015.4.5
n,m = map(int,input().split())
matrix = [list(map(int,input().split())) for i in range(n)]
vector = [int(input()) for i in range(m)]
for j in range(n):
    sum = 0
    for i in range(m):
        sum += matrix[j][i] * vector[i]
    print(sum)

Submission status: Accepted

Solution code:
#coding:utf-8
#1_6_D 2015.4.5
n,m = map(int,input().split())
matrix = [list(map(int,input().split())) for i in range(n)]
vector = [int(input()) for i in range(m)]
for i in range(n):
    print(sum([matrix[i][j] * vector[j] for j in range(m)]))

Submission status: Accepted

Solution code:
import sys
n,m=map(int,input().split())
A=[0]*n
B=[0]*m
C=[0]*n
for i in range(0,n):
	A[i]=list(map(int, input().split()))
	
for i in range(0,m):
	B[i]=int(input())
for i in range(0,n):
	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())
matA=[list(map(int,input().split())) for i in range(n)]
matB=[int(input()) for i in range(m)]
for obj in matA:
	print(sum(obj[i] * matB[i] for i in range(m)))

Submission status: Accepted

Solution code:
import sys

n, m = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
a = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( n ) ]
b = [ [ int( val ) for val in sys.stdin.readline().split( " " ) ] for row in range( m ) ]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":

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

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

    for i in xrange(n):
        A[i*m:i*m+m] = map( int, raw_input().split())

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

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

    for i in xrange(n):
        print c[i]

Submission status: Accepted

Solution code:
# coding=utf-8

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

Solution code:
# coding=utf-8

n, m = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(n)]
b = [input() for _ in xrange(m)]
Ab = [sum([A[i][j] * b[j] for j in xrange(m)]) for i in xrange(n)]
for x in Ab:
    print x

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
matrix = []
for _ in range(n):
    matrix.append(list(map(int, input().split())))
column = [int(input()) for _ in range(m)]
for i in range(n):
    print(sum(a * b for a, b in zip(matrix[i], column)))

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

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