[Question]
  [
Given two arrays of non-negative integers \$A = [A\_1,A\_2,\ldots,A\_n]\$ and \$R = [R\_1,R\_2,\ldots,R\_n]\$ which are equal in length, return an array which has the element \$A\_1\$ repeated \$R\_1\$ times, then element \$A\_2\$ repeated \$R\_2\$ times, all the way up to \$A\_n\$.
[Standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are forbidden. As this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the shortest program wins.
### Test Cases
| \$A\$ | \$R\$ | Output |
| --- | --- | --- |
| `[1,2,3]` | `[1,2,3]` | `[1,2,2,3,3,3]` |
| `[6,0,0,6]` | `[5,1,1,0]` | `[6,6,6,6,6,0,0]` |
| `[100,100]` | `[0,0]` | `[]` |
 
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 1 byte
```
x
```
[Try it online!](https://tio.run/##y0rNyan8/7/i/@Hl@o@a1hyd9HDnDCAd@f9/dHS0oY6RjnGsDpQGMqLNdAyA0AzINNUxBEIDsKihgYEOEAOZBiCRWAA "Jelly – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 27 bytes
```
(concat.).zipWith replicate
```
[Try it online!](https://tio.run/##LY0xDsIwDEV3TuGBASS3SkB0okdgZggZ3CilEWmwmkyIsxNMhb6s//QG/4nyw8dYx/5Wd@6ZHJV2374CX0OZYPEcgyhfi88lQw/GGI0HPFr8t4DpUEk6wRNqiVqtVgrlBNXP2M1MIcmLmfgCvIRUYAtmBILhbQYke27WFQv148ZI91wbx/wF "Haskell – Try It Online")
These built-ins have long names, but I haven't found anything shorter.
[Answer]
# [J](http://jsoftware.com/), 1 byte
```
#
```
[Try it online!](https://tio.run/##y/qvpKegnqZga6WgrqCjYKBgBcS6egrOQT5u/5X/a3KlJmfkKxgqGCkYKwBBmgKEDRE2BXIMgepBwmZA2kDBDCIBYirA1BsYgDBEwlLBQsEc2aD/AA "J – Try It Online")
Simple built-in solution: The [copy](https://www.jsoftware.com/help/dictionary/d400.htm) verb.
[Answer]
# [R](https://www.r-project.org/), 3 bytes
```
rep
```
[Try it online!](https://tio.run/##K/qfZvu/KLXgf5qGoZWxDhBrcqVpJGuY6RgAoZmmTrKGqY4hEBpoQiQMDQx0gBgkYQAS/A8A "R – Try It Online")
In [R](https://www.r-project.org/) many functions are vectorized and so is `rep` - it happens to work correctly for this challenge.
[Answer]
# [Raku](https://raku.org/), 12 bytes
```
(*Zxx*).flat
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfQyuqokJLUy8tJ7Hkv7VCcWKlQppGjUq8pkJafpGCho2hgpGCsZ2OApShqQMUM1MwAEIzkKipgiEQGkDEDQ0MFIAYJG4AEvsPAA "Perl 6 – Try It Online")
* `xx` is Raku's replication operator. It produces a list of a number of copies of its left argument given by its right argument. (Very conveniently, though irrelevant for this problem, the left-hand side is re-evaluated the requested number of times, so for example `rand xx 10` will produce a list of ten different random numbers.)
* `Z` is the zip "meta-operator." It can be prepended to any other operator to produce a new operator that zips two lists together using the original operator.
* The asterisks make this a "WhateverCode" expression, a short way of defining anonymous functions. The first and second argument to the function will take the place of the first and second asterisk, respectively.
* `.flat` flattens the list of replicated lists.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~44~~ 43 bytes
−1 thanks to Arnauld.
```
A=>R=>A.flatMap((a,i)=>Array(R[i]).fill(a))
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@9/R1i7I1s5RLy0nscQ3sUBDI1EnUxMoUFSUWKkRFJ0Zq6mXlpmTo5Goqfk/OT@vOD8nVS8nP10jTSPaUMdIxzhWE87Q5EJTYKZjAIRmICWmOoZAaIBFkaGBgQ4QgxQZgBX8BwA "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~42~~ ~~41~~ 40 bytes
```
lambda*a:sum(map(lambda x,*y:x*y,*a),())
```
[Try it online!](https://tio.run/##LcxBCsMgFATQvadwqTILbWgWQk5iXfxSpIFqJE1BT29/SRmGgbeY2o/nVqaRltt4Ub4/yJB/f7LKVNUJssF030yHIQ2l9aAlhOBwwRTx3wgRwgzLmRmvcBx7srMWXGb7oyhE2nZ@7XItknzd13KopDoaf38B "Python 3 – Try It Online")
-1 thanks to Jonathan Allan!
-1 thanks to loopy walt!
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 1 byte
```
/
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///X/9/2qO2CY96@x51NT/qXfOod8uh9caP2iY@6psaHOQMJEM8PIP/GyoYKRgrpCmAaS5TIG2oYADkmwFJAwUzLgMwz9DAAIQB "APL (Dyalog Unicode) – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 3 bytes
```
r9C
```
[Test suite](https://pythtemp.herokuapp.com/?code=r9C&test_suite=1&test_suite_input=%5B1%2C2%2C3%5D%2C%5B1%2C2%2C3%5D%0A%5B5%2C1%2C1%2C0%5D%2C%5B6%2C0%2C0%2C6%5D%0A%5B0%2C0%5D%2C%5B100%2C100%5D&debug=0)
Takes input as `R,A`.
[Answer]
# [Factor](https://factorcode.org/), ~~27~~  25 bytes
```
[ [ <array> ] 2map-flat ]
```
[Try it online!](https://tio.run/##PY29CsIwFIX3PsV5AUsa0UFF3MTFRZxKh0tIIZi24eY6lNJnjzGCw/nh48DpycjE6fm43a8HEDPNES/Lo/Uw0xCct1y/xXknzkYEtiJzYDcKjlW1oIHGFiuAf890l3sDlfmCfU6V/ctVYfitlSpaU4sWp3J9Rgc9UNj0ngRd0sLugjrCeEucPg "Factor – Try It Online")
Takes input as `R A`.
[Answer]
# [Python](https://www.python.org) NumPy, 39 bytes
```
lambda a,b:[0,*b]*1**b[:1]@[(),*zip(a)]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=Lc5RCsIwDAbg952ib7YlQqs4ZDDwHrUPKVIc2K6UDpzgSXwZiN7J25ixEcIPXwLJ65vGcu3j9Pbt-TMUvz3-NjcM7oIMwTVGgXRWaimdabQ9GS5APrrEUdh1_YmtMUbDDvYW1rRQGVODoqoJD6Cp1MJaKaAmVjPZyuc-sDiENLIupD4XhjnjWPk-szsQRhaQLs4IKJqUu1i45zQTYnlimpb8Aw)
Of course, there is also the `repeat` builtin.
### How?
Beside the usual bending over backwards to avoid the explicit numpy import this uses the fact that if we write \$c\_i = [b\_i]\$ then, formally, \$c\_1 a\_1 + c\_2 a\_2 + ... + c\_n a\_n\$ is a dot product. It is mildly tricky to set up an array of equal length sequences because numpy will just create an additional dimension and create an array of scalars. Here we prepend a different length sequence, forcing a ragged array (after using zip to create a list of singleton tuples). To match we must also prepend one value to the length array. The 1\*\*b[:1] factor, mathematically a nop, is there to trigger a coercion cascade to numpy arrays-
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
¨£ẋf
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBUCIsIiIsIsKowqPhuotmIiwiIiwiWzEsMiwzXSxbMSwyLDNdXG5bNiwwLDAsNl0sWzUsMSwxLDBdXG5bMTAwLDEwMF0sWzAsMF0iXQ==)
This two-byte solution should work, but it seems to bork when the length is an array only of zeros: [Try it Online!](https://vyxal.pythonanywhere.com/#WyJBUCIsIiIsIsO44biKIiwiIiwiWzEsMiwzXSxbMSwyLDNdXG5bNSwxLDEsMF0sWzYsMCwwLDZdXG5bMCwwXSxbMTAwLDEwMF0iXQ==)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 2 bytes
```
Y"
```
[Try it online!](https://tio.run/##y00syfn/P1Lp//9oMx0DIDSL5Yo21TEEQoNYAA) Or [verify all test cases](https://tio.run/##y00syfmf8D9S6b@6rq56hEvI/2hDHSMd41guOG2mYwCEZkCWqY4hEBqA5AwMdIAYyALKxQIA).
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 7 bytes
```
repelem
```
It seem's that TIO's version of Octave doesn't have this built-in.
[Answer]
# [Goruby](https://codegolf.stackexchange.com/questions/363/tips-for-golfing-in-ruby/9289?r=SearchResults&s=1%7C19.2033#9289), ~~25~~ 22 bytes
-3 bytes thanks to [G B](https://codegolf.stackexchange.com/users/18535/g-b)
```
->a,b{a.fl{[_1]*b.sh}}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=pVbdbts2FL73U5w6aSy5imKvazEE9dIfpNtuVqAFdjHDEyiJttlSlEBSaWxJfZHd9GJ7hb3L9jQ7JCX5p2nRYTFi0uef53znkL__Ict48_GfQXkCP-RmD4WkvEwpnMMg4UQpeBW_pYkeADx9usr5MloTtYYZVM0AaTdUxrmiAZz-cv36-as318jptgEIxlEmpUvIqF7naZQxpZhYQRbAmARwFiMbQKPSnvE5zJGvKF-GNoIFLKCuZ5ARnaxRO3LGlJf588nCWmBLNHJ2Bs4eQBQpKtIo8rRx5ENVj4lcqbplA8RhzESKxkJ6Q7g3LGSeVLUNwbpJiSY1nH7AyA6J0Az9MCGce6cffOP39MOeUcuwrvyW2tiVckVbgoaro_BMHny4BFUWVDpxkQ66773EtskedDk9zodCmdEogAxXEwmJOe2YLh6JnIvfTioV6jxS4UqVsXcRXvjV0AvHV_4QHsBruqK3RUhVQgrqnZ75TXNhdbNwJWnhST9UudQRQiXNoWZdTpkzaYMyQqiuS0kNpfDOLhXbUh-ePAF2dML2MK7cuVC6B0nyGXAkwVdgIwnAWiNCqx4mGohIQVIMTDh2tKLa021yCFMUfiYZvZYylwEMS8EE04xwDD7t7cFJlTTDwKaYSm_qH51kjemhaJrEsaQ3jGiWi6-ojZFwdbE_81JGCcGAZuBdPQvDq199mM1QZA_zWYggpreeU9tkHeimYVnoHMk261W9rdEyFlTYYmOaM0S_i2vrmwJVtZZ4zF1_CHqroRSc4gDwDvxbQYzB_OqD7PUsF8bmrD2tzbdjsTtwazmYGlMnexJjWnUN9EkHualyB4aO8-rS2mPFWHXDDFuwFUHAF5LdEN0rYSPu1FvjrUjnZ-0RU80fsZyx2bzHTWI290auAkWpFQxPKtJQzvMAARM3ueSpBc5hzEvPIGI6mTjNtnIZFk3UxszoJdtun5fb7WA0ZzMxHn97_3z6KGAPpg8XdS2anTVEKVGgyMa67-ynefR-zbjL3QTsHjaM8qPcoVwpdJvZCdj9gZyVdXl8JiXZ9B5znka2aC10HdVS3uZM7Cu-JFjFF2b7WW0TS98Dw-Gnzn8SGieU7A1QkqxBs4waFSYSe3ldizKj0mBhX_UNAk2ses0LUAVnerDzShxiDNUbjfb62rNHxm4zAyDZYeUc7iDdZ3NjS24Q8kSoAkc2LDnRmopuvYfDJCsIIrFd7wEGmCc4g8yy8ENzrKo2Rl1TmmsKhnZrgj2pDKtxd425QHievOva36CzP43pP1VyM0ZJ-EU1nO6cJNQjoalbR8WGdQZ2TdTV3_21BbHDwUliG2OHtVp4unfeKBmPzBXX0iwunDb29R0e2vrpXO5NESvibhMboBkVFAV3luiRdMexg8KuJoPNPiYOPN0Nyf9U_Pllm8YFjpb5pTHxP6tpKvmlwvWn2o8fIyvMoGvXntfRuzMetMcmi_PuwbZ7yRx6Mw8le_FLmtzUPXKSm7B_1JiJa941d0W638_L2Z-lXp5_99f59ySIKxIueTWPpotxHKp10zjm39cFLOfzafBN8HARQLtZDCz1cTDBz2NDfxRM8TPpODhQA_w3nImhOmMfP7r1Xw)
# [Ruby](https://www.ruby-lang.org/), ~~33~~ 31 bytes
-2 bytes thanks to G B
```
->a,b{a.flat_map{[_1]*b.shift}}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcsGiNNulpSVpuhb7de0SdZKqE_XSchJL4nMTC6qj4w1jtZL0ijMy00pqayGqbroWKKRFRxvqGOkYx-ooQBmxXGBRMx0DIDQDiZvqGAKhAUzG0MBAB4hBMgYgUYhhCxZAaAA)
[Answer]
# [Desmos](https://desmos.com/calculator), 72 bytes
```
f(A,R)=[A[i<=∑_{n=1}^{[1...R.length]}R[n]][1]fori=[0...R.total][2...]]
```
Might post an explanation if I feel like it.
[Try It On Desmos!](https://www.desmos.com/calculator/xnfpltkd6z)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/fnvee6gmm9)
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 4 bytes
```
,/#'
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs9LRV1bn4krT1zBVMARCA2szBQMgNNMEAEY4BM4=)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Takes `R` as the first input.  
A byte or 2 could be saved if output could be a 2D-array but I'm guessing a flat array is one of the points of the challenge.
```
cÈÇYgV
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=Y8jHWWdW&input=WzUsMSwxLDBdCls2LDAsMCw2XQotUQ)
```
cÈÇYgV     :Implicit input of arrays U=R & V=A
c          :Flat map U
 È         :Pass each X at index Y through the following function
  Ç        :  Map the range [0,X)
   YgV     :    Index into V
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 9 bytes
```
z⟨kj₎t⟩ˢc
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/v@rR/BXZWY@a@koezV95elHy///R0WY6BkBoFqsTbapjCIQGsbH/owA "Brachylog – Try It Online")
*-2 bytes thanks to @DLosc*.
*-1 byte thanks to @Kroppeb*
### Explanation
Given inputs `[a1, …, an]` and `[r1, …, rn]`:
```
z         Zip: [[a1,r1], ..., [an, rn]]
 ⟨    ⟩ˢ   For each sublist [ai, ri]
  k         Take [ai]
     t      Take ri
   j₎       Juxtapose the list [ai] ri times to itself
       c  Concatenate into one list
```
[Answer]
# [Julia 1.0](http://julialang.org/), 23 bytes
```
a^b=vcat(fill.(a,b)...)
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/PzEuybYsObFEIy0zJ0dPI1EnSVNPT0/zf7ShjpGOcWwclFaosVMoKMrMK8nJ44o20zEAQjOgpKmOIRAaoEobGhjoADFQ2gBV6v9/AA "Julia 1.0 – Try It Online")
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~59~~ 55 bytes
* -2 bytes thanks to [@jdt](https://codegolf.stackexchange.com/users/41374/jdt).
```
f(*a,*b,n){for(;n;)~--*b?printf("%d ",*a):a++-b++-n--;}
```
[Try it online!](https://tio.run/##bVDLbsMgEDybr1i5agQ2pKSPHErSfojFAduhXSvFUWz30Mj9dXexq/YSaRdmhhnQUqnq6MLbNHmeOZmVMoiLb8/cBCO@lcrK19MZQ@95eltDKjMnnl2eq5I6KGXG6QZDdRzqA@y6vsZ2/f7CGAXYh8PAP1usBbuwhBRACY1ZoCss7IH0ZCPhXsKDJLiVoOfaRrbRhGhZs2T8TZXXUk/kmktHFi/4D4QlQEZ4pAREnYYDjiQ31NoAwg46/Dq0HgLc/cFCW0OWfE8Q89yK@V1/GvqOpwX9BNC47dALE2W@ckVjJazKeaOInQ8Wu00jGdk4/QA "C (clang) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 9 bytes
```
ＩΣＥθＥ§ηκι
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iOSOxKDk_MWfBgqWlJWm6FjcNAooy80o0nBOLSzSCS3M1fBMLNAp1FECUY4lnXkpqhUaGjkK2po5CpiYIWC8pTkouhupeHq2kW5ajFLsxOtpQx0jHOFYHSsdC5AE) Link is to verbose version of code. Explanation:
```
   θ        Array of values
  Ｅ         Map over values
      η     Array of counts
     §      Indexed by
       κ    Current index
    Ｅ       Map over implicit range
        ι   Current value
 Σ          Concatenate arrays
Ｉ           Cast to string
            Implicitly print
```
[Answer]
# [PowerShell Core](https://github.com/PowerShell/PowerShell), 30 bytes
```
param($a,$r)$r|%{,$a[$i++]*$_}
```
[Try it online!](https://tio.run/##hY/RS8MwEMafm7/iGFEal0CrrG9CpeCDL4rzbYwRY8aUdqlJq0Lbv71e2q6PGx@By3c/7r4rza@27qDzXChjdU/3cA9NX0ori5BKTi2jtr1qOJUb@rlcbm/orus7QtKQBDwN0zDmt/yO8bmAscLai7EJS3iESjy44jEqGtCEn4TtGY6jiOPzcDSB2GPQwiOGlOognt@/tKqgIQGGBGrx6b8SLf2BB9Ad@la7Oq/wd41HUYkQmq5WSjuHbngCWsjM8Ufb6s2IJ2eOIDJTlNh0DIT@RnCefAYlweZlndWuMsWYbQsppgsW63Hjwseatnv7YTDkmZGeeh0oe4kaDhnRSzeRoCMd6f8B "PowerShell Core – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
ÅΓ
```
[Try it online!](https://tio.run/##yy9OTMpM/f//cOu5yf//R5vqGAKhQSxXtJmOARCaxQIA "05AB1E – Try It Online")
[Answer]
# Excel (ms365), 60 bytes
```
=IFERROR(TEXTSPLIT(CONCAT(REPT(A1:C1&"|",A2:C2)),"|",,1),"")
```
[![enter image description here](https://i.stack.imgur.com/Jc6ha.png)](https://i.stack.imgur.com/Jc6ha.png)
---
Or, if you don't mind whole rows as input arrays, for 56 bytes:
```
=IFERROR(TEXTSPLIT(CONCAT(REPT(1:1&"|",2:2)),"|",,1),"")
```
[![enter image description here](https://i.stack.imgur.com/M2Pam.png)](https://i.stack.imgur.com/M2Pam.png)
[Answer]
# [simply](https://github.com/ismael-miguel/simply), 87 bytes
The code defines an anonymous function that returns the expected result.  
Nothing special here...
```
fn($A$R){$X=[]each$R as$k=>$v;if$v$X=&array_concat($X&array_fill($A[$k]$v))send$X;}
```
## Usage
Just use it normally...  
Example using the 2nd test case.
```
$fn = fn($A$R){$X=[]each$R as$k=>$v;if$v$X=&array_concat($X&array_fill($A[$k]$v))send$X;}
// should output: 6,6,6,6,6,0,0
echo &join(call $fn([6,0,0,6], [5,1,1,0]), ',');
```
Since it is an anonymous function, using `call` is required.
## Ungolfed
This code does exactly the same as the golfed version.
This is pretty close to pseudo-code.
```
Set $fn to an anonymous function($A, $R)
Begin.
    Define the variable $result = [].
    Loop through $R as value $value key $key.
    Begin.
        If $value then.
        Begin.
            Set $result to the result of calling &array_concat(
                $result,
                &array_fill($A[$key], $value)
            ).
        End.
    End.
    
    Return the $result.
End.
```
A little further from pseudo-code...
```
$fn = fn($A, $R) => {
    $result = [];
    foreach $R as $key => $value {
        if $value {
            $result = &array_concat(
                $result,
                &array_fill($A[$key], $value)
            );
        }
    }
    
    return $result;
};
```
[Answer]
# [I](https://github.com/mlochbaum/ILanguage), 1 byte
```
\
```
[Try it online!](https://tio.run/##y/z/Xz1NXcFKIea/obWRjrGCggKID2ZzmVkb6BjomIFFTK0NdQx1DLgMDQysgRgsZmBt8B8A "I – Try It Online")
Body must be at least 30 characters; you entered 27.
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-p`, 16 bytes
```
{FA({aRLb}MZab)}
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCJZIiwie0ZBKHthUkxifU1aYWIpfSIsIlAoeVsxIDIgM11bMSAyIDNdKVxuUCh5WzYgMCAwIDZdWzUgMSAxIDBdKVxuKHlbMTAwLDEwMF1bMCwwXSkiLCIiLCItcCJd)
```
{FA({aRLb}MZab)}     ; First argument = A = a
                     ; Second argument = B = b
{              }     ; Create a function that...
          MZab       ; maps a and b (as zipped pairs of elements) to...
    {aRLb}           ; a block that repeats the (first argument) by (second argument)...
 FA(          )      ; and flattens the resulting list
                     ; (after which the list is implicitly printed out)
```
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf/blob/master/math_golf.txt), 7 [bytes](https://github.com/maxbergmark/mathgolf/blob/master/code_page.py)
```
mÅaam*─
```
[Try it online.](https://tio.run/##y00syUjPz0n7/z/3cGtiYq7WoykN//9HG@oY6RjHKkBprmgzHQMgNAOKmOoYAqEBUMzQwEAHiIFiQLlYAA)
Or alternatively, with the input-lists swapped:
```
^mæ~Ä_;
```
[Try it online.](https://tio.run/##y00syUjPz0n7/z8u9/CyusMt8db//0cb6hjpGMcqQGmuaFMdQyA0AIqY6RgAoRlQzADMNzQw0AHiWAA)
**Explanation:**
```
m     # Map over the first (implicit) input-list,
 Å    # using two characters as inner code-block:
  a   #  Wrap it into a list
   a  #  Wrap that into a list
      # (e.g. [6,0,0,6] → [[[6]],[[0]],[[0]],[[6]]])
m*    # Repeat each the second (implicit) input amount of times
      # (e.g. [5,1,1,0] and [[[6]],[[0]],[[0]],[[6]]] →
      #  [[[6,6,6,6,6]],[[0]],[[0]],[[]]])
─     # Flatten it to a single list
      # (e.g. [[[6,6,6,6,6]],[[0]],[[0]],[[]]] → [6,6,6,6,6,0,0])
      # (after which the entire stack is output implicitly as result)
```
Unfortunately, using `m*` on lists `[6,0,0,6]` and `[5,1,1,0]` results in `[30,0,0,0]` and lists `[[6],[0],[0],[6]]` and `[5,1,1,0]` results in `[[30],[0],[0],[0]]` (apparently..). Hence the need for two wraps before we can use `m*`.
```
^        # Zip the two (implicit) input-lists together
         # (e.g. [5,1,1,0] and [6,0,0,6] → [[6,5],[0,1],[0,1],[6,0]]
 m       # Map over each inner pair,
  æ      # using 4 characters as inner code-block:
   ~     #  Pop and push the contents of the pair separately to the stack
    Ä    #  Pop the top, and loop that many times:
     _   #   Duplicate
      ;  #  After the inner loop, discard the top item
         # (after which the entire stack is output implicitly as result)
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 1 byte
```
Ṙ
```
[Try it online!](https://tio.run/##yygtzv7//@HOGf///4820THVMYv9H22oY6RjHAsA "Husk – Try It Online")
Built-in solution. Input is arg1=R, arg2=A
---
# [Husk](https://github.com/barbuz/Husk), 5 bytes
```
Σz(↑∞
```
[Try it online!](https://tio.run/##yygtzv7//9ziKo1HbRMfdcz7//9/tKGOkY5x7P9oEx1THbNYAA "Husk – Try It Online")
Roll-your-own solution avoiding `Ṙ` built-in.
```
Σz(↑∞
 z     # zip the two inputs together with 
  (    #   combination of functions:
    ∞  #   make an infinite list of copies of arg1
   ↑   #   and then take arg2 elements from it;
Σ      # finally, flatten the output
```
]