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:
n=120
l=[0]*120
s="#"*20
for i in range(input()):b,f,r,v=map(int,raw_input().split());l[b*30+f*10+r-41]+=v
print"",
#i=1;while 1:; i+=1
for i in range(1,121):
 print l[i-1],
 if i==120:break
 if i%30==0:print;print s,
 if i%10==0:print;print"",

Submission status: Accepted

Solution code:
l=[0]*120
s="#"*20
for i in range(input()):b,f,r,v=map(int,raw_input().split());l[b*30+f*10+r-41]+=v
print"",
for i in range(1,121):
 print l[i-1],
 if i==120:break
 if i%30==0:print;print s,
 if i%10==0:print;print"",

Submission status: Accepted

Solution code:
l=[0]*120
s="#"*20
n=input()
while n:n-=1;b,f,r,v=map(int,raw_input().split());l[b*30+f*10+r-41]+=v
print"",
while 1:
 n+=1;print l[n-1],
 if n==120:break
 if n%30==0:print;print s,
 if n%10==0:print;print"",

Submission status: Accepted

Solution code:
import sys
n=int(input())
data={}
for i in range(1,5):
	for j in range(1,4):
		for k in range(1,11):
			data[(i,j,k)]=0
			

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

for i in range(1,5):
	for j in range(1,4):
		for k in range(1,11):
			sys.stdout.write(' '+str(data[(i,j,k)]))
		print('')
	if i<4:
		print('#'*20)

Submission status: Accepted

Solution code:
from __future__ import print_function
import sys

officalhouse = [0]*4*3*10

n = int( sys.stdin.readline() )
for i in range( n ):
	b, f, r, v = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	bfr = (b-1)*30+(f-1)*10+(r-1)
	officalhouse[bfr] = officalhouse[bfr] + v;
	
output = []
for b in range( 4 ):
	for f in range( 3 ):
		for r in range( 10 ):
			output.append( " {:d}".format( officalhouse[ b*30 + f*10 + r ] ) )
		output.append( "\n" )
	if b < 3:
		output.append( "####################\n" )

print( "".join( output ), end="" )

Submission status: Accepted

Solution code:
import sys

officalhouse = [0]*4*3*10

n = int( sys.stdin.readline() )
for i in range( n ):
	b, f, r, v = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	bfr = (b-1)*30+(f-1)*10+(r-1)
	officalhouse[bfr] = officalhouse[bfr] + v;
	
output = []
for b in range( 4 ):
	for f in range( 3 ):
		for r in range( 10 ):
			output.append( " {:d}".format( officalhouse[ b*30 + f*10 + r ] ) )
		output.append( "\n" )
	if b < 3:
		output.append( "####################\n" )

print( "".join( output ), end="" )

Submission status: Accepted

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

class residence(object):
	def __init__(self):
		one = [0] * 10
		two = [0] * 10
		three = [0] * 10
		self.all = [one, two, three]

residences = [ ]

for i in xrange(4):
	residences.append(residence())

n = int(raw_input())

for i in xrange(n):
	b, f, r, v = map(int, raw_input().split())
	residences[b-1].all[f-1][r-1] += v

for i, residence in enumerate(residences):
	for floor in residence.all:
		print '',
		for index, num in enumerate(floor):
			if index == len(floor) - 1:
				print num
			else:
				print num,
	if i != len(residences) - 1:
		print '####################'

Submission status: Accepted

