Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
A = map(int, raw_input().split())

q = int(raw_input())
mi = map(int, raw_input().split())

def f(m, A):
    a = list(A)
    i = 0
    while True:
        while (i < len(a)) and (a[i] <= m): i+=1
        m -= a[i-1]
        a.pop(i-1)
        if   m == 0:
            return True
        elif m > 0:
            return f(m, a)
        else:
            return False

for m in mi:
    if f(m, A):
        print "yes"
    else:
        print "no"

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
A.sort()
sumA = sum(A)

q = int(input())
m = list(map(int, input().split()))

def f(A, s, res):
  if res[0]:
    return
  if s == 0:
    res[0] = True
    return
  for i, a in enumerate(A):
    if a > s:
      break
    f(A[i+1:], s-a, res)

for mi in m:
  res = [False]

  if mi <= sumA:
    f(A, mi, res)

  if res[0]:
    print("yes")
  else:
    print("no")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
A.sort()

q = int(input())
m = list(map(int, input().split()))

def f(A, s, res):
  if res[0]:
    return
  if s == 0:
    res[0] = True
    return
  for i, a in enumerate(A):
    if a > s:
      break
    f(A[i+1:], s-a, res)

for mi in m:
  res = [False]
  f(A, mi, res)
  if res[0]:
    print("yes")
  else:
    print("no")

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
A.sort()
sumA = sum(A)

q = int(input())
m = list(map(int, input().split()))

def f(A, s, res):
  if res[0]:
    return
  if s == 0:
    res[0] = True
    return
  for i, a in enumerate(A):
    if a > s:
      break
    f(A[i+1:], s-a, res)

for mi in m:
  res = [False]

  if mi <= sumA:
    f(A, mi, res)

  if res[0]:
    print("yes")
  else:
    print("no")
Buggy python submission (verdict: Time Limit Exceeded):
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B
# awesome answer: 

def merge(A, left, mid, right):
  cnt = 0
  n1 = mid - left
  n2 = right - mid
  L, R = [0]*(n1+1), [0]*(n2+1)
  for i in range(n1):
    L[i] = A[left + i]
  for i in range(n2):
    R[i] = A[mid + i]
  L[n1] = float("inf")
  R[n2] = float("inf")
  i = 0
  j = 0
  for k in range(left, right):
    cnt = cnt + 1
    if L[i] <= R[j]:
      A[k] = L[i]
      i = i + 1
    else:
      A[k] = R[j]
      j = j + 1
  return cnt

def mergeSort(A, left, right, cnt):
  if left+1 < right:
    mid = int((left + right)/2)
    mergeSort(A, left, mid, cnt)
    mergeSort(A, mid, right, cnt)
    cnt[0] = cnt[0] + merge(A, left, mid, right)

if __name__ == "__main__":
  n = int(input())
  S = list(map(int, input().split()))
  cnt = [0]
  mergeSort(S, 0, len(S), cnt)
  print(" ".join(map(str, S)))
  print(cnt[0])

Fixed submission:
count = 0

def merge(A, left, mid, right):
  global count
  n1 = mid - left
  n2 = right - mid
  L = A[left:left+n1]
  R = A[mid:mid+n2]
  L.append(float("inf"))
  R.append(float("inf"))
  i = 0
  j = 0
  for k in range(left, right):
    count += 1
    if L[i] <= R[j]:
      A[k] = L[i]
      i += 1
    else:
      A[k] = R[j]
      j += 1

def mergeSort(A, left, right):
  if left + 1 < right:
    mid = int((left + right)/2)
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)

if __name__ == "__main__":
  n = int(input())
  S = list(map(int, input().split()))
  mergeSort(S, 0, len(S))
  print(" ".join(map(str, S)))
  print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

