CodeEff/ECCO huggingface dataset:
# Original solution
from heapq import heappop,heappush

n,k = list(map(int,input().split()))
a = [0] + list(map(int,input().split()))

ans = 0
if(a[1] != 1):
    ans += 1

links_c = [set() for _ in range(n+1)]
for i,ai in enumerate(a[2:],2):
    links_c[ai].add(i)

depth = [-1] * (n+1)
depth[1] = 0
stack = [1]
hq = []
while(stack):
    next = []
    while(stack):
        i = stack.pop()
        for j in links_c[i]:
            depth[j] = depth[i] + 1
            heappush(hq, (depth[j]*-1,j))
            next.append(j)
    stack = next[::]

while( hq[0][0]*-1 > k ):
    di,i = heappop(hq)
    if( depth[i] <= k ):
        continue

    for j in range(k-1):
        i = a[i]

    ans += 1
    links_c[a[i]].remove(i)
    stack = [i]
    while(stack):
        next = []
        while(stack):
            i = stack.pop()
            depth[i] = 1
            for j in links_c[i]:
                next.append(j)
        stack = next[::]

print(ans)


'''
首都の自己ループを除くと、首都を根として、
子→親の有向木になっている。

・首都のテレポート先は首都でないとダメ
→　長さ2以上の閉路を作るとうまくいかない

・首都以外は、首都までの距離をk以下にできればよい

もっとも根からの距離が遠い頂点xをとる。
xが根からの距離k以下　→　終了してOK
xが根からの距離k以上
→　xからk-1個離れた親を首都につなぎなおす
　そして再度最も遠い頂点を探す、を繰り返す。

'''

# Optimized solution
n,k = list(map(int,input().split()))
a = [0] + list(map(int,input().split()))

ans = 0
if(a[1] != 1):
    ans += 1

links_c = [set() for _ in range(n+1)]
for i,ai in enumerate(a[2:],2):
    links_c[ai].add(i)

depth = [-1] * (n+1)
depth[1] = 0
stack = [1]
ts = [(0,1)]
while(stack):
    next = []
    while(stack):
        i = stack.pop()
        for j in links_c[i]:
            depth[j] = depth[i] + 1
            ts.append((depth[j],j))
            next.append(j)
    stack = next[::]

while( ts[-1][0] > k ):
    di,i = ts.pop()
    if( depth[i] <= k ):
        continue

    for j in range(k-1):
        i = a[i]

    ans += 1
    links_c[a[i]].remove(i)
    stack = [i]
    while(stack):
        next = []
        while(stack):
            i = stack.pop()
            depth[i] = 1
            for j in links_c[i]:
                next.append(j)
        stack = next[::]

print(ans)
# Original solution
import sys
sys.setrecursionlimit(200000)
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
if a[0] != 1:
  a[0] = 1
  ans += 1
b = [[]for i in range(n)]
for i in range(n):
  b[a[i]-1].append(i)
b[0].remove(0)
huka = 0
kyo = [float("inf")] * n
z =[[]for i in range(n)]
def dfs(x,y):
  kyo[x] = y
  z[y].append(x)
  for i in b[x]:
    dfs(i,y+1)
dfs(0,0)
def dfs2(x,y):
  if kyo[x] <=k-y:
    return
  if y == k-1 and x != 0:
    kyo[x] = 0
    global ans
    ans += 1
    return
  kyo[x] = 0
  dfs2(a[x]-1,y+1)
for i in range(n-1,k,-1):
  for j in z[i]:
    dfs2(j,0)
print(ans)

# Optimized solution
import sys
sys.setrecursionlimit(200000)
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
if a[0] != 1:
  a[0] = 1
  ans += 1
b = [[]for i in range(n)]
for i in range(1,n):
  b[a[i]-1].append(i)
huka = 0
kyo = [float("inf")] * n
z =[[]for i in range(n)]
def dfs(x,y):
  kyo[x] = y
  z[y].append(x)
  for i in b[x]:
    dfs(i,y+1)
dfs(0,0)
def dfs2(x,y):
  if kyo[x] <=k-y:
    return
  if y == k-1 and x != 0:
    kyo[x] = 0
    global ans
    ans += 1
    return
  kyo[x] = 0
  dfs2(a[x]-1,y+1)
