qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys


def main():
    n = int(sys.stdin.readline())
    notices = []
    for i in range(n):
        notices.append(tuple(map(int, sys.stdin.readline().split())))
    buildings = [[[0] * 10 for i in range(3)] for j in range(4)]
    for b, f, r, v in notices:
        buildings[b-1][f-1][r-1] += v
    separator = '####################'
    for index, building in enumerate(buildings):
        for floor in building:
            print(' '.join(map(str, floor)))
        if index != len(buildings)-1:
            print(separator)
    return


if __name__ == '__main__':
    main()



Fixed code:
import sys


def main():
    n = int(sys.stdin.readline())
    notices = []
    for i in range(n):
        notices.append(tuple(map(int, sys.stdin.readline().split())))
    buildings = [[[0] * 10 for i in range(3)] for j in range(4)]
    for b, f, r, v in notices:
        buildings[b-1][f-1][r-1] += v
    separator = '####################'
    for index, building in enumerate(buildings):
        for floor in building:
            print(' ' + ' '.join(map(str, floor)))
        if index != len(buildings)-1:
            print(separator)
    return


if __name__ == '__main__':
    main()
Buggy code:
# (c) midandfeed
q = []
for i in range(4):
	b = []
	for j in range(3):
		a = [0 for x in range(10)]
		b.append(a)
	q.append(b)

t = int(input())
for _ in range(t):
	b, f, r, v = [int(x) for x in input().split()]
	q[b-1][f-1][r-1] += v

i = 0
for x in q:
	i += 1
	for y in x:
		for z in range(len(y)):
			print(" {}".format(y[z]), end='')
			if (z==(len(y))-1):
				print()
	if (i!=t):	
		print("#"*20)

Fixed code:
# (c) midandfeed
q = []
for i in range(4):
	b = []
	for j in range(3):
		a = [0 for x in range(10)]
		b.append(a)
	q.append(b)

t = int(input())
for _ in range(t):
	b, f, r, v = [int(x) for x in input().split()]
	q[b-1][f-1][r-1] += v

a = 0
for x in q:
	a += 1
	for y in x:
		for z in range(len(y)):
			print(" {}".format(y[z]), end='')
			if (z==(len(y))-1):
				print()
	if (a!=4):	
		print("#"*20)
Buggy code:
rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    a,b,c,d = map(int, input().split())
    rooms[a-1][b-1][c-1] += d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(rooms[i][j][k], end = "")
            if k != 9:
                print(" ", end="")
        if i != 3 or j !=2:
            print()
    if i != 3:
        print("####################")


Fixed code:
rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    a,b,c,d = map(int, input().split())
    rooms[a-1][b-1][c-1] += d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(rooms[i][j][k]), end = "")
        print()
    if i != 3:
        print("####################")
Buggy code:
n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] = v
for i, v in enumerate(A, 1):
    print(' '.join([str(p) for p in v]))
    if i == 3 or i == 6 or i == 9:
        print('####################')
print()


Fixed code:
n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] += v
for i, v in enumerate(A, 1):
    print(' ' + ' '.join([str(p) for p in v]))
    if i == 3 or i == 6 or i == 9:
        print('####################')
Buggy code:
n = int(input())
dormitory = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for i in range(n):
    data = [int(j) for j in list(input().split())]
    tower = data[0]-1
    rank = data[1]-1
    room = data[2]-1
    dormitory[tower][rank][room] += data[3]

for i in range(0, 4):
    for j in range(0, 3):
        print(" ".join(map(str, dormitory[i][j])))
    if i == 3:
        break
    else:
        print('#'*20)
    

Fixed code:
n = int(input())
dormitory = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for i in range(n):
    data = [int(j) for j in list(input().split())]
    tower = data[0]-1
    rank = data[1]-1
    room = data[2]-1
    dormitory[tower][rank][room] += data[3]

for i in range(0, 4):
    for j in range(0, 3):
        print(" "+" ".join(map(str, dormitory[i][j])))
    if i == 3:
        break
    else:
        print('#'*20)
Buggy code:
# coding: utf-8
# Here your code !

