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 i in range(N)]
B=[0 for i 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 row in range(N):
  tmp=0
  for col in range(M):
    tmp += A[row][col]*B[col]
  print("{:d}".format(tmp))

Submission status: Accepted

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

matrix = [None] * N
vector = [0] * M

for i in range(N):
    matrix[i] = [int(c) for c in input().split()]
for i in range(M):
    vector[i] = int(input())

ans = [sum([a * b for a, b in zip(matrix[i], vector)]) for i in range(N)]

for i in ans:
    print(i)

Submission status: Accepted

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

for i in range(n):
    a = [int(e) for e in input().split()]
    A.append(a)
    
for j in range(m):
    b = int(input())
    B.append(b)
    
for x in range(n):
    D = 0
    for y in range(m):
        C = A[x][y] * B[y]
        D += C
    print(D)

Submission status: Accepted

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

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 = 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 = 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 = map(int,input().split())

Matrix_A = [[] for i in range(n)]
# print("{}".format(Matrix_A))
for i in range(n):
    Matrix_A[i] = list(map(int,input().split()))

Matrix_B = [0 for i in range(m)]
# print(Matrix_B)

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

result = [[0 for i in range(1)]for i in range(n)]

for i in range(n):
    tmp = 0
    for j in range(m):
        tmp += Matrix_A[i][j] * Matrix_B[j]
    result[i][0] = tmp
for i in range(n):
    print(result[i][0])

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	n,m = map(int,input().split())
	a = []
	b = []
	c = []
	for i in range(n):
		a.append([int(s) for s in input().split()])
		c.append(0)
	for i in range(m):
		b.append(int(input()))
	
	for i in range(n):
		ans = 0
		for k in range(m):
			ans = ans + a[i][k]*b[k]
		c[i] = ans

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# input vector
vectorb=[]
for _ in range(m):
    vectorb.append(int(input()))

# initialize C
C = [[0 for i in range(1)] for i in range(n)]

# calculate
for n_tmp in range(n):
    for m_tmp in range(m):
        C[n_tmp][0] += matrixA[n_tmp][m_tmp] * vectorb[m_tmp]

# output
for j in range(n):
    print(C[j][0])

Submission status: Accepted

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

for i in range(n):
    print(sum([ma * ve for ma, ve in zip(matrix[i], vector)]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
A=[[] for j in range(n)]
b=[[0]*1 for i 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 row in range(n):
    tmp=0
    for col in range(m):
        tmp +=A[row][col]*b[col]
    print("%d"%(tmp))

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 = 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(x*y for x,y in zip(ai, b)))

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 k in range(m):
    x = int(input())
    b.append(x)

for j in A:
    ans = []
    for k in range(m):
        ans.append(j[k]*b[k])
    print(sum(ans))

Submission status: Accepted

Solution code:
nums = list(map(int, input().split()))
matrix0, matrix1 = [], []
for n in range(nums[0]):
    matrix0.append(list(map(int, input().split())))    
for m in range(nums[1]):
    matrix1.append(int(input()))
for n in range(nums[0]):
    v = 0
    for m in range(nums[1]):
        v += matrix0[n][m] * matrix1[m]
    print(v)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

B = [[0 for i in range(n)]]
for i in range(n):
    b = int(input())
    B[0][i] = b


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

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 = [[0]*1 for i in range(M)]
 
for i in range(M):
    B[i] = int(input())

for r in range(N):
    t = 0
    for c in range(M):
        t += A[r][c]*B[c]
    print("%d"%(t))

Submission status: Accepted

Solution code:
x, y = map(int,input().split())
A = [[0 for i in range(y)]for i in range(x)]
B = [0 for i in range(y)]

for i in range(x):
    a = list(map(int,input().split()))
    A[i] = a
        
for i in range(y):
    b = int(input())
    B[i] = b
   
ans = [0]*x
for i in range(x):
    for j in range(y):
        ans[i] += A[i][j] * B[j]
for ansi in ans:
    print(ansi)

Submission status: Accepted

Solution code:
N,M = map(int, input().split())
'''
table = [0 for i in range(N)]

for loop in range(gyou):
    a = list(map(int, input().split()))
    for loop2 in range(retu):
        table[loop][loop2] = a[loop2]
sum = [0,0,0]
for one in range(retu):
    b = int(input())
    for two in range(gyou):
        sum[two] = sum[two] + table[two][one] * b

for three in range(gyou):
    print(sum[three])

'''

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

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

B = [[0]*1 for i in range(M)]

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


for row in range(N):
    tmp = 0
    for col in range(M):
        tmp += A[row][col]*B[col]
    print("%d"%(tmp))

Submission status: Accepted

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

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

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

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

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

Submission status: Accepted

Solution code:
# ITP1_6_D
# ベクトルと行列の積

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

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

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

Submission status: Accepted

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

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

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

#calculate
for row in range(n):
    ans = 0
    for col in range(m):
        ans += matrix[row][col] * vector[col]
    print(ans)

Submission status: Accepted

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

vector1 = []
vector2 = []


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

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

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

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

Submission status: Accepted

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

mat = []
for n in range(N):
    buff = input()
    mat.append([int(x) for x in buff.split()])

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

for n in range(N):
    ans = 0
    for m in range(M):
        ans += mat[n][m]*vec[m]
    print(ans)

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 = [[0]*1 for i in range(M)]
 
for i in range(M):
    B[i] = int(input())
 
 
for row in range(N):
    tmp = 0
    for col in range(M):
        tmp += A[row][col]*B[col]
    print("%d"%(tmp))

Submission status: Accepted

Solution code:
init=list(map(int,input().split()))
nm=[[0 for i in range(init[1])] for j in range(init[0])]
m1=[0 for i in range(init[1])]
res=[0 for i in range(init[0])]

for i in range(init[0]):
    row=list(map(int,input().split())) 
    for j in range(init[1]):
        nm[i][j]=row[j]

for i in range(init[1]):
    m1[i]=int(input())


#solve
for i in range(init[0]):
    sum=0
    for j in range(init[1]):
        sum+=nm[i][j]*m1[j]
    res[i]=sum


for i in range(init[0]):
    print(res[i])

Submission status: Accepted

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

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

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

B = [0 for i in range(n)]

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

total = [0 for i in range(m)]

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

for i in range(m):
  print(total[i])

Submission status: Accepted

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

for i in range(n):
    a.append(input().split())

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

s=0

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

Submission status: Accepted

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

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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

for row in range(n):
    a.append(list(map(int, input().split(' '))))
    
for ind in range(m):
    b.append(int(input()))

for row in range(n):
    ans = 0
    for col in range(m):
        ans += a[row][col] * b[col]
    print(ans)

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
g = []
b = []
ansList = []
s = []
o = []
for _ in range(n):
    g.append(list(map(int, input().split())))

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

for i in range(n):
    for j in range(m):
        o.append( g[i][j]*b[j])
    ansList.append(sum(o))
    del o[:]
for ans in ansList:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m = (int(i) for i in input().split())
l = 1
a = [input().split()for i in range(n)]
b = [input().split() for i in range(m)]
al = [[0 for i in range(l)]for j in range(n)]
for i in range(n):
    for j in range(m):
        al[i][l-1] += int(a[i][j]) * int(b[j][l-1])
    else:
        print(al[i][l-1])

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(list(map(lambda x, y: x*y, a[i], b))))

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

Submission status: Accepted

Solution code:
listA=[]
listB=[]
result_vec=[]
i,j=map(int,input().split())
for n in range(i):
    listA.append(list(map(int,input().split())))
for n in range(j):
    listB.append(int(input()))
for n in range(i):
    result=0
    for m in range(j):
        result+=listA[n][m]*listB[m]
    result_vec.append(result)
for n in range(i):print(result_vec[n])

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
# coding: utf-8
line = input().split()
n = int(line[0])
m = int(line[1])
a = [[0 for i in range(m)] for j in range(n)]
b = [0 for i in range(m)]
ans = [0 for i in range(n)]
for i in range(n):
    a[i] = input().split()
    for j in range(m):
        a[i][j] = int(a[i][j])
for i in range(m):
    b[i] = int(input())
    
for i in range(n):
    for j in range(m):
        ans[i] += a[i][j]*b[j]
    print(ans[i])

Submission status: Accepted

Solution code:
h, w = map(int, input().split())

matrix = [list(map(int, input().split())) for _ in range(h)]
vector = [int(input()) for _ in range(w)]

for i in range(h):
    print(sum(v*m for v, m in zip(vector, matrix[i])))

Submission status: Accepted

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

Submission status: Accepted

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

# start calc
for i in range(a[0]):
    for j in range(a[1]):
        ans[i]+=matrix[i][j]*vector[j]
# print
for i in range(a[0]):
    print(str(ans[i]))

Submission status: Accepted

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

mat = []

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

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


res = []

for i in range(a):
	tmp = 0
	for j in range(b):
		tmp += mat[i][j] * mat2[j]
	print(tmp)

Submission status: Accepted

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

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

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

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

for x in range(n):
    ans = 0
    for y in range(m):
        ans += matrix[x][y] * vector[y]

    print(ans)

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

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

Submission status: Accepted

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

A = [[0 for am in range(m)] for an in range(n)]
for xn in range(n):
    Anm = [int(x) for x in input().split()]
    for xm in range(m):
        A[xn][xm] = Anm[xm]

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

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

Submission status: Accepted

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

for x in range(i):
    ans = 0
    for y in range(j):
        ans += a[x][y]*b[y]
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num1, num2 = map(int, input().split())
matrix = []

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

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

for k in range(num1):
    a = 0
    for l in range(num2):
        a += matrix[k][l]*column[l]
    print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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


matrix = [[0]*m for i in range(n)]
mtx = []

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

vector =[0]*m

for a in range(m):
    vector[a] = int(input())

answer = [0]*n
    
for b in range(n):
    for c in range(m):
        answer[b] += matrix[b][c] * vector[c]
    print(answer[b])

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


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:
N,M = map(int,input().split())
L = []
for i in range(N) :
    L.append(list(map(int,input().split())))
v = []
for i in range(M) :
    v.append(int(input()))

ans = []
for i in range(N) :
    element = 0
    for j in range(M) :
        element += L[i][j]*v[j]
    ans.append(element)
for i in range(len(ans)) :
    print(ans[i])

Submission status: Accepted

Solution code:
nm = [int(s) for s in input().split()]
A = []
for i in range(nm[0]):
    a_i = [int(s) for s in input().split()]
    A.append(a_i)
b = []
for j in range(nm[1]):
    b_j = int(input())
    b.append(b_j)

for i in range(nm[0]):
    c_i = 0
    for j in range(nm[1]):
        c_i += A[i][j] * b[j]
    print(c_i)

Submission status: Accepted

Solution code:
n,m = map(int,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]=list(map(int,input().split()))
for i in range(m):
    b[i] = 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:
import sys

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

mat = []

for _ in range(n):
    mat.append(list(map(int, sys.stdin.readline().strip().split())))

vec = []

for _ in range(m):
    vec.append(int(sys.stdin.readline()))

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

Submission status: Accepted

Solution code:
num = input()
lst1 = list(map(int, num.split()))
n = lst1[0]
m = lst1[1]
lst2 = []
lst3 = []
s = 0
for i in range(n):
    line = input()
    lst2.append(list(map(int, line.split())))
#print(lst2)
for i in range(m):
    line = input()
    lst3.append(list(map(int, line.split())))
#print(lst3)
for i in range(n):
    for j in range(m):
        s += lst2[i][j]*lst3[j][0]
        #print(lst2[i][j]*lst3[j][0])
    print(s)
    s = 0

Submission status: Accepted

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

#print(v_li)
#print(b)
#mul = 0
for row in v_li:
    mul = 0
    for col in range(m):
        mul+=row[col]*b[col]
    print(mul)

Submission status: Accepted

Solution code:
import sys
n, m=map(int,sys.stdin.readline().split())
A=[list(map(int,sys.stdin.readline().split())) for i in range(n)]
B=[list(map(int,sys.stdin.readline().split())) for i in range(m)]
C=[[0 for C in range(m)] for r in range(n)]
for r in range(n):
    for c in range(m):
        C[r][0]+=A[r][c]*B[c][0]
    print(C[r][0])

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
arr1 = [list(map(int, input().split())) for _ in range(n)]
arr2 = [int(input()) for _ in range(m)]
for ans in ([sum([a1*a2 for a1,a2 in zip(arr1[j], arr2)]) for j in range(n)]):
    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(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:
def main():
	n, m = (int(a) for a in input().split())
	a = []
	b = []
	for i in range(n):
		for j in input().split():
			a.append(int(j))
	for i in range(m):
		b.append(int(input()))

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

main()

Submission status: Accepted

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

A=[]
b=[]
C=[]
c=0

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

Submission status: Accepted

Solution code:
#! /usr/bin/env python3
n,m = map(int,input().split())

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

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

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

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

Submission status: Accepted

Solution code:

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

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

l2 = []
for i in range(0,n):
    l2.append(int(input()))


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, 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):
    a[i] = list(map(int, input().split()))
for j in range(m):
    b[j] = 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 = [list(map(int, input().split())) for _ in range(n)]
b = [int(input()) for _ in range(m)]
for i in range(n):
    answer = [aj*bj for aj, bj in zip(a[i], b)]
    print(sum(answer))

Submission status: Accepted

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

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

for n_l in n_list:
    sum_n = 0
    for i in range(len(n_l)):
        sum_n += n_l[i]*m_list[i]
    print(sum_n)

Submission status: Accepted

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

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

for i in range(n):
    temp = input()
    sp = temp.split(' ')
    
    for j in range(m):
        a[i][j] = int(sp[j])

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

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:
(n,m)=map(int, input().split())
matrix = [[0]*m for x in range(n)]
vector = [0]*m
ans = [0]*n

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

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