Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
r, c = map(int, input().split())
for i in range(r):
    a = list(map(int, input(),split()))
    print(a,sum(a))
    


Fixed submission:
n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(m):print(sum(a[i]),end=' ')
print(sum(a[m]))

Buggy python submission (verdict: Runtime Error):
r, c = map(int, input().split())
a = []
for i in range(r):
    a.append(list(map(int, input(),split())))
for line in arr:
    line.append(sum(line))
arr.append([sum([line[i] for line in arr]) for i in range(c+1)])
for line in arr:
    print(*line)
    


Fixed submission:
n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(m):print(sum(a[i]),end=' ')
print(sum(a[m]))

Buggy python submission (verdict: Runtime Error):
r, c = map(int, input().split())
a = []
for i in range(r):
    a.append(list(map(int, input(),split())))
for line in arr:
    line.append(sum(line))
arr.append([sum([line[i] for line in arr]) for i in range(c+1)])
for line in arr:
    print(line)
    


Fixed submission:
n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(list(map(int, input().split())))
    a[i]+=[sum(a[i])]
    print(*a[i])
a=list(zip(*a[::-1]))
for i in range(m):print(sum(a[i]),end=' ')
print(sum(a[m]))
Buggy python submission (verdict: Runtime Error):
n, m, l = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

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


Fixed submission:
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]

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

c = [[0 for k in range(l)] for i in range(n)]
for i in range(n):
    for k in range(l):
        for j in range(m):
            c[i][k] += int(a[i][j]*b[j][k] )
 for i in range(n):
    print(c[i])


Fixed submission:
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]

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

c = [[0 for k in range(l)] for i in range(n)]
for i in range(n):
    for k in range(l):
        for j in range(m):
            c[i][k] += int(a[i][j]*b[j][k] )
 for i in range(n):
    print(c[i])


Fixed submission:
n, m, l = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
b = [list(map(int, input().split())) for j in range(m)]
[print(*x) for x in [[sum(j*k for j, k in zip(x, y)) for y in zip(*b)] for x in a]]
Buggy python submission (verdict: Runtime Error):
while 1:
    a = int(input())
    if a ==0:
    break
    a = str(a)
    if a =
    print([a[i] for i in range(len(a))])
    
    


Fixed submission:
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))

Buggy python submission (verdict: Runtime Error):
while 1:
    a = int(input())
    if a ==0:
    break
    a = str(a)
    print([a[i] for i in range(len(a))])
    
    


Fixed submission:
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))

Buggy python submission (verdict: Runtime Error):
while 1:
    a = int(input())
    if a ==0:
    break
    a = str(a)
    print([a[i] for i in range(len(a))])
    
    


Fixed submission:
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))

Buggy python submission (verdict: Runtime Error):
while 1:
    a = int(input())
    if a ==0:
    break
    a = str(a)
    print([a[i] for i in range(len(a))])
    
    


Fixed submission:
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))

Buggy python submission (verdict: Runtime Error):
while 1:
    a = int(input())
    if a ==0:
    break
    a = str(a)
    print([a[i] for i in range(len(a))])


Fixed submission:
while 1:
    n = input()
    if n == '0':
        break
    print(sum(int(x) for x in n))
Buggy python submission (verdict: Runtime Error):
# リストの宣言
A = []

# 入力の最初の行に、数列の長さを表す整数 N が与えられます。
# 2 行目に、N 個の整数が空白区切りで与えられます。
NUM =int(input())
A = input().split()

NUMLIST = range (1, NUM + 1)

# for i = 1 to A.length-1
for i in NUMLIST:
#    key = A[i]
  key = A[i]
  j = i - 1
  while j >= 0 and A[j] > key:
    A[j+1] = A[j]
    j-=1
  A[j+1] = key



Fixed submission:
# リストの宣言
A = []

# 入力の最初の行に、数列の長さを表す整数 N が与えられます。
# 2 行目に、N 個の整数が空白区切りで与えられます。
NUM =int(input())
A = input().split()

print(" ".join(map(str,A)))

NUMLIST = range (1, NUM)

