THEY put you in a square shape room, with

THEY want to know everything about you.

THEY are observing you.

THEY placed some candles in the room.

Every candle makes

You can hide only, if you find a dark spot which has 0 "light".

You will receive a map of the room, with the empty places (X) and Candles (C) in

Example for the light spread

X X X X X

X C X X X

X X X X X

X X X X X

X X X X X

2 2 2 1 0

2 3 2 1 0

2 2 2 1 0

1 1 1 1 0

0 0 0 0 0

`N`meters on each side.THEY want to know everything about you.

THEY are observing you.

THEY placed some candles in the room.

Every candle makes

`L`"light" in the spot they are, and every spot in square shape gets one less "light" as the next ones. If a spot is touched by two candles, it will have the larger "light" it can have. Every spot has the base light of 0.You can hide only, if you find a dark spot which has 0 "light".

**How many dark spots you have?**You will receive a map of the room, with the empty places (X) and Candles (C) in

`N`rows, each character separated by a space.Example for the light spread

`N`= 5,`L`= 3:X X X X X

X C X X X

X X X X X

X X X X X

X X X X X

2 2 2 1 0

2 3 2 1 0

2 2 2 1 0

1 1 1 1 0

0 0 0 0 0

Input

**Line 1:**An integer

`N`for the length of one side of the room.

**Line 2:**An integer

`L`for the base light of the candles.

**Next**

`N`lines:`N`number of characters (as

`c`), separated by one space.

Output

**Line 1 :**The number of places with zero light.

Constraints

0 <

0 <

`N`<= 250 <

`L`< 10## Solution

We keep a map \(M\) as a N x N matrix, initialized by zero and add a special light matrix for each C we find in the grid. The light matrix can be created by looping over each cell and add the inverted Chebyshev distance to the place where we found the candle:

```
def createLight(row, col, n, l):
return np.array([
[max(0, l - max(abs(row - i), abs(col - j)))
for j in range(n)]
for i in range(n)])
```

What follows is just the frame to read in the data and loop over the matrix

```
import math
import numpy as np
n, l = map(int, [input(), input()])
M = np.zeros((n, n))
for i in range(n):
line = input().split(" ")
for j in range(len(line)):
if line[j] == "C":
M+= createLight(i, j, n, l)
print(n * n - np.count_nonzero(M))
```