Algorithms

e-olimp

1. Simple problem

Program reads two-digit number and prints every digit, separated by a space.
Input
One integer from 10 to 99 including.
Output
Two digits separated by a space.

Simple Problem


2. Median number

Three different numbers a, b, c are given. Print the median number.
Input
Integers a, b, c that do not exceed 1000 by absolute value.
Output Print the median among three numbers.

Median number


3. Sum of squares

Find the sum of the squares of two numbers.
Input
Two integers a and b. The numbers do not exceed 109 by absolute value.
Output Print a single integer a2 + b2

Sum of squares


4. Season

Determine the season name by the month number using the compound conditions.
Input
The number of the month.
Output
For spring months print Spring, for summer - Summer, for autumn - Autumn and for winter - Winter.

Season


5. Even and odd numbers

Given three integers a, b, c. Determine is there among them exist at least one even and at least one odd number.
Input
The numbers a, b, c, not exceeding 10000 by absolute value (numbers can be negative).
Output
Print "YES" or "NO".

Even and odd numbers


6. Perimeter of rectangle

Find the perimeter of rectangle.
Input The integer sides of rectangle a and b (1 ≤ a, b ≤ 1000).
Output
Print the perimeter of rectangle.

Perimeter of regtangle


7. Area of rectangle

Find the area of rectangle.
Input
The integer sides of rectangle a and b (1 ≤ a, b ≤ 1000).
Output
Print the area of rectangle.

Area of rectangle


8. Discount

In the electronics supermarket, according to TV commercials, there is a system of discounts: of the two purchased goods, only the cost of more expensive goods is paid in full, and the other is provided free of charge. What amount is enough to pay for the purchase of three goods, if you know the price of each.
Input
Three natural numbers a, b, c - prices of three goods (1 ≤ a, b, c ≤ 10000).
Output
Purchase price.

Discount


9. Tourist

John is going to a tourist meeting of pupils in his school. In his class he was made responsible for the tents. At home he found 3 tents: the first one weighs a1 kilograms and accommodates b1 people, the second tent weighs a2 kilograms and accommodates b2 people, the third tent weighs a3 kilograms and accommodates b3 people.
There are k pupils in John's class. Find out if John can choose tents such that all people can fit in them. Take into account that the selected tents should weigh no more than w kilograms in total.
Input
The first line contains two integers k and w (1 ≤ k ≤ 15, 1 ≤ w ≤ 30). The second line contains six integers: a1, b1, a2, b2, a3, b3 (1 ≤ a1, a2, a3 ≤ 10, 1 ≤ b1, b2, b3 ≤ 15).
Output
Print YES if it is possible to choose tents as desired, and NO otherwise.

Tourist