Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
card = []
suit = ["S","H","C","D"]
for s in suit:
    for i in range(1,14):
        card.append(s + " " + str(i))

n = int(input())
for i in range(n)
    card.remove(input())

for c in card:
	print(c)

Fixed submission:
card = []
suit = ["S","H","C","D"]
for s in suit:
    for i in range(1,14):
        card.append(s + " " + str(i))

n = int(input())
for i in range(n):
    card.remove(input())

for c in card:
	print(c)
Buggy python submission (verdict: Runtime Error):
of = [[0 for i in range(10)] for j in range(12)]

n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    of[3*(b-1)+f][r] += v

for i in range(12):
    if i%3 == 0:
        print("####################")
    for j in range(10):
        print(" ",of[i][j],sep="",end="")
    print("")

Fixed submission:
of = [[0 for i in range(10)] for j in range(12)]

n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    of[3*(b-1)+f-1][r-1] += v

for i in range(12):
    if i%3 == 0 and i !=0:
        print("####################")
    for j in range(10):
        print(" ",of[i][j],sep="",end="")
    print("")
Buggy python submission (verdict: Runtime Error):
r,c = map(int,input().split())

a = [[0 for i in range(c+1)] for j in range(r+1)]

for i in range(r):
    a_tmp = list(map(int,input().split()))
    for j in range(c):
        a[i][j] = a_tmp[j]
        a[i][c+1] += a_tmp[j]
        a[r+1][j] += a_tmp[j]
        a[r+1][c+1] += a_tmp[j]

for i in range(r+1):
    print(' '.join(x for x in a[i]))

Fixed submission:
r,c = map(int,input().split())

a = [[0 for i in range(c+1)] for j in range(r+1)]

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

for i in range(r+1):
    print(' '.join(str(x) for x in a[i]))

Buggy python submission (verdict: Runtime Error):
r,c = map(int,input().split())

a = [[0 for i in range(c+1)] for j in range(r+1)]

for i in range(r):
    a_tmp = list(map(int,input().split()))
    for j in range(c):
        a[i][j] = a_tmp[j]
        a[i][c+1] += a_tmp[j]
        a[r+1][j] += a_tmp[j]
        a[r+1][c+1] += a_tmp[j]

for i in range(r+1):
    print(' '.join(str(x) for x in a[i]))

Fixed submission:
r,c = map(int,input().split())

a = [[0 for i in range(c+1)] for j in range(r+1)]

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

for i in range(r+1):
    print(' '.join(str(x) for x in a[i]))
Buggy python submission (verdict: Runtime Error):
import sys

w = input()
t = sys.stdin.read().split()
print(t.lower().count(w))

Fixed submission:
import sys

w = input()
t = sys.stdin.read().lower().split()
print(t.count(w))

Buggy python submission (verdict: Runtime Error):
import sys

w = input()
t = sys.stdin.read().split()
print(t.lower().count(w))

Fixed submission:
import sys

w = input()
t = sys.stdin.read().lower().split()
print(t.count(w))
Buggy python submission (verdict: Runtime Error):
import Queue
blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]]
dxy = [[0,1], [1,0], [0,-1], [-1,0]]
q = Queue.Queue()
W, H = 0, 0

def checker(xs, ys, xg, yg, field, color):
  if color == 0:
    return False
  global W, H
  x = xs
  y = ys
  while True:
    if x == xg and y == yg:
      return True
    for dx, dy in dxy:
      if x+dx < 1 or y+dy < 1 or x+dx > H or y+dx > W:
        continue
      if field[x+dx][y+dy] == color:
        field[x+dx][y+dy] = 0
        q.put([x+dx, y+dy])
    if q.empty():
      return False
    x, y = q.get()


while True:
  # input
  W, H = map(int, raw_input().split())
  if W==0 and H==0:
    break
  field = [[0 for i in range(W+1)] for j in range(H+1)]
  xs, ys = map(int, raw_input().split())
  xg, yg = map(int, raw_input().split())
  n = int(raw_input())
  for i in range(n):
    c, d, x, y = map(int, raw_input().split())
    for dx, dy in blockpos[d]:
      field[x+dx][y+dy] = c
  result = checker(xs, ys, xg, yg, field, field[xs][ys])
  if result:
    print "OK"
  else:
    print "NG"

