Codeforces Round 497 (Div. 2)


A. Romaji
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
sumimasen
Output
YES
Input
ninja
Output
YES
Input
codeforces
Output
NO
----------------------------------------------------------------------------------------------------
B. Turn the Rectangles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 4
4 6
3 5
Output
YES
Input
2
3 4
5 5
Output
NO
----------------------------------------------------------------------------------------------------
C. Reorder the Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
10 1 1 1 5 5 3
Output
4
Input
5
1 1 1 1 1
Output
0
----------------------------------------------------------------------------------------------------
D. Pave the Parallelepiped
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 1
1 6 1
2 2 2
100 100 100
Output
1
4
4
165
----------------------------------------------------------------------------------------------------
E. Guess two numbers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
3
2
1
0
Output
4 3
3 4
3 3
1 5
2 4
----------------------------------------------------------------------------------------------------
