Codeforces Beta Round 55 (Div. 2)


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

Examples
Input
HoUse
Output
house
Input
ViP
Output
VIP
Input
maTRIx
Output
matrix
----------------------------------------------------------------------------------------------------
B. Fortune Telling
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
1
Output
1
Input
1
2
Output
0
Input
3
5 6 7
Output
13
----------------------------------------------------------------------------------------------------
C. Title
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
a?c
Output
IMPOSSIBLE
Input
2
a??a
Output
abba
Input
2
?b?a
Output
abba
----------------------------------------------------------------------------------------------------
D. Team Arrangement
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 4 1 2 6 3 7 8 9
5 6 2
9 3 4
1 7 8
4
Output
2 3 5 6 9 1 7 8 
Input
3
5 4 1 2 6 3 7 8 9
5 6 2
9 3 4
1 7 8
8
Output
1 2 3 4 5 6 7 9 
Input
2
4 1 3 2 5 6
4 6 5
1 2 3
4
Output
5 6 1 2 3 
----------------------------------------------------------------------------------------------------
E. Shortest Path
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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