Fixed submission:
import Queue
blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]]
dxy = [[0,1], [1,0], [0,-1], [-1,0]]
q = Queue.Queue()
W, H = 0, 0

def checker(xs, ys, xg, yg, field, color):
  if color == 0:
    return False
  global W, H
  x = xs
  y = ys
  while True:
    if x == xg and y == yg:
      return True
    for dx, dy in dxy:
      if x+dx < 1 or y+dy < 1 or x+dx > W or y+dy > H:
        continue
      if field[x+dx][y+dy] == color:
        field[x+dx][y+dy] = 0
        q.put([x+dx, y+dy])
    if q.empty():
      return False
    x, y = q.get()


while True:
  # input
  W, H = map(int, raw_input().split())
  if W==0 and H==0:
    break
  field = [[0 for i in range(H+1)] for j in range(W+1)]
  xs, ys = map(int, raw_input().split())
  xg, yg = map(int, raw_input().split())
  n = int(raw_input())
  for i in range(n):
    c, d, x, y = map(int, raw_input().split())
    for dx, dy in blockpos[d]:
      field[x+dx][y+dy] = c
  result = checker(xs, ys, xg, yg, field, field[xs][ys])
  if result:
    print "OK"
  else:
    print "NG"
Buggy python submission (verdict: Runtime Error):
import sys

def dijkstra(nodes, start, matrix):
  defnode = [False] * (nodes)
  cost = [sys.maxint] * (nodes)
  cost[start] = 0
  node = start
  counter = 0
  while True:
    counter += 1
    if counter == nodes:
      return cost
    defnode[node] = True
    for i in xrange(1, nodes):
      if defnode[i]:
        continue
      if matrix[node][i] == sys.maxint:
        continue
      cost[i] = min(cost[i], cost[node]+matrix[node][i])
    minnode = sys.maxint
    mincost = sys.maxint
    for i in xrange(1, nodes):
      if defnode[i]:
        continue
      if cost[i] < mincost:
        minnode = i
        mincost = cost[i]
    node = minnode

def get_state(a, c, k):
  return (a-1) * (c+1) + k

while True:
  c,n,m,s,d = map(int, raw_input().split())
  if c == 0:
    break
  matrix = [[sys.maxint] * n*(c+1) for i in xrange(n*(c+1))]
  for i in xrange(m):
    a,b,f = map(int, raw_input().split())
    # no use ticket
    for i in xrange(c+1):
      matrix[get_state(a, c, i)][get_state(b, c, i)] = f
      matrix[get_state(b, c, i)][get_state(a, c, i)] = f
    # use ticket
    for i in xrange(c):
      matrix[get_state(a, c, i)][get_state(b, c, i+1)] = f/2
      matrix[get_state(b, c, i)][get_state(a, c, i+1)] = f/2
  costs = dijkstra(n*(c+1), get_state(s, c, 0), matrix)
  mincost = sys.maxint
  for i in xrange(c+1):
    mincost = min(mincost, costs[get_state(d, c, i)])
  print mincost

Fixed submission:
import sys
 
def dijkstra(nodes, start, matrix):
  defnode = [False] * (nodes)
  cost = [sys.maxint] * (nodes)
  cost[start] = 0
  node = start
  counter = 0
  while True:
    counter += 1
    if counter == nodes or node == sys.maxint:
      return cost
    defnode[node] = True
    for i in xrange(nodes):
      if defnode[i]:
        continue
      if matrix[node][i] == sys.maxint:
        continue
      cost[i] = min(cost[i], cost[node]+matrix[node][i])
    minnode = sys.maxint
    mincost = sys.maxint
    for i in xrange(nodes):
      if defnode[i]:
        continue
      if cost[i] < mincost:
        minnode = i
        mincost = cost[i]
    node = minnode

def get_state(a, c, k):
  return (a-1) * (c+1) + k
 
