Codeforces Round 717 (Div. 2)


A. Tit for Tat
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3 1
3 1 4
2 10
1 0
Output
2 1 5 
0 1 
----------------------------------------------------------------------------------------------------
B. AGAGA XOOORRR
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3
0 2 2
4
2 3 1 10
Output
YES
NO
----------------------------------------------------------------------------------------------------
C. Baby Ehab Partitions Again
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
6 3 9 12
Output
1
2
Input
2
1 2
Output
0
----------------------------------------------------------------------------------------------------
D. Cut
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 3
2 3 10 7 5 14
1 6
2 4
3 5
Output
3
1
2
----------------------------------------------------------------------------------------------------
E. Baby Ehab Plays with Permutations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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