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: Wrong Answer

Solution code:
import sys

def main():
    lines = sys.stdin.readlines()

    # The number of rooms
    rooms = [0] * 10
    floors = [rooms] * 3
    buildings = [floors] * 4

    data_num = 0

    for index, line in enumerate(lines):
        #print(line)
        # rm '\n' from string of a line
        line = line.strip('\n')
        elems = line.split(" ")
        if index == 0:
            data_num = int(elems[0])
        else:
            b = int(elems[0]) - 1   # as index
            f = int(elems[1]) - 1   # as index
            r = int(elems[2]) - 1   # as index
            v = int(elems[3])       # as data
            # print v
            print buildings[b][f][r]
            ans = []
            for b_i in range(0, 4):
                b_list = []
                for f_i in range(0, 3):
                    f_list = []
                    for r_i in range(0, 10):
                        if b == b_i and f == f_i and r == r_i:
                            f_list.append(buildings[b_i][f_i][r_i] + v)
                        else:
                            # print buildings[b][f][r]
                            f_list.append(buildings[b_i][f_i][r_i])
                    b_list.append(f_list)
                ans.append(b_list)
            # print ans
            buildings = ans
            # [buildings[b][f][r]+=v if ]
            # buildings[b][f][r] = 2
            # print buildings

    for b_i in range(0, 4):
        for f_i in range(0, 3):
            for r_i in range(0, 10):
                sys.stdout.write(' %d' % buildings[b_i][f_i][r_i])
            sys.stdout.write('\n')
        if b_i != b:
            print "####################"



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    lines = sys.stdin.readlines()

    # The number of rooms
    rooms = [0] * 10
    floors = [rooms] * 3
    buildings = [floors] * 4

    data_num = 0

    for index, line in enumerate(lines):
        #print(line)
        # rm '\n' from string of a line
        line = line.strip('\n')
        elems = line.split(" ")
        if index == 0:
            data_num = int(elems[0])
        else:
            b = int(elems[0]) - 1   # as index
            f = int(elems[1]) - 1   # as index
            r = int(elems[2]) - 1   # as index
            v = int(elems[3])       # as data
            # print v
            # print buildings[b][f][r]
            ans = []
            for b_i in range(0, 4):
                b_list = []
                for f_i in range(0, 3):
                    f_list = []
                    for r_i in range(0, 10):
                        if b == b_i and f == f_i and r == r_i:
                            f_list.append(buildings[b_i][f_i][r_i] + v)
                        else:
                            f_list.append(buildings[b_i][f_i][r_i])
                    b_list.append(f_list)
                ans.append(b_list)
            # print ans
            buildings = ans

    for b_i in range(0, 4):
        for f_i in range(0, 3):
            for r_i in range(0, 10):
                sys.stdout.write(' %d' % buildings[b_i][f_i][r_i])
            sys.stdout.write('\n')
        if b_i != b:
            print "####################"



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

import fileinput
import math

def main():
    offiHouse = [[[0 for i3 in range(10)] for i2 in range(3)] for i1 in range(4)]   #y, x, z

    n = int(input())

    for i in range(n):
        a, b, c, d = map(int, input().split())

        offiHouse[a-1][b-1][c-1] += d

    for i in range(4):
        for j in range(3):
            for k in range(10):
                if(k == 9):
                    print('%d' % offiHouse[i][j][k])
                else:
                    print('%d ' % offiHouse[i][j][k], end='')

        print('####################')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
l = [
    [
        [
            0 for ___ in range(9)
        ] for __ in range(3)
    ] for _ in range(4)
]
for _ in range(int(input())):
    b,f,r,w = [int(i) for i in input().split()]
    l[b-1][f-1][r-1] += w

for a in l:
    for b in a:
        for c in b:
            print(c, end=' ')
        print()
    print('####################')

Submission status: Wrong Answer

Solution code:
l = [
    [
        [
            0 for ___ in range(9)
        ] for __ in range(3)
    ] for _ in range(4)
]

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

for a in l:
    for b in a:
        for i,c in enumerate(b):
            if i != 8:
                print(c, end=' ')
            else:
                print(c)
    print('####################')

Submission status: Wrong Answer

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

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

for a in l:
    for b in a:
        for i,c in enumerate(b):
            if i != 8:
                print(c, end=' ')
            else:
                print(c)
    print('####################')

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []
for i in range(n):
    a.append(list(map(int, input().split())))

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

for i in range(n):
    b[a[i][0] - 1][a[i][1] - 1][a[i][2] - 1] = a[i][3]

for i in range(4):
    for j in range(3):
        b[i][j].insert(0, "")
        print(*b[i][j])
    print("####################")

Submission status: Wrong Answer

