text:
Almost a Columbo episode
Your task is to find two missing characters in a Columbo episode title.
Input
One of the 69 Columbo episode titles (as listed below), with exactly two characters replaced with *.
Example:
"Ran*om for a *ead Man"

Output
You may either return the full episode title, or just the two missing characters in any reasonable format, provided that the order of the characters is unambiguous.
Some valid outputs:
"Ransom for a Dead Man"
"sD"
["s", "D"]

Episodes
Please follow this link to get the unformatted list.
Prescription: Murder        Swan Song                             Murder, Smoke and Shadows
Ransom for a Dead Man       A Friend in Deed                      Sex and the Married Detective
Murder by the Book          An Exercise in Fatality               Grand Deceptions
Death Lends a Hand          Negative Reaction                     Murder: A Self Portrait
Dead Weight                 By Dawn's Early Light                 Columbo Cries Wolf
Suitable for Framing        Troubled Waters                       Agenda for Murder
Lady in Waiting             Playback                              Rest in Peace, Mrs. Columbo
Short Fuse                  A Deadly State of Mind                Uneasy Lies the Crown
Blueprint for Murder        Forgotten Lady                        Murder in Malibu
Etude in Black              A Case of Immunity                    Columbo Goes to College
The Greenhouse Jungle       Identity Crisis                       Caution: Murder Can Be Hazardous to Your Health
The Most Crucial Game       A Matter of Honor                     Columbo and the Murder of a Rock Star
Dagger of the Mind          Now You See Him...                    Death Hits the Jackpot
Requiem for a Falling Star  Last Salute to the Commodore          No Time to Die
A Stitch in Crime           Fade in to Murder                     A Bird in the Hand...
The Most Dangerous Match    Old Fashioned Murder                  It's All in the Game
Double Shock                The Bye-Bye Sky High IQ Murder Case   Butterfly in Shades of Grey
Lovely But Lethal           Try and Catch Me                      Undercover
Any Old Port in a Storm     Murder Under Glass                    Strange Bedfellows
Candidate for Crime         Make Me a Perfect Murder              A Trace of Murder
Double Exposure             How to Dial a Murder                  Ashes to Ashes
Publish or Perish           The Conspirators                      Murder With Too Many Notes
Mind Over Mayhem            Columbo Goes to the Guillotine        Columbo Likes the Nightlife

Clarifications and rules

Storing the list of episodes (or storing enough information to guess the missing characters) is part of the challenge. In other words, you don't get the list 'for free'. If using external files, their lengths must be added to your byte count.
Your program/function must support the titles exactly as listed above:

The case of each letter must match exactly.
The punctuation must also match exactly.
Etc...

All characters in the title may be replaced with *, not just letters. They might be contiguous.
You may expect another 'blank' character instead of *, as long as it does not appear anywhere in any title. (If so, please mention it in your answer.)

Ah, there's just one more thing. I almost forgot...

This is code-golf, so the shortest answer in bytes wins!

Test set
Here is a link to all 14252 possible inputs.

Yay, a reason to use levienstien distance in 05AB1E.

The (original) title compressing (~2k chars) is part of the challenge? Or can we receive it as input / assume that it's in one variable / stack, etc?

@Rod It's part of the challenge. I've added the error-correction tag which, I think, is appropriate here.

Unfortunate that there's both A and a in the list of unique strings that exist.

Not too surprisingly, the most common word is murder, beating out the and a.

If it's of any help to anyone, this is the list of characters used in the titles: ',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz (and <space>, of course).

On top of that, there are no two movies which have exactly 2 characters different and are of the same length.

Had a 600 byte answer in 05AB1E that failed on deciding A vs a... crying

Stax, 294 bytes
ê(·▲[*▬è0↑u■<pá{∞♫┼¢]$Fò╦7τ}αzoN≡ù÷♥R♪♪éé#Ä↑♂¼y>Φp←E├Tì·æ≈ßÿOÄ╩%▼Åp}∞½É÷_~ï♦♪s○╨5╓ok½♪◄}§3vimεå╩p"G4ƒs┬]K╡àbá•Ä◄E°µte\τ╚¥∞LH¥êoc▐I/♥∞íJ{σ↓⌠╢§♥]8<µ6ε∩╠ån¥←A↨⌡↨▼♠áiåcTε╛ëJv⌡♂'┬û▒╟_E2↑☺│╚ê£-vç╘▬╒ì)#Φ¼∟æ∟q⌐▀☻7w_ì~Δc'Ω∙j≡┼Γó2"äV√n◘j≤╦╓ΘiL.,▲♂▌▼∞ccñó╘î←iaΩï)NCøAP┼b_ε☺Cam╥~αDM↕Aä<₧¿é■N/╞τQ╠Γù>b^S>◘á↑

Run and debug it
Here's the approach:

Consider each possible substitution of characters for asterisks.  I'm using upper and lower-case letters, plus the handful of punctuation marks.
Interpret each candidate as a base-91 integer.  Why 91?  It covers the span of possible characters in the input, it's prime, and it's 2 digits.  It just seems good.  I don't know if it's optimal.
Modulus by a carefully chosen denominator. (359473561)  Then check for a the existence of the result in the embedded hash array.  If there's a match, that's the correct substitution.

In order to verify that no incorrect result would be produced, I used a C# program to verify the output for all possible inputs.  It's not very portable, and it's quite long running.  I've been letting it search for more than 24 hours for candidate denominators so far, so it's not really suitable for TIO.  I'm running it in LINQPad.
const string AllChars = " ',-.:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const int Base = 91;
const int InputCount = 14252;

void Main() {
    string filename = Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), "titles.txt");
    var titles = File.ReadAllLines(filename);
    Console.WriteLine("Original titles: {0}", titles.Length);
    Console.WriteLine("All characters: {0}", AllChars.Length);

    var originalHashes = titles.Select(Hash).ToArray().Dump("Original hashes");

    BigInteger candidateMod = 359473561; //BigInteger.One * InputCount * AllChars.Length * AllChars.Length * titles.Length;
    BigInteger? bestMod = null;
    BigInteger failJump = 1;

    var candidateContainer = new DumpContainer(candidateMod).Dump("Candidate");
    var bestContainer = new DumpContainer(bestMod).Dump("Best");
    var rateContainer = new DumpContainer().Dump("Candidates / s");

    int tested = 0;
    var sw = Stopwatch.StartNew();

    while (true) {
        bool success = TestCandidateMod(candidateMod, titles, originalHashes);
        if (success) {
            bestContainer.Content = bestMod = BigInteger.Min(bestMod ?? candidateMod, candidateMod);
            candidateMod = candidateMod * 99 / 100; // reduce by 1%;
        }
        rateContainer.Content = ++tested * 1e3 / sw.ElapsedMilliseconds;
        candidateContainer.Content = --candidateMod;
    }
}

bool TestCandidateMod(BigInteger candidateMod, string[] titles, BigInteger[] originalHashes) {
    var moddedHashes = new HashSet<BigInteger>(originalHashes.Select(h => h % candidateMod));

    bool TitleIsOk(string title) {
        BigInteger originalHash = Hash(title);
        for (int i1 = 0; i1 < title.Length - 1; i1++) {
            BigInteger placeValue1 = BigInteger.Pow(Base, title.Length - i1 - 1);
            foreach (var c1 in AllChars) {
                int offset1 = c1 - title[i1];
                BigInteger hash1 = originalHash + placeValue1 * offset1;
                for (int i2 = i1 + 1; i2 < title.Length; i2++) {
                    BigInteger placeValue2 = BigInteger.Pow(Base, title.Length - i2 - 1);
                    foreach (var c2 in AllChars) {
                        int offset2 = c2 - title[i2];
                        if (offset1 == 0 && offset2 == 0) continue;

                        BigInteger hash2 = hash1 + placeValue2 * offset2;
                        if (moddedHashes.Contains(hash2 % candidateMod)) {
                            return false;
                        }
                    }
                }
            }
        }
        return true;
    }

    return titles.AsParallel().AsUnordered().All(TitleIsOk);
}

BigInteger Hash(string title) => title.Aggregate(BigInteger.Zero, (a, b) => a * Base + b);

Another note about the storage of the embedded hash values in the program.  The hashes are sorted prior to embedding in the array.  I'm using a stax feature called "crammed integer arrays" which is a way of efficiently representing integer arrays.  This representation is able to store differences between elements if that's more efficient, so pre-sorting the values saves some bytes.
Here's the unpacked representation with some minimal comments.
Vl" ',-.:"+:2   all pairs of replacement characters
f   filter
 ;'*/s\$1T  do replacement
 91|E   base-91 digits
 359473561% mod by denominator
 ">m\zR^ehBT}/!P*Nv:0N?s}FGN\:M.RT0r2VVm560$k;!yP<I*&R0_&q6wEcg8)&DsZ_!}&}Y&:Ngv&B::n!g6y &&eej...Z-&J..7!Rso36>y89:*iA*eNHGBmZ5!kiZ5*D(};*Xgkvwqn^(g?!kJib&g$ep!aDaA!Xw$_!w,2E.6NFG6DPat&(u4?28BIRu<bBL\S!ugPf!Ry;&T0\/^y\S{gu;!\0spo!^3!}X0l!i$L5&Z8@|!X4}p.LyU:X2M&PR6Y!k*,[F(&v&(ZJ5Jo0d!RN!hsDFvV.kI*{u@_!a<oGoqsG2}XhJ:2,"!
 #  count occurrences in crammed array

Just magnificent.

Python 2, 862 bytes
00000000: 2363 6f64 696e 673a 3433 370a 696d 706f  #coding:437.impo
00000010: 7274 2072 652c 7a6c 6962 0a6c 616d 6264  rt re,zlib.lambd
00000020: 6120 733a 7265 2e66 696e 6461 6c6c 2873  a s:re.findall(s
00000030: 2e72 6570 6c61 6365 282a 222a 2e22 292c  .replace(*"*."),
00000040: 7a6c 6962 2e64 6563 6f6d 7072 6573 7328  zlib.decompress(
00000050: 2222 2278 da65 54cb 96da 3810 fd95 da65  """x.eT...8....e
00000060: 93e9 0fc8 ce40 80ce 810e c13d a74f 9605  .....@.....=.O..
00000070: 2eb0 4ecb 2a46 8f10 cfd7 e796 0c9d d702  ..N.*F..........
00000080: b08d 54f7 2937 a997 4459 a9a9 179f 7d47  ..T.)7..DY....}G
00000090: 4b4e bdd3 201d 6d4b ec24 d2ce f378 e0e3  KN.. .mK.$...x..
000000a0: 2b3d f742 730d e9e2 2267 8de9 bee0 df60  +=.Bs..."g.....`
000000b0: df2b cf29 d15e 5226 1768 277c 94f7 b48d  .+.).^R&.h'|....
000000c0: e901 7b7c 190e 4a6b bd1a d4c2 b127 be6f  ..{|..Jk.....'.o
000000d0: 5ef0 f98c 1f3d 51c6 f8ad 0b60 a0f1 ac39  ^....=Q....`...9
000000e0: 4ba0 0d77 23cd 7c91 4b74 21d3 49e3 7d9b  K..w#.|.Kt!.I.}.
000000f0: 71d9 2ab0 e6b1 1c6d e08a 073c e157 7c09  q.*....m...<.W|.
00000100: a6ef 249e e498 df96 472d 070f 4d2f 9c05  ..$.....G-..M/..
00000110: cc1b 9a73 1243 7d1c 8612 5c5c 1ee9 b193  ...s.C}...\\....
00000120: 90ed 621e 5d72 893e e6d2 8949 9979 13bf  ..b.]r.>...I.y..
00000130: e4e9 0e02 7ea1 301b e51f 7ca8 7d1d 69ed  ....~.0...|.}.i.
00000140: ce3d 3d7e b9ff 5d01 7651 d231 ba4b 86a3  .==~..].vQ.1.K..
00000150: 1f7e f3eb a8df eaa5 701a 69e3 2c05 b337  .~......p.i.,..7
00000160: ea35 5013 e8e3 772c 71a9 422e 39b3 3766  .5P...w,q.B.9.7f
00000170: 0db5 6078 eced 2158 42f0 a2ca c2ea 8ba6  ..`x..!XB.......
00000180: 12e5 cdea 8d7b bd4d 7c02 abec dd09 6b85  .....{.M|.....k.
00000190: 730f 9679 fae3 1354 5d34 4302 32b8 8677  s..y...T]4C.2..w
000001a0: 50cc d11b 176c f8e9 ef82 03f2 d182 b4d9  P....l..........
000001b0: a077 5c30 74a9 2744 018f ed6a 9abb 91d0  .w\0t.'D...j....
000001c0: 2518 bf66 2488 47b0 5aea a406 e6a3 0be6  %..f$.G.Z.......
000001d0: f54d 7f0d f9b3 c9df f2d8 cb40 ad7c 27db  .M.........@.|'.
000001e0: 561b c031 3ab1 1119 f9b9 6f82 0140 ce53  V..1:.....o..@.S
000001f0: 47d6 1ad4 ac2d bf19 3a67 a424 80fe 9f63  G....-..:g.$...c
00000200: 6754 11d2 572d 91d6 c21e dc56 7122 7594  gT..W-.....Vq"u.
00000210: 1a44 7ab3 e90d 749a 035c 30a6 bd22 ed36  .Dz...t..\0..".6
00000220: 73a4 27a5 6733 b976 f6a7 b72b 9d8e 0cee  s.'.g3.v...+....
00000230: bd9c 851e 33bc 6bbc afed c0b0 dac4 0de2  ....3.k.........
00000240: 8599 b392 e14c ee51 d01b c68b 03a1 6745  .....L.Q......gE
00000250: 8b38 8c80 c818 f684 8301 bef0 0122 dcf0  .8..........."..
00000260: f0f0 40cd 197e f29f 8d5f 4591 d043 21e2  ..@..~..._E..C!.
00000270: 2be1 8ce4 dbe2 325b 056c e532 f2e0 c219  +.....2[.l.2....
00000280: eca3 a506 4fba 9378 af57 2bfc ccc5 ee4e  ....O..x.W+....N
00000290: d142 3294 0d23 e196 7dc9 5565 6da0 0e83  .B2..#..}.Uem...
000002a0: 76fa 4b97 d034 707c 517f 4292 63f5 6c5e  v.K..4p|Q.B.c.l^
000002b0: ab80 8356 0f28 86be b0cb 86dc d4e8 211c  ...V.(........!.
000002c0: 06e6 2973 0bfb 56d3 b637 6f6f 7ab0 6b8b  ..)s..V..7ooz.k.
000002d0: 5a1f ca5f c656 138b 0371 cc14 f310 e99f  Z.._.V...q......
000002e0: 7c05 6a7b 9cc3 6483 e1c5 789f 7518 eba6  |.j{..d...x.u...
000002f0: 99ea 7dfc 073b 2c02 ca3b 8d70 c365 da73  ..}..;,..;.p.e.s
00000300: 483a 549f 782a 2812 304a 31d3 d21c 6daf  H:T.x*(.0J1...m.
00000310: 76af 50b1 97ff 8a93 fbda 257b 3fb9 6a9d  v.P.......%{?.j.
00000320: 9033 d756 eef1 82b3 3259 f93a d799 5a5b  .3.V....2Y.:..Z[
00000330: 3e1d cb06 d1da bbd4 c08d 3563 b3c6 e1c6  >.........5c....
00000340: ed3d b583 e245 654e 9a9e 299f 256c 0e35  .=...EeN..).%l.5
00000350: a185 48f7 0304 28f2 1d22 2222 2929       ..H...(.."""))

