Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input.split() for _ in range(int(input()))]:
        for _ in range(s):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input().split() for _ in range(int(input()))]:
        for _ in range(int(s)):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input().split() for _ in range(int(input()))]:
        for _ in range(s):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input().split() for _ in range(int(input()))]:
        for _ in range(int(s)):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
import sys
sum = 1;
for i in sys.stdin.strip():
    if i != "0":
        print('Case {}: {}'.format(sum, i))
        sum++
    else:
        break

Fixed submission:
import sys
sum = 1;
for i in sys.stdin:
    x = i.strip()
    if x != "0":
        print('Case {}: {}'.format(sum, x))
        sum+= 1
    else:
        break

Buggy python submission (verdict: Runtime Error):
import sys
sum = 1;
for i in sys.stdin.strip():
    if i != "0":
        print('Case {}: {}'.format(sum, i))
        sum+= 1
    else:
        break

Fixed submission:
import sys
sum = 1;
for i in sys.stdin:
    x = i.strip()
    if x != "0":
        print('Case {}: {}'.format(sum, x))
        sum+= 1
    else:
        break
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
a = r*r*math.pi
b = 2*r*math.pi
print('%f %f' % (a, b))

Fixed submission:
import math
r = float(input())
a = r*r*math.pi
b = 2*r*math.pi
print(a, b)

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
a = r*r*math.pi
b = 2*r*math.pi
print('%f %f' % (a, b))

Fixed submission:
import math
r = float(input())
a = r*r*math.pi
b = 2*r*math.pi
print(a, b)
Buggy python submission (verdict: Runtime Error):
a = []
for _ in range(int(input())):
    a.append(input())
a.reverse()
print(" ".join(a))

Fixed submission:
input()
print(" ".join(reversed(input().split())))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while(b != 0):
        a, b = b, a%b
        print(a, b)


import sys
for line in sys.stdin:
    a, b = map(int, input().split())
    print(a, b)
    gcd(a, b)


Fixed submission:
a, b = map(int, input().split())
x, y = max(a, b), min(a, b)

while 1:
    if x%y == 0:
        break
    x, y = y, x%y

print(y)
Buggy python submission (verdict: Runtime Error):
def selectionsort(A, N):
	count = 0
	for i in range(N):
		min_a = min(A[i:])
		min_index = A.index(min_a)
		A[i], A[min_index] = min_a, A[i]
		if (A[i] != A[min_index]): count += 1
	return count

def main():
	n = int(input())
	data = list(map(int, input().split()))

	c = selectionsort2(data, n)
	print(*data)
	print(c)

if __name__ == "__main__":
	main()

Fixed submission:
def selectionsort(A, N):
	count = 0
	for i in range(N):
		minj = i
		for j in range(i, N):
			if A[j] < A[minj]:
				minj = j
		A[i], A[minj] = A[minj], A[i]
		if (A[i] != A[minj]):
			count += 1
	return count

def main():
	n = int(input())
	data = list(map(int, input().split()))

	c = selectionsort(data, n)
	print(*data)
	print(c)

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
data = input().split()

# ??????????????????????????????????£?
# n : ????????????????????????
# S : ????????????
n = 10
S = [0 for i in range(n)]

def isEmpty():
    global top
    if (top == 0):
        return True
    else:
        return False

def isFull():
    global top, n
    return top > n-1

def push(S, x):
    global top
    if isFull():
        print('error: overflow')
        return False
    top += 1
    S[top] = x

def pop(S):
    global top
    if isEmpty():
        print('error: underflow')
        return False
    top -= 1
    return S[top+1]

top = 0

for e in data:


    if e.isdigit():
        push(S, e)
    else:
        a = int(pop(S))
        b = int(pop(S))

        if e == '+':
            push(S, b + a)
        elif e == '-':
            push(S, b - a)
        elif e == '*':
            push(S, b * a)
        else:
            print('error: operand')


print(S[top])

Fixed submission:
data = input().split()

# ??????????????????????????????????£?
# n : ????????????????????????
# S : ????????????
n = 1000
S = [0 for i in range(n)]

def isEmpty():
    global top
    if (top == 0):
        return True
    else:
        return False

def isFull():
    global top, n
    return top > n-1

def push(S, x):
    global top
    if isFull():
        print('error: overflow')
        return False
    top += 1
    S[top] = x