num_j = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

n = int(input())

for _ in range(n):
    b,r,f,v = map(int,input().split())
    num_j[b-1][r-1][f-1] += v

for i in range(4):
    for j in range(3):
        #print(" ",end="")       
        print(" ".join(map(str,num_j[i][j])))
    print("#"*20)

Fixed code:
# coding: utf-8
# Here your code !

num_j = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

n = int(input())

for _ in range(n):
    b,r,f,v = map(int,input().split())
    num_j[b-1][r-1][f-1] += v

for i in range(4):
    for j in range(3):
        print(" ",end="")       
        print(" ".join(map(str,num_j[i][j])))
    
    if i != 3:
        print("#"*20)
Buggy code:
l = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for num in range(n):
    b,f,r,v = [int(x) for x in input().split()]
    data[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('', l[b][f][r], end='')
        print("")
    if b != 3:
        print("#" * 20)

Fixed code:
l = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for num in range(n):
    b,f,r,v = [int(x) for x in input().split()]
    l[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('', l[b][f][r], end='')
        print("")
    if b != 3:
        print("#" * 20)
Buggy code:


#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""

rooms = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

number = int(input())

for n in range(number):
    inp = input().split(" ")
    b = int(inp[0]) - 1
    f = int(inp[1]) - 1
    r = int(inp[2]) - 1
    v = int(inp[3])
    rooms[b][f][r] += v

for b in range(4):
    if b > 0:
        print("####################")
    for f in range(3):
        print(" ".join(map(str,rooms[b][f])))

Fixed code:


#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
??´?????????
"""

rooms = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

number = int(input())

for n in range(number):
    inp = input().split(" ")
    b = int(inp[0]) - 1
    f = int(inp[1]) - 1
    r = int(inp[2]) - 1
    v = int(inp[3])
    rooms[b][f][r] += v

for b in range(4):
    if b > 0:
        print("####################")
    for f in range(3):
        print(""," ".join(map(str,rooms[b][f])))
Buggy code:
n = int(input())
list = [[0 for i in range(10)] for j in range(12)]
for i in range(n):
    b,f,r,v = map(int,input().split())
    list[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('{}'.format(list[i][j]),end = "")
        if j != 9:
            print(' ',end = "")
        else:
            print('')

Fixed code:
n = int(input())
list = [[0 for i in range(10)] for j in range(12)]
for i in range(n):
    b,f,r,v = map(int,input().split())
    list[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(' {}'.format(list[i][j]),end = "")
        if j == 9:
            print('')
Buggy code:
n = int(input())
a = []

a = [[[0]*10 for _ in range(3)] for _ in range(4)]

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

for i in range(4):
    for j in range(3):
        print('',*a[i][j])
    print('#'*20)

    


Fixed code:
n = int(input())
a = []

a = [[[0]*10 for _ in range(3)] for _ in range(4)]

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

for i in range(4):
    for j in range(3):
        print('',*a[i][j])
    if i != 3:
        print('#'*20)
Buggy code:
Residents = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    b ,f ,r ,v  = list(map(int,input().split()))
    Residents[b-1][f-1][r-1] += v
for k in range(4):
    for j in range(3):
        print(' '+ ' '.join(map(str,Residents[k][j])))
    print('####################') 


Fixed code:
Residents = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    b ,f ,r ,v  = list(map(int,input().split()))
    Residents[b-1][f-1][r-1] += v
for k in range(4):
    for j in range(3):
        print(' '+ ' '.join(map(str,Residents[k][j])))
    if (k ==3): break
    print('####################')
Buggy code:
num = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]

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

for b in range(4):
    for f in range(3):
        print(" ".join(map(str, num[b][f])))
    if b < 3:
        print("#"*20)


Fixed code:
num = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]

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

for b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, num[b][f])))
    if b < 3:
        print("#"*20)
Buggy code:
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:
        print("####################")
    for j in range(10):
        print(" ",of[i][j],sep="",end="")
    print("")

Fixed code:
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 code:
n = int(input())
a =[[[0 for i in range(10)]for j in range(3)]for k in range(4)]

for i in range(n):
    b, f, r, v = map(int, input().split())

    a[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", a[i][j][k], end=' ')
        print()
    if i != 3:
        print("#" * 20) 

Fixed code:
n = int(input())
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

for i in range(4):
  if i != 0:
      print("#"*20)
  for j in range(3):
      for k in range(10):
        print(" %d"%(count[i][j][k]), end="")
      print()
Buggy code:
h = [ [ [ 0 for x in range(0, 10) ] for y in range(0, 3) ] for z in range(0, 4) ]
for i in range(0, int(input())):
    b,f,r,v = map(int, input().split())
    h[b-1][f-1][r-1] += v
c = 1
for x in h:
    for y in x:
        print(" ".join(map(str, y)))
    if c < 4:
        print("#" * 20)
    c += 1

Fixed code:
h = [ [ [ 0 for x in range(0, 10) ] for y in range(0, 3) ] for z in range(0, 4) ]
for i in range(0, int(input())):
    b,f,r,v = map(int, input().split())
    h[b-1][f-1][r-1] += v
c = 1
for x in h:
    for y in x:
        print(" " + " ".join(map(str, y)))
    if c < 4:
        print("#" * 20)
    c += 1
Buggy code:
A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',A[b][f][r],end='')
        print()
    if i != 3:
        print('#'*20)

Fixed code:
A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',A[b][f][r],end='')
        print()
    if b != 3:
        print('#'*20)
Buggy code:
def main():

    rooms = [[0 for i in range(10)] for j in range(12)]
    x = int(input())
    for _ in range(x):
        b, f, r, v = tuple(map(int, input().split()))
        rooms[(b-1)*3+(f-1)][r-1] = v

    for i in range(4):
        for j in range(3):
            for k in range(10):
                print(" "+str(rooms[i*3+j][k]), end="")
            print()
        print("#"*20)

if __name__ == '__main__':
    main()


Fixed code:
def main():

    rooms = [[0 for i in range(10)] for j in range(12)]
    x = int(input())
    for _ in range(x):
        b, f, r, v = tuple(map(int, input().split()))
        rooms[(b-1)*3+(f-1)][r-1] += v

    for i in range(4):
        for j in range(3):
            for k in range(10):
                print(" "+str(rooms[i*3+j][k]), end="")
            print()
        if i != 3:
            print("#"*20)

if __name__ == '__main__':
    main()
Buggy code:
s = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, raw_input().split())
        s[b-1][f-1][r-1] += v
 
    for b in range(4):
        for f in range(3):
            print(" " + " ".join(map(str, s[b][f])))
        if b != 3:
            print("#"*20)

Fixed code:
n=int(input())
build=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    build[b-1][f-1][r-1]+=v

for k in range(4):
    for j in range(3):
        print(" "+" ".join([str(x) for x in build[k][j]]))
    if k!=3:
        print("#"*20)
Buggy code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())
for nc in range(n):
    (b, f, r, v) = [int(i) for i in input().split()]
    data[b - 1][f - 1][r - 1] += v



for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' {0}'.format(data[b][f][r]), end='')
        print()
    print('#' * 20)

Fixed code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]

n = int(input())
for nc in range(n):
    (b, f, r, v) = [int(i) for i in input().split()]
    data[b - 1][f - 1][r - 1] += v



for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' {0}'.format(data[b][f][r]), end='')
        print()
    print('#' * 20) if b < 4 -1 else print(end='')
Buggy code:
n = int(input())
h = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
    b, f, r, v = [int(e) for e in input().split()]
    h[b-1][f-1][r-1] += v
for i, b in enumerate(h):
    if i != 0:
        print('#'*20)
    for f in b:
        print(*f)

Fixed code:
n = int(input())
h = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
    b, f, r, v = [int(e) for e in input().split()]
    h[b-1][f-1][r-1] += v
for i, b in enumerate(h):
    if i != 0:
        print('#'*20)
    for f in b:
        print(' ', end='')
        print(*f)
Buggy code:
l=[[["0" for i in range(10)] for i in range(3)] for i in range(4)]
n=int(input())
for i in range(n):
	a,b,c,d=list(map(int,input().split()))
	l[a-1][b-1][c-1]=str(d)
for i in l:
	for j in i:
		print(" ".join(j))
	if not i==l[-1]:
		print("####################")

Fixed code:
l=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
n=int(input())
for i in range(n):
	a,b,c,d=list(map(int,input().split()))
	l[a-1][b-1][c-1]+=d
for i in l[:-1]:
	for j in i:
		print(" "+" ".join(list(map(str,j))))
	print("####################")

for j in l[-1]:
	print(" "+" ".join(list(map(str,j))))
Buggy code:
n = int(input())
info = []
for _ in range(n):
    temp = [int(x) for x in input().split( )]
    info.append(temp)
state = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for a in info:
    state[a[0]-1][a[1]-1][a[2]-1] += a[3]
for b in range(4):
    for f in range(3):
        string = ''
        for k in range(10):
            string += str(state[b][f][k])+' '
        print(string)
    print('#'*20)



Fixed code:
n = int(input())
info = []
for _ in range(n):
    temp = [int(x) for x in input().split( )]
    info.append(temp)
state = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for a in info:
    state[a[0]-1][a[1]-1][a[2]-1] += a[3]
for b in range(4):
    for f in range(3):
        string = ''
        for k in range(10):
            string += ' ' + str(state[b][f][k])
        print(string)
    if b < 3:
        print('#'*20)
Buggy code:
room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

sep = "#"*20

for i in range(4):
  for j in range(3):
    print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i][j][2],room[i][j][3],room[i][j][4],room[i][j][5],room[i][j][6],room[i][j][7],room[i][j][8],room[i][j][9]))
  if j != 3:
    print(sep)


Fixed code:
room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

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

sep = "#"*20

for i in range(4):
  for j in range(3):
    print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i][j][2],room[i][j][3],room[i][j][4],room[i][j][5],room[i][j][6],room[i][j][7],room[i][j][8],room[i][j][9]))
  if i < 3:
    print(sep)
Buggy code:
house = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n = int(input())
for i in range(n):
	b,f,r,v = map(int,input().split())
	house[b][f][r] += v

for i in range(4):
	for j in range(3):
		for k in range(10):
			print(' ',end='')
			if k != 9:
				print(house[i][j][k],end='')
			else:
				print(house[i][j][k])
	if i<3:
		print('####################')


Fixed code:
house = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
n = int(input())
for i in range(n):
	b,f,r,v = map(int,input().split())
	house[b-1][f-1][r-1] += v

for i in range(4):
	for j in range(3):
		for k in range(10):
			print(' ',end='')
			if k != 9:
				print(house[i][j][k],end='')
			else:
				print(house[i][j][k])
	if i<3:
		print('####################')
Buggy code:
rooms = [0] * (4*3*10)
count = int(input())
for i in range(count):
    b, f, r, v = [int(x) for x in input().split()]
    rooms[30*(b-1) + 10*(f-1) + (r-1)] += v
  
for i, room in enumerate(rooms, start=1):
    if i%10 == 0:
        print(room)
    else:
        print(room, end=' ')
    if i%30 == 0 and i%120 != 0:
        print('#'*20)

Fixed code:
rooms = [0] * (4*3*10)
count = int(input())
for i in range(count):
    b, f, r, v = [int(x) for x in input().split()]
    rooms[30*(b-1) + 10*(f-1) + (r-1)] += v
  
for i, room in enumerate(rooms, start=1):
    print('', room, end='')
    if i%10 == 0:
        print()
    if i%30 == 0 and i%120 != 0:
        print('#'*20)
Buggy code:
#coding: utf-8

n = int(input())

x = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]


for i in range(n):
    b, f, r, v = (int(j) for j in input().split())
    x[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(x[i][j][k]), end = '' if k != 9 else '\n')

    print("#"*20 if i != 3 else '' ,end='')


Fixed code:
#coding: utf-8

n = int(input())

x = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]


for i in range(n):
    b, f, r, v = (int(j) for j in input().split())
    x[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(x[i][j][k]), end = '' if k != 9 else '\n')

    print("#"*20 if i != 3 else '', end='\n'if i != 3 else '')
Buggy code:
array=[[0 for i in range(10)]for j in range(12)]
n=int(input())

for i in range(n):
    call=list(map(int,input().split()))
    array[(call[0]-1)*3-1+call[1]][call[2]-1]+=call[3]
for i in range(0,12):
    if i%3==0 and i!=0:
        for j in range(10):
            print("#",end=" ")
        print()
    for j in range(10):
        print(array[i][j],end=" ")
    print()

Fixed code:
array=[[0 for i in range(10)]for j in range(12)]
n=int(input())

for i in range(n):
    call=list(map(int,input().split()))
    array[(call[0]-1)*3-1+call[1]][call[2]-1]+=call[3]
for i in range(0,12):
    if i%3==0 and i!=0:
        for j in range(20):
            print("#",end="")
        print()
    for j in range(10):
        print(" "+str(array[i][j]),end="")
    print()
Buggy code:
# -*- Coding: utf-8 -*-
# ???????????????
info = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

# ?????????????????°
n = int(input())

# ?????????????????????????????????
for i in range(n):
    b,f,r,v = map(int,list(input().split()))
    info[b-1][f-1][r-1] += v

# ???????????????
for i in range(4):
    if i != 0:
        print('####################')
    for j in range(3):
        print(' '.join(map(str,info[i][j])))

Fixed code:
# -*- Coding: utf-8 -*-
# ???????????????
info = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

# ?????????????????°
n = int(input())

# ?????????????????????????????????
for i in range(n):
    b,f,r,v = map(int,list(input().split()))
    info[b-1][f-1][r-1] += v

# ???????????????
for i in range(4):
    if i != 0:
        print('####################')
    for j in range(3):
        print(' '+' '.join(map(str,info[i][j])))
Buggy code:
N=int(input())
l=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(N):
    b, f, r, v = map(lambda x: int(x)-1, input().split())
    l[b][f][r]+=v+1
for j in range(4):
    for k in l[j]:
        print(" ".join(map(str, k)))
    if j < 3:
        print("####################")

Fixed code:
N=int(input())
l=[[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(N):
    b, f, r, v = map(lambda x: int(x)-1, input().split())
    l[b][f][r]+=v+1
for j in range(4):
    for k in l[j]:
        print(" "+" ".join(map(str, k)))
    if j < 3:
        print("####################")
Buggy code:
house = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for i in range(int(input())):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        house[b][f] = ' ' + ' '.join(map(str, house[b][f]))
    house[b] = '\n'.join(map(str, house[b])) + '\n'
house = '#' * 20 + '\n' + '\n'.join(map(str, house))
print(house)

Fixed code:
house = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for i in range(int(input())):
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        house[b][f] = ' ' + ' '.join(map(str, house[b][f]))
    house[b] = '\n'.join(map(str, house[b])) + '\n'
border = '#' * 20 + '\n'
house = border.join(map(str, house))
print(house.rstrip())
Buggy code:
# -*-coding:utf-8

import fileinput
import math

def main():
    offiHouse = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]   #y, x, z

    n = int(input())

    for i in range(n):
        a, b, c, d = map(int, input().split())

        offiHouse[a-1][b-1][c-1] += d

    for i in range(4):
        for j in range(3):
            for k in range(10):
                if(k == 9):
                    print('%d' % offiHouse[i][j][k])
                else:
                    print('%d ' % offiHouse[i][j][k], end='')

        if(i != 3):
            print('####################')

if __name__ == '__main__':
    main()

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

import fileinput
import math

def main():
    offiHouse = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]   #y, x, z

    n = int(input())

    for i in range(n):
        a, b, c, d = map(int, input().split())

        offiHouse[a-1][b-1][c-1] += d

    for i in range(4):
        for j in range(3):
            for k in range(10):
                print('', offiHouse[i][j][k], end='')
            print()
        if(i != 3):
            print('#' * 20)

if __name__ == '__main__':
    main()