while True:
  c,n,m,s,d = map(int, raw_input().split())
  if c == 0:
    break
  matrix = [[sys.maxint] * n*(c+1) for i in xrange(n*(c+1))]
  for i in xrange(m):
    a,b,f = map(int, raw_input().split())
    # no use ticket
    for i in xrange(c+1):
      matrix[get_state(a, c, i)][get_state(b, c, i)] = f
      matrix[get_state(b, c, i)][get_state(a, c, i)] = f
    # use ticket
    for i in xrange(c):
      matrix[get_state(a, c, i)][get_state(b, c, i+1)] = f/2
      matrix[get_state(b, c, i)][get_state(a, c, i+1)] = f/2
  costs = dijkstra(n*(c+1), get_state(s, c, 0), matrix)
  mincost = sys.maxint
  for i in xrange(c+1):
    mincost = min(mincost, costs[get_state(d, c, i)])
  print mincost
Buggy python submission (verdict: Runtime Error):
while True:
  n,m,a = map(int, raw_input().split())
  if n==m==a==0: break
  lst = [0] * n
  for i in xrange(n):
    lst[i] = i
  ms = {}
  for _ in xrange(n):
    h,p,q = map(int, raw_input().split())
    if h not in ms:
      ms[h] = {}
    ms[h][p] = q
  for i,v in sorted(ms.items()):
    for k,l in v.items():
      tmp = lst[k-1]
      lst[k-1] = lst[l-1]
      lst[l-1] = tmp
  print lst[a-1]+1

Fixed submission:
while True:
  n,m,a = map(int, raw_input().split())
  if n==m==a==0: break
  lst = [0] * n
  for i in xrange(n):
    lst[i] = i
  ms = {}
  for _ in xrange(m):
    h,p,q = map(int, raw_input().split())
    if h not in ms:
      ms[h] = {}
    ms[h][p] = q
  for i,v in sorted(ms.items()):
    for k,l in v.items():
      tmp = lst[k-1]
      lst[k-1] = lst[l-1]
      lst[l-1] = tmp
  print lst[a-1]+1
Buggy python submission (verdict: Runtime Error):
from collections import deque

class Process:
  def __init__(self, name, time):
    self.name = name
    self.time = time

  def getName(self):
    return self.name

  def getTime(self):
    return self.time

  def setTime(self, time):
    self.time = time

queue = deque()
n, q = map(int, raw_input().split())
for _ in xrange(n):
  name, time = raw_input().split()
  queue.append(Process(name, int(time)))
t = 0
while nameq:
  p = queue.popleft()
  if p.getTime() > q:
    p.setTime(p.getTime()-q)
    queue.append(p)
    t += q
  else:
    t += time
    print "%s %d" % (p.getName(), p.getTime())

Fixed submission:
from collections import deque

nameq = deque()
timeq = deque()
n, q = map(int, raw_input().split())
for _ in xrange(n):
  name, time = raw_input().split()
  nameq.append(name)
  timeq.append(int(time))

t = 0
while nameq:
  name = nameq.popleft()
  time = timeq.popleft()
  if time > q:
    time -= q
    nameq.append(name)
    timeq.append(time)
    t += q
  else:
    t += time
    print "%s %d" % (name, t)
Buggy python submission (verdict: Time Limit Exceeded):
class UnionFind:
  def __init__(self, size):
    self.table = [-1 for _ in xrange(size)]

  def find(self, x):
    while self.table[x] >= 0: x = self.table[x]
    return x

  def union(self, x, y):
    s1 = self.find(x)
    s2 = self.find(y)
    if s1 != s2:
      if self.table[s1] >= self.table[s2]:
        self.table[s1] += self.table[s2]
        self.table[s2] = s1
      else:
        self.table[s2] += self.table[s1]
        self.table[s1] = s2
      return True
    return False

def hash(n, s, g):
  return n*s+g

def dehash(n, hs):
  return [(hs-hs%n)/n, hs%n]

def kruskal(n, path):
  path = sorted(path.items(), key=lambda x:x[1])
  selected = {}
  union = UnionFind(n)
  for i in xrange(len(path)):
    k,v = path[i]
    s,g = dehash(n, k)
    if union.union(s, g):
      selected[k] = v
  return selected

V,E = map(int, raw_input().split())
path = {}
for _ in xrange(E):
  s,t,w = map(int, raw_input().split())
  path[hash(V, s, t)] = w
result = kruskal(V, path)
sumcost = 0
for v in result.values():
  sumcost += v
print sumcost

Fixed submission:
import heapq