Here is a bash script that assembles this program and demonstrates its execution.
Explanation
This is a fairly simple solution: I looked for the most compressable permutation of the titles as joined by spaces. This program simply replaces * in the input by ., and looks for a match of that a regular expression inside the string.
The string decompresses to:
How to Dial a Murder Forgotten Lady No Time to Die Old Fashioned Murder Suitable for Framing Fade in to Murder Agenda for Murder The Conspirators Requiem for a Falling Star A Case of Immunity Candidate for Crime Any Old Port in a Storm Troubled Waters Rest in Peace, Mrs. Columbo Short Fuse Try and Catch Me Death Lends a Hand Double Exposure Strange Bedfellows Lady in Waiting Now You See Him... Prescription: Murder Grand Deceptions Columbo and the Murder of a Rock Star Etude in Black Dagger of the Mind Undercover A Friend in Deed Caution: Murder Can Be Hazardous to Your Health The Greenhouse Jungle Blueprint for Murder The Bye-Bye Sky High IQ Murder Case Columbo Goes to College Ransom for a Dead Man Publish or Perish Lovely But Lethal Playback Ashes to Ashes A Trace of Murder By Dawn's Early Light A Deadly State of Mind Sex and the Married Detective Murder Under Glass Columbo Likes the Nightlife Uneasy Lies the Crown Death Hits the Jackpot Mind Over Mayhem Columbo Goes to the Guillotine Murder by the Book A Bird in the Hand... It's All in the Game Negative Reaction Double Shock Make Me a Perfect Murder The Most Crucial Game Butterfly in Shades of Grey An Exercise in Fatality Last Salute to the Commodore A Stitch in Crime Swan Song Murder in Malibu Murder, Smoke and Shadows Murder With Too Many Notes A Matter of Honor The Most Dangerous Match Dead Weight Identity Crisis Columbo Cries Wolf Murder: A Self Portrait

JavaScript (ES6), 634 bytes
This submission was meant to remain hidden until an answer of less than 500 bytes was published. Which has now been done.
s=>[..." ',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz"].some((x,_,a)=>!a.every(y=>'kmpyjzlu83giljc0o4nvjfsic25kyom2obemwt8b1434qdrd9tuyqjk6lqyhbwi8rpv6aiw91v5s50psxbs7fb5zx3j8e09lscyct7assemgy9rqg15jqv3ulcg76mhtd57dlcoalt99155ot34at8towx1stbymusf5l0lqubd75ri8edrftn1dfkvfwxmc1akftcluh9z58vo8apk79wr6f1lwbvi4nebpuy0n8ducjbzg9osmujjn3rvvkoqw6jp4zn2tcaawx8r0johdvm650uk0ju97rvl806y7bfaf8m0i8h4jk3xetxe2m0r4slgwuoabjmvvoq81koc00m0bd7q32qlwpne04odf6uxaw9nvo3i8x18904y5d56r98j39rc18vkqfkhe4z5gjzht0lgj8y'.indexOf((1e5+[...S=s.replace(/\*/g,_=>i++?y:x,i=0)].reduce((h,c)=>(h*123+c.charCodeAt())>>>0,0).toString(36)).slice(-6))%6))&&S

Try it online! (one random test case per episode)
How?
We define chr, the list of characters used in the episode titles.
chr = " ',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz"

We define hash, a string containing the hashes of all unobfuscated titles. Each hash consists of a 6-digit number in base-36.
hash =
  'kmpyjzlu83giljc0o4nvjfsic25kyom2obemwt8b1434qdrd9tuyqjk6lqyhbwi8rpv6a' +
  'iw91v5s50psxbs7fb5zx3j8e09lscyct7assemgy9rqg15jqv3ulcg76mhtd57dlcoalt' +
  '99155ot34at8towx1stbymusf5l0lqubd75ri8edrftn1dfkvfwxmc1akftcluh9z58vo' +
  '8apk79wr6f1lwbvi4nebpuy0n8ducjbzg9osmujjn3rvvkoqw6jp4zn2tcaawx8r0johd' +
  'vm650uk0ju97rvl806y7bfaf8m0i8h4jk3xetxe2m0r4slgwuoabjmvvoq81koc00m0bd' +
  '7q32qlwpne04odf6uxaw9nvo3i8x18904y5d56r98j39rc18vkqfkhe4z5gjzht0lgj8y'

We define H(), a simple hash function.
H = s => (                      // given s
  1e5 +                         // prepend '100000' to make sure we have enough leading 0's
  [...s].reduce((h, c) =>       // for each character c in s:
    (h * 123 + c.charCodeAt())  //   update h to h * 123 + ASCII code of c
    >>> 0,                      //   force an unsigned 32-bit integer
    0                           //   start with h = 0
  ).toString(36)                // encode the result in base-36
).slice(-6)                     // and keep only the last 6 digits

This gives log2(366) ~= 31 bits of entropy. By rounding this to 4 bytes and adding the size of chr, the total size of the payload data is: 4 * 69 + 53 = 329 bytes.
The main function now reads as:
s =>                          // given an obfuscated title s
  [...chr].some((x, _, a) =>  // for each character x in chr:
    !a.every(y =>             //   for each character y in chr:
      hash.indexOf(           //     look for the position in the hash string
        H(S = s.replace(      //       of the hash value of the string S
          /\*/g,              //         obtained by replacing in s the two '*'
          _ => i++ ? y : x,   //         with x and y
          i = 0               //         i = counter
        ))                    //       end of call to H()
      ) % 6                   //     apply modulo 6 -> forces every() to fail when it's 0
    )                         //   end of every() -> forces some() to succeed when it fails
  ) && S                      // end of some(); return S

(This was exhaustively tested against all possible inputs.)

I had a feeling there were much better ways to do this.  A target is set...

Apparently, you beat the heck out of Jelly's string compression, which I don't think can be beaten by another approach in Jelly. Brilliant.

@EriktheOutgolfer Well, thanks! But I'm not compressing anything here, so these methods cannot really be compared.

