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 fth floor at building b. If v is negative, it means that &minus;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 ith 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



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

Submission status: Accepted

Solution code:
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("#"*20)
    x += 1

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

Submission status: Accepted

Solution code:
n=int(input())
tbl=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
    b,f,r,v=map(int,input().split())
    tbl[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        print("",*tbl[i][j])
    if i!=3:
        print("#"*20)

Submission status: Accepted

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

n=int(input())
kugiri_ck=0

for num in range(n):
    building,floor,room,population=map(int,input().split(" "))
    count[building-1][floor-1][room-1]+=population

for building in count:
    if kugiri_ck!=0:
        print("#"*20)
    kugiri_ck+=1
    
    for floor in building:
        for room in floor:
            print('{:>2}'.format(room),end="")
        print()

Submission status: Accepted

Solution code:
num_floors = 3
num_rooms = 10
num_houses = 4
houses = {house: [[0 for room in range(num_rooms)] for floor in range(num_floors)] for house in range(1, num_houses+1)}

num_moves = int(input())

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

for i in range(1, num_houses+1):
    for j in houses[i]:
        for k in j:
            print(' {:d}'.format(k), end='')
        print()
    if not i == num_houses:
        print('#' * 20)

Submission status: Accepted

Solution code:
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(f" {count[i][j][k]}",end = "")
        print()
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
# Inputs
n = int(input())
moves = []
for a in range(n):
    moves.append(list(map(int, input().split())))

# Apartment
apt = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

# Movement
for move in moves:
    apt[move[0]-1][move[1]-1][move[2]-1] += move[3]

# Output
for x in range(3):
    for y in range(3):
        for z in range(10):
            print(' {}'.format(apt[x][y][z]), end='')
        print()
    wall = '#' * 20
    print(wall)
for b in range(3):
    for c in range(10):
        print(' {}'.format(apt[3][b][c]), end='')
    print()

Submission status: Accepted

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

for i in range(4):
    for j in range(3):
        print("",*arc[i][j])
    if i!=3:print("#"*20)

Submission status: Accepted

Solution code:
import copy
floor = [0 for i in range(10)]
building = [floor.copy(), floor.copy(), floor.copy()]
buildings = [[], [], [], []]
for i in range(4):
    buildings[i] = copy.deepcopy(building)

# 要素を書き換える。
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    buildings[b-1][f-1][r-1] += v

# 結果を出力する。
for b in range(4):
    for f in buildings[b]:
        print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("".join(["#" for x in range(20)]))

Submission status: Accepted

Solution code:
a = [[[0] * 10 for _ in range(3)] for _ in range(4)]
for _ in range(int(input())):
    b, f, r, v = [int(i) for i in input().split()]
    a[b - 1][f - 1][r - 1] += v
for i in a:
    for j in i:
        print("", *j)
    if i is a[-1]:
        break
    print("#" * 20)

Submission status: Accepted

Solution code:
a = [[[0 for room in range(10)] for floor in range(3)] for house in range(4)]
N = int(input())
for i in range(N):
    h, f, r, v = map(int, input().split())
    a[h - 1][f - 1][r - 1] += v


for h in range(4):
    for f in range(3):
        print(' ' + ' '.join([str(x) for x in a[h][f]]))
    if not h == 3:
        print('####################')

Submission status: Accepted

Solution code:
res=[[[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())
#    print(b,f,r,v)
    res[b-1][f-1][r-1]+=v
for b in range(4):
    for f in range(3):
        for r in range(10):
            print(' ',res[b][f][r],sep='',end='')
        print()
    if b < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
A,B,C,D = [],[],[],[]


for j in range(3):
    A.append([0,0,0,0,0,0,0,0,0,0])
    B.append([0,0,0,0,0,0,0,0,0,0])
    C.append([0,0,0,0,0,0,0,0,0,0])
    D.append([0,0,0,0,0,0,0,0,0,0])


n = int(input())
  

for i in range(n):
    b,f,r,v = map(int,input().split())
    if b == 1:
        A[f-1][r-1] += v 
     
    elif b == 2:
        B[f-1][r-1] += v        
    elif b == 3:
        C[f-1][r-1] += v
    elif b == 4:
        D[f-1][r-1] += v

line = "#"*20

for i in A:
    for k in i:
        print("",k,end ="")
    print()

print(line)
for i in B:
    for k in i:
        print("",k,end ="")
    print()
print(line)
for i in C:
    for k in i:
        print("",k,end ="")
    print()
print(line)
for i in D:
    for k in i:
        print("",k,end ="")
    print()

Submission status: Accepted

Solution code:
Tenant = [[[0]*10 for j in range (3)] for i in range (4)]
n = int(input())

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

count = 0
for i in range(4):
    if count != 0:
        print('#'*20)
    count += 1

    for j in range(3):
        for k in range(10):
            print(' {}'.format(Tenant[i][j][k]), end='')
        print()

Submission status: Accepted

Solution code:
HOUSE_CNT = 4
FLOOR_CNT = 3
ROOM_CNT = 10

def init(houses):
    for h in range(0, HOUSE_CNT):
        floors = []
        for f in range(0, FLOOR_CNT):
            rooms = []
            for r in range(0, ROOM_CNT):
                rooms.append(0)
            floors.append(rooms)
        houses.append(floors)


def in_out(houses):
    n = int(input())
    for i in range(0, n):
        b, f, r, v = tuple(map(int, input().split(' ')))
        houses[b-1][f-1][r-1] += v;


def output(houses):
    line = False
    for house in houses:
        if line:
            print('####################')
        else:
            line = True
        for floor in house:
            for room in floor:
                print(' %d' % room, end='')
            print()


houses = []
init(houses)
in_out(houses)
output(houses)

Submission status: Accepted

Solution code:
A = [[0 for i in range(10)] for j in range(12)]
count = 0

n = int(input())

for _ in range(n):
    a = [int(x) for x in input().split()]
    A[3*(a[0]-1)+a[1]-1][a[2]-1] += a[3]

for _ in range(12):
    for i in range(0,10):
        print(" ", end="")
        print(A[_][i],end="")
    print()
    count += 1
    if count >= 3 and not _ == 11:
        count = 0
        print("####################")
        continue

Submission status: Accepted

Solution code:
rooms = [[[0] * 10 for _ in range(3)] for _ in range(4)]
n = int(input())

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

for i in range(4):
    if i > 0:
        print('#' * 20)
    for j in range(3):
        rooms[i][j][0] = ' ' + str(rooms[i][j][0])
        print(*rooms[i][j])

Submission status: Accepted

Solution code:
n = int(input())
table = [[[0]*10 for i in range (0,3)] for k in range (0,4)]

for i 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(" %s" % " ".join(map(str, table[i][j])))
    if i < 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
X = [[int(_) for _ in input().split()] for i in range(n)]

A = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
for b, f, r, v in X:
    A[b-1][f-1][r-1] += v

for i, B in enumerate(A):
    for F in B:
        for r in F:
            print(" {}".format(r), end = "")
        print()
    if i < 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
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("####################")

Submission status: Accepted

Solution code:
bn = 4
fn = 3
rn = 10
room = [0]*bn*fn*rn

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

for b in range(1, bn+1):
    for f in range(1, fn+1):
        for r in range(1, rn+1):
            num = (b-1)*fn*rn + (f-1)*rn + (r-1)
            print(' %d' % room[num], end='')
        print()
    if b < bn:print('#'*20)

Submission status: Accepted

Solution code:
#coding: utf-8

rooms = [[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())
    b -= 1
    f -= 1
    r -= 1
    rooms[b * 3 + f][r] += v
for i in range(12):
    if i > 0 and i % 3 == 0:
        print('####################')
    for j in range(10):
        print(' %d' % rooms[i][j], end = '')
    print('')

Submission status: Accepted

Solution code:
num = int(input())

Office1 = [[0 for i in range(10)] for j in range(3)]
Office2 = [[0 for i in range(10)] for j in range(3)]
Office3 = [[0 for i in range(10)] for j in range(3)]
Office4 = [[0 for i in range(10)] for j in range(3)]

def printfunc(Office):
    for i in range(3):
        for j in range(10):
            print(" ",Office[i][j],sep="",end="")
        print()

for i in range(num):
    s = input().split()
    b=int(s[0])
    f=int(s[1])
    r=int(s[2])
    v=int(s[3])

    if b==1:
        Office1[f-1][r-1]+=v
    if b==2:
        Office2[f-1][r-1]+=v
    if b==3:
        Office3[f-1][r-1]+=v
    if b==4:
        Office4[f-1][r-1]+=v
    
str = "#" * 20
printfunc(Office1)
print(str)
printfunc(Office2)
print(str)
printfunc(Office3)
print(str)
printfunc(Office4)

Submission status: Accepted

Solution code:
def test():

	output = [[0 for i in range(10)] for j in range(12)]

	n = int(input())

	for num in range(n):
		
		inputs = list(map(int,input().split()))

		b = inputs[0] - 1
		f = inputs[1] - 1
		r = inputs[2] - 1
		v = inputs[3]

		output[b*3 + f][r] += v


	for i in range(12):
		for j in range(10):
			print(f" {output[i][j]}",end = '')
		print()
		if i % 3 == 2 and i != 11:
			for j in range(20):
				print("#",end = '')
			print()


if __name__ == "__main__":
	test()

Submission status: Accepted

Solution code:
n = int(input())

bld = [0 for i in range(10 * 3 * 4)]

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

for i in range(0,len(bld),10):
    if i % 30 == 0 and i > 0:
        print("####################")
    print(" " + " ".join(map(str,bld[i:i+10])))

Submission status: Accepted

Solution code:
n=int(input())
a=[0 for i in range(120)]
for i in range(n):
    b,f,r,v=map(int,input().split())
    a[(b-1)*30+(f-1)*10+r-1]+=v
for i in range(12):
    seq=a[10*i:10*i+10]
    print(" "+" ".join(map(str,seq)))
    if i%3==2 and i!=11:
        print("####################")

Submission status: Accepted

Solution 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 i in range(4):
    for j in range(3):
        for k in range(10):
            print(" {}".format(A[i][j][k]), end="")
        print("")
    if i < 3:
        print("#"*20, end="")
        print("")

Submission status: Accepted

Solution code:
n=int(raw_input())
a=[[0 for x in range(10)] for x in range(12)]


for i in range(n):
	b,f,r,v=map(int,raw_input().split())
	a[b*3+f-4][r-1] += v
for i in range(12):
	print " "+" ".join(map(str,a[i]))
	if i==2 or i==5 or i==8:
		print "#"*20

Submission status: Accepted

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

for j in range(4):
    for k in range(3):
        print(' '+' '.join(str(i) for i in room[j][k]))
    if j<3:
        print('#'*20)

Submission status: Accepted

Solution code:
xs=[0]*120
for _ in [0]*int(input()):
    b,f,r,v=map(int,input().split())
    xs[(b-1)*30+(f-1)*10+(r-1)]+=v
for j in range(0,4):
    for i in range(0,3):
        print('',*xs[j*30+i*10:j*30+i*10+10])
    if j<3: print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
a = [[[0]*11 for j in range(4)]for k in range(5)]
for i in range(0, n):
    b, f, r, v = map(int, input().split())
    a[b][f][r] += v


for i in range(1, 5):
    for j in range(1, 4):
        for k in range(1, 11):
            print(" %d" % (a[i][j][k]), end="")
        print()
    if not i == 4:
        print('#' * 20)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
builds = [[[0 for x in range(10)] for y in range(3)] for z in range(4)]
for i in range(n):
	b, f, r, v = map(int, input().split())
	b -= 1; f -= 1; r -= 1;
	builds[b][f][r] += v;

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

Submission status: Accepted

Solution code:

a = int(input())
building = [[[0 for zero in range(10)] for floor in range(3)] for room in range(4)]


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

for j in range(4):
    for k in range(4):
        if k == 3:
            if j != 3:
                print('####################')
            else:
                break
        else:
            print(' ' + ' '.join([str(building[j][k][n]) for n in range(10)]))

Submission status: Accepted

Solution 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
    
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", room[i][j][k], sep="", end="")
        print("")
    if i <= 2:
        split_str="#"*20
        print(split_str)

Submission status: Accepted

Solution code:
n=int(input())
z=[[[0 for y in range(10)]for i in range(3)]for j in range(4)]
for x in range(n):
	a,b,c,d=map(int,input().split())
	z[a-1][b-1][c-1]+=d
	
for j in range(4):
	for i in range(3):
		for h in range(10):
			print(" "+str(z[j][i][h]),end="")
		print()
	if j!=3:
		print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
z=[[[0 for y in range(10)]for i in range(3)]for j in range(4)]
for x in range(n):
	a,b,c,d=map(int,input().split())
	z[a-1][b-1][c-1]+=d
	
for j in range(4):
	for i in range(3):
		for h in range(10):
			print(" "+str(z[j][i][h]),end="")
		print()
	if j!=3:
		print("#"*20)

Submission status: Accepted

Solution code:
n=int(input())
z=[[[0 for y in range(10)]for i in range(3)]for j in range(4)]
for x in range(n):
	a,b,c,d=map(int,input().split())
	z[a-1][b-1][c-1]+=d
	
for j in range(4):
	for i in range(3):
		for h in range(10):
			print(" "+str(z[j][i][h]),end="")
		print()
	if j!=3:
		print("#"*20)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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("#"*20)
    x += 1
 
    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Submission status: Accepted

Solution code:
import sys,os,re
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate
sys.setrecursionlimit(10**6)

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 i in range(4):
    for j in range(3):
        print(" ",end='')
        print(*a[i][j])
    if i!=3:
        print("#"*20)

Submission status: Accepted

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

for i in range(4):
    for j in range(3):
        print(" "+ " ".join([str(i) for i in buildings[i][j]]))
    if i < 3:
        print("####################")

Submission status: Accepted

Solution code:
L=[[[0]*10 for i in range(3)] for j in range(4)]
n=int(input())
for i in range(n):
    b,f,r,v=list(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+1 !=4:
        print("#"*20)

Submission status: Accepted

Solution code:
import sys
n=int(input())
a=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for i in range(n):
    w=input().split()
    b=(int(w[0]))
    f=(int(w[1]))
    r=(int(w[2]))
    v=(int(w[3]))
    a[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            sys.stdout.write(" {0}".format(a[i][j][k]))
        sys.stdout.write("\n")
    if (i!=3):
        for x in range(20):
            sys.stdout.write("#")
        sys.stdout.write("\n")

Submission status: Accepted

Solution code:
buildings = [[[0 for room in range(10)] for floor in range(3)] for building in range(4)]

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

for i in range(4):
    for floor in buildings[i]:
        print("".join(map("{:2}".format, floor)))
    if i != 3:
        print("#" * 20)

Submission status: Accepted

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

for i in range(4):
    for j in range(3):
        if j!=0:
            print()
        for z in range(10):
            print(" %d"%builds[i][j][z],end = '')
    if i<3:
        print('\n####################')
print()

Submission status: Accepted

Solution code:
n = int(input())
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] #i=ワンフロアの部屋の数, j=階の数 ,k=棟の数
for i in range(0, n):
  b, f, r, v = map(int, input().split()) #b棟f階のr番目の部屋にv人が追加で入居したことを示す
  count[b-1][f-1][r-1] = count[b-1][f-1][r-1] + v

for k in range(0,4):
  for j in range(0, 3):
    for i in range(0, 10):
      print("",count[k][j][i], end=''"")
      if i == 9:
        print("")
  if k < 3:
    for l in range(0, 20):
      print("#", end="")
    print("")

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

Submission status: Accepted

Solution code:
n=int(input())
count = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for kk in range(n):
	b,f,r,v=map(int,input().split())
	count[b-1][f-1][r-1]+=v
for cc in range(4):
	for aa in range(3):
		for bb in range(10):
				print(' '+str(count[cc][aa][bb]),end='')
		print()
	if cc!=3:
		print('#'*20)

Submission status: Accepted

Solution 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)

Submission status: Accepted

Solution code:
n = input()
n = int(n)
l = [[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for i in range(n):
  b,f,r,v = input().split()
  b = int(b)
  f = int(f)
  r = int(r)
  v = int(v)
  l[b-1][f-1][r-1]+=v
for i in range(4):
  for j in range(3):
    for k in range(10):
      print("",l[i][j][k],end="")
    print()
  if i == 3:
    break
  print("####################")

Submission status: Accepted

Solution code:
n=input()
n=int(n)
l=[[[0 for i in range(10)] for i in range(3)] for i in range(4)]
for i in range(n):
    b,f,r,v=input().split()
    b=int(b)
    f=int(f)
    r=int(r)
    v=int(v)
    l[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print("",l[i][j][k],end="")
        print()
    if i==3:
        break
    print("####################")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
    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(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("#"*20)

Submission status: Accepted

Solution code:
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

sep = ''

for building in buildings:
    if sep:
        print(sep)

    for floor in building:
        print(" "+" ".join([str(x) for x in floor]))

    sep = '#'*20

Submission status: Accepted

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

N = int(input())

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

for i in range(4):
    if i != 0:
        print("#"*20)

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

Submission status: Accepted

Solution code:
rooms = [[[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 = map(int, input().split())
   rooms[b-1][f-1][r-1] += v

for i in range(4):
   for j in range(-3, 0):
       print("", *rooms[i][j])
   if i != 3:
       print("#"*20)

Submission status: Accepted

Solution code:
num=[[[0 for a in range(10)]for a in range(3)]for a in range(4)]

n = int(input())

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

for i in range(4):
    for f in num[i]:
        print(""," ".join([str(x) for x in f]))
    
    if i != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
rooms = [[[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())
  rooms[b-1][f-1][r-1] += v
for b in range(4):
  for f in rooms[b]:
    print('',*f)    
  if b != 3:
    print('#' *20)

Submission status: Accepted

Solution code:
rooms = [[[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 = map(int, input().split())
    rooms[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(-3, 0):
        print("", *rooms[i][j])
    if i != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
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("#"*20)
    x += 1
 
    for a in range(3):
        for b in range(10):
            print(" %d"%(table[i][a][b]),end = "")
        print()

Submission status: Accepted

Solution code:
n = int(input())
kousya =[[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0]]]

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

for a in range(4):
    for b in range(3):
        for c in range(10):
            print(" " + str(kousya[a][b][c]),end="")
        print()
    if a < 3:
        print("#"*20)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    building_num = 4
    floor_num = 3
    room_num = 10
    info = [
        [[0] * room_num for floor in range(floor_num)] 
        for building
        in range(building_num)
    ]

    notices_num = int(input())
    for i in range(notices_num):
        b, f, r, n = map(lambda x: int(x), input().split())
        info[b - 1][f - 1][r - 1] += n

    for building in range(building_num):
        for floor in range(floor_num):
            print("".join([f" {elem}" for elem in info[building][floor]]))
        if building != building_num - 1:  # Skip the last line #.
            print("#" * 20)

Submission status: Accepted

Solution code:
list = [[[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())
    list[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {list[i][j][k]}',end="")
        print()
    if int(i)<3: print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
Data = []
buildings =[[ [0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

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

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

Submission status: Accepted

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

for _b in range(4):
    for _f in range(3):
        for _r in range(10):
            print(' ', end='')
            print(building_list[_b][_f][_r], end='')
        print('')
    if _b != 3:
        print('#'*20)

Submission status: Accepted

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

i=1
#情報数
numbers=[]
info=[]
u=""   
number_str=input("")
number=int(number_str)

while i <=number:
    x=input()
    numbers=x.split()
    numbers=list(map(int,numbers))
    info.append(numbers)
    i=i+1

for j in info:
    A[j[0]-1][j[1]-1][j[2]-1]=A[j[0]-1][j[1]-1][j[2]-1]+j[3]


for h in range(0,4):
    for i in range(0,3):
        for j in range(0,10):
            u=u+" "+str(A[h][i][j])
        print(u)    
        u=""
    
    if h<3 : 
        print("#"*20)

Submission status: Accepted

Solution 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 b in range(4):
    if b:
        print("####################")
    for f in range(3):
        for r in range(10):
            print(" {}".format(house[b][f][r]), end='')
        print()

Submission status: Accepted

Solution code:
build=[[[0 for k in range(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())
    build[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' %d' % (build[i][j][k]), end='')
        print()
    if i < 3:
        print('####################')