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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar  2 15:43:49 2019

@author: mac
"""
n = input()
n = int(n)

numbers = []
index = []

for i in range(12):
    index.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

for _ in range(n):
    string = input()
    numbers.append(list(map(int, string.split(' '))))

numbers.sort()

for i in range(12):
    for j in range(10):
        for k in range(n):
            if (numbers[k][0]-1)*3+(numbers[k][1]-1) == i and (numbers[k][2]-1) == j:
                index[i][j] += numbers[k][3]
                      
for i in range(12):
    for j in range(10):
        print(" ",end="")
        print(index[i][j],end="")
#        if j != 9:
#            print(' ',end="")
        if i == 12:
            break
        
    print()
        
    if i == 2 or i == 5 or i == 8:
        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

flag = False
for b in count:
    if flag:
        print("####################")
    else:
        flag = True
    for f in b:
        for r in f:
            print(" " + str(r), 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):
    p = input()
    b,f,r,v = map(int, p.split())
    count[b-1][f-1][r-1] = count[b-1][f-1][r-1] + v

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

Submission status: Accepted

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

N = int(input())

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

for i, building in enumerate(lst):
    if i > 0:
        print("####################")
    for floor in building:
        for room in floor:
            print(end=" ")
            print(room, end="")
        print()

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):
    B , F , R, V =map(int, input().split())
    table[B - 1][F - 1][R - 1] += V

x = 0

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

    for k in range(3):

        for j in range(10):

            print(" %d" %(table[i][k][j]), end = '')
        print()

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):
    data=list(map(int,input().split()))
    room[data[0]-1][data[1]-1][data[2]-1]+=data[3]

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

Submission status: Accepted

Solution code:
n = int(input())
num=[]
for i in range(120):
    num.append(0)

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


for b in range(1,5):
    for f in range(1,4):
        print(" ",end="")
        print(*num[30*(b-1)+10*(f-1):30*(b-1)+10*(f-1)+10])
    if b <4:
        print("#"*20)

Submission status: Accepted

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

    

x = 0
for k in range(4):
    if x != 0:
        print("#"*20)
    x += 1

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

Submission status: Accepted

Solution code:
rooms = [[[0 for x in range(10)] for x in range(10) ] for x in range(10)]

num = int(input())

for i in range(num):
	b,f,r,v = map(int, input().split())
	rooms[b-1][f-1][r-1] += v #インデックスに対して実際の配列は0~n-1までなのでそのズレ対策
	
	#同じ部屋番号が来ても大丈夫なように+=を使う
	
for l in range(4):
	for j in range(3):
		'''
		for k in range(10):
			print(rooms[l][j][k],end = "")
		'''
		print(" "+" ".join(map(str, rooms[l][j])))
		# if k==9: print()
	if l != 3:
		print("#"*20)

Submission status: Accepted

Solution code:
n = int(input())
do = 0
count = [[[ 0 for i in range(10)] for j in range(3)] for k in range(4)]
while do < n:
    b, f, r, v = map(int, input().split(' '))
    
    count[b-1][f-1][r-1] += v
    do += 1
    

for k in range(4):
    for j in range(3):
        for i in range(10):
            print(f' {count[k][j][i]}', end = '')
        print('')
    if k <= 2:
        print('#' * 20)

Submission status: Accepted

Solution code:
n = int(input())

ans = [[[0]*10,[0]*10,[0]*10],[[0]*10,[0]*10,[0]*10], [[0]*10,[0]*10,[0]*10], [[0]*10,[0]*10,[0]*10]]

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

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

Submission status: Accepted

Solution code:
n = int(input())
list = [0]*120
for i in range(n):
    a,b,c,d = map(int,input().split())
    list[(a-1)*30+(b-1)*10+c-1] += int(d)
for j in range(120):
    print(" {}".format(list[j]),end="")
    if j % 10 == 9:
        print()
    if j % 30 == 29 and j < 90:
        print("#"*20)

Submission status: Accepted

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

for i in range(len(arr)):
    for j in range(len(arr[i])):
        for k in range(len(arr[i][j])):
            print(" %d" % arr[i][j][k],end = "")
        else:
            print("")
    if i < len(arr) -1:
        print('#' * 20)

Submission status: Accepted

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

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

i = 0
for house in houses:
  for line in house:
    for num in line:
      print('', num, end = '')
    print()
  if i < 3:
    print('#' * 20)
  i += 1

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 a in range(n):
    i,j,k,x=map(int,input().split())
    count[i-1][j-1][k-1] += x
for i in range(4):
    for j in range(3):
        for k in count[i][j][:]:
            print(" ",end="")
            print(k,end="")
        print()
    if i<3:
        print("####################")

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 f, k in enumerate(count):
    for j in k:
        for i in j:
            print(" {}".format(i), end="")
        print()
    if f < 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())

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

for l in range(4):
    for a in range(3):
        print(" "+" ".join(map(str,count[l][a])))

    if l != 3:
        print("#"*20)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = [[0] * 10 for _ in range(15)]
    for i in range(3, 14, 4):
        ans[i] = '#' * 20
    for _ in range(n):
        b, f, r, v = map(int, input().split())
        ans[(b - 1) * 4 + f - 1][r - 1] += v
    for col in ans:
        if col.count('#') > 0:
            print(col)
        else:
            print(' ' + ' '.join(map(str, col)))


main()

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
members = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] #j = 0 S, j = 1 H, j = 2 C, j = 3 D
for i in range(n):
    line = input().rstrip().split()
    members[int(line[0])-1][int(line[1])-1][int(line[2])-1] += int(line[3])

for i in range(4):
    for j in range(3):
        for k in range(10):
            if k < 9:
                print(" " + str(members[i][j][k]), end="")
            else:
                print(" " + str(members[i][j][k]))
    if i < 3:
        print("####################")

Submission status: Accepted

Solution code:
from collections import defaultdict


data = defaultdict(lambda: defaultdict(lambda: defaultdict(int)))

rows = int(input())

for _ in range(rows):
    b, f, r, v = map(int, input().split())
    data[b][f][r] += v

for b in range(1, 4+1):
    for f in range(1, 3+1):
        print(' ' + ' '.join(str(data[b][f][r]) for r in range(1, 10+1)))
    if b != 4:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())
pop = [[[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())
    pop[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' {}'.format(pop[i][j][k]), end = '')
        print('')
    if i != 3: print('#' * 20)

Submission status: Accepted

Solution code:
n = int(input())
data = {}
for i in range(n):
    b, f, r, v = map(int, input().split())
    if (b,f,r) in data:
        data[(b,f,r)] = data[(b,f,r)] + v
    else:
        data[(b,f,r)] = v
for b in range(1,5):
    for f in range(1,4):
        for r in range(1,11):
            if (b,f,r) in data:
               print(" "+str(data[(b,f,r)]),end="")
            else:
                print(" 0",end="")
        print("")
    if b < 4:
        print("#"*20)

Submission status: Accepted

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

for i in range(4):
  for j in range(3):
    print(' '+' '.join(map(str, cnt[i][j])))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
mansion = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    a=list(map(int,input().split()))
    b=a[0] #what building
    f=a[1] #what floor
    r=a[2] #room number
    v=a[3] #how many
    mansion[b-1][f-1][r-1]+=v
for i in range(4):
    for j in range(3):
        print('', *mansion[i][j])
    if i < 3:
        print("#" *20)

Submission status: Accepted

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

while num > 0:
    list = input().split()
    b = int(list[0]) - 1
    f = int(list[1]) - 1
    r = int(list[2]) - 1
    v = int(list[3])
    room[b][f][r] += v 
    num -= 1

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

Submission status: Accepted

Solution code:
n = int(input())

list = []
for x in range(4):
    building = []
    for y in range(3):
        floor = []
        for z in range(10):
            floor.append(0)
        building.append(floor)
    list.append(building)

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

flag = False
for building in list:
    if(flag):
        print("####################")
    else:
        flag = True

    for floor in building:
        string = ""
        for room in floor:
            string += " " + str(room)

        print(string)

Submission status: Accepted

Solution code:
n = int(input())
list_info = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for _ in range(n):
    info = input()
    info_list = info.split(" ")
    b = int(info_list[0])
    f = int(info_list[1])
    r = int(info_list[2])
    v = int(info_list[3])
    list_info[b - 1][f - 1][r - 1] += v 
for l in range(4):
    for m in range(3):
        num = ""
        for n in range(10):
            num += " "
            num += str(list_info[l][m][n])
        print(num)
    if not(l == 3):
        print("#" * 20)

Submission status: Accepted

Solution code:
num = int(input())
bill =[ [ [ 0 for i in range(10) ] for n in range(3) ] for j in range(4) ]
for i in range(num):
    lines = input().split()
    b, f, r, v = int(lines[0]), int(lines[1]), int(lines[2]), int(lines[3])
    bill[b - 1][f - 1][r - 1] += v

for number,i in enumerate(bill):
    for n in i:
        for j in n:
            print(" " + str(j),end="")
        print()
    if number != 3: 
        print("#"*20)
    else:
        break

Submission status: Accepted

Solution code:
n = int(input())
a = [0]*120
for i in range(n):
	b, f, r, v = map(int, input().split())
	t = (b - 1) * 30 + (f - 1) * 10 + r - 1
	a[t] += v
for i in range(120):
	print(' %d'  % a[i], end="")
	if i % 10 == 9:
		print("")
	if i % 30 == 29 and i < 100:
		for c in range(20):
			print("#", end="")
		print("")

Submission status: Accepted

Solution code:
building = [[[0*r for r in range(1, 11)] for f in range(1, 4)] for b in range(1, 5)]
num = int(input())
for i in range(num):
    b, f, r, v = map(int, input().split())
    building[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print('', *building[b][f])
    if b < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
n = int(input())

school = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    school[b - 1][f - 1][r - 1] += v

for blg in range(4):
    for flr in range(3):
        for rm in range(10):
            print (" %d" % school[blg][flr][rm], end = "")
        print ()
    if blg < 3:
        print ("#" * 20)

Submission status: Accepted

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

for i in range(120):
    a.append(0)

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

Submission status: Accepted

Solution code:
h=[[[0]*10for i in[0]*3]for j in[0]*4];i=0
for _ in[0]*int(input()):b,f,r,v=map(int,input().split());h[~-b][~-f][~-r]+=v
for b in h:
 for f in b:print("",*f)
 print(("","#"*20+"\n")[i<3],end="");i+=1

Submission status: Accepted

Solution code:
section = (1, 2, 3, 4)
book = {sec:[[0 for i in range(10)] for j in range(3)] for sec in section}
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    book[b][f - 1][r - 1] += v
for sec in section:
    for rl in book[sec]:
        print(' ' + ' '.join(map(str, rl)))
    if sec != 4:
        print('####################')

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

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

n = int(sys.stdin.readline())
for i in range(n):
    b, f, r, v = map(int, sys.stdin.readline().split())
    tenant[b-1][f-1][r-1] += v

ROOM_STR = '{:2}' * 10  # width:2 10 rooms
separator = '#' * 20
for b in range(4):
    for f in range(3):
        print(ROOM_STR.format(*tenant[b][f]))  # unpack list of 10 elements
    if b != 3:
        print(separator)

Submission status: Accepted

Solution code:
import sys
arr_3d=[[[0 for r in range(10)] for f in range(3)  ] for b in range (4)]
x=int(sys.stdin.readline())
for i in range(x):
    a,b,c,d=map(int,sys.stdin.readline().split())
    arr_3d[a-1][b-1][c-1]+=d


for b in range(4):
    for f in range(3):
        print (' ', ' '.join(map(str, arr_3d[b][f])), sep='')
    if b < 3:
        print ('#' *20)

Submission status: Accepted

Solution code:
building = [[[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 = [int(i) for i in input().split()]
    building[b-1][f-1][r-1] += v
building = [[[" "+str(k) for k in j] for j in i] for i in building]
print("\n####################\n".join(["\n".join(["".join(j) for j in i]) for i in building]))

Submission status: Accepted

Solution code:
x=[[[0]*10 for i in range(3)] for j in range(4)]
n=int(input())
for i in range(n):
    a,b,c,d=map(int, input().split())
    x[a-1][b-1][c-1]+=d

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

table = [[[0]*10 for r in range(3)] for i in range(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

    

for i in range(4):
    if i != 0:
        print(wall)
        
    for r in range(3):
        for v in range(10):
            print(" %d"%table[i][r][v],end = "")
        print("")

Submission status: Accepted

Solution code:
wall = "#"*20
L = [[[str(0) for i in range(10)] for i in range(3)]
 for i in range(4)]

N = int(input())
for i in range(N) :
    tou,kai,ban,dx = map(int,input().split())
    L[tou-1][kai-1][ban-1] = str(int(L[tou-1][kai-1][ban-1]) + dx)

for i in range(12) :
    info = " "+" ".join(L[i//3][i%3])
    print(info)
    if i % 3 == 2 and i != 11 :
        print(wall)

Submission status: Accepted

Solution code:
# coding: utf-8
# coding: Shift_JIS
# coding: EUC-JP
# coding: cp932
import math

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

for i in range(4):
    if i != 0:
        print("#"*20)
    for j in range(3):
        st = ""
        for z in range(10):
            st = st + " " + str(room[i][j][z])
        print(st)

Submission status: Accepted

Solution code:
import sys

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


def print_rooms():
    for i, building in enumerate(rooms):
        if i != 0:
            print('#' * 20)
        for floor in building:
            print(' ' + ' '.join(map(str, floor)))


lines = int(sys.stdin.readline())
for _ in range(lines):
    b, f, r, v = map(int, sys.stdin.readline().strip().split())
    rooms[b-1][f-1][r-1] += v


print_rooms()

Submission status: Accepted

Solution code:
inform = [[[0]*10 for i in range(3)] for j in range(4)]
N = int(input())
for loop in range(N):
    b, f, r, v = map(int, input().split())
    inform[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(inform[i][j][k],end="")
        print()
    if i != 3:print("####################")

Submission status: Accepted

Solution code:
sh = ["#" for i in range(20)]
def  bet():
    for i in sh:
        print(i, end="")
    print()

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


n = int(input())
for i in range(n):
    line = input()
    lst = list(map(int, line.split()))
    b = lst[0]
    f = lst[1]
    r = lst[2]
    v = lst[3]
    if b == 1:
        one[f-1][r-1] += v
    elif b == 2:
        two[f-1][r-1] += v
    elif b == 3:
        three[f-1][r-1] += v
    elif b == 4:
        four[f-1][r-1] += v
"""
print(one)
print(two)
print(three)
print(four)