Solution code:
n = int(input())

a = []
for i in range(n):
    a.append(list(map(int, input().split())))

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

for i in range(n):
    b[a[i][0] - 1][a[i][1] - 1][a[i][2] - 1] = a[i][3]

for i in range(4):
    for j in range(3):
        b[i][j].insert(0, "")
        print(*b[i][j])
    print("####################")
print()

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
n = input()
array = []
for i in range(n):
    array.append(map(int, raw_input().split()))
for i in range(4):
    for j in range(3):
        for k in range(10):
            sys.stdout.write(' ')
            if(i == array[j][0] - 1 and k == array[j][2] - 1):
                print array[j][3],
            else:
                print 0,
        else:
            print
    else:
        if(i != 3):
            print "####################"

Submission status: Wrong Answer

Solution code:
# coding:utf-8
import sys
n = input()
array = []
for i in range(n):
    array.append(map(int, raw_input().split()))
array.sort()
result = [[0 for i in range(4)] for j in range(n)]
index = 0
for i in range(n):
    if result[index][0] == 0:
        result[index] = array[i][0:4]
    elif result[index][0:3] == array[i][0:3]:
        result[index][3] += array[i][3]
    else:
        index += 1
index = 0
for i in range(4):
    for j in range(3):
        for k in range(10):
            sys.stdout.write(' ')
            if(i == result[index][0] - 1 and k == result[index][2] - 1):
                print result[index][3],
                if index != len(result) - 1:
                    index += 1
            else:
                print 0,
        else:
            print
    else:
        if(i != 3):
            print "####################"

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
m = defaultdict(int)
n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    m[(b, f, r)] += v
for b in range(1, 5):
    for f in range(1, 4):
        for r in range(1, 11):
            print("", m[(b, f, r)], end="")
        print("")
    print("####################")

Submission status: Wrong Answer

Solution code:
from __future__ import print_function
n = int(raw_input())
bilding1 = [[" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"]
           ]
bilding2 = [[" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#35~44
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#46~55
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"]
           ]
bilding3 = [[" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#69~78
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#80~89
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"]
           ]
bilding4 = [[" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#103~112
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"],#114~123
           [" 0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0 ","0"]
           ]
bilding = []
bilding.append(bilding1)
bilding.append(bilding2)
bilding.append(bilding3)
bilding.append(bilding4)

for i in range(0,n):
    inf = raw_input()
    inf= inf.split(" ")
    b = int(inf[0]) -1
    f = int(inf[1]) -1
    r = int(inf[2]) -1
    v = str(inf[3])+" "
    bilding[b][f][r] = v
count = 0
for j in range(0,4):
    for k in range(0,3):
        for l in range(0,10):
            print((bilding[j][k][l]),end="")
        print("")
    if(count < 3):
        print("####################")
        count += 1

Submission status: Wrong Answer

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

n = int(input())

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

for i in range(1,13):
    for y in range(10):
        if y==9:
            print(a[i-1][y],end='')
        else:
            print(a[i-1][y],end='')
            print(" ",end='')
    print()
    if i != 12 and i%3==0:
        print ("#"*20)

Submission status: Wrong Answer

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

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

for b in range(4):
    for f in range(3):
        out = ""
        for r in range(10):
            out += " " + str(l[b][f][r])
        print(out)
    if 3 != b:
        print("####################")

Submission status: Wrong Answer

Solution code:
n = int(input())
info = []
for _ in range(n):
    temp = [int(x) for x in input().split( )]
    info.append(temp)
state = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for a in info:
    state[a[0]-1][a[1]-1][a[2]-1] += a[3]
for b in range(4):
    for f in range(3):
        string = ''
        for k in range(10):
            string += ' '+str(state[b][f][k])
        print(string)
    print('#'*20)

Submission status: Wrong Answer

Solution code:
n = int(input())
info = []
for _ in range(n):
    temp = [int(x) for x in input().split( )]
    info.append(temp)
state = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for a in info:
    state[a[0]-1][a[1]-1][a[2]-1] += a[3]
for b in range(4):
    for f in range(3):
        string = ''
        for k in range(10):
            string += str(state[b][f][k])+' '
        print(string)
    print('#'*20)

Submission status: Wrong Answer

Solution code:
n = int(input())
buffer = []
i = 0
while i<n:
    b,f,r,v = map(int,input().split())
    buffer.append([b,f,r,v])
    i = i + 1

room = []
for h in range(15):
    if h == 3 or h == 7 or h == 11:
        room.append(['**']*10)
    else:
        room.append([0]*10)
            
for y in range(n):
    if buffer[y][0] == 1:
        room[buffer[y][1]-1][buffer[y][2]-1] = buffer[y][3] + room[buffer[y][1]-1][buffer[y][2]-1]
    elif buffer[y][0] == 2:
        room[buffer[y][1]-1+4][buffer[y][2]-1] = buffer[y][3] + room[buffer[y][1]-1+4][buffer[y][2]-1]
    elif buffer[y][0] == 3:
        room[buffer[y][1]-1+8][buffer[y][2]-1] = buffer[y][3] + room[buffer[y][1]-1+8][buffer[y][2]-1]
    elif buffer[y][0] == 4:
        room[buffer[y][1]-1+12][buffer[y][2]-1] = buffer[y][3] + room[buffer[y][1]-1+12][buffer[y][2]-1]
        
for x in range(15):
    if x == 3 or x == 7 or x == 11:
        print("********************")
    else:
        for y in range(10):
            print(" "+str(room[x][y]), end = "")   
        print()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8

n = int(input())

x = [[[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 = (int(j) for j in input().split())
    x[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" " + str(x[i][j][k]), end = '' if k != 9 else '\n')

    print("#"*20 if i != 3 else '' ,end='')

Submission status: Wrong Answer

Solution code:
N = int(input())
n = [ map(int, input().split()) for i in range(N) ]
kousya = [ [[0]*10 for i in range(3)] for j in range(4) ]
for b, f, r, v in n:
    kousya[b-1][f-1][r-1] = v
for i in range(4):
    for j in range(3):
        print('', *kousya[i][j])
    else:
        if i == 3: break
        print('#' * 20)

Submission status: Wrong Answer

Solution code:
# リスト内包表記
a = [[0 for i in range(10)] for k in range(3 * 4)]
for i in range(int(input())):
    b, f, r, v = map(int, input().split())
    a[(b-1)*3 + (f-1)][r-1] = v
for idx, i in enumerate(a):
    if idx % 3 == 0 and idx != 0:
        for k in range(20):
            print("#", end = "")
        print("")
    print(" ", end = "")
    print(" ".join(map(str, i)))

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]


for j in range(4):
    for n in range(3):
        for m in range(10):
            print(nyukyo[j][n][m], end=' ')
        print()
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]


for j in range(4):
    for n in range(3):
        for m in range(10):
            print(nyukyo[j][n][m], end=' ')
        print()
    print('#' * 20)

print()

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]


for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print()
    print('#' * 20)

print()

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]


for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print()
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]
    if nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] < 0:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 0
    elif nyukyo[value[0]-1][value[1]-1][value[2]-1] > 9:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 9

