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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = map(int,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:
l = input().split()
n = int(l[0])
m = int(l[1])

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

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

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

Submission status: Accepted

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

for i in range(n):
    tmp=0
    for j in range(m):
        tmp+=vector_a[i][j]*vector_b[j]
    print(tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, raw_input().split())
a, b = [], []
c = [0 for _ in range (n)]
for _ in range(n):
	a.append(map(int, raw_input().split()))
for _ in range(m):
	b.append(int(raw_input()))
for i in range(n):
	c[i] = 0
	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 = [], []
c = [0 for _ in range (n)]
for _ in range(n):
	a.append(map(int, raw_input().split()))
for _ in range(m):
	b.append(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:
data = list(map(int, list(input().split())))
row = data[0]
column = data[1]
matrix = [[0 for i in range(column)] for j in range(row)]
vector = [[0] for k in range(column)]
vector_multi = [[0] for l in range(row)]

for i in range(row):
    data_row = list(map(int, list(input().split())))
    for j in range(column):
        matrix[i][j] = data_row[j]

for i in range(column):
    vector[i] = int(input())

for i in range(row): 
    element = 0
    for j in range(column):
        element += matrix[i][j] * vector[j]
    vector_multi[i][0] = element

for i in vector_multi:
    print(i[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8
array = map(int, raw_input().split())
n = array[0]
m = array[1]
a = [[0 for i in range(m)] for j in range(n)]
b = [0 for i in range(m)]
answer = [0 for i in range(n)]
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):
    for j in range(m):
        answer[i] += a[i][j] * b[j]
for i in range(n):
    print answer[i]

Submission status: Accepted

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

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:
'''
1 1 1
2 2 2
1
2
3
とあったら、1*1+1*2+1*3
          2*1+2*2+2*3
みたいな感じ。
'''

from operator import add
from functools import reduce

#テスト値
n,m = map(int,input().split())
#a = [[1,1,1],[2,2,2]]
#b = [1,2,3]

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

b = [int(input()) for n in range(m)]
#print(b)

#ベクトル積の計算。
#まず行ごとの値を計算。
c = []
for n in range(n):
    c.append([a[n][m]*b[m] for m in range(m)])
    
#print(c)#ここまでOK。

d=[reduce(add,c[n]) for n in range(len(c))]



#print(d)

[print(d[i]) for i in range(len(d))]

Submission status: Accepted

Solution code:
n,m = map(int,raw_input().split())
for i in range(0,n):
    if i == 0:
        matrix = [map(int,raw_input().split())]
    else:
        matrix.append(map(int,raw_input().split()))
vec=[]
for j in range(0,m):
    vec.append(raw_input())
mul = []
for k in range(0,n):
    num_sum=0
    for l in range(0,m):
        num_sum += matrix[k][l] * int(vec[l])
    print num_sum

Submission status: Accepted

Solution code:
import sys

(row, column) = sys.stdin.readline().rstrip('\r\n').split(' ')
row = int(row)
column = int(column)

a = []
b = []
c = []

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

for ii in range(column):
  b.append(int(input().rstrip('\r\n')))

for ii in range(len(a)):
  work = 0
  for jj in range(len(a[ii])):
    work += a[ii][jj] * b[jj]
  c.append(work)

for cc in c:
  print(cc)

Submission status: Accepted

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

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 = [[0 for x in range(m)] for y in range(n)]
b = []
for i in range(n):
    retsu = [int(x) for x in input().split( )]
    a[i] = retsu
for j in range(m):
    b.append(int(input()))
answer = []
for i in range(n):
    value = 0
    for j in range(m):
        value += a[i][j]*b[j]
    answer.append(value)
for ans in answer:
    print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
mat = [map(int, input().split()) for i in range(a)]
vec = [int(input()) for i in range(b)]
for row in mat:
    print(sum([x*y for x, y in zip(row, vec)]))

Submission status: Accepted

Solution code:
#coding: utf-8

a, b = (int(i) for i in input().split())

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

for i in range(a):
    n[i] = input().split()

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

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

Submission status: Accepted

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

for j in range(m):
    v.append(int(input()))

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

n, m = map(int, sys.stdin.readline().split())
matrix_a = list()
matrix_b = list()

for i in range(n):
    matrix_a.append(list(map(int, sys.stdin.readline().split())))

for i in range(m):
    matrix_b.append(int(sys.stdin.readline()))

#print(matrix_a)
#print(matrix_b)

for i in range(n):
    product = 0
    for x in range(m):
        product += matrix_a[i][x]*matrix_b[x]
    print(product)

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)]
[print(sum([j*k for j,k in zip(a[i],b)])) for i in range(n)]

Submission status: Accepted

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

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

result = []
for line in mat:
    c = sum([line[i] * vec[i] for i in range(m)])
    result.append(c)

print("\n".join(map(str, result)))

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
#行列a、ベクトルb、行列積cの初期化
a = [0 for i in range(n)]
b = [0 for j in range(m)]
c = []
#a,bの読み込み
for i in range(n):
    a[i] = input().split()
    a[i] = [int(x) for x in a[i]]
for j in range(m):
    b[j] = int(input())
#行列積計算
temp = 0
for i in range(n):
    for j in range(m):
        temp += a[i][j]*b[j]
    c.append(temp)
    temp = 0
#結果の表示
for num in c:print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split(' '))
A = []
i = 0
while i < n:
    a = list(map(int, input().split(' ')))
    A.append(a)
    i += 1
