Codeforces Round 652 (Div. 2)


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

Examples
Input
4
3
4
12
1000000000
Output
NO
YES
YES
YES
----------------------------------------------------------------------------------------------------
B. AccurateLee
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
10
0001111111
4
0101
8
11001101
10
1110000000
1
1
Output
0001111111
001
01
0
1
----------------------------------------------------------------------------------------------------
C. RationalLee
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 2
1 13 7 17
1 3
6 2
10 10 10 10 11 11
3 3
4 4
1000000000 1000000000 1000000000 1000000000
1 1 1 1
Output
48
42
8000000000
----------------------------------------------------------------------------------------------------
D. TediousLee
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1
2
3
4
5
100
2000000
Output
0
0
4
4
12
990998587
804665184
----------------------------------------------------------------------------------------------------
E. DeadLee
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2 1
1 2
2 3
1 3
Output
ALIVE
3 2 1 
Input
3 2
1 1 0
1 2
1 3
Output
ALIVE
2 1 
Input
4 4
1 2 0 1
1 3
1 2
2 3
2 4
Output
ALIVE
1 3 2 4 
Input
5 5
1 1 1 2 1
3 4
1 2
2 3
4 5
4 5
Output
ALIVE
5 4 1 3 2 
Input
4 10
2 4 1 4
3 2
4 2
4 1
3 1
4 1
1 3
3 2
2 1
3 1
2 4
Output
DEAD
----------------------------------------------------------------------------------------------------
F. BareLee
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 8
1 4
3 10
Output
1 1
Input
4
1 2
2 3
3 4
4 5
Output
0 0
Input
1
1 1
Output
0 1
Input
2
1 9
4 5
Output
0 0
Input
2
1 2
2 8
Output
1 0
Input
6
216986951114298167 235031205335543871
148302405431848579 455670351549314242
506251128322958430 575521452907339082
1 768614336404564650
189336074809158272 622104412002885672
588320087414024192 662540324268197150
Output
1 0
----------------------------------------------------------------------------------------------------
