Problem:

Official House

You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.

  For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that &minus;v persons left.

Assume that initially no person lives in the building. 

Input

  In the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line. 

Output

For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings.

Constraints

No incorrect building, floor and room numbers are given.

0 ≤ the number of tenants during the management ≤ 9

Sample Input

3
1 1 3 8
3 2 2 7
4 3 8 1

Sample Output

 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0



Sample input:
3
1 1 3 8
3 2 2 7
4 3 8 1


Sample output:
 0 0 8 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 7 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
####################
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 1 0 0

Submission status: Accepted

Solution code:
A=[[0 for ia in range(10)]for iaa in range(3)]
B=[[0 for ib in range(10)]for ibb in range(3)]
C=[[0 for ic in range(10)]for icc in range(3)]
D=[[0 for id in range(10)]for idd in range(3)]
num=int(input())
for i in range(num):
	a=input().split()
	if int(a[0])==1:
		A[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==2:
		B[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==3:
		C[int(a[1])-1][int(a[2])-1]+=int(a[3])
	elif int(a[0])==4:
		D[int(a[1])-1][int(a[2])-1]+=int(a[3])
	else:
		pass
for ja in range(3):
	for ka in range(10):
		print(' ',end='')
		print((A[ja][ka]),end='')
	print() 
print('####################')
for jb in range(3):
	for kb in range(10):
		print(' ',end='')
		print((B[jb][kb]),end='')
	print()
print('####################')
for jc in range(3):
	for kc in range(10):
		print(' ',end='')
		print((C[jc][kc]),end='')
	print()
print('####################')
for jd in range(3):
	for kd in range(10):
		print(' ',end='')
		print((D[jd][kd]),end='')
	print()

Submission status: Accepted

Solution code:
n_room = 10     # 1フロアの部屋の数
n_floor = 3     # 1棟ごとの階数
n_blds = 4      # 棟の数
cnt1 = 0           # 配列作成時のカウンタ
ary = []        # 配列を作成

# 配列を0で埋めた状態で作成
ary = [[[0]*n_room for i in range (0,n_floor)] for k in range (0,n_blds)]

n = int(input())    # データ数を取得
cnt2 = 0            # データ取得用カウンタの初期化

while True:
    b,f,r,v = map(int, input().split())
    ary[b-1][f-1][r-1] += v
    cnt2 += 1
    if cnt2 == n:
        break
    
x = 0

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

    for a in range(3):
        for b in range(10):
            print(" %d"%(ary[i][a][b]),end = "")
        print()

Submission status: Accepted

Solution code:
#print(int('-1'))
result = []

for b in range(0, 4):
    result.append([])
    for f in range(0, 3):
        result[b].append([])
        for r in range(0, 10):
            result[b][f].append(0)

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

for b in range(0, 4):
    for f in range(0, 3):
        for r in range(0, 10):
            print(' '+ str(result[b][f][r]), end = '')
        print()
    if (b < 3):
        for m in range(0, 20):
            print('#', end = '')
        print()

Submission status: Accepted

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

for bild in range(4):
    for floor in range(3):
        ans = " ".join(map(str, data[bild][floor]))
        print(" "+ans)
    if bild != 3:
        print("####################")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

# ITP1_6_C

N=int(input())
buildings= list()
floor= list()
result=""
for j in range(4):
    floor= list()
    for i in range(3):
        floor.insert(i,list("0"*10))
    buildings.insert(j,floor)


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

for i,building in enumerate(buildings):
    # print(building)
    for floor in building:
        result=" "+" ".join(map(str,floor))
        print(result)
    if(i==len(buildings)-1):
        break
    print("####################")

Submission status: Accepted

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(4):
		for k in range(10):
			if j==3:
				if i<3:
					print("##",end="")
				else:
					break
			else:
				print(" "+str(a[i][j][k]),end="")
			if k==9:
				print("")

Submission status: Accepted

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

room = [[[0]*10 for i in range(3)] for k in range(4)]
n =  int(input().strip())

for m in range(n):
    raw_data = input()
    data = list(map(int,raw_data.split()))
    room[data[0]-1][data[1]-1][data[2]-1]+=data[3]

for build in range(3):
    for floor in range(3):
        data = " "+str(room[build][floor][0])
        for No in range(1,10):
            data = data+" "+str(room[build][floor][No])
        print(data)
    print('#'*20)
for floor in range(3):
    data = " "+str(room[3][floor][0])
    for No in range(1,10):
        data = data+" "+str(room[3][floor][No])
    print(data)

Submission status: Accepted

Solution code:
import sys

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

lst = []

N = int(input())
for i in sys.stdin.readlines():
    row = i.rstrip().split()
    b = int(row[0])
    f = int(row[1])
    r = int(row[2])
    v = int(row[3])
    
    ans[b-1][f-1][r-1] += v
    
for i,j in enumerate(ans,start=1):
    if i != 4:
        for k in j:
            print(' ', end='')
            print(*k)
        print('#'*20)
    else:
        for k in j:
            print(' ', end='')
            print(*k)

Submission status: Accepted

Solution code:
building = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())

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

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

Submission status: Accepted

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

n = int(input())

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

for i, b in enumerate(count):
    for f in b:
        for r in f:
            print(" {0}".format(r), end = "")
        print()
    if i < 3: print("####################")

Submission status: Accepted

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

listA = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listB = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listE = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listF = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listG = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listH = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listI = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listJ = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listK = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
listL = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

while i < n+1:
    b, f, r, v = map(int, input().split())
    if 3 * b + f == 4:
        listA[r-1] += v
        i += 1
    
    elif 3 * b + f == 5:
        listB[r-1] += v
        i += 1
    
    elif 3 * b + f == 6:
        listC[r-1] += v
        i += 1
    
    elif 3 * b + f == 7:
        listD[r-1] += v
        i += 1
    
    elif 3 * b + f == 8:
        listE[r-1] += v
        i += 1
    
    elif 3 * b + f == 9:
        listF[r-1] += v
        i += 1
    
    elif 3 * b + f == 10:
        listG[r-1] += v
        i += 1
    
    elif 3 * b + f == 11:
        listH[r-1] += v
        i += 1
    
    elif 3 * b + f == 12:
        listI[r-1] += v
        i += 1
    
    elif 3 * b + f == 13:
        listJ[r-1] += v
        i += 1
    
    elif 3 * b + f == 14:
        listK[r-1] += v
        i += 1
    
    else:
        listL[r-1] += v
        i += 1
    
    
for i in range(9):
    print(' ' + str(listA[i]), end='')
print(' ' + str(listA[9]), end='\n')
for i in range(9):
    print(' ' + str(listB[i]), end='')
print(' ' + str(listB[9]), end='\n')
for i in range(9):
    print(' ' + str(listC[i]), end='')
print(' ' + str(listC[9]), end='\n')
print('####################')        
for i in range(9):
    print(' ' + str(listD[i]), end='')
print(' ' + str(listD[9]), end='\n')
for i in range(9):
    print(' ' + str(listE[i]), end='')
print(' ' + str(listE[9]), end='\n')
for i in range(9):
    print(' ' + str(listF[i]), end='')
print(' ' + str(listF[9]), end='\n')
print('####################')
for i in range(9):
    print(' ' + str(listG[i]), end='')
print(' ' + str(listG[9]), end='\n')
for i in range(9):
    print(' ' + str(listH[i]), end='')
print(' ' + str(listH[9]), end='\n')
for i in range(9):
    print(' ' + str(listI[i]), end='')
print(' ' + str(listI[9]), end='\n')
print('####################')
for i in range(9):
    print(' ' + str(listJ[i]), end='')
print(' ' + str(listJ[9]), end='\n')
for i in range(9):
    print(' ' + str(listK[i]), end='')
print(' ' + str(listK[9]), end='\n')
for i in range(9):
    print(' ' + str(listL[i]), end='')
print(' ' + str(listL[9]), end='\n')

Submission status: Accepted

Solution code:
x = [[[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())
    x[b-1][f-1][r-1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(" ", end="")
            print(x[i][j][k], end="")
        print()
    if i < 3:
        print("####################")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
B=[
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
],
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
]
]

def f(x):
    for k in range(3):
        word = ""
        for i in range(10):
            if i !=10:
                word = word +" "+str(B[x][k][i])
            else:
                word = word +str(B[x][k][i])
        print(word)


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

def f(x):
    for k in range(3):
        word = ""
        for i in range(10):
            if i !=10:
                word = word +" "+str(B[x][k][i])
            else:
                word = word +str(B[x][k][i])
        print(word)

f(0)
print("####################")
f(1)
print("####################")
f(2)
print("####################")
f(3)

Submission status: Accepted

Solution code:
n = int(input())
w = [0] * 30
x = [0] * 30
y = [0] * 30
z = [0] * 30

for i in range(n):
    b, f, r, v = map(int, input().split())
    if b == 1:
        w[r + (f - 1)*10 - 1] += v
    if b == 2:
        x[r + (f - 1)*10 - 1] += v
    if b == 3:
        y[r + (f - 1)*10 - 1] += v
    if b == 4:
        z[r + (f - 1)*10 - 1] += v


first = ''
second = ''
third = ''

for i in range(10):
    first += ' ' + str(w[i])
print(first)
for i in range(10):
    second += ' ' + str(w[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(w[i + 20])
print(third)
first = ''
second = ''
third = ''

print('#' * 20)

for i in range(10):
    first += ' ' + str(x[i])
print(first)
for i in range(10):
    second += ' ' + str(x[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(x[i + 20])
print(third)
first = ''
second = ''
third = ''

print('#' * 20)

for i in range(10):
    first += ' ' + str(y[i])
print(first)
for i in range(10):
    second += ' ' + str(y[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(y[i + 20])
print(third)
first = ''
second = ''
third = ''

print('#' * 20)

for i in range(10):
    first += ' ' + str(z[i])
print(first)
for i in range(10):
    second += ' ' + str(z[i + 10])
print(second)
for i in range(10):
    third += ' ' + str(z[i + 20])
print(third)

Submission status: Accepted

Solution code:
import sys
input_lines = sys.stdin.readlines()[1:]

bls = [[[0] * 10 for i in range(3)] for j in range(4)]
for line in input_lines:
    [b,f,r,v] = [int(i) for i in line.split()]
    bls[b-1][f-1][r-1] += v
for i in range(4):
    for f in bls[i]:
        print(''.join([' {0}'.format(v) for v in f]))
    if i<3:
        print('#'*20)

Submission status: Accepted

Solution code:
def manageHotel(l, b, f, r, v):
	l[b-1][f-1][r-1] += v
	return l

build = list()
for i in range(4):
	floor = list()
	for j in range(3):
		room = list()
		for k in range(10):
			room.append(0)
		floor.append(room)
	build.append(floor)
i = int(input())
while i > 0:
	data = [int(x) for x in input().split()]
	build = manageHotel(build, data[0], data[1], data[2], data[3])
	i -= 1
for b in range(len(build)):
	for f in range(len(build[b])):
		for r in range(len(build[b][f])):
			print(' %d' % (build[b][f][r]), end='')
		print()
	if b < len(build) - 1:
		print('#' * 20)

Submission status: Accepted

Solution code:
off = [[[0 for _ in range(10)] for _ in range(3)] for _ in range(4)]
n = int(input())

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

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

Submission status: Accepted

Solution code:
'import sys'
d=[[[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=[int(j) for j in input().split()]
    d[b-1][f-1][r-1]+=v
for i, b in enumerate(d):
    for f in b:
        for r in f:
            print(" {}".format(r),end="")
        print()
    if i< 3:
        print("#"*20)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n1 = [0 for i in range(10) for j in range(3)]
n2 = [0 for i in range(10) for j in range(3)]
n3 = [0 for i in range(10) for j in range(3)]
n4 = [0 for i in range(10) for j in range(3)]
for _ in range(int(input())):
	b,f,r,v = map(int, tuple(input().split(' ')))
	if b == 1:
		n1[10*(f-1)+r-1] += v
	elif b == 2:
		n2[10*(f-1)+r-1] += v
	elif b == 3:
		n3[10*(f-1)+r-1] += v
	elif b == 4:
		n4[10*(f-1)+r-1] += v
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n1[10*j+i])
	print(s)
print('####################')
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n2[10*j+i])
	print(s)
print('####################')
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n3[10*j+i])
	print(s)
print('####################')
for j in range(3): 
	s = ''
	for i in range(10): s += ' ' + str(n4[10*j+i])
	print(s)

Submission status: Accepted

Solution code:
data = []
for x in range(0,3*10*4):
    data.append(0)
num = int(input())
for x in range(0,num):
    b,f,r,v = map(int, input().split())
    tmp = data.pop(30*(b-1)+10*(f-1)+(r-1))
    data.insert(30*(b-1)+10*(f-1)+(r-1),v+tmp)
for x in range(0,4) :
    for y in range(0,3):
        for z in range(0,10):
            print('',data.pop(0),end='')
        print("")
    if x != 3:
        print("####################")
    else:
        pass

Submission status: Runtime Error

Solution code:
num = input()
L = []
house = []
for i in range(int(num)):
    k = input().split()
    k[0] = int(k[0])
    k[1] = int(k[1])
    k[2] = int(k[2])
    k[3] = int(k[3])
    L.append(k)

for i in range(3):
    a = ["","0","0","0","0","0","0","0","0","0","0","0"]
    b = ["","0","0","0","0","0","0","0","0","0","0","0"]
    c = ["","0","0","0","0","0","0","0","0","0","0","0"]
    d = ["#"*20]
    house.append([a,b,c,d])

a = ["","0","0","0","0","0","0","0","0","0","0","0"]
b = ["","0","0","0","0","0","0","0","0","0","0","0"]
c = ["","0","0","0","0","0","0","0","0","0","0","0"]
house.append([a,b,c])

for i in L:
    house[i[0]][i[1]][i[2]] = str(i[3])

for i in house:
    for j in i:
        k = " ".join(j)
        print(k)

Submission status: Runtime Error

Solution code:
%time
num = input()
L = []
house = []
for i in range(int(num)):
    k = input().split()
    k[0] = int(k[0])
    k[1] = int(k[1])
    k[2] = int(k[2])
    k[3] = int(k[3])
    L.append(k)

for i in range(3):
    a = ["","0","0","0","0","0","0","0","0","0","0","0"]
    b = ["","0","0","0","0","0","0","0","0","0","0","0"]
    c = ["","0","0","0","0","0","0","0","0","0","0","0"]
    d = ["#"*20]
    house.append([a,b,c,d])

a = ["","0","0","0","0","0","0","0","0","0","0","0"]
b = ["","0","0","0","0","0","0","0","0","0","0","0"]
c = ["","0","0","0","0","0","0","0","0","0","0","0"]
house.append([a,b,c])

for i in L:
    house[i[0]-1][i[1]-1][i[2]] = str(i[3])

for i in house:
    for j in i:
        k = " ".join(j)
        print(k)

Submission status: Runtime Error

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

for i in range(4):
    for j in range(3):
        print " ".join(map(str, home[i][j]))
        if j == 2 and i != 3

Submission status: Runtime Error

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

for i in range(4):
    for j in range(3):
        print "",
        print " ".join(map(str, home[i][j]))
        if j == 2 and i != 3

Submission status: Runtime Error

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

for i in range(4):
    for j in range(3):
        print "",
        print " ".join(map(str, home[i][j]))
        if j == 2 and i != 3
            print "#" * 20

Submission status: Runtime Error

Solution code:
_1_1=[]
_1_2=[]
_1_3=[]
_2_1=[]
_2_2=[]
_2_3=[]
_3_1=[]
_3_2=[]
_3_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)
N=int(input())
s=[input() for i in range(N)]
bfrv=[]
for i in range(N):
    bfrv.append(i.split())
for i in bfrv:
    if i[0]==1 and i[1]==1:
        _1_1[int(i[2])-1]+=int(i[3])
    if i[0]==1 and i[1]==2:
        _1_2[int(i[2])-1]+=int(i[3])
    if i[0]==1 and i[1]==3:
        _1_3[int(i[2])-1]+=int(i[3])
    if i[0]==2 and i[1]==1:
        _2_1[int(i[2])-1]+=int(i[3])
    if i[0]==2 and i[1]==2:
        _2_2[int(i[2])-1]+=int(i[3])
    if i[0]==2 and i[1]==3:
        _2_3[int(i[2])-1]+=int(i[3])
    if i[0]==3 and i[1]==1:
        _3_1[int(i[2])-1]+=int(i[3])
    if i[0]==3 and i[1]==2:
        _3_2[int(i[2])-1]+=int(i[3])
    if i[0]==3 and i[1]==3:
        _3_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)

Submission status: Runtime 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=[]
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])
    if int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    if 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: Runtime 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=[]
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[2])
    if int(i[0])==1 and int(i[1])==2:
        _1_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==1 and int(i[1])==3:
        _1_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==1:
        _2_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==2:
        _2_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==2 and int(i[1])==3:
        _2_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==1:
        _3_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==2:
        _3_2[int(i[2])-1]+=int(i[3])
    if int(i[0])==3 and int(i[1])==3:
        _3_3[int(i[2])-1]+=int(i[3])
    if int(i[0])==4 and int(i[1])==1:
        _4_1[int(i[2])-1]+=int(i[3])
    if int(i[0])==4 and int(i[1])==2:
        _4_2[int(i[2])-1]+=int(i[3])
    if 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: Runtime 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=[]
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: Runtime 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=[]
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)

Submission status: Runtime 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: Runtime 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)
pritn("#"*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: Runtime Error

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

Submission status: Runtime 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
    for a in range(3):
        for b in range(10):
            print((lst[i][a][b]),end="")
        print()

Submission status: Runtime 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
    for a in range(3):
        for b in range(10):
            print((lst[i][a][b]),end="")
        print()

Submission status: Runtime 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
    for a in range(3):
        for b in range(10):
            print((lst[i][a][b]),end="")
        print()

Submission status: Runtime 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(" %d",%(lst[i][a][b]),end="")
        print()