x = []
j = 0
while j < m:
    x.append(int(input()))
    j += 1
ans = ''
p = 0
while p < n:
    q = 0
    a0 = 0
    while q < m:
        a0 += A[p][q] * x[q]
        q += 1
    ans += str(int(a0)) + '\n'
    p += 1
print(ans[:-1])

Submission status: Accepted

Solution code:
import sys

i,j = input().split()

matrixa = []

for _ in range(int(i)):
    matrixa += [[int(n) for n in sys.stdin.readline().split()]]

matrixb =[ int(num) for num in sys.stdin.readlines() ]

matrixc = [ 0 for _ in range(int(i))]

for n in range(int(i)):
    for a,b in zip(matrixa[n],matrixb):
        matrixc[n] += a*b
for c in matrixc:
    print(c)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
matrix = []
lines = []
c_ele = []

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

for j in range(m):
    lines.append(int(input()))

for k in range(n):
    sum = 0
    for l in range(m):
        sum += matrix[k][l] * lines[l]
    c_ele.append(sum)

for p in c_ele:
    print(p)

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)]
[print(sum([j*k for j,k in zip(a[i],b)])) for i in range(n)]

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)]
[print(sum([j*k for j,k in zip(a[i],b)]))for i in range(n)]

Submission status: Accepted

Solution code:
n,m=list(map(int,input().split(' ')))
am=[[0 for j in range(m)] for i in range(n)]
bm=[0 for l in range(m)]
cm=[0 for i in range(n)]
for i in range(n):
    am[i]=list(map(int,input().split(' ')))
for j in range(m):
    bm[j]=int(input())
for i in range(n):
    for j in range(m):
        cm[i]=cm[i]+am[i][j]*bm[j]
for i in range(n):
    print(cm[i])

Submission status: Accepted

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

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):
  print(sum([j * k for j, k in zip(a[i], b)]))

Submission status: Accepted

Solution code:
vec1 = []
vec2 = []

n, m = map(int, input().split())
for x in range(1, n+1):
    vec1.append(list(map(int, input().split())))

for y in range(m):
    vec2.append(int(input()))

for j in vec1:
    result = 0
    for w, z in zip(j, vec2):
        result += w * z
    print(result)

Submission status: Accepted

Solution code:
import sys

l = []
result = []
for i in sys.stdin:
    l.append(i)

for i in range(0,len(l)):
    l[i] = l[i].split()
    for j in range(0,len(l[i])):
        l[i][j] = int(l[i][j])

for i in range(1,l[0][0]+1):
    a = []
    for j in range(0,l[0][1]):
        a.append(l[i][j] * l[j+l[0][0]+1][0])
    result.append(sum(a))

for data in result:
    print(data)

