[Question]
  [
# Introduction
In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time.
For example, say your target's password is `89097`, the system may prompt them to enter the 2nd, 4th and 5th digit:
`997`
Or it might prompt them to enter the 1st, 3rd and 5th digit:
`807`
All you know is that your target entered the digits in order, *but you don't know which position they belong to in the actual password*. All you know is there are two 9s, which must come before 7; and that 8 comes before 0, and 0 before 7. Therefore, there are six possible passwords:
```
80997
89097
89907
98097
98907
99807
```
The keylogger in your target's computer has been collecting password inputs for months now, so let's hack in!
# Challenge
Given a list of three-digit inputs, output all the possible passwords that are valid for all inputs. In order to reduce computational complexity and to keep the amount of possible results low, the password is guaranteed to be numerical and have a fixed size of 5. The digits in every input are in order: if it's 123, the target typed 1 first, then 2, then 3.
# Input/Output examples
```
|----------------------|--------------------------------------------|
|         Input        |                   Output                   |
|----------------------|--------------------------------------------|
| [320, 723, 730]      | [37230, 72320, 73203, 73230]               |
| [374, 842]           | [37842, 38742, 83742]                      |
| [010, 103, 301]      | [30103]                                    |
| [123, 124, 125, 235] | [12345, 12354, 12435]                      |
| [239, 944]           | [23944]                                    |
| [111, 120]           | [11201, 11120, 11210, 12011, 12110, 12101] |
| [456, 789]           | []                                         |
| [756, 586]           | [07586, 17586, 27586, 37586, 47586, 57586, 57856, 58756, 67586, 70586, 71586, 72586, 73586, 74586, 75086, 75186, 75286, 75386, 75486, 75586, 75686, 75786, 75806, 75816, 75826, 75836, 75846, 75856, 75860, 75861, 75862, 75863, 75864, 75865, 75866, 75867, 75868, 75869, 75876, 75886, 75896, 75986, 76586, 77586, 78586, 79586, 87586, 97586] |
| [123]                | [00123, 01023, 01123, 01203, 01213, 01223, 01230, 01231, 01232, 01233, 01234, 01235, 01236, 01237, 01238, 01239, 01243, 01253, 01263, 01273, 01283, 01293, 01323, 01423, 01523, 01623, 01723, 01823, 01923, 02123, 03123, 04123, 05123, 06123, 07123, 08123, 09123, 10023, 10123, 10203, 10213, 10223, 10230, 10231, 10232, 10233, 10234, 10235, 10236, 10237, 10238, 10239, 10243, 10253, 10263, 10273, 10283, 10293, 10323, 10423, 10523, 10623, 10723, 10823, 10923, 11023, 11123, 11203, 11213, 11223, 11230, 11231, 11232, 11233, 11234, 11235, 11236, 11237, 11238, 11239, 11243, 11253, 11263, 11273, 11283, 11293, 11323, 11423, 11523, 11623, 11723, 11823, 11923, 12003, 12013, 12023, 12030, 12031, 12032, 12033, 12034, 12035, 12036, 12037, 12038, 12039, 12043, 12053, 12063, 12073, 12083, 12093, 12103, 12113, 12123, 12130, 12131, 12132, 12133, 12134, 12135, 12136, 12137, 12138, 12139, 12143, 12153, 12163, 12173, 12183, 12193, 12203, 12213, 12223, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12243, 12253, 12263, 12273, 12283, 12293, 12300, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12346, 12347, 12348, 12349, 12350, 12351, 12352, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12403, 12413, 12423, 12430, 12431, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12443, 12453, 12463, 12473, 12483, 12493, 12503, 12513, 12523, 12530, 12531, 12532, 12533, 12534, 12535, 12536, 12537, 12538, 12539, 12543, 12553, 12563, 12573, 12583, 12593, 12603, 12613, 12623, 12630, 12631, 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12643, 12653, 12663, 12673, 12683, 12693, 12703, 12713, 12723, 12730, 12731, 12732, 12733, 12734, 12735, 12736, 12737, 12738, 12739, 12743, 12753, 12763, 12773, 12783, 12793, 12803, 12813, 12823, 12830, 12831, 12832, 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12843, 12853, 12863, 12873, 12883, 12893, 12903, 12913, 12923, 12930, 12931, 12932, 12933, 12934, 12935, 12936, 12937, 12938, 12939, 12943, 12953, 12963, 12973, 12983, 12993, 13023, 13123, 13203, 13213, 13223, 13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13243, 13253, 13263, 13273, 13283, 13293, 13323, 13423, 13523, 13623, 13723, 13823, 13923, 14023, 14123, 14203, 14213, 14223, 14230, 14231, 14232, 14233, 14234, 14235, 14236, 14237, 14238, 14239, 14243, 14253, 14263, 14273, 14283, 14293, 14323, 14423, 14523, 14623, 14723, 14823, 14923, 15023, 15123, 15203, 15213, 15223, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15243, 15253, 15263, 15273, 15283, 15293, 15323, 15423, 15523, 15623, 15723, 15823, 15923, 16023, 16123, 16203, 16213, 16223, 16230, 16231, 16232, 16233, 16234, 16235, 16236, 16237, 16238, 16239, 16243, 16253, 16263, 16273, 16283, 16293, 16323, 16423, 16523, 16623, 16723, 16823, 16923, 17023, 17123, 17203, 17213, 17223, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17239, 17243, 17253, 17263, 17273, 17283, 17293, 17323, 17423, 17523, 17623, 17723, 17823, 17923, 18023, 18123, 18203, 18213, 18223, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18243, 18253, 18263, 18273, 18283, 18293, 18323, 18423, 18523, 18623, 18723, 18823, 18923, 19023, 19123, 19203, 19213, 19223, 19230, 19231, 19232, 19233, 19234, 19235, 19236, 19237, 19238, 19239, 19243, 19253, 19263, 19273, 19283, 19293, 19323, 19423, 19523, 19623, 19723, 19823, 19923, 20123, 21023, 21123, 21203, 21213, 21223, 21230, 21231, 21232, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21243, 21253, 21263, 21273, 21283, 21293, 21323, 21423, 21523, 21623, 21723, 21823, 21923, 22123, 23123, 24123, 25123, 26123, 27123, 28123, 29123, 30123, 31023, 31123, 31203, 31213, 31223, 31230, 31231, 31232, 31233, 31234, 31235, 31236, 31237, 31238, 31239, 31243, 31253, 31263, 31273, 31283, 31293, 31323, 31423, 31523, 31623, 31723, 31823, 31923, 32123, 33123, 34123, 35123, 36123, 37123, 38123, 39123, 40123, 41023, 41123, 41203, 41213, 41223, 41230, 41231, 41232, 41233, 41234, 41235, 41236, 41237, 41238, 41239, 41243, 41253, 41263, 41273, 41283, 41293, 41323, 41423, 41523, 41623, 41723, 41823, 41923, 42123, 43123, 44123, 45123, 46123, 47123, 48123, 49123, 50123, 51023, 51123, 51203, 51213, 51223, 51230, 51231, 51232, 51233, 51234, 51235, 51236, 51237, 51238, 51239, 51243, 51253, 51263, 51273, 51283, 51293, 51323, 51423, 51523, 51623, 51723, 51823, 51923, 52123, 53123, 54123, 55123, 56123, 57123, 58123, 59123, 60123, 61023, 61123, 61203, 61213, 61223, 61230, 61231, 61232, 61233, 61234, 61235, 61236, 61237, 61238, 61239, 61243, 61253, 61263, 61273, 61283, 61293, 61323, 61423, 61523, 61623, 61723, 61823, 61923, 62123, 63123, 64123, 65123, 66123, 67123, 68123, 69123, 70123, 71023, 71123, 71203, 71213, 71223, 71230, 71231, 71232, 71233, 71234, 71235, 71236, 71237, 71238, 71239, 71243, 71253, 71263, 71273, 71283, 71293, 71323, 71423, 71523, 71623, 71723, 71823, 71923, 72123, 73123, 74123, 75123, 76123, 77123, 78123, 79123, 80123, 81023, 81123, 81203, 81213, 81223, 81230, 81231, 81232, 81233, 81234, 81235, 81236, 81237, 81238, 81239, 81243, 81253, 81263, 81273, 81283, 81293, 81323, 81423, 81523, 81623, 81723, 81823, 81923, 82123, 83123, 84123, 85123, 86123, 87123, 88123, 89123, 90123, 91023, 91123, 91203, 91213, 91223, 91230, 91231, 91232, 91233, 91234, 91235, 91236, 91237, 91238, 91239, 91243, 91253, 91263, 91273, 91283, 91293, 91323, 91423, 91523, 91623, 91723, 91823, 91923, 92123, 93123, 94123, 95123, 96123, 97123, 98123, 99123] |
|----------------------|--------------------------------------------|
```
---
# Rules
* Input is guaranteed non-empty.
* Leading and trailing zeros matter: `01234` is different from `12340`, and `1234` doesn't crack either password. Think of how real passwords work!
* [Standard I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods) apply.
* No [standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default).
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes wins. Non-codegolfing languages are welcome!
  
[Answer]
# Python, 100 bytes
```
lambda e,d='%05d':[d%i for i in range(10**5)if all(re.search('.*'.join(x),d%i)for x in e)]
import re
```
[Try it online!](https://tio.run/##PcuxCoMwEADQvV9xi1wiQaLgIvgl1iFtLvWKJuF0sF@f1qXrg5c/x5JiV8J4L6vbHt4BGT9iZXuPw@QrhpAEGDiCuPgi1dq67jUHcOuqhJqdnDwXhU2NzTtxVKc2v6avdl6N9HzjLSc5QKj8OagJrbVoANvO4qwHyMLxgLN8AQ "Python 2 – Try It Online")
Works in Python 2 as well as Python 3.
(**97 bytes** in Python 3.8:)
```
lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
import re
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~11~~ 9 bytes
```
žh5ãʒæIåP
```
[Try it online!](https://tio.run/##yy9OTMpM/f//6L4M08OLT006vMzz8NKA//@jzU3NdEwtzGIB "05AB1E – Try It Online")
**Explanation**
```
žh          # push 0123456789
  5ã        # 5 times cartesian product
    ʒ       # filter, keep only values are true under:
     æ      # powerset of value
      Iå    # check if each of the input values are in this list
        P   # product
```
[Answer]
# JavaScript (ES6), 88 bytes
Prints the results with `alert()`.
```
a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}
```
[Try it online!](https://tio.run/##bZLfboIwFMbvfYpeSbtB7V@BEHwRQmLD6qYyWIAYF@Ozs1OaMDVw0V97vu98p2k4mYvpq@74M0RN@2HHQz6afHc7tB0@503Orc6aKMqIofZiu198zXe4z3FxLt8bQvv6WFkcaULotxmqL1xQSq8lPbXHZk/f9oSs16a23YB7ch@nHcpR1TZ9W1tat5/ZarC9qxmU79DtUcJmisFBiAJCMnTABtZHAxzvqykAF4EUzDljISdIFpTIfwRtNqiQoLAQwSocYJUTJCvniFi53kSJufclAqQQySR2SMAu5l7Gp/GcTeMl46/jwSBnN/e35EJ5aAchdVB6N@hKhwiglYOSeu4VMnXuVKnlW4Ku1P8kzv0ItuzmoHAY4egguAPUXFFwf@KMz4FKb6cHTtLlwNkYe6NOtstGFoME6R7w34QodfunR3rpfA5g4AgRPKyDD0ihVI5/ "JavaScript (Node.js) – Try It Online")
### Commented
```
a => {                    // a[] = input array of 3-character strings
  for(k = n = 1e5; n--;)  // initialize k to 100000; for n = 99999 to 0:
    a.every(x =>          // for each string x = 'XYZ' in a[]:
      ( s =               //   define s as the concatenation of
          ([k] + n)       //   '100000' and n; e.g. '100000' + 1337 -> '1000001337'
          .slice(-5)      //   keep the last 5 digits; e.g. '01337'
      ).match(            //   test whether this string is matching
        [...x].join`.*`   //   the pattern /X.*Y.*Z/
      )                   //
    ) &&                  // end of every(); if all tests were successful:
      alert(s)            //   output s
}                         //
```
[Answer]
## Haskell, ~~81~~ ~~80~~ ~~78~~ 76 bytes
```
f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]
```
The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.
[Try it online!](https://tio.run/##RY5dCoMwEITfe4olFDRgJX9WLdob9AQSMLRKpVGDCvWhd7dNLLovAzPf7O5Tja9K62WpYc4L8zHZqVXm5l8Kj3ph6KWexIjYQYHS2i8rXbWlf@@7u5rCdz88xux4XSsIEDYYz3JpVdNBDtYG3wxNN0FYYygOAFAgzn7LAMWMO@EEyeCfxMJaiWCbRaiDKXEwJ3RL6NqnTKwSWWE82gDGU2ulQuwdSld4vymis3sjSZGUsHwB "Haskell – Try It Online")
Edit: -1 byte thanks to @xnor, ~~-2~~ -4 bytes thanks to @H.PWiz
[Answer]
# [Python 2](https://docs.python.org/2/), 96 bytes
```
l=input()
n=1e5
while n:
 n-=1;s='%05d'%n;t={''}
 for c in s:t|={x+c for x in t}
 if l<t:print s
