Threading elements over corresponding elements in the second list

I often need to merge two lists like the following:

$A=\{\{0.1\},\{0.2\},\ldots,\{1\}\}$

$B=\{\{x_1\},\{x_{21},x_{22},x_{23}\},\{x_{31},x_{32},x_{33}\},\ldots,x_N\}$

in a way to ideally obtain a new list such as:

$C = \{\{0.1,x_{1}\}, \{0.2,x_{21}\}, \{0.2,x_{22}\}, \{0.2, x_{23}\},\{0.3,x_{31}\}, \{0.3,x_{32}\}, \{0.3, x_{33}\}, \ldots, \{1, x_N\}\}$

At present I do this by inspecting the lists and manually associating them in the appropriate way. In above example, I would do

Table[{A[[k]],B[[k,1]]},{k,1,N}]

Table[{A[[k]],B[[k,2]]},{k,2,S}]

Table[{A[[k]],B[[k,3]]},{k,2,S}]

where S is the position of the last element that contains three entries in the $B$ list.

These lists are typically very long, and I wonder whether there is a way to do this efficiently.

• A related thread. You'll be particularly interested in the use of Flatten[]. – J. M. will be back soon Jun 4 '15 at 20:29
• Flatten[Tuples /@ (Transpose@{a, b}), 1]? – N.J.Evans Jun 4 '15 at 20:36
• closely related – Kuba Jun 4 '15 at 20:40
• Also Function[Null, {##}, Listable][Flatten@alist, blist]~Flatten~1 – garej Feb 24 '16 at 13:00

I feel like it is a duplicate but I can't find it now. or

Flatten[Tuples /@ Transpose[{alist, blist}], 1]

, 