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:
#coding: UTF-8

n = input()

a = 0
aa = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ab = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ac = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ba = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bb = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ca = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
cb = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
cc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
da = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
db = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
dc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

while a < n:
	l = map(int, raw_input().split())
	b = l[0]
	f = l[1]
	r = l[2]
	v = l[3]
	a += 1
	if b == 1 and f == 1:
		x = aa[r-1]
		y = x + v
		aa[r-1] = y
	if b == 1 and f == 2:
		x = ab[r-1]
		y = x + v
		ab[r-1] = y
	if b == 1 and f == 3:
		x = ac[r-1]
		y = x + v
		ac[r-1] = y
	if b == 2 and f == 1:
		x = ba[r-1]
		y = x + v
		ba[r-1] = y
	if b == 2 and f == 2:
		x = bb[r-1]
		y = x + v
		bb[r-1] = y
	if b == 2 and f == 3:
		x = bc[r-1]
		y = x + v
		bc[r-1] = y
	if b == 3 and f == 1:
		x = ca[r-1]
		y = x + y
		ca[r-1] = y
	if b == 3 and f == 2:
		x = cb[r-1]
		y = x + v
		cb[r-1] = y
	if b == 3 and f == 3:
		x = cc[r-1]
		y = x + v
		cc[r-1] = y
	if b == 3 and f == 1:
		x = da[r-1]
		y = x + y
		da[r-1] = y
	if b == 3 and f == 2:
		x = db[r-1]
		y = x + v
		db[r-1] = y
	if b == 3 and f == 3:
		x = dc[r-1]
		y = x + v
		dc[r-1] = y
print " ",
for aaa in aa:
	print aaa,
print "\n ",
for aba in ab:
	print aba,
print "\n ",
for aca in ac:
	print aca,
print "\n",
print "####################"
print " ",
for baa in ba:
	print baa,
print "\n ",
for bba in bb:
	print bba,
print "\n ",
for bca in bc:
	print bca,
print "\n",
print "####################"
print " ",
for caa in ca:
	print caa,
print "\n ",
for cba in cb:
	print cba,
print "\n ",
for cca in cc:
	print cca,
print "\n",
print "####################"
print " ",
for daa in da:
	print daa,
print "\n ",
for dba in db:
	print dba,
print "\n ",
for dca in dc:
	print dca,







#print "%d %d %d" %(f, s, t)

Submission status: Wrong Answer

Solution code:
#coding: UTF-8

n = input()

a = 0
aa = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ab = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ac = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ba = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bb = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
bc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
ca = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
cb = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
cc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
da = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
db = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
dc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

while a < n:
	l = map(int, raw_input().split())
	b = l[0]
	f = l[1]
	r = l[2]
	v = l[3]
	a += 1
	if b == 1 and f == 1:
		x = aa[r-1]
		y = x + v
		aa[r-1] = y
	if b == 1 and f == 2:
		x = ab[r-1]
		y = x + v
		ab[r-1] = y
	if b == 1 and f == 3:
		x = ac[r-1]
		y = x + v
		ac[r-1] = y
	if b == 2 and f == 1:
		x = ba[r-1]
		y = x + v
		ba[r-1] = y
	if b == 2 and f == 2:
		x = bb[r-1]
		y = x + v
		bb[r-1] = y
	if b == 2 and f == 3:
		x = bc[r-1]
		y = x + v
		bc[r-1] = y
	if b == 3 and f == 1:
		x = ca[r-1]
		y = x + y
		ca[r-1] = y
	if b == 3 and f == 2:
		x = cb[r-1]
		y = x + v
		cb[r-1] = y
	if b == 3 and f == 3:
		x = cc[r-1]
		y = x + v
		cc[r-1] = y
	if b == 4 and f == 1:
		x = da[r-1]
		y = x + y
		da[r-1] = y
	if b == 4 and f == 2:
		x = db[r-1]
		y = x + v
		db[r-1] = y
	if b == 4 and f == 3:
		x = dc[r-1]
		y = x + v
		dc[r-1] = y