# for i = 1 to A.length-1
for i in NUMLIST:
#    key = A[i]
  key = A[i]
  j = i - 1
  while j >= 0 and int(A[j]) > int(key):
    A[j+1] = A[j]
    j-=1
  A[j+1] = key
  print(" ".join(map(str, A)))
Buggy python submission (verdict: Runtime Error):
x = raw_input()

print (x * x * x)


Fixed submission:
x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)

Buggy python submission (verdict: Runtime Error):
print (pow(x,3))



Fixed submission:
x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)

Buggy python submission (verdict: Runtime Error):
pow(x,3)




Fixed submission:
x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)

Buggy python submission (verdict: Runtime Error):
pow(x,3)



Fixed submission:
x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)

Buggy python submission (verdict: Runtime Error):
input = input('>> ')
ans = pow(input,3)
print(ans)


Fixed submission:
x = input('')
x = int(x)
ans = int(pow(x,3))
print(ans)
Buggy python submission (verdict: Runtime Error):
x = input()
print( x*x*x)


Fixed submission:
x = int( input() )
print( x*x*x)

Buggy python submission (verdict: Runtime Error):
x = double( input() )
print( x*x*x)


Fixed submission:
x = int( input() )
print( x*x*x)

Buggy python submission (verdict: Runtime Error):
x = long( input() )
print( x*x*x)


