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: Runtime Error

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

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

multi = np.dot(matrix, array)
for i in list(multi):
    print i

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:
import numpy
n, m = map(int, raw_input().split())
a = numpy.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = numpy.c_[a, (map(int, raw_input().split()))]
b = numpy.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = numpy.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int, raw_input().split())

Submission status: Runtime Error

Solution code:
import numpy as np

Submission status: Runtime Error

Solution code:
import numpy

Submission status: Runtime Error

Solution code:
import NumPy as np
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:
import NumPy
n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:

n, m = map(int, raw_input().split())
a = numpy.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = numpy.c_[a, (map(int, raw_input().split()))]
b = numpy.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = numpy.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:

n, m = map(int, raw_input().split())
a = np.array(map(int, raw_input().split()))
for i in xrange(n-1):
	a = np.c_[a, (map(int, raw_input().split()))]
b = np.array(map(int, raw_input().split()))
for i in xrange(m-1):
	b = np.r_[b, (map(int, raw_input().split()))]
for i in xrange(n):
	print b.dot(a)[i]

Submission status: Runtime Error

Solution code:
import numpy as np
a = np.array(map(int, raw_input().split()))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n, m = input()
A = []
b = []
c = 0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
tate,yoko=map(int,raw_input().split())
A=[]
b=[]
for i in range(tate):
    A.append(map(int, raw_input().split()))
for j in range(yoko):
    b.append(input())
Anp=np.array(A)
bnp=np.array(b)
cnp=Anp.dot(b)
for ele in cnp:
    print ele

Submission status: Runtime Error

Solution code:
import numpy as np

m1 = []
m2 = []
n, m = map(int, input().split())
for _ in range(n):
    m1.append([int(x) for x in input().split()])
for _ in range(m):
    m2.append([int(input())])

m1 = np.matrix(m1)
m2 = np.matrix(m2)
ans = m1 * m2