for i in range(n-1,k,-1):
  for j in z[i]:
    dfs2(j,0)
print(ans)
# Original solution
# ABC135
def main():
    a, b = tuple(map(int, input().rstrip().split()))
    print(((a + b) // 2 if (a + b) % 2 == 0 else "IMPOSSIBLE"))


if __name__ == "__main__":
    main()

# Optimized solution
# ABC135A - Harmony
def main():
    A, B = list(map(int, input().split()))
    flg = (A + B) % 2 == 0
    print(((A + B) // 2 if flg else "IMPOSSIBLE"))


if __name__ == "__main__":
    main()
# Original solution
a, b = list(map(int, input().split()))

k = ( a + b )

if k%2 == 0:
  print((k//2))
else:
  print('IMPOSSIBLE')

# Optimized solution
a, b = list(map(int, input().split()))

if (a**2 - b**2) % (2 * (a - b)) == 0:
    print(((a**2 - b**2) // (2 * (a - b))))
else:
    print('IMPOSSIBLE')
# Original solution
ab = input().split()
A, B = int(ab[0]), int(ab[1])

if A == B:
    print((1))
elif A % 2 != B % 2:
    print("IMPOSSIBLE")
else:
    K = (A+B) // 2
    if abs(A-K) == abs(B-K):
        print(K)
    else:
        print("IMPOSSIBLE")

# Optimized solution
ab = input().split()
A, B = int(ab[0]), int(ab[1])

out = None
if A == B:
    out = None
elif A % 2 != B % 2:
    out = "IMPOSSIBLE"
else:
    K = (A+B) // 2
    if abs(A-K) == abs(B-K):
        out = K
    else:
        out = "IMPOSSIBLE"

print(out)
# Original solution
a,b=list(map(int,input().split()))
if (a+b)%2==0:
    print(((a+b)//2))
else:
    print("IMPOSSIBLE")


# Optimized solution
a,b=list(map(int,input().split()))
if (a+b)%2!=0:
    print("IMPOSSIBLE")
else:
    print(((a+b)//2))
# Original solution
a, b = list(map(int, input().split()))
if abs(b - a) % 2:
    print('IMPOSSIBLE')
else:
    print((abs(b - a) // 2 + min(a, b)))

# Optimized solution
a, b = list(map(int, input().split()))
if (a - b) % 2 == 0:
    print(((a + b) // 2))
else:
    print('IMPOSSIBLE')
# Original solution
a, b = list(map(int, input().split()))
if (a - b) % 2 == 0:
  print(((a + b) // 2))
else:
  print("IMPOSSIBLE")

# Optimized solution
a, b = list(map(int, input().split()))
print(((a+b)// 2 if (a+b)% 2 == 0 else "IMPOSSIBLE"))
# Original solution
a,b = list(map(int,input().split()))
if a%2==0 and b%2!=0:
    print("IMPOSSIBLE")
elif a%2!=0 and b%2==0:
    print("IMPOSSIBLE")
else:
    print((int(((a+b)/2))))

# Optimized solution
a,b = list(map(int,input().split()))
if (a%2) != (b%2):
    print("IMPOSSIBLE")
else:
    print((int(((a+b)/2))))
# Original solution
A,B = list(map(int, input().split()))

a=(A+B)
if (a)%2==1:
    print('IMPOSSIBLE')

else:
    print((str(int(a/2))))

# Optimized solution
A,B = list(map(int, input().split()))

if (A+B)%2==1:
    print('IMPOSSIBLE')

else:
    print((int((A+B)/2)))
# Original solution
#ABC135A - Harmony
A, B = list(map(int,input().split()))
if (max(A,B) - min(A,B)) % 2 == 1:
    print("IMPOSSIBLE")
else:
    print(((A+B)//2))

# Optimized solution
#ABC135A - Harmony
A, B = list(map(int,input().split()))
if (A+B) % 2 == 1:
    print("IMPOSSIBLE")
else:
    print(((A+B)//2))
# Original solution
a,b=list(map(int,input().split()))
k=(a+b)/2
if int(k)<(a+b)/2:
    print('IMPOSSIBLE')
else:
    print((int(k)))

# Optimized solution
A, B = list(map(int, input().split()))
print(((A+B)//2 if (A+B) % 2 == 0 else "IMPOSSIBLE"))
# Original solution
s=eval(input().replace(" ","+"))
print((s//2 if s%2==0 else "IMPOSSIBLE"))

# Optimized solution
A, B = list(map(int, input().split()))
print(((A+B)//2 if (A+B) % 2 == 0 else "IMPOSSIBLE"))
# Original solution
# coding: utf-8
# Your code here!
A,B=input().split()

A=int(A)
B=int(B)

def abs(x):
    if x>=0:
        return x
    else:
        return -x
        
if abs(A-B)%2==0:
    print((min(A,B)+int(abs(A-B)/2)))
else:
    print('IMPOSSIBLE')

# Optimized solution
A, B = list(map(int, input().split()))

if (A + B) % 2 == 0:
    K =  (A + B) // 2
    print(K)
else:
    print('IMPOSSIBLE')
# Original solution
A,B = list(map(int,input().split()))
if (A+B)%2==0:
    print(((A+B)//2))
else:
    print("IMPOSSIBLE")

# Optimized solution
A,B = list(map(int,input().split()))
if A>B:
    A,B = B,A
if (B-A)%2==0:
    print(((B+A)//2))
else:
    print("IMPOSSIBLE")
# Original solution
a, b = list(map(int, input().split()))
large = max(a, b)
ans = 0

for i in range((a+b)//2, large):
	if abs(a - i) == abs(b - i):
		ans = i
		break

if ans == 0:
	print("IMPOSSIBLE")
else:
	print(ans)


# Optimized solution
a, b = list(map(int, input().split()))
large = max(a, b)
ans = ((a + b) / 2)

if ans.is_integer():
	print((int(ans)))
else:
	print("IMPOSSIBLE")
# Original solution
a=eval(input().replace(' ','+'));print((a%2*'IMPOSSIBLE'or a//2))

# Optimized solution
a=eval(input().replace(*' +'))
print((a%2*'IMPOSSIBLE'or a//2))
# Original solution
a, b = list(map(int, input().split()))
if (a+b) % 2 == 0:
  print(((a + b) // 2))
else:
  print("IMPOSSIBLE")

# Optimized solution
a, b = list(map(int, input().split()))
if abs(a-b) % 2 == 0:
    print(((a+b)//2))
else:
    print("IMPOSSIBLE")
# Original solution
A, B = list(map(int, input().split()))
if (A+B) % 2 == 0:
    print(((A+B)//2))
else:
    print("IMPOSSIBLE")


# Optimized solution
def LI():
    return list(map(int, input().split()))


A, B = LI()
if (A+B) % 2 == 0:
    ans = (A+B)//2
else:
    ans = "IMPOSSIBLE"
print(ans)
# Original solution
A,B=list(map(int, input().split()))
print(((A+B)//2 if (A+B)&1==0 else 'IMPOSSIBLE'))

# Optimized solution
A, B = list(map(int, input().split()))
if A > B: A, B = B, A
if (B - A) & 1:
    print('IMPOSSIBLE')
    exit()
print((A + (B - A) // 2))
# Original solution
A, B = list(map(int, input().split()))

if (A+B) % 2:
  print('IMPOSSIBLE')
else:
  print(((A+B)//2))

# Optimized solution
a=eval(input().replace(' ','+'));print((a%2*'IMPOSSIBLE'or a//2))
# Original solution
a, b = list(map(int, input().split()))
if (a+b)%2 != 0:
  print("IMPOSSIBLE")
else:
  print(((a+b)//2))

# Optimized solution
a, b = list(map(int, input().split()))
if (a+b)%2 != 0:
  print("IMPOSSIBLE")
else:
  print((int((a+b)/2)))
# Original solution
from functools import reduce

n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))

count = 0
for i in range(n):
    if reduce(
        lambda x, y: x + y[0] * y[1],
        list(zip(bs, list(map(int, input().split())))),
        0,
    ) + c > 0:
        count += 1

print(count)


# Optimized solution
n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))

count = 0
for _ in range(n):
    if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:
        count += 1

print(count)
# Original solution
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a = list(map(int, input().split()))
    t = 0
    for i in range(m):
        t += a[i]*b[i]
    if (t + c) > 0:
        ans += 1
print(ans)


# Optimized solution
# ソースコードの正答を判定する。
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a = list(map(int, input().split()))
    t = 0
    for i in range(m):
        t += a[i]*b[i]
    if (t + c) > 0:
        ans += 1
print(ans)
# Original solution
n,m,c = list(map(int,input().split()))
b = [int(_) for _ in input().split()]
a = []
ans = 0
for _ in range(n):
    a.append([int(_) for _ in input().split()])
for i in range(n):
    sum = 0
    for j in range(m):
        sum += a[i][j] * b[j]
    if sum + c > 0:
        ans += 1
    else:
        pass
print(ans)

# Optimized solution
n,m,c = list(map(int,input().split()))
b = [int(_) for _ in input().split()]
ans = 0
for _ in range(n):
    a = [int(_) for _ in input().split()]
    sum = 0
    for j in range(m):
        sum += a[j] * b[j]
    if sum + c > 0:
        ans += 1
print(ans)
# Original solution
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in range(n):
	a = list(map(int, input().split()))
	val = 0
	for j in range(m):
		val += a[j] * b[j]
	val += c
	if val > 0:
		cnt += 1
print (cnt)

# Optimized solution
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
for i in range(n):
	a = list(map(int, input().split()))
	cnt = 0
	for j in range(m):
		cnt += a[j]*b[j]
	cnt += c
	if cnt > 0:
		res += 1
print (res)
# Original solution
N, M, C = list(map(int, input().split()))
Bi = list(map(int, input().split()))
count = 0
for i in range(N):
    Ai = list(map(int, input().split()))
    t = C
    for i in range(M):
        t += Ai[i] * Bi[i]
    if t > 0:
        count += 1
print(count)

# Optimized solution
N, M, C = list(map(int, input().split()))
Bi = list(map(int, input().split()))
Ai = [list(map(int, input().split())) for _ in range(N)]

count = 0
for a in Ai:
    s = C
    for i in range(M):
        s += a[i] * Bi[i]
    if s > 0:
        count += 1
print(count)
# Original solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []
cnt = 0


for i in range(N):
  A.append(list(map(int, input().split())))
  
for a in range (N):
  tl = 0
  for b in range (M):
    tl += A[a][b]*B[b]
  if tl+C > 0:
    cnt += 1
print(cnt)


# Optimized solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []
cnt = 0

for i in range (N):
    A.append(list(map(int,input().split())))
    
for j in range (N):
  tl = 0
  for k in range (M):
    tl += A[j][k]*B[k]
  if tl + C > 0:
    cnt += 1
    
print(cnt)
# Original solution
n,m,c = list(map(int,input().split()))
b = [int(i) for i in input().split()]
ans = 0
for i in range(n):
	a = [int(i) for i in input().split()]
	sum = c
	for i in range(m):sum+=b[i] * a[i]
	ans+=sum > 0
print(ans)

# Optimized solution
n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
    a=list(map(int,input().split()))
    sum=c
    for j in range(m):sum+=a[j]*b[j]
    if sum>0:ans+=1
print(ans)
# Original solution
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
a = [(list(map(int,input().split()))) for i in range(n)]
t = 0

for i in range(n):
    z = 0
    for j in range(m):
        z += a[i][j] * b[j]
    z += c
    if z > 0:
        t += 1

print(t)    

# Optimized solution
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
a = [(list(map(int,input().split()))) for i in range(n)]
ans = 0
for i in range(n):
    z = c
    for j in range(m):
        z += a[i][j] * b[j]
    if z > 0:
        ans += 1
print(ans)
# Original solution
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n,m,c = list(map(int, input().split()))
    b = list(map(int, input().split()))
    for _ in range(n):
        temp = 0
        a = list(map(int, input().split()))
        for j in range(m):
            temp += a[j]*b[j]
        if temp + c > 0:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

# Optimized solution
import sys

input = sys.stdin.readline

def main():
    ans = 0
    n,m,c = list(map(int, input().split()))
    b = list(map(int, input().split()))
    for _ in range(n):
        temp = c
        a = list(map(int, input().split()))
        for j in range(m):
            temp += a[j]*b[j]
        if temp > 0:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()
# Original solution
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]

cnt=0
for i in range(N):
    ans=0
    for j in range(M):
        ans += B[j]*A[i][j]
    if ans+C>0:
        cnt+=1

print(cnt)

# Optimized solution
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    am=0
    A=list(map(int,input().split()))
    for j in range(M):
        am+=B[j]*A[j]
    if am+C>0:
        cnt+=1
print(cnt)
# Original solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]

ct = 0
for i in A:
    if sum([j * k for j, k in zip(i, B)]) + C > 0:
        ct += 1

print(ct)


# Optimized solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))

ct = 0
for i in range(N):
    if sum([j * k for j, k in zip(list(map(int, input().split())), B)]) + C > 0:
        ct += 1

print(ct)
# Original solution
import copy

N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
As = []
for i in range(N):
    As.append(list(map(int, input().split())))

correct_answer_num = 0
for A in As:
    result = 0

    for j in range(M):
        result += A[j] * B[j]

    result += C
    if result > 0:
        correct_answer_num += 1

print(("{}".format(correct_answer_num)))


# Optimized solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
As = []
for i in range(N):
    As.append(list(map(int, input().split())))

correct_answer_num = 0
for A in As:
    result = 0

    for j in range(M):
        result += A[j] * B[j]

    result += C
    if result > 0:
        correct_answer_num += 1

print(("{}".format(correct_answer_num)))
# Original solution
N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]

res = 0
for i in range(N):
    sum = 0
    for j in range(M):
        sum += alist[i][j] * blist[j]
    if sum + C > 0:
        res += 1
print(res)

# Optimized solution
N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]

print((sum([1 if sum(t[0]*t[1] for t in zip(alist[i], blist)) + C > 0 else 0 for i in range(N)])))
# Original solution
n,m,c=list(map(int,input().split()))
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)]
cnt=0
for i in range(n):
    total=0
    for j in range(m):
        total+=B[j]*A[i][j]
    total+=c
    if 0<total:
        cnt+=1
print(cnt)

# Optimized solution
N,M,C=list(map(int,input().split())) 
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
    X=0
    for j in range(M):
        X += A[i][j]*B[j]
    X += C
    if  0 < X:
        ans += 1
print(ans)
# Original solution
N,M,C=list(map(int,input().split())) 
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
    X=0
    for j in range(M):
        X+=(A[i][j]*B[j])
    X=X+C
    if  0 < X:
        ans = ans+1
print(ans)
    

# Optimized solution
n, m, c = list(map(int, input().split()))
blst = list(map(int, input().split()))
cnt = 0
for i in range(n):
    judge = 0
    alst = list(map(int, input().split()))
    for j, k in zip(alst, blst):
        judge += j * k
    if judge + c > 0:
        cnt += 1
print(cnt)
# Original solution
N, M, C = list(map(int, input().split()))
*B, = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(N)]

count = 0
for a in A:
	j = 0
	for ta, b in zip(a, B):
		j += ta * b
	if 0 < j + C:
		count += 1

print(count)


# Optimized solution
N, M, C = list(map(int, input().split()))
*B, = list(map(int, input().split()))

count = 0
for _ in range(N):
	count += (0 < sum(x * y for x, y in zip(tuple(map(int, input().split())), B)) + C)

print(count)
# Original solution
lx = list(map(int,input().split(" ")))
lb = list(map(int,input().split(" ")))
#la = [li[0]][li[1]]
la = []
cnt = 0

for i in range(0, lx[0]):
    tmp = lx[2]
    la.append(list(map(int,input().split(" "))))
    for j in range(0, lx[1]):
        tmp += la[i][j] * lb[j]
    if (tmp > 0):
        cnt += 1

print(cnt)

# Optimized solution
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
#la = [li[0]][li[1]]

cnt = 0

for i in range(n):
    a = list(map(int, input().split()))
    tmp = c
    for j in range(0, m):
        tmp += a[j] * b[j]
    if (tmp > 0):
        cnt += 1

print(cnt)
# Original solution
N, M, C = list(map(int, input().split()))
Blis = [int(x) for x in input().split()]
k = 0
for i in range(N):
  Alis = [int(x) for x in input().split()]
  total = 0
  for j in range(M):
    total = total + (Alis[j])*(Blis[j])
  total = total + C
  if total > 0:
    k = k + 1
print(k) 

# Optimized solution
N, M, C = list(map(int, input().split()))
Blis = [int(x) for x in input().split()]
Alis = [x for x in range(N)]
k = 0
for i in range(N):
  Alis[i] = [int(x) for x in input().split()]
for i in range(N):
  total = 0
  for j in range(M):
    total = total + (Alis[i][j])*(Blis[j])
  total = total + C
  if total > 0:
    k = k + 1
print(k)
# Original solution
N,M,C = list(map(int,input().split()))
Blist = list(map(int,input().split()))
Alist = [list(map(int,input().split())) for i in range(N)]

counter = 0

for x in range(N):
    all = C
    xlist = Alist[x]
    for j in range(M):
        all += Blist[j]*xlist[j]
    if all>0:
        counter += 1

print(counter)


# Optimized solution
N, M, C = list(map(int, input().split()))
Blist = list(map(int, input().split()))
ans = 0
for i in range(N):
    score = C
    Alist = list(map(int, input().split()))
    for j in range(M):
        score += Alist[j]*Blist[j]
    if score > 0:
        ans += 1
print(ans)
# Original solution
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for i in range(n):
    A = list(map(int, input().split()))
    s = c
    for a, b in zip(A, B):  s += a*b
    if s > 0:  ans += 1

print(ans)


# Optimized solution
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
for i in range(n):
    A = list(map(int, input().split()))
    s = c + sum([a*b for a, b in zip(A, B)])
    if s > 0:  ans += 1

print(ans)
# Original solution
n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
a=[[0] * m for _ in range(n)]
for i in range(n):
        a[i]=list(map(int,input().split()))
count=0

for i in range(n):
#     print(sum(list(map(lambda a,b:a*b,a[i],b))))
   if sum(list(map(lambda a,b:a*b,a[i],b)))+c > 0:
       count+=1
print(count)

# Optimized solution
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
    A=list(map(int,input().split()))
    if sum(a*b for a,b in zip(A,B))+C>0:count+=1
print(count)
# Original solution
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for _ in range(N):
  A = list(map(int, input().split()))
  sums = sum([A[i]*B[i] for i in range(M)])+C
  if sums > 0:
    cnt += 1
print(cnt)

# Optimized solution
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
for i in a:
  if sum([j * k for j, k in zip(i, b)]) + c > 0:
    cnt += 1
print(cnt)
# Original solution
N,M,C = list(map(int,input().split()))
B_ = list(map(int,input().split()))
A_ = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
  sum_n = 0
  for j in range(M):
    sum_n += A_[i][j]*B_[j]
  if sum_n+C > 0:
    ans += 1
print(ans)

# Optimized solution
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
count = 0
for n in range(N):
  cost = 0
  for m in range(M):
    cost += A[n][m]*B[m]
  if cost + C > 0:
    count += 1
print(count)
# Original solution

N, M, C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

cnt = 0
for a in A:
  tmp = C
  for i in range(M):
    tmp += a[i]*B[i]
  if(tmp > 0):
    cnt += 1
print(cnt)

# Optimized solution
N, M, C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

ans = 0
for a in A:
  tmp = C
  for j in range(M):
    tmp += a[j]*B[j]
  if tmp > 0:
    ans += 1
print(ans)
# Original solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0]*N
count = 0

def a_x_b(ab):
  a, b = ab
  return a*b

for n in range(N):
  A[n] = list(map(int, input().split()))
  AB = [(A[n][i], B[i]) for i in range(M)]
  if sum(list(map(a_x_b, AB)))+C > 0:
    count += 1
  else:
    continue
    
print(count)

# Optimized solution
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0]*N
count = 0

for n in range(N):
  A[n] = list(map(int, input().split()))
  
  _sum = 0
  for i in range(M):
    _sum += A[n][i] * B[i]
    
  if _sum + C > 0:
    count += 1
  else:
    continue
    
print(count)
# Original solution
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
    A=list(map(int,input().split()))
    p=C
    for j in range(M):p+=A[j]*B[j]
    if p>0:count+=1
print(count)

# Optimized solution
n,m,c = list(map(int,input().split()))
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(n)]
count=0
t=c
for i in range(n):
    for j in range(m):
        t += a[i][j]*b[j]
    if t > 0:
        count += 1
    t=c

print(count)