def pop(S):
    global top
    if isEmpty():
        print('error: underflow')
        return False
    top -= 1
    return S[top+1]

top = 0

for e in data:


    if e.isdigit():
        push(S, e)
    else:
        a = int(pop(S))
        b = int(pop(S))

        if e == '+':
            push(S, b + a)
        elif e == '-':
            push(S, b - a)
        elif e == '*':
            push(S, b * a)
        else:
            print('error: operand')


print(S[top])
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    stack <int> s1;
    stack < pair <int, int> > s2;
    char ch;
    int sum = 0;

    for (int i = 0; cin >> ch; i++) {
        if (ch == '\\') s1.push(i);
        else if (ch == '/' && s1.size() > 0) {
            int j = s1.top();
            s1.pop();
            sum += i - j;
            int a = i - j;

            while (s2.size() > 0 && s2.top().first > j) {
                a += s2.top().second;
                s2.pop();
            }
            s2.push(make_pair(j, a));
        }
    }

    vector<int> ans;

    while (s2.size() > 0) {
        ans.push_back(s2.top().second);
        s2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++) {
        cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

Fixed submission:

from collections import deque

def main():
    s1 = deque()
    s2 = deque()
    total = 0

    string = input()

    for i in range(len(string)):
        if string[i] == '\\':
            s1.append(i)
        elif string[i] == '/' and len(s1) > 0:
            j = s1.pop()
            a = i - j
            total += a

            while (len(s2) > 0 and s2[-1][0] > j):
                a += s2[-1][1]
                s2.pop()

            s2.append((j, a))

    ans = []
    while (len(s2) > 0):
        ans.append(s2[-1][1])
        s2.pop()

    print(total)

    print(len(ans), *ans[::-1])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
class my_dict:

    def __init__(self):
        self.d = []

    def insert(self, x):
        if (x not in self.d):
            self.d.append(x)

    def find(self, x):
        if (x in self.d):
            return 'yes'
        else:
            return 'no'


def main():
    n = int(input())
    my_d = my_dict()

    for i in range(n):
        command, string = input().split()
        if (command == 'insert'):
            my_d.insert(string)
        elif (command == 'find'):
            print(my_d.find(string))


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    d = set([])


    for i in range(n):
        command, string = input().split()
        if (command == 'insert'):
            d.add(string)
        elif (command == 'find'):
            if string in d:
                print('yes')
            else:
                print('no')

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
print("%f %f" % (math.pi * r**2, math.pi * r * 2))

Fixed submission:
import math
r = float(input())
print("%f %f" % (math.pi * r**2, math.pi * r * 2))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
if r == 0:
    print(0,0)
else:
    print("%f %f" % (math.pi * r**2, math.pi * r * 2))

Fixed submission:
import math
r = float(input())
print("%f %f" % (math.pi * r**2, math.pi * r * 2))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
if r == 0:
    print('%f %f' % (0, 0))
else:
    print("%f %f" % (math.pi * r**2, math.pi * r * 2))

Fixed submission:
import math
r = float(input())
print("%f %f" % (math.pi * r**2, math.pi * r * 2))
Buggy python submission (verdict: Runtime Error):
a = []
a[:4] = [0, 1, 2, 3]
inList = []
while True:
    price = int(input())
    if price == 0:
        break
    inList.append(int(input()))
n = max(inList)
for i in range(4, n + 1):
    a[i] = a[i-1] + a[i-2] + a[i-3]
for i in inList:
    print((a[i] // 3650) + (a[i] % 3650 != 0))

Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    a = list(range(n + 1))
    a[:4] = [1, 1, 2, 4]
    for i in range(4, n + 1):
        a[i] = a[i-1] + a[i-2] + a[i-3]
    print((a[n] // 3650) + (a[n] % 3650 != 0))

Buggy python submission (verdict: Runtime Error):
a = []
a[:4] = [0, 1, 2, 3]
inList = []
while True:
    n = int(input())
    if n == 0:
        break
    inList.append(n)
n = max(inList)
for i in range(4, n + 1):
    a[i] = a[i-1] + a[i-2] + a[i-3]
for i in inList:
    print((a[i] // 3650) + (a[i] % 3650 != 0))

Fixed submission:
while True:
    n = int(input())
    if n == 0:
        break
    a = list(range(n + 1))
    a[:4] = [1, 1, 2, 4]
    for i in range(4, n + 1):
        a[i] = a[i-1] + a[i-2] + a[i-3]
    print((a[n] // 3650) + (a[n] % 3650 != 0))
Buggy python submission (verdict: Runtime Error):
import math
isPrime = [1 for _ in range (10002)]
isPrime[:2] = [0, 0]
for i in range(2, 101):
    for j in range(i*i, 10001, i):
        isPrime[j] = 0
prime = []
for i in range(10001):
    if isPrime[i] == 1:
        prime.append(i)
while True:
    n = int(input())
    if n == 0:
        break
    cnt = 0
    for i in range(n + 1):
        sum = 0
        for j in range(i,n + 1):
            sum += prime[j]
            if sum == n:
                cnt += 1
                break
            if sum > n:
                break
    print(cnt)

        

Fixed submission:
import math
isPrime = [1 for _ in range (10002)]
isPrime[:2] = [0, 0]
for i in range(2, 101):
    for j in range(i*i, 10001, i):
        isPrime[j] = 0
prime = []
for i in range(10001):
    if isPrime[i] == 1:
        prime.append(i)
while True:
    n = int(input())
    if n == 0:
        break
    cnt = 0
    for i in range(len(prime) + 1):
        sum = 0
        for j in range(i,len(prime)):
            sum += prime[j]
            if sum == n:
                cnt += 1
                break
            if sum > n:
                break
    print(cnt)

Buggy python submission (verdict: Runtime Error):
import math
isPrime = [1 for _ in range (10002)]
isPrime[:2] = [0, 0]
for i in range(2, 101):
    for j in range(i*i, 10001, i):
        isPrime[j] = 0
prime = []
for i in range(10001):
    if isPrime[i] == 1:
        prime.append(i)
while True:
    n = int(input())
    if n == 0:
        break
    cnt = 0
    for i in range(n):
        sum = 0
        for j in range(i,n):
            sum += prime[j]
            if sum == n:
                cnt += 1
                break
            if sum > n:
                break
    print(cnt)

        

Fixed submission:
import math
isPrime = [1 for _ in range (10002)]
isPrime[:2] = [0, 0]
for i in range(2, 101):
    for j in range(i*i, 10001, i):
        isPrime[j] = 0
prime = []
for i in range(10001):
    if isPrime[i] == 1:
        prime.append(i)
while True:
    n = int(input())
    if n == 0:
        break
    cnt = 0
    for i in range(len(prime) + 1):
        sum = 0
        for j in range(i,len(prime)):
            sum += prime[j]
            if sum == n:
                cnt += 1
                break
            if sum > n:
                break
    print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = []
for i in range(n):
    op = input().split()
    if op[0] == 'insert':
        d.append(op[1])  
    elif op[0] == 'find':
        if op[1] in d:
            print('yes')
        else:
            print('no')

Fixed submission:
import sys
n = int(input())
d = {}
for op in sys.stdin.readlines():
    op = op.split()
    if op[0] == 'insert':
        d[op[1]] = 1  
    elif op[0] == 'find':
        if op[1] in d:
            print('yes')
        else:
            print('no')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
d = []
for op in sys.stdin.readlines():
    op = op.split()
    if op[0] == 'insert':
        d.append(op[1])  
    elif op[0] == 'find':
        if op[1] in d:
            print('yes')
        else:
            print('no')

Fixed submission:
import sys
n = int(input())
d = {}
for op in sys.stdin.readlines():
    op = op.split()
    if op[0] == 'insert':
        d[op[1]] = 1  
    elif op[0] == 'find':
        if op[1] in d:
            print('yes')
        else:
            print('no')
Buggy python submission (verdict: Time Limit Exceeded):
# fp = open("DPL_1_D-in11.txt")
# inlist = list(map(int, fp.read().splitlines()))
n = int(input())
A = []
dp = [0 for _  in range(n)]
dp[0] = 1
for i in range(n):
    num = int(input())
    A.append(num)
    dpmax = 0
    for j in range(i):
        if A[j] < num and dp[j] > dpmax:
            dpmax = dp[j]
    dp[i] = max(dpmax + 1, 1)    
print(max(dp))

Fixed submission:
import bisect
n = int(input())
A = []
for i in range(n):
    num  = int(input())
    if A == []:
        A.append(num)
    elif num > A[-1]:
        A.append(num)
    else:
        j = bisect.bisect_left(A, num)
        A[j] = num
print(len(A))
Buggy python submission (verdict: Runtime Error):
_ = input()
S = set(input().split())
_ = input()
T = set(input().spilit())
print(len(S & T))

Fixed submission:
_ = input()
S = set(input().split())
_ = input()
T = set(input().split())
print(len(S & T))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

nums = list()
for i in range(10):
    num = raw_input().split("?±±?????????")
    nums.append(int(num))

nums = sorted(nums)
print "{}\n{}\n{}".format(nums[0],nums[1],nums[2])

Fixed submission:
mt = list()
for i in range(10):
    mt.append(int(raw_input()))

mt = sorted(mt,reverse=True)
for i in range(3):
    print mt[i]

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

mt = sys.stdin.strip().split()
mt = sorted([int(i) for i in mt])
print "\n".join(mt[:3])

Fixed submission:
mt = list()
for i in range(10):
    mt.append(int(raw_input()))

mt = sorted(mt,reverse=True)
for i in range(3):
    print mt[i]
Buggy python submission (verdict: Runtime Error):
inputs = map(int, raw_input().split())
max = max(inputs)

inputs.remove(max)

if max ** 2 == inputs[0] **2 + inputs[1] **2 :
    print "Yes"
else:
    print "No"

Fixed submission:
n = int(raw_input())
for i in range(n):
    e = map(int, raw_input().split())
    e.sort()
    if e[2] * e[2]== e[0] * e[0] + e[1] * e[1]:
        print "YES"
    else:
        print "NO"
Buggy python submission (verdict: Runtime Error):
x, y = map(int, raw_input().split())
if x < y:
    x, y = y, x

while y != 0
    x, y = y, x%y
print x

Fixed submission:
# coding; utf-8

a, b = map(int, raw_input().split())
if a < b:
    a, b = b, a
while b != 0:
    a, b = b, a % b

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

def is_prime(x):
    if x==1: return 0
    if x==2: return 1
    n = 3
    while n <= math.sqrt(x):
        if x % n == 0:
            return 1
        n += 2
    return 1

count = 0
for line in sys.stdin:
    x = int(raw_input())
    count += is_prime(x)
print count
~


Fixed submission:
import math
import sys

def is_prime(x):
    if x == 1: return 0
    elif x == 2: return 1
    elif x % 2 == 0: return 0

    n = 3
    while n <= math.sqrt(x):
        if x % n == 0:
            return 0
        n += 2
    return 1

n = int(raw_input())
count = 0
for i in range(n):
    x = int(raw_input())
    count += is_prime(x)

print count
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
nums = [int(raw_input()) for i in range(n)]

maxv = nums[1] - nums[0]
for j in range(1, n):
    for i in range(j):
        maxv = max(maxv, nums[j]-nums[i])

print maxv


Fixed submission:
# coding: utf-8
# 答えを見た。。。

n = int(raw_input())
R = [int(raw_input()) for i in range(n)]

maxv = -2000000000
minv = R[0]

for r in R[1:]:
    maxv = max(maxv, r - minv)
    minv = min(minv, r)

print maxv
Buggy python submission (verdict: Runtime Error):
a, b = [int(i) for i in raw_input().split()]
if a < b:
    print "a < b"
elif a > b:
    print "a > b":
else:
    print "a == b"

Fixed submission:
a, b = [int(i) for i in raw_input().split()]

if a > b:
    print "a > b"
elif a < b:
    print "a < b"
else:
    print "a == b"
Buggy python submission (verdict: Runtime Error):
a, b, c = [int(i) for i in raw_input()]
num = 0
for i in range(a,b+1):
    if c % i == 0:
        num += 1

print num

Fixed submission:
a, b, c = [int(i) for i in raw_input().split()]
num = 0
for i in range(a,b+1):
    if c % i == 0:
        num += 1

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

r = int(raw_input())
print "{:.6f} {:.6f}".format(math.pi * r * r, s * math.pi * r)

Fixed submission:
import math

r = float(raw_input())
print "{:.6f} {:.6f}".format(math.pi * r * r, 2 * math.pi * r)

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

r = float(raw_input())
print "{:.6f} {:.6f}".format(math.pi * r * r, s * math.pi * r)

Fixed submission:
import math

r = float(raw_input())
print "{:.6f} {:.6f}".format(math.pi * r * r, 2 * math.pi * r)
Buggy python submission (verdict: Runtime Error):
While True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in range(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W + "\n"

Fixed submission:
while True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in xrange(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W
    print

Buggy python submission (verdict: Runtime Error):
While True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in range(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W
    print

Fixed submission:
while True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in xrange(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W
    print

Buggy python submission (verdict: Runtime Error):
While True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in xrange(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W
    print

Fixed submission:
while True:
    H, W = map(int, raw_input().split())
    if H == W == 0:
        break
    print "#" * W
    for i in xrange(H -2):
        print "#" + "." *(W-2) + "#"
    print "#" * W
    print
Buggy python submission (verdict: Runtime Error):
n = raw_input()
array = raw_input().split()
for i in reversed(range(n)):
    print i,

Fixed submission:
n = int(raw_input())
array = raw_input().split()
for i in reversed(range(n)):
    print array[i],
Buggy python submission (verdict: Runtime Error):
n, m = map(int,raw_input().split())
matrix = []
for i in range(n):
    matrix.append(map(int,raw_input().split()))

vector = []
for i in range(m):
    vector.append(int(raw_input()))

for i in range(m):
    for j in range(n):
        print sum([vector[j] * matrix[i][j]])

Fixed submission:
n, m = map(int,raw_input().split())
matrix = []
for i in range(n):
    matrix.append(map(int,raw_input().split()))
 
vector = []
for i in range(m):
    vector.append(int(raw_input()))
 
for row in range(n):
    sum = 0
    for col in range(m):
        sum += vector[col] * matrix[row][col]
    print sum
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
def main():
    n, m, l = map(int, raw_input().split())
    mat_A = [] # (n, m)
    mat_B = [] # (m, l)
    for i in range(n):
        mat_A.append(map(int, raw_input().split()))

    for j in range(m):
        mat_B.append(map(int, raw_input().split()))

    for i in range(n):
        c = [0 for g in range(n)]
        for j in range(l):
            for k in range(m):
              #  print "n:{}, m:{}, l:{}".format(i,k,j)
                c[j] += mat_A[i][k] * mat_B[k][j]
        print " ".join(map(str, c))
if __name__ == "__main__":
    main()

Fixed submission:
# coding: utf-8
def main():
    n, m, l = map(int, raw_input().split())
    mat_A = [] # (n, m)
    mat_B = [] # (m, l)
    for i in range(n):
        mat_A.append(map(int, raw_input().split()))

    for j in range(m):
        mat_B.append(map(int, raw_input().split()))

    for i in range(n):
        c = [0 for g in range(l)]
        for j in range(l):
            for k in range(m):
              #  print "n:{}, m:{}, l:{}".format(i,k,j)
                try:
                    c[j] += mat_A[i][k] * mat_B[k][j]
                except:
                    print "n: {}, m: {}, l: {}".format(i,k,j)
        print " ".join(map(str, c))
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
 
n, m, l = map(int, raw_input().split())
mat_A = [] # (n, m)
mat_B = [] # (m, l)
for i in range(n):
    mat_A.append(map(int, raw_input().split()))
 
for j in range(m):
    mat_B.append(map(int, raw_input().split()))
 
for i in range(n):
    c = [0 for g in range(n)]
    for j in range(l):
        for k in range(m):
            c[j] += mat_A[i][k] * mat_B[k][j]
    print " ".join(map(str, c))

Fixed submission:
# coding: utf-8
def main():
    n, m, l = map(int, raw_input().split())
    mat_A = [] # (n, m)
    mat_B = [] # (m, l)
    for i in range(n):
        mat_A.append(map(int, raw_input().split()))

    for j in range(m):
        mat_B.append(map(int, raw_input().split()))

    for i in range(n):
        c = [0 for g in range(l)]
        for j in range(l):
            for k in range(m):
              #  print "n:{}, m:{}, l:{}".format(i,k,j)
                try:
                    c[j] += mat_A[i][k] * mat_B[k][j]
                except:
                    print "n: {}, m: {}, l: {}".format(i,k,j)
        print " ".join(map(str, c))
if __name__ == "__main__":
    main()