Fixed submission:
x = int( input() )
print( x*x*x)
Buggy python submission (verdict: Runtime Error):
x = int( input() )
print(x//3600+":"+(x%3600)//60+":"+x%60)


Fixed submission:
x = int(input())
print(x//3600,end="")
print(':',end="")
print((x//60)%60,end="")
print(':',end="")
print(x%60)

Buggy python submission (verdict: Runtime Error):
x = int(input())
print(x//3600+":"+(x//60)%60+":"+(x%60))


Fixed submission:
x = int(input())
print(x//3600,end="")
print(':',end="")
print((x//60)%60,end="")
print(':',end="")
print(x%60)
Buggy python submission (verdict: Runtime Error):
# -*- coding=utf-8 -*-
price = [int(input()) for p in range(int(input()))]

# Nのコード　→ いけるぞ！
# まずは最小値を調査
min_ = price[0]
index_ = 0
for i in range(1, len(price)):
    if price[i] < min_:
        min_ = price[i]
        index_ = i

# 次は最大値を調査
print(max(price[index_ + 1:]) - min_)


Fixed submission:
# -*- coding=utf-8 -*-
price = [int(input()) for p in range(int(input()))]

# N ^ 2 のコード → ダメダメ
# max_ = price[1] - price[0]
# for i in range(1, len(price)):
#     for j in range(0, i):
#         if price[i] - price[j] >= max_:
#             max_ = price[i] - price[j]

# Nのコード　→ いけるぞ！
# まずは最小値を調査
min_ = price[0]
max_ = -1000000000000
for i in range(1, len(price)):
    if price[i] - min_ > max_:
        max_ = price[i] - min_

    if price[i] < min_:
        min_ = price[i]

print(max_)
Buggy python submission (verdict: Runtime Error):
n = int(input())

linked_list = []

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.insert(0, x)
    elif command == "deleteFirst":
        del linked_list[0]
    elif command == "deleteLast":
        del linked_list[-1]
    elif "delete" in command:
        x = command.split()[-1]
        del linked_list[linked_list.index(x)]

print(*linked_list)



Fixed submission:
from collections import deque

n = int(input())

linked_list = deque([])

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.appendleft(x)
    elif command == "deleteFirst":
        linked_list.popleft()
    elif command == "deleteLast":
        linked_list.pop()
    elif "delete" in command:
        x = command.split()[-1]
        if x in linked_list:
            linked_list.remove(x)

print(*linked_list)

Buggy python submission (verdict: Runtime Error):
n = int(input())

linked_list = []

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.insert(0, x)
    elif command == "deleteFirst":
        del linked_list[0]
    elif command == "deleteLast":
        del linked_list[-1]
    elif "delete" in command:
        x = command.split()[-1]
        del linked_list[linked_list.index(x)]

print(*linked_list)



Fixed submission:
from collections import deque

n = int(input())

linked_list = deque([])

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.appendleft(x)
    elif command == "deleteFirst":
        linked_list.popleft()
    elif command == "deleteLast":
        linked_list.pop()
    elif "delete" in command:
        x = command.split()[-1]
        if x in linked_list:
            linked_list.remove(x)

print(*linked_list)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

linked_list = []

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.insert(0, x)
    elif command == "deleteFirst":
        del linked_list[0]
    elif command == "deleteLast":
        del linked_list[-1]
    elif "delete" in command:
        x = command.split()[-1]
        if x in linked_list:
            del linked_list[linked_list.index(x)]

print(*linked_list)



Fixed submission:
from collections import deque

n = int(input())

linked_list = deque([])

for _ in range(n):
    command = input()

    if "insert" in command:
        x = command.split()[-1]
        linked_list.appendleft(x)
    elif command == "deleteFirst":
        linked_list.popleft()
    elif command == "deleteLast":
        linked_list.pop()
    elif "delete" in command:
        x = command.split()[-1]
        if x in linked_list:
            linked_list.remove(x)

print(*linked_list)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))

for i in range(0, N):
    v = A[i]
    j = i
    while (j >= 0) and (A[j] > j):
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v

    for k in range(N):
        print('{0} '.format(A[k]), end='')
    print()


Fixed submission:
# -*- coding: utf-8 -*-


def show(A):
    for k in range(N):
        if k == N - 1:
            print('{0}'.format(A[k]))
        else:
            print('{0}'.format(A[k]), end=' ')


N = int(input())
A = list(map(int, input().split()))
show(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] = A[j], v
        j -= 1

    show(A)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def insertionSort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g

        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

    print_line(A, cnt)


def shellSort(A, n):
    m = 0
    G = []
    while n >= (3 ** m - 1) / 2:
        m += 1
        G.append((3 ** m - 1) / 2)

    print(m)
    for i in range(len(G)):
        if i == len(G) - 1:
            print(G[i])
        else:
            print("{0}".format(G[i]), end=' ')

    for i in range(m):
        insertionSort(A, n, G[i])


def print_line(A, cnt):
    print(cnt)
    for i in range(len(A)):
        print(A[i])


A = []
n = int(input())
for i in range(n):
    A.append(int(input()))

shellSort(A, n)


Fixed submission:
# -*- coding: utf-8 -*-


def insertionSort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g

        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

    return cnt


def shellSort(A, n):
    cnt = 0
    m = 1
    G = []
    while True:
        if n < int((3 ** m - 1) / 2):
            m -= 1
            break
        else:
            G.append(int((3 ** m - 1) / 2))
            m += 1

    G.reverse()

    for i in range(m):
        cnt += insertionSort(A, n, G[i])

    print_line(A, G, m, cnt)


def print_line(A, G, m, cnt):
    print(m)
    for i in range(len(G)):
        if i == len(G) - 1:
            print(G[i])
        else:
            print("{0}".format(G[i]), end=' ')
    print(cnt)
    for i in range(len(A)):
        print(A[i])

A = []
n = int(input())
for i in range(n):
    A.append(int(input()))

shellSort(A, n)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())
s = list(input().split())
n = int(input())
t = list(input().split())
cnt = 0
for i in range(n):
    if t[i] in s:
        cnt += 1

print(cnt)


Fixed submission:
# -*- coding: utf-8 -*-

input()
s = set(input().split())
input()
t = set(input().split())
print(len(s & t))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

input()
s = set(input().split())
input()
t = set(input().split())
print(int(s & t))


Fixed submission:
# -*- coding: utf-8 -*-

input()
s = set(input().split())
input()
t = set(input().split())
print(len(s & t))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

input()
s = set(input().split())
input()
t = set(input().split())
print(int(s & t))


Fixed submission:
# -*- coding: utf-8 -*-

input()
s = set(input().split())
input()
t = set(input().split())
print(len(s & t))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

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


Fixed submission:
# -*- coding: utf-8 -*-

import math

x1, y1, x2, y2 = map(float, input().split())
dis = math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
print(dis)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

from statistics import stdev

while True:
    n = int(input())

    if n == 0:
        break

    s = list(map(int, input().split()))
    print(stdev(s))



Fixed submission:
# -*- coding: utf-8 -*-

import math

while True:
    n = int(input())

    if n == 0:
        break

    s = list(map(float, input().split()))
    mean = sum(s) / len(s)

    for i in range(len(s)):
        s[i] = (s[i] - mean) * (s[i] - mean)

    variance = sum(s) / len(s)
    stdev = math.sqrt(variance)

    print(stdev)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

while True:
    n = int(input())

    if n == 0:
        break

    s = list(map(float, input().split()))
    mean = sum(s) / len(s)

    for i in range(len(s)):
        s[i] = (s[i] - sum) * (s[i] - sum)

    variance = sum(s) / len(s)
    stdev = math.sqrt(variance)

    print(stdev)


Fixed submission:
# -*- coding: utf-8 -*-

import math

while True:
    n = int(input())

    if n == 0:
        break

    s = list(map(float, input().split()))
    mean = sum(s) / len(s)

    for i in range(len(s)):
        s[i] = (s[i] - mean) * (s[i] - mean)

    variance = sum(s) / len(s)
    stdev = math.sqrt(variance)

    print(stdev)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
abs_xy = []

for i in range(n):
    abs_xy.append(abs(x[i] - y[i]))

d1 = sum(abs_xy)

d2 = 0
for i in range(n):
    d2 += abs_xy * abs_xy
d2 = math.sqrt(d2)

d3 = 0
for i in range(n):
    d3 += abs_xy * abs_xy * abs_xy
d3 = math.pow(d3, 1/3)

d = max(abs_xy)

print(d1)
print(d2)
print(d3)
print(d)


Fixed submission:
# -*- coding: utf-8 -*-

import math

n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
abs_xy = []

for i in range(n):
    abs_xy.append(abs(x[i] - y[i]))

d1 = sum(abs_xy)

d2 = 0
for i in range(n):
    d2 += abs_xy[i] * abs_xy[i]
d2 = math.sqrt(d2)

d3 = 0
for i in range(n):
    d3 += abs_xy[i] * abs_xy[i] * abs_xy[i]
d3 = math.pow(d3, 1/3)

d = max(abs_xy)

print(d1)
print(d2)
print(d3)
print(d)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = []
while True:
    n = input()
    if n == 0:
        break
    a.append(n)

for i in len(a):
    print('Case%s: %s' %(i + 1, a[i]))



Fixed submission:
# -*- coding: utf-8 -*-
c = 1
while True:
    n = int(input())
    if n == 0:
        break
    print('Case {0}: {1}'.format(c, n))
    c += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
    x = int(input())
    if x == 0: break
    print("Case {}: {}".format(i, n))
    i += 1


Fixed submission:
# -*- coding: utf-8 -*-
c = 1
while True:
    n = int(input())
    if n == 0:
        break
    print('Case {0}: {1}'.format(c, n))
    c += 1
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
n = list(map(int, input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * 2 * math.pi, n[0] * n[0] * math.pi))


Fixed submission:
# -*- coding: utf-8 -*-
import math
n = list(map(float, input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * n[0] * math.pi, n[0] * 2 * math.pi))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
n = list(map(input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * 2 * math.pi, n[0] * n[0] * math.pi))


Fixed submission:
# -*- coding: utf-8 -*-
import math
n = list(map(float, input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * n[0] * math.pi, n[0] * 2 * math.pi))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
n = list(map(float, input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * n[0] * math.pi), n[0] * 2 * math.pi)


Fixed submission:
# -*- coding: utf-8 -*-
import math
n = list(map(float, input().split()))
print('{0:.6f} {1: .6f}'.format(n[0] * n[0] * math.pi, n[0] * 2 * math.pi))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int , input().split()))
a.reverse()

for i in len(a):
    print('{0} '.format(a[i]))



Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int, input().split()))
a.reverse()

for i in range(n):

    if i is n - 1:
        print('{0}'.format(a[i]))
    else:
        print('{0} '.format(a[i]), end='')

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int, input().split()))
a.reverse()