Wolfram Language 1383 1226 bytes
EditDistance finds the Levenshtein distance between strings.
f@i_:=Sort[{i~EditDistance~#,#}&/@StringSplit[Uncompress@"1:eJxtVU1vGzcQzam/Y3rqJTHaHnPThyU5kBxFq8Ao0MtIO9olzOWoJNfK5tfnkVzZStCDjSU55Lw3783o94PuKvnt3butl3D05hyNuo+06X0t/t8///p7xy5oRyf1xDQXrmnDLh2UEDoMFFuhqepz2kVEbGktrg6IX7Grx92ansQ0bUzLqjeRD1byqwvPnXFN2l9zPZBx9MQmjltVqz7Sog+SVlPby9kbF/PNN5D3sa8l3ZxaPmYce2BaehHXKu7Sp941Vq4HGw2RZr4/Gra05C4fzLlpwEdPmc/GFOQ7+a83cuW/YGsBjKrIOe8EXyYe25R65k33c4Y5O7yI/CgZgnIS7RNvsCow1/oidqBpH1Gz2LLNr7qBPtuatok6XmZkUd+loxkKamqOpXSvKcdn77+dNfQ+b22xY0JLCNuKx1fWDKzo8wtobnhoJT9ZXdhRpaXcE8hhIF5KOxepCxw8LP5oQi7xgiNbE4d09CgNR/MitBM+JudkkQYwv7g/At2zB7n1Vfa9zzDhBBDwIaO0PBxGySbZXriA6oIghLiKsFDfaIziKDmkxM445JiHruvdCOehFgc9hlSYYEIJRO1j0XWlTrNsj3qhf7SnSoRWpru7uyvug2YV2x7Jo2YXzLTrtNZS0QUXj+HszXlJpwWHFtxB7G0/mWA6yAf8UfU8IE3T0sOXMSKjLyUZCJJinVy0kZvG+urS/6XlkIls+Bm2EpgBcp7kGG+SrcAHqObJzvwLiJm6cDae4aD8zkxt3x2UlirhSnPZG2sVLXeT/z1VnSJlQle1XOslX6/kW97KPcIeZqkhWwQe2CAFLH06nstR8igJby9+JLSL2FP2tUeL38KBYsDzpPaUVWvgQf6lyXcScjts4TV5Txsf7mi8no6/OuGQ3JZ4JeJeL7eDCjc3MO6h/78qYG2lkdJi/e0MhDQYK/AJf2dfp2ZGOMzjaSVsY3v72mthyk1YjmmHTn+dF2U6rkwsED/B+WeNxZK0RzMXGaU4d2p8bsQUmibp6NOHiNaaWHs9ug4wDBEY/WTzCE2SgRogYAoOpT7AdMS8yUgqKIDpBGb1SSD+ZeyWvUdxc++91n0S2lKk/HFT0ScDMnvV9Isw0KNG+clha/M8SvGYJoA1J/kBVHorKg==",{"\n"}]][[1,2]]

f["Ran*om for a *ead Man"]

"Ransom for a Dead Man"

Python 2, 621 bytes
C='6PX2OHRR3M431R8RODFNHWX44MRFXJFPZ3FH5D9920XJ6DQRBGY02VNRZETRUTVB0TH9V3T0C0VKA5NLPVQ6T9IUVNSSHXMDQORLA842O8MJQEM46Y6BKW9IQWXOL02MTRLM5L1APZFUXO1EY880ECSXKW0GO1YJPTW7P56X0B6ZSMJBUDS2FZIQ4XPAS5PHQL6HEICDMJQKQZXGISSQ4F0KBLG0ODLEJXYUVNUP5IS27GIMC5FBZFAK6PU5WOEFBOJZHXBGBJYMB8Z0GQH5VFJW6JQ0BVJAQAW7KJ56R0DF35U5IGBO2U22VQPWMBIP8IAH0Y1TU9VGRWDHR59G4HELD8491GJECIQNH9ERA2IRMOBM2DMYSN87Z1NBLEBMEYI4AV40ZPP2MC4DPQRMOT16IUAACE'
H=[int(C[i::69],36)for i in range(69)]
P="acbedgfihkjmlonqpsrutwvyxz";P+=P.upper()+" '-,.:"
f=lambda s:[t for h,t in[(hash('B'+s.replace('*','%s')%(i,j))%(36**6),i+j)for i in P for j in P]if h in H][0]

Try it online!
Note: Dang! Just saw this is essentially the same as Arnauds solution...
Not fully golfed yet...
The basic idea here: create a list of hashes of the titles, modulo 36^6 (this requires 6 bytes per title; plus some overhead).
Now, given a title with two missing characters, brute force substitute the two possible letters, and check to see if the resulting string's hash is in the list.
By preprending 'B' to the titles and using Python's hash function, we get a list which never has collisions in that task; so there will always be one and only one possible answer.

Jelly, 752 bytes
“¬pẋEĠṬɓV;_÷¡×KḌƤ0m®Ạ-^jSƁhṙ#4¶µ.zbọẒṂhʋhe]ÇjỴėṖ=½%ẓ>ẆḃḥḞ-€VœØsỊv^ḅṇŒ#ċyṂkḅṄɠmS3HṬ`ØỵṆ(ṆƇṀßI(ċɓẊ^Ʋs#ç⁺&ð⁸³Iṙ}ṃỌ¤zhṡ¥ẉeE/WḌĊEd⁸ġƝẈµ9raẒ[ḳėŒnÞ*ƒṭɓ>>^ƓdeɦlCḥƘ-=Ʋẓ"÷:V}Ṅ⁼ƭbÇḤƁẊ21ẋṄŻėḢ⁴GG⁷ñ,ụƥṭ6ʂ¥ƊsØĖż]ṗŀṙĠ⁷ṀĿt$²ỵÞ(ŻṙS¥pḥƝ|þœ¹fX{bbð*ṾẹḢGẊmʠḲḤFẎṘṣʋ¡f⁺}4Sọ(Ẉḅ¿ọṿỌŒ0mo@ƒ⁻ıƲỊḢ#ẹ⁵ŀạƭėµdƙæṀ|ḷ2¶TḲẈżḣƁ/ṃạHṠVf¿2ỊþfnṪðF:=WẒXȷḂ5ȧẓ®ƥƤḃ0¿ṬỌḥg4Ụ3Ḅ(ⱮƬZƒẈİu<Ð6ImṖƇṁgḊƘBƤṡ⁾ȯ=ƓẆ{œƙYṅb÷ėÞṬSȷƁḌɱyƒþwỊK¬6t=ėṡ⁽Ṡƥġ-ẒḞOṙOṾ.Eḣḋqṣ,¢¬ƒṗ3ṾỌƓ¤þṗñỤṫ#Ḷġ*żėṣĖƈ1)zḄ×l⁻ñ:ẊẎY®ɠ4ƭ⁹ṪqạƬẒẆO_jṃgẓ¶ɓẎṆ⁼Ẹ⁴9%*'ọḌṅṅþḷḄ*Þ9ɓ&ȯ'~æ:⁷ịẒ⁸t)!ẸƙȥṫỴỵṢ ẏxƓ}ɠ+£¡Ṃ¦ṗẏÞæẊA²Ʋ#ẹƊ!£Æụ½:eUỌƒṾịụ&ḋȤ#lṖ*M¤fçȮṫo]ṗXṚ'+8ỊEẋ8{{Sṇ85⁺VɦrF¢c,[£Nȯœ/ʋñṄṬƑỤsṗxṿŒ¿€Ỵ¥ƬƭṂṂỤẋogṠṡḢÆṭzƘȯ:Ẓ¹ḥṃṄạėPȦ4ṗḋĊ⁵Ḣẋṛ⁷oNHAnṃ÷°5ṿ¿Ṗ,%ßĠṠ⁷ṂÐrEʋėỌẊƲXœ>*þƒƲẇÐĠṪṀ$:İƥøs²ṗ)}ṇ5⁻g¦eLʠCı32ṾŻƲƘ¹$²ƘsĿÇḳPṬẒƘẎlṂṫ8ɦɓ4ẸþCẈạOỌẏŻḲⱮʠÑ<ʠĊṣßỌK7Ø5],⁸ƒjḂƥ⁷»Ỵ©=ċ€0i2ị®

Try it online!
Used this to compress the list.
This assumes that there is no movie which has exactly 2 characters different than another movie, which is proven here (output 1).

Ruby, 1185 1165 bytes
->s{t="Pr@c2p#:[Trac}of[F2)X>6ed_Ag)d14~_Bluepr`0f^[6(lVSt?}3M`d_F(}>&[C%}3Immun;y_OlXF%hi7ed[M?tK 3H7^_UndKcovK_A9t;c/>C2mZMak}M}1PKfect[BirX`jH]d<Sho8jGuillot`ZHow & Di5 1~=Mos0Cruci5 GamZ~,9mok}]XSh(ow+It's All `jGamZ*W;/Too M]VNot@_C]did?}4C2mZ~: A9elf P^tra;_Su;abl}4Fram`g_*>M5ibu_Sw]97g_*UndK Gl%+L(V>Wa;`g_*byjBook{C2@ Wolf_Playback{]dj*31Rock9tar_Etud}>Bla8 CollegZNow Y$9e}Him<Exposure{Lik@jN!lifZ6?/L)ds 1H]d=Mos0D]gK$s M?ch_DaggK ofjM`d=Bye-By}SkVHig/IQ *C%ZR]som 416aXM]_Sex ]djMar2eX6tectivZAn ExKcis}>F?5;y_Gr]X6cep#+Neg?iv}Reac#_6aXWe!_BVDawn's EarlVL!_Tr$bleXW?K+R@0>Peace, Mrs. Columbo_Sh^0FusZUne%VLi@jCrown_F^gott) L(y=Gre)h$s}JunglZId)t;VC2si+Cau#: *C] B}Hazard$s & Y$r He5th_6?/H;sjJackpot_Requiem 41F5l`g9tar_L%t95ut}&jCommod^ZNo Tim}& DiZButtKflV>Sh(@ 3Grey_LovelVBu0Leth5_TrV]XC?c/MZAnVOlXP^0>a9t^m_Str]g}Bedfellow+Ash@ & Ash@_Publis/^ PKish=C7spir?^+M`XOvK Mayhem"
"!ight|#ti7|$ou|%as|&to|(ad|)en|*~ |+s_|/h |0t |1a |2ri|3of |4f^ |5al|6De|7on|8ck{Go@ to|9 S|;it|<..._Doubl}|=_Th}|>` |?at|@es|Ker|Vy |Xd |Ze_|[ ~_A |]an|^or|`in|j th}|{_Columbo |}e |~Murder".scan(/[^|]+/){|u|t.gsub!u[0],u[1..-1]}
t.split(?_).find{|u|u.match?s.gsub(?*,?.)}}

Try it online!
A lambda accepting a string and returning a string. Uses some homebrewed string expansion. There's probably room for golfing both in how the title is chosen from the expanded list, and in how exactly the list is compressed.
-20 bytes: Rearrange the order of the list (by hand) to increase substring repetition
Ungolfed:
->s{
  t="Pr@c2p#:..."            # t will expand to an underscore-delimited list of titles
  "!ight|#ti7|$ou|..."       # This is a pipe-delimited list of substitutions
    .scan(/[^|]+/){|u|       # For each substring consisting of non-pipe characters:
      t.gsub! u[0], u[1..-1] #   Each substitution's first character is the key
    }
  t.split(?_)                # Split t into individual titles
    .find{|u|                # Find the first title where:
      u.match? s.gsub(?*,?.) #   Treating the input as a regex yields a match
    }
  }

Here is a snippet of the greedy substitution selection algorithm I used to generate this code. I've omitted some details so it won't work as-is, but it should give the gist.
chars = (0..127)
  .map(&:chr)
  .select{|c| c.inspect.size == 3 && !titles.include?(c)}

substitutions = []

while !chars.empty?
  most_valuable_substring = Hash
    .new{ |hash,key| hash[key] = 0 }
    .tap{ |reps| titles.substrings.each{ |sb| reps[sb] += 1 } }
    .select{ |sb,count| count > 1 && sb.size*count > 4 }
    .sort_by{ |sb,count| sb.size*count }
    .last
    .first

  c = chars.pop
  substitutions << c + most_valuable_substring
  titles.gsub! most_valuable_substring, c
end

p titles
p substitions.reverse.join "|"

Java 10, 1426 1405 1381 1315 1313 1298 bytes
s->{var i=new java.util.zip.Inflater(0<1);i.setInput(java.util.Base64.getDecoder().decode("ZVTLjts6DP0VAlp00zsf0F0ek2SKeJo7TjHokrEZW4gs5UpyM75f30Pl0QJdGDBE6vDw8FC7KKmJ9pxt8F+oGmMr0dQX9lQH35nrwWeqh3ASYt9S3XMbLsm8sU9hoGOIxLQUbqlib2a0ilaQZj0OpTW1fJRruRckRARbBLI02f6UGzwdphKfh3AyM0/PHxIbm0RBVpzZ2TyZdVSYpTRSuCaDmrmnLYolMNggal6lY8WlN+FGs24FvtCManFH2oWYI9tsCuF3sV2fzXyiJV/8p0TPHN1E23K6CG4cDoEWoJzoPbijqUeb+eCkNL2KPFgotI9hxBnQOEtMZtaBEZeUm5pbbidt5R2F9cbO8XTg5mTeJGUN7MBWPlMV0xPdypq6B1VajUmgqbIFsTqjBIUjVRbNfvfCSdmCnqq3iOHizdyNco7W5z8ZrELsQs7iSbncVUflCtoeRvOcx7aoPXfKa0YLTqXQyzCMXtW/q7EOWi0oTSedmD0Kr6OI7wOo0tfRd07MSys+45qKl2wyCx7/9BfgUUows/85trioiD/CGGkj7HJfUKsAcRZxbCw7WvOgOlSMJqIS2wQf4oPVw2BXeMSZ3kJzUsWiWXLXXU9Ljmr3Gi5aEKYACzs8PT3d7LSx+armVwhxDhkz+m+0cvf5ip3DCK+4WwbDmt2IoaCBMoMwDKENUVCB9nYogaVV7jUEaXoVGaKgmxVfJUfCbUozmttYNkeh1NDK66HFkj3aULUgQ9Obb64Fn9RDWLjvhvGSYeOZc3eUItyyOBSbC0kK3nySf/BRfZrQcdfTy7+/RwPHzUfV+eiKbXXhMXTIh0FPZht+CgJIwe7lnh02YCoTWCgtqgTOBFKDPPTkJ1KiungKxtAhxOFuwZJJa8cpmRqbiQ5hjPYozukbA5+0tlXTq/xX3SrGQ1ThLcLaxCPekd/y7SP2qOzH9eTW9/PHOaQRM9lg6mUecBQ/rqX+aunyY3a4YlNPqAd8/BXBFnhwzjYyuKc793cLv+xD0HdvoteQcVvNRd/QOA6nXoa/9qbMZLRoD0+BPMJbe7pt8as+Ps4e5Rc="));var b=new byte[1433];i.inflate(b);i.end();for(var t:new String(b).split("#"))if(t.matches(s.replace("*",".")))System.out.print(t);}

-66 bytes thanks to @OlivierGrégoire by encoding the String.
Explanation:
Try it online.
Here is the code for the encoder.
s->{                        // Method with String parameter and no return-type
  var i=new java.util.zip.Inflater(0<1);
                            //  Create the decoder
  i.setInput(java.util.Base64.getDecoder().decode(
                            //  Put the following encoded String in the decoder
     "ZVTLjts6DP0VAlp00zsf0F0ek2SKeJo7TjHokrEZW4gs5UpyM75f30Pl0QJdGDBE6vDw8FC7KKmJ9pxt8F+oGmMr0dQX9lQH35nrwWeqh3ASYt9S3XMbLsm8sU9hoGOIxLQUbqlib2a0ilaQZj0OpTW1fJRruRckRARbBLI02f6UGzwdphKfh3AyM0/PHxIbm0RBVpzZ2TyZdVSYpTRSuCaDmrmnLYolMNggal6lY8WlN+FGs24FvtCManFH2oWYI9tsCuF3sV2fzXyiJV/8p0TPHN1E23K6CG4cDoEWoJzoPbijqUeb+eCkNL2KPFgotI9hxBnQOEtMZtaBEZeUm5pbbidt5R2F9cbO8XTg5mTeJGUN7MBWPlMV0xPdypq6B1VajUmgqbIFsTqjBIUjVRbNfvfCSdmCnqq3iOHizdyNco7W5z8ZrELsQs7iSbncVUflCtoeRvOcx7aoPXfKa0YLTqXQyzCMXtW/q7EOWi0oTSedmD0Kr6OI7wOo0tfRd07MSys+45qKl2wyCx7/9BfgUUows/85trioiD/CGGkj7HJfUKsAcRZxbCw7WvOgOlSMJqIS2wQf4oPVw2BXeMSZ3kJzUsWiWXLXXU9Ljmr3Gi5aEKYACzs8PT3d7LSx+armVwhxDhkz+m+0cvf5ip3DCK+4WwbDmt2IoaCBMoMwDKENUVCB9nYogaVV7jUEaXoVGaKgmxVfJUfCbUozmttYNkeh1NDK66HFkj3aULUgQ9Obb64Fn9RDWLjvhvGSYeOZc3eUItyyOBSbC0kK3nySf/BRfZrQcdfTy7+/RwPHzUfV+eiKbXXhMXTIh0FPZht+CgJIwe7lnh02YCoTWCgtqgTOBFKDPPTkJ1KiungKxtAhxOFuwZJJa8cpmRqbiQ5hjPYozukbA5+0tlXTq/xX3SrGQ1ThLcLaxCPekd/y7SP2qOzH9eTW9/PHOaQRM9lg6mUecBQ/rqX+aunyY3a4YlNPqAd8/BXBFnhwzjYyuKc793cLv+xD0HdvoteQcVvNRd/QOA6nXoa/9qbMZLRoD0+BPMJbe7pt8as+Ps4e5Rc="));
  var b=new byte[1433];     //  Create a byte-array to contain the decoded bytes
  i.inflate(b);             //  Decode it
  i.end();                  //  Let the decoder know we're done
  for(var t:new String(b)   //  Convert the byte-array with decoded bytes to a decoded String
            .split("#"))    //  And loop over the titles
    if(t.matches(           //   If a title matches
        s.replace("*",".")))//   the input with all "*" replaced with a regex-wildcard "."
      System.out.print(t);} //    Print this title

1315 bytes (Encoder)

Further hints: keep the Deflated byte array in a file. Then read with java.nio.Files.readAllBytes(java.nio.Paths.get("a")). This way, no bas64 required.

@OlivierGrégoire Thanks. I decided to not implement the second comment, because I prefer to run it on TIO and it's not competitive with the other answers anyway. One question about the encoder/decoder: How are the 796 and 1397 determined?

Okay, it's your call :-) The nubers are the sizes of the deflated/inflated arrays after processing. They are determined by replacing d.deflate(b) and i.inflate(b) with System.out.println(d.deflate(b)) and System.out.println(i.inflate(b)). If you golf the text, you should update the array sizes.

By the way, the 1290 golf fails for 2 test cases.

@OlivierGrégoire Hmm, but d.deflate(b) and i.inflate(b) use the byte-arrays b, which already have a size.. How do I know which size those b are before calling deflate/inflate?

First run: var bytes = new byte[9999], and output the number. Second run: replace the 9999 by the outputted value, and remove the System.out.println(). If you don't do this, your String will very likely have a wrong size and will the output will be messed up, that's probably what happened with the 1290 golf. The API is supposed to work with buffers, but in our case, we want to golf, so we have to precalculate those values. If we don't, we lose bytes.

I confirm that the 1290-golf issues are solved by using the correct values (803 instead of 796, and 1433 instead of 13XX) and is then 1298 bytes instead of 1290.

@OlivierGrégoire Ah oops. I was working on changing that when a co-worker came asking some questions, so I forgot saving the edit.. Thanks for the reminder. ;)


text:
Facey McFaceface
Anyone remember Boaty?
You could totally make any old word, right?

Write a function to turn a string into Somethingy McSomethingface.
It should accept one string as input. Ignore the case of the input.
If the word ends in 'y', your function should not add an additional 'y' to the first instance, but should remove it in the second instance.
If the word ends in 'ey', it should not have an additional 'y' added in the first instance, but should remove both in the second instance.
The output should only have upper case letters in the first character, the 'M' of 'Mc' and the first character after 'Mc'.
it only needs to work with strings of 3 or more characters.

Examples:
boat                  =>  Boaty McBoatface
Face                  =>  Facey McFaceface
DOG                   =>  Dogy McDogface
Family                =>  Family McFamilface
Lady                  =>  Lady McLadface
Donkey                =>  Donkey McDonkface
Player                =>  Playery McPlayerface
yyy                   =>  Yyy McYyface
DJ Grand Master Flash =>  Dj grand master flashy McDj grand master flashface

What about spaces in the string, do we leave them intact?  Examples: '   y' and '      '

I’m going to implement a suggestion from @Arnauld and make it three characters minimum. Treat whitespace just like another letter.

Related: Code Johnny Code, Code!

Can we assume the input will only contain upper and lowercase letters?

@KevinCruijssen I haven't put any non-letters in the test cases, so they're effectively not concerned.

@AJFaraday That's what I said... And regardless of what characters are in the test cases, you should clarify whether the input will contain non-letters, since a lot of commenters assume it may contain whitespace.

@DJMcMayhem Ahhh, good point. I've assumed whitespace is fine and that's been factored in to a lot of answers. I should have a test case for it. Probably DJ Grand Master Flash => Dj grand master flashy McDj grand master flashface

Donkey McDonkface is my favorite... seems like it would make a great insult.

This has to be the best function ever.

Nitpick: shouldn't that be Doggy McDogface?

@craq I thought of that, but too late, unfortunately. It’s hard to change it after people have answered.

Spaces in the input seem to break answers that rely on title-casing the input.

@Cowsquack if they pass my test cases, I declare them successful.

Stax, 26 bytes
ëO╛εh╕⌠î&!}∞┌C^U╟«äδ◙Bg⌠└¿

