Codeforces Round 319 (Div. 2)


A. Multiplication Table
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 5
Output
2
Input
6 12
Output
4
Input
5 13
Output
0
----------------------------------------------------------------------------------------------------
B. Modulo Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5
1 2 3
Output
YES
Input
1 6
5
Output
NO
Input
4 6
3 1 1 3
Output
YES
Input
6 6
5 5 5 5 5 5
Output
YES
----------------------------------------------------------------------------------------------------
C. Vasya and Petya's Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
Output
3
2 4 3 
Input
6
Output
4
2 4 3 5 
----------------------------------------------------------------------------------------------------
D. Invariance of Tree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4 3 2 1
Output
YES
4 1
4 2
1 3
Input
3
3 1 2
Output
NO
----------------------------------------------------------------------------------------------------
E. Points on Plane
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
0 7
8 10
3 4
5 0
9 12
Output
4 3 1 2 5 
----------------------------------------------------------------------------------------------------