Solution code:
a = [[[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().strip().split())
    a[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in range(3):
        print(''.join(' {}'.format(a[b][f][r])for r in range(10)))
    if b < 3:
        print("#" * 20)

Submission status: Accepted

Solution code:
if __name__ == "__main__":

    house = [ [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ], [ 0,0,0,0,0,0,0,0,0,0 ] ], [ [ 0,0,0,0,0,0,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(raw_input())

    i = 0
    while i < n:
        x = map(int, raw_input().split())
        b = x[0]
        f = x[1]
        r = x[2]
        v = x[3]
        house[b-1][f-1][r-1] += v
        i += 1

    b = 1
    while b <= 4:
        f = 1
        while f <= 3:
            s = ""
            r = 1
            while r <= 10:
                s += " {0}".format(house[b-1][f-1][r-1])
                r += 1
            print s
            f += 1
        if b != 4:
            print "####################"
        b += 1

Submission status: Accepted

Solution code:
# coding=utf-8
from copy import deepcopy

rooms = dict(zip(range(1, 11), [0] * 10))
building = dict(zip(range(1, 4), [deepcopy(r) for r in [rooms]*3]))
buildings = dict(zip(range(1, 5), [deepcopy(b) for b in [building]*4]))

# input
n = input()
for _ in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    buildings[b][f][r] += v

# print result
for b in range(1, 5):
    for f in range(1, 4):
        rooms = buildings[b][f]
        print ' ' + ' '.join(map(str, [rooms[i] for i in xrange(1, 11)]))
    if b != 4:
        print '#' * 20

Submission status: Accepted

Solution code:
rooms = [[[0] * 10 for b in range(3)] for a in range(4)]
n = int(input())
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):
        print(' ' + ' '.join(map(str, rooms[i][j])))
    if i < 3:
        print('#' * 20)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = [[[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().strip().split())
    a[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in range(3):
        print(''.join(' {}'.format(a[b][f][r]) for r in range(10)))
    if b < 3:
        print('#'*20)

Submission status: Accepted

Solution code:
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
  
count = int(input())
  
for c in range(count):
    (b, f, r, v) = [int(x) for x in input().split()]
    data[b - 1][f - 1][r - 1] += v
  
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('',data[b][f][r], end='')
        print()
    if b < 3:
        print('#' * 20)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

n = int(input())

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


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

Submission status: Accepted

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

n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(raw_input())

residence = []

for i in xrange(4):
  floor = []
  for j in xrange(3):
    room = []
    for k in xrange(10):
      room.append(0)
    floor.append(room)
  residence.append(floor)

i = 0
while i < n:
  line = map(int, raw_input().split(" "))
  residence[line[0] - 1][line[1] - 1][line[2] - 1] += line[3]
  # print "residence[%d][%d][%d] = %d" % (line[0] - 1, line[1] - 1, line[2] - 1, line[3])
  # print residence
  i += 1

secion_line = "####################"
for i in xrange(4):
  for j in xrange(3):
    output_line = ""
    for k in xrange(10):
      output_line += " " + str(residence[i][j][k])
    print output_line
  if i != 3:
   print secion_line

Submission status: Accepted

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

for x,i in enumerate(room):
    for j in i:
            print(''," ".join(map(str,j)))
    if x <= 2 : print('#'*20)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
  
BUILDINGS = tuple(x for x in range(4))
FLOORS = tuple(x for x in range(3))
ROOMS = tuple(x for x in range(10))
  
occupant = [[[0 for r in ROOMS] for f in FLOORS] for b in BUILDINGS]
  
n = input() # ????????¨???
  
for line in sys.stdin:
    b, f, r, v = map(int, line.split())
    occupant[b - 1][f - 1][r - 1] += v
      
for b in BUILDINGS:
    if b:
        print('#' * 20)
    for f in FLOORS:
        print("", *occupant[b][f])

Submission status: Accepted

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

B = 4
F = 3
R = 10
SHARPS = 20

def main():
    """
    The function to be called when this script is run as a script.
    
    """
    
    info_number = int(input())
    given_info_str = (info.split() for info in (
        input() for _ in range(info_number)))
    given_info_int = (list(map(int, info)) for info in given_info_str)
    houses = [[[0 for i in range(R)] for j in range(F)] for k in range(B)]
    for info in given_info_int:
        houses[info[0] - 1][info[1] - 1][info[2] - 1] += info[3]
    for num, building in enumerate(houses):
        for floor in building:
            print (" " + " ".join(map(str, floor)))
        if num < (B - 1):
            print("#" * 20)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = [[['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 
[['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
 [['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ['', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 
 [['', 0, 0, 0, 0, 0, 0, 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 = input()
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    a[b - 1][f - 1][r] += v
print ' '.join(map(str, a[0][0]))
print ' '.join(map(str, a[0][1]))
print ' '.join(map(str, a[0][2]))
print '####################'
print ' '.join(map(str, a[1][0]))
print ' '.join(map(str, a[1][1]))
print ' '.join(map(str, a[1][2]))
print '####################'
print ' '.join(map(str, a[2][0]))
print ' '.join(map(str, a[2][1]))
print ' '.join(map(str, a[2][2]))
print '####################'
print ' '.join(map(str, a[3][0]))
print ' '.join(map(str, a[3][1]))
print ' '.join(map(str, a[3][2]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
build = range(1, 5)
floor = range(1, 4)
dic = {}
for b in build:
    dic[b] = {}
    for f in floor:
        dic[b][f] = [0]*10

n = input()
for i in range(n):
    info = map(int, raw_input().split())
    dic[info[0]][info[1]][info[2]-1] += info[3]
    if dic[info[0]][info[1]][info[2]-1] > 9:
        print 'error'

for b in build:
    for f in floor:
        print '',
        print ' '.join(map(str, dic[b][f]))
    if b != 4:
        print "#"*20

Submission status: Accepted

Solution code:
build = range(1, 5)
floor = range(1, 4)
dic = {b: {f: [0]*10 for f in floor} for b in build}

n = input()
for i in range(n):
    info = map(int, raw_input().split())
    dic[info[0]][info[1]][info[2]-1] += info[3]
    if dic[info[0]][info[1]][info[2]-1] > 9:
        print 'error'

for b in build:
    for f in floor:
        print '',
        print ' '.join(map(str, dic[b][f]))
    if b != 4:
        print "#"*20

Submission status: Accepted

Solution code:
res_list = [[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
            [[0, 0, 0, 0, 0, 0, 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 i in range(n):
    io_rec = list(map(int, input().split(" ")))
    bld_num = io_rec[0] - 1
    floor_num = io_rec[1] - 1
    room_num = io_rec[2] - 1
    io_headcnt = io_rec[3]
    res_list[bld_num][floor_num][room_num] += io_headcnt


for i in range(4):
    if i:
        print("#" * 20)
    bld = res_list[i]
    for j in bld:
        floor_str = map(str, j)
        print(" " + " ".join(floor_str))

Submission status: Accepted

Solution code:
import sys

n = input()
a_uni = [[[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,raw_input().split())
	a_uni[b-1][f-1][r-1] += v
for i in range(4):
	for j in range(3):
		for k in range(10):
			if k==9:
				sys.stdout.write(' ')
				print(a_uni[i][j][k])
			else :
				sys.stdout.write(' ')
				sys.stdout.write(str(a_uni[i][j][k]))
	if not i==3:
		print '####################'

Submission status: Accepted

Solution code:
def showrooms(building,floor,rooms):
    for x in xrange(0,floor):
        for y in xrange(0,rooms):
            if y==0:
                print "",
                print building[x][y],
            elif y ==rooms-1:
                print building[x][y]
            else:
                print building[x][y],
FLOOR = 3
ROOMS = 10
n = input()
building1 = [[0 for i in range(ROOMS)] for j in range(FLOOR)]
building2 = [[0 for i in range(ROOMS)] for j in range(FLOOR)]
building3 = [[0 for i in range(ROOMS)] for j in range(FLOOR)]
building4 = [[0 for i in range(ROOMS)] for j in range(FLOOR)]
# for x in xrange(0,n):
for x in xrange(0,n):
    b,f,r,v = map(int,raw_input().split())
    f=f-1
    r=r-1
    if b==1:
        building1[f][r] += v
    elif b==2:
        building2[f][r] += v
    elif b==3:
        building3[f][r] += v
    elif b==4:
        building4[f][r] += v
    else:
        print "your input is invalid format."
        break
showrooms(building1,FLOOR,ROOMS)
print "####################"
showrooms(building2,FLOOR,ROOMS)
print "####################"
showrooms(building3,FLOOR,ROOMS)
print "####################"
showrooms(building4,FLOOR,ROOMS)

Submission status: Accepted

Solution code:
n=input()
L1=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
L2=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]   
L3=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
L4=[[0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0],
   [0,0,0,0,0,0,0,0,0,0]]
Mantion=[L1,L2,L3,L4]
for i in range(n):
  b,f,r,v=map(int, raw_input().split())
  Mantion[b-1][f-1][r-1]+=v

for j in range(3):
  L1_str=map(str, L1[j])
  print "",
  print " ".join(L1_str)
print "#"*20
for j in range(3):
  L2_str=map(str, L2[j])
  print "",
  print " ".join(L2_str)
print "#"*20
for j in range(3):
  L3_str=map(str, L3[j])
  print "",
  print " ".join(L3_str)
print "#"*20
for j in range(3):
  L4_str=map(str, L4[j])
  print "",
  print " ".join(L4_str)

Submission status: Accepted

Solution code:
l = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]
n = int(input())
while n > 0:
  b,f,r,v = map(int,input().split())
  l[b-1][f-1][r-1] += v
  n -= 1
c = 0
for b in l:
  c += 1
  for f in b:
    r_l = [str(r) for r in f]
    print(' '+' '.join(r_l))
  if c < len(l):  
    print('#'*20)

Submission status: Accepted

Solution code:
house = [[[0 for col in range(10)]for row in range(3)]for layer in range(4)]
n = int(raw_input())
for i in range(n):
    input_line = raw_input().split()
    house[int(input_line[0])-1][int(input_line[1])-1][int(input_line[2])-1] += int(input_line[3])
for i in range(0,4):
    if i != 0:
        print "#"*20
    for j in range(0,3):
        buf = ""
        for k in range(0,10):
                buf += " " + str(house[i][j][k])
        print buf

Submission status: Accepted

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

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

for b in range(4):
    for f in range(3):
        for r in range(10):
            ans += " "+str(a[b][f][r])
        if (b!=3 or f!=2 or r!=9):
            ans += "\n"
    if (b != 3):
        ans += "#"*20+"\n"

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

nums = []
for i in range(4):
    nums.append([])
    for j in range(3):
        nums[i].append([])
        for k in range(10):
            nums[i][j].append(0)


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

for i, building in enumerate(nums):
    for floor in building:
        print('', ' '.join(map(str, floor)))
    if i != 3:
        print('#'*20)

Submission status: Accepted

Solution code:
# coding:utf-8

class FLOOR:
    def __init__(self):
        self.room = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

class BUILD:
    def __init__(self):
        self.floor = [FLOOR(), FLOOR(), FLOOR()]

# 3??????10??¨?±????4?£?
all_rooms = [BUILD(), BUILD(), BUILD(), BUILD()]

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

for b in range(4):
    for f in range(3):
        display = []
        for r in range(10):
            display.append(str(all_rooms[b].floor[f].room[r]))
        print(' ' + ' '.join(display))
    if (b < 3):
        print('#'*20)

Submission status: Accepted

Solution code:
def print_list(lst) :
	a = ' '.join(list(map(str, lst)))
	print(" " + a)

n = int(input())
lst = [[[0 for w in range(10)] for q in range(3)] for e in range(4)]
for _ in range(n):
	b,f,r,v = list(map(int, input().split()))
	lst[b-1][f-1][r-1] += v 
for i in range(4):
	if (i != 0):
		print("#" * 20)
	for j in range(3):
		print_list(lst[i][j])

Submission status: Accepted

Solution code:
num = int(input())

info = list()
buildings = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

for i in range(num):
    info = input().split()
    buildings[int(info[0])-1][int(info[1])-1][int(info[2])-1] += int(info[3])

for i, b in enumerate(buildings):
    for f in b:
        print(' ', end='')
        print(' '.join(map(str, f)))
    if not i == (len(buildings) - 1):
        print('#'*20)

Submission status: Accepted

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

n = int(input())

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

for i, b in enumerate(house):
    for f in b:
        print(' ', end='')
        print(*f)
    if i < 3:
        print('#' * 20)

Submission status: Accepted

Solution code:
house1 = [[0 for x in range(10)], [0 for x in range(10)], [0 for x in range(10)]]
house2 = [[0 for x in range(10)], [0 for x in range(10)], [0 for x in range(10)]]
house3 = [[0 for x in range(10)], [0 for x in range(10)], [0 for x in range(10)]]
house4 = [[0 for x in range(10)], [0 for x in range(10)], [0 for x in range(10)]]
houses = [house1, house2, house3, house4]

n = int(input())

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

cnt = 0
for house in houses:
    for floor in house:
        floor = [str(x) for x in floor]
        print(' ' + ' '.join(floor))
    if cnt != 3:
        print('#' * 20)
    cnt += 1

Submission status: Accepted

Solution code:
import sys

S = [[[0 for k in xrange(10)] for j in xrange(3)] for i in xrange(4)]

n = input()

for l in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    S[b - 1][f - 1][r - 1] += v
    
for k in xrange(4):
    for j in xrange(3):
        for i in xrange(10):
            tmp = ' ' + str(S[k][j][i]) 
            sys.stdout.write(tmp)
        print ""
    if k != 3:
        print "#" * 20

Submission status: Accepted

Solution code:
import sys
n = input()
a = [[[0]*10 for i in range(3)] for i in range(4)]
for i in xrange(n):
	b = map(int, raw_input().split())
	a[b[0]-1][b[1]-1][b[2]-1] += b[3]

for i in range(4):
	for j in range(3):
		for k in range(10):
			sys.stdout.write(' %s' % a[i][j][k])
		print ""
	if i != 3:
		print '#'*20

Submission status: Accepted

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

for b in range(1, 5):
    for f in range(1, 4):
        for r in range(1, 11):
            print(" " + str(Building[b][f][r]), end = "")
        print()
    if b != 4:
        print("####################")

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
n = int(raw_input())

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

for i in range(n):
    C = map(int, raw_input().split())
    Mem[C[0]-1][C[1]-1][C[2]-1] += C[3]

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

Submission status: Accepted

Solution code:
def print_list(lst) :
    a = ' '.join(list(map(str, lst)))
    print(" " + a)


lst = [[[0 for q in range(10)] for w in range(3)] for e in range(4)]

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

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

Submission status: Accepted

Solution code:
n = int( raw_input() )
house = [ [ [ 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 , raw_input().split() )
  house[b-1][f-1][r-1] += v
     
for i in range(4):
  for j in range(3):
    ans=''
    for k in range(10):
      ans += ' ' + str( house[i][j][k] )
    print ans
  if i != 3: 
    print '#'*20

Submission status: Accepted

Solution code:
bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v
for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b < 3:
        print("#"*20)

Submission status: Accepted

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

n = input()

for i in range(n):
    Inf = map(int, raw_input().split())

    Adr[Inf[0]-1][Inf[1]-1][Inf[2]-1] += Inf[3]

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


    if b < 3:
        print "####################"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = [None] * 4
for i in xrange(4):
    data[i] = [None] * 3
    for j in xrange(3):
        data[i][j] = [0] * 10

n = input()
for i in xrange(n):
    line = map(int, raw_input().split())
    data[line[0] - 1][line[1] - 1][line[2] - 1] += line[3]

for i in xrange(4):
    for j in xrange(3):
        s = ""
        for k in xrange(10):
            s += ' '
            s += str(data[i][j][k])
        print s
    if i < 3:
        print '#' * 20

Submission status: Accepted

Solution code:
n = int(raw_input())
l = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]
for i in range(n):
    b,f,r,v = map(int,raw_input().split())
    l[b-1][f-1][r-1] += v
for i in range(4):
    if i != 0:
        print "####################"
    for j in range(3):
        print "",
        for k in range(9):
            print "%d" %l[i][j][k] ,
        print l[i][j][9]

Submission status: Accepted

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