Problem p03944 (python)

Fixed submission:
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        if CoordinateList[n][0] == 0:
             pass
        else:
            for i in range(H):
                del AllArea[i][:(CoordinateList[n][0])]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].insert(0,"B")

    elif CoordinateList[n][2] == 2:
        if CoordinateList[n][0] == 0:
            print(0)
            exit()
        else:
            for i in range(H):
                del AllArea[i][(CoordinateList[n][0]):]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].append("B")

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        if changeY == 0:
            print(0)
            exit()
        else:
            del AllArea[changeY:]
            
            for changeRaw in range(int(CoordinateList[n][1])):
                AllArea.append(rawBlack)
            

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        if changeY == 0:
            pass
        else:
            del AllArea[:changeY]
            for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
            
# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        if CoordinateList[n][0] == 0:
             pass
        else:
            for i in range(H):
                del AllArea[i][:(CoordinateList[n][0])]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].insert(0,"B")

    elif CoordinateList[n][2] == 2:
        if CoordinateList[n][0] == 0:
            print(0)
            exit()
        else:
            for i in range(H):
                del AllArea[i][(CoordinateList[n][0]):]
                for numX in range(CoordinateList[n][0]):
                    AllArea[i].append("B")

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        if changeY == 0:
            print(0)
            exit()
        else:
            del AllArea[changeY:]
            for changeRaw in range(changeY):
                AllArea.append(rawBlack)
         

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        if changeY == 0:
            pass
        else:
            del AllArea[:changeY]
            for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
            
            
# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"B")

    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("B")

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        if changeY == 0:
            print(0)
            exit()
        else:
            del AllArea[changeY:]
            for changeRaw in range(changeY):
                AllArea.append(rawBlack)
         

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        if changeY == 0:
            pass
        else:
            del AllArea[:changeY]

            for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
            
            
# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"B")

    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("B")

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        if changeY == 0:
            print(0)
            exit()
        else:
            del AllArea[changeY:]
            for changeRaw in range(changeY):
                AllArea.append(rawBlack)
         

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        if changeY == 0:
            pass
        else:
            del AllArea[:changeY]
            print(range(changeY))
            for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
            
            
# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"B")
        #print(AllArea)
    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("B")

        #print(AllArea)

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        del AllArea[changeY:]
        for changeRaw in range(changeY):
            AllArea.append(rawBlack)
        #print(AllArea)

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        del AllArea[:changeY]
        for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
        #print(AllArea)

# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

#print(AllArea)
print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("W")
        rawBlack.append("B")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"B")
        #print(AllArea)
    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("B")

        #print(AllArea)

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        del AllArea[changeY:]
        for changeRaw in range(changeY):
            AllArea.append(rawBlack)
        #print(AllArea)

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        del AllArea[:changeY]
        for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
        #print(AllArea)

# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("W")

#print(AllArea)
print(AreaWhite)

Buggy submission (verdict: Runtime Error):
W,H,N = map(int,input().split())

CoordinateList = []
for i in range(N):
    x,y,a = map(int, input().split())
    CoordinateList.append([x,y,a])

# raw White & Black
AllArea = []
for numline in range(H):
    rawWhite = []
    rawBlack = []
    for numraw in range(W):
        rawWhite.append("White")
        rawBlack.append("Black")
    AllArea.append(rawWhite)

# coloring from white to Black
for n in range(N):
    if CoordinateList[n][2] == 1:
        for i in range(H):
            del AllArea[i][:(CoordinateList[n][0])]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].insert(0,"Black")
        #print(AllArea)
    elif CoordinateList[n][2] == 2:
        for i in range(H):
            del AllArea[i][(CoordinateList[n][0]):]
            for numX in range(CoordinateList[n][0]):
                AllArea[i].append("Black")

        #print(AllArea)

    elif CoordinateList[n][2] == 3:
        changeY = H - int(CoordinateList[n][1])
        del AllArea[changeY:]
        for changeRaw in range(changeY):
            AllArea.append(rawBlack)
        #print(AllArea)

    elif CoordinateList[n][2] == 4:
        changeY = H - int(CoordinateList[n][1]) 
        del AllArea[:changeY]
        for changeRaw in range(changeY):
                AllArea.insert(0,rawBlack)
        #print(AllArea)

# counting 
AreaWhite = 0
for i in range(H):
    AreaWhite += AllArea[i].count("White")

#print(AllArea)
print(AreaWhite)