If you haven't completed the codechef prefixes december long challange then here are some hint given you csn go throught thease statements.

Problem statement


this Problem Positive prefix taken from CodeChef December long challenge.Let's read Problem statement.

You are given two positive integers N and K, where KN. Find a sequence A1,A2,,AN such that:

  • for each valid iAi is either i or i
  • there are exactly K values of i such that 1iN and A1+A2++Ai>0

If there are multiple solutions, you may print any one of them. It can be proved that at least one solution always exists.

Input

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains two space-separated integers N and K.

Output

For each test case, print a single line containing N space-separated integers A1,A2,,AN.

Constraints

  • 1T1,000
  • 1KN1,000

Subtasks

Subtask #1 (10 points): N10

Subtask #2 (90 points): original constraints

Example Input

3
3 3

Example Output

1 2 3

Resources & hint

 

n=5 k=1  (k<n/2)so one of the solution could be
o/p- -1 2 -3 -4 -5

n=3 k=3 (print same)
o/p- 1 2 3

n=10  k=6 (k>n/2) so one of the solution could be
o/p- -1 2 -3 4 -5 6 -7 8 -9 10
 
explanation:
-1+2  >0
-1+2-3+4  >0
-1+2-3+4-5+6   >0
-1+2-3+4-5+6-7+8  >0
-1+2-3+4-5+6-7+8-9  >0
-1+2-3+4-5+6-7+8+9+10  >0

 For more hint go -> here



Tags:
Codechef december long challange
codechef solutions
codechef positive prefixes solution
codechef hail xor december long challange solutions
Square root of lca conv december codechef long challange solution