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:
record=[[[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 = [int(x) for x in input().split()]
    record[b-1][f-1][r-1]+=v
for b in range(4):
    for f in record[b]: print(" "+" ".join([str(x) for x in f]))
    if b != 3:
        print("".join(["#" for x in range(20)]))

Submission status: Accepted

Solution code:
N = int(input())
Bs = [0] * 120

for i in range(N):
  b, f, r, v = map(int, input().split())
  if b == 1:
    Bs[0 + 10 * (f-1) + (r-1)] += v
  elif b == 2:
    Bs[30 + 10 * (f-1) + (r-1)] += v
  elif b == 3:
    Bs[60 + 10 * (f-1) + (r-1)] += v
  elif b == 4:
    Bs[90 + 10 * (f-1) + (r-1)] += v

for i in range(12):
  for j in range(10):
    print(' {}'.format(Bs[i * 10 + j]), end = '')
    if (j+1) % 10 == 0:
      print()
  if (i+1) % 3 == 0 and (i+1) != 12:
    print('#' * 20)

Submission status: Accepted

Solution code:
B = [[0]*30,[0]*30,[0]*30,[0]*30]
n = int(input())

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

for i in [0,1,2,3]:
    print('',*B[i][:10])
    print('',*B[i][10:20])
    print('',*B[i][20:30])
    if i == 3:
        break
    print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
inOut = list()

for _ in range(n):
  inOut.append(list(map(int, input().split())))

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

for i in range(n):
  num[inOut[i][0]-1][inOut[i][1]-1][inOut[i][2]-1] += inOut[i][3]
      
for i in range(4):
  for j in range(3):
    for k in range(10):
      print(" {}".format(num[i][j][k]), end="")
    print()
  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 i 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())
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()

Submission status: Accepted

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

z = int(input())

for x in range(z):
    a, b, c, d = map(int, input().split())
    hotel[a - 1][b - 1][c - 1] = hotel[a - 1][b - 1][c - 1] + d

for i, ridge in enumerate(hotel):
    for j, floor in enumerate(ridge):
        for k, room in enumerate(floor):
            print(f" {room}", end="")
        print()
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
n = int(input())
dic = {}

while True:
    try:
        b, f, r, v = map(int, input().split())
        bfr = 100*b + 10*f + r
        if dic.get(str(bfr)) == None:
            dic[str(bfr)] = v
        else:
            dic[str(bfr)] += v
    except:
        break

for b2 in range(1, 5):
    for f2 in range(1, 4):
        l = " "
        for r2 in range(1, 11):
            bfr2 = 100*b2 + 10*f2 + r2
            if dic.get(str(bfr2)) == None:
                l += "0"
            else:
                l += str(dic[str(bfr2)])
            if r2 < 10:
                l += " "
        print(l)
    if b2 < 4:
        print("#" * 20)

Submission status: Accepted

Solution code:
n = int(input())

y = [[[0 for i in range(10)] for v in range(3)] for k in range(4)]

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

for b in range(4):
    for f in y[b]:
        print('', *f)
    if b != 3:
        print('#' * 20)

Submission status: Accepted

Solution code:
domitory = [[[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 = list(map(int,input().split()))
    domitory[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f" {domitory[i][j][k]}",end="")
        print()
    if i == 3:
        break
    print("####################")

Submission status: Accepted

Solution code:
n = int(input())
room = [[[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)]]]
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 i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ",end="")
            print(room[i][j][k], end="")
        print("")
    if i != 3:
        for l in range(20):
            print("#",end="")
        print("")

Submission status: Accepted

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

for l in range(0,n):
    apart_id,floor,room,human=map(int,input().split())
    apart_table[apart_id-1][floor-1][room-1]+=human

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

    for n in range(0,3):
        for o in range(0,10):
            print(" {}".format(apart_table[m][n][o]),end='')
        print()

Submission status: Accepted

Solution code:
a = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
# print(a)
# print(a[0])
# print(a[0][1])
# print(a[0][1][2])

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

for j in range(0, len(a)):
	for k in range(0, len(a[j])):
		for l in range(0, len(a[j][k])):
			print(' {0}'.format(a[j][k][l]), end='')
		print()
	if j != len(a) - 1:
		print('#' * 20)

# for j in a:
#	for k in j:
#		for l in k:
#			print(l, end=' ')
#		print()
#	print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
room = [ [[0]*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 j in range(4):
    for m in range(3):
        for k in range(10):
            print(' {}'.format(room[j][m][k]),end='')
        print()
    if j!=3:
        print('#'*20)

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 k in range(3):
        for l in range(10):
            print (" %d" %(table[i][k][l]), end="")
        print()
    if i < 3: print("#"*20, end="\n")

Submission status: Accepted

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

while i < n:
    l = input()
    l = [x for x in map(int, l.split())]
    tbl[l[0]-1][l[1]-1][l[2]-1] += l[3]
    i += 1

i = 0
for x in tbl:
    for y in x:
        print(" ",end="")
        # for z in y:
        #     print(z, end=" ")
        # print()
        print(" ".join(map(str, y)))
    if i < 3:
        print("####################")
    i += 1

Submission status: Accepted

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

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

for index,build in enumerate(apart) :
    for floor in build:
        for room in floor:
            print(" %d" % room,end="")
        print()
    if index != len(apart)-1:
        print("####################")

Submission status: Accepted

Solution code:
gakuen_list = [[[0 for i in range(10)]for j in range(3)]for n in range(4)]
y = int(input())
l = 0
for i in range(y):
    a,b,c,x = input().split(" ")
    a = int(a)
    b = int(b)
    c = int(c)
    c -= 1
    q = gakuen_list[a - 1][b - 1][c]
    q = int(q)
    if q != 0:
        q += int(x)
        gakuen_list[a - 1][b- 1][c] = q
    else:
        gakuen_list[a - 1][b- 1][c] = x
        continue
for img in gakuen_list:
    for line in img:
        for dot in line:
            print(" " + str(dot),end="")
        print()
    if l == 3:
        break
    else:
        l += 1
        for n in range(20):
            print("#",end="")
    print()

Submission status: Accepted

Solution code:
n = int(input())
B = []
F = []
R = []
V = []
T = [[[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())
    T[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(T[i][j][k], end="")
        print()
    if i < 3:
        print("#"*20)

Submission status: Accepted

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

n = int(input())
newcomer_list = [input() for _ in range(n)]

for newcomer in newcomer_list:
    b, f, r, v = map(int, newcomer.split())
    residence_data[b - 1][f - 1][r - 1] += v

for i in range(4):
    for j in range(3):
        print('', *residence_data[i][j])
    if i == 3:
        break
    print('#' * 20)

Submission status: Accepted

Solution code:
BUILDGS_COUNT = 4
FLOOR_COUNT = 3
ROOM_COUNT = 10

buildings = [[[0 for i in range(ROOM_COUNT)] for j in range(FLOOR_COUNT)] for k in range(BUILDGS_COUNT)]

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

for i in range(BUILDGS_COUNT):
  for j in range(FLOOR_COUNT):
    for k in range(ROOM_COUNT):
      print(' {}'.format(buildings[i][j][k]), end='')
    print()
  if i != BUILDGS_COUNT-1:
    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())

i = 0
while i < n:
    b, f, r, v = map(int, input().split())
    #左から棟、階、部屋
    house[b-1][f-1][r-1] += v
    i += 1

###出力方法だけ写経した
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"%(house[i][a][b]),end = "")
        print()

Submission status: Accepted

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

for i in range(n):
    building, flr, room, val= map(int, input().split())
    rooms[building - 1][flr - 1][room - 1] += val

for i in range(4):
    for ii in range(3):
        fl = str()
        for iii in range(10):
            fl = fl + ' ' + str(rooms[i][ii][iii])
        print(fl)
    if i < 3:
        print('####################')

Submission status: Accepted

Solution code:
buildings = []
for _ in range(4):
    building = []
    for _ in range(3):
        building.append([0 for _ in range(10)])
    buildings.append(building)

n = int(input())
notice_list = []
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(len(buildings)):
    for floor in buildings[i]:
        print(' ', ' '.join(map(str, floor)), sep='')
    if i != len(buildings)-1:
        print("####################")

Submission status: Accepted

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

n=int(input())

#b棟f階のr番目の部屋にv人が追加で入居したことを示します
for i in range(n):
    b,f,r,v=list(map(int, input().split(" ")))
    #print(b,f,r,v)
    info[b-1][f-1][r-1]=info[b-1][f-1][r-1]+v

for i,building in enumerate(info):
    if(i):
        print("####################")
    for floor in building:
        for room in floor:
            print(" "+str(room),end="")
        print()

Submission status: Accepted

Solution code:
A1=[["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"]]
A2=[["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"]]
A3=[["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"]]
A4=[["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"],["0","0","0","0","0","0","0","0","0","0"]]
N=int(input())
for j in range(N):
    b,f,r,v=map(int,input().split())
    if b==1:
        A1[f-1][r-1]=str(v+int(A1[f-1][r-1]))
    elif b==2:
        A2[f-1][r-1]=str(v+int(A2[f-1][r-1]))
    elif b==3:
        A3[f-1][r-1]=str(v+int(A3[f-1][r-1]))
    else:
        A4[f-1][r-1]=str(v+int(A4[f-1][r-1]))
for i in range(3):
    m=" "+" ".join(A1[i])
    print(m)
print("#"*20)
for i in range(3):
    m=" "+" ".join(A2[i])
    print(m)
print("#"*20)
for i in range(3):
    m=" "+" ".join(A3[i])
    print(m)
print("#"*20)
for i in range(3):
    m=" "+" ".join(A4[i])
    print(m)

Submission status: Accepted

Solution code:
mansions = [[[0 for x in range(10)] 
                for floor in range(3)] 
                    for i in range(4)]

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

mn_cnt =0
for mansion in mansions:
    for floor in mansion:
        print(" "+" ".join(map(str,floor)))
    if mn_cnt != 3:
        print("####################")
    mn_cnt+=1

Submission status: Accepted

Solution code:
mansions = [[[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 =input().split()
    mansions[int(a)-1][int(b)-1][int(c)-1] += int(d)


for i in range(4):
    if not i == 0:
        print()
        print("####################")
    for j in range(3):
        if not j == 0:
            print()
        for k in range(10):
            print(" ",end="")
            print(mansions[i][j][k],end="")
            if i == 3 and j == 2 and k == 9:
                print()

Submission status: Accepted

Solution code:
n = int(input())
cube = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]

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

for x in range(4):
    for y in range(3):
        for z in range(10):
            print(' ' + str(cube[x][y][z]), end='')
        print()
    if x < 3: 
        print('#' * 20)

Submission status: Accepted

Solution code:

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

inp_num = int(input())
for i in range(inp_num):
    building,floor,room,v = list(map(int, input().split()))
    dorm[building - 1][floor - 1][room - 1] += v

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

Submission status: Accepted

Solution code:
N = int(input())
b1 = dict()
b2 = dict()
b3 = dict()
b4 = dict()

for i in range(1,4):
  for j in range(1,11):
    idx = i*10+j
    b1[idx] = 0
    b2[idx] = 0
    b3[idx] = 0
    b4[idx] = 0

builds = [b1, b2 ,b3 ,b4]

for i in range(N):
  a = list(map(int,input().split()))
  idx = a[1] * 10 + a[2]
  builds[a[0] - 1][idx]  += a[3]

for b in range(4):
  d = builds[b]
  for i in range(11,21):
    print(" {}".format(d[i]),end="")
  print()
  for i in range(21,31):
    print(" {}".format(d[i]),end="")
  print()
  for i in range(31,41):
    print(" {}".format(d[i]),end="")
  print()
  if b < 3:
    print("####################")

Submission status: Accepted

Solution code:
OH = [[[0]*10 for i in range (0,3)] for k in range (0,4)]
odd = int(input())
for loop in range(odd):
    house_id,floor,room,add = map(int,input().split())
    OH[house_id-1][floor-1][room-1] += add
for t in range(4):
  for g in range(3):
    for i in range(10):
      if i == 9 :
          print(" %d"%(OH[t][g][i]))
      else:
       print(" %d"%(OH[t][g][i]),end="")
  if t < 3:
   print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())

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

for i in range(4):
    for j in range(3):
        print("",*home[i][j])
    if i < 3 :
        print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
apa = [[[0]*10 for i in range(3)] for j in range(4)]
for i in range(n):
    inp = list(map(int,input().split()))
    apa[inp[0]-1][inp[1]-1][inp[2]-1] += inp[3]

for j in range(4):
    for i in range(3):
        for k in range(10):
            print(" %d"%apa[j][i][k],end="")
        print("")
    if j <3:
        print("#"*20)

Submission status: Accepted

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

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

for i, b in enumerate(B):
    if i != 0:
        print('#' * 20)
    for f in b:
        print(' ', end='')
        print(*f)

Submission status: Accepted

Solution code:
base_num = input()
a = int(base_num)
end_num = 0

input_list = []
while True:
    base_suit = input()
    input_list.append(base_suit)

    end_num += 1
    if a == end_num:
        break

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

for i in input_list:
    t = i.split(' ')
    b = int(t[0]) - 1
    f = int(t[1]) - 1
    r = int(t[2]) - 1
    v = int(t[3])

    count[b][f][r] = count[b][f][r] + v

for i, b in enumerate(count):
    for f in b:
        for r in f:
            print(" {}".format(r),end='')
        print()
    if i + 1 != len(count):
        print('####################',end='\n')

Submission status: Accepted

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

num = int(input())

for count in range(num):
    b, f, r, v = map(int, input().split()) 
    tbl[b-1][f-1][r-1]= tbl[b-1][f-1][r-1] + v
    if tbl[b-1][f-1][r-1] > 9:
        tbl[b-1][f-1][r-1] = 9
    if tbl[b-1][f-1][r-1] < 0:
        tbl[b-1][f-1][r-1] = 0

for i, row in enumerate(tbl):
    for j, elem in enumerate(row):
        for n, test in enumerate(elem):
            print(" ", end = "")
            print(tbl[i][j][n], end = "")
        print()
    if i != 3:
        print('####################')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
info = []
cnt = 0

###初期配置
ans1 = [[0] * 10 for i in range(3)]###棟
ans2 = [[0] * 10 for i in range(3)]
ans3 = [[0] * 10 for i in range(3)]
ans4 = [[0] * 10 for i in range(3)]

while True:
    b, f, r, v = map(int, input().split())
    info.append([b, f, r, v])
    cnt += 1
    if cnt == n:
        break

for i in range(len(info)):
    if info[i][0] == 1:
        ans1[info[i][1]-1][info[i][2]-1] += info[i][3]
    
    elif info [i][0] == 2:
        ans2[info[i][1]-1][info[i][2]-1] += info[i][3]

    elif info [i][0] == 3:
        ans3[info[i][1]-1][info[i][2]-1] += info[i][3]

    else:
        ans4[info[i][1]-1][info[i][2]-1] += info[i][3]

for i in range(3):
    print("", " ".join(map(str, ans1[i])))
print(20*'#')

for i in range(3):
    print("", " ".join(map(str, ans2[i])))
print(20*'#')

for i in range(3):
    print("", " ".join(map(str, ans3[i])))
print(20*'#')

for i in range(3):
    print("", " ".join(map(str, ans4[i])))

Submission status: Accepted

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

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

for b in range(len(room_list)):
    for f in room_list[b]:
        print("", *f)
    if b != len(room_list)-1:
        print("#" * 20)

Submission status: Accepted

Solution code:
m = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]

n = int(input())
i = 1

while n >= i:
    b, f, r, v = map(int, input().split())
    m[b-1][f-1][r-1] += v
    i += 1

bc, fc, rc = 0, 0, 0
while 4 > bc:
    while 3 > fc:
        while 10 > rc:
            if rc != 9:
                print(" {}".format(m[bc][fc][rc]), end = "")
            if rc == 9:
                print(" {}".format(m[bc][fc][rc]))
            rc += 1
        rc = 0
        fc += 1
    if bc != 3:
        print("####################")
    fc = 0
    bc += 1

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
home = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for l in range(int(input())):
    data = list(map(int,input().split()))
    b = data[0]
    f= data[1]
    r= data[2]
    v= data[3]
#b棟、f階、r番目の部屋にr人
    home[b-1][f-1][r-1]+=v

for n in range(0,4):
    for m in home[n]:
        for o in m:
            print(" "+str(o),end="")
            
        print()
    if n<3:
        print("#"*20)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    table = [[[0]*10 for i in range (0,3)] for j in range (0,4)]

    N = int(input())
    for i in range(N):
         b_num, f_num, r_num, v_num = map(int, input().split())
         table[b_num-1][f_num-1][r_num-1] += v_num

    # print(table)

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

if __name__ == '__main__':
  main()

Submission status: Accepted

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

B_str = [[[str(x) for x in y] for y in z] for z in B]

for b in range(4):
    for f in range(3):
        l = B_str[b][f]
        print(" " + " ".join(l))
    if b != 3:
        print("####################")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

persons = [0] * 120

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

for j in range(4):
	if j >= 1:
		print("#"*20)
	for h in range(3):
		for w in range(10):
			print(" %d" %(persons[w + h * 10 + j * 30]), end='')
		print()

Submission status: Accepted

Solution code:
n = int(input())

one = [[0 for _ in range(10)] for _ in range(3)]
two = [[0 for _ in range(10)] for _ in range(3)]
three = [[0 for _ in range(10)] for _ in range(3)]
four = [[0 for _ in range(10)] for _ in range(3)]

d = {1:one,2:two,3:three,4:four}

while n > 0:
    b,f,r,v = map(int,input().split())
    d[b][f-1][r-1] += v
    n-= 1

c = 0
for N in [one,two,three,four]:
    for f in N:
        print(" "+" ".join([str(i) for i in f]))
    c +=1
    if c != 4:
        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 = (int(x) for x in input().split())
    count[b - 1][f - 1][r - 1] += v

for b in range(4):
    for f in range(3):
        for r in range(10):
            print("", count[b][f][r], end="")
        print()
    if (b != 3) : print("####################")

Submission status: Accepted

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

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

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:
Tou = [[[0 for _ in range(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())
    Tou[b-1][f-1][r-1] = Tou[b-1][f-1][r-1] + v

for i in range(4):
    for j in range(3):
        sent =' '
        for k in range(10):
            sent = sent + str(Tou[i][j][k]) + ' '
        print(sent[:-1])
    if i != 3:
        print("####################")

Submission status: Accepted

Solution code:
# [[0*10], [0*10], [0*10]]を4つ持つtableを用意
table = [[[0]*10 for i in range(3)] for k in range(4)]

n = int(input())

# tableに情報を入力
for i in range(n):
    tower, floor, number, people = map(int, input().split())
    table[tower-1][floor-1][number-1] += people
    
x = 0
for i in range(4):
    
    # 最初と最後は#*20なしに対応
    if x != 0:
        print('#'*20)
    x += 1
    
    for j in range(3):
        for k in range(10):
            # 情報出力、%dと%の組み合わせで変数として扱い出力
            print(' %d'%(table[i][j][k]), end="")
        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)]
for x 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(" "+str(count[i][j][k]),end="") 
        print() 
    if i<3:
        print("#"*20)

Submission status: Accepted

Solution code:
building_num = 4
floor_num = 3

m = []
for i in range(building_num):
    building = []
    for j in range(floor_num):
        floor = [0] * 10
        building.append(floor)
    m.append(building)

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

delimiter = '#' * 20
for i in range(building_num):
    building = m[i]
    for floor in building:
        for room in floor:
            print(f' {room}', end='')
        print()

    if i != building_num - 1:
        print(delimiter)

Submission status: Accepted

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

for j, b in enumerate(room):
    for f in b:
        for r in f:
            print('', r, end='')
        print()

    if j != 3: print('#' * 20)

Submission status: Accepted

Solution code:
n = int(input())
r = [[["0" for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    m = list(map(int,input().split()))
    r[m[0]-1][m[1]-1][m[2]-1] = str(int(r[m[0]-1][m[1]-1][m[2]-1])+m[3])
for i,l in enumerate(r):
    for j in l:
        print(" " + " ".join(j))
    if i != 3:
        print("####################")

Submission status: Accepted

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

for i in range(4):
    for j in range(3):
        ans = [str(_) for _ in rooms[i][j]]
        print(' '+' '.join(ans))
    else:
        if i != 3:
            print('####################')

Submission status: Accepted

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

Submission status: Accepted

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

for i, building in enumerate(builds):
    for floor in building:
        for room in floor:
            print(" {}".format(room), end="")
        print()
    if i != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
N = int(input())
room = [[0 for i in range(30)] for j in range(4)]
s = "#"*20

for i in range(N):
    info = input().split()
    room[int(info[0])-1][(int(info[1])-1)*10+int(info[2])-1] += int(info[3])
for i in range(4):
    print("",*room[i][:10])
    print("",*room[i][10:20])
    print("",*room[i][20:30])
    if i != 3:
        print(s)

Submission status: Accepted

Solution code:
room=[[[0]*10 for i in range(0,3)]for j in range(0,4)]
N=int(input())
for i in range (N):
    a,b,c,d=input().split()
    a,b,c,d=[int(a),int(b),int(c),int(d)]
    room[a-1][b-1][c-1]=room[a-1][b-1][c-1]+d
for i in range(4):
    for j in range(3):
        result=" ".join([str(m) for m in room[i][j]])
        print("",result)
    if i==3:
        break
    print("####################")