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: Runtime Error

Solution code:
house = [[ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ "#" for i in range(20)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ "#" for i in range(20)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ "#" for i in range(20)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)],
        [ 0 for i in range(10)]]
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    if b==1:
        house[f-1][r-1] += v
    elif b==2:
        house[f+3*b-1][r-1] += v
    elif b==3:
        house[f+3*b-2][r-1] += v
    else:
        house[f+3*b-1][r-1] += v
for i in range(len(house)):
    if (i+1)%4 ==0:
        print(''.join(str(i) for i in house[i]))
    else:
        print('',' '.join(str(i) for i in house[i]))

Submission status: Runtime Error

Solution code:
house=[
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ "#" for i in range(20)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ "#" for i in range(20)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ "#" for i in range(20)],
[ 0 for i in range(10)],
[ 0 for i in range(10)],
[ 0 for i in range(10)]]
#n = int(input())
for i in range(1):
    b,f,r,v = map(int,input().split())
    if b==1:
        house[f-1+(b-1)*4][r-1] += v
    elif b==2:
        house[f-1+(b-1)*4][r-1] += v
    elif b==3:
        house[f-1+(b-1)*4][r-1] += v
    else:
        house[f-1+(b-1)*4][r-1] += v
    for i in range(len(house)):
        if (i+1)%4 ==0:
            print(''.join(str(i) for i in house[i]))
        else:
            print('',' '.join(str(i) for i in house[i]))

Submission status: Runtime Error

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

for i in range(4):
	for j in range(3):
		for k in range(10):
			print(' ',end='')
			if k != 9:
				print(house[i][j][k],end='')
			else:
				print(house[i][j][k])
	if i<3
	print('####################')

Submission status: Runtime Error

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

for i in range(4):
	for j in range(3):
		for k in range(10):
			print(' ',end='')
			if k != 9:
				print(house[i][j][k],end='')
			else:
				print(house[i][j][k])
	if i<3:
		print('####################')

Submission status: Runtime Error

Solution code:
Residents = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for l in range(n):
    b ,f ,r ,v  = list(map(int,input().split())
    Residents[b-1][f-1][r-1] += v
for k in range(4):
    for j in range(3):
        print(' '+ ' '.join(map(str,Residents[k][j])))
    print('####################')

Submission status: Runtime Error

Solution code:
n = int(input())
apart = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for joho in range(n):
    x = [int(i) for i in input().split()]
    apart[x[2]][x[1]][x[0]] += x[3]

for tou in range(4):
    for stair in range(3):
        for room in range(10):
            print(" ",apart[tou][stair][room],sep="",end="")
        print("")
    if tou != 3:
        print("####################")

Submission status: Runtime Error

Solution code:
/* 1_6_C.c */
/* Last Change: 2018/05/09 (Wed) 20:53:53. */

#include<stdio.h>
/* #include<stdlib.h> */
/* #include<string.h> */
/* #include<limits.h> */
/* #include<math.h> */
/* #include<time.h> */

int main(void){
	/* blabla */
	int n,x[4][3][10];
	int a,b,c,d;
	int i,j,k;
	for(i=0;i<4;i++)
		for(j=0;j<3;j++)
			for(k=0;k<10;k++)
				x[i][j][k]=0;
	scanf(" %d",&n);
	for(i=0;i<n;i++){
		scanf(" %d %d %d %d",&a,&b,&c,&d);
		x[a-1][b-1][c-1]=d;
	}
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			for(k=0;k<10;k++)
				printf(" %d",x[i][j][k]);
			printf("\n");
		}
		printf("####################\n");
	}
	i=3;
		for(j=0;j<3;j++){
			for(k=0;k<10;k++)
				printf(" %d",x[i][j][k]);
			printf("\n");
		}
	return 0;
}

Submission status: Runtime Error

Solution code:
# Official House

n = int(input())
houses = 4
floors = 3
rooms = 10

official = [[[0 for k in range(rooms)] for j in range(floors)] for i in range(houses)]
print(official)