def prim(n, path):
  selected = {}
  paths = []
  hq = []
  selected[0] = True

  if 0 not in path:
    return []

  for s,d,w in path[0]:
    heapq.heappush(hq, (w, [0,d,w]))

  while len(hq) != 0:
    k,root = heapq.heappop(hq)
    if root[1] in selected: continue
    selected[root[1]] = True
    paths.append(root)
    for s,d,w in path[root[1]]:
      heapq.heappush(hq, (w, [s,d,w]))
  return paths

V,E = map(int, raw_input().split())
path = {}
for _ in xrange(E):
  s,t,w = map(int, raw_input().split())
  if s not in path:
    path[s] = []
  path[s].append([s,t,w])
  if t not in path:
    path[t] = []
  path[t].append([t,s,w])
result = prim(V, path)
sumcost = 0
for s,d,v in result:
  sumcost += v
print sumcost
Buggy python submission (verdict: Runtime Error):
m=[0,1,0,0,0,0,1,0]
(a, b, c) = map(int, raw_input().split())
print ["Close", "Open"][a * 4 + b * 2 + c]

Fixed submission:
m=[0,1,0,0,0,0,1,0]
(a, b, c) = map(int, raw_input().split())
print ["Close", "Open"][m[a * 4 + b * 2 + c]]
Buggy python submission (verdict: Runtime Error):
a = 0
o = ""
while True:
  s = raw_input()
  if s == "=":
    break
  if s in ["+", "-", "*", "/"]:
    o = s
  else:
    a = eval(str(a) + o + s)
print a

Fixed submission:
(a, o) = ("", "")
while True:
  s = raw_input()
  if s == "=":
    break
  if s in ["+", "-", "*", "/"]:
    o = s
  else:
    a = eval(str(a) + o + s)
print a
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def main():
  while True:
    n = input()
    if not n: break

    w = 0
    a = [0, 0]
    ans = 0
    for s in raw_input().split():
      f = 0 if s[0] == "l" else 1
      u = 0 if s[1] == "d" else 1
      a[f] = u
      if w == 0 and a[0] == 1 and a[1] == 1:
        w = 1
        ans += 1
      elif w == 1 and a[0] == 0 and a[1] == 0:
        w = 0
        ans += 1

    print ans

  return 0

## -------------------------------------------
## TEMPLATE

if __name__ == "__main__":
  setrecursionlimit(1024 * 1024)
  main()

Fixed submission:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

def main():
  while True:
    n = input()
    if not n: break

    w = 0
    a = [0, 0]
    ans = 0
    for s in raw_input().split():
      f = 0 if s[0] == "l" else 1
      u = 0 if s[1] == "d" else 1
      a[f] = u
      if w == 0 and a[0] == 1 and a[1] == 1:
        w = 1
        ans += 1
      elif w == 1 and a[0] == 0 and a[1] == 0:
        w = 0
        ans += 1

    print ans

  return 0

## -------------------------------------------
## TEMPLATE

from sys import stdin
from sys import setrecursionlimit
from copy import deepcopy
from math import sqrt
from itertools import permutations
from itertools import combinations

def getline():
  return stdin.readline()

def getLineAs(tp):
  return map(tp, getline().split())

def array(n, init = 0):
  return [deepcopy(init) for i in range(n)]

if __name__ == "__main__":
  setrecursionlimit(1024 * 1024)
  main()
Buggy python submission (verdict: Runtime Error):
while True:
  t = raw_input().split(',')
  l = [int(x) for x in t[:10]]
  v = [int(x) for x in t[10:]]
  time = float(sum(l)) / float(sum(v))
  dis = time * float(v[0])

  s = 0
  for (i, x) in enumerate(l):
    s += x
    if s >= int(dis):
      print i + 1
      break

Fixed submission:
import sys

for line in iter(sys.stdin.readline, ''):
  t = line.strip().split(',')
  l = [int(x) for x in t[:10]]
  v = [int(x) for x in t[10:]]
  time = float(sum(l)) / float(sum(v))
  dis = time * float(v[0])

  s = 0
  for (i, x) in enumerate(l):
    s += x
    if s >= int(dis):
      print i + 1
      break
Buggy python submission (verdict: Runtime Error):
def cross(p0, p1, p2):
  dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
  dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
  return True if dy2 * dx1 > dy1 * dx2 else False
 
