Codeforces Round 426 (Div. 2)


A. The Useless Toy
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
^ >
1
Output
cw
Input
< ^
3
Output
ccw
Input
^ v
6
Output
undefined
----------------------------------------------------------------------------------------------------
B. The Festive Evening
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1
AABBB
Output
NO
Input
5 1
ABABB
Output
YES
----------------------------------------------------------------------------------------------------
C. The Meaningless Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
2 4
75 45
8 8
16 16
247 994
1000000000 1000000
Output
Yes
Yes
Yes
No
No
Yes
----------------------------------------------------------------------------------------------------
D. The Bakery
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
1 2 2 1
Output
2
Input
7 2
1 3 3 1 4 4 4
Output
5
Input
8 3
7 7 8 7 7 8 1 7
Output
6
----------------------------------------------------------------------------------------------------
E. Ever-Hungry Krakozyabra
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 10
Output
9
Input
40 57
Output
17
Input
157 165
Output
9
----------------------------------------------------------------------------------------------------
