Problem:
Official House You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room. For each notice, you are given four integers b , f , r and v which represent that v persons entered to room r of f th floor at building b . If v is negative, it means that −v persons left. Assume that initially no person lives in the building. Input In the first line, the number of notices n is given. In the following n lines, a set of four integers b , f , r and v which represents i th notice is given in a line. Output For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings. Constraints  No incorrect building, floor and room numbers are given.  0 ≤ the number of tenants during the management ≤ 9  Sample Input 3
1 1 3 8
3 2 2 7
4 3 8 1 Sample Output 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0

Solution (Python):
n=int(input())

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

def print_floor(b):
    for i in range(3):
        for j in range(10):
            print(" "+str(resident[b][i][j]),end="")
        print()


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

for i in range(4):
    print_floor(i)
    if i!=3:
        for j in range(20):
            print("
        print()

Solution (Python):
n = int(input())

rooms = {}

for i in range(1, 5):
    rooms[i] = {}
    for j in range(1, 4):
        rooms[i][j] = {}
        for k in range(1, 11):
            rooms[i][j][k] = 0

for i in range(n):
    b, f, r, v = map(int, input().split())
    rooms[b][f][r] += v
    
for i in range(1, 5):
    for j in range(1, 4):
        for k in range(1, 11):
            
            print(f' {rooms[i][j][k]}', end='')
        print()

    if i < 4:
        print('

Solution (Python):
table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

N = int(input())

for loop in range(N):
    house_id,floor,room,add = map(int,input().split())
    table[house_id-1][floor-1][room-1] += add


x = 0

for i in range(4):
    if x != 0:
        print("
    x += 1

    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Solution (Python):
N = int(input())
B = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]
for i in range(N):
    b,f,r,v = map(int,input().split())
    B[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' {}'.format(B[i][j][k]),end='')
        print()
    if i != 3:
        print('

Solution (Python):
p = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]

num = int(input())

for i in range(num):
    b,f,r,v = [ int(x) for x in input().split()]
    p[b-1][f-1][r-1] += v
    
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ",end="")
            print(p[i][j][k],end="")
        print()
    if i < 3:
        print("

Solution (Python):
n = int(input())
houseInfo = [[0] * 10 for _ in range(12)]

for i in range(n):
    b, f, r, v = list(map(int, input().split()))
    
    base = ((b - 1) * 3) + (f - 1)

    houseInfo[base][r - 1] += v

count = 1
index = 0
while index < len(houseInfo):
    if count % 4 == 0:
        print("
    else:
        print(" ", end="")
        print(*houseInfo[index])
        index += 1

    count += 1

Solution (Python):
n=int(input())
b=[0]*n
f=[0]*n
r=[0]*n
v=[0]*n
for i in range(0,n):
    b[i],f[i],r[i],v[i]=(int(x) for x in input().split())
for i in range(1,5):
    for j in range(1,4):
        for k in range(1,11):
            sum=0
            for l in range(n):
                if b[l]==i and f[l]==j and r[l]==k:
                    sum+=v[l]
            if k!=10:
                print(" %d"%sum,end="")
            else:
                print(" %d"%sum)
    if i!=4:
        print("

Solution (Python):
n = int(input())

bldg = [[[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())
	
	bldg[b-1][f-1][r-1] = bldg[b-1][f-1][r-1] + v



for a in range(4):
		for b in range(3):
			for c in range(10):
					print(" " + str(bldg[a][b][c]), end = "")
			print()
		if a != 3:
			for i in range(20):
				print("
			print()

Solution (Python):
tower1 = [[0]*10 for i in range(3)]
tower2 = [[0]*10 for i in range(3)]
tower3 = [[0]*10 for i in range(3)]
tower4 = [[0]*10 for i in range(3)]

n = int(input())

for _ in range(n):
	b,f,r,v = map(int,input().split())
	
	if b == 1:
		tower1[f-1][r-1] += v
	elif b == 2:
		tower2[f-1][r-1] += v
	elif b == 3:
		tower3[f-1][r-1] += v
	elif b == 4:
		tower4[f-1][r-1] += v
		
for i in tower1:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))

print("

for i in tower2:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))

print("

for i in tower3:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))
	
print("

for i in tower4:
	print(str.format(" {} {} {} {} {} {} {} {} {} {}",i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],i[9]))

Solution (Python):
class town:
    def __init__(self,room,height):
        
        self.a = [[0] * room for i in range(height)]
        self.b = [[0] * room for i in range(height)]
        self.c = [[0] * room for i in range(height)]
        self.d = [[0] * room for i in range(height)]
    def in_out(self,b,f,r,v):
        str_h = self.check(b)
        str_h[f][r] += v
    def check(self,b):
        if b == 1:
            return self.a
        if b == 2:
            return self.b
        if b == 3:
            return self.c
        if b == 4:
            return self.d
    def open_house(self):
        for a in self.a:
            print(end=' ')
            print(*a)
        print('
        for b in self.b:
            print(end=' ')
            print(*b)
        print('
        for c in self.c:
            print(end=' ')
            print(*c)
        print('
        for d in self.d:
            print(end=' ')
            print(*d)
counts = int(input())
mytown = town(10,3)
for c in range(counts):
    b,f,r,v = map(int,input().split(' '))
    mytown.in_out(b,f-1,r-1,v)
mytown.open_house()

Solution (Python):
building = [[[0]*10 for i in range(3)] for j in range(4)]

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' {0}' .format(building[i][j][k]), end='')
        print()
    if i < 3:
        print('

Solution (Python):
wall = "
n = int(input())
dat = []
for _ in range(12):
    dat.append([0] * 10)

for _ in range(n):
    b,f,r,v = map(int, input().split())
    dat[3 * (b - 1) + ( f-1)][r - 1] += v
for i in range(12):
    print(" ",end="")
    print(" ".join(map(str, dat[i])))
    if i % 3 == 2 and i!=11:
        print(wall)

Solution (Python):

fidge_number = 4
floor_number = 3
room_number = 10
residents_data = list()


for x in range(fidge_number):
    residents_data_temp = list()
    for y in range(floor_number):
        residents_data_temp.append([0]*10)
    residents_data.append(residents_data_temp)


data_number = int(input())
for i in range(data_number):
    
    input_data = list(map(int, input().split()))
    fidge_input = input_data[0]
    floor_input = input_data[1]
    room_input = input_data[2]
    number_input = input_data[3]
    
    
    if 0 <= fidge_input <= fidge_number and 0<= floor_input <= floor_number and 0<= room_input <= room_number:
        if residents_data[fidge_input-1][floor_input-1][room_input-1] + number_input >= 0:

    
            residents_data[fidge_input-1][floor_input-1][room_input-1] += number_input


for x in range(fidge_number):
    for y in range(floor_number):
        print(" " + " ".join(map(str,residents_data[x][y])))
    if x != fidge_number-1:
        print("

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N = int(input())

    check = [[[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())
        check[b-1][f-1][r-1] += v
    
    for i in range(4):
        for j in range(3):
            for k in range(10):
                print("", check[i][j][k], end="")
            print()
        if i != 3:
            print("


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
H = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    H[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        A = map(str, H[b][f])
        a = ' '+' '.join(A)
        print(a)
    if b == 3:
        exit()
    print('

Solution (Python):
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())
for x in range(n):
    a,b,c,d=map(int,input().split())
    house[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("

Solution (Python):
apart = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

rep = int(input())

for i in range(rep):
    lst = list(map(int,input().split()))
    b = lst[0] - 1
    f = lst[1] - 1
    r = lst[2] - 1
    v = lst[3]
    apart[b][f][r] += v

for i,building in enumerate(apart):
    for floor in building:
        for room in floor:
            print(f" {room}",end='')
        print()

    
    if i < 3:
        print("

Solution (Python):
n=int(input())

A=[[[0 for k in range(11)] for j in range(4)] for i in range(5)]

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

for a in range(1,5):
	for b in range(1,4):
		for c in range(1,11):
			print(f" {A[a][b][c]}", end="")
		print()
	if a != 4: print("

Solution (Python):
house= [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())

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

for b in range(4):
 for f in range(3):
  for r in range(10):
   print(f" {house[b][f][r]}",end="")
  print()
 if b<3:
  print("

Solution (Python):
n = int(input())
people = [[[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())
    people[b-1][f-1][r-1] += v
    if people[b-1][f-1][r-1] < 0:
        people[b-1][f-1][r-1] = 0
    if people[b-1][f-1][r-1] > 9:
        people[b-1][f-1][r-1] = 9
for B in people:
    for F in B:
        for R in F:
            print(' ' + str(R), end='')
        print('')
    if not B is people[-1]:
        print('

Solution (Python):
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 b in range(4):
    for f in range(3):
        print(" " + " ".join(map(str, count[b][f])))
    if b != 3:
        print("

Solution (Python):
rperf = 10
fperb = 3
buildings = 4

n = int(input())

rooms = [[[0 for i in range(rperf)] for j in range(fperb)] for k in range(buildings)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    b, f, r = b-1, f-1, r-1 
    if rooms[b][f][r]+v < 0:
        rooms[b][f][r] = 0
    else:
        rooms[b][f][r] += v

for i in range(buildings):
    if i>0:
        print("
    for j in range(fperb):
        floor = ""
        for k in range(rperf):
            floor += " " + str(rooms[i][j][k])
        print(floor)

Solution (Python):
test = input().split()
n = int(test[0])
building = []
count2 = 0
for i in range(120):
    building.append(0)
for a in range(n):
    actual_room_no = 0
    count = 10 
    b, f, r, v = map(int, input().split())
    if b == 4:
        actual_room_no += 90
    elif b == 3:
        actual_room_no += 60
    elif b == 2:
        actual_room_no += 30
    if f == 3:
        actual_room_no += 20
    elif f == 2:
        actual_room_no += 10
    for j in range(10):
        if r == int(count):
            actual_room_no += count
            count -= 1
        else:
            count -= 1
    actual_room_no -= 1
    building[actual_room_no] += v
for g in range(3):
    for c in range(3):
        for d in range(10):
            print(' ',end='')
            if building[int(count2)] < 0:
                print(0,end='')
                count2 += 1
            else:
                print(int(building[int(count2)]),end='')
                count2 += 1
        print('')
    for e in range(20):
        print('
    print('')
for h in range(3):
        for d in range(10):
            print(' ',end='')
            print(building[int(count2)],end='')
            count2 += 1
        print('')

Solution (Python):
n=int(input())
mat=[[0 for i in range(20)] for j in range(15)]
for i in range(n):
    b,f,r,v=list(map(int,input().split()))
    h=(b-1)*4+f-1
    w=2*r-1
    n=v
    mat[h][w]+=n
for x in range(15):
    for y in range(20):
        if x%4==3:
            mat[x][y]="
        elif y%2==0:
            mat[x][y]=" "
        print(mat[x][y],end="")
    print()

Solution (Python):

n = int(input())


input_list = [input() for i in range(n)]


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


for l in input_list:
    tou, kai, banme, nin = map(int, l.split())
    count[tou - 1][kai - 1][banme - 1] = count[tou - 1][kai - 1][banme - 1] + nin


for m in range(4):
    for o in range(3):
        print(" " + " ".join(map(str, count[m][o])))
    if m != 3:
        print("

Solution (Python):
hm=[[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']],[['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0'],['0','0','0','0','0','0','0','0','0','0']]]
ku=['
n=int(input())
for w in range(n):
    a,b,c,d=input().split()
    a=int(a)
    b=int(b)
    c=int(c)
    e=int(hm[a-1][b-1][c-1])
    hm[a-1][b-1][c-1]=str(e+int(d))
    
for i in range(4):
    for m in range(3):
        print("",' '.join(hm[i][m]))
    if i==3:
        break
    print(''.join(ku))

Solution (Python):
rooms = [[[0]*10 for _ in range(3)] for _ in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = [int(j) for j in input().split()]
    rooms[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print(" " + " ".join([str(i) for i in rooms[b][f]]), end="")
        print()
    if b < 3:
        print("

Solution (Python):
n = int(input())
L = [[[0]*10 for _ in range(3)] for _ in range(4)]
for _ in range(n):
    b,f,r,v = map(int, input().split())
    L[b-1][f-1][r-1] += v
    
for i in range(4):
    for j in range(3):
        for k in range(10):
            L[i][j][k] = str(L[i][j][k])
        print(" " + " ".join(L[i][j]))
    if i < 3:
        print("

Solution (Python):
info_n = int(input())

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

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

    resident[b - 1][f - 1][r - 1] += v
    
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(" " + str(resident[b][f][r]), end="")
        print()
    if b != 3:
        print("

Solution (Python):

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

def enter_room(building_index, floor_index, room_index, num):
    room[building_index][floor_index][room_index] += num

N = int(input())

for i in range(N):
    building_num, floor_num, room_num, num = list(map(int, input().split()))
    enter_room(building_num - 1, floor_num - 1, room_num - 1, num)

for b in range(len(room)):
    for f in range(len(room[b])):
        line = ''
        for r in range(len(room[b][f])):
            line += ' ' + str(room[b][f][r])
        print(line)
    if b < len(room) - 1:
        print('

Solution (Python):
n=int(input())
a=[map(int,raw_input().split()) for i in range(n)]
bd_lists=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for b in a:
    if bd_lists[b[0]-1][b[1]-1][b[2]-1]+b[3]>=0:
        bd_lists[b[0]-1][b[1]-1][b[2]-1]+=b[3]
for i in range(4):
    for j in range(3):
        ln=""
        for k in range(10):
            ln+=" "+str(bd_lists[i][j][k])
        print ln
    if i!=3:
        print("

Solution (Python):
n = int(input())

bfrv = [list(map(int, input().split())) for i in range(n)]
rooms = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for b,f,r,v in bfrv: rooms[b-1][f-1][r-1] += v
for b in range(4):
  for f in range(3):
    print(" "+" ".join(map(str, rooms[b][f])))
  if b<3: print("

Solution (Python):

count = [[[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())
    count[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print("",count[i][j][k],end="")
        print()
    if i < 3:
        print("

Solution (Python):
n = int(input())
house = [[[0] * 10 for i in range(3)] for j in range(4)]
count = 0
while count != n:
    b, f, r, v = map(int, input().split())
    house[b-1][f-1][r-1] += v
    count += 1
for b_num in range(4):
    for f_num in range(3):
        for r_num in range(10):
            print(" " + str(house[b_num][f_num][r_num]),end="")
        print()
    if b_num != 3: 
        print("

Solution (Python):
n = int(input())
list = [[0]*10 for i in range(12)]
for j in range(n):
    b,f,r,v = map(int,input().split())
    list[(b-1)*3+f-1][r-1] += v
for k in range(12):
    print("",*list[k])
    if k%3 == 2 and k <= 10 :print("

Solution (Python):
def show_building_information( notice ):
    building_num = 4
    floor_num = 3
    room_num = 10

    information = [0 for a in range(building_num * floor_num * room_num)]

    for n in notice:
        information[ (n[0] - 1 ) * floor_num * room_num + (n[1] - 1) * room_num + (n[2] - 1) ] +=  n[3]


    for b in range(building_num) :
        for f in range(floor_num):
            for r in range(room_num):
                print( " " + str( information[ b * floor_num * room_num + f * room_num + r ] ), end="")

            print()

        if b != building_num - 1:
            print("
        else:
            print("", end="")


if __name__ == "__main__":

    n  = int(input())
    notice_list = list()

   

    while( n > 0 ):

        notice = input().split(" ")
        notice_list.append([int(notice[0]), int(notice[1]), int(notice[2]), int(notice[3])])

        n = n - 1

    
    
    
    
    

    show_building_information(notice_list)

Solution (Python):
Floa = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]

x = int(input())
for i in range(x):
    T = list(map(int,input().split()))
    Floa[T[0]-1][T[1]-1][T[2]-1] += T[3]

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

Solution (Python):

table = [[[0]*10 for i in range(0,3)] for k in range(0,4)] 

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

x=0

for j in range(4):
    if x!=0:
        print('
    x +=1
    
    for k in range(3):
        for m in range(10):
            print(" %d"%(table[j][k][m]), end = "")
        print()

Solution (Python):
n = int(input())
a = [[[0 for vv in range(10)] for ff in range(3)] for bb in range(4)]
hl = "
for i in range(n):
    b, f, r, v = map(int,input().split())
    a[b-1][f-1][r-1] += v
line = ""
for bb in range(4):
    for ff in range(3):
        for rr in range(10):
            line += " " + str(a[bb][ff][rr])
        print(line)
        line = ""
    if bb != 3:
        print(hl)

Solution (Python):
n=int(input())
bfr=[[[0]*10 for i in range(3) ]for i in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    bfr[b-1][f-1][r-1]+=v
for i in range(len(bfr)):
    for f in bfr[i]:
        print(' ',end='')
        print(*f)
    if i != len(bfr)-1:
        print('

Solution (Python):
n=int(input())
room=[[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    room[b-1][f-1][r-1]+=v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {0}".format(room[i][j][k]),end="")
        print()
    if(i!=3):
        print("

Solution (Python):
l = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())


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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {l[i][j][k]}', end='')
        print()
    if i != 3: print('

Solution (Python):
n = int(input())


list = [[[0] * 10 for i in range(3)] for j in range(10)]


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

for i in range(4):
    if i!=0:
        print('
    for j in range(3):
        for k in range(10):
            print(' %d' % (list[i][j][k]), end='')
        print()

Solution (Python):
tbl = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
line = "

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {tbl[i][j][k]}", end = "")
        print()
    if int(i) < 3:
        print(line)

Solution (Python):
building1 = [[[0 for i in range(10)] for j in range(3)]for l in range(4)]


number_of_data = int(input())

for k in range(number_of_data):
    info = list(map(int, input().split(" ")))
    building1[info[0] - 1][info[1] - 1][info[2] - 1] += info[3]

for m in range(4):
    for floor in range(3):
        for room in range(10):
            if room != 9:
                print(" " + str(building1[m][floor][room]), end="")
            else:
                print(" " + str(building1[m][floor][room]))
    if m != 3:
        print("

Solution (Python):

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

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

sw_First=True
for l_b in l_school:
    if sw_First==True:
        sw_First=False
    else:
        print("
    for l_r in l_b:
        print("",*l_r)

Solution (Python):
def splitsharp():
    print("

num = int(input())
building = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(num):
    infos = [int(e) for e in input().split()]
    building[infos[0]-1][infos[1]-1][infos[2]-1] = building[infos[0]-1][infos[1]-1][infos[2]-1] + infos[3]
for i in range(4):
    for j in range(3):
        floor =[]
        s = ""
        for k in range(10):
            floor.append(" ")
            floor.append(str(building[i][j][k]))
        s = "".join(floor)
        print(s)
    if(i==3):
        exit()
    splitsharp()

Solution (Python):
tenants = [[[0 for k in range(10)] for j in range(3)] for i in range(4)]

n = int(input())

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

for i in range(4):
    for j in range(3):
        print('',*tenants[i][j])
    if i!=3:
        print('

Solution (Python):
import copy
floor = [0,0,0,0,0,0,0,0,0,0]
build = [copy.deepcopy(floor),copy.deepcopy(floor),copy.deepcopy(floor)]
list = [copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build),copy.deepcopy(build)]

line = int(input())
for i in range(line):
    b,f,r,v=map(int, input().split())
    build = list[b-1]
    floor = build[f-1]
    floor[r-1] += v

for i in range(4):
    build = list[i]
    for j in range(3):
        floor = build[j]
        for k in range(10):
            if k == 9:
                print(" " + str(floor[k]))
            else:
                print(" " + str(floor[k]), end="")
    if i != 3:
        print("

Solution (Python):
class Room:
  def __init__(self):
    self.__count = 0
  
  @property
  def count(self):
      return self.__count

  @count.setter
  def count(self, count):
      self.__count += count

class Floor:
  def __init__(self):
    self.__rooms = [Room() for i in range(10)]
  
  def room(self, i):
    return self.__rooms[i - 1]
  
  @property
  def get(self):
    return ' ' + ' '.join([str(self.__rooms[i].count) for i in range(10)])

class Building:
  def __init__(self):
    self.__floors = [Floor() for i in range(3)]
  
  def floor(self, i):
    return self.__floors[i - 1]
  
  @property
  def get(self):
    return '\n'.join([self.__floors[i].get for i in range(3)])

class School:
  def __init__(self):
    self.__buildings = [Building() for i in range(4)]
  
  def building(self, i):
    return self.__buildings[i - 1]
  
  @property
  def get(self):
    delimiter = '\n' + '
    return delimiter.join([self.__buildings[i].get for i in range(4)])

if __name__ == '__main__':
  school = School()
  for i in range(int(input())):
     b, f, r, v = map(int, input().split())
     school.building(b).floor(f).room(r).count = v
  print(school.get)

Solution (Python):
rooms = [
        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
        [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
        ]

num = int(input())
for _ in range(num):
    aRoom = input().split()
    rooms[int(aRoom[0])-1][int(aRoom[1])-1][int(aRoom[2])-1] = int(aRoom[3]) + rooms[int(aRoom[0])-1][int(aRoom[1])-1][int(aRoom[2])-1]

for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' ',end="")
            print(int(rooms[b][f][r]),end="")
        print()
    if b <= 2:
        print("

Solution (Python):
tbl = [[[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())
    tbl[b - 1][f - 1][r - 1] += v
for j, row in enumerate(tbl):
    if j != 0:print("
    for k in row:
        print("", *k)

Solution (Python):
A = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n, *D = map(int, open(0).read().split())
for b, f, r, d in zip(*[iter(D)]*4):
    A[b-1][f-1][r-1] += d
for i in range(4):
    for j in range(3):
        print(' '+' '.join(map(str, list(A[i][j]))))
    if i + 1 in range(4):
        print('

Solution (Python):
tenants = []
buildings = [[[0 for _ in range(10)] for _ in range(3)]for _ in range (4)]

n = int(input())

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


for i in range(4):
    if i != 0:
        print("
    for j in range(3):
        for k in range(10):
            print(" {}".format(buildings[i][j][k]), end='')
        print()

Solution (Python):
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    bfr=[[[0]*10 for _ in range(3)]for _ in range(4)]
    for _ in range(n):
        b,f,r,v=map(int,input().split())
        b,f,r=b-1,f-1,r-1
        bfr[b][f][r]+=v
    for i,ff in enumerate(bfr):
        for f in ff:
            print("",*f)
        if i==3:break
        print("

main()

Solution (Python):
BIG_NUM = 2000000000

table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

N = int(input())

for loop in range(N):
    house_id,floor,room,add = map(int,input().split())
    table[house_id-1][floor-1][room-1] += add


x = 0

for i in range(4):
    if x != 0:
        print("
    x += 1

    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Solution (Python):
n = int(input())
  
building =  [[[ 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(s) for s in input().split() ]
    building[b-1][f-1][r-1] += v

s = ""
for b in range(4):
    for f in range(3):
        for r in range(10):
            s += ' '+str(building[b][f][r])
        s += '\n'
    if b!=3:
        s = s + '

print(s, end='')

Solution (Python):
notify = int(input())
b1 = list()
b2 = list()
b3 = list()
b4 = list()

for f in range(30):
    b1.append(0)
    b2.append(0)
    b3.append(0)
    b4.append(0)
    
whole = list()
whole.append(b1)
whole.append(b2)
whole.append(b3)
whole.append(b4)

for n in range(notify):
    b, f, r, v = input().split()
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    place = (f-1)*10 + r - 1
    whole[b-1][place] = int(whole[b-1][place]) + v

sh = ''
times = 0
for m in range(20):
    sh += '
    
for s in whole:
    ccc = ''
    for p in range(len(s)):
        if p == 10 or p == 20:
            ccc += '\n'
        ccc += ' ' + str(s[p])
    print(ccc)
    if times < 3:
        print(sh)
    times += 1

Solution (Python):
build = [[[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())
    build[b-1][f-1][r-1] += v

for i in range(4):
    if i>=1:
        print("
    for j in range(3):
        for k in range(10):
            print(" "+str(build[i][j][k]), end="")
        print()

Solution (Python):
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for z in range(n):
    a,b,c,d = map(int,input().split())
    house[a-1][b-1][c-1] += d
for e in range(4):
    for f in range(3):
        for g in range(10):
            print(" "+str(house[e][f][g]),end = "")
        print()
    if e != 3:
        print("

Solution (Python):
info_num = int(input())
building = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for i in range(info_num):
    lst = list(map(int, input().split()))
    b, f, r, v =lst[0], lst[1], lst[2], lst[3]
    building[b-1][f-1][r-1] = building[b-1][f-1][r-1] + v


count = 0
for floor in building:
    for room in floor:
        for volume in room:
            print(" " + str(volume), end = "")
        print()
    count = count +1
    if count <=3:
        print("

Solution (Python):
table = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    table[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        print(" " + " ".join(map(str, table[i][j])))
    if i != 3:
        print("

Solution (Python):
houses = [[[0]*10 for f in range(3)] for b in range(4)]

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

for b in range(4):
  for f in range(3):
    print(" " + " ".join([str(v) for v in houses[b][f]]))
  if b<3:
    print("