We write one of the numbers $0$ and $1$ into each unit square of a chessboard with $40$ rows and $7$ columns. If any two rows have different sequences, at most how many $1$s can be written into the unit squares?

$ 
\textbf{(A)}\ 198
\qquad\textbf{(B)}\ 128
\qquad\textbf{(C)}\ 82
\qquad\textbf{(D)}\ 40
\qquad\textbf{(E)}\ \text{None of above}
$
To solve this problem, we need to maximize the number of 1's on a 40-row by 7-column chessboard, ensuring that each row has a unique sequence of 0's and 1's. We will use combinatorial methods to determine the maximum number of 1's.

1. **Determine the number of distinct sequences:**
   Each row must have a unique sequence of 0's and 1's. The number of distinct sequences with exactly \( n \) 1's in a row of 7 columns is given by the binomial coefficient \( \binom{7}{n} \).

2. **Calculate the total number of distinct sequences:**
   We need to find the smallest \( n \) such that the sum of the binomial coefficients from \( \binom{7}{0} \) to \( \binom{7}{n} \) is at least 40. This ensures that we have at least 40 unique sequences.

   \[
   \binom{7}{0} + \binom{7}{1} + \binom{7}{2} + \binom{7}{3} + \binom{7}{4} + \binom{7}{5} + \binom{7}{6} + \binom{7}{7} = 1 + 7 + 21 + 35 + 35 + 21 + 7 + 1 = 128
   \]

   Since \( \binom{7}{0} + \binom{7}{1} + \binom{7}{2} + \binom{7}{3} + \binom{7}{4} = 1 + 7 + 21 + 35 + 35 = 99 \) is already greater than 40, we can stop at \( \binom{7}{4} \).

3. **Distribute the 1's:**
   To maximize the number of 1's, we start by filling rows with the highest number of 1's possible, ensuring each row is unique.

   - There is 1 way to have 7 ones: \( \binom{7}{7} = 1 \)
   - There are 7 ways to have 6 ones: \( \binom{7}{6} = 7 \)
   - There are 21 ways to have 5 ones: \( \binom{7}{5} = 21 \)
   - There are 35 ways to have 4 ones: \( \binom{7}{4} = 35 \)

   We need to ensure the total number of rows does not exceed 40. We can use all the sequences with 7, 6, and 5 ones, and then use as many sequences with 4 ones as needed to reach 40 rows.

4. **Calculate the number of 1's:**
   - 1 row with 7 ones: \( 1 \times 7 = 7 \)
   - 7 rows with 6 ones: \( 7 \times 6 = 42 \)
   - 21 rows with 5 ones: \( 21 \times 5 = 105 \)
   - Remaining rows with 4 ones: \( 40 - (1 + 7 + 21) = 11 \) rows with 4 ones: \( 11 \times 4 = 44 \)

   Adding these together gives the total number of 1's:
   \[
   7 + 42 + 105 + 44 = 198
   \]

Thus, the maximum number of 1's that can be written into the unit squares is \( \boxed{198} \).