Binomial coefficients 5#322

Binomial coefficients 5

3 segundos
64 megabytes
Difícil (≈1650)

Given a positive integer n \leq 40 and a non-negative integer r < 2^n, find all integers from to 2^n - 1 for which the following equality holds:

C_{2^n - 1}^k \bmod 2^n = r

Entrada

The first line contains the number of test cases t~(t < 400). Each of the following lines represents a separate test case and contains two integers and .

Salida

For each test case, print in a separate line the number of suitable values of , followed by these values in increasing order.

Ejemplos

Ejemplo 1

Loading
Loading