for i in range(n):
    print(ans[i, 0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import math
import numpy as np

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

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

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

c = A.dot(b)

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

Submission status: Runtime Error

Solution code:
import numpy as np


#def area##################################

def zero(n):
	c=list()
	for i in range(n):
		c+=[0]
	return c

###########################################

f_input=map( int,raw_input().split(" ")  )


vec=f_input[0]
col=f_input[1]


#zero teigi
null=list()
for i in range(vec):
	null.append(zero(col))
#print null
cvarea=np.matrix(null)


k=list()
for i in range(col):
	k+=[[0]]
k=np.matrix(k)
varea=k

#print "cvarea="
#print cvarea
#print "varea="
#print varea





#print "kokkara"

for i in range(vec):
	N=map(int,raw_input().split(" "))
	print N
	M=np.matrix(N)
	print M
	cvarea[i]+=N
#print "cvarea="
#print cvarea

for i in range(col):
	N=int(raw_input())
	varea[i]+=N
#print "varea="
#print varea

sol=cvarea*varea
print sol

Submission status: Runtime Error

Solution code:
import numpy as np


#def area##################################

def zero(n):
	c=list()
	for i in range(n):
		c+=[0]
	return c

###########################################

f_input=map( int,raw_input().split(" ")  )


vec=f_input[0]
col=f_input[1]


#zero teigi
null=list()
for i in range(vec):
	null.append(zero(col))
#print null
cvarea=np.matrix(null)


k=list()
for i in range(col):
	k+=[[0]]
k=np.matrix(k)
varea=k

#print "cvarea="
#print cvarea
#print "varea="
#print varea





#print "kokkara"

for i in range(vec):
	N=map(int,raw_input().split(" "))
#	print N
	M=np.matrix(N)
#	print M
	cvarea[i]+=N
#print "cvarea="
#print cvarea

for i in range(col):
	N=int(raw_input())
	varea[i]+=N
#print "varea="
#print varea

sol=cvarea*varea
for i in range(col):
	print int(sol[i])

Submission status: Runtime Error

Solution code:
import numpy as np


#def area##################################

def zero(n):
	c=list()
	for i in range(n):
		c+=[0]
	return c

###########################################

f_input=map( int,raw_input().split(" ")  )


vec=f_input[0]
col=f_input[1]


#zero teigi
null=list()
for i in range(vec):
	null.append(zero(col))
#print null
cvarea=np.matrix(null)


k=list()
for i in range(col):
	k+=[[0]]
k=np.matrix(k)
varea=k

#print "cvarea="
#print cvarea
#print "varea="
#print varea





#print "kokkara"

for i in range(vec):
	N=map(int,raw_input().split(" "))
#	print N
	M=np.matrix(N)
#	print M
	cvarea[i]+=N
#print "cvarea="
#print cvarea

for i in range(col):
	N=int(raw_input())
	varea[i]+=N
#print "varea="
#print varea

sol=cvarea*varea
for i in range(vec):
	print int(sol[i])

Submission status: Runtime Error

Solution code:
import numpy as np
def zero(n):
	c=list()
	for i in range(n):
		c+=[0]
	return c
f_input=map( int,raw_input().split(" ")  )
vec=f_input[0]
col=f_input[1]
null=list()
for i in range(vec):
	null.append(zero(col))

cvarea=np.matrix(null)


k=list()
for i in range(col):
	k+=[[0]]
k=np.matrix(k)
varea=k







for i in range(vec):
	N=map(int,raw_input().split(" "))
	M=np.matrix(N)
	cvarea[i]+=N

for i in range(col):
	N=int(raw_input())
	varea[i]+=N

sol=cvarea*varea
for i in range(vec):
	print int(sol[i])

Submission status: Runtime Error

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

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

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def solve(n, m, a, b):
    res = []
    for i in range(n):
        s = [a[i][j] * b[j] for j in range(m)]
        res.append(sum(s))
    return res

if __name__ == '__main__':
    n, m = [int(i) for i in input().split()]
    a = [[int(i) for i in input().split()] for _ in range(n)]
    b = [int(i) for i in input().split()] for _ in range(m)]
    for x in solve(n, m, a, b):
        print(x)

Submission status: Runtime Error

Solution code:
def solve(n, m, a, b):
    res = []
    for i in range(n):
        s = [a[i][j] * b[j] for j in range(m)]
        res.append(sum(s))
    return res

if __name__ == '__main__':
    n, m = map(int, raw_input().split())
    a = [map(int, raw_input().split()) for _ in range(n)]
    b = [int(i) for i in input()) for _ in range(m)]
    for x in solve(n, m, a, b):
print(x)

Submission status: Runtime Error

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

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

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

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

print(c[0])
print(c[1])
print(c[2])

Submission status: Runtime Error

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

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

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


print(matrix)
print()
print(vector)

Submission status: Runtime Error

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

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

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


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

Submission status: Runtime Error

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

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

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

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

    print(sum)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
t(i) for i in input().split()]

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

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

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

    print(sum)

Submission status: Runtime Error

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

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

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


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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

vector = []
for ni in range(n):
    vector.append(int(input()))
    
for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)


print(matrix)
print()
print(vector)

Submission status: Runtime Error

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

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

vector = []
for ni in range(n):
    vector.append(int(input()))

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

    print(sum)

Submission status: Runtime Error

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

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

vector = []
for ni in range(n):
    vector.append(int(input()))

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

    print(sum)

Submission status: Runtime Error

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

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

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


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

Submission status: Runtime Error

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

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

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

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

    print(sum)

Submission status: Runtime Error

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

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

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

for ni in range(n):

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

        print(sum)

Submission status: Runtime Error

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

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

for _ in result:
    print(_)

Submission status: Runtime Error

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

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

v = [0] * m
for i in xrange(m):
	v[i] = input()

for i in xrange(n):
	t = 0
	for j in xrange(m):
		t += mx[i][j] * v[j]
	print t

Submission status: Runtime Error

