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

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

a = [input().split() for k in range(c)]

for l in range(r):
    for m in range(c):
        list[l][c] += int(a[l][m])
        list[r][m] += int(a[l][m])
        list[l][m] = int(a[l][m])

for n in range(r):
    print(list[r][c])
    print(int(a[n][c-1]))
    list[r][c] += list[n][c]

print(list)


Fixed submission:
#coding: UTF-8
import sys

H, W = map(int, input().split())
table = [[0]*(W+1) for i in range(H+1)]
# list = [[0 for i in range(W+1)] for j in range(H+1)]

for row in range(H):
    pre_table = list(map(int, input().split()))
    for col in range(W):
        table[row][col] = pre_table[col]

for row in range(H):
    for col in range(W):
        table[row][W] += table[row][col]

for col in range(W+1):
    for row in range(H):
        table[H][col] += table[row][col]

for row in range(H+1):
    print("%d"%(table[row][0]), end="")
    for col in range(1, W+1):
        print(" %d"%(table[row][col]), end = "")
    print()

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

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

a = [input().split() for k in range(c)]

for l in range(r):
    for m in range(c):
        list[l][c] += int(a[l][m])
        list[r][m] += int(a[l][m])
        list[l][m] = int(a[l][m])

for n in range(r):
    print(list[r][c])
    print(int(a[n][c-1]))
    list[r][c] += list[n][c]

print(list)


Fixed submission:
#coding: UTF-8
import sys

H, W = map(int, input().split())
table = [[0]*(W+1) for i in range(H+1)]
# list = [[0 for i in range(W+1)] for j in range(H+1)]

for row in range(H):
    pre_table = list(map(int, input().split()))
    for col in range(W):
        table[row][col] = pre_table[col]

for row in range(H):
    for col in range(W):
        table[row][W] += table[row][col]

for col in range(W+1):
    for row in range(H):
        table[H][col] += table[row][col]

for row in range(H+1):
    print("%d"%(table[row][0]), end="")
    for col in range(1, W+1):
        print(" %d"%(table[row][col]), end = "")
    print()

Buggy python submission (verdict: Runtime Error):
#coding: UTF-8
import sys

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

a = [input().split() for k in range(c)]

for l in range(r):
    for m in range(c):
        list[l][c] += int(a[l][m])
        list[r][m] += int(a[l][m])
        list[l][m] = int(a[l][m])

for n in range(r):
    list[r][c] += list[n][c]

for o in range(r+1):
    for p in range(c+1):
        print(list[o][p], " ", end = '')
    print(" ")


Fixed submission:
#coding: UTF-8
import sys

H, W = map(int, input().split())
table = [[0]*(W+1) for i in range(H+1)]
# list = [[0 for i in range(W+1)] for j in range(H+1)]

for row in range(H):
    pre_table = list(map(int, input().split()))
    for col in range(W):
        table[row][col] = pre_table[col]

for row in range(H):
    for col in range(W):
        table[row][W] += table[row][col]

for col in range(W+1):
    for row in range(H):
        table[H][col] += table[row][col]

for row in range(H+1):
    print("%d"%(table[row][0]), end="")
    for col in range(1, W+1):
        print(" %d"%(table[row][col]), end = "")
    print()