Submission status: Accepted

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

for i in range(n):
    line = [int(i) for i in input().split()]
    A_line.append(line)
for i in range(m):
    row += [int(i) for i in input().split()]
for i in range(n):
    c=0
    for j in range(m):
        c += A_line[i][j]*row[j]
    print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m = tuple(int(i) for i in input().split())
A = [[int(j) for j in input().split()] for k in range(n)]
b = [int(input()) for p in range(m)]
R = [sum([A[p][q] * b[q] for q in range(m)]) for p in range(n)]

for r in R:
    print(str(r))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
行数, 列数 = map(int, input().split())

#行列の初期化
行列 = [[0 for _ in range(列数)] for __ in range(行数)]

#データをもとに行列を作成
for 現在行 in range(行数):
    行データ = list(map(int, input().split()))
    for 現在列 in range(列数):
        行列[現在行][現在列] = 行データ[現在列]

#ベクトルデータを取得
ベクトル = [0 for _ in range(列数)]
for 現在行 in range(列数):
    ベクトル[現在行] = int(input())

答え = []
#ベクトルを掛ける
for i in range(行数):
    c = 0
    for j in range(列数):
        c += 行列[i][j] * ベクトル[j]
        
    答え.append(c)

#表示
for i in range(len(答え)):
    print(答え[i])

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
A = []
B = []
for i in range(n):
	tmp = list(map(int,input().split()))
	A.append(tmp)
	tmp=[]
for i in range(m):
	num = int(input())
	B.append(num)
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=[input().split()for _ in[0]*n]
b=[input()for _ in[0]*m]
for a in A:print(sum(int(x)*int(y)for x,y in zip(a,b)))

Submission status: Accepted

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

Submission status: Accepted

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

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:
l=input().split()
n=int(l[0])
m=int(l[1])

#receive vecter a(n*m)
i=0
A=[]
while i<n:
    a=input().split()
    for p in a:
        A.append(int(p))
    i+=1

#receive vecter b(m*1)
I=0
B=[]
while I<m:
    b=int(input())
    B.append(b)
    I+=1

#Ci=ai1b1+ai2b2+...+aimbm
#C[i]=a[m*(i)+1]*b[1]+a[m*(i)+2]*b[2]+...a[m*(i)+m]*b[m]
q=0
C=[]
while q<n:
    Q=0
    cq=0
    while Q<m:
        cq+=A[m*q+Q]*B[Q]
        Q+=1
    C.append(cq)
    q+=1

for x in C:
    print(x)

Submission status: Accepted

Solution code:
size = [int(i) for i in input().split()]
matrix = [[0 for i in range(size[1])] for j in range(size[0])]
vector = [0 for i in range(size[1])]
for gyou in range(size[0]):
    x = [int(i) for i in input().split()]
    matrix[gyou] = x
for retsu in range(size[1]):
    x = int(input())
    vector[retsu] = x

for gyou in range(size[0]):
    print(sum(map(lambda val1, val2: val1 * val2, matrix[gyou], vector)))

Submission status: Accepted

Solution code:
N, M = map(int, raw_input().split())
A = [map(int, raw_input().split()) for _ in xrange(N)]
B = [int(raw_input()) for _ in xrange(M)]
     
for i in xrange(N):
    print sum(a*b for a, b in zip(A[i], B))

Submission status: Accepted

Solution code:
n, m = [int(_) for _ in input().split()]
matrix = []
for i in range(n):
    matrix.append([int(_) for _ in input().split()])
vector = []
for i in range(m):
    vector.append(int(input()))

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

Submission status: Accepted

Solution code:
N = [int(i) for i in input().split()]

result = [0 for _ in range(N[0])]
row = []
col = []
for num, info in enumerate(range(N[0]+N[1])):
    if num < N[0]:
        row.append([int(i) for i in input().split()])
    else:
        col.append(int(input()))

for num, r in enumerate(row):
    res = 0
    for i, j in zip(r, col):
        res += i * j
    result[num] = res

for i in result:
    print(str(i))

Submission status: Accepted

