text:
Cycle my input please
Input
A string s of printable ASCII characters, newlines, and spaces (0x20 ( ) to 0x7E (~)), and a non-negative integer n.
Challenge
To write a program that outputs either another program, or s depending on n. If n = 1, Then your code should output code which outputs s. If n = 2, Your code should output code which outputs code which outputs s and so on.
All outputted code should be in the same language as the language of the original submission.
Test Cases
Format: s, n -> output
Assuming your submission is written in JavaScript:
No cycles, 0 -> No cycles
Hello, 1 -> console.log("Hello");
Cycle!, 3 -> console.log("console.log(\"console.log(\\\"Cycle!\\\")\")");
:), 3 -> console.log("console.log('console.log(`:)`)')");

Scoring
This is code-golf, so aim for shortest code in bytes.
Additional Rules

I/O format is flexible
Default rules and standard loopholes apply.
The output of your submission must be valid.
You can use any language, even if it was created after this challenge, as long as it wasn't created for the purpose of this challenge
This isn't a polyglot challenge. A JavaScript submission shouldn't output Ruby code.
Input is guaranteed to be valid as defined in the Input section

Validation
Here's a quick tip to test your answers:
For n=0, output=s
For n=1, eval(output)=s
For n=2, eval(eval(output))=s
Where n and s are inputs

Are functions that output programs or functions allowed?

related duplicate?

@nwellnhof According to the default rules, yes.

@LuisfelipeDejesusMunoz Sorry, I mistyped, I meant the same language, not code

@Emigna, looks like a dupe to me.

R, 43 bytes
f=function(s,n)"if"(n,function()f(s,n-1),s)

Try it online!
Returns a zero-argument function that recursively calls f with n set to n-1. n successive function applications returns s.

V, 3 bytes
ÀII

Try it online!
Takes string as input, prepends as many I as stated in the first argument.

Google Sheets, 96 bytes
=Join("",If(B1,ArrayFormula("="&Rept("""",2^(Row(Offset(A1,0,0,B1))-1))),),A1,Rept("""",2^B1-1))

Inputs are in cells A1 (s) and B1 (n).

(Columns D, E, and F show the result if you copy the output from the column to its left and input it as a formula.)

The formula concatenates 3 pieces into a single string. The first piece is the most complicated.
If(B1,ArrayFormula("="&Rept("""",2^(Row(Offset(A1,0,0,B1))-1))),)

If If statement drops the prefix if n=0 so you end up with No cycles instead of ="No cycles. The ArrayFormula creates an array of equal signs followed by some number quotes. That number is 2^(x-1) where x counts up from 1 to n thanks to the Row(Offset(~)) combination.
The next piece (A1) adds in s and the final piece (Rept("""",2^B1-1)) adds in 2^n-1 quotes at the end.

PHP, 69 bytes
function($s,$n){while($n--)$s='echo'.var_export($s,1).';';return $s;}

Try it online!
From the documentation about var_export:

var_export — Outputs or returns a parsable string representation of a variable

This function calls var_export prepends echo and appends ; $n times.

Could you provide an explanation?

There´s no need for a space between return and $s. 2) recursive function, 67 bytes function f($s,$n){return$n?f('echo'.var_export($s,1).';',$n-1):$s;} 3) full program, 63 bytes: for([,$s,$n]=$argv;$n--;)$s="echo".var_export($s,1).";";echo$s; (run with -r)

I'd have to include -r in the byte count, don't I?

No, flags are free now; they count as a different language so, if you wanted to use that flag, this solution would be PHP -r.

Perl 6, 25 bytes
{'{Q«'x$^n~$^s~'»}'x$n}

Try it online!
Function returning function code. Uses Q« » to quote unescaped ASCII strings.

JavaScript (Node.js), 43 bytes
Outputs a program that outputs a program that outp.... until b=1
f=(a,b)=>b?--b?`(f=${f})('${a}',${b})`:a:''

Try it online!

This does not match the test cases, the output for f("hello", 2) should be console.log("console.log(\"hello\")") or console.log("console.log('hello')")

Yes it is... it just outputs console.log("hello")

Does not work for n=0

Nevermind, it's just 1-indexed

Is the b=0 -> '' case required? If not I think you can save 5 bytes just by removing it. (Becomes even clearer if you use 0-indexing instead of 1-indexing)

Haskell, 42 bytes
s#n|n<1=s|0<1="main=putStr"++show(s#(n-1))

Try it online!

I think ...0<1=show$s#(n-1) is enough, because we treat values in Haskell as functions.

PHP, 12+1 bytes, not competing
plain text is a valid PHP program, but, if N is not 0, this fails for text containing <? with short tags enabled and for text containing <?php  or <?= in any case:
<?=$argv[1];

call with php -R '<code>' '<string>' <n>;
call the output with php -R '<code>'

Jelly, 2 bytes
Ṿ¡

Try it online!

Explanation? How does this wor

@FireCubez It simply executes the value → string representation function n times.

And does executing the string representation of a value print the value?

@FireCubez The eval function (V) simply evaluates the code within a string. It doesn't implicitly print anything.

Python, 55 bytes
c=lambda s,n:c("(lambda:"+repr(s)+")()",n-1)if n else s

C (clang), -DA=asprintf( -lm 136 bytes
j,*c,*e;f(a,b){A&c,"%s",a);for(;b--;){e="";for(j=1;j++<pow(2,b);A&e,"\\%s",e));A&c,"puts(%s\"%s%s\");",e,c,e);}puts(c);}

Try it online!


text:
Chiral three dimensional texts
Two dimensional chiral objects are not chiral in three dimensional space. This is because you can flip them over which is equivalent to taking the mirror image unlike in two dimensions where only rotations in the plane of the object are allowed which cannot reproduce the effect of a mirror operation. In this challenge, we will be deciding whether three dimensional texts are chiral.
Some definitions

Three dimensional text: A rectangular three dimensional array of characters. In this challenge, programs will only need to handle nonwhitespace printable ASCII (! through ~).
Mirror operation: The operation of reversing the order of characters along a single axis of the three dimensional text.

Rotations can be thought of intuitively, but here is an explicit definition for those who will eventually ask.

90-degree rotation: The operation of transposing each plane perpendicular to a specific axis (say \$i\$), then applying a mirror operation to an axis other than \$i\$.
Rotation: A succession of 90-degree rotations.
Chiral: A three dimensional text is chiral if after applying any single mirror operation, there does not exist a rotation of the new text that reproduces the original text. A text is not chiral if after applying a single mirror operation the new text can be rotated back to the original text.

A slightly more concise definition of chirality is lack of existence of an improper rotation under which an object is invariant.
Task
In whatever format you prefer, take a three dimensional text as input.
Output one of two consistent values, one indicating that the text is chiral and one indicating that it is not.
Shortest code wins.
Examples
In each section, the vertical pipes (|) separate the test cases. Within each test case, layers of the three dimensional texts are separated by blank lines.
Not chiral
Z--Z    |    i~    |    Qx    |    a    |    abaLIa
----    |    >>    |    xx    |    b    |    N#)*@"
Z--Z    |          |          |         |    }-3}#k
        |    >>    |    QQ    |    d    |    ../..'
Z--Z    |    ~i    |    QQ    |    e    |
----    |          |          |         |
Z--Z    |          |          |    f    |
        |          |          |    g    |

Chiral
Z--Z    |    *k    |    Qxxx    |    a*
----    |    <0    |    xxxx    |    **
Z---    |          |            |
        |    l7    |    QQQQ    |    **
Z---    |    GB    |    QQQQ    |    a*
----    |          |            |
Z--Z    |    q~    |            |    **
        |    ]J    |            |    *a

Haskell, 97 96 95 bytes

-1 byte thanks to nimi

f s=all(r s/=)$foldr($)s<$>mapM(\_->[id,g,map g])[1..6]
g=r.foldr(zipWith(:))e
r=reverse
e=[]:e

Try it online!
Explanation
Ok, this is a bit mathy. It is well known that the group of rotations as described in the challenge (i.e. the group generated by rotations of 90 degrees around one of the three principal axes) is isomorphic to the symmetric group \$S_4\$, as described here. It is also well known that \$S_4\$ is generated by the elements \$(1\, 2\, 3\, 4),(1\, 3\, 2\, 4)\$.
What I am trying to say is this: fix two distinct axes, and call the 90 degrees rotations about those axes \$r_1\$ and \$r_2\$. Then we can generate all the rotations by repeatedly applying \$r_1\$ and \$r_2\$. A bit of bruteforce shows that we only need up to 6 applications of \$r_1\$ and \$r_2\$.
Thus we have the following algorithm: given a three-dimensional text \$s\$, we apply all possible rotations to \$s\$ and check whether any of those matches \$s\$ flipped along an axis. The rotations are generated by composing up to six 90 degrees rotations about two fixed axes.

g=r.foldr(zipWith(:))e
e=[]:e

g is a 90 degrees rotation of a 2D list (also works on 3D lists, as those can be seen as 2D lists of 1D lists). The foldr(zipWith(:))e is simply transpose from Data.List, but shorter.

f s=all(r s/=)$foldr($)s<$>mapM(\_->[id,g,map g])[1..6]

f checks whether its argument s is chiral.

