30. There are 111 lamps, and each lamp has its own switch. It is allowed to simultaneously switch 13 of them. At the initial moment, some lamps are on, and some are off.

a) Is it possible to turn off all the lamps?

b) How many switches will be required for this if all the lamps were initially on?
30. Let's show that we can always turn off all the lamps. We can assume that initially more than 13 lamps were on (otherwise, we would have turned on 13 lamps from the extinguished ones). Moreover, for the same reason, we can assume that the number of extinguished lamps is more than 6. We will select 13 lamps such that 7 are on and 6 are off. We will perform the switch. As a result, the number of burning lamps will decrease by one. By repeating this procedure several times, we will achieve that exactly 13 lamps are burning and we will turn them off with one switch.

Of course, this method is not the most economical. Let's ensure that in task b) 9 switches are sufficient. (8 switches are not enough. Why?) We can act as follows: first, turn off 13 lamps, then turn off another 7 (for which we will switch 10 burning and 3 extinguished lamps). After two stages, 91 burning lamps will remain, which can be turned off with seven switches.