Let $a_1, a_2, \ldots, a_{2023}$ be nonnegative real numbers such that $a_1 + a_2 + \ldots + a_{2023} = 100$. Let $A = \left \{ (i,j) \mid 1 \leqslant i \leqslant j \leqslant 2023, \, a_ia_j \geqslant 1 \right\}$. Prove that $|A| \leqslant 5050$ and determine when the equality holds.

[i]Proposed by Yunhao Fu[/i]
1. Define the set \( A \) as follows:
   \[
   A = \left\{ (i,j) \mid 1 \leq i \leq j \leq 2023, \, a_i a_j \geq 1 \right\}
   \]
   We need to prove that \( |A| \leq 5050 \) and determine when equality holds.

2. Split \( A \) into two subsets:
   \[
   A_1 = \{(i,i) \mid 1 \leq i \leq 2023, \, a_i^2 \geq 1\}
   \]
   \[
   A_2 = \{(i,j) \mid 1 \leq i < j \leq 2023, \, a_i a_j \geq 1\}
   \]
   Thus, \( A = A_1 \cup A_2 \).

3. Let \( |A_1| = k \). This means there are \( k \) indices \( i \) such that \( a_i \geq 1 \).

4. For \( A_2 \), note that if \( a_i a_j \geq 1 \) for \( i \neq j \), then at least one of \( a_i \) or \( a_j \) must be greater than or equal to 1. Therefore, the number of such pairs is at most \( \binom{k}{2} \).

5. Given \( a_1 + a_2 + \ldots + a_{2023} = 100 \), we use the Cauchy-Schwarz inequality:
   \[
   (a_1 + a_2 + \ldots + a_{2023})^2 \leq 2023 \sum_{i=1}^{2023} a_i^2
   \]
   \[
   100^2 \leq 2023 \sum_{i=1}^{2023} a_i^2
   \]
   \[
   10000 \leq 2023 \sum_{i=1}^{2023} a_i^2
   \]
   \[
   \sum_{i=1}^{2023} a_i^2 \geq \frac{10000}{2023}
   \]

6. Since \( a_i \geq 1 \) for \( k \) indices, we have:
   \[
   \sum_{i=1}^{k} a_i^2 \geq k
   \]
   and for the remaining \( 2023 - k \) indices, \( a_i \) can be less than 1.

7. The total sum of squares is:
   \[
   \sum_{i=1}^{2023} a_i^2 = \sum_{i=1}^{k} a_i^2 + \sum_{i=k+1}^{2023} a_i^2 \geq k
   \]

8. Combining the inequalities, we get:
   \[
   10000 \leq 2023 \sum_{i=1}^{2023} a_i^2 \geq 2023 k
   \]
   \[
   k \leq \frac{10000}{2023}
   \]
   Since \( k \) must be an integer, \( k \leq 100 \).

9. The total number of pairs in \( A \) is:
   \[
   |A| = |A_1| + |A_2| \leq k + \binom{k}{2}
   \]
   \[
   |A| \leq 100 + \binom{100}{2} = 100 + \frac{100 \cdot 99}{2} = 100 + 4950 = 5050
   \]

10. Equality holds if \( k = 100 \) and \( \binom{100}{2} = 4950 \), which implies exactly 100 of the \( a_i \) are 1 and the others are 0.

\(\blacksquare\)

The final answer is \( \boxed{ |A| \leq 5050 } \) and equality holds when exactly 100 of the \( a_i \) are 1 and the others are 0.