#C1991. Taco Array Multiplication

    ID: 45257 Type: Default 1000ms 256MiB

Taco Array Multiplication

Taco Array Multiplication

You are given t test cases. Each test case consists of two lines. The first line contains two integers n and k. The second line contains n space-separated integers representing the array a.

Your task is to compute an array b for each test case such that:

bi=ai×a(i+k)modnb_i = a_i \times a_{(i+k) \bmod n}

where the indexing is 0-based and the modulo operation ensures the index wraps around the array. Print the array b for each test case on a separate line, with each element separated by a single space.

Note: The input is read from standard input and the output is written to standard output.

inputFormat

The first line of input contains a single integer t representing the number of test cases.

For each test case:

  • The first line contains two integers n and k.
  • The second line contains n space-separated integers a0, a1, ..., an-1.

Constraints are such that all arithmetic can be performed within standard 64-bit integer ranges.

outputFormat

For each test case, output one line containing n space-separated integers - the elements of the computed array b.

## sample
1
5 2
1 2 3 4 5
3 8 15 4 10

</p>