for a in range(n):
    info = [int(x) for x in input().rstrip().split()]
    b = info[0] - 1
    f = info[1] - 1
    r = info[2] - 1
    v = info[3]
    currentFloor = official[b][f]
    print(currentFloor)
    currentFloor[r] += v

print(official)

for i in range(houses):
    for j in range(floors):
        for k in range(rooms):
            print(' ' + official[i][j][k], end = '')
    if i < houses - 1:
        print('#' * 20)

Submission status: Runtime Error

Solution code:
import numpy as np
a = []
for i in range(4):
    a.append(np.zeros((3,10), dtype = int))
border = '#'*20
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    a[b-1][f-1][r-1] += v
    
for i in range(4):
    for k in a[i]:
        for l in k:
            print('{} '.format(l), end ='')
        print()
    if i != 3:
        print(border)

Submission status: Runtime Error

Solution code:
import numpy as np
a = []
for i in range(4):
    a.append(np.zeros((3,10), dtype = int))
border = '#'*20
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    a[b-1][f-1][r-1] += v
    
for i in range(4):
    for k in a[i]:
        c = 0
        for l in k:
            c += 1
            if c !=10:
                print('{} '.format(l), end ='')
            elif c == 10:
                print('{}'.format(l), end ='')
        print()
    if i != 3:
        print(border)

Submission status: Runtime Error

Solution code:
a = [[[0 for i in range(10)]for i in range(3)]for i in range(4)]
for i in range(4):
    a.append(np.zeros((3,10), dtype = int))
border = '#'*20
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    a[b-1][f-1][r-1] += v
    
for i in range(4):
    for k in a[i]:
        c = 0
        for l in k:
            c += 1
            if c !=10:
                print('{} '.format(l), end ='')
            elif c == 10:
                print('{}'.format(l), end ='')
        print()
    if i != 3:
        print(border)

Submission status: Runtime Error

Solution code:
a = [[[0 for i in range(10)]for i in range(3)]for i in range(4)]
for i in range(4):
    a.append(np.zeros((3,10), dtype = int))
border = '#'*20
n = int(input())
for i in range(n):
    b,f,r,v = map(int,input().split())
    a[b-1][f-1][r-1] += v
    
for i in range(4):
    for k in a[i]:
        for l in k:
                print(' {}'.format(l), end ='')
        print()
    if i != 3:
        print(border)

Submission status: Runtime Error

Solution code:
def main():
    k = [[[0 for x 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, raw_input().split())
        k[b-1][f-1][r-1] += v

    for b in range(4):
        for f in range(3):
            print(" ".join(map(str, k[b][f])))
        if b != 3:
            print("#"*20)

main()

Submission status: Runtime Error

Solution code:
import sys
import numpy as np

x = []
i = 0
for line in sys.stdin:
    if i==0:
        lx = int(line)
    else:
        x.append([int(i) for i in line.split()])
    i = 1

rooms = np.zeros((4,3,10), dtype = int)
for e in x:
    i,j,k,l = e
    rooms[i-1][j-1][k-1] += l

for i in range(4):
    for j in range(3):
        for k in range(10):
            print rooms[i][j][k],
        print
    if i<3: print '#' * 20

Submission status: Runtime Error

Solution code:
import sys

x = []
i = 0
for line in open('in1.txt','r'):#sys.stdin:
    if i==0:
        lx = int(line)
    else:
        x.append([int(i) for i in line.split()])
    i = 1

rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
for e in x:
    i,j,k,l = e
    rooms[i-1][j-1][k-1] += l

for i in rb:
    for j in rf:
        print ' ',
        for k in rr:
            print rooms[i][j][k],
        print
    if i<len(rb)-1: print '#' * 20

Submission status: Runtime Error

Solution code:
rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
while True:
    lx = int(raw_input())
    for i in range(lx):
        b,f,r,b = map(int, raw_input().split())
        rooms[i-1][j-1][k-1] += l

for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i < len(rb)-1:
        print '#' * 20

Submission status: Runtime Error

Solution code:
rb = range(4)
rf = range(3)
rr = range(10)
rooms = [[[0 for i in rr] for j in rf]for k in rb]
while True:
    lx = int(raw_input())
    for i in range(lx):
        b,f,r,v = map(int, raw_input().split())
        rooms[b-1][f-1][r-1] += v

for i in rb:
    for j in rf:
        print '',
        for k in rr:
            print rooms[i][j][k],
        print
    if i < len(rb)-1:
        print '#' * 20

Submission status: Runtime Error

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

n = int(input())
i = 0
while i < n:
    b, f, r, v = map(int, raw_input().split())
    bilding[b][f][r] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
        print floar
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())
    bilding[r][f][b] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[k][j][i])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