while True:
  l = [float(x) for x in raw_input().split(',')]
  a = l[0:2]
  b = l[2:4]
  c = l[4:6]
  d = l[6:8]
  if((cross(a, c, b) != cross(a, c, d)) and (cross(b, d, a) != cross(b, d, c))):
    print 'YES'
  else:
    print 'NO'

Fixed submission:
import sys

def cross(p0, p1, p2):
  dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
  dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
  return dy2 * dx1 - dy1 * dx2
 
for line in iter(sys.stdin.readline, ''):
  l = [float(r) for r in line.split(',')]
  a, b, c, d = l[0:2], l[2:4], l[4:6], l[6:8]
  print 'YES' if (cross(a, c, b) * cross(a, c, d)) < 0 and (cross(b, d, a) * cross(b, d, c) < 0) else 'NO'

Buggy python submission (verdict: Runtime Error):
def cross(p0, p1, p2):
  dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
  dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
  return dy2 * dx1 - dy1 * dx2
 
while True:
  line = raw_input()
  l = [float(r) for r in line.split(',')]
  a, b, c, d = l[0:2], l[2:4], l[4:6], l[6:8]
  print 'YES' if (cross(a, c, b) * cross(a, c, d)) < 0 and (cross(b, d, a) * cross(b, d, c) < 0) else 'NO'

Fixed submission:
import sys

def cross(p0, p1, p2):
  dx1, dx2 = p1[0] - p0[0], p2[0] - p0[0]
  dy1, dy2 = p1[1] - p0[1], p2[1] - p0[1]
  return dy2 * dx1 - dy1 * dx2
 
for line in iter(sys.stdin.readline, ''):
  l = [float(r) for r in line.split(',')]
  a, b, c, d = l[0:2], l[2:4], l[4:6], l[6:8]
  print 'YES' if (cross(a, c, b) * cross(a, c, d)) < 0 and (cross(b, d, a) * cross(b, d, c) < 0) else 'NO'
Buggy python submission (verdict: Runtime Error):
import math

i, size = 0, 0
rs = []
while True:
    line = raw_input()
    if line == '0 0 0':
        for r in rs:
            if size <= r:
                print 'OK'
            else:
                print 'NA'
        break
    else:
        i += 1
    if i == 1:
        t = [int(n) for n in line.split()]
        t.sort()
        size = int(math.ceil(math.sqrt(t[0] * t[0] + t[1] * t[1])))
    if i > 2:
        rs.append(int(line))

Fixed submission:
import math

results = []
while True:
    line = raw_input()
    if line == '0 0 0':
        for r in results:
            print r
        break
    else:
        t = [int(n) for n in line.split()]
        t.sort()
        size = math.sqrt(t[0] * t[0] + t[1] * t[1])
        entry = input()
        for i in range(entry):
            if float(2 * input()) > size:
                results.append('OK')
            else:
                results.append('NA')
Buggy python submission (verdict: Runtime Error):
def form_check(t):
    plus = t.index('+')
    equal = t.index('=')
    if len(t[:plus]) > 1 or len(t[plus + 1:equal]) > 1 or len(t[equal + 1:]  > 1):
        return False
    return True

def check(t):
    equal = t.index('=')
    if eval(t[:equal]) == eval(t[equal + 1:]):
        return True
    else:
        return False

while True:
    try:
        line = raw_input()
    except EOFError:
        break

    if form_check(line):
        nums = range(0, 10)
    else:
        nums = range(1, 10)
    a = -1
    for num in nums:
        if check(line.replace('X', str(num))):
            a = num
    if a >= 0:
        print a
    else:
        print 'NA'

Fixed submission:
def form_check(t):
    plus = t.index('+')
    equal = t.index('=')
    n = [t[:plus], t[plus + 1:equal], t[equal + 1:]]
    for a in n:
        if len(a) > 1 and a[0] == 'X':
            return False
    return True

def check(t):
    if eval(t.replace('=', ' == ')):
        return True
    else:
        return False

while True:
    try:
        line = raw_input()
    except EOFError:
        break

    if form_check(line):
        nums = range(0, 10)
    else:
        nums = range(1, 10)
    a = -1
    for num in nums:
        if check(line.replace('X', str(num))):
            a = num
    if a >= 0:
        print a
    else:
        print 'NA'
Buggy python submission (verdict: Runtime Error):
# encoding: 'utf-8'

