Pebbles are placed on the squares of a $2021\times 2021$ board in such a way that each square contains at most one pebble. The pebble set of a square of the board is the collection of all pebbles which are in the same row or column as this square. (A pebble belongs to the pebble set of the square in which it is placed.) What is the least possible number of pebbles on the board if no two squares have the same pebble set?
1. **Claim**: The least possible number of pebbles on a $2021 \times 2021$ board such that no two squares have the same pebble set is $2021 + \left\lfloor \frac{2021}{2} \right\rfloor = 3031$.

2. **Construction**: We can achieve this by placing pebbles in a specific pattern:
   - Place a pebble in every cell on one of the main diagonals.
   - Place a pebble in every cell on one half of the other main diagonal.

   For example, for $n=5$, the board looks like this:
   \[
   \begin{bmatrix}
   \ast & . & . & . & \ast \\
   . & \ast & . & \ast & . \\
   . & . & \ast & . & . \\
   . & \ast & . & \ast & . \\
   \ast & . & . & . & \ast \\
   \end{bmatrix}
   \]

3. **Verification**: 
   - Initially, place a pebble on every cell of one main diagonal:
     \[
     \begin{bmatrix}
     \ast & . & . & . & . \\
     . & \ast & . & . & . \\
     . & . & \ast & . & . \\
     . & . & . & \ast & . \\
     . & . & . & . & \ast \\
     \end{bmatrix}
     \]
   - Then, place pebbles on one half of the other main diagonal:
     \[
     \begin{bmatrix}
     \ast & . & . & . & \ast \\
     . & \ast & . & \ast & . \\
     . & . & \ast & . & . \\
     . & \ast & . & \ast & . \\
     \ast & . & . & . & \ast \\
     \end{bmatrix}
     \]

4. **Optimality Proof**:
   - Suppose there exists a row without any pebbles (call this row $A$) and a row with at most one pebble (call this row $B$). If the pebble in row $B$ is in column $C$, then row $A$, column $C$ and row $B$, column $C$ have the same set of pebbles, which is a contradiction.
   - Therefore, every row and column must have at least one pebble.

5. **Deficient Rows and Columns**:
   - Define a row or column as "deficient" if it contains only one pebble.
   - Let $x$ be the number of deficient rows. Summing through the rows, we have:
     \[
     T \geq x + 2(n - x) = 2n - x \quad (\bigstar)
     \]
   - No two deficient rows can have pebbles in the same column, so there are exactly $x$ special columns.
   - Summing through the columns, we get:
     \[
     T \geq 1 + 2(x - 1) + (n - x) = x + n - 1 \quad (\bigstar\bigstar)
     \]

6. **Combining Inequalities**:
   - Adding $(\bigstar)$ and $(\bigstar\bigstar)$:
     \[
     2T \geq 3n - 1 \implies T \geq \frac{3n - 1}{2} \implies T \geq n + \left\lfloor \frac{n}{2} \right\rfloor
     \]

Thus, the least possible number of pebbles is $n + \left\lfloor \frac{n}{2} \right\rfloor$.

The final answer is $\boxed{2021 + \left\lfloor \frac{2021}{2} \right\rfloor = 3031}$.