Solution code:
n, m = list(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):
    rst = 0
    for j in range(m):
        rst += a[i][j] * b[j]
    print(str(rst))

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

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

for row in A:
    product = 0
    for e_A, e_b in zip(row, b):
        product += e_A * e_b
    print(product)

Submission status: Accepted

Solution code:
# AOJ ITP1_6_D

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    n = a[0]; m = a[1] # nが行、mが列の数。
    M = []
    for i in range(n):
        data = numinput()
        list = []
        for j in range(m):
            list.append(data[j])
        M.append(list)
    b = []
    for j in range(m):
        b.append(int(input()))

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

if __name__ == "__main__":
    main()

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

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 line in A:
    for i, j in zip(line, b):
        c += i * j
    print(c)
    c = 0

Submission status: Accepted

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

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

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

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

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):
    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())
Li = [[] for y in range(n)]
Li2 = []
a = 0
for x in range(n):
    Li[x] += list(map(int, input().split()))
for x in range(m):
    Li2.append(int(input()))
for x in range(n):
    for y in range(m):
        a += Li[x][y]*Li2[y]
    print(a)
    a = 0

Submission status: Accepted

Solution code:

import sys

n, m = input().strip().split(" ")
n = int(n) ;m = int(m)

c = n

a = []
for line in sys.stdin :
    a.append(line)
    c -= 1
    if c == 0 :
        break

c = m

b = []
for line in sys.stdin :
    b.append(line)
    c -= 1
    if c == 0 :
        break

for i in range(0, len(a)) :
    a[i] = a[i].strip().split(" ")
    for j in range(0, len(a[i])) :
        a[i][j] = int(a[i][j])

for i in range(0, len(b)) :
    b[i] = int(b[i].strip())

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

Submission status: Accepted

Solution code:
# Matrix Vector Multiplication

matrixSize = [int(i) for i in input().rstrip().split()]
n = matrixSize[0]
m = matrixSize[1]

matrix = []
for i in range(n):
    array = [int(j) for j in input().rstrip().split()]
    matrix.append(array)
# print(matrix)

vector = [int(input()) for k in range(m)]
# print(vector)

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

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):
    csum = 0
    for k in range(m):
        csum = csum + b[k]*a[i][k]
    print('{}'.format(csum))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n,m = map(int,input().split())
gyo_A = []
vec_b = []
ans = ""

for i in range(n):
    temp = [int(x) for x in input().split()]
    gyo_A.append(temp)

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

for i in range(n):
    vec_c = 0
    for j in range(m):
        vec_c += gyo_A[i][j] * vec_b[j]
    
    print(vec_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)]

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

Submission status: Accepted

Solution code:
ll=[]
J=0
a,b=map(int,input().split())
for i in range(a):
    l=input().rstrip().split()
    l=list(map(int,l))
    ll+=l
    #print(ll)
for j in range(b):
    n=int(input())
    for i in range(a):
        ll[j]=ll[j]*n
        j=j+b
#print(ll)
for i in range(0,a*b,b):
    print(sum(ll[i:i+b]))

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

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

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

b = list()
for k 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=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):
    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:
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:
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()))
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 = []
b = []

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

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

Submission status: Accepted

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

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

        
B = [];
for k in range(0,m):
    b = int(input());
    B.append(b);

q = 0;
for j in range(0,n):
    x = 0;
    for i in range(0,m):
        x += A[q]*B[i];
        q += 1;
    print(x);

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

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)]
ans = [0 for _ in range(n)]
for i in range(n):
    for j in range(m):
        ans[i] += a[i][j]*b[j]
print("\n".join(map(str, ans)))

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=int(input())
    B.append(b)    
for l in A:
    a=0
    i=0
    for o in l:
        a+=o*B[i]
        i+=1
    print(a)

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())
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:
num_str = input().split()
n, m = [int(i) for i in num_str]
count = 0

Mat = []
Vec = []

for i in range(n):
    row = input().split()
    row_i = [int(i) for i in row]
    Mat.append(row_i)

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

for i in range(n):
    tmp_list = [x * y for (x, y) in zip(Mat[i], Vec)]
    print(sum(tmp_list))