Robot "Mag-o-matic" manipulates $101$ glasses, displaced in a row whose positions are numbered from $1$ to $101$. In each glass you can find a ball or not. Mag-o-matic only accepts elementary instructions of the form $(a;b,c)$, which it interprets as
"consider the glass in position $a$: if it contains a ball, then switch the glasses in positions $b$ and $c$ (together with their own content), otherwise move on to the following instruction"
(it means that $a,\,b,\,c$ are integers between $1$ and $101$, with $b$ and $c$ different from each other but not necessarily different from $a$). A $\emph{programme}$ is a finite sequence of elementary instructions, assigned at the beginning, that Mag-o-matic does one by one.
A subset $S\subseteq \{0,\,1,\,2,\dots,\,101\}$ is said to be $\emph{identifiable}$ if there exists a programme which, starting from any initial configuration, produces a final configuration in which the glass in position $1$ contains a ball if and only if the number of glasses containing a ball is an element of $S$.
(a) Prove that the subset $S$ of the odd numbers is identifiable.
(b) Determine all subsets $S$ that are identifiable.
### Part (a): Prove that the subset \( S \) of the odd numbers is identifiable.

1. **Initialization**: We need to show that there exists a program that can identify if the number of balls in the glasses is odd. 

2. **Program Construction**: Consider the following sequence of instructions:
   \[
   (1; 1, 2), (2; 2, 3), (3; 3, 4), \ldots, (100; 100, 101)
   \]
   This sequence of instructions will swap the contents of adjacent glasses if the current glass contains a ball. 

3. **Effect of the Program**: 
   - If the number of balls is odd, after executing the program, the ball in the last glass (position 101) will be swapped an odd number of times, meaning it will end up in position 1.
   - If the number of balls is even, the ball in the last glass will be swapped an even number of times, meaning it will remain in position 101.

4. **Conclusion**: Therefore, the glass in position 1 will contain a ball if and only if the number of balls is odd. This proves that the subset \( S \) of odd numbers is identifiable.

\(\blacksquare\)

### Part (b): Determine all subsets \( S \) that are identifiable.

1. **Identifiable Set Conditions**: Suppose \( S \) is an identifiable set. Then:
   - \( 101 \in S \) because if all glasses contain balls, the program must identify this.
   - \( 0 \notin S \) because if no glasses contain balls, the program must not identify this.

2. **Program Construction for General \( S \)**:
   - We need to show that any set satisfying these two conditions is identifiable.
   - Suppose there are some balls (not zero) in the glasses. We will show a sequence of instructions that orders all the balls in a contiguous sequence from right to left, i.e., at the positions \( 101, 100, \ldots \).

3. **Ordering Balls**:
   - Use the instructions: 
     \[
     (1; 1, n), (2; 2, n), \ldots, (100; 100, n)
     \]
     where \( n = 101 \). This ensures that there is a ball in the 101st place.
   - Repeat the same block of instructions for \( n = 100 \) and so on, until \( n = 2 \). This ensures that the balls are in a contiguous sequence from right to left.

4. **Identifying Specific \( n \)**:
   - To identify \( S = \{n\} \) where \( 1 \leq n < 101 \), arrange the balls right to left.
   - Check that there is a ball at the \( m = (101 - n + 1) \)-th position and there isn't at the \( m-1 = (101 - n) \)-th position.
   - Use the block of instructions:
     \[
     (m; m, 1), (m-1; m, 1)
     \]
     Before these instructions, there is no ball at the 1st position. After execution, there is a ball at the 1st position if and only if there were exactly \( n \) initial balls.

5. **Combining Identifications**:
   - Let \( S \) consist of elements \( 1 \leq n_0 < n_1 < \ldots < n_k = 101 \).
   - First, use a chunk of code that identifies \( n_0 \).
   - Then, work only on positions \( 2, 3, \ldots, 101 \) and use a chunk of code that identifies \( n_1 \) on those positions.
   - Use the instruction \( (2; 2, 1) \).
   - Repeat this action for \( n_2, \ldots, n_{k-1} \).

6. **Final Program**:
   - The obtained program identifies \( S \). If \( n \in S \) and \( n \neq 101 \), put \( n \) balls in the glasses and execute the program. The glass in position 1 will contain a ball if and only if \( n \in S \).
   - If there are 101 balls, the glass in position 1 will also contain a ball.

\(\blacksquare\)

The final answer is \( \boxed{ S } \) such that \( 101 \in S \) and \( 0 \notin S \).