"""
for i in one:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in two:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in three:
    for j in i:
        print(" {}".format(j), end="")
    print()
bet()
for i in four:
    for j in i:
        print(" {}".format(j), end="")
    print()

#print(one)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict
residents = defaultdict(int)
n=int(input())
q = [map(int, input().split()) for _ in range(n)]
for b, f, r, v in q:
    residents[(b,f,r)] += v
print(f'\n{"#"*20}\n'.join(['\n'.join([' ' + ' '.join([str(residents[(b,f,r)]) for r in range(1,11)]) for f in range(1,4)]) for b in range(1,5)]))

Submission status: Accepted

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

for i, j in enumerate(a):
    for k in j:
        for l in k:
            print(' ' + str(l), end='')
        print()
    if i < len(a) - 1:
        print('#'*20, sep='')

Submission status: Accepted

Solution code:
def main():
	buillist = [Building(), Building(), Building(), Building()]
	n = int(input())
	for i in range(n):
		x = input().split()
		buillist[int(x[0]) - 1].assign(int(x[1]), int(x[2]), int(x[3]))
	for b in range(4):
		for f in range(3):
			string = map(str, buillist[b].floors[f])
			string = ' '.join(string)
			buillist[b].string[f] = string
		for f in buillist[b].string:
			print(' ' + f)
		if not b == 3:
			print('####################')

class Building():
	def __init__(self):
		self.floors = [[0]*10, [0]*10, [0]*10]
		self.string = ['', '', '']

	def assign(self, f, r, v):
		self.floors[f - 1][r - 1] += v

main()

Submission status: Accepted

Solution code:
n=int(input())
information=[]

one=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
two=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
three=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
four=[[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
kousya=[one,two,three,four]

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

for i in range(4):
    for j in range(3):
        for k in range(10):
            if k<9:
                print(" "+str(kousya[i][j][k]),end="")
            else:
                print(" "+str(kousya[i][j][k]))
    if i<3:
        print("####################")

Submission status: Accepted

Solution code:

n =  int(input())


tatemono = [0] * 4 * 3 *10
while ( n > 0 ):
    (b,f,r,v)  =  map(int,input().split())
    tatemono[(b-1)*30 + (f-1)*10 + r-1] += v
    n = n -1


for  i in range (0,4):
    for  i2 in range (0,3):
        for  i3 in range (0,10):
            print (' {}'.format(tatemono[i3 + i*30 + i2*10]),end="")
        else:
            print("")
    if ( i != 3 ):
        print ("####################")

Submission status: Accepted

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

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 i in range(n):
    b, f, r, v = map(int, input().split())
    list[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 (list[k][j][i], end = "")
        print("")
    if k != 3:
        print("####################")

Submission status: Accepted

Solution code:
n = int(input())

blist = []
flist = []
rlist = []
vlist = []

for _ in range(n):
    b, f, r, v = map(int, input().split())
    blist.append(b)
    flist.append(f)
    rlist.append(r)
    vlist.append(v)

arr4 = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]

for b, f, r, v in zip(blist, flist, rlist, vlist):
    arr4[b-1][f-1][r-1] += v

for b in range(3):
    for f in range(3):
        for r in range(10):
            print(" " + str(arr4[b][f][r]), end="")
        print()
    print("####################")

for f in range(3):
    for r in range(10):
        print(" " + str(arr4[3][f][r]), end="")
    print()

Submission status: Accepted

Solution code:
answer = [[[0]*10 for i in range(3)] for k in range(4)]
N = int(input())
for i in range(N):
    b, f, r, v = map(int, input().split())
    answer[b-1][f-1][r-1] += v
    
for i in range(3):
    for k in range(3):
        for l in range(10):
            print(" " + str(answer[i][k][l]),end="")
        print()
    print("#"*20)
for k in range(3):
    for l in range(10):
        print(" " + str(answer[3][k][l]),end="")
    print()

Submission status: Accepted

Solution code:
def custom_print(building):
    for i in range(3):
        print(' ' + ' '.join([str(o) for o in building[i]]))


SEPARATOR = "####################"

if __name__ == '__main__':

    n = int(input())

    building_1 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_2 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_3 = [
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    building_4 = [
        [0, 0, 0, 0, 0, 0, 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):
        input_line = input().split()
        b = int(input_line[0])
        f = int(input_line[1])
        r = int(input_line[2])
        v = int(input_line[3])

        if b == 1:
            building_1[f - 1][r - 1] += v
        elif b == 2:
            building_2[f - 1][r - 1] += v
        elif b == 3:
            building_3[f - 1][r - 1] += v
        else:
            building_4[f - 1][r - 1] += v

    custom_print(building_1)
    print(SEPARATOR)
    custom_print(building_2)
    print(SEPARATOR)
    custom_print(building_3)
    print(SEPARATOR)
    custom_print(building_4)

Submission status: Accepted

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

BUILDS = 4
FLOORS = 3
ROOMS = 10

house = [[[0 for x in range(ROOMS)] for y in range(FLOORS)] for z in range(BUILDS)]

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

for i in range(BUILDS):
    for j in range(FLOORS):
        floor = ''
        for k in range(ROOMS):
            floor += ' {}'.format(house[i][j][k])
        print(floor)
    
    if i < BUILDS - 1:
        print('#' * 20)

Submission status: Accepted

Solution code:
def print_building(b_dict,b_floor):
    for i in range(len(b_dict[b_floor])):
        for j in b_dict[b_floor][i]:
            print(' {}'.format(j),end='')
        print('\r')

def print_fence():
    print('####################')

building = {
    1:[[0]*10 for i in range(3)],
    2:[[0]*10 for i in range(3)],
    3:[[0]*10 for i in range(3)],
    4:[[0]*10 for i in range(3)]
}

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

for i in range(1,4):
    print_building(building,i)
    print_fence()
print_building(building,4)

Submission status: Accepted

Solution code:
n = int(input())
R,F,B = 10,3,4

Status = [[[0 for x in range(R)] for y in range(F)] for z in range(B)]

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

for m in range(4):
    for n in range(3):
        for k in range(10):
            print(" {}".format(Status[m][n][k]),end="")
        print()
    if m+1 in range(4):
        print("#"*20)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
L = [[[0 for i in range(10)] for i in range(3) ] for i in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    L[b-1][f-1][r-1] += v
for bn, b in enumerate(L):
    for f in b:
        print(" ", end="")
        print(*f)
    if not bn == 3:
        print("#" * 20)

Submission status: Accepted

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

for _ in range(int(input())):
    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):
        print(' ' + ' '.join(map(str,h[b][f])))
    if b<3:
        print('#'*20)