Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03145 (python)

Fixed submission:
ab, bc, ca = input().split()
print(int((int(ab)*int(bc))/2))

Buggy submission (verdict: Runtime Error):

def read_input1():
    n, k = map(int, input().split())

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

    return n, k, data_tuples


def count_neta(sushi_set):
    neta = {s[0] for s in sushi_set}
    return len(neta)


def sum_oishisa(sushi_set):
    oishisa = [s[1] for s in sushi_set]
    return sum(oishisa)


def check_value(sushi_set):
    neta_count = count_neta(sushi_set)
    oishisa = sum_oishisa(sushi_set)

    return oishisa + (neta_count * neta_count)


# ネタ数を減らさず、かつもっともおいしさの減少が少ないすしを探す
def check_changable_sushi(sushi_set):
    neta_count = count_neta(sushi_set)

    target = None
    for s in sushi_set:
        temp_sushi_set = sushi_set.remove(s)
        temp_neta_count = count_neta(temp_sushi_set)

        if neta_count == temp_neta_count:
            if target is None or target[1] > s[1]:
                target = s

        temp_sushi_set.append(s)
    return target


def find_other_sushi(all_sushi_set, sushi_set):
    neta_eaten = [s[0] for s in sushi_set]
    candidate_sushi = [sushi for sushi in all_sushi_set if sushi[0] not in neta_eaten]

    if candidate_sushi:
        target = max(candidate_sushi, key=lambda x: x[1])
    else:
        target = None

    return target


def next_neta_variation(all_sushi_set, sushi_set):
    drop_target = check_changable_sushi(sushi_set)
    if drop_target:
        insert_target = find_other_sushi(all_sushi_set, sushi_set)

        if insert_target:
            new_set = sushi_set.copy()
            new_set.remove(drop_target)
            new_set.append(insert_target)
            return new_set
    return None


if __name__ == '__main__':
    n, k, sushis = read_input1()
    neta_candidate = {}

    sushis.sort(key=lambda x: x[1], reverse=True)

    init_sushi_set = sushis[:k].copy()
    neta_count = count_neta(init_sushi_set)
    neta_candidate[neta_count] = init_sushi_set

    curr_sushi_set = init_sushi_set
    while True:
        next_sushi_set = next_neta_variation(sushis, curr_sushi_set)
        if not next_sushi_set:
            break

        curr_sushi_set = next_sushi_set
        neta_count = count_neta(curr_sushi_set)
        neta_candidate[neta_count] = curr_sushi_set

    max_score = -1
    for sushis in neta_candidate.values():
        score = check_value(sushis)
        if max_score < score:
            max_score = score

    print(max_score)
Problem p03309 (python)

Fixed submission:
"""
102 C
"""

import math

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))

    return n, alist


def sum_abs(alist, b):
    return sum([abs(a - b) for a in alist])


