IPSC Logo

Internet Problem Solving Contest

IPSC 2013

Problem Q – Quite the cheater!

Your physics lab report is due tomorrow. However, you had no time to do the required experiments, as you spent all your time practicing for the IPSC. Therefore you decided to write a fake report quickly. Here is how to get a good grade for your lab report:

Problem specification

You are given two integers: the desired mean μ and the desired variance v.

Pick a number of measurements n and the values of those measurements a1,,an such that the mean of those values is exactly μ and their variance is (easy subproblem: at least v / hard subproblem: exactly v). Formally, your values must satisfy the following conditions:

Input specification

The first line of the input file contains an integer t specifying the number of test cases. Each test case is preceded by a blank line.

Each test case contains a single line with two integers: μ and v.

You may assume that t 100, |μ|≤ 106, and 0 v 109.

Output specification

For each test case, output two lines. The first line should contain the number of values n, the second line a space-separated list of values a1,,an. Any valid solution will be accepted.

Example

input
1

47 2080
output
11
34 -7 102 117 16 8 0 130 36 34 47

This would be a correct solution to both subproblems. I.e., this sequence of 11 values has mean exactly 47 and variance exactly 2080.