Solution code:
import numpy as np
print("hello")

Submission status: Runtime Error

Solution code:
[n, m] = [int(x) for x in raw_input().split()]
A = []
B = [0] * m

counter = 0
while counter < n:
    A.append([int(x) for x in raw_input().split()])
    counter += 1

B[counter] = [int(raw_input()) for j in range(m)]

counter = 0
while counter < n:
    result = 0
    for j in range(m):
        result += A[counter][j] * B[j]
    print(result)
    counter += 1

Submission status: Runtime Error

Solution code:
n, m = [int (x) for x in input().split(' ')]
a = [[0 for i in range(n)] for j in range(m)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]
for s in range(0,n):
    a[s] = [int (x) for x in input().split(' ')]
for s in range(0,m):
    b[s] = int(input())
for s in range(0,n):
    for t in range(0,m):
        c[s] += a[s][t] * b[t]
for t in range(0,n):
    print("%d" % c[t])

Submission status: Runtime Error

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

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

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: Runtime Error

Solution code:
# coding: utf-8
# Here your code !
import numpy as np
N, M = map(int, input().split())

A = []
b = []

for _ in range(N):
    A.append([int(i) for i in input().split()])
    
for _ in range(M):
    b.append([int(input())])

A = np.matrix(A)
b = np.matrix(b)

c = A.dot(b)

print("\n".join([str(int(c[i])) for i in range(N)]))

Submission status: Runtime Error

Solution code:
import numpy as np

n, m = map(int, input().strip().split())
a = np.zeros((n,m), dtype = int)
b = np.zeros((m,1), dtype = int)

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

c = a.dot(b)

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

Submission status: Runtime Error

Solution code:
import numpy as np

n, m = map(int, input().strip().split())
a = np.zeros((n,m), dtype = int)
b = np.zeros((m,1), dtype = int)
c = np.zeros((n,1), dtype = int)

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

c = a.dot(b)

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

Submission status: Runtime Error

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

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

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


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

Submission status: Runtime Error

Solution code:
#!usr/bin/env python3

import sys


def main():
    m, n = [int(col_row) for col_row in sys.stdin.readline().split()]
    matrix = [[0 for col in range(m)] for row in range(n)]
    vector = [0 for col in range(m)]

    for row in range(n):
        lst = [int(element) for element in sys.stdin.readline().split()]
        for col in range(m):
            matrix[row][col] += lst[col]

    for row in range(m):
        lst = [int(element) for element in sys.stdin.readline().split()]
        vector[row] += lst[0]

    for row in range(n):
        sum_of_row = 0
        for col in range(m):
            sum_of_row += matrix[row][col] * vector[col]
        # res.append(sum_of_row)
        print(sum_of_row)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

n, m = map(int, fin.readline().split())

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

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

for i in range(m):
	b[i] = int(fin.readline())

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

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: Runtime Error

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

Mat = [[]]

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

b = []

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

c = [0 for k in range(n)]

for l in range(n):
	for l2 in range(m):
		c[l] += (Mat[l][l2] * b[l2])
	print(c[l])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a=[]
for i in range(n):
    a[i] = 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: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
pupils = []

while True:
    l = list(map(int, input().split()))
    if sum(l) == -3:
        break
    pupils.append(l)

for pupil in pupils:
    score = pupil[0] + pupil[1]
    if pupil[0] == -1 or  pupil[1] == -1:
        rank = 'F'
    elif score >= 80:
        rank = 'A'
    elif score >= 65:
        rank = 'B'
    elif (score >= 50) or (score >= 30 and pupil[2] >= 50):
        rank = 'C'
    elif score >= 30:
        rank = 'D'
    else:
        rank = 'F'
    print(rank)

Submission status: Runtime Error

Solution code:
# n*m?????????A??¨m*1??????????????????b??¨??????????¨????????????°??????

import numpy as np
n, m = map(int, input().split())

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

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

c = A.dot(b)            #A??b

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