def submit():
    n, alist = read_input()

    alist = [a - (i + 1) for i, a in enumerate(alist)]
    alist.sort()

    if n % 2 == 0:
        b_min, b_max = alist[n // 2], alist[n // 2 + 1]
        print(min(sum_abs(alist, b_min), sum_abs(alist, b_max)))
    else:
        print(sum_abs(alist, alist[n // 2]))


if __name__ == "__main__":
    submit()

Buggy submission (verdict: Runtime Error):
"""
102 C
"""

import math

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))

    return n, alist


def sum_abs(alist, b):
    return sum([abs(a - b) for a in alist])


def submit():
    n, alist = read_input()

    alist = [a - (i + 1) for i, a in enumerate(alist)]
    alist.sort()

    if n % 2:
        b_min, b_max = alist[n // 2], alist[n // 2 + 1]
        print(min(sum_abs(alist, b_min), sum_abs(alist, b_max)))
    else:
        print(sum_abs(alist, alist[n // 2]))


if __name__ == "__main__":
    submit()
Problem p03455 (python)

Fixed submission:
a,b = map(int, input().split())

if (a*b)%2:
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
a,b = map(int, input())

if (a*b)%2:
  print('Odd')
else:
  print('Even')
Problem p03557 (python)

Fixed submission:

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))
    clist = list(map(int, input().split()))

    return n, alist, blist, clist


def submit():
    n, alist, blist, clist = read_input()

    alist.sort(reverse=True)
    blist.sort(reverse=True)
    clist.sort(reverse=True)

    b_a_n = [0] * n
    i = j = 0

    while j < n:
        while i < n and alist[i] >= blist[j]:
            i += 1
        b_a_n[j] = n - i
        j += 1

    b_a_sum = b_a_n.copy()
    for i in range(2, n + 1):
        b_a_sum[n - i] = b_a_sum[n - i + 1] + b_a_n[n - i]

    count = 0
    i = j = 0
    while i < n:
        while blist[j] >= clist[i]:
            j += 1
            if j == n:
                print(count)
                return
        count += b_a_sum[j]
        i += 1

    print(count)

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):

def read_input():
    n = int(input())
    alist = list(map(int, input().split()))
    blist = list(map(int, input().split()))
    clist = list(map(int, input().split()))

    return n, alist, blist, clist


def submit():
    n, alist, blist, clist = read_input()

    alist.sort(reverse=True)
    blist.sort(reverse=True)
    clist.sort(reverse=True)

    b_a_n = [0] * n
    i = j = 0

    while j < n:
        while i < n and alist[i] >= blist[j]:
            i += 1
        b_a_n[j] = n - i
        j += 1

    b_a_sum = b_a_n.copy()
    for i in range(2, n + 1):
        b_a_sum[n - i] = b_a_sum[n - i + 1] + b_a_n[n - i]

    count = 0
    i = j = 0
    while i < n:
        while blist[j] >= clist[i]:
            j += 1
            if j == n:
                print(count)
                return
        count += b_a_sum[j]
        i += 1

    print(count)



if __name__ == '__main__':
    submit()
Problem p03599 (python)

Fixed submission:

import math

def read_input():
    a, b, c, d, e, f = map(int, input().split())
    return a, b, c, d, e, f


# 100aと100bの線形結合でf以下でとりうる値を見つける
def search_water_valiation(a, b, f):
    result = []
    for i in range(30):
        for j in range(30):
            water = 100*a*i + 100*b*j
            if water <= f:
                result.append(water)

    result = list(set(result))
    result.sort()

    return result


# c, dの線形結合でmax_sugar以下の最大値を探す
# cx + dy <= max_sugarより
# y <= - c/d x + max_sugar/d
# xの範囲は(0, max_sugar/c)
def search_most_sweet(c, d, max_sugar):
    sugars = []
    for x in range(math.floor(max_sugar/c) + 1):
        y = math.floor((-c * x + max_sugar)/d)
        sugars.append(c*x + d*y)

    sugars = list(set(sugars))
    return max(sugars)

def submit():
    a, b, c, d, e, f = read_input()

    waters = search_water_valiation(a, b, f)
    max_sugars = [min(w * e // 100, f - w) for w in waters]

    result = []
    for water, max_sugar in zip(waters, max_sugars):
        sugar = search_most_sweet(c, d, max_sugar)
        result.append((water, sugar))

    result = [r for r in result if r[0] + r[1] <= f]
    result = [(w+s, s, 100 * s / (w + s)) for (w, s) in result if (w, s) != (0, 0)]

    r = max(result, key=lambda x:x[2])
    print('{} {}'.format(r[0], r[1]))

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):

import math

def read_input():
    a, b, c, d, e, f = map(int, input().split())
    return a, b, c, d, e, f


# 100aと100bの線形結合でf以下でとりうる値を見つける
def search_water_valiation(a, b, f):
    result = []
    for i in range(30):
        for j in range(30):
            water = 100*a*i + 100*b*j
            if water <= f:
                result.append(water)

    result = list(set(result))
    result.sort()

    return result


# c, dの線形結合でmax_sugar以下の最大値を探す
# cx + dy <= max_sugarより
# y <= - c/d x + max_sugar/d
# xの範囲は(0, max_sugar/c)
def search_most_sweet(c, d, max_sugar):
    sugars = []
    for x in range(math.floor(max_sugar/c) + 1):
        y = math.floor((-c * x + max_sugar)/d)
        sugars.append(c*x + d*y)

    sugars = list(set(sugars))
    return max(sugars)

def submit():
    a, b, c, d, e, f = read_input()

    waters = search_water_valiation(a, b, f)
    max_sugars = [w * e // 100 for w in waters]

    result = []
    for water, max_sugar in zip(waters, max_sugars):
        sugar = search_most_sweet(c, d, max_sugar)
        result.append((water, sugar))

    result = [r for r in result if r[0] + r[1] <= f]
    result = [(w+s, s, 100 * s / (w + s)) for (w, s) in result if (w, s) != (0, 0)]

    r = max(result, key=lambda x:x[2])
    print('{} {}'.format(r[0], r[1]))

if __name__ == '__main__':
    submit()
Problem p03632 (python)

Fixed submission:

def read_input():
    a, b, c, d = map(int, input().split())

    return a, b, c, d

def submit():
    a, b, c, d = read_input()

    if b < c or d < a:
        print(0)
        return

    if a < c:
        if d <= b:
            print(d - c)
        else:
            print(b - c)
    else:
        if b <= d:
            print(b - a)
        else:
            print(d - a)
    return

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):


def read_input():
    a, b, c, d = map(int, input().split())

    return a, b, c, d

def submit():
    a, b, c, d = read_input()

    if b < c or d < a:
        print(0)
        return

    if a < c:
        if d <= b:
            print(d - c)
        else:
            print(b - c)
    else:
        if b <= d:
            print(b - a)
        else:
            print(d - a)



if __name__ == '__main__':
    sub
Problem p03633 (python)

Fixed submission:


def read_input():
    n = int(input())
    tlist = []
    for i in range(n):
        tlist.append(int(input()))

    return n, tlist


def mygcd(a, b):
    if b == 0:
        return a
    return mygcd(b, a % b)


def mylcm(a, b):
    g = mygcd(a, b)
    return a * b // g


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)


if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):


def read_input():
    n = int(input())
    tlist = []
    for i in range(n):
        tlist.append(int(input()))

    return n, tlist

gcdmemo = {}

def mygcd(a, b):
    if b == 0:
        return a

    if not (a, b) in gcdmemo.keys():
        gcdmemo[(a, b)] = mygcd(b, a % b)

    return gcdmemo[(a, b)]


def mylcm(a, b):
    g = mygcd(a, b)
    if g != 0:
        return int(a * b / g)
    return a * b


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):
def read_input():
    n = int(input())
    tlist = []
    for i in range(n):
        tlist.append(int(input()))

    return n, tlist


def mygcd(a, b):
    if b == 0:
        return a
    return mygcd(b, a % b)


def mylcm(a, b):
    g = mygcd(a, b)
    return int(a * b / g)


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):
def read_input():
    n = int(input())
    tlist = []
    for i in range(n):
        tlist.append(int(input()))

    return n, tlist