for i in n:
    print('{0} '.format(a[i]))



Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int, input().split()))
a.reverse()

for i in range(n):

    if i is n - 1:
        print('{0}'.format(a[i]))
    else:
        print('{0} '.format(a[i]), end='')
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

n = int(input())
s = []
h = []
c = []
d = []

for i in range(13):
    s.append(i + 1)
    h.append(i + 1)
    c.append(i + 1)
    d.append(i + 1)

for j in range(n):
    x = list(input().split())
    if x[0] is 'S':
        s.remove(int(x[1]))
    elif x[0] is 'H':
        h.remove(int(x[1]))
    elif x[0] is 'C':
        c.remove(int(x[1]))
    elif x[0] is 'D':
        d.remove(int(x[1]))

if len(s) != 0:
    for i in range(len(s)):
        print('{0} {1}'.format('S', s[i]))

if len(h) != 0:
    for i in range(len(h)):
        print('{0} {1}'.format('H', h[i]))

if len(c) != 0:
    for i in range(len(c)):
        print('{0} {1}'.format('C', c[i]))

while len(d) != 0:
    for i in range(len(d)):
        print('{0} {1}'.format('D', d[i]))


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
s = []
h = []
c = []
d = []

for i in range(13):
    s.append(i + 1)
    h.append(i + 1)
    c.append(i + 1)
    d.append(i + 1)