for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print()
    print('#' * 20)

print()

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]
    if nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] < 0:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 0
    elif nyukyo[value[0]-1][value[1]-1][value[2]-1] > 9:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 9

for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print()
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]
    if nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] < 0:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 0
    elif nyukyo[value[0]-1][value[1]-1][value[2]-1] > 9:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 9

for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print(' ')
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]
    if nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] < 0:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 0
    elif nyukyo[value[0]-1][value[1]-1][value[2]-1] > 9:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 9

for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print(' ')
    print('#' * 20)
print()

Submission status: Wrong Answer

Solution code:
import sys

n = int(sys.stdin.readline())
values =[ [ int(val) for val in num[:-1].split() ] for num in sys.stdin.readlines() ]

nyukyo =[ [ [ 0 for _ in range(10) ] for _ in range(3) ] for _ in range(4) ]

for value in values:
    nyukyo[value[0]-1][value[1]-1][value[2]-1] = value[3]
    if nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] < 0:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 0
    elif nyukyo[value[0]-1][value[1]-1][value[2]-1] > 9:
        nyukyo[value[0] - 1][value[1] - 1][value[2] - 1] = 9

for j in range(4):
    for n in range(3):
        for m in range(10):
            print( ' ' + str(nyukyo[j][n][m]), end='')
        print('')
    if j < 3:
        print('#' * 20)

Submission status: Wrong Answer

Solution code:
n=int(input())
build,story,room,people=[],[],[],[]
for i in range(n):
    date=list(map(int,input().split(' ')))
    build.append(date[0])
    story.append(date[1])
    room.append(date[2])
    people.append(date[3])
build1=[[0 for i in range(10)] for j in range(3)]
build2=[[0 for i in range(10)] for j in range(3)]
build3=[[0 for i in range(10)] for j in range(3)]
build4=[[0 for i in range(10)] for j in range(3)]
print(build)
for i in range(n):
    m=int(i)
    if(build[m]==1):
        build1[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==2):
        build2[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==3):
        build3[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==4):
        build4[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]

for i in range(3):
    print( ' '.join(list(map( lambda x: str(x),build1[i]))) )
print('#'*20)
for i in range(3):
    print( ' '.join(list(map( lambda x: str(x),build2[i]))) )