Run and debug it
^           convert input to upper case                     "FACE"
B~          chop first character and push it back to input  70 "ACE"
v+          lowercase and concatenate                       "Face"
c'yb        copy, push "y", then copy both                  "Face" "Face" "y" "Face" "y"
:]          string ends with?                               "Face" "Face" "y" 0
T           trim this many character                        "Face" "Face" "y"
+           concatenate                                     "Face" "Facey"
p           output with no newline                          "Face"
"e?y$"z     push some strings                               "Face" "e?y$" ""
" Mc`Rface  execute string template; `R means regex replace " Mc Faceface"
            result is printed because string is unterminated

Run this one

V, 27 28 30 bytes
Vu~Ùóe¿y$
Hóy$
ÁyJaMc<Esc>Aface

Try it online!
<Esc> represents 0x1b

Golfed two bytes after learning that we did not need to support inputs with less than 3 characters.
1 byte saved thanks to @DJMcMayhem by working on the second line before the first one, thus removing the G

The input is in the buffer. The program begins by converting everything to lowercase
V selects the line and u lowercases it
~ toggles the case of the first character (converting it to uppercase)
and Ù duplicates this line above, leaving the cursor at the bottom line
ó and replaces e¿y$, compressed form of e\?y$ (optional e and a y at the end of the line), with nothing (happens on the second line)
H goes to the first line
ó replaces y$ (y at the end of the line) with nothing on the first line
Á appends a y to the end of the first line
J and joins the last line with the first with a space in the middle, and the cursor is moved to this space
a appends Mc (<Esc> returns to normal mode)
A finally, appends face at the end of the line

27 bytes: Try it online!

Python, 144 bytes
def f(s):
 s=s[0].upper()+s[1:].lower()
 y=lambda s:s[:-1]if s[-1]=='y'else s
 t=y(s)
 u=s[:-2]if s[-2:]=='ey'else y(s)
 return t+'y Mc%sface'%u

Try it online here

my first ever code golf attempt...

welcome to PPCG! might I suggest adding a link to Try it Online! for verification of correctness?

f("Face") does not comply with the current test cases (TIO).

Edited post for correctness, also added a Try It Online! link

136 bytes.

126 bytes

105 bytes

97 bytes.

Excel, 204 144 137 165 bytes
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(REPT(REPLACE(LOWER(A1),1,1,UPPER(LEFT(A1)))&"~",2),"~","y Mc",1),"yy ","y "),"ey~","~"),"y~","~"),"~","face")

From the inside outwards:
REPLACE(LOWER(A1),1,1,UPPER(LEFT(A1)))      Replaces PROPER to handle space-delimited cases
REPT(%&"~",2)                   Duplicate.                    Donkey~Donkey~
SUBSTITUTE(%,"~","y Mc",1)      Replace first ~.              Donkeyy McDonkey~
SUBSTITUTE(%,"yy ","y ")        Handle words ending in 'y'.   Donkey McDonkey~
SUBSTITUTE(%,"ey~","~")         Handle words ending in 'ey'   Donkey McDonk~
SUBSTITUTE(%,"y~","~")          Handle words ending in 'y'    Donkey McDonk~
SUBSTITUTE(%,"~","face")        Adding face.                  Donkey McDonkface

Old answer, creating all bits separately, and then concatenating (176 bytes).
Does not handle space-delimited cases correctly.
=PROPER(A1)&IF(LOWER(RIGHT(A1,1))="y",,"y")&" Mc"&IF(LOWER(RIGHT(A1,2))="ey",LEFT(PROPER(A1),LEN(A1)-2),IF(LOWER(RIGHT(A1,1))="y",LEFT(PROPER(A1),LEN(A1)-1),PROPER(A1)))&"face"

Unfortunately, due to the requirement of handling space-delimited cases, PROPER(A1) is invalid (see the DJ Grand Master Flash input case), the best replacement that I could find while working on my VBA solution was LEFT(UPPER(A1))&MID(LOWER(A1),2,LEN(A1)) - please let me know if you end up golfing that down.

Thank you @TaylorScott.  Found 'REPLACE(LOWER(A1),1,1,UPPER(LEFT(A1)))` which is 2 bytes shorter.

Perl 6, 42 37 35 bytes
{S/y$//~"y Mc{S/e?y$//}face"}o&tclc

Try it online!

C# (.NET Core), 122 108 139 175 180 179 154 bytes
Thanks a lot, lee!
s=>((s.EndsWith("y")?s:s+"y")+" Mc"+(s+"$").Replace("ey$","")+"face").Replace(s,s.ToUpper()[0]+s.Substring(1).ToLower()).Replace("y$","").Replace("$","");

Try it online!
C# (.NET Core, with LINQ), 152 bytes
s=>((s.Last()=='y'?s:s+"y")+" Mc"+(s+"$").Replace("ey$","")+"face").Replace(s,s.ToUpper()[0]+s.Substring(1).ToLower()).Replace("y$","").Replace("$","");

Try it online!

Welcome to the site! :)

Ruby, 61 49 bytes
->s{s.capitalize=~/(e)?y$|$/;"#$`#$1y Mc#$`face"}

Try it online!
Saved 12 sweet bytes thanks to @MartinEnder:

a slimmer regular expression, which made use of
some of Ruby's special global variables which I tend to forget, and
bracketless string interpolation (see e.g. https://codegolf.stackexchange.com/a/52357/11071), which I never knew existed.

Using the regex from my Retina answer and making a bit more use of string interpolation gets this down to 49: https://tio.run/##DcxBCsIwEEDRqwxJBF3Y4lpSN0U3igcQwTQmGFptMVNkTOLVY3bvb/577ihbmdeND77SanKoBvc18lcvzWpHIop6y7i4cbEhOOkiq7RhKS8@oRsVwr4ktOdDwdMNBEd1J2jHV28oVUbpB4SIEaYZPTAeMIFsgAd7wWsqmz8

@MartinEnder Wow, that is quite a difference. I don't think I've seen string interpolation without brackets. I'll take it if you don't want to use it for your own Ruby answer.

Nah, it's fine, I wouldn't have come up with using =~ and building the whole string instead of using sub. String interpolation can be used without brackets if the variable is a global, instance or class variable.

You can get this down to 44+1 bytes by using the -p flag and using sub: https://tio.run/##DchBCsIwEADA@74iQqAKavEFXkoLYtEHFHSTrhiMSUjSw4pvN@Y2TFwUlyJve43BZLTmQytIixLtmjZHll/ZbpvpwGLU0/2BmppSlMcMfTV0l6HibSzDGWeGzrsXMVwtMkVgrnMSQ0Q3ixFTpih6i@n58yEb71LZhT8

Python 3, 80 bytes
Long time avid reader, my first submission at last !

lambda y:re.sub("([\w ]+?)((e)?y)?$",r"\1\3y Mc\1face",y.capitalize())
import re

Try it online

Welcome to PPCG, and very nice first post!

SOGL V0.12, 38 bytes
lW y≠F
u⁽³:F y*+pF‽j:lW e=⌡j}"‰θ`√►׀‘p

Try it Here!

Retina, 29 bytes
.+
$T
0`(e)?y$|$
$1y Mc$`face

Try it online!

Python 2, 88 92 bytes
lambda s:(s+'y'*-~-(s[-1]in'yY')).title()+' Mc'+re.sub('e?y$','',s.title())+'face'
import re

Try it online!

Fails with 'FamilY'

@Dead Possum: Fixed. Thks!

Java 8, 121 112 107 106 bytes
s->(s=(char)(s.charAt(0)&95)+s.toLowerCase().substring(1)).split("y$")[0]+"y Mc"+s.split("e?y$")[0]+"face"

-1 byte thanks to @OliverGrégoire.
Explanation:
Try it online.
s->                         // Method with String as both parameter and return-type
  (s=                       //  Replace and return the input with:
     (char)(s.charAt(0)&95) //   The first character of the input as Uppercase
     +s.toLowerCase().substring(1))
                            //   + the rest as lowercase
  .split("y$")[0]           //  Remove single trailing "y" (if present)
  +"y Mc"                   //  Appended with "y Mc"
  +s.split("e?y$")[0]       //  Appended with the modified input, with "y" or "ey" removed
  +"face"                   //  Appended with "face"

What if the first char is not alphabetical? Or maybe we can get a rule added about that..

@streetster Just asked OP, and it seems the input will only contains uppercase and/or lowercase letters.

~32 -> 95 for 1 byte saved

@OlivierGrégoire I really need to start learning a bit more about bitwise operations.. >.>

JavaScript, 103 96 94 bytes
Pretty naïve first pass at this.
s=>(g=r=>s[0].toUpperCase()+s.slice(1).toLowerCase().split(r)[0])(/y$/)+`y Mc${g(/e?y$/)}face`

Try it online

s=>${s=s[0].toUpperCase()+s.slice(1).toLowerCase().replace(/y$/,``)}y Mc${s.replace(/e?y$/,``)}face

One less: s=>${s=s[0].toUpperCase()+s.slice(1).toLowerCase().replace(/y$/,'')}y Mc${s.replace(/e$/,``)}face

Thanks, @BenjaminGruenbaum, but the first fails for Donkey and the second for Face.

The markdown is ruining the code: https://gist.github.com/benjamingr/8fec077b5436846cc9c52be353238037

@Shaggy i managed to reduce the g function by some chars :). you can look in my solution

Perl 5 -p, 47 39 bytes
Saved 6 bytes with @OlegV.Volkov's suggestions, 1 with @mwellnhof's, and 1 on my own
$_=lc^$";$_=s/y?$/y Mc/r.s/e?y$//r.face

Try it online!

You can get rid of ucfirst: $_=lc^$";

$_=s/y$//r."y Mc".s/e?y$//r.face is one byte shorter.

/y$|$/ -> /y?$/

Duh.  I should have realized that.

vim, 35 34 bytes
Vu~Yp:s/ey$
:%s/y$
kgJiy Mc<ESC>Aface<ESC>

<ESC> is 0x1b
Ungolfed
Vu~                      # Caseify McCaseface
Yp                       # dup line
:s/ey$
:%s/y$                   # Get the suffixes right
kgJiy Mc<ESC>Aface<ESC>  # Join lines and add the extra chars

Try it online!
Saved 1 byte thanks to DJMcMayhem

You can do Y instead of yy

C++ 14 (g++), 181 171 148 147 134 bytes
[](auto s){s[0]&=95;int i=1,b;for(;s[i];)s[i++]|=32;b=s[--i]-'y';return s+(b?"y":"")+" Mc"+(b?s:s.substr(0,s[i-1]-'e'?i:i-1))+"face";}

Note that clang will not compile this.
Credit goes to Kevin Cruijssen and Olivier Grégoire for the &95 trick.
Thanks to Chris for golfing 11 bytes.
Try it online here.
Ungolfed version:
[] (auto s) { // lambda taking an std::string as argument and returning an std::string
    s[0] &= 95; // convert the first character to upper case
    int i = 1, // for iterating over the string
    b; // we'll need this later
    for(; s[i] ;) // iterate over the rest of the string
        s[i++] |= 32; // converting it to lower case
    // i is now s.length()
    b = s[--i] - 'y'; // whether the last character is not a 'y'
    // i is now s.length()-1
    return s + (b ? "y" : "") // append 'y' if not already present
    + " Mc"
    + (b ? s : s.substr(0, s[i-1] - 'e' ? i : i-1)) // remove one, two, or zero chars from the end depending on b and whether the second to last character is 'e'
    + "face";
}