```
[Try it online!](https://tio.run/##PY3bCoMwEETf8xVBkLS0hWwuXpuvsUoDEkVTarF@u01W6MssZ2aYHT/@OTixv5@2bylU7dI2SZLsvbFufPnTmTgDrSZH7ipC3c1APRuWcv1gqau9WRnbCO2GiTbUOjpX/mvW5dKgtUTLh9x2tL/7apys83Te8ZL4amVScHZluZBRJQ9rwctVoEIJJA6xATw2JAf0APsgFKoOKqTGRMgyUKnU0QPAxrGrdBa/FCVSjqSL7L@4/QA "Python 2 – Try It Online")
Takes input as a set of strings.
---
# [Python 3](https://docs.python.org/3/), 98 bytes
```
f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']
```
[Try it online!](https://tio.run/##LU5da4QwEHw2vyJvm7QW8nlqIL9E8mCtcoE0Jxfb3v16u7FlYZjdGWZ2e@7XW9bHsfo0fb5/TDS1xQO4KT9Z4rc73e4x76zwuNIyGheWVJZxZeMDx8ng/ezCir4HjZmm0JbXmdd9xh2EVNrYS9cPEI6fa0wLlY40yadYdrZ8T4nFvH3tjHNOmhUbSfNXCG/wYvkBWglooVO6ohZAQHcGeW8UciGrKkVVtZB4kadTKnOiRVTa4l3pAflgTPVIeao1Db@ryfggge7ktr/85/wC "Python 3 – Try It Online")
Recursively tries building every five-digit number string in `s`, tracking the subsequences in `l` still remaining to be hit. If all are empty by the end, prints the result.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 54 bytes
```
->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}
```
[Try it online!](https://tio.run/##RY3LCoMwEEX3@QpJobbBpnn6KFg/RFykoriwIGpBSdJft8QIXV3OzJm54@e1bm2@3Z5KXwqCJMZFhuQVT03f1LM2i1FY9X2hzWqW/Hs/6RWFGIX2bq3dSlBCzgiMApgwvgcnsIrcOBGOU8E8E7prlOwaJ9SPqT@jTPiQLhiXfst45jgT4rAp9dpRImS8l6aZ58SzTOP/9wpUuFF1p81shqAtZ/xWQ3B@1J0ap8oCsP0A "Ruby – Try It Online")
Takes input as an arrray of character arrays.
[Answer]
# Pyth, 11 bytes
```
f<QyT^s`MT5
```
Takes input as a set of strings.  
[Try it here](http://pyth.herokuapp.com/?code=f%3CQyT%5Es%60MT5&input=%7B%22123%22%2C%20%22124%22%2C%20%22125%22%2C%20%22235%22%7D&debug=0)
### Explanation
```
f<QyT^s`MT5
      s`MT      Take the digits as a string.
     ^    5     Take the Cartesian product with itself 5 times.
f   T           Filter the ones...
 <Qy            ... where the input is a subset of the power set.
```
[Answer]
# [R](https://www.r-project.org/), ~~80~~ 81 bytes
```
Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,substr(1e6:199999,2,6),v=T))
```
[Try it online!](https://tio.run/##FclZCoQwEEXRrUh9VclDSByghd6EuAGNhTSIhAxCrz7qhfN1QymTbtkp/86kIapLOBbvjz/vMa9MBGpqQnTLySASwR7U43kxBTY6jObzBotBcH1nkWJsWxnbPfrKtn25AQ "R – Try It Online")
Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!
Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).
Thanks to @RobinRyder for saving a byte!
[Try it online!](https://tio.run/##FctRCkBAEIDhq2hKzWiSXfaBcgm5ALtDStp2UU6/@Ot7/ENKg7jLCm7HKSGKPXmfvN8fXOM1IwBDWQBHOx3IAES8BvEcffiGBSGvjAOuuvaP@O5HoqR0nSndfEyma5Ne "R – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
9Żṗ5ŒPiⱮẠɗƇ
```
[Try it online!](https://tio.run/##y0rNyan8/9/y6O6HO6ebHp0UkPlo47qHuxacnH6s/f///9HRxjoK5joKJrE6CtEWQFpHwSg2FgA "Jelly – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 53 bytes
```
~(`
.$*
m`^
G`
^
K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
"
$$"
```
[Try it online!](https://tio.run/##K0otycxLNPz/v04jgUtPRYsrNyGOyz2BK47LO@HQNlNt1QQVlUPbDJQMlYyUjJVMlEyVzJTMlSyULA9t41LiUlFR@v/f2MiAy9zImMvc2AAA "Retina – Try It Online") Explanation:
```
~(`
```
After executing the script, take the result as a new script, and execute that, too.
```
.$*
```
Insert `.*` everywhere. This results in `.*3.*2.*0.*` although we only need `3.*2.*0`, not that it matters.
```
m`^
G`
```
Insert a `G`` at the start of each line. This turns it into a Retina Grep command.
```
^
K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
"
$$"
```
Prefix two more Retina commands. The resulting script will therefore look something like this:
```
K`
```
Clear the buffer (which contains the original input).
```
5+
```
Repeat 5 times...
```
%`$
```
... append to each line...
```
0$"1$"2$"3$"4$"5$"6$"7$"8$"9
```
... the digit `0`, then a copy of the line, then the digit `1`, etc. until `9`. This means that after `n` loops you will have all `n`-digit numbers.
```
G`.*3.*2.*0.*
G`.*7.*2.*3.*
G`.*7.*3.*0.*
```
Filter out the possible numbers based on the input.
[Answer]
# [Perl 5](https://www.perl.org/) `-MList::Util=all -a`, 70 bytes
```
map{$t=sprintf'%05d',$_;(all{$t=~/$_/}map s//.*/gr,@F)&&say$t}0..99999
```
[Try it online!](https://tio.run/##K0gtyjH9/z83saBapcS2uKAoM68kTV3VwDRFXUcl3lojMScHJFGnrxKvXwtUpVCsr6@npZ9epOPgpqmmVpxYqVJSa6CnZwkC//8bGFsqWJqY/MsvKMnMzyv@r@trqmdgaACkfTKLS6ysQksyc2yBZv7XTQQA "Perl 5 – Try It Online")
### Old Approach: [Perl 5](https://www.perl.org/) `-a`, ~~80~~ 77 bytes
*Credit to @NahuelFouilleul for -2 bytes*
```
map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){$t+=/$b/}$t-@F||say}0..99999
```
[Try it online!](https://tio.run/##K0gtyjH9/z83saC6uKZGQ6XE1kCzQsNUt1JfXz9ZsybVOi2/SCVJAyivUKyvr6eln16k4@CmWa1Som2rr5KkX6tSouvgVlNTnFhZa6CnZwkC//8bGVsqWJqY/MsvKMnMzyv@r@trqmdgaPBfNxEA "Perl 5 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~79~~ 77 bytes
```
->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}
```
[Try it online!](https://tio.run/##Lc/LTsMwEAXQPV9hCUWToOL6/VgEPqR00aYpihSkilJRlJhfD/E1m2PP9Vgef96OP8u5fVueX@5TLTjnsrcN/zhcpnmYqRL2RNWQ@LUf@@4rZ3d@GMfXae7mof3dPk4df7/ejjXRhvgTNWmbUlou7LzbkVaCNoy80li0oP3@oRx563Jmg1sz1ras@q6FX0smoYIaGmj/DXY1rPeZQ@IFlFBBDQ20AkqooIYGlh4HPQwCSqighgZa6ASUUEENDbSwdHoYYMx65OWtmI157zBJ@VGAMRuQxGyz/AE "Ruby – Try It Online")
Input is an array of strings.
Here's a more readable version of the same code:
```
def f(codes)
  (0...10**5).map{|i| '%05d'%i}.select do |i|
    codes.all? do |code|
      i =~ Regexp.new(code.chars.join('.*'))
    end
  end
end
```
[Answer]
# PHP 128 bytes
```
for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
",$i-1))||$k=$argc;
```
or
```
for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
",$i)))break;
```
take input from command line arguments. Run with `-nr` or [try them online](http://sandbox.onlinephpfunctions.com/code/b914abb3a3b0adb98b54e1727d1f03652957c66c).
[Answer]
# [J](http://jsoftware.com/), 52 bytes
```
(>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]
```
[Try it online!](https://tio.run/##jdhPqxzHFYbxvT5FIwXfexP7uqvqnPpzjYMh4FVW2QrFi8TGDgETQlYBfXWl69eGICcGC/S4qZkz531O99SU9bcPr58fvju@fDkejk@P83i5/n72fPzhT3/8@sPj7z/99xd/fon3PzyX8@nx7Zv37377@VffPr@uj49v3rcvf/f56/L05uWH51af3rz@5ihvn959eHr1z@9//Nff//rNt/84vnw@3r4c3/7l@x@Px3fHZy@fPH7@8v7p@O6rt0@fPD6@fn59fvH8TXn66vHhePjk06enV69ePbR6HqO2Y7Tz4fjvRz20a9Er@/UL@x3XysNVMeKYUX/27mvlaHNcnNcbrlf/759XD2c5j3J9WjvLx59wvdB@oernn1GuvKXG9TeP2vKjz7lei7xeablfj/3qL3xKbetYER9VX2t75delKOXq8PHUyrVwre7/XKzb9VrY7yuuy7Z@dd@h88jjN8fDw9N1p47vjofIfoy5flX3/00zruqc/aM057hWjoIVGwbmT5wqd323Mk4sWLFhYJ5YsGLDwPs9HQfOEwtWbBiY2E8sWLFhYOL9zoET1@awfvdam2tfd0luo4lrc1pZw6w8Sh@P7NwP1/Us4n29H/6LBe@V66uxWbDivR6Y2HHgxLUZ3pnYceDEtdl0CUzsOHDi2qwSNgxM7Dhw4vKlOU@8r7fXxYL3SjuxYMV7PTCx48CJazO8M7HjwIlrs@kSmNhx4MTtVcy/mH8x/2L@xfyL@RfzL@ZfzL@YfzH/Yv7F/Iv5F/Mv5l/Mv5h/Mf9i/sX8i/kX8y/mX8y/mH8x/2L@V7QTC94rzZe@2Rx2tov3emBix4ET12Z4Z2LHgRN3tlp0LDreG2HRsehYdCztXg9M7Dhw4u5YdCw6Fh2LjkXHoqP5V/Ov5l/Nv5p/Nf9q/tX8q/lX86/mX82/mn81/2r@1fyr@Vfzr@Z/ffyJBSve64E2@LPjwIn785uNttl0ry8Gqi1qi9qitqgtaovaqraqrWr5Nj82raqtaqvaqraqNZNmJs1Mmpk0M2lm0sykmUkzk2YmLdSG2lBrSi3U3j9ooTbUhtpQm2pTbao12/sHsOX9Y6g21abaVNvVdrVdrTvSutqutqvtarvarnaoHWqHWvdxHw821Q61Q@1QO9ROtVPtVOvut6l2qp1qp9qpdqpdapfapfZ@ZpbapXapXWqX2rVrw1MUnoe4DxHuWrhr4a5Fu9d/Oj5gx4ETfZp7FKYd5hYmEFxCqtQxdbSTXA/@iQUr3usONDqmjqlj6pg6po6pY@qYOqaOqWPXseto17q@ZCcWrHivByZ2HDhxd@w6dh27jl3HrmPXceg4dLRDXl/oEwtWvNcDEzsOnLg7Dh2HjkPHoePQceg4dZw62o2vzePEghXv9cDEjgMn7o5Tx6nj1HHqOHWcOi4dl473zr90XDouHVe71wMTOw6cuDsuHZeOS8el49Jx7Y7Nr4lf9uL4fbHgvbK7NztwswM3O3CzAzc7cLMDNztwswM3O3CzAzc7cLMDNztwswM3O3Cz7zXfkea5bZ6l5v42M2/mEHI6e1w/mCcWvFd2zpAz5Aw5Q86QM@QMOUPOkDPkDDlDzpAz5Aw5Q86QM@QMOUPOkDPkTDmdjq6f9BML3is7Z8qZcqacKWfKmXKmnClnyplyppwpZ8qZcqacKWfKmXKmnClnyplydjmd365Dx4kF75Wds8vZ5exydjm7nF3OLmeXs8vZ5exydjm7nF3OLmeXs8vZ5exydjm7nF3OIacT5nUsOrHgvbJzDjmHnEPOIeeQc8g55BxyDjmHnEPOIeeQc8g55BxyDjmHnEPOIeeQc8g55XQGvg5uJxa8V3bOKeeUc8o55ZxyTjmnnFPOKeeUc8o55ZxyTjmnnFPOKeeUc8o55ZxyTjmXnPcpfcm55Fz1Xtk5l5xLziXnknPJueRcci45l5xLziXnknPJueRcci45l5xLziXnknPJuXbO6v8dqvN5Lff1Tludz6vzeXU@r87n1fm8Op9X5/PqfF6dz6vzeXU@r87n1fm8Op9X5/PqfF6dz6vzeXU@r87n1fm8Op9X5/PqfF6dz6sTcrWLVntUtQNU36/q6a2ejWryjV1j18p9ve0au8ausWvsGrvGrrFr7Bq7xq6xa@wau8ausWvsGrvGrrFr7Bq7xq6xa@wau8ausWvsGrvGrrFr7Bq7YBfsotzX2y7YBbtgF@yCXbALdsEu2AW7YBfsgl2wC3bBLtgFu2AX7IJdsAt2wS7YBbtgF@yCXbALdsEu2CW7ZJflvt52yS7ZJbtkl@ySXbJLdsku2SW7ZJfskl2yS3bJLtklu2SX7JJdskt2yS7ZJbtkl@ySXbJLdsmus@vsermvt11n19l1dp1dZ9fZdXadXWfX2XV2nV1n19l1dp1dZ9fZdXadXWfX2XV2nV1n19l1dp1dZ9fZdXadXWc32A12o9zX/smR3WA32A12g91gN9gNdoPdYDfYDXaD3WA32A12g91gN9gNdoPdYDfYDXaD3WA32A12g91gN9gNdoPdZDfZzXJfb7vJbrKb7Ca7yW6ym@wmu8luspvsJrvJbrKb7Ca7yW6ym@wmu8luspvsJrvJbrKb7Ca7yW6ym@wmu8lusVvsVrmvt91it9gtdovdYrfYLXaL3WK32C12i91it9gtdovdYrfYLXaL3WK32C12i91it9gtdovdYrfYLXaL3drtHz78Bw "J – Try It Online")
[Answer]
# Japt, 21 bytes
```
1e5o ù'0 f@e_XèZË+".*
```
[Try it!](https://ethproductions.github.io/japt/?v=1.4.6&code=MWU1byD5JzAgZkBlX1joWssrIi4q&input=WyI3NTYiLCAiNTg2Il0KLVE=)
```
1e5o ù'0 f@e_XèZË+".*    # full program
1e5o                     # generate numbers under 100k
     ù'0                 # left pad with 0's
         f@              # filter array
           e_            # check every element of input array
             Xè          # X is the number to be tested.
                         # test it against a regex.
               ZË+".*    # the regex is an element from the input array
                         # with wildcards injected between each character
```
-2 bytes thanks to @Shaggy!
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 116 bytes
```
x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(-6,(a,c)=>s.IndexOf(c,a<0?a+6:a+1))>0))Print(s);}}
```
[Try it online!](https://tio.run/##fc09a8MwFIXhPb/CiA662DFXdj5KZKkYuhQK7dYhZBCqZC4EBSTRGox/u9t66pTpLA/ntWlrEy29zXQLXcqRwnC@aK@WUenJ3yKnkAtSKKkTbi9h@jKxSOqBTVSWp@f9zCR5Ptb99cqz0rnuhyG6wWTHt4eKm8qC0ql@CZ9ufPPcVqbDJ1MeTqYUABoB3n@bmSeQ87zIjefBfZ8vE2sbZFXBjk27TotsBrn5iJTdKwXH4b897v7Q4665g1CshwLXwxbFPYtrbvkB "C# (Visual C# Interactive Compiler) – Try It Online")
```
// x: input list of strings
x=>{
  // generate all numbers under 100k
  for(int i=0;i<1e5;){
    // convert the current number to
    // a 5 digit string padded with 0's
    var s=$"{i++:D5}";
    // test all inputs against the 5 digit
    // string using an aggregate.
    // each step of the aggregate gets
    // the index of the next occurrence
    // of the current character starting
    // at the previously found character.
    // a negative index indicates error.
    if(x.All(t=>t
             .Aggregate(-6,(a,c)=>
               s.IndexOf(c,a<0?a+6:a+1)
             )>0))
      // output to STDOUT
      Print(s);
  }
}
```
**EDIT:** fixed a bug where the same character was counted more than once. For example, if `000` was logged, the function used to return all passwords containing a single `0`.
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 113 bytes
```
import StdEnv,Data.List
$l=[s\\s<-iter 5(\p=[[c:e]\\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]
```
[Try it online!](https://tio.run/##LY2xCsIwFAB3vyKDkBbaIi0iSrPpIHQQHF8yPGMqgZe0Nqkg@O1GQbe7W06TQZ/ccJ3JMIfWJ@vGYYrsHK8H/yj2GLHqbIiLJQkIUoa2tNFMbJ3JUQDonVFSmrYcC92WwFe8qviWK5UDKPVCoqwnOzL0zyzMl2Dus/HaBBbyIRMiz0mlc8TvULAlA@BNveKqYMA3dfOH5ltUeuue8BZSeezS/unRWf2TE2Hsh8l9AA "Clean – Try It Online")
[Answer]
## K 67 bytes
```
{n@&{&/y in\:x@/:&:'a@&3=+/'a:(5#2)\:'!32}[;x]'n:{"0"^-5$$x}'!_1e5}
```
K has a (very) primitive regex capability, so i tried a different approach.
{...} defines a lambda. Use example: `{...}("320";"723";"730")`
returns `("37230";"72320";"73203";"73230")`
* `n` is the list of integers in range 0..9999 as 0-padded strings
	+ `_1e5` applies floor to float 1e5 (scientific notation) -> generates integer 100000
	+ `!_1e5` generates integer-list 0..99999
	+ `{..}'!_1e5` applies lambda to each value in 0..99999
	+ `$x` transform argument x (implicit arg) to string
	+ `-5$$x` right adjust string $x to a field of size 5 (ex. `-5$$12` generates `" 12"`
	+ `"0"^string` replaces blanks with "0" char, so `"0"^-5$$12` generates `"00012"`
* `a` is the list of integers in the range 0..31 as 5-bit values
	+ `!32` generate values 0..31
	+ `(5#2)` repeat 2 five times (list 2 2 2 2 2)
	+ `(5#2)\:'!32` generates 5-bit values (2-base five-times) for each value in range 0..31
* we filter the values of a with exactly 3 ones. That values are all the combinations (places) where pattern can be located: `11100 11010 11001 10110 10101 10011 01110 01101 01011 00111`. Ex. for "abc" pattern we have equivalence with regexs `abc?? ab?c? ab??c a?bc? a?b?c a??bc ?abc? ?ab?c ?a?bc ??abc?`
	+ `+\'a` calculates sum of each binary representation (number of ones)
	+ `3=+\'a` generates list of booleans (if each value in a has exactly 3 ones)
	+ `a@&3=+\'a` reads as "a at where 3=+\'a is true"
* generate list of indexes for previous places: `(0 1 2; 0 1 3; 0 1 4; 0 2 3; 0 2 4; 0 3 4; 1 2 3; 1 2 4; 1 3 4; 2 3 4)` and the possible entered-values for a password (x)
	+ `&:'` reads as "where each", applies to list of binary-coded integers, and calculates indexes of each 1-bit
	+ `x@/:` applies password x to each elem of the list of indexes (generates all possible entered values)
* Determines if all patterns are located in the list of all possible entered values
	+ `y` is the arg that represent list of patterns
	+ `y in\:` reads as each value of y in the list at the right
	+ `&/` is "and over". `&/y in\:..` returns true iff all patterns in y are locates at the list ..
* finally, return each string in n at every index that makes lambda true
	+ `n@&{..}` reads as "n at where lambda {..} returns true"
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), ~~119~~ 102 bytes
```
lambda l:['%05d'%n for n in range(10**5)if all(map(lambda x:''in[x:=x[x[:1]==c:]for c in'%05d'%n],l))]
```
[Try it online!](https://tio.run/##NYzLjsIgFIbX9inYGMC44HCxLQlP0umC0XYkQSS1aufpO4fG2fz58t/y73y9J9XkaR3d1xr97fviSbQd3QtzoftExvtEEgmJTD79DAzE4WB4GImPkd18Zp/JYikNqVusW7qls9A7d7Z9GZ9x/P/WHyPn/fq@hjgQsNUuuhgeMxtePrKQ8nNmnPNql6eQZjYybK9USUGPtJaqqBK0oqrWyI2WyAJKCqKkSgA6sDVB6k0NqlQGfala5Fbr0gHY0vKmzak8Ny1yvbFpTp@fPw "Python 3.8 (pre-release) – Try It Online")
This was based off of [xnor's Python answer](https://codegolf.stackexchange.com/a/180285/75323) and @Bubbler helped me golf it by 17 bytes ;)
[Answer]
# [Python 3.8](https://docs.python.org/3.8/), ~~97~~ 96 bytes
```
lambda l:[s for n in range(10**5)if(s:='%05d'%n,t:={''},[t:=t|{x+c for x in t}for c in s])!=t>l]
```
[Try it online!](https://tio.run/##RY3LTsMwEEX3fIVZVLZLFh4/mgcyP1K6CG3SWjJulBgoCvn2YE8l2FzdMz4zHr7j5RpUNYxrb19X376/nVrim/1E@utIAnGBjG04dwzEdmu469nUWLoR5kQ3oYiNnSldin0q8We@PR1x7ZbX4pLrMdfpwB9tfPGH9evifEeg8cSS7rP1zIXhIzLOn8kwuhBZz/w/8HWmSgpa0FKqnErQ5SHNSp2o0hJJQDZAZEMJwBmgD1JjmpRSGXyRqk5Ua333ANC439Vml3@paqQSyVS7v4vLLw "Python 3.8 (pre-release) – Try It Online")
-1 byte thanks to @xnor.
# [Python 2](https://docs.python.org/2/), 96 bytes
```
lambda l,d='%05d':[d%n for n in range(10**5)if reduce(lambda t,c:t|{x+c for x in t},d%n,{''})>l]
```
[Try it online!](https://tio.run/##PY7LboMwFET3@Yq7iQwpCz/Do6I/0laIgp1YMgZZRk1F@XZqTJXNSGfuzNjTj7@Plm7KjQM0jZr97GTTgB6m0XmYnLY@uLbzerQnVX9sph2@@hZM1tfojEWPqvf@bEGNDixoC661N5kQfLmIVCtwsp87mfy3fNZV/nd5vHSx8NgLfs3CQLYgtKZv5nP7vmsjgVQG6nCeZp@kr8dHEpWY9AnptiBGMcpQTtmuDKP1FLycByo4jYTJniB4TzBMokdinlAeVQSlTMQLZWWgkvMjR0hMHLtcXPdXijJSHkkU1@fi@gc "Python 2 – Try It Online")
Alternative forms of [xnor's Python 2 answer](https://codegolf.stackexchange.com/a/180285/78410).
[Answer]
# [Bash](https://www.gnu.org/software/bash/) + GNU utilities, ~~54~~ ~~53~~ 51 bytes
```
sed 's/./&.*/g;s/ \|^/|grep /g;s//seq -w 0 99999/e'
```
[Try it online!](https://tio.run/##XY7dCoJAEIXv9ynORRQEtj@zulpP0FUvIEHlkILYzyrd@O62ShF5YAbmO4fDnE@@HF5lVTOefCpQVw0LoLiFBfClvGHf3Lt2i8XH@tBD1454Al3juUUU/dwpjB754LnAysuNXG7W8rrzEnl/lP31yXdMt/T8QPSCQjZK8mr41kyPNDyQUXCG4EgJchapNUJpBa0IpDS@EjqEtLFhYhiKIQxlyKzFn4TWOkTUjNo4gUuzGXWBxmkybzAk3g "Bash – Try It Online")
*Thanks to @user41805 for 1 byte off, and now an additional 2 bytes off.*
Input: Space-separated integers on stdin.
Output: On stdout, one possible password per line.
[Answer]
# C(GCC) ~~222~~ 214 bytes
-8 bytes ceilingcat
```
#define C(p)*f-p||++f;
#define I(x,y)x>9&&++y,x%=10;
a,b,c,d,e,g,**h,*f;z(int**H){for(a=0;g=a<10;){for(h=H;*h;g&=f>*h+++2){f=*h;C(a)C(b)C(c)C(d)C(e)}g&&printf("%d%d%d%d%d,",a,b,c,d,e);e++;I(e,d)I(d,c)I(c,b)I(b,a)}}
```
[Try it online!](https://tio.run/##XU3LTsMwELznK6yiRmt7IyVFCCLjXnJpvqHi4PiR5ECICoe0ab49LIYihHZnpJ2Z3bVZa@263jkf@sGzCkYuQjZer1IGldzkGiY882lfpqmUZ5y2ushVYrBBiw49tihEhyKoC/TDhxAHPoe3Exidq1abZwp/C50@KNGpNtVhLzop5Y50TUoFhlfQECzBETxf2jQdT3QvwGbrboUb/P3LlZdS1eDR8RocWmKLDXGDhi/LSsvs1fQDcDYnjH2NHVFxfHhhms0llviIWUG9qD/@7sd/wvy/L2Lg/XgfA/EYxhXMY@QC0ecqWdZP "C (gcc) – Try It Online")
Calling code
```
int main() {
  int hint1[5] = {9,9,7,-1,-1};
  int hint2[5] = {8,0,7,-1,-1};
  int* hints[3] = {hint1,hint2,0};
  z(hints);
}
```
Output
```
80997,89097,89907,98097,98907,99807,
```
[Answer]
The function takes an array of strings as input and prints each possible code on separate lines.
# [PHP](https://php.net/), 122 bytes
```
function a($n){for(;$x++<1e5;){foreach($n as$a)if(!preg_match("/$a[0].*$a[1].*$a[2]/",$x))continue 2;printf("%05d
",$x);}}
```
[Try it online!](https://tio.run/##TZDdioMwFITvfYqzIQVtZZvfqqSwD@KGJbi69aIxWAuF4rPbNKllbzKcbyYZctzJLccv58/uapupHyyYFNvs3g1jqvBttzvSVqowt6Y5eQ/MBZus79IPN7Z/P2czeYz22NREf2690ChM71GOb1nWDHbq7bUFptzY26lL0YbI3yS4ap6X9e06AagRZwTlgArGg3CCdB6NQjxJKdhKCA1RSkKUE7oaNF6mTESRXhiXL5fx6okrId55SmPwXSbkIdSX1UqKSGR5@N@iARLtVwJ@aXD3OHwR0LdFyk9hmSqZlwc "PHP – Try It Online")
[Answer]
# [sed](https://www.gnu.org/software/sed/) -E, ~~46~~ 44 bytes
```
s/./&.*/g;s/ |^/|grep /g;s//seq -w 0 99999/e
```
[Try it online!](https://tio.run/##K05N0U3PK/3/v1hfT19NT0s/3bpYX6EmTr8mvSi1QAHM1S9OLVTQLVcwULAEAf3U//@NjQwUzI2MFcyNDf7lF5Rk5ucV/9d1BQA "sed – Try It Online")
Input: Space-separated integers on stdin.
Output: On stdout, one possible password per line.
This is from my bash answer, which had 3 bytes off thanks to @user41805.
]