Codeforces Beta Round 40 (Div. 2)


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

Examples
Input
code
edoc
Output
YES
Input
abb
aba
Output
NO
Input
code
code
Output
NO
----------------------------------------------------------------------------------------------------
B. Martian Dollar
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
3 7
Output
8
Input
4 10
4 3 2 1
Output
10
Input
4 10
4 2 3 1
Output
15
----------------------------------------------------------------------------------------------------
C. Email address
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
vasyaatgmaildotcom
Output
[email protected]
Input
dotdotdotatdotdotat
Output
[email protected]
Input
aatt
Output
a@t
----------------------------------------------------------------------------------------------------
D. Pawn
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 1
123
456
789
Output
16
2
RL
Input
3 3 0
123
456
789
Output
17
3
LR
Input
2 2 10
98
75
Output
-1
----------------------------------------------------------------------------------------------------
E. 3-cycles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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