N = int(input())
ls = list()
for _ in range(N):
    e = sorted([int(x) for x in split(input())])
    if e in ls:
        continue
    else:
        ls.append(e)
print(N - len(ls))

Fixed submission:
# encoding: 'utf-8'

N = int(input())
ls = list()

for _ in range(N):
    e = sorted([int(x) for x in input().split()])
    if e in ls:
        continue
    else:
        ls.append(e)
print(N - len(ls))
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
print a*b

Fixed submission:
xs = map(int,raw_input().split())
a = xs[0]
b = xs[1]
print a*b, 2*(a+b)
Buggy python submission (verdict: Runtime Error):
def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    else if a < b:
        print "a < b"
    else :
        print "a == b"

Fixed submission:
def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    elif a < b:
        print "a < b"
    else :
        print "a == b"

aizu001()

Buggy python submission (verdict: Runtime Error):
def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    else if a < b:
        print "a < b"
    else :
        print "a == b"

aizu001 ()

Fixed submission:
def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    elif a < b:
        print "a < b"
    else :
        print "a == b"

aizu001()
Buggy python submission (verdict: Runtime Error):
import scipy as np

def az18_2():
    n,m = map(int,raw_input().split())
    a = np.array([map(int, raw_input().split()) for i in range(n)])
    b = np.array([input() for i in range(m)])
    for i in range(n):
        print a.dot(b)[i]
az18_2()

Fixed submission:
def az18():
    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)]
    for i in range(n):
        a[i] = map(int,raw_input().split())
    for i in range(m):
        b[i] = input()
    for i in range(n):
        t = map(lambda (x,y): x*y, zip(a[i],b))
        print sum(t)
        
    
    
az18()

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

def az18_2():
    n,m = map(int,raw_input().split())
    a = np.array([map(int, raw_input().split()) for i in range(n)])
    b = np.array([input() for i in range(m)])
    for i in range(n):
        print a.dot(b)[i]
az18_2()

Fixed submission:
def az18():
    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)]
    for i in range(n):
        a[i] = map(int,raw_input().split())
    for i in range(m):
        b[i] = input()
    for i in range(n):
        t = map(lambda (x,y): x*y, zip(a[i],b))
        print sum(t)
        
    
    
az18()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
while 1:
    n=int(raw_input())
    if n==0: break
    h1=map(int, raw_input().split())
    for h in h1:
        h2=[ x for x in h1 if x!=h ]
        g=[ h2[i+1]-h2[i] for i in range(n-1) ]
        if len(set(g))==1:
            print h
            break

Fixed submission:
import sys,math
for line in sys.stdin.readlines():
    V=float(line.rstrip())
    N=0
    while 1:
        N+=1
        v=9.8*math.sqrt((5*N-5)/4.9)
        if V-v<=0: break
    print N
Buggy python submission (verdict: Runtime Error):
import sys
for rec in sys.stdin.readlines():
    while len(d)>1:
        tmp=[]
        for i in range(1,len(d)):
            tmp.append((d[i-1]+d[i])%10)
        d=tmp
    print d[0]

Fixed submission:
import sys
for rec in sys.stdin.readlines():
    d=map(int,list(rec.rstrip()))
    while len(d)>1:
        tmp=[]
        for i in range(1,len(d)):
            tmp.append((d[i-1]+d[i])%10)
        d=tmp
    print d[0]
Buggy python submission (verdict: Runtime Error):
import re
print sum(map(int,re.sub("\w+"," ",raw_input()).strip().split()))

Fixed submission:
import re, sys
print sum(map(int,re.sub(r"[^\d]+",r" "," ".join(sys.stdin.readlines())).strip().split()))

Buggy python submission (verdict: Runtime Error):
import re, sys
print sum(map(int,re.sub("\w+|\s+"," ",sys.stdin.readlines()).strip().split()))

Fixed submission:
import re, sys
print sum(map(int,re.sub(r"[^\d]+",r" "," ".join(sys.stdin.readlines())).strip().split()))

Buggy python submission (verdict: Runtime Error):
import re, sys
print sum(map(int,re.sub("[^\d]+"," ",sys.stdin.readlines()).strip().split()))

Fixed submission:
import re, sys
print sum(map(int,re.sub(r"[^\d]+",r" "," ".join(sys.stdin.readlines())).strip().split()))