We have $2021$ colors and $2021$ chips of each color. We place the $2021^2$ chips in a row. We say that a chip $F$ is [i]bad[/i] if there is an odd number of chips that have a different color to $F$ both to the left and to the right of $F$.

(a) Determine the minimum possible number of bad chips.

(b) If we impose the additional condition that each chip must have at least one adjacent chip of the same color, determine the minimum possible number of bad chips.
### Part (a)

1. **Define the problem in terms of parity:**
   - We have \(2021\) colors and \(2021\) chips of each color, making a total of \(2021^2\) chips.
   - A chip is considered *bad* if there is an odd number of chips of different colors on both sides of it.

2. **Classify chips and positions by parity:**
   - Label the chips of each color as *odd* or *even* based on their position in the sequence of chips of that color.
   - Similarly, label the positions in the row as *odd* or *even*.

3. **Count the odd and even chips and positions:**
   - There are \(1011\) odd chips and \(1010\) even chips for each color.
   - There are \(\frac{2021^2 + 1}{2}\) odd positions and \(\frac{2021^2 - 1}{2}\) even positions.

4. **Calculate the minimum number of bad chips:**
   - Since there are \(1011 \cdot 2021\) odd chips but only \(\frac{2021^2 + 1}{2}\) odd positions, at least \(1011 \cdot 2021 - \frac{2021^2 + 1}{2} = 1010\) chips must be bad.
   - To achieve this minimum, place the chips of colors \(c = 1, \ldots, 2020\) in the positions \(2022c - 2021, 2022c - 2020, \ldots, 2022c - 1\) and place the chips of color \(c = 2021\) in the positions \(2022, 4044, \ldots, 2022 \cdot 2020, 2021^2\).

5. **Verify the placement:**
   - In this arrangement, the only bad chips are the \(1^\text{st}, 3^\text{rd}, \ldots, 2019^\text{th}\) chips of color \(c = 2021\), which are \(1010\) in number.

### Part (b)

1. **Consider the additional condition:**
   - Each chip must have at least one adjacent chip of the same color.

2. **Analyze the relationship between bad chips:**
   - For every odd chip in an even position, at least one of its neighbors must be an even chip of the same color in an odd position.
   - Conversely, for every bad even chip, at most two of its neighbors are bad odd chips of the same color.

3. **Set up the equations:**
   - Let \(a\) be the number of bad odd chips and \(b\) be the number of bad even chips.
   - The number of pairs of adjacent bad chips of the same color is at least \(a\) but at most \(2b\).
   - Therefore, \(a \leq 2b\).
   - Additionally, we have \(a - b = 1010\).

4. **Solve the inequalities:**
   - From \(a - b = 1010\), we get \(a = 1010 + b\).
   - Substituting into \(a \leq 2b\), we get \(1010 + b \leq 2b\), which simplifies to \(b \geq 1010\).

5. **Calculate the minimum number of bad chips:**
   - The total number of bad chips is \(a + b = 1010 + b + b = 1010 + 2b\).
   - Since \(b \geq 1010\), the minimum number of bad chips is \(1010 + 2 \cdot 1010 = 3030\).

6. **Construct the equality case:**
   - Place the chips of colors \(c = 1, \ldots, 2018\) in the positions \(2024c - 2023, 2024c - 2022, \ldots, 2024c - 3\).
   - This leaves \(2017\) gaps of length \(3\), each starting with an even location.
   - Additionally, there are \(12\) empty spaces at the end, alternating between even and odd.
   - Distribute the first \(2019\) chips of color \(2019\) in the first \(673\) gaps, the first \(2019\) chips of color \(2020\) in the next \(673\) gaps, and the first \(2013\) chips of color \(2021\) in the next \(671\) gaps.
   - This results in \(3 \left(\frac{673 + 1}{2} + \frac{673 + 1}{2} + \frac{671 + 1}{2}\right) = 3030\) bad chips.
   - Place the remaining \(2\) chips each of colors \(2019\) and \(2020\), and \(8\) chips of color \(2021\) in the remaining positions to ensure they are not bad.

The final answer is \( \boxed{ 1010 } \) for part (a) and \(3030\) for part (b).