## Codeforces-1000B B Light It Up

Recently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment 0 and turn power off at moment M. Moreover, the lamp allows you to set a program of switching its state (states are “lights on” and “lights off”). Unfortunately, some program is already installed into the lamp.

## Codeforces-1000A Codehorses T-shirts

Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.

The valid sizes of T-shirts are either “M” or from 0 to 3 “X” followed by “S” or “L”. For example, sizes “M”“XXS”“L”“XXXL” are valid and “XM”“Z”“XXXXL” are not.

## Codeforces-1004B. Sonya and Exhibition

Sonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.

The country where Sonya lives is an endless line. There is a city in each integer coordinate on this line. She has nn hotels, where the ii-th hotel is located in the city with coordinate xi. Sonya is a smart girl, so she does not open two or more hotels in the same city.

Sonya understands that her business needs to be expanded by opening new hotels, so she decides to build one more. She wants to make the minimum distance from this hotel to all others to be equal to dd. The girl understands that there are many possible locations to construct such a hotel. Thus she wants to know the number of possible coordinates of the cities where she can build a new hotel.

Because Sonya is lounging in a jacuzzi in one of her hotels, she is asking you to find the number of cities where she can build a new hotel so that the minimum distance from the original nn hotels to the new one is equal to d.

## Codeforces round 493 div2 B.Cutting

There are a lot of things which could be cut — trees, paper, “the rope”. In this problem you are going to cut a sequence of integers.

There is a sequence of integers, which contains the equal number of even and odd numbers. Given a limited budget, you need to make maximum possible number of cuts such that each resulting segment will have the same number of odd and even integers.

Cuts separate a sequence to continuous (contiguous) segments. You may think about each cut as a break between two adjacent elements in a sequence. So after cutting each element belongs to exactly one segment. Say, [4,1,2,3,4,5,4,4,5,5][4,1,2,3,4,5,4,4,5,5]  two cuts →→[4,1|2,3,4,5|4,4,5,5][4,1|2,3,4,5|4,4,5,5].  On each segment the number of even elements should be equal to the number of odd elements.

The cost of the cut between xx and yy numbers is |xy|bitcoins. Find the maximum possible number of cuts that can be made while spending no more than Bbitcoins.

## CodeForces – 1013A A. Piles With Stones

There is a beautiful garden of stones in Innopolis.

Its most beautiful place is the nn piles with stones numbered from 11 to nn.

EJOI participants have visited this place twice.

When they first visited it, the number of stones in piles was x1,x2,…,xnx1,x2,…,xn, correspondingly. One of the participants wrote down this sequence in a notebook.

They visited it again the following day, and the number of stones in piles was equal to y1,y2,…,yny1,y2,…,yn. One of the participants also wrote it down in a notebook.

It is well known that every member of the EJOI jury during the night either sits in the room 108108 or comes to the place with stones. Each jury member who comes there either takes one stone for himself or moves one stone from one pile to another. We can assume that there is an unlimited number of jury members. No one except the jury goes to the place with stones at night.

Participants want to know whether their notes can be correct or they are sure to have made a mistake.

## CodeForces – 1011B Planning The Expedition

Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant.

The warehouse has mm daily food packages. Each package has some food type aiai.

Each participant must eat exactly one food package each day. Due to extreme loads, each participant must eat the same food type throughout the expedition. Different participants may eat different (or the same) types of food.

Formally, for each participant jj Natasha should select his food type bjbj and each day jj-th participant will eat one food package of type bjbj. The values bjbj for different participants may be different.

What is the maximum possible number of days the expedition can last, following the requirements above?