print('#'*20)
for i in range(3):
    print( ' '.join(list(map( lambda x: str(x),build3[i]))) )
print('#'*20)
for i in range(3):
    print( ' '.join(list(map( lambda x: str(x),build4[i]))) )

Submission status: Wrong Answer

Solution code:
n=int(input())
build,story,room,people=[],[],[],[]
for i in range(n):
    date=list(map(int,input().split(' ')))
    build.append(date[0])
    story.append(date[1])
    room.append(date[2])
    people.append(date[3])
build1=[[0 for i in range(10)] for j in range(3)]
build2=[[0 for i in range(10)] for j in range(3)]
build3=[[0 for i in range(10)] for j in range(3)]
build4=[[0 for i in range(10)] for j in range(3)]

for i in range(n):
    m=int(i)
    if(build[m]==1):
        build1[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==2):
        build2[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==3):
        build3[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    if(build[m]==4):
        build4[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]

for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build1[i]))))
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build2[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build3[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build4[i]))) )

Submission status: Wrong Answer

Solution code:
n=int(input())
build,story,room,people=[],[],[],[]
for i in range(n):
    date=list(map(int,input().split(' ')))
    build.append(date[0])
    story.append(date[1])
    room.append(date[2])
    people.append(date[3])
build1=[[0 for i in range(10)] for j in range(3)]
build2=[[0 for i in range(10)] for j in range(3)]
build3=[[0 for i in range(10)] for j in range(3)]
build4=[[0 for i in range(10)] for j in range(3)]
print(build)
print(story)
print(room)
print(people)
for i in range(n):
    m=int(i)
    if(build[m]==1):
        build1[story[m]-1][room[m]-1]=build1[story[m]-1][room[m]-1]+people[m]
    elif(build[m]==2):
        build2[story[m]-1][room[m]-1]=build2[story[m]-1][room[m]-1]+people[m]
    elif(build[m]==3):
        build3[story[m]-1][room[m]-1]=build3[story[m]-1][room[m]-1]+people[m]
    else:
        build4[story[m]-1][room[m]-1]=build4[story[m]-1][room[m]-1]+people[m]

for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build1[i]))))
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build2[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build3[i]))) )
print('#'*20)
for i in range(3):
    print(' '+' '.join(list(map( lambda x: str(x),build4[i]))) )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [[[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())
  l[b - 1][f - 1][r - 1] += v
for b in range(4):
  for f in range(3):
    for r in range(10):
      print(" %d" % l[b][f][r], end = "")
    print("")
  print("#" * 20)

Submission status: Wrong Answer

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: Wrong Answer

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

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

sep = "#"*20

for i in range(4):
  for j in range(3):
    print(" {0} {1} {2} {3} {4} {5} {6} {7} {8} {9}".format(room[i][j][0],room[i][j][1],room[i][j][2],room[i][j][3],room[i][j][4],room[i][j][5],room[i][j][6],room[i][j][7],room[i][j][8],room[i][j][9]))
  if j != 3:
    print(sep)

Submission status: Wrong Answer

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

a = {}
b = {}
c = {}
d = {}

for i in range(1, 30):
    a[i] = 0
    b[i] = 0
    c[i] = 0
    d[i] = 0

n = int(input())

for j in range(n):
    m = list(map(int, input().split()))

    if m[0] == 1:
        a[m[2] + 10 * (m[1] - 1)] = a[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 2:
        b[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 3:
        c[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 4:
        d[m[2] + 10 * (m[1] - 1)] = d[m[2] + 10 * (m[1] - 1)] + m[3]

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(a[i * j]), end='')

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(b[i * j]), end='')

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(c[i * j]), end='')

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(d[i * j]), end='')

Submission status: Wrong Answer

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

a = {}
b = {}
c = {}
d = {}

for i in range(1, 30):
    a[i] = 0
    b[i] = 0
    c[i] = 0
    d[i] = 0

n = int(input())

for j in range(n):
    m = list(map(int, input().split()))

    if m[0] == 1:
        a[m[2] + 10 * (m[1] - 1)] = a[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 2:
        b[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 3:
        c[m[2] + 10 * (m[1] - 1)] = b[m[2] + 10 * (m[1] - 1)] + m[3]

    elif m[0] == 4:
        d[m[2] + 10 * (m[1] - 1)] = d[m[2] + 10 * (m[1] - 1)] + m[3]

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(a[i * j]), end='')
    print()

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(b[i * j]), end='')
    print()

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(c[i * j]), end='')
    print()

print('####################')

for i in range(1, 3):
    for j in range(1, 10):
        print(' {0}'.format(d[i * j]), end='')
    print()