print " " + str(aa[0]),
aaa = 1
while aaa < 10:
	print str(aa[aaa]),
	aaa += 1
print "\n " + str(ab[0]),
aba = 1
while aba < 10:
	print str(ab[aba]),
	aba += 1
print "\n " + str(ac[0]),
aca = 1
while aca < 10:
	print str(ac[aca]),
	aca += 1

print "\n",
print "####################"
print " " + str(ba[0]),
baa = 1
while baa < 10:
	print str(ba[baa]),
	baa += 1
print "\n " + str(bb[0]),
bba = 1
while bba < 10:
	print str(bb[bba]),
	bba += 1
print "\n " + str(bc[0]),
bca = 1
while bca < 10:
	print str(bc[bca]),
	bca += 1
print "\n",
print "####################"

print " " + str(ca[0]),
caa = 1
while caa < 10:
	print str(ca[caa]),
	caa += 1
print "\n " + str(cb[0]),
cba = 1
while cba < 10:
	print str(cb[cba]),
	cba += 1
print "\n " + str(cc[0]),
cca = 1
while cca < 10:
	print str(cc[cca]),
	cca += 1
print "\n",
print "####################"
print " " + str(da[0]),
daa = 1
while daa < 10:
	print str(da[daa]),
	daa += 1
print "\n " + str(db[0]),
dba = 1
while dba < 10:
	print str(db[dba]),
	dba += 1
print "\n " + str(dc[0]),
dca = 1
while dca < 10:
	print str(dc[dca]),
	dca += 1

print "\n",
print "####################"



#print "%d %d %d" %(f, s, t)

Submission status: Wrong Answer

Solution code:
n = int(input())

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#'0'??§?????????''????????\
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		print(' '.join(A[i][j]))
	print('####################')

Submission status: Wrong Answer

Solution code:
n = int(input())

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#'0'??§?????????''????????\
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		print(' '.join(A[i][j]))
	print('####################')
print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		print(' '.join(A[i][j]))
	print('####################')
print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		print(' '.join(A[i][j]))
	print('####################')

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		sys.stdout.write(' '.join(A[i][j]))
		sys.stdout.write(' ')
		print()
	print('####################')
print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		sys.stdout.write(' '.join(A[i][j]))
		#sys.stdout.write(' ')
		print()
	print('####################')
print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		sys.stdout.write(' '.join(A[i][j]))
		sys.stdout.write(' ')
		print()
	print('####################')
#print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		sys.stdout.write(' '.join(A[i][j]))
		#sys.stdout.write(' ')
		print()
	print('####################')
#print()

Submission status: Wrong Answer

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

A=[[['0' for _ in range(10)] for _ in range(3)] for _ in range(4)]
#0??§?????????
#[[[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],  
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]],
# [[0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0],
#  [0 0 0 0 0 0 0 0 0 0]]]

#?£?    Building = b
#???    Floor    = f
#???    Room     = r
#??°    Number   = num
for i in range(n):
	b,f,r,num = input().strip().split()
	A[int(b)-1][int(f)-1][int(r)-1]=num

for i in range(4):
	for j in range(3):
		sys.stdout.write(' ')
		sys.stdout.write(' '.join(A[i][j]))
		print()
	if i!=3:
		print('#'*20)

Submission status: Wrong Answer

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

n = input()

for i in xrange(n):
    b,f,r,v=map(int,raw_input().split())
    house_info[b-1][f-1][r-1] = v
    
for i in xrange(4):
    for j in xrange(3):
        result = " ".join(map(str,house_info[i][j]))
        print result
    print "####################"

Submission status: Wrong Answer

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

n = input()

for i in xrange(n):
    b,f,r,v=map(int,raw_input().split())
    house_info[b-1][f-1][r-1] = v
    
for i in xrange(4):
    for j in xrange(3):
        result = " " + " ".join(map(str,house_info[i][j]))
        print result
    if i < 3:
        print "####################"

Submission status: Wrong Answer

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

dic = {}
bui = [k for k in range(1, 5)]
flo = [k for k in range(1, 4)]
roo = [k for k in range(1, 11)]