I don't know C++ that well, but you can golf 9 bytes: Try it online 172 bytes. Summary of changes: s[0]=s[0]&~32; to s[0]&=~32;; s[i++]=s[i]|32; to s[i++]|=32; and int i=1,n=s.length()-1,b; so you only need 1 int.

Oh, and one more byte by removing the space at #include<string>

@KevinCruijssen thanks for catching that! I have edited.

You can save 11 bytes by not defining n and just using the value of i after the while loop. Try it online!

@Chris Thanks! I managed to shave off 2 more bytes.

129 bytes

Elixir, 112 110 107 106 bytes
now as short as java
fn x->x=String.capitalize x;"#{x<>if x=~~r/y$/,do: "",else: "y"} Mc#{String.replace x,~r/e?y$/,""}face"end

Try it online!
Explanation:
x=String.capitalize x

Gets x with the first character in uppercase and all others lowercase.
#{ code }

Evaluate the code and insert it into the string.
#{x<>if x=~ ~r/y$/, do: "", else: "y"}

Concatenates x with y if it does not end with y (ie it does not match the regex y$).
#{String.replace x, ~r/e?y$/, "")}

Removes trailing ey and trailing y.

V, 38 36 32 bytes
-5 byte thanks to @Cows quack
Vu~hy$ó[^y]$/&y
A Mc<esc>póe¿y$
Aface