def mygcd(a, b):
    if b == 0:
        return a
    return mygcd(b, a % b)


def mylcm(a, b):
    g = mygcd(a, b)
    return int(a * b / g)


def submit():
    n, tlist = read_input()

    acc = 1
    for t in tlist:
        acc = mylcm(acc, t)

    print(acc)

if __name__ == '__main__':
    submit()
Problem p03837 (python)

Fixed submission:


def warshall_floyd(d, n):
    # d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


def read_input():
    n, m = map(int, input().split())

    edges = []
    for i in range(m):
        a, b, c = map(int, input().split())
        edges.append((a - 1, b - 1, c))

    return n, m, edges

def submit():
    n, m, edges = read_input()

    # 全ノード間の最短経路を求める
    d = [[float('inf') for _ in range(n)] for _ in range(n)]

    for edge in edges:
        d[edge[0]][edge[1]] = edge[2]
        d[edge[1]][edge[0]] = edge[2]

    for i in range(n):
        d[i][i] = 0

    d = warshall_floyd(d, n)

    # 各edgeについていずれかの2点間の最短経路に含まれうるか確認する
    edge_inuse = [0 for _ in range(m)]
    for e, edge in enumerate(edges):
        for i in range(n):
            for j in range(n):
                dist1 = d[i][j]
                dist2 = d[i][edge[0]] + edge[2] + d[edge[1]][j]

                if dist1 == dist2:
                    edge_inuse[e] = 1
                    break

            if edge_inuse[e] == 1:
                break

    print(m - sum(edge_inuse))
    return


if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):


def warshall_floyd(d, n):
    # d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


def read_input():
    n, m = map(int, input().split())

    edges = []
    for i in range(m):
        a, b, c = map(int, input().split())
        edges.append((a - 1, b - 1, c))

    return n, m, edges

def submit():
    n, m, edges = read_input()

    # 全ノード間の最短経路を求める
    d = [[float('inf') for _ in range(n)] for _ in range(n)]

    for edge in edges:
        d[edge[0]][edge[1]] = edge[2]
        d[edge[1]][edge[0]] = edge[2]

    for i in range(n):
        d[i][i] = 0

    d = warshall_floyd(d, n)

    # 各edgeについていずれかの2点間の最短経路に含まれうるか確認する
    edge_inuse = [0 for _ in range(n)]
    for e, edge in enumerate(edges):
        for i in range(n):
            for j in range(n):
                dist1 = d[i][j]
                dist2 = d[i][edge[0]] + edge[2] + d[edge[1]][j]

                if dist1 == dist2:
                    edge_inuse[e] = 1
                    break

            if edge_inuse[e] == 1:
                break

    print(m - sum(edge_inuse))
    return