for b in bui:
    for f in flo:
        for r in roo:
            dic[(b, f, r)] = 0

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

for b in bui:
    for f in flo:
        for r in roo:
            buf = " "+ str(dic[(b, f, r)])
        print buf
    if b < 4:
        print "#"*20

Submission status: Wrong Answer

Solution code:
import sys
n = input()
mine = [[0]*10 for i in range(3)]
#ie = [mine*4]
ie = []

for i in range(4):
    ie.append(mine)
for x in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    ie[b-1][f-1][r-1] = v
for x in xrange(4):
    for y in xrange(3):
        for z in xrange(10):
            #print '%d' % ie[x][y][z],
            sys.stdout.write(' ' + str(ie[x][y][z]))
        print ''
    print '####################'

Submission status: Wrong Answer

Solution code:
import sys
n = input()
#mine = [[0]*10 for i in range(3)]
#ie = [mine*4]
ie = []
for x in xrange(4):
    ie.append([])
    for y in xrange(3):
        ie[x].append([])
        for z in xrange(10):
            ie[x][y].append([])
            ie[x][y][z] = 0
for x in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    ie[b-1][f-1][r-1] = v
for x in xrange(4):
    for y in xrange(3):
        for z in xrange(10):
            sys.stdout.write(' ' + str(ie[x][y][z]))
        print ''
    print '####################'

Submission status: Wrong Answer

Solution code:
import sys
n = input()
#mine = [[0]*10 for i in range(3)]
#ie = [mine*4]
ie = []
for x in xrange(4):
    ie.append([])
    for y in xrange(3):
        ie[x].append([])
        for z in xrange(10):
            ie[x][y].append([])
            ie[x][y][z] = 0
for x in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    ie[b-1][f-1][r-1] = v
for x in xrange(4):
    for y in xrange(3):
        for z in xrange(10):
            sys.stdout.write(' ' + str(ie[x][y][z]))
        print ''
    sys.stdout.write('####################\n')

Submission status: Wrong Answer

Solution code:
import sys
n = input()
#mine = [[0]*10 for i in range(3)]
#ie = [mine*4]
ie = []
for x in xrange(4):
    ie.append([])
    for y in xrange(3):
        ie[x].append([])
        for z in xrange(10):
            ie[x][y].append([])
            ie[x][y][z] = 0

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

for x in xrange(4):
    for y in xrange(3):
        for z in xrange(10):
            sys.stdout.write(' ' + str(ie[x][y][z]))
        print ''
    sys.stdout.write('####################\n')

Submission status: Wrong Answer

Solution code:
import sys
n = input()
#mine = [[0]*10 for i in range(3)]
#ie = [mine*4]
ie = []
for x in xrange(4):
    ie.append([])
    for y in xrange(3):
        ie[x].append([])
        for z in xrange(10):
            ie[x][y].append([])
            ie[x][y][z] = 0

for x in xrange(n):
    b, f, r, v = map(int, raw_input().split())
    ie[b-1][f-1][r-1] += v
    if ie[b-1][f-1][r-1] < 0:
        ie[b-1][f-1][r-1] = 0
    elif ie[b-1][f-1][r-1] > 9:
        ie[b-1][f-1][r-1] = 9

        

for x in xrange(4):
    for y in xrange(3):
        for z in xrange(10):
            sys.stdout.write(' ' + str(ie[x][y][z]))
        print ''
    sys.stdout.write('####################\n')

Submission status: Wrong Answer

Solution code:
def check(x_list, f, r, v):
    x_list[f][r] += v

def peo(x_list):
    for i in range(3):
        for j in range(10):
            print x_list[i][j],
        print ("")