def kochCurve(p1, p2, n):
  if n == 0:
    print(p2[0], p2[1])
    return

  v = (p2 - p1)/3
  s = p1 + v
  t = s + v

  theta = math.atan2(v[1], v[0])

  a = np.linalg.norm(t - s)
  h = 3**(1/2)*a/2
  u = s + (t - s)/2 + np.array([h*math.sin(theta), h*math.cos(theta)])

#  print(n, p1, s, u, t, p2)

  n -= 1
  kochCurve(p1, s, n)
  kochCurve(s, u, n)
  kochCurve(u, t, n)
  kochCurve(t, p2, n)

if __name__ == "__main__":
  n = int(input())
  print([0, 0])
  kochCurve(np.array([0, 0]), np.array([100, 0]), n)

Fixed submission:
import math

def kochCurve(p1, p2, n):
  if n == 0:
    print(p2[0], p2[1])
    return

  v = [(p2[0]-p1[0])/3, (p2[1]-p1[1])/3]
  s = [p1[0]+v[0], p1[1]+v[1]]
  t = [s[0]+v[0], s[1]+v[1]]

  theta = math.atan2(v[1], v[0]) + math.pi/2

  a = math.sqrt((t[0]-s[0])**2+(t[1]-s[1])**2)
  h = 3**(1/2)*a/2
  u = [s[0]+(t[0]-s[0])/2+h*math.cos(theta), s[1]+(t[1]-s[1])/2+h*math.sin(theta)]

  n -= 1
  kochCurve(p1, s, n)
  kochCurve(s, u, n)
  kochCurve(u, t, n)
  kochCurve(t, p2, n)

if __name__ == "__main__":
  n = int(input())
  print(0, 0)
  kochCurve([0, 0], [100, 0], n)

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

def kochCurve(p1, p2, n):
  if n == 0:
    print(p2[0], p2[1])
    return

  v = (p2 - p1)/3
  s = p1 + v
  t = s + v

  theta = math.atan2(v[1], v[0])

  a = np.linalg.norm(t - s)
  h = 3**(1/2)*a/2
  u = s + (t - s)/2 + np.array([h*math.sin(theta), h*math.cos(theta)])

#  print(n, p1, s, u, t, p2)

  n -= 1
  kochCurve(p1, s, n)
  kochCurve(s, u, n)
  kochCurve(u, t, n)
  kochCurve(t, p2, n)

if __name__ == "__main__":
  n = int(input())
  print(0, 0)
  kochCurve(np.array([0, 0]), np.array([100, 0]), n)

Fixed submission:
import math

def kochCurve(p1, p2, n):
  if n == 0:
    print(p2[0], p2[1])
    return

  v = [(p2[0]-p1[0])/3, (p2[1]-p1[1])/3]
  s = [p1[0]+v[0], p1[1]+v[1]]
  t = [s[0]+v[0], s[1]+v[1]]

  theta = math.atan2(v[1], v[0]) + math.pi/2

  a = math.sqrt((t[0]-s[0])**2+(t[1]-s[1])**2)
  h = 3**(1/2)*a/2
  u = [s[0]+(t[0]-s[0])/2+h*math.cos(theta), s[1]+(t[1]-s[1])/2+h*math.sin(theta)]

  n -= 1
  kochCurve(p1, s, n)
  kochCurve(s, u, n)
  kochCurve(u, t, n)
  kochCurve(t, p2, n)

if __name__ == "__main__":
  n = int(input())
  print(0, 0)
  kochCurve([0, 0], [100, 0], n)
Buggy python submission (verdict: Time Limit Exceeded):
def insertion(A):
  count = 0
  for i in range(1, len(A)):
    for j in range(i, 0, -1):
      if A[j] < A[j-1]:
        A[j], A[j-1] = A[j-1], A[j]
        count += 1
      else:
        break
  return count

def main():
  n = int(input())
  A = list(map(int, input().split()))
  print(insertion(A))

if __name__ == "__main__":
  main()

Fixed submission:
count = 0