Solution code:


n = int(input())
i = 0
while i < n:
    b, f, r, v = map(int, raw_input().split())
    bilding[r][f][b] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[k][j][i])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())
    bilding[r][f][b] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())
    bilding[r-1][f-1][b-1] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[k][j][i])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())
    bilding[r-1][f-1][b-1] += v
    i += 1

Submission status: Runtime Error

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

n = int(input())
i = 0
while i < n:

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())

Submission status: Runtime Error

Solution code:
bilding = [[[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, raw_input().split())
    bilding[b-1][f-1][r-1] += v
    i += 1

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

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

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

for i in range(4):
    for j in range(3):
        print(" "+" ".join(str,bilding[i][j]))
    if i % 4 != 0:
        print "#"*20

Submission status: WA: Presentation Error

Solution code:
import sys


def main():
    n = int(sys.stdin.readline())
    notices = []
    for i in range(n):
        notices.append(tuple(map(int, sys.stdin.readline().split())))
    buildings = [[[0] * 10 for i in range(3)] for j in range(4)]
    for b, f, r, v in notices:
        buildings[b-1][f-1][r-1] += v
    separator = '####################'
    for index, building in enumerate(buildings):
        for floor in building:
            print(' '.join(map(str, floor)))
        if index != len(buildings)-1:
            print(separator)
    return


if __name__ == '__main__':
    main()

Submission status: WA: Presentation Error

Solution code:
bil_date = []
flag = 0
for i in range(4):
    bil_date.append([[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]])
all_date_amo = int(input())
for i in range(all_date_amo):
    date = [int(indate) for indate in input().split()]
    bil_date[date[0]-1][date[1]-1][date[2]-1] = date[3]
    
for bil in bil_date:
    for flo in bil:
        for room in flo:
            print(' {}'.format(room),end='')
        print('')
    if flag == 3:
        pass
    else:
        for i in range(20):
            print('#',end='')
    flag = flag + 1
    print('')

Submission status: WA: Presentation Error

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

n = int(input())

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

for i, d in enumerate(a):
    for c in d: print(*c)
    if i != len(a) - 1:
        print("#" * 20)

Submission status: WA: Presentation Error

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


def printstate(billdings):
    for billnum, billding in enumerate(billdings):
        for floor in billding:
            """
            for room in floor:
                print(room, " ", end="")
            print()
            """
            floor = list(map(str, floor))
            print(" ".join(floor))
        print("#"*20 if billnum != len(billdings)-1 else "")


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

printstate(billdings)

Submission status: WA: Presentation Error

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


def printstate(billdings):
    for billnum, billding in enumerate(billdings):
        for flooor in billding:
            flooor = list(map(str, flooor))
            print(" ".join(flooor))
        print("#"*20 if billnum != len(billdings)-1 else "")


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

printstate(billdings)

Submission status: WA: Presentation Error

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


def printstate(billdings):
    for billnum, billding in enumerate(billdings):
        for flooor in billding:
            for room in flooor:
                print(" {}".format(room), end="")
            print()
        print("#"*20 if billnum != len(billdings)-1 else "")


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

printstate(billdings)

Submission status: WA: Presentation Error

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


def printstate(billdings):
    """
    for billnum, billding in enumerate(billdings):
        for flooor in billding:
            for room in flooor:
                print(" {}".format(room), end="")
            print()
        print("#"*20 if billnum != len(billdings)-1 else "")
    """
    for i in range(len(billdings)):
        for j in range(len(billdings[0])):
            for k in range(len(billdings[0][0])):
                print(" "+str(billdings[i][j][k]), end="")
            print()
        print("#"*20) if i != len(billdings)-1 else print()


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

printstate(billdings)

Submission status: WA: Presentation Error

Solution code:
_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_3=[]
_4_1=[]
_4_2=[]
_4_3=[]
for i in range(10):
    _1_1.append(0)
    _1_2.append(0)
    _1_3.append(0)
    _2_1.append(0)
    _2_2.append(0)
    _2_3.append(0)
    _3_1.append(0)
    _3_2.append(0)
    _3_3.append(0)
    _4_1.append(0)
    _4_2.append(0)
    _4_3.append(0)
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in s:
    bfrv.append(i.split())
for i in bfrv:
    if int(i[0])==1 and int(i[1])==1:
        _1_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==3:
        _4_3[int(i[2])-1]+=int(i[3])
print(*_1_1)
print(*_1_2)
print(*_1_3)
print("#"*20)
print(*_2_1)
print(*_2_2)
print(*_2_3)
print("#"*20)
print(*_3_1)
print(*_3_2)
print(*_3_3)
print("#"*20)
print(*_4_1)
print(*_4_2)
print(*_4_3)

Submission status: WA: Presentation Error

Solution code:
_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_3=[]
_4_1=[]
_4_2=[]
_4_3=[]
for i in range(10):
    _1_1.append(0)
    _1_2.append(0)
    _1_3.append(0)
    _2_1.append(0)
    _2_2.append(0)
    _2_3.append(0)
    _3_1.append(0)
    _3_2.append(0)
    _3_3.append(0)
    _4_1.append(0)
    _4_2.append(0)
    _4_3.append(0)
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in s:
    bfrv.append(i.split())
for i in bfrv:
    if int(i[0])==1 and int(i[1])==1:
        _1_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    elif int(i[0])==4 and int(i[1])==3:
        _4_3[int(i[2])-1]+=int(i[3])
print(" ".join(map(str, _1_1)))
print(" ".join(map(str, _1_2)))
print(" ".join(map(str, _1_3)))
print("#"*20)
print(" ".join(map(str, _2_1)))
print(" ".join(map(str, _2_2)))
print(" ".join(map(str, _2_3)))
print("#"*20)
print(" ".join(map(str, _3_1)))
print(" ".join(map(str, _3_2)))
print(" ".join(map(str, _3_3)))
print("#"*20)
print(" ".join(map(str, _4_1)))
print(" ".join(map(str, _4_2)))
print(" ".join(map(str, _4_3)))

Submission status: WA: Presentation Error

Solution code:
_, *lines = open(0).readlines()
H = [[[0]*10 for i in range(3)] for j in range(4)]
for line in lines:
    b, f, r, v = map(int, line.split())
    H[b-1][f-1][r-1] += v
for i, h in enumerate(H):
    if i:
        print("#"*20)
    for r in h:
        print(*r)

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
from sys import stdin

rooms = [[[0] * 10 for _ in range(3)] for _ in range(4)]
stdin.readline().rstrip()
while True:
    try:
        b, f, r, v = [int(x) for x in stdin.readline().rstrip().split()]
        rooms[b-1][f-1][r-1] += v
    except:
        break

for b in range(4):
    for f in range(3):
        print(*rooms[b][f])
    else:
        if b != 3:
            print("#"*20)

Submission status: WA: Presentation Error

Solution code:
residents = [[[0] * 11 for i in range(4)] for j in range(5)]
N = int(input())
for _i in range(N):
    b, f, r, v = map(int, input().split())
    residents[b][f][r] += v
for i in range(1, 5):
    for j in range(1, 4):
        print(' '.join(map(str, residents[i][j][1:])))
    if not i == 4:
        print(''.join(['#'] * 20))

Submission status: WA: Presentation Error

Solution code:
residents = [[[0] * 11 for i in range(4)] for j in range(5)]
N = int(input())
for _i in range(N):
    b, f, r, v = map(int, input().split())
    residents[b][f][r] += v
for i in range(1, 5):
    for j in range(1, 4):
        print(' '.join(map(str, residents[i][j][1:])))
    if not i == 4:
        print(''.join(['#'] * 20))
print()

Submission status: WA: Presentation Error

Solution code:
residents = [[[0] * 11 for i in range(4)] for j in range(5)]
N = int(input())
for _i in range(N):
    b, f, r, v = map(int, input().split())
    residents[b][f][r] += v
for i in range(1, 5):
    for j in range(1, 4):
        print(' ' + ' '.join(map(str, residents[i][j][1:])))
    if not i == 4:
        print(''.join(['#'] * 20))
print()

Submission status: WA: Presentation Error

Solution code:
A = []
for _ in range(12):
        A.append([0]*10)

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

for i in range(12):
        print(' '.join(map(str, A[i])))
        if i in [2, 5, 8]:
                print('#'*20)

Submission status: WA: Presentation Error

Solution code:
n=int(input())
lst=[[[0]*10 for i in range(0,3)] for j in range(0,4)]
for k in range(n):
    b,f,r,v = map(int,input().split())
    lst[b-1][f-1][r-1] +=v
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((lst[i][a][b]),end="")
        print()

Submission status: WA: Presentation Error

Solution code:
n = int(input())
li = ["#"*20 if i%4==0 else "0"*10 for i in range(1, 16)]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    h = 4*b-(4-f)-1
    v = v if v > 0 else v == 0
    if v > 0:
        li[h] = li[h].replace(li[h], ''.join([str(v) if i == r-1 else list(li[h])[i] for i in range(10)]))
print('\n'.join(li))

Submission status: WA: Presentation Error

Solution code:
n = int(input())
li = ["#"*20 if i%4==0 else "0"*10 for i in range(1, 16)]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    h = 4*b-(4-f)-1
    v = v if v > 0 else v == 0
    if v > 0:
        li[h] = li[h].replace(li[h], ''.join([str(v) if i == r-1 else list(li[h])[i] for i in range(10)]))
li = [' '.join(li[i]) if (i+1)%4!=0 else li[i] for i in range(len(li))]
print('\n'.join(li))

Submission status: WA: Presentation Error

Solution code:
n = int(input())
li = ["#"*20 if i%4==0 else "0"*10 for i in range(1, 16)]
for _ in range(n):
    b, f, r, v = map(int, input().split())
    h = 4*b-(4-f)-1
    v = v if v > 0 else v == 0
    li[h] = li[h].replace(li[h], ''.join([str(v) if i == r-1 else list(li[h])[i] for i in range(10)]))
li = [' '.join(li[i]) if (i+1)%4!=0 else li[i] for i in range(len(li))]
print('\n'.join(li))

Submission status: WA: Presentation Error

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

for i in range(int(input())):
	n=list(map(int,input().split()))
	room[n[0]-1][n[1]-1][n[2]-1]=n[3]
n=0
for i in room:
	for j in i:
		print(' '.join(list(map(str,j))))
		if n==2 or n==5or n==8:
			print('####################')
		n+=1

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
num = {
    1:{1:[0]*10,2:[0]*10,3:[0]*10},
    2:{1:[0]*10,2:[0]*10,3:[0]*10},
    3:{1:[0]*10,2:[0]*10,3:[0]*10},
    4:{1:[0]*10,2:[0]*10,3:[0]*10}
}

n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    num[b][f][r-1] += v
for b in num:
    for f in num[b]:
        for r in num[b][f]:
            print(r, end=' ')
        print()
    if b==4: break
    print('#'*20)

Submission status: WA: Presentation Error

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

for i in range(4):
    for j in range(3):
        print(*tou[i][j])
    if i!=3: print('#'*20)

Submission status: WA: Presentation Error

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

for i in range(4):
    for j in range(3):
        print(*tou[i][j])
    if i!=3: print('#'*20)
print()

Submission status: WA: Presentation Error

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

for i in range(4):
    for j in range(3):
        print(*tou[i][j])
    if i!=3: print('#'*20)
print()

Submission status: WA: Presentation Error

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

Submission status: WA: Presentation Error

Solution code:
table = [0] * 4*3*10

n = int(input())

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

for i in range(120):
    if i != 0 and i % 30 == 0:
        print("####################")
    print(table[i], end="")
    if i%10 == 9:
        print()
    else:
        print(" ", end="")