A_bill = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
B_bill = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
C_bill = [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0]]
D_bill = [[0,0,0,0,0,0,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):
    x = raw_input()
    b, f, r, v = x.split()
    b = int(b)
    f = int(f)
    r = int(r)
    v = int(v)
    
    if b == 0:
        check(A_bill, f,r,v)
    elif b == 1:
        check(B_bill, f,r,v)
    elif b == 2:
        check(C_bill, f,r,v)
    elif b == 3:
        check(D_bill, f,r,v)

peo(A_bill)
print("####################")
peo(B_bill)
print("####################")
peo(C_bill)
print("####################")
peo(D_bill)

Submission status: Wrong Answer

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

Solution code:
N = int(input())
m=[]
line = ''
m = [[[0 for k in range(10)] for j in range(3)] for i in range(10)]
for i in range(N):
    n = input().split()
    b = int(n[0])
    f = int(n[1])
    r = int(n[2])
    v = int(n[3])
    m[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        for k in range(10):
            line += ' {0}'.format(m[i][j][k])
        print(line)
        line = ''
    print('#'*20)

Submission status: Wrong Answer

Solution code:
def create_List():
	re_list = [[],[],[],[]]
	for i in range(4):
		for j in range(3):
			re_list[i].append([0 for k in range(10)])
	return re_list

# ????????§??¨?????????????????§????????¨????????????(??????)
num = create_List()
for _ in range(int(input())):
	data = list(map(int,input().split()))
	num[data[0]-1][data[1]-1][data[2]-1] = data[3]

# ????????????
for i in range(4):
	for j in range(3):
		print(' '.join(map(str,num[i][j])))
	print('#'*20)

Submission status: Wrong Answer

Solution code:
def create_List():
	re_list = [[],[],[],[]]
	for i in range(4):
		for j in range(3):
			re_list[i].append([0 for k in range(10)])
	return re_list

# ????????§??¨?????????????????§????????¨????????????(??????)
num = create_List()
for _ in range(int(input())):
	data = list(map(int,input().split()))
	num[data[0]-1][data[1]-1][data[2]-1] = data[3]

# ????????????
for i in range(4):
	for j in range(3):
		print(' '.join(map(str,num[i][j])))
	print('#'*19)

Submission status: Wrong Answer

Solution code:
def create_List():
	re_list = [[],[],[],[]]
	for i in range(4):
		for j in range(3):
			re_list[i].append([0 for k in range(10)])
	return re_list

# ????????§??¨?????????????????§????????¨????????????(??????)
num = create_List()
for _ in range(int(input())):
	data = list(map(int,input().split()))
	num[data[0]-1][data[1]-1][data[2]-1] = data[3]

# ????????????
for i in range(4):
	for j in range(3):
		print(' ' + ' '.join(map(str,num[i][j])))
	print('#'*20)

Submission status: Wrong Answer

Solution code:
def create_List():
	re_list = [[],[],[],[]]
	for i in range(4):
		for j in range(3):
			re_list[i].append([0 for k in range(10)])
	return re_list

# ????????§??¨?????????????????§????????¨????????????(??????)
num = create_List()
for _ in range(int(input())):
	data = list(map(int,input().split()))
	num[data[0]-1][data[1]-1][data[2]-1] = data[3]

# ????????????
for i in range(4):
	for j in range(3):
		print(' ' + ' '.join(map(str,num[i][j])))
	if i == 3:
		break
	print('#'*20)

Submission status: Wrong Answer

Solution code:
def create_List():
	re_list = [[],[],[],[]]
	for i in range(4):
		for j in range(3):
			re_list[i].append([0 for k in range(10)])
	return re_list

# ????????§??¨?????????????????§????????¨????????????(??????)
num = create_List()
for _ in range(int(input())):
	data = list(map(int,input().split()))
	num[data[0]-1][data[1]-1][data[2]-1] += data[3]

# ????????????
for i in range(4):
	for j in range(3):
		print(' ' + ' '.join(map(str,num[i][j])))
	if i == 4:
		break
	print('#'*20)

Submission status: Wrong Answer

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

for x in range(4):
    for y in range(3):
        print(*l[x][y])
    print("####################")

Submission status: Wrong Answer

Solution code:
array=[[0 for i in range(10)]for j in range(12)]
n=int(input())

for i in range(n):
    call=list(map(int,input().split()))
    array[(call[0]-1)*3-1+call[1]][call[2]-1]+=call[3]
for i in range(0,12):
    if i%3==0 and i!=0:
        for j in range(10):
            print("#",end=" ")
        print()
    for j in range(10):
        print(array[i][j],end=" ")
    print()

Submission status: Wrong Answer

Solution code:
n = int(input())
a =[[[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())

    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], end='')
        print()
    print("#" * 20)

Submission status: Wrong Answer

Solution code:
import sys
n = input()
a = [[[0]*10]*3]*4
for i in range(n):
    x = map(int, raw_input().split())
    a[x[0]-1][x[1]-1][x[2]-1] += x[3]
for i in range(4):
    for j in range(3):
        for k in range(10):
            sys.stdout.write(' ')
            sys.stdout.write(str(a[i][j][k]))
        print ''
    if i != 3:
        print '####################'

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 k in range(4):
	for j in range(3):
		for i in range(10):
			print(" {}".format(a[k][j][i]), end="")
		print("")
	print("#" * 20)
print("")

Submission status: Wrong Answer

Solution code:
b = 4
f = 3
r = 10

bfrv = [[[0 for c in range(r)] for b in range(f)] for a in range(b)]

n = int(input())

for i in range(n):
    bi, fi, ri, vi = map(int, input().split())
    bfrv[bi - 1][fi - 1][ri - 1] = bfrv[bi - 1][fi - 1][ri - 1] + vi

for x in range(b):
    for y in range(f):
        s = ""
        for z in range(r):
            s = " ".join(map(str, bfrv[x][y]))
        print(s)
    print("#" * 20)

Submission status: Wrong Answer

Solution code:
b = 4
f = 3
r = 10

bfrv = [[[0 for c in range(r)] for b in range(f)] for a in range(b)]

n = int(input())

for i in range(n):
    bi, fi, ri, vi = map(int, input().split())
    bfrv[bi - 1][fi - 1][ri - 1] = bfrv[bi - 1][fi - 1][ri - 1] + vi

for x in range(b):
    for y in range(f):
        for z in range(r):
            s = " " + " ".join(map(str, bfrv[x][y]))
        print(s)
    print("#" * 20)

Submission status: Wrong Answer

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

print(data)

Submission status: Wrong Answer

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

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')

        print()

    if bi < 3:
        print('#' * 20)

Submission status: Wrong Answer

Solution code:
date = [
    [[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(i) for i in input().split()]
    date[b-1][f-1][r-1] +=v

for b in date:
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        
    print('#' * 20)

Submission status: Wrong Answer

Solution code:
b = 4
f = 3
r = 10

bfrv = [[[0 for c in range(r)] for b in range(f)] for a in range(b)]

n = int(input())

for i in range(n):
    bi, fi, ri, vi = map(int, input().split())
    bfrv[bi - 1][fi - 1][ri - 1] = bfrv[bi - 1][fi - 1][ri - 1] + vi

for x in range(b):
    for y in range(f):
        for z in range(r):
            print('', bfrv[x][y][z], end='')
        print()
    print("#" * 20)

Submission status: Wrong Answer

Solution code:
x = int(input())
a = []
for i in range(1, 120 + 1):
    a.append(0)
for d in range(1, x + 1):
    f, t, y, r = [int(l) for l in input().split()]
    if r < 0:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] + r
    else:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = r
for u in (0, 30, 60, 90):
    for b in (u, u + 10, u + 20):
        for k in range(b, b + 10):
            print(' '.join,a[k])
        print()
    if u < 90:
        print('#' * 20)
    else:
        pass

Submission status: Wrong Answer

Solution code:
x = int(input())
a = []
for i in range(1, 120 + 1):
    a.append(0)
for d in range(1, x + 1):
    f, t, y, r = [int(l) for l in input().split()]
    if r < 0:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] + r
    else:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = r
for u in (0, 30, 60, 90):
    for b in (u, u + 10, u + 20):
        for k in range(b, b + 10):
            print(' '.join,a[k])
        print()
    if u < 90:
        print('#' * 20)
    else:
        print()

Submission status: Wrong Answer

Solution code:
x = int(input())
a = []
for i in range(1, 120 + 1):
    a.append(0)
for d in range(1, x + 1):
    f, t, y, r = [int(l) for l in input().split()]
    if r < 0:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] + r
    else:
        a[((30 * (f - 1)) + (10 * (t - 1)) + y) - 1] = r
for u in (0, 30, 60, 90):
    for b in (u, u + 10, u + 20):
        for k in range(b, b + 10):
            print(" ",a[k],end='',sep='')
        print()
    if u < 90:
        print('#' * 20)
    else:
        pass

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [[[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10]]

print(len(A))
for i in range(N):
    b, f, r, v = [int(j) for j in input().split()]
    A[b-1][f-1][r-1] += v

for a, b in enumerate(A):
    for f in b:
        print(' '.join([str(i) for i in f]))
    else:
        if a != len(A) - 1:
            print('#' * 10)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [[[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10], [[0] * 10, [0] * 10, [0] * 10]]

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

for a, b in enumerate(A):
    for f in b:
        print(' '.join([str(i) for i in f]))
    else:
        if a != len(A) - 1:
            print('#' * 10)

Submission status: Wrong Answer

Solution code:
n = int(input())
a =[' 0',' 0',' 0',' 0',' 0',' 0',' 0',' 0',' 0',' 0']
A_1 = a.copy()
A_2 = a.copy()
A_3 = a.copy()
B_1 = a.copy()
B_2 = a.copy()
B_3 = a.copy()
C_1 = a.copy()
C_2 = a.copy()
C_3 = a.copy()
D_1 = a.copy()
D_2 = a.copy()
D_3 = a.copy()
ren1 = [A_1,A_2,A_3]
ren2 = [B_1,B_2,B_3]
ren3 = [C_1,C_2,C_3]
ren4 = [D_1,D_2,D_3]
for i in range(n):
    b = input()
    c = b.split(' ')
    ren = int(c[0])
    kai = int(c[1])
    banme = int(c[2])
    nin = int(c[3])
    if nin < 0:
        if ren == 1:
            ren1[kai-1][banme-1] = ' 0'
        elif ren == 2:
            ren2[kai-1][banme-1] = ' 0'
        elif ren == 3:
            ren3[kai-1][banme-1] = ' 0'
        elif ren == 4:
            ren4[kai-1][banme-1] = ' 0'
    elif ren == 1:
        ren1[kai-1][banme-1] = ' %s'%(nin)
    elif ren == 2:
        ren2[kai-1][banme-1] = ' %s'%(nin)
    elif ren == 3:
        ren3[kai-1][banme-1] = ' %s'%(nin)
    elif ren == 4:
        ren4[kai-1][banme-1] = ' %s'%(nin)
print(''.join(A_1))
print(''.join(A_2))
print(''.join(A_3))
print('####################')
print(''.join(B_1))
print(''.join(B_2))
print(''.join(B_3))
print('####################')
print(''.join(C_1))
print(''.join(C_2))
print(''.join(C_3))
print('####################')
print(''.join(D_1))
print(''.join(D_2))
print(''.join(D_3))

Submission status: Wrong Answer

Solution code:
rooms = [0] * (4*3*10)
n = input();
#print "n = ", n
for i in xrange(n):
	b,f,r,v = map(int, raw_input().split())
	#print "b=", b, ", f=", f, ", r=", r, ", v=", v
	rooms[(b-1)*30+(f-1)*10+r] += v

sep = "#" * 20
for b in xrange(4):
	for f in xrange(3):
			t = 30*b + 10*f
			print ""," ".join(map(str, rooms[t:t+10]))
	if b < 3: print sep

Submission status: Wrong Answer

Solution code:
rooms = [0] * (4*3*10)
n = input();
for i in xrange(n):
	b,f,r,v = map(int, raw_input().split())
	rooms[(b-1)*30+(f-1)*10+r] += v

sep = "#" * 20
for b in xrange(4):
	for f in xrange(3):
			t = 30*b + 10*f
			print ""," ".join(map(str, rooms[t:t+10]))
	if b < 3: print sep