if __name__ == '__main__':
    submit()
Problem p03847 (python)

Fixed submission:

def read_input():
    n = int(input())
    return n


def mymod(x):
    return x % (10**9 + 7)


def submit():
    N = read_input()
    N = list(map(int, list(bin(N)[2:])))

    dp = [[0]*(3) for _ in range(len(N) + 1)]
    dp[len(N)][0] = 1

    for i in range(len(N) - 1, -1, -1):
        for s in range(3):
            for k in range(3):
                new_s = 2 * s + N[len(N) - i - 1] - k
                if new_s < 0:
                    continue
                if new_s > 2:
                    new_s = 2
                dp[i][new_s] += dp[i + 1][s]
            dp[i][0] = mymod(dp[i][0])
            dp[i][1] = mymod(dp[i][1])
            dp[i][2] = mymod(dp[i][2])

    print(mymod((dp[0][0] + dp[0][1] + dp[0][2])))


if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):
import numpy as np


def read_input():
    n = int(input())
    return n


def mymod(x):
    return x % (10**9 + 7)


def submit():
    N = read_input()
    N = list(map(int, list(bin(N)[2:])))

    dp = np.zeros((len(N) + 1, 3))
    dp[len(N)][0] = 1

    for i in range(len(N) - 1, -1, -1):
        for s in range(3):
            for k in range(3):
                new_s = 2 * s + N[len(N) - i - 1] - k
                if new_s < 0:
                    continue
                if new_s > 2:
                    new_s = 2
                dp[i][new_s] += mymod(dp[i + 1][s])
            dp[i][0] = mymod(dp[i][0])
            dp[i][1] = mymod(dp[i][1])
            dp[i][2] = mymod(dp[i][2])

    print(int(sum(dp[0])) % (10**9 + 7))

if __name__ == '__main__':
    submit()
Problem p03964 (python)

Fixed submission:
import math


def read_input():
    n = int(input())

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

    return n, ratios


def get_votes(ex_votes, ratio):
    def check_votes(a, b):
        return a[0] <= b[0] and a[1] <= b[1]

    def div_ceil(a, b):
        if a % b == 0:
            return a //b
        else:
            return a // b + 1

    base = div_ceil(sum(ex_votes), (ratio[0] + ratio[1]))
    base = int(base)
    while True:
        test_votes = (ratio[0] * base, ratio[1] * base)
        if check_votes(ex_votes, test_votes):
            return test_votes
        else:
            diff_votes = (test_votes[0] - ex_votes[0], test_votes[1] - ex_votes[1])
            if diff_votes[0]/ratio[0] < diff_votes[1]/ratio[1]:
                base += div_ceil(-diff_votes[0], ratio[0])
            else:
                base += div_ceil(-diff_votes[1], ratio[1])
            base = int(base)


def submit():
    n, ratios = read_input()

    votes = ratios[0]
    for ratio in ratios[1:]:
        votes = get_votes(votes, ratio)

    print(sum(votes))


if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):

import math

def read_input():
    n = int(input())

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

    return n, ratios


def get_votes(ex_votes, ratio):
    base = max(math.ceil(ex_votes[0]/ratio[0]), math.ceil(ex_votes[1]/ratio[1]))
    return (base * ratio[0], base * ratio[1])


def submit():
    n, ratios = read_input()

    votes = ratios[1]
    for ratio in ratios[1:]:
        votes = get_votes(votes, ratio)

    print(sum(votes))


if __name__ == '__main__':
    submit()
Problem p03999 (python)

Fixed submission:

from itertools import combinations


def read_input():
    s = input().strip()
    return s

def split_and_sum(s, indice):
    indice_e = [0] + indice + [10]

    result = []
    for start,end in zip(indice_e, indice_e[1:]):
        result.append(int(s[start:end]))

    return sum(result)

def submit():
    s = read_input()
    max_index = len(s)

    acc = 0
    for i in range(max_index):
        for c in combinations(range(1, max_index), i):
            acc += split_and_sum(s, list(c))

    print(acc)

if __name__ == '__main__':
    submit()

Buggy submission (verdict: Runtime Error):

from itertools import combinations


def read_input():
    s = input().strip()
    return s