for j in range(n):
    x = list(input().split())
    if x[0] is 'S':
        s.remove(int(x[1]))
    elif x[0] is 'H':
        h.remove(int(x[1]))
    elif x[0] is 'C':
        c.remove(int(x[1]))
    elif x[0] is 'D':
        d.remove(int(x[1]))

if len(s) != 0:
    for i in range(len(s)):
        print('{0} {1}'.format('S', s[i]))

if len(h) != 0:
    for i in range(len(h)):
        print('{0} {1}'.format('H', h[i]))

if len(c) != 0:
    for i in range(len(c)):
        print('{0} {1}'.format('C', c[i]))

if len(d) != 0:
    for i in range(len(d)):
        print('{0} {1}'.format('D', d[i]))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

r, c = list(map(int, input().split()))
a = []
line_sum = 0

for i in range(r):
    a.append(list(map(int, input().split())))

for i in range(r):
    for j in range(c + 1):
        if j == c:
            print('{0}'.format(sum(a[i])))
            line_sum += sum(a[i])
        else:
            print('{0} '.format(a[i][j]), end='')

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

    print('{0} '.format(column_sum), end='')

print(line_sum)


Fixed submission:
# -*- coding: utf-8 -*-

r, c = list(map(int, input().split()))
a = []
line_sum = 0

for i in range(r):
    a.append(list(map(int, input().split())))

for i in range(r):
    for j in range(c + 1):
        if j == c:
            print('{0}'.format(sum(a[i])))
            line_sum += sum(a[i])
        else:
            print('{0} '.format(a[i][j]), end='')

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

    print('{0} '.format(column_sum), end='')

print(line_sum)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n, m, l = list(map(int, input().split()))
a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))

for i in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    for j in range(l):
        mat_sum = 0
        for k in range(m):
            mat_sum += a[n][m] * b[m][l]
        print('{0} '.format(mat_sum), end='')
    print()


Fixed submission:
# -*- coding: utf-8 -*-

n, m, l = list(map(int, input().split()))
a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))

for i in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    for j in range(l):
        mat_sum = 0
        for k in range(m):
            mat_sum += a[i][k] * b[k][j]
        if j == l - 1:
            print('{0}'.format(mat_sum), end='')
        else:
            print('{0} '.format(mat_sum), end='')
    print()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

w = sys.stdin.readline().strip()
count = 0

while True:
    t = list(map(int, input().split()))

    if 'END_OF_TEXT' in t:
        break

    for i in range(len(t)):
        if t[i].lower() == w:
            count += 1

print(count)



Fixed submission:
# -*- coding: utf-8 -*-

import sys

w = sys.stdin.readline().strip()
count = 0

while True:
    t = list(map(str, input().split()))

    if 'END_OF_TEXT' in t:
        break

    for i in range(len(t)):
        if t[i].lower() == w:
            count += 1

print(count)