Codeforces Round 435 (Div. 2)


A. Mahmoud and Ehab and the MEX
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
0 4 5 6 7
Output
2
Input
1 0
0
Output
1
Input
5 0
1 2 3 4 5
Output
0
----------------------------------------------------------------------------------------------------
B. Mahmoud and Ehab and the bipartiteness
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
1 3
Output
0
Input
5
1 2
2 3
3 4
4 5
Output
2
----------------------------------------------------------------------------------------------------
C. Mahmoud and Ehab and the xor
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
Output
YES
1 2 4 5 7
Input
3 6
Output
YES
1 2 5
----------------------------------------------------------------------------------------------------
D. Mahmoud and Ehab and the binary string
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
1
3
2
1
0
Output
? 000
? 001
? 010
? 011
? 100
? 101
! 2 1
----------------------------------------------------------------------------------------------------
E. Mahmoud and Ehab and the function
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 6 3
1 2 3 4 5
1 2 3 4 5 6
1 1 10
1 1 -9
1 5 -1
Output
0
9
0
0
----------------------------------------------------------------------------------------------------
F. Mahmoud and Ehab and the final stage
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 9
mahmoud mahmoudbadawy drmahmoud drevil mahmoud
1 1 5
1 1 2
1 2 3
2 3 mahmoud
2 4 mahmoud
2 2 mahmouu
1 1 5
1 2 3
1 1 1
Output
14
14
13
30
12
7
----------------------------------------------------------------------------------------------------