def merge(A, left, mid, right):
  global count
  n1 = mid - left
  n2 = right - mid
  L = A[left:left+n1]
  R = A[mid:mid+n2]
  L.append(float("inf"))
  R.append(float("inf"))
  i = 0
  j = 0
  numLeft = len(L)-1 # the number of L's elements
  for k in range(left, right):
    if R[j] < L[i]:
      A[k] = R[j]
      j += 1
      count += numLeft-i # the number of inversions to R[j]
    else:
      A[k] = L[i]
      i += 1

def mergeSort(A, left, right):
  if left + 1 < right:
    mid = int((left + right)/2)
    mergeSort(A, left, mid)
    mergeSort(A, mid, right)
    merge(A, left, mid, right)


def main():
  n = int(input())
  A = list(map(int, input().split()))
  mergeSort(A, 0, n)
  print(count)

if __name__ == "__main__":
  main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
cout = ""

for i in range(1,n+1):
	x = i

	if (x%3) == 0:
		cout = cout + " " + str(i)
		continue

	while x > 0:
		if (x%10) == 3:
			cout = cout + " " + str(i)
			continue
		x /= 10

print cout

Fixed submission:
n = int(raw_input())
cout = ""

for i in range(1,n+1):
	x = i

	if (x%3) == 0:
		cout = cout + " " + str(i)
		continue

	while x > 0:
		if (x%10) == 3:
			cout = cout + " " + str(i)
			break
		x /= 10

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

n = input()
ai = raw_input()
ai = map(int, ai.split())

for i in reversed(range(1, n)):
	sys.stdout.write(str(ai[i])+" ")
print ai[i-1]

Fixed submission:
import sys

n = input()
ai = raw_input()
ai = map(int, ai.split())

for i in reversed(range(1, n)):
	sys.stdout.write(str(ai[i])+" ")
print ai[0]
Buggy python submission (verdict: Runtime Error):
import sys

n, m, l = 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(map(int, raw_input().split()))

c = [[0 for i in xrange(n)] for j in xrange(l)]

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

for i in xrange(n):
	for j in xrange(l-1):
		sys.stdout.write(str(c[i][j])+" ")
	print c[i][l-1]

Fixed submission:
import sys

N, M, L = map(int, raw_input().split())
a = []
b = []
for n in range(N):
	a.append(map(int, raw_input().split()))
for m in range(M):
	b.append(map(int, raw_input().split()))

c = [[0 for l in xrange(L)] for n in xrange(N)]

for n in xrange(N):
	for l in xrange(L):
		for m in xrange(M):
			c[n][l] += a[n][m] * b[m][l]

for n in xrange(N):
	for l in xrange(L-1):
		sys.stdout.write(str(c[n][l])+" ")
	print c[n][L-1]

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

n, m, l = 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(map(int, raw_input().split()))

a = np.matrix(a)
b = np.matrix(b)

c = a * b

for i in xrange(n):
	for j in xrange(l-1):
		sys.stdout.write(str(c[i,j])+" ")
	print c[i,l-1]

Fixed submission:
import sys

N, M, L = map(int, raw_input().split())
a = []
b = []
for n in range(N):
	a.append(map(int, raw_input().split()))
for m in range(M):
	b.append(map(int, raw_input().split()))

c = [[0 for l in xrange(L)] for n in xrange(N)]

for n in xrange(N):
	for l in xrange(L):
		for m in xrange(M):
			c[n][l] += a[n][m] * b[m][l]

for n in xrange(N):
	for l in xrange(L-1):
		sys.stdout.write(str(c[n][l])+" ")
	print c[n][L-1]
Buggy python submission (verdict: Time Limit Exceeded):
import sys

# ?????§???????±??????????
def get_max(data):
    now_max = None
    for i in range(0, len(data)-1):
        start_val = data[i]
        for j in range(i+1, len(data)):
            if now_max is None or data[j]-start_val > now_max:
                now_max = data[j] - start_val
    return now_max