mapM(\_->[id,g,map g])[1..6] generates a list of all sequences of length 6 whose elements are any of id (the identity transformation, i.e. do nothing), g (90 degrees rotation about an axis), map g (90 degrees rotations about a different axis).
given a list [f1,f2,...,f6] of transformations, foldr($)s computes f1(f2(...f6(s)...), and (r s/=) checks whether the result is equal to s reversed (i.e. a mirror image of s).

So what f does is check if any rotation of s matches its mirror image, returning False if it does and True otherwise.

APL (Dyalog Classic), 28 bytes
~⊂∘⌽∊(⊢∪2 0 1∘⍉¨∪⌽∘⍉⍤2¨)⍣≡∘⊂

Try it online!

K (ngn/k), 36 bytes
{^*({?x,((++:')'x),(|+:)'x}/,x)?,|x}

Try it online!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
What numbers are these?
While I was writing numbers I noticed after a while that my keyboard had the Shift key pressed and blocked and all I wrote was $%&-like characters. And even worse, I had been switching between the English and Spanish keyboard layouts so I don't know which one I used for each number.
Challenge
Given a string containing symbol characters, try to guess which number I wrote. My keyboard produces the following characters for the numbers when the Shift is pressed:
1234567890
----------
!"·$%&/()=  Spanish layout
!@#$%^&*()  English layout

The input will be a non-null, non-empty string composed of the symbols above.
The output will be a single number if the keyboard layout can be inferred from the string (i.e. if the string contains a @ an English layout was used, and if the string contains a " a Spanish layout was used) or if the number is the same for both layouts (i.e. the input is !$ which translates as 14 for both layouts); otherwise the output will be the two possible numbers for both layouts if it cannot be inferred and the resulting numbers are different.
The input string will always be written in a single layout. So you don't need to expect "@ as input.

Examples
Input  -->  Output
------------------
/()         789        (Spanish layout detected by the use of /)
$%&         456,457    (Layout cannot be inferred)
!@#         123        (English layout detected by the use of @ and #)
()&!        8961,9071  (Layout cannot be inferred)
((·))       88399      (Spanish layout detected by the use of ·)
!$          14         (Layout cannot be inferred but the result is the same for both)
!!$$%%      114455     (Layout cannot be inferred but the result is the same for both)
==$"        0042/42    (Spanish layout, if a number starts with 0 you can choose to
                       omit them in the result or not)

Single character translations:
------------------------------
!   1
"   2
·   3
$   4
%   5
&   6,7
/   7
(   8,9
)   9,0
=   0
@   2
#   3
^   6
*   8

This is code-golf, so may the shortest code for each language win!

Dang it, that · is challenging...

@EriktheOutgolfer in fact the · is useless for Spanish, it is only used in the Catalan language.

Is output like {(8, 9, 6, 1), (9, 0, 7, 1)} (for the 4th test case) acceptable?

@Lynn yes, it is.

When outputting 2 numbers, does the order matter?

@Shaggy not at all. :-)

For my English layout it's !"£$%^&*()

@Okx interesting, I suppose my sysadmin has installed the American English layout in my computer. The British one seems to be a mix of both.

Is that dot (·) the same as byte 250 in CP437 and DOS Latin-1? If so, may we encode input and our submissions in such code pages able to represent all of the characters required in a single byte?

@Οurous the byte 250 in CP437 seems to be a punctuation mark resembling the middle dot, so yes, you can use it. I'm not sure what you want to do with the code pages but please, go ahead.

@Charlie The reason I ask is it saves a lot of space not having to handle an otherwise multi-byte character.

Can the input be taken as a list of characters instead of string?

@KevinCruijssen yes, of course.

Jelly, 32 31 bytes
O“=!"Ṣ$%&/()“)!@#$%^&*(‘iⱮ€PƇ’Q

Try it online!

-1 bytes thanks to Erik the Outgolfer

O“!"Ṣ$%&/()=“!@#$%^&*()‘iⱮ€PƇ%⁵Q
O                                  ord of each character in the input
 “!"Ṣ$%&/()=“!@#$%^&*()‘           Constant that yields the list:
                                      [[33, 34, 183, 36, 37, 38, 47, 40, 41, 61],
                                       [33, 64, 35, 36, 37, 94, 38, 42, 40, 41]
                          €        For each list of numbers:
                         Ɱ           For each ord of the characters in the input:
                        i              Find the index of the ord of the character
                                       in the list of numbers.
                                       If the number is not found, `i` returns zero
                                       which means it's a character from only one
                                       keyboard.
                                   There are now two lists of numbers 1-10.
                            Ƈ      Keep the list(s) that:
                           P         have nonzero product.
                             %⁵    Modulo 10. This maps 10->0.
                               Q   Unique elements. This removes duplicates if the two numbers are the same.

31 bytes.

Python 3, 76 bytes
lambda s:{(*map(k.find,s),)for k in['=!"·$%&/()',')!@#$%^&*(']if{*s}<={*k}}

Try it online!

Perl 6, 62 bytes
{set grep {!/\D/},TR'=!"·$%&/()'0..9',TR')!@\x23$%^&*('0..9'}

Try it online!
Returns a Set. (Could be made two or three bytes shorter if there wasn't a bug in Rakudo's handling of # in search lists.)

Java (JDK), 173 bytes
Golfed
c->{String s="",e=s;var m="21#3457#908###6##12#456389###0#7".split("");for(int l:c){e+=m[l=l%16];s+=m[l+16];}return s.equals(e)|s.contains("#")?e:e.contains("#")?s:s+","+e;}

Try it online!

Ungolfed
c->{                                                      // Lamdba taking char array as input
    String s="",e=s;                                      // Initialise Spanish and English strings
    var m="21#3457#908###6##12#456389###0#7".split("");   // Create magic hashing lookup array (see below)
    for(int l:c){                                         // Loops through all chars in input
        e+=m[l=l%16];                                     // Get english number from array and append
        s+=m[l+16];                                       // Get Spanish number from array and append
    }
    return s.equals(e)|s.contains("#")?e:                 // If equal or Spanish is invalid return english
        e.contains("#")?s:                                // If English is invalid return Spanish
        s+","+e;                                          // If both are valid but not equal, return both
}

The Magic Hashing Lookup Array
After some experimenting with values I realised that each of the ASCII values of the characters !"·$%&/()=@#^* modulo 16 returns a unique number. The 'magic hashing lookup array' stores the English numbers associated with each character at this unique index, and each of the Spanish numbers at this index offset by 16, making fetching the required number from the array trivial for each language. A hash is stored for values that are invalid for either language.

I don't suppose you could use toCharArray() and the int values to make this shorter? (Just an idea, I haven't tried it yet.)

@Quintec I tried it, but the extra bytes from toCharArray() and calculating the exponent to be applied to the int value made it far longer than both the .contains() statements.

s.equals(e)|s.contains("#") can be s.matches(e+"|.*#.*").

Suggest l%=16 instead of l=l%16

Japt, 38 bytes
Outputs an array of strings with the Spanish layout first.
"=!\"·$%&/())!@#$%^&*("òA £ËXbD
kø'- â

Try it

Jelly, 38 bytes
183Ọ“=!"“$%&/()”j,“)!@#$%^&*(”iⱮ€⁸ẠƇ’Q

Try it online!

Nice! Just one question, I have tried your code with () or (()) as input, but your code then return nothing. I suppose that's a limitation with what Jelly receives as input?

@Charlie Try with '()' and '(())' respectively. Yes, if you don't quote the argument, it's only inputted as a string if it can't be evaluated to a Python 3 value.

Retina 0.8.2, 60 bytes
.+
$&¶$&
T`=!"·$%&/()`d`^.+
T`)!@#$%^&*(`d`.+$
D`
Gm`^\d+$

Try it online! Link includes test cases. Explanation:
.+
$&¶$&

Duplicate the input.
T`=!"·$%&/()`d`^.+
T`)!@#$%^&*(`d`.+$

Try to translate each line according to a different keyboard layout.
D`

Deduplicate the result.
Gm`^\d+$

Only keep lines that only contain digits.

Do you need the m in your last stage?

@ovs Yes, the matches run first, and then the lines are split and lines containing matches are kept.

Clean, 116 bytes
import StdEnv,Text
$s=removeDup[foldl(<+)""d\\r<-["=!\"·$%&/()",")!@#$%^&*("],d<-[[indexOf{c}r\\c<-s]]|all((<) -1)d]

Try it online!
Takes input and is encoded in CP437. TIO only supports UTF-8, so an escape is used in the demo code to get the literal byte value 250 corresponding to the centre dot (counted as one byte).

The !$% input should output only one number, not two, as the result is the same for both layouts.

@Charlie Fixed it.

05AB1E, 42 41 bytes
•Hhç₁d©u÷^Σ(“ðΣèõĆ
-•184в2äεIÇk}ʒ®å_}>T%Ù

Port of @dylnan's Jelly answer.
Try it online or verify all test cases.
Explanation:
•Hhç₁d©u÷^Σ(“ðΣèõĆ
-•184в           # Compressed list [33,34,183,36,37,38,47,40,41,61,33,64,35,36,37,94,38,42,40,41]
      2ä         # Split into two parts: [[33,34,183,36,37,38,47,40,41,61],[33,64,35,36,37,94,38,42,40,41]]
ε   }            # Map each inner list to:
 IÇ              #  Get the input, and convert each character to its unicode value
   k             #  Then get the index of each unicode value in the current map-list
                 #  (this results in -1 if the item doesn't exist)
     ʒ   }       # Filter the resulting list of indices by:
      ®å_        #  If the inner list does not contain any -1
          >      # Increase each index by 1 to make it from 0-indexed to 1-indexed
           T%    # Take modulo-10 to convert 10 to 0
             Ù   # Uniquify the result-lists (and output implicitly)

See this 05AB1E tip of mine (section How to compress integer lists?) to understand why •Hhç₁d©u÷^Σ(“ðΣèõĆ\n-•184в is [33,34,183,36,37,38,47,40,41,61,33,64,35,36,37,94,38,42,40,41]). This (together with the 2ä) is 1 byte shorter than taking the unicode values of the string: '""!ÿ·$%&/()=""!@#$%^&*()"‚Ç.

The !$ and !!$$%% cases should output only one number as the result is the same for both layouts and there is no ambiguity.

@Charlie Oops, fixed

Ruby, 68 bytes
->s{%w[=!"·$%&/() )!@#$%^&*(].map{|a|s.tr a,'0-9'}.grep_v(/\D/)|[]}

Try it online!

APL (Dyalog), 40 bytes
Anonymous tacit prefix function. Though unused, · is in the Dyalog single byte character set. Assumes 0-based indexing (⎕IO←0) which is default on many systems.
{∪⍵/⍨~10∊¨⍵}'=!"·$%&/()' ')!@#$%^&*('⍳¨⊂

Try it online!
⊂ the entire argument
'=!"·$%&/()' ')!@#$%^&*('⍳¨ indices of the characters in each of these strings
{∪⍵/⍨~10∊¨⍵} apply the following lambda (⍵ is the argument):
10∊¨⍵ for each list of digits, whether 10 (indicating "not found") is a member thereof
 ~ local negation (i.e. only those where all digits are found)
 ⍵/⍨ filter the argument by that
 ∪ find the unique elements of that

JavaScript (ES6), 99 bytes
s=>(g=l=>a=s.replace(/./g,c=>l.indexOf(c)))('=!"·$%&/()',b=g(')!@#$%^&*('))>=0?a-b&&b>=0?[a,b]:a:b

Try it online!
How?
The helper function \$g\$ attempts to convert the input string using a given layout.
Invalid characters are replaced with \$-1\$, which results in either a valid but negative looking numeric string (if only the first character was missing), or an invalid numeric string. Either way, the test x >= 0 is falsy.

Dart, 125 bytes
f(s)=>['=!"·\$%&/()',')!@#\$%^&*('].map((b)=>s.split('').map((e)=>b.indexOf(e)).join()).where((e)=>!e.contains('-')).toSet();

Ungolfed :
f(s){
  ['=!"·\$%&/()',')!@#\$%^&*(']
    .map(
      (b)=>s.split('').map((e)=>b.indexOf(e))
      .join()
    ).where(
      (e)=>!e.contains('-')
    ).toSet();
}

Creates an array with the two specified key values, from 0 to 9
For each of them,  convert the input string to the corresponding number by using the characters' indexes
Join the resulting array to create a number
Remove any number having a '-' (Dart returns -1 when indexOf can't find a char)
Return as a Set to remove duplicates

Try it on Dartpad!

T-SQL, 143 bytes
SELECT DISTINCT*FROM(SELECT TRY_CAST(TRANSLATE(v,m,'1234567890')as INT)a
FROM i,(VALUES('!"·$%&/()='),('!@#$%^&*()'))t(m))b
WHERE a IS NOT NULL

Input is taken via pre-existing table i with varchar field v, per our IO standards.
Joins the input table with the two different character strings, then uses the new SQL 2017 function TRANSLATE to swap out individual characters, and TRY_CAST to see if we end up with a number. If not, TRY_CAST returns NULL.
The final outer SELECT DISTINCT combines identical results and filters out the NULLS.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Tatamibari solver
Background
Tatamibari is a logic puzzle designed by Nikoli.
A Tatamibari puzzle is played on a rectangular grid with three different kinds of symbols in it: +, -. and |. The solver must partition the grid into rectangular or square regions according to the following rules:

Every partition must contain exactly one symbol in it.
A + symbol must be contained in a square.
A | symbol must be contained in a rectangle with a greater height than width.
A - symbol must be contained in a rectangle with a greater width than height.
Four pieces may never share the same corner. (This is how Japanese tatami tiles are usually placed.)

The following is an example puzzle, with a solution:

Task
Solve the given Tatamibari puzzle.
Input & output
The input is a 2D grid that represents the given Tatamibari puzzle. Each cell contains one of the four characters: +, -, |, and a character of your choice to represent a non-clue cell. In the test cases, an asterisk * is used.
You can choose any suitable output format which can unambiguously represent any valid solution to a Tatamibari puzzle. This includes, but is not limited to: (if in doubt, ask in comments.)

A list of 4-tuples, where each tuple includes the top index, left index, width and height of a rectangle (or any equivalent representation)
A numeric grid of the same shape as the input, where each number represents a rectangle
A list of coordinate sets, where each set includes all the coordinates of the cells in a rectangle

If a puzzle has multiple solutions, you can output any number (one or more) of its valid solutions. The input is guaranteed to have at least one solution.
Test cases
Puzzle:
|-*
*+|
*-*
Solution:
122
134
554
=====
Puzzle:
+***
**|*
*+**
***-
Solution:
1122
1122
3322
3344
======
Puzzle:
|*+*+
*****
****-
***+|
+****
Solution:
12233
12233
44444
55667
55667
=======
Puzzle:
****-**
**-**|*
*|*****
****-**
*******
**+*|**
*****+*
One possible solution:
1122222
1133344
1155544
1155544
6667744
6667788
6667788
===========
Puzzle:
*-****|+**
+*-******|
****+*****
*-******||
**++|*****
+****-|***
-****-**+*
********-*
|*+*+|****
*-*--**+*+
Solution:
1111122334
5666622334
7777822994
7777A2299B
CCDEA2299B
CCFFFFGGHH
IIIIJJGGHH
KLLMMNGGOO
KLLMMNGGPP
QQRRSSSTPP

Rules
Standard code-golf rules apply. The shortest code in bytes wins.

Python 2, 417 374 366 bytes
Input is list of lines, ~ for non-clue.
Outputs a single solution to stderr in the format (x_start, width, y_start, height).
R=range
k=input()
X,Y=len(k[0]),len(k)
W,H=R(X),R(Y)
Q=[[]]
for q in Q:C=[(x,y)for(a,b,c,d)in q for x in(a,a+b)for y in(c,c+d)];max(map(C.count,C+W))<4>0<all(sum(w>x-s>-1<y-t<h<[c for r in k[t:t+h]for c in r[s:s+w]if'~'>c]==['+|-'[cmp(h,w)]]for(s,w,t,h)in q)==1for x in W for y in H)>exit(q);Q+=[q+[(s,w+1,t,h+1)]for s in W for w in R(X-s)for t in H for h in R(Y-t)]

Try it online! This is too inefficient for the suggested test cases.

Ungolfed
grid = input()
total_width = len(grid[0])
total_height = len(grid)

partitions = [[]]

for partition in partitions:
    # list the corners of all rectangles in the current partition
    corners = [(x, y)
               for (start_x, width, start_y, height) in partition
               for x in (start_x, start_x + width)
               for y in (start_y, start_y + height)]
    # if no corners appears more than three times ...
    if corners != [] and max(map(corners.count, corners)) < 4:
        # .. and all fields are covered by a single rectangle ...
        if all(
                sum(width > x - start_x > -1 < y - start_y < height
                    for (start_x, width, start_y, height) in partition) == 1
                for x in range(total_width)
                for y in range(total_height)):
            # ... and all rectangles contain a single non-~
            # symbol that matches their shape:
            if all(
                [char for row in grid[start_y: start_y + height]
                    for char in row[start_x:start_x + width] if '~' > char]
                == ['+|-'[cmp(height, width)]]
                    for (start_x, width, start_y, height) in partition):
                # output the current partition and stop the program
                exit(partition)

    # append each possible rectangle in the grid to the current partition,
    # and add each new partition to the list of partitions.
    partitions += [partition + [(start_x, width + 1, start_y, height + 1)]
                   for start_x in range(total_width)
                   for width in range(total_width - start_x)
                   for start_y in range(total_height)
                   for height in range(total_height - start_y)]

Try it online!

J, 193 bytes
Returns all possible solutions as grids with -1, -2 … indicating rooms. There is room for improvements, but the (((((( started to confuse me. :-)
[:(#~0=0(e.,)"2])'*+-|'([:,/(([(<./@,@:<:@[`]`[}{.<@:+"1,/@(#:i.)@{:)"2((((({(0,=/,</,>/)@$)~0({.*(1=#)*0<{.)@-.~,);.0~*[:*/0<1{])"2#]){.([,:-~)"1/>:))[(#~0<:,)~,/@(#:i.)@$)"2)^:(1#.*@,)@,:@i.]

Try it online! For the larger test cases I provided ff that has a filter [:(#~1*@#.|@,"2) for intermediate steps, where empty grids got added because of padding.
How it works

'*+-|' … i.] Map *+-| to 0 1 2 3.
,/@(#:i.)@$ From all the tiles
[(#~0<:,)~ that aren't part of a room,
{.([,:-~)"1/>: starting from the most top-left tile, that isn't part of a room yet, try every possible rectangle spanning down-right.
…"2#] For that rectangle to be valid for the next step,
[:*/0<1{] 0.) it must have a positive size in each dimension
0({.*(1=#)*0<{.)@-.~, 1.) no tile must be part of a room, 2.) exactly one symbol must be within the rectangle,
(({(0,=/,</,>/)@$)~ 3.) the dimension of the rectangle fulfill the constraint of the symbol.
(<./@,@:<:@[][}{.<@:+"1,/@(#:i.)@{:)"2 For every valid rectangle, copy the current grid and place the next room.
^:(1#.*@,)@,: We need to do this n times, where n is the number of symbols.
[:(#~0=0(e.,)"2]) After this there might be grids that have n rooms, but still empty tiles; those must be filtered out.


text:
Text compression
With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in other words, use the smallest number of bytes to display the text.
The Text is:
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?

I'm honestly surprised this didn't get closed as a dupe of that Rick-Roll question. Are we not doing that anymore?

@JoKing it is a different string. A little variety on the same challenge can be fun sometimes.

@moonheart08 pretty sure that point was shot down in meta.

R, 106 bytes
"["=gsub
cat(1["Peter Piper picked",2[" peck of pickled peppers","1 a2.
A2 1.
If 1 a2,
Where's the2 1?"]])

Try it online!

That is a very clever use of aliasing!!

Great solution ! It beats also the memCompress approach 47+79=126 bytes

This idea saved me another byte here as well!

Wow, I didn't spot that golf. That's really nice.

Jelly,  80 73 72 68 67 61  57 bytes
“¡ŀṪ]ṃ{yṁ“Ñ3$ṘW5Ḍż⁸¢Hŀ“³ḌM“¡FỊİg“ÑɲʋØƥþƈƘ}“ṣɠ»“Ƙ9~ḷ’ṃFḊ”?

Try it online!
How?
“...“...“...“...“...“...»“Ƙ9~ḷ’ṃFḊ”? - Main Link: no arguments
“...“...“...“...“...“...»            - list of compressed strings
                                     -   = [" Peter Piper picked",
                                     -      " peck of pickled peppers",
                                     -      ".\nA",
                                     -      ".\nIf",
                                     -      ",\nWhere's the",
                                     -      " a"]
                         “Ƙ9~ḷ’      - base 250 literal X = 2331781969
                               ṃ     - base decompress - i.e. use the list of strings as if
                                     -   they were the digits [1,2,3,4,5,0]
                                     -   X in base 6 is [1,0,2,3,2,1,4,1,0,2,5,2,1], so:
                                     -   [" Peter Piper picked",
                                     -    " a",
                                     -    " peck of pickled peppers",
                                     -    ".\nA"," peck of pickled peppers",
                                     -    " Peter Piper picked",
                                     -    ".\nIf",
                                     -    " Peter Piper picked",
                                     -    " a",
                                     -    " peck of pickled peppers",
                                     -    ",\nWhere's the",
                                     -    " peck of pickled peppers",
                                     -    " Peter Piper picked"]
                                F    - flatten
                                 Ḋ   - dequeue (remove the leading space)
                                  ”? - literal '?' character (causes print of previous)
                                     - implicit print (of the '?' character)

JavaScript (SpiderMonkey), 114 bytes
print(`0 a1.
A1 0.
If 0 a1,
Where's the1 0?`.replace(/\d/g,n=>+n?' peck of pickled peppers':'Peter Piper picked'))

Try it online!
I would claim this answer is from ovs, anyway, 19 bytes saved.
Thanks Arnauld, saves 3 bytes.

114 bytes.

Bubblegum, 73 71 bytes
00000000: 0b48 2d49 2d52 08c8 2c00 9205 99c9 d9a9  .H-I-R..,.......
00000010: 290a 890a 05a9 c9d9 0af9 6960 819c d414  ).........i`....
00000020: 20bf 0028 5fac c7e5 884b 4a01 d31c 3d2e   ..(_....KJ...=.
00000030: cf34 0552 8cd7 e10a cf48 2d4a 552f 5628  .4.R.....H-JU/V(
00000040: c948 25c1 227b 00                        .H%."{.

Try it online!

How did you shave off bytes of a bubblegum answer?

@Laikoni the original 73 bytes answer was created using gzip on the highest compression level (-9) plus some metadata shaving using head and tail, the 71 byter is generated using zopfli, which I initially forgot about. Zopfli usually creates shorter DEFLATE streams.

Yeah, I've tried up to 5,000,000 iterations on zopfli, it couldn't find anything past the 71-byte one on iteration 3109.

Jelly, 64 60 58 57 bytes
“¡ŀṪ]ṃ{yṁ“Ñ3$ṘW5Ḍż⁸¢Hŀ»j⁾ a,Ṛẋ2ż“³ḌM“¡FỊİg“ÑɲʋØƥþƈƘ}»FḊ”?

Try it online!

Wow, surprisingly similar to another answer, with the same language and same byte count. I don't actually know what's happening in this language, so is the code basicically the same?

A lot of the overlap in the code is the identical compressed strings, which is not surprising.

@tox the two programs are currently not working in the same way (although both of us have used similar ideas as each other in the history of revisions). This one is using compressed string lists (“...“...») to form most of the four lines and then interleaving (ż) with the less repetitive parts (like ',\nIf'), again with compressed string lists; you can see how mine works from the description.

Python 2, 115 bytes
a="Peter Piper picked"
b=" peck of pickled peppers"
print a,"a%s.\nA"%b+b,a+".\nIf",a,"a%s,\nWhere's the"%b+b,a+"?"

Try it online!
Prints multiple commas-separated strings to put spaces in between them.

Python 3, 115 bytes
print("1 a2.\nA2 1.\nIf 1 a2,\nWhere's the2 1?".translate({49:"Peter Piper picked",50:" peck of pickled peppers"}))

Try it online!
Python 3's translate does the heavy lifting. Using non-printable characters with single-digit ASCII value should save two bytes.

exit saves 1 byte for the Python 3 program.

Bash, 99

4 bytes saved thanks to @manatwork.

echo "${P=Peter Piper picked} a${p= peck of pickled peppers}.
A$p $P.
If $P a$p,
Where's the$p $P?"

Try it online!

You could move the variable declarations to their first usages with assign default value parameter expansions:  Try it online!.

@manatwork Wow, I had no idea you could do that.  Pretty cool to get under 100 - Thanks!  This technique would make a good bash tips answer.

Twig, 105 bytes
This uses a simple replacement to fill in the gaps.
Twig's replace() filter allows you to define the values to replace as the keys of an hash.
Luckly, it also works with arrays, as they have numerical keys.
{{"0a1.
A1 0.
If 0 a1,
Where's the1 0?"|replace(["Peter Piper picked"," peck of pickled peppers"])|raw}}

The |raw is needed to avoid escaping, which turned Where's into Where's.
You can try it on https://twigfiddle.com/phqpts

Since this is compiled down to PHP, the equivalent for PHP would be:
<?php
    $array = array("Peter Piper picked", " peck of pickled peppers");
    $string = "0 a1.
A1 0.
If 0 a1,
Where's the1 0?";

    echo str_replace(array_keys($array), $array, $string);

Which can be shortened significatively.

Ruby, 104 bytes
/ a/=~$a="Peter Piper picked a peck of pickled peppers"
puts"#$a.
A#$' #$`.
If #$a,
Where's the#$' #$`?"

Try it online!

V, 99 87 bytes
-12 bytes: turns out 2 substitutions are shorter which is basically the same as everyone else's solution (except Bubblegum?)
i1 a0.
A0 1.
If 1 a0,
Where's the0 1?Í0/ peck of pickled peppers
Í1/Peter Piper picked

Try it online!

Java (JDK), 123 bytes
v->"".format("%s a%s.%nA%2$s %1$s.%nIf %1$s a%2$s,%nWhere's the%2$s %1$s?","Peter Piper picked"," peck of pickled peppers")

Try it online!

Are you allowed to take a required argument like that?

@Quintec Yes, if the input is unused

Python 3, 120 117 116 bytes
a,b="Peter Piper picked"," peck of pickled peppers"
exit(f"{a} a{b}.\nA{b} {a}.\nIf {a} a{b},\nWhere's the{b} {a}?")

Format strings were shorter than addition(129 bytes) and a join(140 bytes).
-3 thanks to Jo King,
-1 thanks to Jonathan Allen

That's not a format string. That's a format string. (117 bytes)

Programs may output to STDERR, so save 1 by replacing print with exit.

jq, 110 characters
(106 characters code + 4 characters command line options)
"1 a2.
A2 1.
If 1 a2,
Where's the2 1?"|gsub("1";"Peter Piper picked")|gsub("2";" peck of pickled peppers")

Sample run:
bash-4.4$ jq -nr '"1 a2.
A2 1.
If 1 a2,
Where'"'"'s the2 1?"|gsub("1";"Peter Piper picked")|gsub("2";" peck of pickled peppers")'
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?

Try it online!

SQL Server, 211
declare @a char(18)='Peter Piper picked'
declare @b char(24)=' peck of pickled peppers'
declare @c char=char(10)
print @a+' a'+@b+'.'+@c+'A'+@b+' '+@a+'.'+@c+'If '+@a+' a'+@b+','+@c+'Where''s the'+@b+' '+@a+'?'

db<>fiddle

Nice solution! A few ways to improve: for multiple variables use a comma instead of restating declare; use an actual line break in the string instead of char(10), in fact you can put the line breaks directly in the print statement and eliminate @c entirely. Pick your most-used variable and use @ by itself (its valid!)

T-SQL, 137 bytes
SELECT p+a+k+'.
A'+k+' '+p+'.
If '+p+a+k+',
Where''s the'+k+' '+p+'?'
FROM(SELECT'Peter Piper picked'p,' a'a,' peck of pickled peppers'k)b

That last return before the FROM is for readability only, the rest are part of the string concatenation.
Different method than SeanC's SQL solution.

Stax, 60 56 bytes
╣lF╤╨┴+Y╟W╪▄,○F«↑•L°T»`┼◄ü√}x![Ñ$Θ☼²qσQ¼▬ôZ¡▄╙╥⌂å╛►¶▓&╗s

Run and debug it

Here's one byte shorter unpacked, and this one seems to be making a profound statement about existence.

"i am.  Am i.  If i am,  Where's them i?"  I can't stop laughing.  This is gold.

Descartes ain't not nothin' on me.

sed, 101 100 bytes
s/^/0 a1.\nA1 0.\nIf 0 a1,\nWhere's the1 0?/
s/0/Peter Piper picked/g
s/1/ peck of pickled peppers/g

Try it online!
-1 byte thanks to @DigitalTrauma

Replace .* with ^ to save a byte

///, 86 bytes
/1/Peter Piper picked//2/ peck of pickled peppers/1 a2.
A2 1.
If 1 a2,
Where's the2 1?

Try it online!

C (gcc), 123 bytes
f(){printf("%s a%s.\nA%2$s %1$s.\nIf %1$s a%2$s,\nWhere's the%2$s %1$s?","Peter Piper picked"," peck of pickled peppers");}

Try it online!

Clean, 166 bytes
import StdEnv,Text;f="peck of pickled";g="picked";u="peppers";p="Peter Piper";s=join" "[p,g,"a",f,u+".\nA",f,u,p,g+".\nIf",p,g,"a",f,u+",\nWhere's","the",f,u,p,g+"?"]

Try it online!

Windows Batch, 179 bytes
4D534346000000009C00000000000000
2C000000000000000301010001000000
000000004200000001000100DF000000
000000000000544DB5682000612E6261
7400E59D45D15200DF00434B73484DCE
C85708482D492D5208C82C00920599C9
D9A9290A890A05A9C9D90AF96960811C
A048416A0150BE588F970BA2C911970A
2CC6C13579A69164990E4C5F78466A51
AA7AB14249462A09D6DA0300

extract %0 .bat
.bat
Self-extracting Cabinet file using Batch/CAB polyglot.
The blank line is needed for the batch file processor to find the actual batch code, but can be LF alone instead of CR/LF.
The Cabinet file is just a series of "@echo <string>" lines, and the '@' symbol suppresses the "echo" itself from being displayed.

C# (.NET Core), 123 118 116 bytes
v=>@"0 a1.
A1 0.
If 0 a1,
Where's the1 0?".Replace("0","Peter Piper picked").Replace("1"," peck of pickled peppers")

Try it online!
Inspired by @Olivier Grégoire's java answer
5 bytes saved by @sebbs

05AB1E, 78 76 74 72 bytes
’0 a1.
A10.
If0 a1,
W€Î's €€10?’TS.•1~¼ ¿•“±æ€‚ ÿÇì“'p0ǝ„íÎ´Œ™„r¾Ð«‚ðì:¦

Try it online.
Explanation:
’0 a1.
A10.
If0 a1,
W€Î's €€10?’              # String "0 a1.\nA10.\nIf0 a1,\nWhere's the10?"
TS                        # 10 to digits: ["1","0"]
.•1~¼ ¿•                  # String "pickled"
        “±æ€‚ ÿÇì“        # String "neck of ÿ pepper", where the "ÿ" will
                          # automatically be replaced with the top value of the stack
                  'p0ǝ    # Replace the character at index 0 with a "p":
                          #  "peck of pickled pepper"
„íÎ´Œ                     # String "peter pipe"
     ™                    # Titlecased: "Peter Pipe"
      „r¾Ð                # String "r picked"
          «               # Merge them together: "Peter Piper pickled"
           ‚              # Pair them together:
                          #  ["peck of pickled pepper","Peter Piper pickled"]

            ðì            # Prepend a space before each:
                          #  [" peck of pickled pepper"," Peter Piper pickled"]
              :           # Replace the ["1","0"] with this list of strings
               ¦          # Remove the leading space (and output implicitly)

See this 05AB1E tip of mine to understand why:

’0 a1.\nA10.\nIf0 a1,\nW€Î's €€10?’ is "0 a1.\nA10.\nIf0 a1,\nWhere's the10?"
.•1~¼ ¿• is "pickled"
“±æ€‚ ÿÇì“ is "neck of ÿ pepper"
„íÎ´Œ is "peter pipe"
„r¾Ð is "r picked"

Haskell, 132 bytes
g x y=x++y++x
p=g"Peter Piper picked"
q=g" peck of pickled peppers"
a=g" ".("a"++).q
f=p(a".\nA"++p".\nIf "++a",\nWhere's the")++"?"

Try it online!

PHP, 102 bytes
Basically just change the repeater words or sentences with numbers, and then apply php-strtr
<?=strtr("0 a 1.
A 1 0.
If 0 a 1,
Where's the 1 0?",["Peter Piper picked","peck of pickled peppers"]);

Try it online!
Or
PHP, 144 bytes
<?=strtr("0 1 25 a 3 of 2l5 4.
A 3 of 2l5 4 0 1 25.
If 0 1 25 a 3 of 2l5 4,
Where's the 3 of 2l5 4 0 1 25?",[Peter,Piper,pick,peck,peppers,ed]);

Try it online!

MBASIC, 146 143 bytes
1 P$="Peter Piper picked":Q$=" peck of pickled peppers":PRINT P$" a"Q$".":PRINT"A"Q$" "P$".":PRINT"If "P$" a"Q$",":PRINT"Where's the"Q$" "P$"?"

It's not very clever, but it works.

Saved 3 spaces.

Dart,  124 120  117 bytes
f(){var s='Peter Piper picked',t=' peck of pickled peppers';return"$s a$t.\nA$t $s.\nIf $s a$t,\nWhere's the$t $s?";}

-4 bytes by declaring both variables on the same row
-3 bytes by adding the leading space to 'peck of pickled peppers'
Try it on Dartpad!

Kotlin, 150 bytes
var s="Peter Piper picked"
var z=" peck of pickled peppers"
var v=s+" a"+z
var x=z+" "+s
print(v+".\n"+"A"+x+".\n"+"If "+v+",\n"+"Where's the "+x+"?")

Try it online!

Retina 0.8.2, 85 bytes

1 a0.¶A0 1.¶If 1 a0,¶Where's the0 1?
1
Peter Piper picked
0
 peck of pickled peppers

Try it online! Same idea as everyone else.

PHP, 107 bytes
<?=($a="Peter Piper picked")." a".($b=" peck of pickled peppers").".
A$b $a.
If $a a$b,
Where's the$b $a?";

Try it online!

Missing a point in the first line.

Use comma instead of concatenation to save 4 bytes: <?=$a=...," a",$b=...,...

Red, 116 bytes
prin rejoin[a:"Peter Piper picked"" a"b:" peck of pickled peppers"".^/A"b" "a".^/If "a" a"b",^/Where's the"b" "a"?"]

Try it online!
Explanation:
The job is done by the rejoin funcion, which reduces and joins a block of values.
prin rejoin [                      ; print the reduced (evaluated) and joined block
    a: "Peter Piper picked"        ; save the text to a
    " a"                           ; literal " a"
    b: " peck of pickled peppers"  ; save the text to b
    ".^/A"                         ; literal newline followed by "A"
    b                              ; " peck of pickled peppers"
    " "                            ; literal " "
    a                              ; "Peter Piper picked"
    ".^/If "                       ; literal ".^/If "
    a                              ; "Peter Piper picked"
    " a"                           ; literal " a"
    b                              ; " peck of pickled peppers"
    ",^/Where's the"               ; literal "," folowwed by a newline by "Where's the"
    b                              ; " peck of pickled peppers"
    " "                            ; literal " "
    a                              ; "Peter Piper picked"
    "?"                            ; literal "?"
]

J, 121 bytes
echo('1 a2.',CR,'A2 1.',CR,'If 1 a2,',CR,'Where''s the2 1?')rplc('1';'Peter Piper picked';'2';' peck of pickled peppers')

Try it online!

Powershell, 99 101 bytes
$a='Peter Piper picked'
$b=' peck of pickled peppers'
"$a a$b.
A$b $a.
If $a a$b,
Where's the$b $a`?"

Shouldn't $a='Peter Piper picked' ?

It appears as though the space in the $b makes your submission both longer and invalid (TIO).

Furthermore, I think you are missing a [...]Peter Piper picked? at your output's end.

Windows Batch, 129 bytes
Alternatively,
set a= Peter Piper picked
set b= peck of pickled peppers
@echo%a% a%b%.
@echo A%b%%a%.
@echo If%a% a%b%,
@echo Where's the%b%%a%?
Using LF alone instead of CR/LF combinations for line-endings.

Deadfish~, 1446 bytes
{{i}dd}c{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{{d}iii}iic{iiiiii}iiiiic{dddddd}dddddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}iii}ic{ddd}ddddddc{iiiii}iiiiic{ddd}dddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}ii}dddc{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{ddddd}ddddc{ddd}ddddddc{iiiiii}iiic{iii}dc{{d}iii}c{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{{d}iii}iic{iiiiii}iiiiic{dddddd}dddddc{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}iii}dc{ddd}ddddc{{i}dd}dddc{ii}dddcdddc{i}iiic{d}dddc{dddddd}ddc{{i}ddd}iiiiiic{{d}ii}dddc{{i}dd}iiiic{d}ddcdddc{{d}iii}ic{{i}dd}c{d}dcddc{i}ddc{{d}iii}dddddc{{i}dd}dc{d}ic{{d}iii}c{{i}dd}c{d}iiicddddddc{i}ddcic{d}iiicdc{{d}iii}iic{{i}dd}c{d}dc{i}icc{d}dc{i}iiicic{{d}ii}dddc{iiiii}ddc{ii}ic{i}iiiiic{d}dddddc{i}iiic{{d}ii}ddc{iiiii}ddc{ii}iiiiic{i}dddc{d}dc{i}iiic{{d}ii}ddc{{i}dd}c{d}iiicddddddc{i}ddcddddddcdc{dddd}iiic

Try it online!


text:
(Javascript) itertools.groupBy, e.g. [0,0,1,1,0] -> [[0,0],[1,1],[0]]
(language-specific challenge)
Specification:
Language: ECMAScript, any version[1]
Challenge: Somewhat like python's itertools.groupBy: Your function Array.group(f) should take as input an "equivalence function" f whose output defines our notion of an "equivalence key" for array elements (like a sort key). The return value of .group(f) should be an array of arrays in the same order, split whenever the value of the keyfunc parameter changes (in the === sense).
Object.defineProperties(Array.prototype, {
    group: {
        value: function(f) {/*
            CODE GOES HERE
        */}
    }
});

Examples / test cases:
> ['a','c','E','G','n'].group(x => x==x.toUpperCase())
[['a','c'], ['E','G'], ['n']]

> [1,1,'1'].group(x=>x)
[[1,1],['1']]

> [3,1,'1',10,5,5].group(x=>x+2)
[[3], [1], ['1'], [10], [5,5]]

> [{a:1,b:2,c:3}, {b:2,a:1,c:0}, {c:5}].group(x => JSON.stringify([x.a, x.b]))
[[{a:1,b:2,c:3},{b:2,a:1,c:0}], [{c:5}]]

> [].group(x=>x)
[]

Scoring criteria:
score = # of characters that replace comment above (lower is better), with easements that:

whitespace and statement-separating semicolons don't count towards total[2]
variable names and keywords each count as exactly 1 characters towards total per use[3]; this includes builtins, so Array.map.apply would be 5 'characters' (however, builtins count their full length as tiebreakers)
-5 bonus points if f being undefined has same result as the identity function x=>x
you may modify the construct function(f) {...} for recursion/combinator purposes while keeping it as a function respecting rule #5, but must subtract from your score the extra characters incurred (i.e. imagine the scoring began earlier)

Disallowances:

no side-effects which affect anything other than your code (such as modifying this, window, the prototype, etc.); as a corollary, all definitions must stay local to the .group function (e.g. x=5 would be disallowed, but var x=5 is fine)

minor notes:
[1] draft specs fine if in any major browser, proprietary extensions fine if in 2+ major browsers;
[2] as long as you don't try to compile a few megabytes-long whitespace ;-)
[3] as long as reflection is not used to abuse code-in-variable-names ;-)

Errata:
Answer may do anything reasonable with regards to sparse arrays. e.g. arr=[1,1]; arr[4]=1; arr -> [1, 1, empty × 2, 1]. Possibilities include ignoring them (like .map and friends do), or treating them as undefined (like an incremental for-loop would), or anything reasonable. For example arr.group(x=>x) might return [[1,1],[undefined,undefined],[1]], or [[1,1,1]], or even more dubious things like [[1,1],null,[1]] if it makes sense. You may also assume sparse arrays do not exist.
edit: #2 now applies to keywords.
You may find the following snippet useful to estimate score (the rules supercede this snippet though):
var code = `......`;
console.log('score estimate:', code.replace(/\w+/g,'X').replace(/[\s;]/g,'').replace(/X(?=X)/g,'X ').length, '-5?');

Do you mean Array.prototype.group instead of Array.group?

Should one just submit the function body or a function (which should assigned to Array#group later) or the full shim including assignment? What if one want change the signature of the function? (e.g, function name, more (optional) parameters, default value for f)

Yes, I was writing it as shorthand for Array.prototype.group. You can change the signature of the function as long as it still conforms to the test cases; for example, adding the parameter group(f,state) { will incur a mere -2 penalty to score (since it is 2 'characters' longer, the comma and variable name). Submit whatever seems cleanest.

You had mentioned that the submission cannot pollute the globalThis (window in browser / global in node). Is pollute this valid through?

No, it is invalid to pollute this. Thanks for checking. I should clarify; I will edit the wording of rule #5 since no one has answered this yet.

Is group() operate in-place and return this, or return an new array without modifing this?

@tsh: returns a new array

Let us continue this discussion in chat.

So as to possibly avoid the need for such clarifications, I'm suggesting using the sandbox next time! :-)

Why does x => x==x.toUpperCase() result in [['a','c']..] though x=>x+2 results in [[3], [1]..]?

JavaScript, 47 points (53 tiebreaker)
Array.prototype.group = function(f){
    const r = []
    let k = r
    for(const i of this)
        k !== (k = f ? f(i) : i) ? r.push(a = [i]) : a.push(i)
    return r
}

Body: +52
Identity comparison: -5
Full-length built-ins: +6

Try it:

Array.prototype.group = function(f){
    const r = []
    const k = r
    for(const i of this)
        k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i)
    return r
}

console.log(
    ['a','c','E','G','n'].group(x => x==x.toUpperCase()),
    [1,1,'1'].group(x=>x),
    [3,1,'1',10,5,5].group(x=>x+2),
    [{a:1,b:2,c:3}, {b:2,a:1,c:0}, {c:5}].group(x => JSON.stringify([x.a, x.b])),
    [].group(x=>x)
)

JavaScript, 48 points (56 tiebreaker)
More traditional code golf-y solution.
Array.prototype.group = function(f,r=[],k=r){
    this.map(i=>k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i))
    return r
}

Signature: +9
Body: +44
Identity comparison: -5
Full-length built-ins: +8

Try it:

Array.prototype.group = function(f,r=[],k=r){
    this.map(i=>k!==(k=f?f(i):i)?r.push(a=[i]):a.push(i))
    return r
}

console.log(
    ['a','c','E','G','n'].group(x => x==x.toUpperCase()),
    [1,1,'1'].group(x=>x),
    [3,1,'1',10,5,5].group(x=>x+2),
    [{a:1,b:2,c:3}, {b:2,a:1,c:0}, {c:5}].group(x => JSON.stringify([x.a, x.b])),
    [].group(x=>x)
)

Hopefully I got the scoring right. :P

A const variable declaration const k = r cannot be changed k=f, the value of a variable declared using let can be changed

full-length built-ins?

@guest271314 Fixed, thank you!

@ninjagecko Per your scoring criteria #2: "builtins count their full length as tiebreakers."

JavaScript (Node.js), 90 bytes, 82 points
return((o,p,O)=>this.map(v=>(O=o,(o=f?f(v):v)===O?p.push(v):p=[v])))(0/0).filter(x=>x.pop)

Try it online!

90 - 3 (this counts as 1 bytes) - 5 (default f as x=>x) = 82 points

I love the use of NaN!==NaN

Your latest edit seems to have broken the test cases.

Using NaN rather than 0/0 to have lower score?


text:
Describe a 2D Bitmap Using Filled Rectangle Mapping
Idea:
Consider a 2-bit bitmap of arbitrary side-lengths overlaid on a coordinate grid and imaged with random data (1's represent an element of the image, 0's represent the "blank" canvas background):
y x—0 2 4 6 8 10  14  18
|
0   0000000000111100000000
    0000000011111110000000
2   0000111111111111000000
    0000011111111111000000
4   0000000000000000000000
    1111111000000000011111
6   1111111111100000000011
    1111111111111111000000

Next, consider how the rasterized image may be described using a series of drawn, solid rectangles. Example:
    0 2 4 6 8 101214161820

0   0000000000111100000000
    0000000011111110000000
2   0000111111111111000000
    0000011111111111000000
4   0000000000000000000000
    xxxxxxx000000000011111
6   xxxxxxx111100000000011
    xxxxxxx111111111000000

The x's describe a region of the bitmap that may be described using a solid rectangle. Finally, consider how that rectangular section of the image can be described under the X-Y coordinate system by two of its vertices in the format:
{x0,y0,x1,y1}

In this case,
{0,5,6,7}

describes the example rectangular section.
Challenge:
Design a program which receives a 2D matrix containing bitmap data and outputs a concatenated list of rectangle coordinates.
Restrictions:
The output, when processed by remapping (plotting using 1's) the rectangles back onto a blank coordinate canvas (a canvas of all 0's) of the same side-length dimensions, should yield exactly the input matrix.
The output should be a concatenated list of all computed rectangles, no extraneous parsing characters or structures distinguishing one set of coordinates from another. The list will be read top-down, ordering will be inferred given that each rectangle requires only two coordinates to be described.
Example I/O:
(Do mind that this example in no way presents the ideal output, however, it is a valid output.)
Input 2D matrix:
0000000000111100000000
0000000011111110000000
0000111111111111000000
0000011111111111000000
0000000000000000000000
1111111000000000011111
1111111111100000000011
1111111111111111000000

Output concatenated list:
{10,0,13,3,8,1,9,3,5,2,7,3,4,2,4,2,14,1,14,3,15,2,15,3,0,5,6,7,7,6,10,7,11,7,15,7,17,5,21,5,20,6,21,6}

Efficiency score:
Programs will be ranked by their average-case efficiency using this resource (or one which functions identically) to generate pseudorandom, 2-bit, 20x20 matrices. Determine the average-case efficiency by calculating the arithmetic mean of the output lengths of at least 10 iterations (sum of the lengths divided by the number of iterations). The lesser the average length of the output, the greater the efficiency.

I have completely redesigned the phrasing and approach of the post based on everyone's input on the original. It is quite literally no longer the same post. If there is any further uncertainty, please inform me (for one thing, I'm not sure about the number of iterations in the average, but 10 seemed like enough). As it stands now, I believe I have covered all previous bases of uncertainty and confusion.

Let us continue this discussion in chat.

There is a missing comma in the example output: {10,0,13,3,8,19,3,… should be {10,0,13,3,8,1,9,3,…. Also, please edit the question to clarify whether rectangles may overlap.

@AndersKaseorg Nice find, I'm mystified as to how that comma became missing. For overlapping rectangles, there is no restriction against them so they are allowed.

@AndersKaseorg Oops, appears I eyed my own graph wrong there, thanks.

Python 3 + Z3, optimal, 51.19 ± 0.10 rectangles
(Random 20×20 bitmaps with \$\frac17\$ probability of 0, average of 10000 cases, 95% confidence interval.)
import sys
import z3

bitmap = [list(map(int, line)) for line in sys.stdin.read().splitlines()]
height = len(bitmap)
width = len(bitmap[0])
rects = set()
for y0 in reversed(range(height)):
    for x0 in reversed(range(width)):
        x2 = width - 1
        for y1 in range(y0, height):
            if bitmap[y1][x0] != 1:
                break
            x1 = x0
            while x1 < x2 and bitmap[y1][x1 + 1] == 1:
                x1 += 1
            rects.discard((x0 + 1, y0, x1, y1))
            rects.discard((x0, y0 + 1, x1, y1))
            rects.discard((x0, y0, x1, y1 - 1))
            rects.add((x0, y0, x1, y1))
            x2 = x1
cover = {
    (x, y): [] for y in range(height) for x in range(width) if bitmap[y][x] == 1
}
use = {}
for x0, y0, x1, y1 in rects:
    u = use[x0, y0, x1, y1] = z3.Bool(f"use{x0}_{y0}_{x1}_{y1}")
    for y in range(y0, y1 + 1):
        for x in range(x0, x1 + 1):
            cover[x, y].append(u)
solver = z3.Optimize()
solver.add([z3.Or(c) for c in cover.values()])
solver.minimize(z3.Sum([z3.If(u, 1, 0) for u in use.values()]))
assert solver.check() != z3.unsat
model = solver.model()
print(sum((list(rect) for rect, u in use.items() if z3.is_true(model[u])), []))

Rust
Try it online
Average case num rectangles: 57.9054 (10000 iterations of 20x20 matrices, with 1/7 probability of "0")
Solution to example input:
{10,0,13,3,8,1,14,3,4,2,15,2,5,3,15,3,0,5,6,7,17,5,21,5,0,6,10,7,20,6,21,6,0,7,15,7}
The algorithm is pretty simple: for each horizontal line of 1s, use that as the top side of a rectangle, extend this rectangle down while possible, and if it covers some previously uncovered area, add it to the list. This assumes rectangles can overlap. I have not verified whether the output is always correct, but the example input looks ok. The output was verified against the input for 10000 iterations, and it looks correct.
The code includes a benchmark function to calculate the score, and a function to draw the result. The input can be changed in the main function.
extern crate rand;
use rand::{Rng, thread_rng};

#[derive(Copy, Clone, Debug)]
struct Rect {
    x0: usize,
    y0: usize,
    x1: usize,
    y1: usize
}

impl Rect {
    fn contains_xslice(&self, xa: usize, xb: usize) -> bool {
        self.x0 <= xa && xb <= self.x1
    }
    fn contains(&self, r: &Rect) -> bool {
        // r is completely inside of self
        self.x0 <= r.x0 && r.x1 <= self.x1 && self.y0 <= r.y0 && r.y1 <= self.y1
    }
}

fn display_rects(r: &[Rect]) -> String {
    let s = r.iter()
        .map(|z| format!("{},{},{},{}", z.x0, z.y0, z.x1, z.y1))
        .collect::<Vec<_>>()
        .join(",");

    // transform 1,1 into {1,1}
    format!("{{{}}}", s)
}

fn draw_rects(r: &[Rect], w: usize, h: usize) -> String {
    let mut s = format!("");
    for y in 0..h {
        for x in 0..w {
            let p = Rect { x0: x, x1: x, y0: y, y1: y };
            if r.iter().any(|a| a.contains(&p)) {
                s.push_str("1");
            } else {
                s.push_str("0");
            }
        }
        s.push_str("\n");
    }
    s
}

#[derive(Clone, Debug, PartialEq, Eq)]
struct Matrix {
    v: Vec<u8>,
    size: (usize, usize),
}

impl Matrix {
    fn new(w: usize, h: usize) -> Self {
        Self {
            v: vec![0; w*h],
            size: (w, h),
        }
    }
    fn from_str(s: &str) -> Self {
        let mut v = vec![];
        let mut w = None;
        let mut h = 0;
        for l in s.lines() {
            h += 1;
            let mut tw = 0;
            for c in l.chars() {
                tw += 1;
                let x = match c {
                    '0' => 0,
                    '1' => 1,
                    a => panic!("Invalid input! {:?} at {},{}", a, tw, h),
                };
                v.push(x);
            }
            if let Some(ww) = w {
                if tw != ww {
                    panic!("All lines must have the same width! {} != {}", tw, ww);
                }
            } else {
                w = Some(tw);
            }
        }

        let w = w.unwrap_or(0);

        Matrix {
            v,
            size: (w, h),
        }
    }
    fn random(w: usize, h: usize) -> Self {
        let mut rng = thread_rng();
        let mut v = vec![];

        for _ in 0..w*h {
            let n = rng.gen_range(0, 6+1);
            let x = if n == 0 { 0 } else { 1 };
            v.push(x);
        }

        Matrix {
            v,
            size: (w, h),
        }
    }
    fn get(&self, x: usize, y: usize) -> u8 {
        self.v[y * self.size.0 + x]
    }
    fn hline(&self, y: usize) -> &[u8] {
        &self.v[y * self.size.0 .. (y + 1) * self.size.0]
    }
    fn hline_1_pieces(&self, y: usize) -> Vec<Rect> {
        let mut r = vec![];
        let line = self.hline(y);
        let xmax = self.size.0 - 1;
        let y0 = y;
        let y1 = y;
        let mut lineit = line.iter();
        let mut xoff = 0;
        while lineit.len() > 0 {
            // Find first non-zero pixel
            if let Some(x0) = lineit.position(|&x| x != 0) {
                let x0 = xoff + x0;
                // x0..x1 is a line of 11111
                let x1 = x0 + lineit.position(|&x| x == 0).unwrap_or(xmax - x0);
                r.push(Rect { x0, x1, y0, y1 });
                // Remember offset because the iterator is being consumed
                xoff = x1 + 2;
            }
        }

        r
    }
    fn rectangles(&self) -> Vec<Rect> {
        let mut r: Vec<Rect> = vec![];
        let ymax = self.size.1 - 1;
        // For each hline, add rectangles covering the maximum width possible
        let hpieces: Vec<Vec<Rect>> = (0..self.size.1).map(|i| self.hline_1_pieces(i)).collect();
        // Extend each rectangle down while possible
        for (y0, layer) in hpieces.iter().enumerate() {
            for rect in layer {
                let mut y = y0 + 1;
                while y <= ymax {
                    if hpieces[y].iter().any(|&r| r.contains_xslice(rect.x0, rect.x1)) {
                        y += 1;
                    } else {
                        break;
                    }
                }
                let y1 = y - 1;
                let rn = Rect { y1, ..*rect };
                if r.iter().any(|&r1| r1.contains(&rn)) {
                    // An equivalent rectangle is already in the vec
                } else {
                    // This rectangle covers some new area, push it
                    r.push(rn);
                }
            }
        }

        r
    }
}

fn benchmark(iterations: usize) -> f64 {
    let mut sum = 0;
    for _ in 0..iterations {
        let m = Matrix::random(20, 20);
        let r = m.rectangles();
        let output = draw_rects(&m.rectangles(), 20, 20);
        assert_eq!(m, Matrix::from_str(&output));
        sum += r.len();
    }
    sum as f64 / iterations as f64
}

fn main() {
    let input = "\
0000000000111100000000
0000000011111110000000
0000111111111111000000
0000011111111111000000
0000000000000000000000
1111111000000000011111
1111111111100000000011
1111111111111111000000
";
    let m = Matrix::from_str(input);
    assert_eq!(input, draw_rects(&m.rectangles(), 22, 8));
    println!("{}", display_rects(&m.rectangles()));
    println!("{}", benchmark(10000));
}

Looks like a good implementation. Does the program define the initial horizontal line by first encountering a 1, continuing on for every 1 on that row, and then ceasing the definition before the first 0 it encounters?

@B.fox exactly, it extracts all the line segments

@AndersKaseorg thanks, fixed, now the average case has increased significantly.


text:
Multiply numerical polynomials
A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by the binomial coefficients:
$$p_n = {x \choose n} = \frac{x(x-1)\cdots(x-n+1)}{n!}$$
For instance:
\$p_0 = 1\$
\$p_1 = x\$
\$p_2 = \frac{x(x-1)}{2} = \frac{1}{2}x^2 - \frac{1}{2}x\$
\$p_3 = \frac{x(x-1)(x-2)}{6} = \frac{1}{6}x^3 - \frac{1}{2}x^2 + \frac{1}{3}x\$
The product of any two numerical polynomials is a numerical polynomial, so there are formulas expressing \$p_m\times p_n\$ as a linear combination of \$p_0, p_1, ..., p_{m+n}\$.
Your job is to produce these formulas.
Goal:
Input: A pair of positive integers \$m\$ and \$n\$
Output: The list of integers \$[a_1,...,a_{m+n}]\$ of length \$m+n\$ such that
$$p_m\times p_n = \sum_{i=1}^{m+n} a_ip_i$$
This is code golf, so shortest code wins.
Examples:
Input: (1,1)
We have \$p_1 = x\$, so \$p_1\times p_1 = x^2\$. The leading term is \$1x^2\$, and the leading term of \$p_2\$ is \$\frac{1}{2!}x^2\$, so we set \$a_2 = \frac{2!}{1} = 2\$. Subtracting off \$2p_2\$ we have \$p_1\times p_1-2p_2 = x^2 - (x^2 - x) = x\$. Thus, we see that \$p_1\times p_1 = p_1 + 2p_2\$, so the output should be \$[1,2]\$.
Input: (1,2)
\$p_2 = \frac{1}{2}x(x-1)\$, so \$p_1\times p_2 = \frac{1}{2}x^2(x-1)\$, which has leading term \$\frac{1}{2}x^3\$. The leading term of \$p_3\$ is \$\frac{1}{3!}x^3\$, so we set \$a_3 = \frac{3!}{2} = 3\$. \$p_1\times p_2 - 3p_3 = x^2-x = 2p_2\$, so we deduce that \$p_1\times p_2=0p_1 + 2p_2 + 3p_3\$, so the output should be \$[0,2,3]\$.
Input (2,2)
The leading term of \$p_2^2\$ is \$\frac{1}{4}x^4\$, so we start with \$p_2^2-\frac{4!}{4}p_4\$. This has leading term \$x^3\$, so we subtract off \$\frac{3!}{1}p_3\$ to get \$p_2^2-\frac{4!}{4}p_4-\frac{3!}{1}p_3\$. This expression turns out to be equal to \$p_2\$, so rearranging we get that \$p_2^2 = 0p_1+p_2+6p_3+6p_4\$, so the output should be \$[0,1,6,6]\$.
Test Cases:
(1,1) ==> [1,2]
(1,2) ==> [0,2,3]
(1,3) ==> [0, 0, 3, 4]
(1,4) ==> [0, 0, 0, 4, 5]
(2,2) ==> [0, 1, 6, 6]
(2,3) ==> [0, 0, 3, 12, 10]
(2,4) ==> [0, 0, 0, 6, 20, 15]
(3,4) ==> [0, 0, 0, 4, 30, 60, 35]
(4,4) ==> [0, 0, 0, 1, 20, 90, 140, 70]

Just an FYI we have MathJax now so you can use \$ to write in-line equations like $ p_{m} $ instead of using images.

Looks like every test is missing the $a_0=0$ entry; so are the inputs actually going to be strictly positive integers or should (0,0) yield an empty list?

@JonathanAllan Strictly positive -- none of the polynomials have a constant coefficient so it would be kind of boring.

@FryAmTheEggman That's good to know because making the images is quite annoying.

@JonathanAllan I guess I shouldn't have given p_0 as an example of a basis element...

@Hood I've transformed the images into MathJax. I triple-checked to make sure I didn't made any mistakes, but feel free to edit if I did after all.

@KevinCruijssen Wow thanks!

APL (Dyalog Extended), 20 18 bytes
,((×⌿!\)⌹⊢!⍨\⊢)⍳⍤+

Try it online!
A tacit dyadic function that takes m and n as left and right arguments respectively. Mainly uses the matrix division built-in ⌹ to solve the linear equations:
$$
\begin{bmatrix}
\binom{1}{1} & \binom{1}{2} & \cdots & \binom{1}{n+m} \\
\binom{2}{1} & \binom{2}{2} & \cdots & \binom{2}{n+m} \\
\vdots       & \vdots       & \ddots & \vdots         \\
\binom{n+m}{1} & \binom{n+m}{2} & \cdots & \binom{n+m}{n+m}
\end{bmatrix}
\begin{bmatrix}
a_1 \\ a_2 \\ \vdots \\ a_{n+m}
\end{bmatrix}
=
\begin{bmatrix}
\binom{1}{n} \binom{1}{m} \\
\binom{2}{n} \binom{2}{m} \\
\vdots \\
\binom{n+m}{n} \binom{n+m}{m}
\end{bmatrix}
\Leftrightarrow Ba = v $$
When \$ B \$ and \$ v \$ are ready, the answer is simply v⌹B. So the main work is to golf the parts to build \$ B \$ and \$ v \$.
How it works
,((×⌿!\)⌹⊢!⍨\⊢)⍳⍤+  ⍝ Left argument: n, Right argument: m
,(            )⍳⍤+  ⍝ Pass [n m] and [1 .. n+m] to the inner function
         ⊢!⍨\⊢      ⍝ Compute B
  (×⌿!\)            ⍝ Compute v
        ⌹           ⍝ Solve the linear equation

Computing \$ B \$
x!y computes \$ \binom{y}{x} \$.
⊢!⍨\⊢  ⍝ Left: [n m], Right: [1 .. n+m]
⊢   ⊢  ⍝ Use right argument for both sides (L, R)
 !⍨\   ⍝ Outer product by flipped binomial:
       ⍝ For each pair of l∊L and r∊R, compute r!l or lCr

Computing \$ v \$
×⌿!\  ⍝ Left: [n m], Right: [1 .. n+m]
  !\  ⍝ Outer product by binomial function
      ⍝ Result is a matrix of two rows [U V]
×⌿    ⍝ Reduce by multiply; compute U×V element-wise

Haskell, 74 bytes
a%b|let a?i|a<1=0^(i-b)^2|d<-a-1=div(i*d?(i-1)-(d-i)*d?i)a=map(a?)[1..a+b]

Try it online!
Uses a recursive formulation I found. Let \$g_b(a,i)\$ be the coefficient of \$p_i\$ in \$p_a p_b\$, which is implemented in the code by a?i (with b fixed). We can express \$g_b\$ recursively as
$$g_b(a,i)=\frac{i\cdot g_b(a-1,i-1)-(a-1-i)\cdot g_b(a-1,i-1)}{a}$$
with base case
$$g_b(0,i)=
\begin{cases}
1,\text{ if }b=i\\
0,\text{ otherwise}\\
\end{cases}
$$
The base case corresponds to the expansion for \$p_b\$, which has a single nonzero coefficient of \$p_i\$ at \$i=b\$. The code implements this indicator function as 0^(i-b)^2.
The code has guards belonging to the definition of ? in the let binding. It's perhaps easier to read as the following (non-working) code where the definition of a?i expects b as a global variable. Perhaps confusingly, the a in the definition of ? is not always the same as the input to %, since it recurses down.
a?i|a<1=0^(i-b)^2|d<-a-1=div(i*d?(i-1)-(d-i)*d?i)a
a%b=map(a?)[1..a+b]

The main function % lists the coefficients for each i from 1 to a+b. It's possible to code the recursion in % directly by zipping shifted lists, but I did not find a short way to do it especially with the dependence on the position i.

Haskell, 84 bytes
n#m=[foldr1(-)[i!k*k!n*k!m|k<-[i,i-1..0]]|i<-[1..n+m]]
_!0=1
n!k=n*(n-1)!(k-1)`div`k

Try it online!
Explanation
Given a polynomial \$q\$, the following algorithm (see here) computes the unique coefficients \$a_0,a_1,\ldots\$ such that \$q=a_0p_0+a_1p_1+\ldots\$.
Let
$$
\Delta^{(0)}q(x)=q(x)\\
\Delta^{(i+1)}q(x)=\Delta^{(i)}q(x+1)-\Delta^{(i)}q(x).
$$
Then \$a_i=\Delta^{(i)}q(0)\$.
Moreover, it can be easily proved that
$$
\Delta^{(i)}q(0)=\sum_{k=0}^{i}(-1)^{i-k}{i\choose k}q(k).
$$

_!0=1
n!k=n*(n-1)!(k-1)`div`k

n!k is the binomial coefficient \$n\choose k\$.

n#m=[foldr1(-)[i!k*k!n*k!m|k<-[i,i-1..0]]|i<-[1..n+m]]

The function # computes the answer to the challenge. It simply uses the observation above to compute
$$
a_i=\sum_{k=0}^{i}(-1)^{i-k}{i\choose k}{k\choose n}{k\choose m}.
$$
The foldr1(-) is the only thing that needs explaining. When applied to a list \$[b_0,b_1,\ldots,b_l]\$, foldr1(-) returns
$$
b_0-(b_1-(\ldots-(b_{l-1}-b_l)\ldots)=\sum_{j=0}^{l}(-1)^jb_j
$$

Haskell, 108 100 bytes
I'm also keeping this one. It is, in my opinion, more elegant, albeit much more verbose.
n#m=take(n+m).tail$head<$>iterate(zipWith(-)=<<tail)[x!n*x!m|x<-[0..]]
_!0=1
n!k=n*(n-1)!(k-1)`div`k

Try it online!

_!0=1
n!k=n*(n-1)!(k-1)`div`k

n!k is the binomial coefficient \$n\choose k\$.

n#m=take(n+m).tail$head<$>iterate(zipWith(-)=<<tail)[x!n*x!m|x<-[0..]]

The function # computes the answer to the challenge. Let \$q=p_n\cdot p_m\$.

[x!n*x!m|x<-[0..]] is the infinite list
$$
\left[{0\choose n}{0\choose m},{1\choose n}{1\choose m},{2\choose n}{2\choose m},\ldots\right]
$$
i.e.
$$
[q(0),q(1),q(2),\ldots].
$$
Given a list \$[b_0,b_1,b_2,\ldots]\$, the function zipWith(-)=<<tail returns \$[b_1-b_0,b_2-b_1,\ldots]\$. Thus the code head<$>iterate(zipWith(-)=<<tail)[x!n*x!m|x<-[0..]] returns the infinite list
$$
[\Delta^{(0)}q(0),\Delta^{(1)}q(0),\Delta^{(2)}q(0),\ldots]=[a_0,a_1,a_2,\ldots].
$$
Finally with take(n+m).tail we drop \$a_0\$ and we take the first \$n+m\$ coefficients, thereby solving the challenge.

Cool! I guess this is a sort of discrete Taylor expansion.

@Hood Indeed ;)

This description also explains why p_m*p_n never involves binomial coefficients lower than min(m,n): the discrete derivative has a product rule: D(f*g)=D(f(x))*g(x+1) + f(x)*D(g(x)). Applying this k times, you can see that D^k(f*g)=D^n(f(x))*g(x+k) + D^{k-1}(f(x))*D(g(x+k-1)) + ... + f(x)*D^n(g(x)). If k<n then all of the derivatives of p_n have value zero at zero, so D^k(p_n*g)(0)=0.

Pari/GP, 46 bytes
m->n->b=binomial;[b(m,i-n)*b(i,m)|i<-[1..m+n]]

Try it online!
I did not expect the formula to be so simple: the \$i\$-th element of the output for \$(m,n)\$ is \${m \choose i-n} {i \choose m}\$.
In fact, it can be proven that \$\sum_{i=0}^{m+n} {m \choose i-n} {i \choose m} {x \choose i} = {x \choose m} {x \choose n}\$. The RHS counts the number of ways to choose two subsets of \$\{1,2,\dots,x\}\$ of size \$m\$ and \$n\$ respectively; while the LHS counts, for each \$i\$, the number of ways to choose a subset of size \$i\$, and two subsets of size \$m\$ and \$n\$ respectively whose union is the chosen subset of size \$i\$.

Pari/GP, 62 bytes
Saved one byte thanks to Mr. Xcoder.
m->n->b=matpascal(m+n);([b[i,m+1]*b[i,n+1]|i<-[1..#b]]/b~)[^1]

Sadly, GP does not have a built-in for pointwise product.
Try it online!

Nice answer. As a completely minor golf, curryinng gives -1 bytes (m->n->).

Wolfram Language (Mathematica), 37 bytes
b[r=Range@+##,#]b[#,r-#2]&
b=Binomial

Try it online!
-5 bytes thanks to att.

Wolfram Language (Mathematica), 42 bytes
Table[b=Binomial;b[#,i-#2]b[i,#],{i,+##}]&

Try it online!

Wolfram Language (Mathematica), 57 bytes
Saved one byte thanks to Misha Lavrov.
Inverse[b=Array[Binomial,0{,}+##]].(b[[;;,#]]b[[;;,#2]])&

Try it online!

We can shave off a byte by replacing +##{1,1} with 0{,}+##, as in this golfing tip.

37 bytes

JavaScript (ES6), 109 bytes
This is really just a port of Delfad0r's great answer, implemented as nested recursive functions.
Takes input as (n)(m).
n=>m=>(g=i=>i?[...g(i-1),(h=k=>k&&h(k-1)-(b=(y,x=k)=>y?x*b(y-1,x-1)/y:i-k&1||-1)(k,i)*b(n)*b(m))(i)]:[])(n+m)

Try it online!
How?
The function \$b(y,x)\$ computes:
$$-(-1)^{i-k}{x\choose y}$$
It's slightly shorter to return \$-(-1)^{i-k}\$ as the last iteration of this function than processing it separately. Because we compute the product of three binomial coefficients, the signs of the first two of them are simply cancelling each other out.
The function \$h()\$ is used to compute:
$$\sum_{k=1}^{i}-b(k,i)\times b(n,k)\times b(m,k)\\
=\sum_{k=1}^{i}{(-1)^{i-k}{i\choose k}{k\choose n}{k\choose m}}$$
And the function \$g()\$ is used to compute each term \$a_i\$ for \$1\le i \le n+m\$.

Maxima, 55 bytes
Golfed version. Try it online!
f(m,n):=makelist(binomial(m,i-n)*binomial(i,m),i,1,m+n)

Ungolfed version. Try it online!
f(m,n) := block(
    local(i),
    makelist(binomial(m,i-n)*binomial(i,m), i, 1, m+n)
)$

for x in [[1, 1], [1, 2], [1, 3], [1, 4], [2, 2], [2, 4], [3, 3], [3, 4], [4, 4]] do (
    print(x[1], " -> ", f(x[1], x[2]))
)$

Haskell, 61 bytes
n#m=[n!(m+n-i)*i!n|i<-[1..n+m]]
_!0=1
n!k=n*(n-1)!(k-1)`div`k

Try it online!
Based on @Delfad0r's answer, but using the formula in my PARI/GP answer.


text:
Minimal Power Root
The minimal power iteration of a number \$n\$ is defined as follows:
$$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$
That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(32)=32^2=1024\$ and \$\text{MPI}(1234)=1234^1=1234\$.
The minimal power root of a number \$n\$ is defined as the number obtained from repeatedly applying \$\text{MPI}\$ until a fixed point is found. Here is a table of the minimal power roots of numbers between 1 and 25:
   n              MPR(n)
--------------------------
   1                   1
   2                   1
   3              531441
   4                   1
   5                3125
   6 4738381338321616896
   7                   1
   8            16777216
   9                   1
  10                   1
  11                  11
  12                  12
  13                  13
  14                  14
  15                  15
  16                  16
  17                  17
  18                  18
  19                  19
  20                   1
  21                  21
  22                   1
  23              279841
  24                   1
  25                   1

Challenge: Generate the numbers whose minimal power root is not equal to 1 or itself.
Here are the first 50 numbers in this sequence:

3, 5, 6, 8, 23, 26, 27, 29, 35, 36, 39, 42, 47, 53, 59, 64, 72, 76, 78, 82, 83, 84, 92, 222, 223, 227, 228, 229, 233, 237, 239, 254, 263, 267, 268, 269, 273, 276, 277, 278, 279, 285, 286, 287, 289, 296, 335, 338, 339, 342

Rules

You may generate the first n numbers of this sequence (0- or 1-indexed), generate the nth term, create a generator which calculates these terms, output infinitely many of them, etc.
You may take input and give output in any base, but the calculations for MPR must be in base 10. E.g., you may take input ### (in unary) and output ### ##### ###### (in unary)
You must yield numbers. You may not (e.g.) output "3", "5", "6", since those are strings. 3, 5, 6 and 3 5 6 are both valid, however. Outputting 2 3, "23", or twenty-three are all considered invalid representations of the number 23. (Again, you may use any base to represent these numbers.)
This is a code-golf, so the shortest code (in bytes) wins.

Just curious, how could you prove that a fixed point is found eventually for all n?

@nwellnhof (Rough proof.) Suppose there is no fixed point of $x$, i.e., $\text{MPR}(x)$ doesn't exist. Let $x_i$ be the $i$-th iteration of the $\text{MPI}$ function over $x$. This sequence is strictly increasing, since $a^b>a^{b^c}$ for all $a,b,c\ge2$. Being strictly increasing, the probability of no digit in $x_i$ being 0 or 1 tends towards 0 as $x_i$ tends towards $\infty$.

Huh. The oeis doesn't have this sequence.

@ConorO'Brien That shows your hypothesis is plausible, but it doesn't prove it.

@kasperd Thus the "rough proof" before it.

I don't understand this challenge. What is the actual goal that determines the result? It's the minimum power of n that fulfils... what condition?

@FabianRöling The challenge is to find what n eventually results in after applying $\text{MPI}$. E.g., for 23, you perform MPI, giving MPI(23) = 23^min(digits(23)) = 23^min(2, 3) = 23^2 = 529. This is the first iteration. Again, MPI(529) = 529^min(5, 2, 9) = 529^2 = 279841. This is the second iteration. Once more, MPI(279841) = 279841^min(2,7,9,8,4,1) = 279841^1 = 279841. Here, MPI(279841) = 279841, and we cannot go any further without repeating the results. Thus, MPR(23) = 279841. We are looking for numbers n such that MPR(n) != 1 && MPR(n) != n.

Oh, you take the lowest digit as the power, got it. And if it's 0? Then you get to number^0=1, 1^1=1, fixed point or what?

@FabianRöling yes

Is it OK if we omit numbers whose MPRs do not fit inside the range of numbers supported in our language? For example, the MPR of 335 is outside of the bounds of the largest integer type in my language.

05AB1E, 8 bytes
Generates the nth number 1-indexed
µNÐΔWm}‹

Try it online!
Explanation
µ          # run until counter equals input
 NÐ        # push 3 copies of the current iteration index (1-based)
   Δ  }    # run this code until the result no longer changes
    Wm     # raise the number to the power of its minimum digit
       ‹   # check if greater than the index

Optionally as an infinite list at the same byte count:
∞ʒDΔWm}‹

Try it online!

Wait, is that all?.. That looks so much simpeler than I thought it would be.. >.> I'll delete my answer, since it's more than twice as long..

@KevinCruijssen: I am a bit surprised myself. Thought it would take 12 or so bytes when looking at the task.

I twiddled with µ and Δ right after the challenge was posted and got this exact same answer, but I was wondering why it didn't work... I used D rather than Ð because I thought one copy would have been used by the fixed-point function and the other by the smaller-than function, but I didn't take into account that I needed yet another copy. Thanks, Emigna, for solving my Enimga.

Perl 6, 49 bytes
{grep {($_,{$_**.comb.min}...*==*).tail>$_},1..*}

Try it online!
Returns an infinite sequence. I suppose that the following 45 byte version works, too, but I can't prove that the fixed point is always found after n iterations.
{grep {($_,{$_**.comb.min}...*)[$_]>$_},3..*}

J, 41 39 37 bytes
(>:[echo^:(<(^0".@{/:~@":)^:_))^:_]1x

Try it online!
This one is a full program printing the infinite sequence. A very rare occasion where a full program beats a verb in J.
How it works
(>:[echo^:(<mpi_fix))^:_]1x    Using the mpi_fix below; it finds the MPI fixpoint
          (<mpi_fix)           Is mpi_fix greater than the input?
    echo^:                     If so, apply echo; do nothing otherwise
                               echo returns an empty array
 >:[                           Discard the above and return input+1
(                   )^:_       Repeat the above infinitely (increment has no fixpoint)
                        ]1x    starting from arbitrary-precision number 1

J, 41 39 bytes
>:^:(>:(^0".@{/:~@":)^:_)^:_@>:@]^:[&0x

Try it online!
A monadic verb. Given a 1-based index, returns the number at that index. The footer checks that first 20 terms are correct.
Reading the word "fixpoint", I immediately thought "Oh yeah, ^:_ will do the great job." Then I ended up with this abomination of angry and sad faces. And it's not even a train, it's a single verb.
Ungolfed & How it works
nth_term =: >:^:(>:(^0".@{/:~@":)^:_)^:_@>:@]^:[&0x

mpi =: ^0".@{/:~@":    Find the MPI
             /:~@":    Sort the string representation
        0   {          Take first item
         ".@           Convert back to number
       ^               Raise the input to the power of above

mpi_fix =: mpi^:_      Find the MPI fixpoint

next_term =: >:^:(>:mpi_fix)^:_@>:    Given a number, find the next term
                               @>:    Increment once, and then...
                  >:mpi_fix           Is mpi_fix not greater than input?
             >:^:           ^:_       Increment while the above is true

nth_term =: next_term@]^:[&0x    Given one-based index, find the nth term
            next_term@]          Apply next_term monadically
                       ^:[       n times
                          &0x    to the starting value of zero

The arbitrary-precision integer 0x is needed to compute the fixpoint accurately, e.g. of the number 6.

Great! That's a lot of ^:, my head starts to ache on the second of them :)

(>:[(<(^{.@/:~&.":)^:_)echo])^:_]1x

33 bytes: _&(_&(]]+]>:(^{.@/:~&.":)^:_)>:)* taking input as an extended integer

Mathematica, 59 51 bytes
-8 bytes thanks to Misha Lavrov.
Select[Range@#,#<(#//.x_:>x^Min@IntegerDigits@x)&]&

Pure function. Takes a number as input, and returns the list of terms up to that number as output. Nothing very complicated here.

FixedPoint is usually not as good as //. (short for ReplaceRepeated) in code golf. Here, we may save a few bytes with Select[Range@#,1<(#//.x_:>x^Min@IntegerDigits@x)!=#&]&.

Also, if MPI(x) is neither 1 nor x, then it is always bigger than x, so an even shorter solution is Select[Range@#,#<(#//.x_:>x^Min@IntegerDigits@x)&]&.

Jelly, 10 bytes
*DṂƊƬḊCȦµ#

A monadic Link taking an integer, I, from STDIN which yields the first I entries.
Try it online!
(*DṂƊƬṪ%@µ# works for 10 too)
How?
Counts up starting a n=0 until input truthy results of a monadic function are encountered and yields those ns.
The function repeatedly applies another monadic function starting with x=n and collects the values of x until the results are no longer unique. (e.g.: 19 yields [19]; 23 yields [23,529,279841]; 24 yields [24, 576, 63403380965376, 1]; etc...) and then dequeues the result (removes the leftmost value), complements all the values (1-x) and uses Ȧ to yield 0 when there is a zero in the list or if it's empty.
The innermost function raises the current x to all the digits of x and then keeps the minimum (doing this is a byte save over finding the minimum digit first).
*DṂƊƬḊCȦµ# - Link (call the input number I)
         # - count up from 0 and yield the first I for which this yields a truthy value:
        µ  -   a monadic chain:
    Ƭ      -     collect until results are not unique:
   Ɗ       -       last three links as a monad:
 D         -         convert to a list of decimal digits
*          -         exponentiate
  Ṃ        -         minimum
     Ḋ     -     dequeue
      C    -     compliment
       Ȧ   -     any-and-all?

Clever usage of  ƬḊCȦ over there. :-)

Ṫ> picks up 0 :(

Pyth, 10 bytes
.f>u^GshS`

Try it online!
This generates a list of the first \$ n \$ such numbers. The auto-filled program has GZZQ as a suffix. This simply finds (.f) the first Q numbers that have a minimal power root u^GshS`G greater than itself Z.
The minimal power root code works by finding a fixed point u of raising the current number G to the power of it's minimal digit, which is the same as the first digit (h) sorted lexicographically (S), then converted back to an integer (s).

Python 3, 90 88 bytes
-2 bytes by @mypetlion
def F(x):m=x**int(min(str(x)));return[int,F][m>x](m)
x=1
while 1:x<F(x)and print(x);x+=1

Try it online!
print as an expression saves two bytes over using if statement in Python 2. F computes the MPI fixpoint; the rest gives the infinite sequence to STDOUT.

Change return m>x and F(m)or m to return[int,F][m>x](m) to save 2 bytes.

78 bytes

Haskell, 67 62 bytes
filter((<)<*>until((==)=<<g)g)[1..]
g a=a^read[minimum$show a]

Returns an infinite list.
Try it online!

Ruby, 52 bytes
x=1;loop{b=x+=1;1while b<b**=b.digits.min;b>x&&p(x)}

Try it online!
Prints infinite sequence

51 bytes (uses $. instead of x, saves initialization)

Java 10, 178 173 bytes
v->{for(int x=1,m;;){var b=new java.math.BigInteger(++x+"");for(m=9;m>1;)b=b.pow(m=(b+"").chars().min().orElse(0)-48);if(b.compareTo(b.valueOf(x))>0)System.out.println(x);}}

Port of @GB's Ruby answer, so also prints indefinitely.
Try it online.
Explanation:
v->{             // Method with empty unused parameter and no return-type
  for(int x=1,   //  Start an integer `x` at 1
      m;         //  Temp integer for the smallest digit, starting uninitialized
      ;){        //  Loop indefinitely
    var b=new java.math.BigInteger(++x
                 //   Increase `x` by 1 first
          +"");  //   And create a BigInteger `b` for the new `x`
    for(m=9;     //   Reset `m` to 9
        m>1;)    //   Loop as long as the smallest digit is not 0 nor 1
      b=b.pow(m=(b+"").chars().min().orElse(0)-48
                 //    Set `m` to the smallest digit in `b`
              ); //    Set `b` to `b` to the power of digit `m`
    if(b.compareTo(b.valueOf(x))>0)
                 //   If `b` is larger than `x`:
      System.out.println(x);}}
                 //    Print `x` with a trailing newline

JavaScript (Node.js), 98 90 89 86 bytes
-3 bytes thanks @Conor O'Brien

function*(){for(n=0n;;x>n&&(yield n))for(x=++n;(b=Math.min(...""+x))-1;)x**=BigInt(b)}

Try it online!
Using the fact that \$MPR(n)>n\$ if \$MPR(n)\notin \{1,n\}\$
Seems that a generator is shorter than returning an array of n numbers?
Or printing infinitely - 72 bytes
for(n=0n;;x>n&&alert(n))for(x=++n;(b=Math.min(...""+x))-1;)x**=BigInt(b)

Try it online!

86 bytes by moving some of the control flow around, eliminating braces. (mainly: if(x>n)yield n to x>n&&(yield n) as an expression)

JavaScript (Node.js), 75 bytes
Returns the \$n\$th term, 1-indexed.
f=(i,x=n=1n)=>(N=x**BigInt(Math.min(...x+'')))>x?f(i,N):(i-=N>n)?f(i,++n):n

Try it online!

C (gcc), 171 153 138 bytes
__int128 m,a,t,h,s;r(){for(a=10,h=s;a=fmin(h%10,a),h/=10;);a=pow(s,a);a-s&&r(s=a);}f(n){for(;t-n;a-1&&a-m&&printf("%lu ",m,t++))r(s=++m);}

Outputs the first n terms whose MPRs are representable within the largest "integer" type.
Brute-forces the solution but still works surprisingly fast.
Some things may be able to be inlined (such as r, which is only called once), but it may require a decent amount of effort.
See previous revision for solution without -lm.
-18 bytes thanks to ceilingcat!
-15 bytes and ultra-precision thanks to rtpax!
Try it online!

Vyxal, 6 bytes
λfge;Ẋ

Try it Online!
λ   ;Ẋ # While result changes...
 f     # Convert to digitlist
  g    # Take minimum
   e   # Number to power of that

JavaScript (Chrome), 78 77 bytes
F=x=>(m=x**BigInt(Math.min(...''+x)))>x?F(m):m
for(x=0n;++x;)x<F(x)&&alert(x)

Try it online!
Port of my own Python 3 solution. The latest version of Chrome supports BigInt (tested on my PC). Don't try this code as-is on your browser though.

lol was about to golf my answer but you got the lead. 77 bytes Also 77 bytes, my planned golf

Racket, 270, 257 233 bytes
(define(f n)(local((define(m x)(expt x(-(first(sort(map char->integer(string->list(~v x)))<))48)))(define(g y)(if(= y(m y))y(g(m y))))(define(k x l)(if(=(length l)n)l(if(< x(g x))(k(+ x 1)(cons x l))(k(+ x 1)l)))))(reverse(k 1'()))))

Try it online!
This is my first Racket submission, so it can definitely be golfed much further. Nevertheless I'm somewhat content, at least for managing to solve the task.
More readable:
(define (f n)
  (local ((define (m x)
           (expt x
                 (- (first (sort (map char->integer (string->list (~v x)))
                                 <))
                    48)))
         (define (g y)
           (if
             (= y (m y))
             y
             (g (m y))))
         (define (k x l)
           (if (= (length l) n)
               l
               (if (< x (g x))
                   (k (+ x 1) (cons x l))
                   (k (+ x 1) l))))
    (reverse (k 1 '()))))

Axiom, 168 bytes
u(x)==(y:=x::String;x^reduce(min,[ord(y.i)-48 for i in 1..#y])::NNI)
q(a:PI):PI==(b:=a;repeat(c:=u(b);c=b=>break;b:=c);b)
z(x)==[i for i in 1..x|(m:=q(i))~=1 and m~=i]

The function to use it is z(); here it print numbers that has the corrispondence
one number not 1, not itself and are less than its argument.
(6) -> z 1000
 (6)
 [3, 5, 6, 8, 23, 26, 27, 29, 35, 36, 39, 42, 47, 53, 59, 64, 72, 76, 78, 82,
  83, 84, 92, 222, 223, 227, 228, 229, 233, 237, 239, 254, 263, 267, 268,
  269, 273, 276, 277, 278, 279, 285, 286, 287, 289, 296, 335, 338, 339, 342,
  346, 347, 348, 354, 358, 363, 365, 372, 373, 374, 376, 382, 383, 386, 392,
  394, 395, 399, 423, 424, 426, 427, 428, 432, 433, 435, 436, 442, 447, 459,
  462, 464, 466, 467, 468, 469, 476, 477, 479, 483, 487, 488, 489, 493, 494,
  523, 524, 527, 529, 533, 537, 542, 546, 553, 556, 557, 562, 563, 572, 573,
  577, 582, 583, 584, 594, 595, 598, 623, 626, 627, 629, 632, 633, 642, 646,
  647, 648, 663, 664, 669, 672, 676, 682, 683, 684, 693, 694, 695, 698, 722,
  724, 729, 736, 759, 763, 773, 775, 782, 786, 823, 829, 835, 846, 847, 856,
  873, 876, 885, 893, 894, 896, 923, 924, 928, 933, 953, 954, 962, 969, 973,
  974, 984, 993, 994, 995]
                                               Type: List PositiveInteger

Visual Basic .NET (.NET Core), 290 bytes (includes imports)
Iterator Function A()As System.Collections.IEnumerable
Dim i=B.One,q=i,p=i
While 1=1
q=i-1
p=i
While q<>p
For j=0To 9
If p.ToString.Contains(j)Then
q=p
p=B.Pow(p,j)
Exit For
End If
Next
End While
If p>1And p<>i Then Yield i
i+=1
End While
End Function

Try it online!
Requires the following import:
Imports B = System.Numerics.BigInteger

This uses an iterator function to return an infinite (lazy loaded) list of integers that meets the criteria. Uses BigInteger to avoid any size restrictions, particularly with intermediate calculations.
Un-golfed:
Iterator Function A() As System.Collections.IEnumerable
    Dim i As B = 1
    While True
        Dim prevProduct As B = 0
        Dim product As B = i
        While prevProduct <> product
            For j = 0 To 9
                If product.ToString.Contains(j) Then
                    prevProduct = product
                    product = B.Pow(product, j)
                    Exit For
                End If
            Next
        End While
        If product <> 1 And product <> i Then
            Yield i
        End If
        i += 1
    End While
End Function

Common Lisp, 238 bytes
(defun x(m n o p q)(setf i(sort(map 'list #'digit-char-p(prin1-to-string m))#'<))(setf j(expt m(first i)))(cond((= q p)nil)((and(= n j)(not(= n 1))(not(= n o)))(cons o(x(1+ o)0(1+ o)p(1+ q))))((= n j)(x(1+ o)0(1+ o)p q))(t(x j j o p q))))

Try it online!

APL(NARS), 96 chars, 192 bytes
r←f w;k;i;a
   r←⍬⋄k←1
A: i←k
B: →C×⍳i=a←i*⌊/⍎¨⍕i⋄i←a⋄→B
C: →D×⍳(a=k)∨a=1⋄r←r,k
D: k+←1⋄→A×⍳k≤w

test (partial result for argument 22 seems to much big so <21 arguments I don't know if can be ok)
  f 21
3 5 6 8

Python 3, 102 bytes
x=int(input())
a=c=0
while x:
 a+=1;b=a
 while b-c:b,c=b**int(min(str(b))),b
 x-=b!=1and b!=a
print(a)

Try it online!
Decided to try a Python 3 solution that directly prints the nth term in the sequence.

Looks like you're not using any Python 3 features. Quick golfing in Python 2 gives 87 bytes.

Infinite output gives 77 bytes.

Japt, 44 bytes

_ì ñ g
_gV ¥1?Z:ZpZgV)gW
@@[1X]øXgW}fXÄ}gUÄ

Try it online!
Substantially different from the other Japt answer.
Explanation:
                        Empty line preserves the input

_ì ñ g                Function V finds the smallest digit in a number Z
 ì                          Get the digits of Z
   ñ                        Sort the digits
     g                      Get the first (smallest) digit

_gV ¥1?Z:ZpZgV)gW     Function W finds the MPR of a number Z
 gV ¥1?Z                    If V(Z) is 1, then it's stable; return it
        :ZpZgV)             Otherwise get MPI of Z...
               gW           And call W on it ( MPR(Z) == MPR(MPI(Z)) )

@@[1X]øXgW}fXÄ}gUÄ    Main program
@             }gUÄ      Get the nth number by repeatedly applying...
 @        }fXÄ              Find the next smallest number X which returns false to...
       XgW                    MPR(X)
      ø                       is either...
  [1X]                        1 or X

In terms of future golfing possibilities, I do a lot of manually calling a function on a number, which I suspect could be reduced but I'm not sure how.

Husk, 16 12 10 bytes
fS>ωṠ^o▼dN

Saved 6 bytes thanks to H.PWiz.
Try it online!
Explanation
fS>ωṠ^o▼dN
f        N       Filter the natural numbers where...
   ω             ... the fixed point...
    Ṡ^o▼d        ... of raising the number to its smallest digit...
 S>              ... is greater than the number.

You can change >¹ here with S>. This allows you to put it all in one line. Also, it appears that you have mistakenly left in the previous tio link

C (clang) + -DL=long long -lm, 213 bytes
q(char*a,char*b){return*a>*b;}L f(L a){char*c;asprintf(&c,"%lld",a);qsort(c,strlen(c),1,q);L b=pow(a,*c-48);return b>a?f(b):b;}i;g(j){for(i=0;j;i++){L x=f(i);x!=i&x!=1&x>0&&printf("%d\n",i)&&j--;}}

Try it online!
Function g(j) prints the first j terms of the sequence.

Return with a=... to save a dozen or so bytes.

And x>1 instead of x!=1&x>0.

The first one requires a change to GCC, though.

Jelly, 14 bytes
3*DṂ$$ÐLḟ1,$Ɗ#

Try it online!

Python 3, 54 bytes
lambda n,x=0:n!=x and f(n**min(map(int,str(n))),n)or n

Try it online!

Burlesque, 35 bytes
r0f{J{J<]**}{J<]1!=}w!J1!=x/x/!=&&}

Try it online!
"Produces" the infinite list of MPRs (i.e. never finishes, never prints). For a finite list use:
Burlesque, 36 bytes
ri{J{J<]**}{J<]1!=}w!J1!=x/x/!=&&}FO

Try it online!
Takes an integer input N and tests the first N values
r0      # All integers starting from 0
f{      # Filter for
 J      # Duplicate original value (for later)
 {
  J     # Duplicate current value
  <]    # Minimum digit
  **    # Raise current value to power of min digit
 }
 {
  J<]   # Find minimum digit (non-destructive)
  1!=   # Not equal to 1
 }w!    # While current value does not contain 0 or 1
 J      # Duplicate output
 1!=    # Not equal to 1
 x/x/   # Reorganise stack
 !=     # Output is not equal to original
 &&     # AND not equal to 1
}

Dash (or other generic Bourne shell) + bc, 190 bytes
a=0
while :
do
a=`echo $a+1|bc`
b=$a
while :
do
for m in `seq 0 9`
do
case "$b" in
*$m*)break;;
esac
done
case $m in
0)break;;
1)[ $a = $b ]||echo $a;break;;
esac
b=`echo $b^$m|bc`
done
done

Try it online!
This implementation prints the infinite sequence -- as far as it is allowed.
I specifically did not use bash arithmetic because I didn't want the limit of bash's number system.  If you change the line a=0 to a=$1, you can start looking at any number (though subtract 1 if you want the first number considered).  Passing in 9922289264447635429194, I found part of the sequence is:

9922289264447635429236
  9922289264447635429254
  9922289264447635429323
  9922289264447635429328
  9922289264447635429335

I thought those were just floating-point errors in my program...

@S.S.Anne   well, it is trivial to get huge numbers in the calculation.   22 -> 484 -> 54875873536 -> 165251092644282265779977014214656 -> 1.  And I avoided them by using bc and treating the numbers as strings.  But I also wanted to be able to get numbers in the sequence exceeding what an integer could represent.  Ideally, your program should have no floating point values.

Well it uses pow (exponentiation) which is only available for floating-point numbers.

@S.S.Anne.  right, but there is a limit to precision.  on x86, you actually get as much precision just multiplying the unsigned long longs as using powl().  On other platforms (my Raspberry PI) you get more.  Having said that, you nominally need 108 bits of precision to verify 22 is not in the sequence.  If you are lucky enough to get a 0 in the first 10-12 digits, ok, but otherwise...