def split_and_sum(s, indice):
    indice_e = [0, *indice, 10]

    result = []
    for start,end in zip(indice_e, indice_e[1:]):
        result.append(int(s[start:end]))

    return sum(result)

def submit():
    s = read_input()
    max_index = len(s)

    acc = 0
    for i in range(max_index):
        for c in combinations(range(1, max_index), i):
            acc += split_and_sum(s, c)

    print(acc)

if __name__ == '__main__':
    submit()
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
ubkookoookyfyut

Buggy submission (verdict: Runtime Error):
unko

Buggy submission (verdict: Runtime Error):
afgdgrh
Problem p02756 (python)

Fixed submission:
from collections import deque

s = input()
q = int(input())
revflag = 1
d = deque(s)
for i in range(q):
	tfc = list(map(str, input().split()))
	if tfc[0] == '1':
		revflag *= -1
	elif tfc[1] == '1':
		if revflag > 0:
			d.appendleft(tfc[2])
		else:
			d.append(tfc[2])
	else:
		if revflag > 0:
			d.append(tfc[2])
		else:
			d.appendleft(tfc[2])
if revflag > 0:
	print(''.join(d))
else:
	print(''.join(reversed(d)))

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for i in range(q):
	t, f, c = map(str, input().split())
	if t == '1':
		s = s[::-1]
	elif f == '1':
			s = c + s
	else:
			s += c
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
for i in range(q):
	t, f, c = map(str, input().split())
	if t == '1':
		s = s[::-1]
	elif f == '1':
			s = c + s
	else:
			s += c
print(s)
Problem p03059 (python)

Fixed submission:
A,B,T = map(int, input().split())
X = T//A
print(B*X)

Buggy submission (verdict: Runtime Error):
A,B,T = map(int, input()split())
X = (T+0.5)/A
print(B*X)
Problem p03060 (python)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
P = []
for i in range(N):
    p = V[i]-C[i]
    if p >0:
    	P.append(p)

print(sum(P))

Buggy submission (verdict: Runtime Error):
N = int(input().split())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
P = []
for i in range(N):
    p = V[i]-C[i]
    if p >0:
    	P.append(p)

print(sum(P))
Problem p03085 (python)

Fixed submission:
b = input()
if b == "A":
    print("T")

elif b =="T":
    print("A")

elif b =="C":
    print("G")

elif b == "G":
    print("C")

Buggy submission (verdict: Runtime Error):
b = input()
if b == "A":
    print("T")

elif b =="T":
    print("A")

elif b =="C":
    print("G")

elif b == "G":
    pritn("C")
Problem p03086 (python)

Fixed submission:
s = input()
n = len(s)
a = "BDEFHIJKLMNOPQRSUVWXYZ"
cnt = []
for i in range(0, n):
    for j in range(i,n+1):
    	fr = s[i:j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
a = "BDEFHIJKLMNOPQRSUVWXYZ"
cnt = []
for i in range(n):
    for j in range(i,n+1):
    	fr = s[i;j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
a = [B,D,E,F,H,I,J,K,L,M,N,O,P,Q,R,S,U,V,W,X,Y,Z]
cnt = []
for i in range(n):
    for j in range(i,n+1):
    	fr = s[i;j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
a = [B,D,E,F,H,I,J,K,L,M,N,O,P,Q,R,S,U,V,W,X,Y,Z]
cnt = []
for i in range(n):
    for j in range(i,n+1):
    	fr = s[i;j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
print(max(cnt))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N):
    t[i+1]=t[i] + (1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
R = [list(map(int, input().split)) for i in range(Q)]
ans = []
for i in range(Q):
    x = R[i][0]-1
    y = R[i][1]
    a=S[x:y].count("AC")
    ans.append(a)

for i in range(Q):
    print(ans[i])
Problem p03102 (python)

Fixed submission:
import numpy as np
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
A = [[int(i) for i in input().split()] for i in range(n)]
B = np.array(b).reshape(m,1)
cnt = 0
for i in range(n):
    x = np.dot(A[i], B)+c
    if x >0:
    	cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
A = [[int(i) for i in input().split()] for i in range(n)]
B = np.array(b).reshape(m,1)
cnt = 0
for i in range(m):
    x = np.dot(A[i], B)+c
    if x >0:
    	cnt += 1
    print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
A = [[int(i) for i in input().split()] for i in range(n)]
B = np.array(b).reshape(m,1)
cnt = 0
for i in range(m):
    x = np.dot(A[i], B)+c
    if x >0:
    	cnt += 1

print(cnt)