# ??\???????????????????????????
data = []
line_num = int(sys.stdin.readline().rstrip())
while True:
    input_data = sys.stdin.readline()
    if not input_data:
        break
    input_data = int(input_data.rstrip())
    data.append(input_data)

result = get_max(data)
print(result)

Fixed submission:
import sys

line_num = int(sys.stdin.readline().rstrip())
maxv = -2000000000
minv = int(sys.stdin.readline().rstrip())

for i in range(1, line_num):
    rt = int(sys.stdin.readline())
    if rt - minv > maxv:
        maxv = rt - minv
    if rt < minv:
        minv = rt

print(maxv)
Buggy python submission (verdict: Runtime Error):
N = input()
a=map(int,raw_input().split())
print(a)
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(a)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Buggy python submission (verdict: Runtime Error):
N = input()
a=map(int,raw_input().split())
print(a)
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(a)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Buggy python submission (verdict: Runtime Error):
N = input()
a=map(int,raw_input().split())
print(a)
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(a)
return

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Buggy python submission (verdict: Runtime Error):
N = input()
a=list(map(int,raw_input().split()))
print(a)
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(a)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Buggy python submission (verdict: Runtime Error):
N = input()
a=list(map(int,input().split()))
print(a)
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(a)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Buggy python submission (verdict: Runtime Error):
N = input()
a=list(map(int,raw_input().split()))
for i in range(1,N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
for i in range(N):
    v = a[i]
    j = i-1
    while j >= 0 and a[j] > v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(*a)
Buggy python submission (verdict: Time Limit Exceeded):
N=input()
input = [int(input()) for i in range(int(N))]
max=-10000000000
for i,x in enumerate(input):
	for j,y in enumerate(input):
		if j>i:
			if max < input[j]-input[i]:
				max = input[j]-input[i]
print(max)
	

Fixed submission:
N=input()
input = [int(input()) for i in range(int(N))]
maxv=-10000000000
minv=10000000000
for i,x in enumerate(input):
	maxv = max(maxv, input[i]-minv)
	minv = min(minv, input[i])
print(maxv)
Buggy python submission (verdict: Runtime Error):
n = int(input())
keys = list(map(int, input().split()))
#n=5
#heap_keys = [7,8,1,2,3]
heap = []
for i,x in enumerate(heap_keys):
    node = i+1
    key = x
    parent_key = heap_keys[int(node/2)-1] if i > 0 else None
    left_key = heap_keys[2*node-1] if 2*node-1 <len(heap_keys) else None
    right_key = heap_keys[2*node] if 2*node <len(heap_keys) else None
    heap.append({"node":node, "key":x, "parent_key":parent_key, "left_key":left_key, "right_key":right_key})

for h in heap:
    out_str = "node %s: key = %s, " % (h["node"],h["key"])
    if h["parent_key"]:out_str += "parent key = %s, " % h["parent_key"]
    if h["left_key"]:out_str += "left key = %s, " % h["left_key"]
    if h["right_key"]:out_str += "right key = %s, " % h["right_key"]
    print(out_str)

Fixed submission:
n = int(input())
heap_keys = list(map(int, input().split()))
heap = []
for i,x in enumerate(heap_keys):
    node = i+1
    key = x
    parent_key = heap_keys[int(node/2)-1] if i > 0 else None
    left_key = heap_keys[2*node-1] if 2*node-1 <len(heap_keys) else None
    right_key = heap_keys[2*node] if 2*node <len(heap_keys) else None
    heap.append({"node":node, "key":x, "parent_key":parent_key, "left_key":left_key, "right_key":right_key})

for h in heap:
    out_str = "node %s: key = %s, " % (h["node"],h["key"])
    if h["parent_key"]:out_str += "parent key = %s, " % h["parent_key"]
    if h["left_key"]:out_str += "left key = %s, " % h["left_key"]
    if h["right_key"]:out_str += "right key = %s, " % h["right_key"]
    print(out_str)
Buggy python submission (verdict: Runtime Error):
#?????????
N = input()
A = map(int, raw_input().split())
for i in range(len(A)):
    v = A[i]
    j = i - 1
    while (j >= 0) & (A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print ' '.join(map(str, A))

Fixed submission:
def insertionSort():
    N = int(input())
    lst = list(map(int, input().split()))
    
    for i in range(1, N):
        print(*lst)
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j -= 1
        lst[j+1] = v
    
    print(*lst)
        
insertionSort()
Buggy python submission (verdict: Runtime Error):
from collections import deque
order = int(input())
llist = [input().split() for _ in range(order)]
ans = deque([])
for lst in llist:
    if lst[0] == 'insert':
        ans.appendleft(lst[1])
    
    elif lst[0] == 'delete':
        ans.remove(lst[1])
   
    elif lst[0] == 'deleteFirst':
        ans.popleft()
    
    elif lst[0] == 'deleteLast':
        ans.pop()

print(*ans)

Fixed submission:
from collections import deque
order = int(input())
llist = [input().split() for _ in range(order)]
ans = deque([])
count = 0
for lst in llist:
    if lst[0] == 'insert':
        ans.appendleft(lst[1])
    
    elif lst[0] == 'delete':
        if lst[1] in ans:
            ans.remove(lst[1])
   
    elif lst[0] == 'deleteFirst':
        ans.popleft()
    
    elif lst[0] == 'deleteLast':
        ans.pop()
        
    count += 1

print(*ans)
Buggy python submission (verdict: Runtime Error):
import math

x1,y1,x2,y2 = map(int,input().split())
print(math.fabs(math.sqrt((x2 - x1)**2 + (y2 - y1)**2)))

Fixed submission:
import math

x1,y1,x2,y2 = map(float,input().split())
print(math.fabs(math.sqrt((x2 - x1)**2 + (y2 - y1)**2)))
Buggy python submission (verdict: Runtime Error):
class Dice :
    def __init__(self,num):
        self.num = num

    def move_E(self):
        self.copy = self.num.copy() 
        for i,j in zip([0,2,5,3],[3,0,2,5]):
            self.num[i] = self.copy[j]

    def move_W(self):
        self.copy = self.num.copy()
        for i,j in zip([0,3,5,2],[2,0,3,5]):
            self.num[i] = self.copy[j]

    def move_N(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[1,5,4,0]):
            self.num[i] = self.copy[j]

    def move_S(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[4,0,1,5]):
            self.num[i] = self.copy[j]



number = list(map(int,input().split()))
#number = [1,2,4,8,16,32]
#print("1 2 3 4 5 6")
# ?????????????????????
dice = Dice(number)

for order in input():
    if order == 'S':
        dice.move_S()
    elif order == 'N':
        dice.move_N()
    elif order == 'W':
        dice.move_W()
    else:
        dice.move_E()

# ?????????????????¶????????????
#print(dice.num)

print(dice.num[0])

Fixed submission:
class Dice :
    def __init__(self,num):
        self.num = num

    def move_E(self):
        self.copy = self.num.copy() 
        for i,j in zip([0,2,5,3],[3,0,2,5]):
            self.num[i] = self.copy[j]

    def move_W(self):
        self.copy = self.num.copy()
        for i,j in zip([0,3,5,2],[2,0,3,5]):
            self.num[i] = self.copy[j]

    def move_N(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[1,5,4,0]):
            self.num[i] = self.copy[j]

    def move_S(self):
        self.copy = self.num.copy()
        for i,j in zip([0,1,5,4],[4,0,1,5]):
            self.num[i] = self.copy[j]



number = list(map(int,input().split()))
#number = [1,2,4,8,16,32]
#print("1 2 3 4 5 6")
# ?????????????????????
dice = Dice(number)

for order in input():
    if order == 'S':
        dice.move_S()
    elif order == 'N':
        dice.move_N()
    elif order == 'W':
        dice.move_W()
    else:
        dice.move_E()

# ?????????????????¶????????????
#print(dice.num)

print(dice.num[0])
Buggy python submission (verdict: Runtime Error):
import math

r = int(input())
print("%f %f" % (r*r*math.pi,2*r*math.pi))

Fixed submission:
import math

r = float(input())
print("%f %f" % (r*r*math.pi,2*r*math.pi))
Buggy python submission (verdict: Runtime Error):
# ????????????
n,m,l = list(map(int,input().split()))
matrixA,matrixB = [],[]
for i in range(n):
	matrixA.append(list(map(int,input().split())))
for j in range(m):
	matrixB.append(list(map(int,input().split())))

matrix = []
for i in range(l):
	mtr = []
	for j in range(m):
		mtr.append(matrixB[j][i])
	matrix.append(mtr)

matrixC = []
for i in range(l):
	mtr = []
	for j in range(n):
		num_sum = 0
		# print(matrixA[j],matrix[i])
		for a,b in zip(matrixA[j],matrix[i]):
			num_sum += a*b
		mtr.append(num_sum)
	matrixC.append(mtr)

matrix = []
for i in range(l):
	out = ''
	for j in range(n):
		out += str(matrixC[j][i]) + ' '
	print(out[:-1])

Fixed submission:
# ????????????
n,m,l = list(map(int,input().split()))
matrixA,matrixB = [],[]
for i in range(n):
	matrixA.append(list(map(int,input().split())))
for j in range(m):
	matrixB.append(list(map(int,input().split())))

matrix = []
for i in range(l):
	mtr = []
	for j in range(m):
		mtr.append(matrixB[j][i])
	matrix.append(mtr)

matrixC = []
for i in range(l):
	mtr = []
	for j in range(n):
		num_sum = 0
		# print(matrixA[j],matrix[i])
		for a,b in zip(matrixA[j],matrix[i]):
			num_sum += a*b
		mtr.append(num_sum)
	matrixC.append(mtr)

matrix = []
for i in range(n):
	out = ''
	for j in range(l):
		out += str(matrixC[j][i]) + ' '
	print(out[:-1])

Buggy python submission (verdict: Runtime Error):
# ????????????
n,m,l = list(map(int,input().split()))
matrixA,matrixB = [],[]
for i in range(n):
	matrixA.append(list(map(int,input().split())))
for j in range(m):
	matrixB.append(list(map(int,input().split())))

matrix = []
for i in range(l):
	mtr = []
	for j in range(m):
		mtr.append(matrixB[j][i])
	matrix.append(mtr)

matrixC = []
for i in range(l):
	mtr = []
	for j in range(n):
		num_sum = 0
		# print(matrixA[j],matrix[i])
		for a,b in zip(matrixA[j],matrix[i]):
			num_sum += a*b
		mtr.append(num_sum)
	matrixC.append(mtr)

matrix = []
for i in range(l):
	out = ''
	for j in range(n):
		out += str(matrixC[j][i]) + ' '
	print(out[:-1])

Fixed submission:
# ????????????
n,m,l = list(map(int,input().split()))
matrixA,matrixB = [],[]
for i in range(n):
	matrixA.append(list(map(int,input().split())))
for j in range(m):
	matrixB.append(list(map(int,input().split())))

matrix = []
for i in range(l):
	mtr = []
	for j in range(m):
		mtr.append(matrixB[j][i])
	matrix.append(mtr)

matrixC = []
for i in range(l):
	mtr = []
	for j in range(n):
		num_sum = 0
		# print(matrixA[j],matrix[i])
		for a,b in zip(matrixA[j],matrix[i]):
			num_sum += a*b
		mtr.append(num_sum)
	matrixC.append(mtr)

matrix = []
for i in range(n):
	out = ''
	for j in range(l):
		out += str(matrixC[j][i]) + ' '
	print(out[:-1])