<esc> is a literal escape character and [^ is encoded as \x84
Try it online!

gu$ can become Vu

Since [^ is a regex shortcut (see here), you can use 0x84 instead of [^ to save a byte. Similarly, \? can be simplified into <M-?> to save another byte. And $a => A

Ruby, 69 bytes
->s{"#{(s.capitalize!||s)[-1]==?y?s:s+?y} Mc#{s.gsub /e?y$/,""}face"}

Explanation:
->s{                                                                } # lambda
    "#{                                 } Mc#{                }face" # string interpolation
       (s.capitalize!||s) # returns string capitalized or nil, in that case just use the original string
                         [-1]==?y # if the last character == character literal for y
                                 ?s:s+?y # then s, else s + "y"
                                              s.gsub /e?y$/,"" # global substitute
                                                               # remove "ey" from end

Try it online!

Could you add a TIO link? I don't know Ruby, but does s.capitalize replace the previous s? If not, does /e?y$/ handle a test case ending in Y, EY, or Ey correctly?

@KevinCruijssen s.capitalize vs s.capitalize! (different functions). s.capitalize! clobbers the old version.

@KevinCruijssen I've added a TIO link.

@KevinCruijssen Also added an explanation

Ah ok, thanks for the explanation and the information about s.capitalize!. Never programmed in Ruby, but adding an explanation mark to replace the previous value is pretty cool. +1 from me.

Python 3, 117 114 bytes
-3 bytes thanks to Dead Possum
def f(s):s=s.title();return s+'y'*(s[-1]!='y')+' Mc'+([s,s[:-1],0,s[:-2]][(s[-1]=='y')+((s[-2:]=='ey')*2)])+'face'

Try it online!

3rd element of list [s,s[:-1],'',s[:-2] can be changed to 0 to save 1 byte.

In 'y'*1 *1 is not needed. 2 more bytes

Switching from Python 3 to Python 2, and replacing return with print is 1 byte shorter.

K4, 74 69 68 bytes
Solution:
{$[r;x;x,"y"]," Mc",_[r:0&1-2/:"ye"=2#|x;x:@[_x;0;.q.upper]],"face"}

Examples:
q)k)f:{$[r;x;x,"y"]," Mc",_[r:0&1-2/:"ye"=2#|x;x:@[_x;0;.q.upper]],"face"}
q)f each ("boat";"Face";"DOG";"Family";"Lady";"Donkey";"Player")
"Boaty McBoatface"
"Facey McFaceface"
"Dogy McDogface"
"Family McFamilface"
"Lady McLadface"
"Donkey McDonkface"
"Playery McPlayerface"

Explanation:
Figure out if the last characters are equal to "ey", convert result to base-2 so we can ignore words that end "e?". Index into a list of numbers of characters to trim.
Managed to shave 5 bytes off my code to determine whether the last two chars at "ey" but struggling to better it...
{$[r;x;x,"y"]," Mc",_[r:0&1-2/:"ye"=2#|x;x:@[_x;0;.q.upper]],"face"} / the solution
{                                                                  } / lambda function
                                                            ,"face"  / join with "face"
                    _[                  ;                  ]         / cut function
                                           @[_x; ;        ]          / apply (@) to lowercased input
                                                0                    / at index 0
                                                  .q.upper           / uppercase function
                                         x:                          / save back into x
                                      |x                             / reverse x
                                    2#                               / take first two chars of x
                               "ye"=                                 / equal to "ye"?
                             2/:                                     / convert to base 2
                           1-                                        / subtract from 1
                         0&                                          / and with 0 (take min)
                       r:                                            / save as r
             ," Mc",                                                 / join with " Mc"
 $[r;x;x,"y"]                                                        / join with x (add "y" if required)

Bonus:
67 byte port in K (oK):
{$[r;x;x,"y"]," Mc",((r:0&1-2/"ye"=2#|x)_x:@[_x;0;`c$-32+]),"face"}

Try it online!

What's the point in the K4 if your oK port defeats it?

I didn't think it would, and the port doesn't work if the first char isn't alphabetical as I blindly subtract 32 from the ASCII value - there's no "upper" built-in.

Red, 143 142 bytes
func[s][s: lowercase s s/1: uppercase s/1
w: copy s if"y"<> last s[append w"y"]rejoin[w" Mc"parse s[collect keep to[opt["y"|"ey"]end]]"face"]]

Try it online!
Ungolfed:
f: func[s][
   s: lowercase s                      ; make the entire string lowercase
   s/1: uppercase s/1                  ; raise only its first symbol to uppercase
   w: copy s                           ; save a copy of it to w
   if "y" <> last s[append w "y"]     ; append 'y' to w if it doesn't have one at its end
   rejoin[w                            ; assemble the result by joining:
          " Mc"
          ; keep the string until "y", "ey" or its end
          parse s[collect keep to [opt ["y" | "ey"] end]]
          "face"
    ]
]

05AB1E, 30 bytes
™D'y©Ü®«s¤®Qi¨¤'eQi¨]’McÿŠÑ’ðý

Try it online!
or as a Test suite

Pyth, 36 34 bytes
++Jrz4*\yqJK:J"e?y$"k+" Mc"+K"face

Try it online!
Explanation:
++Jrz4*\yqJK:J"(e)?y$"k+" Mc"+K"face

  Jrz4                                  Set J to the titlecase of z (input)
           K:J"e?y$"k                   Set K to (replace all matches of the regex e?y$ in J with k (empty string))
         qJ                             Compare if equal to J
      *\y                               Multiply by "y" (if True, aka if no matches, this gives "y", else it gives "")
 +                                      Concatenate (with J)
                             +K"face    Concatenate K with "face"
                       +" Mc"           Concatenate " Mc" with that
+                                       Concatenate

Sadly this doesn't work, as the last test case fails.

Switch rz3 to rz4 to get this to work properly for the last test case.

Oh whoops, I'll fix that :P

Jelly, 77 75 74 73 bytes
2ḶNṫ@€⁼"“y“ey”S
ØA;"ØaF
¢y⁸µ¢Uyµ1¦
Çṫ0n”yẋ@”y;@Ç;“ Mc”
⁸JU>ÑTị3Ŀ;@Ç;“face

Try it online!
Any golfing suggestions are welcome (and wanted)!

PHP: 132
<?php function f($s){$s=ucfirst(strtolower($s));return $s.(substr($s,-1)=='y'?'':'y').' Mc'.preg_replace('/(ey|y)$/','',$s).'face';}

Explanation:
<?php

function f($s)
{
    // Take the string, make it all lowercase, then make the first character uppercase
    $s = ucfirst(strtolower($s));

    // Return the string, followed by a 'y' if not already at the end, then ' Mc'
    // and the string again (this time, removing 'y' or 'ey' at the end), then
    // finally tacking on 'face'.
    return $s
        . (substr($s, -1) == 'y' ? '' : 'y')
        . ' Mc'
        . preg_replace('/(ey|y)$/', '', $s)
        . 'face';
}

JavaScript (Node.js), 87 bytes

thanks to @Shaggy for 5 reducing 5 bytes

s=>(g=r=>Buffer(s.replace(r,"")).map((x,i)=>i?x|32:x&~32))(/y$/)+`y Mc${g(/e?y$/)}face`

Try it online!

You don't have to name non-recursive functions.

Nicely done. I never think to use Buffer, will have to try to remember it for future challenges. Got it down to 87 bytes for you.

Jstx, 27 bytes
h</►yT↓►y/◙♂ Mc♀/◄eyg►yg/íå

Explanation
      # Command line args are automatically loaded onto the stack
h     # Title case the top of the stack
<     # Duplicate the top value on the stack twice
/     # Print the top value on the stack
►y    # Load 'y' onto the stack
T     # Returns true if the 2nd element on the stack ends with the top
↓     # Execute block if the top of the stack is false
  ►y  # Load 'y' onto the stack
  /   # Print the top value on the stack
◙     # End the conditional block
♂ Mc♀ # Load ' Mc' onto the stack
/     # Print the top value on the stack
◄ey   # Load 'ey' onto the stack
g     # Delete the top of the stack from the end of the 2nd element on the stack if it exists
►y    # Load 'y' onto the stack
g     # Delete the top of the stack from the end of the 2nd element on the stack if it exists
/     # Print the top of the stack
íå    # Load 'face' onto the stack
      # Print with newline is implied as the program exits

Try it online!

I haven't seen this language before.  It looks interesting.  Is there documentation?

@recursive Here's some documentation.

Wow, this is really impressive.  Especially for so little development time.  I'm excited to see where this goes.

Python, 105 104
import re;r=re.sub;c=str.capitalize;f=lambda s:r('([^e^y])$','\\1y',c(s))+' Mc'+r('ey$','',c(s))+'face'

thx @Berry M. from noticing my dyslexia

-1 byte if you spell Mc correctly!

APL (Dyalog Classic), 62 bytes
{'face',⍨(' Mc','e?y$'⎕r''⊢S),⍨S,(Y≠⊃⌽S←⍵(819⌶¨)⍨1=⍳⍴⍵)/Y←'y'}

Try it online!
Thanks to @ngn for this solution!

Clojure: 161 155
(use '[clojure.string :as s])
(defn f[t](s/join[(s/capitalize(cond(=(last t)\y)t :else(s/join[t "y"])))" Mc"(s/capitalize(s/replace t #"e*y$" ""))"face"]))

Ungolfed:
(defn facegen [s0]
  (let [ s1 (clojure.string/capitalize (cond
                                         (= (last s0) \y)  s0
                                         :else             (clojure.string/join [s0 "y"])))
         s2 (clojure.string/capitalize (clojure.string/replace s0 #"e*y$" ""))]
    (clojure.string/join [s1 " Mc" s2 "face"])))

Try it online!

Pyth, 60 59 bytesSBCS
K"ey"Jrz4Iq>2JK=<2J=kK.?=k\yIqeJk=<1J))%." s÷   WZÞàQ"[JkJ

Test suite
They don't display here, but three bytes, \x9c, \x82, and \x8c are in the packed string between s and ÷. Rest assured, the link includes them.
Python 3 translation:
K="ey"
J=input().capitalize()
if J[-2:]==K:
    J=J[:-2]
    k=K
else:
    k="y"
    if J[-1]==k:
        J=J[:-1]
print("{}{} Mc{}face".format(J,k,J))

APL (Dyalog Classic), 95 90 88 87 86 85 84 82 80 78 77 73 bytes
{'face',⍨(' Mc',S↓⍨-+/∧/¨Y'ey'=¨↑∘S¨-⍳2),⍨S,(Y≠⊃⌽S←⍵(819⌶¨)⍨1=⍳⍴⍵)/Y←'y'}

Try it online!
This could be golfed down some more, and any suggestions are welcome!

PHP, 45  46 bytes
<?=($s=ucfirst(fgets(STDIN)))."y Mc{$s}face";

Try it online!

Fails in two different ways with input boAty. (Wrong caps, 'y' not removed).

PowerShell Core, 98 bytes
(("y$","e?(?=y)y$"|%{$o.ToUpper()[0]+$o.ToLower().Substring(1)-replace $_,""})-join "y Mc")+"face"

Try it online!
Many thanks to @Anderson Pimentel for inspiring a solution using regex replacements!

Unix (79 bytes)
Using Standard input :
 rev|sed -r 's/(.*)(.)$/\L\1\U\2/;s/^(ye?)?(.*)$/ecaF\2cM y\1\2/;s/ yy/ y/'|rev

test :
echo -e "Lady\nFace\nDonkey\nyyy"|rev|sed -r 's/(.*)(.)$/\L\1\U\2/;s/^(ye?)?(.*)$/ecaF\2cM y\1\2/;s/ yy/ y/'|rev
Lady McLadFace
Facey McFaceFace
Donkey McDonkFace
Yyy McYyFace

or ( by Function) :
F(){ echo $1|rev|sed -r 's/(.*)(.)$/\L\1\U\2/;s/^(ye?)?(.*)$/ecaF\2cM y\1\2/;s/ yy/ y/'|rev;}

test :
 F donkey
 Donkey McDonkFace

Excel VBA, 134 bytes
An anonymous VBE Immediate Window Function that takes input from range [A1] and outputs to the Immediate Window.
b=[Left(Upper(A1))]+Mid([Lower(A1)],2):l=len(b):y=[Right(A1)="y"]:?b;IIf(y,"","y")" Mc"IIf(y,Left(b,l-1+(InStrRev(b,"e")=l-1)),b)"face

source: Stack Exchange

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

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

sort: votes


text:
Put an array into bins
In this simple challenge you are given an input array L of non-negative integers and a number of bins b greater than 0 but no more than the length of L. Your code must return a new array M whose length is b and which has binned the array L. This is easiest explained with examples.
L = [1,0,5,1] and b = 2 returns M = [1,6].
L = [0,3,7,2,5,1] and b = 3 returns M = [3,9,6].
So far, so simple.  However in this question b doesn't necessarily have to divide len(L). In this case the last bin will just have fewer numbers to make it up.
Each bin except possibly the last one must have the same number of numbers contributing to its total.  The last bin must have no more numbers contributing to it than the other bins.  The last bin must have as many numbers contributing to it as possible subject to the other rules.
L = [0,3,7,2,5,1] and b = 4 returns M = [3,9,6,0].  M = [10,8,0,0] is not an acceptable output as the third bin does not have the name number of numbers contributing to it as bins 1 and 2.
L = [0,3,7,2,5] and b = 2 returns M = [10,7].  M = [3, 14] is not an acceptable output as the last bin will have 3 elements contributing to it but the first has only 2.
L = [1,1,1,1,1,1,1] and b = 3 returns M = [3,3,1].
As a final rule, your code must run in linear time.
You may use any language or libraries you like and can assume the input is provided in any way you find convenient.

It turns out that there are some inputs which can't be solved.  For example [1,1,1,1,1] and b=4. Your code can output whatever it likes for those inputs.

I think a few more test cases would be nice.

your code must run in linear time - I would find any algorithm who doesn't follow this naturally quite weird

@Uriel There is no limit to how weird code-golf answers can be :)

@Lembik Though in what way is disallowing such potential weird approaches beneficial to a code-golf challenge?

@JonathanFrech it’s just down to the preferences of the OP :)

You should add a test case where b evenly divides the number of elements in L.

@nwellnhof Isn't that covered by the first two?

The last example should probably return [3,3,1].

@Titus Cough.. hides head in shame (thanks).

Is the impossible-to-solve situation an "output any" or a "do any"?

@l4m2 Do anything.

APL (Dyalog), 19 bytes
{+/⍺(⌈⍺÷⍨≢⍵)⍴⍵,⍺⍴0}

Try it online!
We append b zeros to the array before reshaping it into equal parts of ⌈⍺÷⍨≢⍵ (⌈ length of L ÷ b ⌉) and summing them, as depicted in ,⍺⍴0, since any amount of blank spots (which are not part of the original array) larger than b - 1 would be filled with at least b - 1 elements from other chunks, which makes the balancing point of the last group at maximum b - 1 difference from the rest. We use b > b - 1 because it is code golf.
For example, L with 15 elements and b = 3 wouldn't be grouped as
x x x x x x
x x x x x x
x x x 0 0 0

but rather as (note how the rightmost 2 xs "fills in" the leftmost zeros)
x x x x x
x x x x x
x x x x x

while a 16 elements array would be filled with 2 (3 - 1) blank spots, like
x x x x x x
x x x x x x
x x x x 0 0

R, 75 71 70 63 bytes
function(L,b)colSums(matrix(L[1:(ceiling(sum(L|1)/b)*b)],,b),T)

Try it online!
This pads L with NA until the length is a multiple of b, then takes the column sums of L as a matrix with b columns, removing NA values.
Explaining as a stack-based language:
function(L,b){
      (ceiling(sum(L|1)/b*b)  # push the next multiple of b >= length(L), call it X
    1:..                      # push the range 1:X
  L[..]                       # use this as an index into L. This forces L
                              # to be padded to length X with NA for missing values
        matrix(..,,b)         # create a matrix with b columns, using L for values
                              # and proceeding down each column, so
                              # matrix(1:4,,2) would yield [[1,3],[2,4]]
colSums(.., na.rm = T)        # sum each column, removing NAs

Very nice and quick!  The rise of the R coder...

@Lembik I was lucky enough to have popped into TNB right in between you saying "I'm going to post this as a challenge" and you actually posting it.

Oh look "length[<-" will return too just like our favorite buddy "[<-". No bytes saved for less readability: function(L,b)colSums(matrix("length<-"(L,ceiling(length(L)/b)*b),,b),T)

@Vlo no bytes saved for less readability is probably the motto of R golfing...although I suppose that sum(L|1) is a byte saved from length(L)!

Python 2, 65 bytes
f=lambda l,n:n and[sum(l[:len(l)/n+1])]+f(l[len(l)/n+1:],n-1)or[]

Try it online!

Ruby, 54 53 bytes
Saved a byte thanks to @Kirill L.
->l,b{s=1.0*l.size/b;(1..b).map{l.shift(s.ceil).sum}}

Try it online!

Nice, you can also save a byte by replacing [0]*b by 1..b

@KirillL. Thanks. Hadn't even occurred to me.

MATL, 6 bytes
vi3$es

Try it online! Or verify all test cases.
Explanation
Consider input 4, [0,3,7,2,5,1] as an example.
v       % Vertically concatenate stack contents. Gives the empty array, []
        % STACK: []
i       % Input b
        % STACK: [], 4
        % Implicitly input L at the bottom of the stack
        % STACK: [0,3,7,2,5,1], [], 4
3$e     % 3-input reshape. This reshapes L with [] rows and b columns, in
        % column-major order (down, then across). [] here means that the
        % number of rows is chosen as needed to give b columns. Padding
        % with trailing zeros is applied if needed
        % STACK: [0 7 5 0;
                  3 2 1 0]
s       % Sum of each column
        % STACK: [3 9 6 0]
        % Implicitly display

This is the most impressive answer in my view.

C (gcc), 107 bytes
j,k,t,Q;f(A,l,b)int*A;{for(j=~0;b>++j;printf("%d,",t))for(t=k=0;(Q=!!(l%b)+l/b)>k;t+=Q<l?A[Q]:0)Q=k+++Q*j;}

Try it online!

Haskell, 61 bytes
l#0=[]
l#n|o<-length l`div`n+1=sum(take o l):(drop o l)#(n-1)

Try it online!

Doesn't seem to work for [1, 2, 3, 4, 5, 6] # 3.

Java 10, 96 89 86 bytes
a->b->{int r[]=new int[b],i=0,n=a.length;for(;i<n;)r[i/((n+b-1)/b)]+=a[i++];return r;}

Try it online here.
Found a shorter way to write i/(n/b+(n%b==0?0:1) here: i/((n+b-1)/b)
Thanks to Olivier Grégoire for golfing 3 bytes.
Ungolfed version:
input -> bins -> { // input is int[] (original array), bins is int (number of bins)
    int result[] = new int[bins], // resulting array, initialized with all 0
    i = 0, // for iterating over the original array
    n = a.length; // length of the original array
    for(; i < n ;) // iterate over the original array
        result[i / ((n + bins - 1) / bins)] += input[i++]; // add the element to the right bin; that's bin n/bins if bins divides n, floor(n/bins)+1 otherwise
    return result;
}

86 bytes

@OlivierGrégoire Thanks!

Elixir, 98 bytes
fn l,b->Enum.map Enum.chunk(l++List.duplicate(0,b-1),round Float.ceil length(l)/b),&Enum.sum/1 end

Try it online!
The best Elixir has is splitting into parts with a length of n. And it cannot ceil division as integer very well, so we do float division, round it up. Unfortunately the only way to do this results in a float, so we round it again to an integer.

Some of your outputs have the wrong length.

@Lembik fixed it.

Perl 6,  52 51  50 bytes
52 bytes: Test it
->\L,\b{L.rotor(:partial,ceiling L/b)[^b].map: &sum}

51 bytes: Test it
{@^a.rotor(:partial,ceiling @a/$^b)[^$b].map: &sum}

50 bytes: Try it
{map &sum,@^a.rotor(:partial,ceiling @a/$^b)[^$b]}

47 bytes non-competing Test it
{@^a.rotor(:partial,ceiling @a/$^b)[^$b]».sum}

It's non-competing as ».sum is allowed to do the calculations in parallel. So it may or may not be in linear time.

Expanded:
{  # bare block with two placeholder parameters ｢@a｣ and ｢$b｣

  map                   # for each sublist

    &sum,               # find the sum

    @^a                 # declare and use first parameter

    .rotor(             # break it into chunks

      :partial,         # include trailing values that would be too few otherwise

      ceiling @a / $^b # the number of elements per chunk

    )[ ^$b ]           # get the correct number of chunks if it would be too few

}

PHP, 88 bytes
function($a,$b){return array_map(array_sum,array_chunk($a,~-count($a)/$b+1))+[$b-1=>0];}

anonymous function, takes array and integer, returns array
The only golfing potential this had was replacing ceil(count($a)/$b)) with (count($a)-1)/$b+1 and abbreviating (count($a)-1) with ~-count($a). The resulting float is implicitly cast to integer in the array_chunk call.
Try it online.

Charcoal, 22 bytes
ＮθＡηＷ﹪Ｌηθ⊞η⁰Ｅ⪪η÷ＬηθＩΣι

Try it online! Link is to verbose version of code. Explanation:
Ｎθ

Input b.
Ａη

Input L.
Ｗ﹪Ｌηθ⊞η⁰

Push a 0 to L until L's length is divisible by b.
Ｅ⪪η÷ＬηθＩΣι

Divide L's length by b and split L into sections of that length, then sum each section and cast to string for implicit output on separate lines.

JavaScript (Node.js), 71 bytes
L=>b=>Array(b).fill().map((v,i)=>L.slice(s=i*b,s+b).reduce((x,y)=>x+y))

Try it online!

C (clang), 58 bytes
i;f(*L,l,b,*m){b=l/b+!!(l%b);for(i=0;i<l;m[i++/b]+=L[i]);}

Try it online!
f() takes parameters as follows:
L: pointer to input array
l: length of input array
b: number of bins
m: pointer to buffer that receives new array
Following is a re-entrant version @ 60 bytes:
f(*L,l,b,*m){b=l/b+!!(l%b);for(int i=0;i<l;m[i++/b]+=L[i]);}

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


text:
Given a grid, starting at the center and spiraling out, and an Position what is the ID?
Related:

Determine the position of a non-negative number in the infinite spiral
Wind me a number snake!

Challenge:
Given a grid, with an ID starting at the center and spiraling out, what is the ID given a position in the fewest number of bytes?
Grid:
+---------------+---------------+---------------+---------------+---------------+
| id:  20       | id:  19       | id:  18       | id:  17       | id:  16       |
| pos: (-2, -2) | pos: (-1, -2) | pos: (0, -2)  | pos: (1, -2)  | pos: (2, -2)  |
+---------------+---------------+---------------+---------------+---------------+
| id:  21       | id:  6        | id:  5        | id:  4        | id:  15       |
| pos: (-2, -1) | pos: (-1, -1) | pos: (0, -1)  | pos: (1, -1)  | pos: (2, -1)  |
+---------------+---------------+---------------+---------------+---------------+
| id:  22       | id:  7        | id:  0        | id:  3        | id:  14       |
| pos: (-2, 0)  | pos: (-1, 0)  | pos: (0, 0)   | pos: (1, 0)   | pos: (2, 0)   |
+---------------+---------------+---------------+---------------+---------------+
| id:  23       | id:  8        | id:  1        | id:  2        | id:  13       |
| pos: (-2, 1)  | pos: (-1, 1)  | pos: (0, 1)   | pos: (1, 1)   | pos: (2, 1)   |
+---------------+---------------+---------------+---------------+---------------+
| id:  24       | id:  9        | id:  10       | id:  11       | id:  12       |
| pos: (-2, 2)  | pos: (-1, 2)  | pos: (0, 2)   | pos: (1, 2)   | pos: (2, 2)   |
+---------------+---------------+---------------+---------------+---------------+

Tests:
f(0, 0) = 0
f(1, 1) = 2
f(0, -1) = 5
f(2, 0) = 14
f(-2, -2) = 20

f(x, y) = id

Notes:

Grid will always be square (height == width)
Grid can be infinite in size

How can the grid be both square and infinite in size?

Sorry, just trying to say it can be bigger than the example grid provided.

Sorta odd you chose to make the bottom right 1,1 and the top left -1,-1. Then again I guess Java does this in java.awt.*

@MagicOctopusUrn - makes you think a little more? It's just the grid setup I've been using in my codebase. I didn't want to use the same old grid in my game.

The last case should output 20,  not 24

JavaScript (ES6), 64 bytes
Takes input in currying syntax (x)(y).
x=>y=>(d=(A=Math.abs)(A(x)-A(y))+A(x)+A(y))*d+(d-x+y)*(-y>x||-1)

Try it online!
Heavily inspired by this answer from math.stackexchange.com.

JavaScript (Node.js), 58 bytes
y=>x=>(m=Math.max)(4*x*x-m(x+y,3*x-y),4*y*y+m(-x-y,x-3*y))

Try it online!
Use the formula from my previous answer, with some edit (because Javascript doesn't vectorize).
I came up with the formula myself. Basically, knowing that the formula must be quadratic in each 1/4 grid section, I find out the formula mostly by trial-and-error and then find a way to fit those together.

MATL, 15 bytes
|sQtE1YLqwG+X{)

Try it online! Or verify all test cases.

J, 37 bytes
(g@[-+<.-+[+[)>.(g=:4**:)@]-+>.]+]+-~

Try it online!
My first J answer! Use the formula from my Javascript answer.

Precedence rules are weird. (at least I don't need to memorize too much, but it's counterintuitive)
More than half of the characters are BF keywords.
-+> and :).


text:
Fizz Buzz with unique characters in columns
Inspired by Digits in their lanes and 1, 2, Fizz, 4, Buzz
Introduction
Your task is to generate exactly the following output:
1
2
Fizz
4
  Buzz
    Fizz
7
8
      Fizz
        Buzz
 11
          Fizz
   13
    14
            FizzBuzz
     16
      17
              Fizz
       19
                  Buzz
                    Fizz
 22
    23
                      Fizz
                        Buzz
   26
                          Fizz
     28
      29
                            FizzBuzz
       31
      32
                              Fizz
34
                                  Buzz
                                    Fizz
 37
  38
                                      Fizz
                                        Buzz
        41
                                          Fizz
  43
   44
                                            FizzBuzz
      46
       47
                                              Fizz
         49
                                                  Buzz

Challenge
This challenge is based on the Fizz Buzz challenge, and here is a recap: output the numbers from 1 to 100 inclusive, each number on its own line, but if the number is a multiple of 3, you should output "Fizz" instead of the original number, if the number is a multiple of 5, you should output "Buzz" instead of the original number. If the number is a multiple of 15, you should output "FizzBuzz" instead of the original number.
However, in addition to the requirement above, you should also indent each line using spaces to make that every column contains unique characters (excluding spaces and newlines) only. The spaces prepended to each line are the minimum required to make all the lines appeared before it (inclusive) has unique characters in each column.
For example, 1,2,Fizz,4 does not need any indentation because they already have unique characters in each column (column 1: 12F4, column2: i, column3: z, column4: z), but when adding Buzz we need to indent by two spaces because otherwise we would have two z's in both the 3rd and the 4th column. Since two spaces is enough to achieve the goal you should not indent it by three spaces. 7 and 8 does not need any indentation but when outputting 11 we need to indent by one space because the 1st column already has a 1. 13 then needs to be indented by three spaces because now 1st, 2nd and 3rd column all have a 1. Indentation for the remaining lines follow the same rule.
To make the challenge simpler, The upper limit has been changed to 50.
Specs

You can write a program or a function. Neither of them should take any non-empty input. Taking an empty input is fine.
Since this is a KC challenge you need to produce the output as specified in the Introduction section. A single trailing newline is fine. No heading newlines or extra heading spaces. No extra trailing spaces for each line.
Your program can exit with error or have non-empty STDERR output as long as STDOUT conforms to the specification.
This is intra-language code-golf, the program with lowest number of bytes wins in its language.
Default loopholes apply.

The given output doesn't exactly match the spec, e.g. lines 12, 20, 35 and 50.

But the second character in the first two lines is carriage return.

I have excluded spaces, now I should exclude newlines as well.

Python 2, 127 bytes
i=0;exec"print ord('<<<<>@<<BD=F?@HABJCNP=@RT?VABXCBZ<^`=>bdDf>?hBCjEn'[i])%60*' '+(i%3/2*'Fizz'+i%5/4*'Buzz'or`-~i`);i+=1;"*50

Try it online!
A fifty-byte lookup table seems to hurt the code size less than the logic necessary to track which characters have occurred in each column.

Logic would have been better if we were required to print up to 100 instead...

Python 2, 167 166 163 161 157 bytes
a=eval(`[{0}]*99`);i=0
exec"f=i%3/2*'Fizz'+i%5/4*'Buzz'or`i+1`;i+=1;g=0\nwhile any(b>{c}for b,c in zip(a[g:],f)):g+=1\nmap(set.add,a[g:],f);print' '*g+f;"*50

Try it online!
Edits:

while is shorter than for..range() by 1 byte.
Thanks to @ovs for shaving off 3 bytes. I always forget exec...
Adapted i%3/2 trick from Lynn's answer (-2 bytes).
@Lynn suggested a=map(set,[[]]*99), but I found another way using eval and repr with same bytes (-4 bytes).

Use a list of sets to track the chars used for each column, and set inequality for membership. The rest follows the exact spec given.

C (gcc), 145 144 bytes (143 for hex)
i;main(){for(;i++<50;printf("%*s%s%.d\n","000402800:81>34@56B7BH14JH3N56P76R0RX12ZX8^23`67b9b"[i]-48,i%3?"":"Fizz",i%5?"":"Buzz",i%3*i%5?i:0));}

Try it online!
0000h: 69 3B 6D 61 69 6E 28 29 7B 66 6F 72 28 3B 69 2B ; i;main(){for(;i+
0010h: 2B 3C 35 30 3B 70 72 69 6E 74 66 28 22 25 2A 73 ; +<50;printf("%*s
0020h: 25 73 25 2E 64 5C 6E 22 2C 22 FE FE FE 02 FE 00 ; %s%.d\n","......
0030h: 06 FE FE 08 06 FF 0C 01 02 0E 03 04 10 05 10 16 ; ................
0040h: FF 02 18 16 01 1C 03 04 1E 05 04 20 FE 20 26 FF ; ........... . &.
0050h: 63 28 26 06 2C 00 01 2E 04 05 30 07 30 22 5B 69 ; c(&.,.....0.0"[i
0060h: 5D 2B 32 2C 69 25 33 3F 22 22 3A 22 46 69 7A 7A ; ]+2,i%3?"":"Fizz
0070h: 22 2C 69 25 35 3F 22 22 3A 22 42 75 7A 7A 22 2C ; ",i%5?"":"Buzz",
0080h: 69 25 33 2A 69 25 35 3F 69 3A 30 29 29 3B 7D    ; i%3*i%5?i:0));}

Ruby, 129 bytes
puts (1..50).map{|n|" "*(".<<<<>@<<BD=F?@HABJCNP=@RT?VABXCBZ<^`=>bdDf>?hBCjEn"[n].ord%60)+("FizzBuzz
"[i=n**4%-15,i+13]||n.to_s)}

Try it online!
Double credit goes to Lynn here, for the lookup table approach and the fizzbuzz algorithm.
The FizzBuzz algorithm is very interesting, and it hinges on the remarkable coincidence that all positive, non-composite numbers less than 15 (other than 3 and 5), when raised to the 4th power, are 1 more than a multiple of 15. In fact:
 n     n**4  n**4%15  n**4%-15
 1        1     1       -14
 2       16     1       -14
 3       81     6        -9
 4      256     1       -14
 5      625    10        -5
 6     1296     6        -9
 7     2401     1       -14
 8     4096     1       -14
 9     6561     6        -9
10    10000    10        -5
11    14641     1       -14
12    20736     6        -9
13    28561     1       -14
14    38416     1       -14
15    50625     0         0

The values 3**4%15 and 5**4%15 are exactly 4 apart: the length of the string "Fizz". We can exploit this by using them to index from the end of a string, at least 9 characters in length. Multiples of 3 will index from the beginning of the string, and multiples of 5 will index from 5 characters from the end. Every other number will attempt to index from before the beginning of the string, and fail, returning nil. Then 15, of course, indexes from the 0th character. The fact that "FizzBuzz" is only 8 characters long is a small obstacle; we use a newline character to pad it, which will later be ignored by puts.
It's possible that the lookup table can be out-golfed by a more procedural approach, but my attempt was in the neighborhood of 190 bytes.

Interesting. It should be noted that the fact all numbers coprime to 15 when raised to 4th power equal to 1 modulo 15 can be derived from Fermat's little theorem.

[JavaScript (Node.js) REPL], 144 bytes
(f=(i,s=[['Fizz'][i%3]]+[['Buzz'][i%5]]||i+[],b=i>1?f(i-1):[])=>[...s].some((p,j)=>b.some(w=>w[j]==p&0!=p))?f(i,' '+s):b.push(s)&&b)(50).join`

`
Try it online!
Warning program itself runs unacceptable time
JavaScript (Node.js), 132 bytes by Arnauld
f=(a=n=[],s=`${b=++n%5?'':'Buzz',n%3?b||n:'Fizz'+b}
`)=>n>50?'':a.some(x=>[...x].some((c,i)=>c!=0&c==s[i]))?f(a,' '+s):s+f([s,...a])

Try it online!

Your answer doesn’t seem to be the same as the TIO link

@JoKing TIO outputs array, and i don't know whether it's allowed

Java (JDK 10), 185 bytes
v->{for(int n=0,l;n<50;System.out.printf((l>0?"%"+l:"%")+"s%s%n","",(n%3<1?"Fizz":"")+(n%5<1?"Buzz":n%3<1?"":n)))l="####%'##)+$-&'/()1*57$'9;&=()?*)A#EG$%IK+M%&O)*Q,U#".charAt(n++)-35;}

Try it online!
Credits

Geobits for their short FizzBuzz code
-1 byte thanks to Kevin Cruijssen (though I was doing it when he posted the comment ;-) )

Haskell, 190 187 186 178 176 bytes
unlines$foldl(\a x->a++[[z|z<-iterate(' ':)x,all(\m->null[p|(p,q)<-m`zip`z,p==q&&p>' '])a]!!0])[]$h<$>[1..50]
a%b=a`mod`b<1
h n|n%15="FizzBuzz"|n%3="Fizz"|n%5="Buzz"|1<2=show n

Try it online!
The slightly more readable (and annotated) version:
-- check if a is evenly divisible by b
a%b=a`mod`b<1
-- produce correct FizzBuzz output for a number
h n|n%15="FizzBuzz"|n%3="Fizz"|n%5="Buzz"|1<2=show n
-- test if all chars distinct between two strings
x#y=null[a|(a,b)<-x`zip`y,a==b&&a>' ']
-- given a new string and all previous strings
-- shift the new string to the right until all
-- chars are distinct
x!y=[z|z<-iterate(' ':)y,all(z#)x]!!0
g=h<$>[1..50]
f'=foldl step[]g
  where step acc x = acc++[acc!x]

Edit: I ended up inlining some functions in the golfed version to save more bytes.

@Laikoni Right. Fixed.

Jstx, 122 bytes
◄50-☺6*ø($♥:ø↕♂Fizz♀☺(◙$♣:ø↕♂Buzz♀6☺(◙"ø↕$6◙♂<<<<>@<<BD=F?@HABJCNP=@RT?VABXCBZ<^`=>bdDf>?hBCjEn'[i])%60*♀&P◄59▼ö,► 7.☻a0.2

Try it online!

Deadfish~, 3041 bytes
{i}c{iiii}cdc{dddd}ic{iiii}iiic{dddd}dddcc{iiiiii}iiic{iiii}dddciiiiicdddc{d}iiic{i}dc{d}dddcdc{{d}iii}iic{iiiiii}iiiiiic{ii}iiic{{d}i}ic{iii}iiiiiic{iiii}dddcddciic{i}icdc{{d}ii}dddc{{i}ddd}iiiciiiiic{{d}ii}iic{{i}dd}iiiic{d}ddcdddciiiic{i}dc{{d}ii}ddc{{i}ddd}iiiiiic{d}dc{i}iiic{d}ic{i}iiiic{{d}ii}dddc{iiiiii}iiiiic{i}iiic{d}c{{d}iii}iic{ii}dddcdddddc{d}ddc{ii}ddcddddddc{d}ddc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}ii}iic{d}ddc{ii}c{d}iic{d}ddc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{iiiiii}iiic{iiii}dddciiiiiicddcdddc{d}dc{ii}dddc{dd}iic{ii}dddc{d}dciiiiiicdc{{d}}cc{{i}dd}dc{ii}iiciiiiiicdddc{{d}ii}ddc{{i}dd}iiiic{dd}ic{ii}ddc{d}iic{{d}iii}dddddc{{i}ddd}iiic{i}c{{d}ii}dddc{{i}dd}iiiicdddddc{{d}ii}ic{{i}ddd}icddc{i}dc{d}ic{i}iiic{dd}iiic{ii}dc{d}dddddc{{d}iii}ic{{i}ddd}dc{ii}dc{dd}dddciic{ii}dddc{d}iic{i}iiic{{d}i}ic{{i}dd}iiiic{d}ddcdddc{{d}iii}ic{{i}ddd}c{i}dcdddcciiic{i}ddc{d}ddddciiiiic{d}iiic{{d}iii}dc{{i}dd}dciiiiiicdcddddciiiiicdc{dddddd}iic{ddddd}iicc{iiii}dc{dddd}ic{iiii}c{dddd}c{iiiiii}c{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iic{dddd}ddc{ii}iicc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}iicccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}iiiiic{dddd}dddddc{iiii}iiiiiic{dddd}ddddddc{ii}iicccccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iicccccccc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}iic{ii}dddcc{dddd}ic{ii}ii{c}{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iiccc{ii}dddciic{dddd}dc{ii}iicccc{ii}dddciiic{dddd}ddc{ii}ii{c}cc{iiii}ddc{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{ii}iiccccc{ii}dddciiiiic{dddd}ddddc{ii}iicccccc{ii}dddciiiiiic{dddd}dddddc{ii}ii{c}cccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iiccccccc{ii}dddc{i}ddc{ddddd}iiic{ii}ii{c}cccccccc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}ii{cc}{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iic{ii}ddcc{dddd}c{ii}iicccc{ii}ddcic{dddd}dc{ii}ii{cc}cc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}ii{cc}cccc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}iiccc{ii}ddciiiic{dddd}ddddc{ii}ii{cc}cccccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iiccccc{ii}ddciiiiiic{dddd}ddddddc{ii}iicccccc{ii}ddc{i}dddc{ddddd}iiic{ii}ii{cc}cccccccc{iiii}ddc{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{ii}iiccccccc{ii}dcddc{dddd}ic{ii}iicccccc{ii}dcdc{dddd}c{ii}ii{cc}{c}{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{iiii}icic{dddd}ddc{ii}ii{cc}{c}cccc{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}ii{cc}{c}cccccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iic{ii}dciiiic{dddd}dddddc{ii}iicc{ii}dciiiiic{dddd}ddddddc{ii}ii{cc}{c}cccccccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}ii{cc}{cc}{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc{ii}iicccccccc{ii}cdddc{dddd}ic{ii}ii{cc}{cc}cc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iicc{ii}cdc{dddd}dc{ii}iiccc{ii}cc{dddd}ddc{ii}ii{cc}{cc}cccc{iiii}ddc{iii}iiiiic{ii}dddcc{ddddd}ddddddc{iiiii}iciiiiicc{{d}}{d}ddc{ii}iicccccc{ii}ciic{dddd}ddddc{ii}iiccccccc{ii}ciiic{dddd}dddddc{ii}ii{cc}{cc}cccccc{iiii}ddc{iii}iiiiic{ii}dddcc{{d}}{d}ddc{ii}iiccccccccc{ii}ciiiiic{ddddd}iiic{ii}ii{cc}{cc}{c}{iii}iiiic{iiiii}iciiiiicc{{d}}{d}ddc

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


text:
Reverse Range Successors
Given a positive integer n, do the following (and output every stage):

start with a list containing n copies of n.
do the following n times:
at the ith step, gradually decrement the ith entry of the list until it reaches i

So, for example, if the given n is 4, then you start with [4,4,4,4], and then at the first step you have [3,4,4,4], [2,4,4,4], [1,4,4,4]. At the second step, you have [1,3,4,4], [1,2,4,4]. At the third step you have [1,2,3,4]. Nothing is done on the fourth step.
So your output is [[4,4,4,4],[3,4,4,4],[2,4,4,4],[1,4,4,4],[1,3,4,4],[1,2,4,4],[1,2,3,4]].

Any reasonable input/output format is permitted.

Standard loopholes apply. This is code-golf: the answer with the smallest byte-count wins.

Python implementation for checking purposes.

You might want to explicitly state that ith is always 1-indexed.

Do we really have to manipulate array? I get to a shorter answer without manipulating any array, producing an acceptable output.

@OlivierGrégoire You do not have to follow the steps, you just need to produce the output in a reasonable format. (i.e. go ahead)

Jelly, 9 bytes
r€⁸Œp»\QṚ

Try it online!
How?
r€⁸Œp»\QṚ - Link: integer, N    e.g. 4
 €        - for €ach of implicit range of N (i.e. for i in [1,2,3,...N])
  ⁸       -   with the chain's left argument, N on the right:
r         -     inclusive range (for i<=N this yields [i, i+1, ..., N]
          - ...leaving us with a list of lists like the post-fixes of [1,2,3,....,N]
          -                     e.g. [[1,2,3,4],[2,3,4],[3,4],[4]]
   Œp     - Cartesian product* of these N lists
          -                     e.g. [[1,2,3,4],[1,2,4,4],[1,3,3,4],[1,3,4,4],[1,4,3,4],[1,4,4,4],[2,2,3,4],[2,2,4,4],[2,3,3,4],[2,3,4,4],[2,4,3,4],[2,4,4,4],[3,2,3,4],[3,2,4,4],[3,3,3,4],[3,3,4,4],[3,4,3,4],[3,4,4,4],[4,2,3,4],[4,2,4,4],[4,3,3,4],[4,3,4,4],[4,4,3,4],[4,4,4,4]]
      \   - cumulative reduce with:
     »    -   maximum (vectorises)
          -                     e.g. [[1,2,3,4],[1,2,4,4],[1,3,4,4],[1,3,4,4],[1,4,4,4],[1,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[2,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[3,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4],[4,4,4,4]]
       Q  - de-duplicate        e.g. [[1,2,3,4],[1,2,4,4],[1,3,4,4],[1,4,4,4],[2,4,4,4],[3,4,4,4],[4,4,4,4]]
        Ṛ - reverse             e.g. [[4,4,4,4],[3,4,4,4],[2,4,4,4],[1,4,4,4],[1,3,4,4],[1,2,4,4],[1,2,3,4]]

* It may be easier to see what's going on with the Cartesian product used above with a different input:
the Cartesian product of [[0,1,2],[3,4],[5]]
is [[0,3,5],[0,4,5],[1,3,5],[1,4,5],[2,3,5],[2,4,5]]

You outgolfed the un-outgolf-able.

R, 83 82 74 bytes
N=rep(n<-scan(),n);while({print(N);any(K<-N>1:n)})N[x]=N[x<-which(K)[1]]-1

Try it online!
Instead of a double for-loop, a while loop is sufficient here: we find the first index where the list is greater than the index, and decrement there.
K has TRUE wherever N[i]>i, which(K) returns the true indices, and we take the first with [1].

Jelly, 12 bytes
R‘®¦<³S©$Ð¿Ṛ

Try it online!

13 bytes without register: Try it online!

JavaScript (ES6), 75 bytes
f=(n,a=Array(n).fill(n))=>[[...a],...a.some(v=>v>++j,j=0)?f(a[j-1]--,a):[]]

Try it online!

APL+WIN, 54 bytes
Prompts for screen input of integer
((⍴m)⍴n)-+⍀m←0⍪(-0,+\⌽⍳n-1)⊖((+/+/m),n)↑m←⊖(⍳n)∘.>⍳n←⎕

Outputs a matrix with each row representing the result of each step e.g. for 4:
4 4 4 4
3 4 4 4
2 4 4 4
1 4 4 4
1 3 4 4
1 2 4 4
1 2 3 4

Java (OpenJDK 8), 135 bytes
a->{int r[]=new int[a],i=0;java.util.Arrays x=null;x.fill(r,a);for(r[0]++;i<a;r[i++]++)for(;--r[i]>i;System.out.print(x.toString(r)));}

Try it online!
Explanation:
int r[]=new int[a],i=0;    //Initialize array and loop counter
java.util.Arrays x=null;    //reduces the number of of “Arrays” needed from 3 to 1
x.fill(r,a);    //Sets each value in array length n to int n
for(r[0]++;i<a;r[i++]++)    //Increment everything!
  for(;--r[i]>i;    //If decremented array element is larger than element number:
     System.out.print(x.toString(r)));}    //Print the array

Credit:
-8 bytes thanks to Jonathan Frech!
-16 bytes thanks to Kevin Cruijssen!
-1 byte thanks to Okx!

129 bytes.

The import java.util.*; is part of the byte-count I'm afraid. And @JonathanFrech's code can be golfed by 4 more bytes by putting the ,i=0 after the r[], and changing <-~a to <=a. (Try it online. 144 bytes) (and I changed ~-i to i-1 to make it more readable..)

139 bytes by getting rid of the import java.util.*; by using java.util.Arrays x=null; and x.fill and x.toString. (Note that your current solution is 155 bytes with the required import java.util.*;.)

Golf a byte by using for(;r[i-1]>i; rather than for(;r[i-1]!=i;.

@KevinCruijssen Another byte could be saved by golfing ++i<=a to i++<a.

Another -2 byte changing the last part to for(r[0]++;i<a;r[i++]++)for(;--r[i]>i;System.out.print(x.toString(r)));. :) Try it online 135 bytes

Haskell, 69 67 65 63 bytes
Recursive definition:
f 0=[[]]
f a=map(:(a<$[2..a]))[a,a-1..2]++[1:map(+1)x|x<-f$a-1]

Thanks to Laikoni for 2 bytes!

The second map is two bytes shorter with a list comprehension: Try it online!

Jelly, 11 bytes
x`’Jḟḣ1Ʋ¦ÐĿ

Try it online!
How it works
x`’Jḟḣ1Ʋ¦ÐĿ  Main link. Argument: n

x`           Repeat self; yield an array of n copies of n.
         ÐĿ  While the results are unique, repeatedly call the link to the left.
             Return the array of all unique results, including the initial value.
  ’     ¦      Decrement the return value at all indices specified by the chain
               in between.
       Ʋ         Combine the four links to the left into a monadic chain.
   J               Indices; yield [1, ..., n].
    ḟ              Filterfalse; remove all indices that belong to the return value.
     ḣ1            Head 1; truncate the result to length 1.

Python 3, 91 bytes
n=int(input())
x=[n]*n;print(x)
for i in range(n):
    for j in[0]*(n-i-1):x[i]-=1;print(x)

Try it online!

1 space is enough to indent code in python. Removing unnecessary spaces and switching to python 2 saves 10 bytes: check it out

@DeadPossum, even though I know I could do better in Python 2, its soon going to be obsolete so I wanted to practice my Python 3 skills as most as possible.

PHP, 153 Bytes
Try it online!
Code
function f($n){
$a=array_fill(0,$n,$n);$r=json_encode($a)."\n";$p=0;while($p<$n)
{if($a[$p]!=$p+1){$a[$p]--;$r.=json_encode($a)."\n";}else{$p++;}}echo$r;}

Gonna try to lower the bytes, or finish the recursive function
Explanation
function f($n){
  $a=array_fill(0,$n,$n);          #start with $nlength array filled with $n
  $r=json_encode($a)."\n";         #pushed to the string to output
  $p=0;                            #first position
  while($p<$n){                    #on position $n ($n-1) we do nothing
    if($a[$p]!=$p+1){              #comparing the position+1 to the value
     $a[$p]--;                     #it gets decreased by 1
     $r.= json_encode($a)."\n";    #and pushed
   } else {
     $p++;                       #when position+1 = the value,
   }                               #position is changed ++
  }
   echo $r;
  }

seems like you have some unnecessary whitespace so this should be 153 bytes -- note that I don't know PHP.

yep, just realize, thank you, editing now.

Python 2, 80 76 bytes
i=input();l=[i]*i;print l
for x in range(i):
 while l[x]>x+1:l[x]-=1;print l

Try it online!
Bit wasteful having two print statements but I can't think of a better way at the moment.

75 bytes.

Python 2, 70 bytes
-2 bytes thanks to @LeakyNun
-2 bytes thanks to @JonathanFrech
i=I=input()
l=[I]*I
exec"exec'print l;l[-i]-=1;'*max(~-i,2);i-=1;"*~-I

Try it online!

(I-1) --> ~-I

70 bytes, initializing i=I and decrementing.

Retina, 49 bytes
.+
*
_
$`_,$=
.{*\`_+,(_+)
$.1
0`(\b(_+),\2)_
$1

Try it online! Explanation:
.+
*

Convert the input to unary.
_
$`_,$=

Create a list of n copies of i,n where i is the index of the copy.
.

Don't print anything (when the loop finishes).
{

Loop until the pattern does not change.
*\`_+,(_+)
$.1

Temporarily delete the is and convert the ns to decimal and output.
0`(\b(_+),\2)_
$1

Take the first list entry whose value exceeds its index and decrement it.

Python 3, 70 67 65 bytes
def f(n):
 k=0;a=[n]*n
 while k<n-1:print(a);k+=a[k]==k+1;a[k]-=1

Try it online!

(67) Converting to function: -3 bytes
(65) Removing unneeded parentheses: -2 bytes

Ungolfed version:
def f(n):
    k = 0
    a = [n] * n             # create n-item list with all n's
    while k < n - 1:        # iterate through columns 0..n-1
        print(a)            # print whole list
        if a[k] == k + 1:   # move to the next column when current item reaches k+1
            k += 1
        a[k] -= 1           # decrement current item

Java (JDK 10), 112 bytes
n->{var s="";for(int i=1,k=n,j;i<=n;k=--k>i?k:n-++i+i)for(j=0;j++<n;)s+=(j<i?j:j>i?n:k)+(j<n?",":";");return s;}

Try it online!

J, 17 15 bytes
+/\@,(#=)@i.&.-

Try it online!
Explanation
+/\@,(#=)@i.&.-  Input: n
              -  Negate n
          i.     Reverse of range [0, n)
       =           Identity matrix of order n
      #            Copy each row by the reverse range
              -  Negate
    ,            Prepend n
+/\              Cumulative sum of rows

C (clang), 131 141 bytes
i,j,k,m[99];p(){for(k=0;m[k];printf("%d ",m[k++]));puts("");}f(n){for(j=k=m[n]=0;k<n;m[k++]=n);p();for(;j<n;j++)for(i=1;i++<n-j;m[j]--,p());}

Try it online!
This will work for all n upto 99. TIO truncates output. It can support arbitrarily larger n by changing size of array m as memory permits.

Following is limited to n=1..9 but is significantly shorter
C (clang), 89 92 bytes
i,j;char m[12];f(n){j=!puts(memset(m,n+48,n));for(;j<n;j++)for(i=1;i++<n-j;m[j]--,puts(m));}

Try it online!
Updated: Modified to avoid dependence on static initialization

Your static/global initialization because multiple test cases is not allowed, as functions have to be callable more than once.

@Jonathan Updated answers. I always wondered if this should be allowed, and couldn't make up my mind.

Here is the relevant meta post: https://codegolf.meta.stackexchange.com/a/4940/73111

You could golf m[j]--,p() to p(m[j]--) and save a byte.

128 bytes

Python 3, 101 bytes
def f(n):
 p=print;m=[n for_ in range(n)];p(m)
 for i in range(n):
    while m[i]>1+i:m[i]-=1;p(m)

I could probably golf more with the print, but I'm away from my computer and am not entirely sure of python 2's rules on setting a variable to print. I'll update later when I get to a computer or if someone clarifies in the comments.

K (ngn/k), 34 32 bytes
{{x[y]-:1;x}\(,x#x),,/(|!x)#'!x}

Try it online!

Clojure, 132 bytes
#(loop[R[(vec(repeat % %))]j(- % 2)i 0](if(> i j)R(recur(conj R(update(last R)i dec))(if(= i j)(- % 2)(dec j))(if(= i j)(inc i)i))))

I was hoping this to be shorter...
Less stateful but longer at 141 bytes:
#(apply map list(for[i(range %)](concat(repeat(nth(cons 0(reductions +(reverse(range %))))i)%)(range % i -1)(if(>(dec %)i)(repeat(inc i))))))