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

a=[]
b=[]

for i in range(n):
    val1=input().split(" ")
    val2=[int(j) for j in val1]
    a.append(val2)


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


c = int(0)


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
height, width = map(int, input().split())
A = []
for i in range(height):
    A.append(list(map(int, input().split())))
B = [int(input()) for s in range(width)]
C = [0 for i in range(height)]
for i in range(height):
    for j in range(width):
        C[i] += A[i][j] * B[j]
    print(C[i])

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:
lst1=[]
lst2=[]
answer=0
n,m=(int(x) for x in input().split())
for s in range(n):
    aij=input().split()
    lst1.append(aij)
for t in range(m):
    bi=int(input())
    lst2.append(bi)
for u in range(n):
    lstA=lst1[u]
    for v in range(m):
        number1=int(lstA[v])
        number2=lst2[v]
        answer+=number1*number2
    print(answer)
    answer=0

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(a):
  ans = 0
  for j in range(b):
    ans = ans + mat[i][j] * int(line[j])
  print(ans)

Submission status: Accepted

Solution code:
N, M = map(int, input().split())
A = []
B = []
for n in range(N):
    a = list(map(int, input().split()))
    A.append(a)

for m in range(M):
    b = int(input())
    B.append(b)

for a in A:
    c = [unit * b for unit, b in zip(a, B)]
    print(sum(c))

Submission status: Accepted

Solution code:
n,m=list(map(int,input().split()))
A=[[] for i in range(n)]
A1=[[0 for x in range(m)] for y in range(n)]
B=0
C=0
D=0
c=[[0] for i in range(m)]
b=[[0] for i 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 k in range(n):
    B=0
    for l in range(m):
        B+=A[k][l]*b[l]
    print(B)

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)]
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] * 1 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 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):
	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 = [input().split() for l in range(n)]
b=[int(input()) for i in range(m)]
du=0
for v in range(n):
    for k in range(m):
        du+=int(a[v][k])*b[k]
    print(du)
    du=0

Submission status: Accepted

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

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

Submission status: Accepted

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


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

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

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

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

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

Submission status: Accepted

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

b=[]

for i in range(m):
    x=int(input())
    b.append(x)
c=[0]*n


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



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

Submission status: Accepted

Solution code:
num1,num2=input().split(" ")
vec=[]
a=[]
for i in range(int(num1)):
    c=[]
    b=input().split(" ")
    for j in range(int(num2)):
        c.append(int(b[j]))
    a.append(c)
for k in range(int(num2)):
    num4=int(input())
    vec.append(num4)
for l in range(int(num1)):
    sum=0
    for m in range(0,len(vec),1):
        sum=sum+(a[l][m]*vec[m])
    print(sum)

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

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

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

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

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

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

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

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(n):
    matrix1.append(list(map(int, input().split())))
    
for _ in range(m):
    matrix2.append([int(input())])

for i in range(n):
    elem = 0
    for j in range(m):
        elem += matrix1[i][j] * matrix2[j][0]
    ans.append([elem])

for row in ans:
    for column in row:
        print(column)

Submission status: Accepted

Solution code:
def mapt(fn, *args):
    return tuple(map(fn, *args))
    
n, m = mapt(int, input().split(" "))
nums = [mapt(int, input().split(" ")) for i in range(n)]
b = [int(input()) for i in range(m)]

for row in nums:
    print(sum(i*j for i, j in zip(b,row)))

Submission status: Accepted

Solution code:
#
# 6d
#


def main():
    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 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])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
a=[]
while True:
    try:
        for i in range(n):
            a.append(list(map(int,input().split())))
        b=[int(input()) for j in range(m)]
        for k in range(n):
            q=a[k]
            w=0
            for l in range(m):
                w+=b[l]*q[l]
            print(w)
        
    except:
        break;

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
mat = [list(map(int, input().split())) for _ in range(n)]
vec = [int(input()) for _ in range(m)]
ans = [0]*n
for i, row in enumerate(mat):
    for j in range(m):
        ans[i] += row[j] * vec[j]
[print(ans[i]) for i in range(n)]

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
matrix1 = [[0]*m]*n
matrix2 = [0]*m
answer = [0]*n
for i in range(n):
  matrix1[i] = list(map(int, input().split()))
for i in range(m):
  matrix2[i] = int(input())

for i in range(n):
  for j in range(m):
    answer[i] += matrix1[i][j] * matrix2[j]
  print(answer[i])

Submission status: Accepted

Solution code:
N,M=map(int,input().split())
K=[0]*N
T=[]
for k in range(N):
  C=list(map(int,input().split()))
  T.append(C)
D=[int(input()) for i in range(M)]
for i in range(N):
  for j in range(M):
    K[(i*M+j)//M]+=T[i][j]*D[j]
for o in range(N):
  print(K[o])

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

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

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]

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

Submission status: Accepted

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


A = [[int(x) for x in input().split()] for l in range(n)]
B = [int(input()) for i in range(m)]

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

for k in c:
    print(k)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 行列と列ベクトルの積を求めるプログラム
import sys

