Codeforces Round 379 (Div. 2)


A. Anton and Danik
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
ADAAAA
Output
Anton
Input
7
DDDAADA
Output
Danik
Input
6
DADADA
Output
Friendship
----------------------------------------------------------------------------------------------------
B. Anton and Digits
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1 3 4
Output
800
Input
1 1 1 1
Output
256
----------------------------------------------------------------------------------------------------
C. Anton and Making Potions
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
20 3 2
10 99
2 4 3
20 10 40
4 15
10 80
Output
20
Input
20 3 2
10 99
2 4 3
200 100 400
4 15
100 800
Output
200
----------------------------------------------------------------------------------------------------
D. Anton and Chess
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 2
R 1 1
B 1 5
Output
YES
Input
2
4 2
R 3 3
B 1 5
Output
NO
----------------------------------------------------------------------------------------------------
E. Anton and Tree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
0 0 0 1 1 0 1 0 0 1 1
1 2
1 3
2 4
2 5
5 6
5 7
3 8
3 9
3 10
9 11
Output
2
Input
4
0 0 0 0
1 2
2 3
3 4
Output
0
----------------------------------------------------------------------------------------------------
F. Anton and School
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
6 8 4 4
16 22 10 10
Output
3 5 1 1 
Input
5
8 25 14 7 16
19 6 9 4 25
Output
-1
----------------------------------------------------------------------------------------------------