# 標準入力からデータを読み込む
def read_data():
    n, m = [int(i) for i in sys.stdin.readline().strip().split(' ')]
    matrix = []
    for _ in range(n):
        matrix.append([int(num) for num in sys.stdin.readline().strip().split(' ')])

    vector = []
    for _ in range(m):
        vector.append(int(sys.stdin.readline().strip()))

    return matrix, vector

# 行列xベクトルの計算
def multiple(matrix, vector):
    n = len(matrix)
    m = len(vector)
    ans = []

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

        ans.append(sum)

    return ans

# メイン関数
def main():
    matrix, vector = read_data()
    ans = multiple(matrix, vector)
    for i in ans:
        print(i)
        
if __name__ == '__main__':
    main()

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

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

C = []
for i in range(n):
    for j in range(m):
        c = A[i][j]*B[j]
        C.append(c)
        
d = math.ceil(len(C)/n)
r = [C[x: x+d] for x in range(0,len(C),d)]

for i in range(len(r)):
    s = sum(r[i])
    print(s)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
A = [[0 for col in range(m)] for row in range(n)]
b = [0 for element in range(m)]

# matrix
for row in range(n):
    temp = input().split()
    temp = [int(a) for a in temp]
    for col in range(m):
        A[row][col] = temp[col]
# vector
for row in range(m):
    temp = int(input())
    b[row] = temp
# calc.
for row in range(n):
    sum = 0
    for col in range(m):
        sum += A[row][col] * b[col]
    print(sum)

Submission status: Accepted

Solution code:
var=input()
var=var.split()
n=int(var[0])
m=int(var[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):
    var=input()
    var=var.split()
    for j in range(m):
        A[i][j]=int(var[j])
for i in range(m):
    var=input()
    var=var.split()
    b[i]=int(var[0])
line=0

for line_A in A:
    line_b=0
    for row in line_A:
        c[line]+=row*b[line_b]
        line_b+=1
    print(c[line])
    line+=1

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num=list(map(int,input().split(" ")))
matrix=[list(map(int,input().split(" ")))for i in range(num[0])]
vector=[int(input())for i in range(num[1])]
ans=[]
for i in range(num[0]):
    ans.append(sum([(matrix[i][j]*vector[j])for j in range(num[1])]))
for i in ans:
    print(i)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

#print(a)
#print(b)

for k in range(n):
    for l in range(m):
        sum += a[k][l] * b[l]
    result.append(sum)
    sum = 0

for i in range(len(result)):
    print(result[i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
P=[]
Q=[]
c=0

for i in range(n):
    P.append(input().split())
    
for j in range(m):
    b=int(input())
    Q.append(b)
    
for k in range(n):
    for l in range(m):
        a=P[k]
        c+=int(a[l])*Q[l]
    print(c)
    c=0

Submission status: Accepted

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

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

for k in range(n):
    lstc=[]
    for l in range(m):
        c=lsta[k][l]*lstb[l]
        lstc.append(c)
    print(sum(lstc))

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

A = []
B = []

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

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:
a=[]
b=[]
n,m=map(int,input().split())
for i in range(n):
    a.append(list(map(int,input().split())))
for i in range(m):
    b.append(int(input()))
for i in range(n):
    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 = [[1, 2, 0, 1,],
#     [0, 3, 0, 1,],
#     [4, 1, 1, 0]]
# b = [1, 2, 3, 0]
A = []
b = []
for _ in range(n):
    A.append(list(map(int, input().split())))
for _ in range(m):
    b.append(int(input()))


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

Submission status: Accepted

Solution code:
def multiply_columns(column_a, column_b):
    total = 0
    
    for a, b in zip(column_a, column_b):
        total += (a * b)
    
    return total


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

matrix = []
column_matrix = []

for _ in range(n):
    nums = [int(y) for y in input().split()]
    matrix.append(nums)

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

totals = []
total = 0

for column in matrix:
    total = multiply_columns(column, single_column_vector)
    totals.append(total)

for total in totals:
    print(total)

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

Submission status: Accepted

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

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:
x=[]
y=[]
n,m=map(int,input().split())

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

#print(x)
#print(y)


for k in range(n):
    z=0
    for l in range(m):
        z+=y[l]*x[k][l]

    print(z)

Submission status: Accepted

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

a=[[0 for M in range(m)]for N in range(n)]
for k in range(n):
    A=list(map(int,input().split()))
    a[k]=A

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

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

Submission status: Accepted

Solution code:
N,M,*A = map(int, open(0).read().split())
B = A[N*M:]

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

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

Submission status: Accepted

Solution code:
i, j = map(int, input().split())
list_a = []
list_b = []

for n in range(i):
    list_a.append(list(map(int, input().split())))
for n in range(j):
    list_b.append(int(input()))
for n in range(i):
    result = 0
    for m in range(j):
        result += list_a[n][m] * list_b[m]
    print(result)

Submission status: Accepted

Solution code:
nrow, col = [], []

n, m = map(int, input().split())
count = 0
while count < n:
    nrow.append(list(map(int, input().split())))
    count += 1
count = 0
while count < m:
    col.append(int(input()))
    count += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(n):
    res = 0
    for bb, aa in zip(b, A[i]):
        res += bb * aa
    print(res)

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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

for val in c:
    print(val)

Submission status: Accepted

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

Submission status: Accepted

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