text:
Golf an Advent Calendar
It's that time of year when many of us get our advent calendars! If you are unfamiliar with an advent calendar, these are  special calendars used to count down advent in anticipation of Christmas. In my experience the doors are placed randomly, and part of the fun as a child was working out where tomorrow's door was! Often these days, calendars have chocolates behind each door, but instead of buying an advent calendar this year, you should build an ASCII one!
Task
Given input of an integer (n) in the range 0-24, produce an ASCII advent calendar with the numbered doors up-to n, opened. You must use the same order as in the below example: 2, 17, 8, 12, 1, 6, 11, 20, 5, 22, 3, 10, 15, 23, 7, 16, 9, 24, 18, 4, 13, 19, 21, 14.
Doors
The closed door must be:
.-----------.
|           |
|           |
|           |
|       nn  |
|___________|

where n represents the number of the door (leading zeros are optional) and the opened door is:
.-----------.
|\          |
| |         |
| |         |
| |         |
| |_________|
 \|

except for door 24, which is instead:
.--------------------------.
|                          |
|                          |
|                          |
|                      24  |
|__________________________|
.--------------------------.
|\                         |
| |                        |
| |                        |
| |                        |
| |________________________|
 \|

These doors are arranged within a frame of 37 lines of 79 characters, with two spaces between each column, and an empty line between each row.
Opened Doors
When the doors are opened you must display one of the (tenuously Christmas related - apologies for my terrible art skills!) pictures below within the door:
 . _ .    _'_        +       .^o     _(")_     _n_       $        .
 }\O/{    ) (^.^_   /~\     (';')   (_ . _)    (")      |,|    __/ \__
 }/*\{    \./v`v'  /~*~\   {\|+|/}   / : \   >( o )<    | |    `.   .'
 /***\     oO8    /~*~~*\    d-b    (_/ \_)  (  o  )  ._|_|_.   /.^.\

 .\^/.     ____   __.==,_    .*.     _   _    . . .   _______   _   _
<->o<->   /_%_/|  --|XX|-    /.\    (O X O)  .i_i_i.  _j_j_j_  ( `v' )
 '/v\`   |_|_| |   _|  |    |_-_|    / ^ \   |-~~-~|   ||__|    \   /
         |_|_|/   (____'   (.-o-.)   \/ \/   |_____|  _|/$$|_     V

   i       |~|     //'`\     |=|    _{/ _{/   ,   *   \  ====     b
 .'%'.     | |    //....\    / \      \_/    +  . +   \\\|+-|   .'''.
|^~~.~|     Y     ||()()|   |(%)|     /O \     . ' .  \\\\\+|  {*=*=*}
_'._.'_    _|_    ||_[]_|   |___|   @__,/\\  ~~~~~~~  \\\\\\\   '._.'

    _    |  _  |  .W. .W.  .&%$+*.    \O/       .;'   ..,.;..   ('v')
  .'.'O  | ($) |  |*| |*|  */'"'\&  [ ]|_.     .m_.   |\\|//|  //   \\
 /___\   |  " o|  |*| |*|  $\._./%  |_____)   C|  |    \\|//   |\   /|
(_____)  | === |  'M' 'M'  '%&*+$'  ------'    |__|    _=|=_     Y Y

 \   /      .==.    .-.     -._.-   __/\__     ...       .-.
._o_O_.  .--'  |  \|   |/    .+.    \_\/_/    '*  `     //`);
|/\/\/|  \_____/  /|   |\   ( W )   /_/\_\   |_/\*_|   %%
"""""""  `====='    '-'      `"`      \/     [_____]  //

Each image is 7 characters long and covers 4 lines so they will fit within the windows. You are free to choose any of the  above images and use them in any order, but  you may not repeat an image. For the 24th, you must also add a message:
       ~
   ~ MERRY ~
 ~ CHRISTMAS! ~
     ~~~~~

which fits alongside one of the above pictures, you can choose whether the text is to the right or the left of the image.
Examples
Given input 0, output the calendar with no doors opened:
.-----------------------------------------------------------------------------.
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |        2  |  |       17  |  |        8  |  |       12  |  |        1  |  |
|  |___________|  |___________|  |___________|  |___________|  |___________|  |
|                                                                             |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |        6  |  |       11  |  |       20  |  |        5  |  |       22  |  |
|  |___________|  |___________|  |___________|  |___________|  |___________|  |
|                                                                             |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |        3  |  |       10  |  |       15  |  |       23  |  |        7  |  |
|  |___________|  |___________|  |___________|  |___________|  |___________|  |
|                                                                             |
|  .-----------.  .-----------.  .--------------------------.  .-----------.  |
|  |           |  |           |  |                          |  |           |  |
|  |           |  |           |  |                          |  |           |  |
|  |           |  |           |  |                          |  |           |  |
|  |       16  |  |        9  |  |                      24  |  |       18  |  |
|  |___________|  |___________|  |__________________________|  |___________|  |
|                                                                             |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |           |  |           |  |           |  |           |  |           |  |
|  |        4  |  |       13  |  |       19  |  |       21  |  |       14  |  |
|  |___________|  |___________|  |___________|  |___________|  |___________|  |
|                                                                             |
|_____________________________________________________________________________|

For input 5, output something similar to:
.-----------------------------------------------------------------------------.
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\   . _ .  |  |           |  |           |  |           |  |\  __.==,_ |  |
|  | |  }\O/{  |  |           |  |           |  |           |  | | --|XX|- |  |
|  | |  }/*\{  |  |           |  |           |  |           |  | |  _|  |  |  |
|  | |  /***\  |  |       17  |  |        8  |  |       12  |  | | (____'  |  |
|  | |_________|  |___________|  |___________|  |___________|  | |_________|  |
|   \|                                                          \|            |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |           |  |           |  |           |  |\  _{/ _{/ |  |           |  |
|  |           |  |           |  |           |  | |   \_/   |  |           |  |
|  |           |  |           |  |           |  | |   /O \  |  |           |  |
|  |        6  |  |       11  |  |       20  |  | | @__,/\\ |  |       22  |  |
|  |___________|  |___________|  |___________|  | |_________|  |___________|  |
|                                                \|                           |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\    _n_   |  |           |  |           |  |           |  |           |  |
|  | |   (")   |  |           |  |           |  |           |  |           |  |
|  | | >( o )< |  |           |  |           |  |           |  |           |  |
|  | | (  o  ) |  |       10  |  |       15  |  |       23  |  |        7  |  |
|  | |_________|  |___________|  |___________|  |___________|  |___________|  |
|   \|                                                                        |
|  .-----------.  .-----------.  .--------------------------.  .-----------.  |
|  |           |  |           |  |                          |  |           |  |
|  |           |  |           |  |                          |  |           |  |
|  |           |  |           |  |                          |  |           |  |
|  |       16  |  |        9  |  |                      24  |  |       18  |  |
|  |___________|  |___________|  |__________________________|  |___________|  |
|                                                                             |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\     +    |  |           |  |           |  |           |  |           |  |
|  | |   /~\   |  |           |  |           |  |           |  |           |  |
|  | |  /~*~\  |  |           |  |           |  |           |  |           |  |
|  | | /~*~~*\ |  |       13  |  |       19  |  |       21  |  |       14  |  |
|  | |_________|  |___________|  |___________|  |___________|  |___________|  |
|   \|                                                                        |
|_____________________________________________________________________________|

For input 14:
.-----------------------------------------------------------------------------.
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\   . _ .  |  |           |  |\     .    |  |\    ____  |  |\  __.==,_ |  |
|  | |  }\O/{  |  |           |  | | __/ \__ |  | |  /_%_/| |  | | --|XX|- |  |
|  | |  }/*\{  |  |           |  | | `.   .' |  | | |_|_| | |  | |  _|  |  |  |
|  | |  /***\  |  |       17  |  | |  /.^.\  |  | | |_|_|/  |  | | (____'  |  |
|  | |_________|  |___________|  | |_________|  | |_________|  | |_________|  |
|   \|                            \|             \|             \|            |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\      _   |  |\     $    |  |           |  |\  _{/ _{/ |  |           |  |
|  | |   .'.'O |  | |   |,|   |  |           |  | |   \_/   |  |           |  |
|  | |  /___\  |  | |   | |   |  |           |  | |   /O \  |  |           |  |
|  | | (_____) |  | | ._|_|_. |  |       20  |  | | @__,/\\ |  |       22  |  |
|  | |_________|  | |_________|  |___________|  | |_________|  |___________|  |
|   \|             \|                            \|                           |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\    _n_   |  |\   _(")_  |  |           |  |           |  |\    |=|   |  |
|  | |   (")   |  | | (_ . _) |  |           |  |           |  | |   / \   |  |
|  | | >( o )< |  | |  / : \  |  |           |  |           |  | |  |(%)|  |  |
|  | | (  o  ) |  | | (_/ \_) |  |       15  |  |       23  |  | |  |___|  |  |
|  | |_________|  | |_________|  |___________|  |___________|  | |_________|  |
|   \|             \|                                           \|            |
|  .-----------.  .-----------.  .--------------------------.  .-----------.  |
|  |           |  |\  \  ==== |  |                          |  |           |  |
|  |           |  | | \\\|--| |  |                          |  |           |  |
|  |           |  | | \\\\\-| |  |                          |  |           |  |
|  |       16  |  | | \\\\\\\ |  |                      24  |  |       18  |  |
|  |___________|  | |_________|  |__________________________|  |___________|  |
|                  \|                                                         |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\     +    |  |\    ,  *  |  |           |  |           |  |\     i    |  |
|  | |   /~\   |  | | +  .  + |  |           |  |           |  | |  .'%'.  |  |
|  | |  /~*~\  |  | |  .  ' . |  |           |  |           |  | | |^~~.~| |  |
|  | | /~*~~*\ |  | | ~~~~~~~ |  |       19  |  |       21  |  | | _'._.'_ |  |
|  | |_________|  | |_________|  |___________|  |___________|  | |_________|  |
|   \|             \|                                           \|            |
|_____________________________________________________________________________|

For input 24:
.-----------------------------------------------------------------------------.
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\   . _ .  |  |\   //''\  |  |\     .    |  |\    ____  |  |\  __.==,_ |  |
|  | |  }\O/{  |  | | //....\ |  | | __/ \__ |  | |  /_%_/| |  | | --|XX|- |  |
|  | |  }/*\{  |  | | ||()()| |  | | `.   .' |  | | |_|_| | |  | |  _|  |  |  |
|  | |  /***\  |  | | ||_[]_| |  | |  /.^.\  |  | | |_|_|/  |  | | (____'  |  |
|  | |_________|  | |_________|  | |_________|  | |_________|  | |_________|  |
|   \|             \|             \|             \|             \|            |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\      _   |  |\     $    |  |\    |~|   |  |\  _{/ _{/ |  |\   . . .  |  |
|  | |   .'.'O |  | |   |,|   |  | |   | |   |  | |   \_/   |  | | .i_i_i. |  |
|  | |  /___\  |  | |   | |   |  | |    Y    |  | |   /O \  |  | | |-~~-~| |  |
|  | | (_____) |  | | ._|_|_. |  | |   _|_   |  | | @__,/\\ |  | | |_____| |  |
|  | |_________|  | |_________|  | |_________|  | |_________|  | |_________|  |
|   \|             \|             \|             \|             \|            |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\    _n_   |  |\   _(")_  |  |\  |  _  | |  |\  .W. .W. |  |\    |=|   |  |
|  | |   (")   |  | | (_ . _) |  | | | ($) | |  | | |*| |*| |  | |   / \   |  |
|  | | >( o )< |  | |  / : \  |  | | |  " o| |  | | |*| |*| |  | |  |(%)|  |  |
|  | | (  o  ) |  | | (_/ \_) |  | | | === | |  | | 'M' 'M' |  | |  |___|  |  |
|  | |_________|  | |_________|  | |_________|  | |_________|  | |_________|  |
|   \|             \|             \|             \|             \|            |
|  .-----------.  .-----------.  .--------------------------   .-----------.  |
|  |\   _   _  |  |\  \  ==== |  |\  .&%$+*.       ~        |  |\    \O/   |  |
|  | | (O X O) |  | | \\\|--| |  | | */'"'\&   ~ MERRY ~    |  | | [ ]|_.  |  |
|  | |  / ^ \  |  | | \\\\\-| |  | | $\._./% ~ CHRISTMAS! ~ |  | | |_____) |  |
|  | |  \/ \/  |  | | \\\\\\\ |  | | '%&*+$'     ~~~~~      |  | | ------' |  |
|  | |_________|  | |_________|  | |________________________|  | |_________|  |
|   \|             \|             \|                            \|            |
|  .-----------.  .-----------.  .-----------.  .-----------.  .-----------.  |
|  |\     +    |  |\   ,   *  |  |\     |    |  |\    .*.   |  |\     i    |  |
|  | |   /~\   |  | | +  . +  |  | |  .'''.  |  | |   /.\   |  | |  .'%'.  |  |
|  | |  /~*~\  |  | |   . ' . |  | | {*=*=*} |  | |  |_-_|  |  | | |^~~.~| |  |
|  | | /~*~~*\ |  | | ~~~~~~~ |  | |  '._.'  |  | | (.-o-.) |  | | _'._.'_ |  |
|  | |_________|  | |_________|  | |_________|  | |_________|  | |_________|  |
|   \|             \|             \|             \|             \|            |
|_____________________________________________________________________________|

Rules
This is code-golf so the shortest code in bytes, in each language, wins.

Any reasonable format can be used for I/O assuming it is consistent.
Any amount of whitespace before and after the calendar is fine, as well as additional spaces/unprintables at the end of each line, but nothing before each line as this must fit into 80 characters.
All standard loopholes are forbidden.

Thanks
James Holderness for contributing ASCII images!

This is so cute!

Charcoal, 676 639 614 607 598 590 564 561 bytes
Ｐ⁴⁰↓.↓³⁷Ｍ↗×³⁹_‖ＯＦ²⁴«≔⌕”%↖∧F◨℅V⊖⎚λJ↷;φε⊟ ↧”§βιε≔⎇⁼²³ι²⁶⊕χαＪ×﹪ε⁵¦¹⁵×÷ε⁵¦⁷Ｍ³¦².α↓.↓⁵↖←×⁻α²_¿‹ιＩθ«Ｍ±¹±⁴↘¹↓⁵↖↖\↑⁵Ｍ⁴¦¹ＥＥ⁴⁺×﹪ι⁸¦⁷×⁵⁶⁺κ×⁴÷ι⁸✂”}⊞r⌕⁸⸿‹;β/｜∧±⪪Ｉ÷=EＥ%±÷ü5>ü⊘-▶⁹⦃vy⌈#$“o⊟ⅈ‖zＭq‖s0ＹV↔↔|⎈⁹'⁸γ₂βxM¿yH⌕.➙↧↘⁻³]υ｜tψ⧴À‹>8Φπ；Ｖ}Ｑλjgd↔⟲｜WU(‖Ｊ⁴⁹ＸJx#aα➙?⁰Ｎ@⁵=πＸ⭆›*≡ηΦzgQ±tJ;∨≦K⪫9⁸πcω2-0CγＮ8｜x43,ＢＤua←A9Ｍ№»⎚‴dＮ|k9<·⊖Ｒ?Ｔρe»∧=₂₂~⁰i³e4⮌↖λ″ＯÞν%≧Jj◧ＳLÀ·Π_B₂Ｔσ-*¬y&XWP›J↔À≕²ψＴ↘b▶“ζX↙ΣψSCμ#×Ｉ？Ｋ%Ｈ6Ｋⅉ⁸OＨ…⁸Ｕⅈ«j×⟦χ～gＰ% ¦◨⦄⟲24；⦄▷Ｙ>≕À▶；DψＪψＹＮ(Ｎ-⊞Ｋ‹▷⦃Ug∧⦃8⊕|·ＨＯ；ＪＺ⎇*>GPＭ⮌Σ�“Ｐ²⁼↶w66›λ⁼±⧴ι⊟uβρ⁻C⊙Ｚ+%oΣＶＬtＹ1Ｏ≦ O｜ηf±h﹪φ⊟”¦κ⁺κ⁷Ｍ⁸±⁴¿⁼²³ι”¶<↑?≡ＤTh¤WSＷV～≔✂r₂b…wＳεGl≔TêE¶(…Ｒ↘�”»«←__↑⁵Ｍ⁻α²¦⁴←⮌Ｉ⊕ι

Try it online!
Here you have the verbose version of the code, quite understandable. My approach is the opposite from @Neil's. He draws all the gifts and then covers those not needed. I only draw the gifts needed.

5 bytes saved thanks to Neil!

Save 3 bytes: Print(Map(Map(4,Add(Times(Modulo(i,8),7),Times(56,Add(k,Times(4,IntDivide(i,8)))))),Slice("...",k,Add(k,7)))); instead of the for (4) loop.

@Neil I understand your code and it seems a good idea, but I cannot get it to work on TIO.

Don't try to copy/paste it; Stack Exchange inserts zero-width characters into comments.

@Neil That must be the reason, because when I wrote the code myself suddenly it started to work. :-)

Oh, it's a 5 byte saving? My fault for trusting Charcoal's l option...

Charcoal, 666 bytes
Ｊ⁶³¦³⁰←×⁷⁷_↑³⁶.→⁷⁷↓.↓³⁶↖Ｊ±⁷±⁴”}➙◧﹪ε⎆Ｔ⎆¿⊘W？⁸ω⁷{↙n,θ<YθＴＬＵeK%I(+↥Ｃ…hχRνGζ)ητＲ✳⮌⁹πj,⊞Ｒ∕!lD)CN✳χＧ-=ê⊕l⟧ＲＰ↙§m∧Ｅ⁴Ｆ≧GＷ!↨⪪⟧⟦⟦Ｘ=G﹪ς←´:¦B^⟲⊟H⌀SM⦃}´↶E$zfI⮌εÞ⁶ι⟦⁺～Ｗ]ＸιθＺ¦@|θ⦃‴1₂↑dＡ=÷ＰＴι^V⪪Ｎa÷⌈b#lＱ+;BＴ⟲⌀6↑↥\⁺◨ⅉ8'Àq；？.6μ″D⎇Ｍ3§ν⁻φＧ>2Σ¿⟧u←@6nh¹⮌↧,‴¹f↧M⁵|Dυχ¶3⊘>γＱ·UB×NO³{Ｌκ3¤³ν⊕φβ.¤+xl⁷MΠ⦄η+L➙⁺[Dσ◧；≔e=F⊘ξρHλκＬ`Ｓ"d｜N℅⊗0§χ～vＨ⍘À§⊕g↖c@Π]R¦⎆πＥx⁶⪪~;⸿j}⊗⊙↷A‹›N·？ＣＸ[´m'Ｊχ0`-⪫νd⪫⎆/Ｍ⍘ζＧ＆Ｇ⟲Ｆ¿Ｇ⍘×.#ςςm≧ω²Ｅⅉmv`⊞ω9Þ·'ＺNN→Ｊ＆γQ«T～_J6◨z⪫ＯＢg¤upε↷~⁵T«P{Ｚr»λ≔u⧴⁰ⅈ｜≕q⊕≔χz⮌…@ＭυA➙⭆/TLＦ}¤Ｎ*Ｎ⁰⁶↖¬∕κE>α;|Ｗ"h↙⊘⁹}Σ1⁰g⮌ＦRü0ＡÀ⊗"⁸$”Ｆ⁵Ｆ⁵«Ｊ×¹⁵ι×⁷κ←×¹¹_↑⁵.¹¹↓.↓⁵»Ｆ²³«Ｊ×¹⁵Ｉ§”o⊞O↧▷⁰$ê;”¦ι×⁷Ｉ§”o⊞-Y~Ｆι,]”¦ι¿‹ιＩθ«Ｍχ←↓ →\↑⁵← \»«↖ＵＯ±⁷±⁴ ←←⮌Ｉ⊕ι»»Ｊ³⁴¦¹⁷↓  H ←____↗↑ ~  ⁴¿‹²³Ｉθ«Ｊ²⁰¦¹⁷↘¹↓⁵↖↑\ »«Ｊ⁴⁴¦²⁰ＵＯ±²²±⁴ ← 42

Try it online! Link is to verbose version of code. Not really golfed, but I'm not sure I want to...
Ｊ²⁵¦³⁰←×_³⁸↑³⁶.→³⁸‖ＯＦ²⁴«Ｊ×Ｉ§”o⊞∧№qＧo⁴↨'”¦ι¹⁵×Ｉ§”o⊞Þ‹wα≕ＹＱ”¦ι⁷≔⎇⁼²³ι²⁶⊕χη←×_η↑⁵.η↓.↓⁵↑¿‹ιＩθ«Ｍη← ¶\↑⁵← \Ｍ⁴→…⪪✂”}⊞μ↓↙Ｊ∧W⎚2⁻⁹]jι｜T◨%êⅈπ↔{Mⅈ⎇_u9⁹F⪫4ＡＧhd⪫ＣNb↷a^ＡnQ⌀oV←×⟦c″⁵FιＯ↗ωsＸςb⁶β|(α)ⅈ,gＢ№$¹ξU=◨↷…Yn´;⎆Σd$=1%▷≦″“}υ⌈ν§Ｖ？Ｗξ⌈‖⦃⊗↓⎚Ｋ⎚✳Ｖ✳V？↗⎆¶﹪⊙⟦≧*(▶″$Q；\⟲↶A⊗s≧»Πj⁸⎆↑´T≡⁵Ｋ⊙αηI3⊙✂“↗⌕Ｎ~e%⬤Ｉη◨γ·y⁸_Gλ↙%ＥＯ)⎆$YＰ“¦7ê⁵№¹▷⟦α)ν&℅◨⦄Ｓ“⁹aEＸ>➙8)↨§+φ✳⁸WＲ&；⎚◧⎆¬▶B³u▷J±÷δ+⁺↖Ｍ≧；↧χw➙Oθ✂⁺⁶r⟦ＧεCVY↖<⁻◧⁹ＤＫ‴1⌀✂$k\φ{0·M℅,ρ)S⎇⸿3oψＪ5$\`↗⁰⊙0c¤?&？⌕↗Ｕε¦⎆～b＆d⊞÷f¬；Ｔ-χＵnν⁶{⊖″;f._⟦#⊗V2⍘¬T.(⁻<Ｖ⊗№êx⊕₂⦃ΣσＧτ¹yΣ2⁶⧴em⁷ＷÀI>]≔A↘_2↓⁴⸿¦y⌕ⅉ﹪B7”×ι²⁸φ¹⁻η⁴¦⁴»«↖←←←⮌Ｉ⊕ι

Try it online! Link is to verbose version of code. This is a version that draws the presents separately for 577 541 530 bytes after I've stolen several ideas from @Charlie to golf a few more bytes off.

Satan Clause is coming to town.

Don't worry, I also borrowed a couple of ideas from you, so we're even. :-)

Python 2, 1322 1319 1287 1265 1061 1059 1056 1032 1030 bytes
n=input();k=' '
print'.'+'-'*77+'.'
for l in'','','\n','	','\r':
 for L in zip(*[['| ']*7]+[['.'+'-'*q+'. ']+['|'+[(['\  ']+[' | ']*6)[j]+"eJxNUkFuGzEM/Mo0qKFd2Uvdm7pAERRoD0bgpIoTRDGNoJcc2tx6saK3d0a7CEphwSVHpIYjweAwZLyV63SWT7HIpxhjwR7wPw7GGC5G+i8DXjF+zgPoMe4xmdsk3NamfQMOGBWfLk5QvR1fez5cBubPpa5reiP+a3oW7uzryINY+Mhz8QlFcUJx9gc+op9fN3X2kDevXCbchHvf7/mkyAL72NFm/jTN4ytPNauKHWafsHe37XbjeZrq/X2dMojyAJ5PC6y3vrK9OJflOrU2NdXLKvnzPPHH6W8A+RfGSTxxhz5/bf/zZu5hnocEZnw755NKM+qwGqu82hPfcHdEXmvOddcZAZbbbJr/ufezEAJ5nuOWi/oG3ov4d3q9Lli4lg7uZZmv68t7J/6IJ8qJZa6ReshC1/cy9PrfwnE16wMRrL0/BbRs3MxcLr0+5dNWFqhvKtK/eEm8opwUF9WXJH3sQHkP1DVSn1jffdgF8FP/l2W+learx9aM+nufz/W+rL+7EPnkxD+V6DU/dh5Pql/j3driJXcrS2r37ebmoUNUp0XlG66+3/y4/bn7evsBLSvb4rJf1v/+AYT9zU8=".decode('base64').decode('zip').split('Q')[i-1].split('U')[j],k*(q-4)+'%2s '%(`i`*(j>2))][i>n]+' | 'for j in 0,1,2,3]+[['| |'+'_'*e+'| ','|'+'_'*q+'| '][i>n],[' \|',k*3][i>n]+k*q]for i in map(ord,l)for(q,e)in[[11,26,9,24][i>23::2]]]):print k.join(L),'|'
print'|'+'_'*77+'|'

Try it online!
-4 bytes thanks to Mr.Xcoder
-24 bytes thanks to Lynn

Compressed version (thanks to Lynn and ovs):
Python 2, 1021 1017 1013 bytes
exec'eJxNVG1P2zAQ/s6vuFWrHDuOQ1JGWVmRJjRpk6hQYR6gOLhCY1IK6wuwfRgmv33POWHaRdX17nxvj323mjarza+nRB7eTQWJnc1Ds3oSRqQiE2o8TvF358f6ge6pWVWlLsb6QBfgta72dVHocle/02UJcaSLXV1AGOkxxGJfv9flni4OIIDBDLnQxV492SEOeYKQ9KfZJKqqRCBRq3GdVkn1mn2L5NCmMIqod9SJFA/vy2pZp4PBgAx5/Cy9uNP8mXmuHPNcKeVoTuRXniBTMpDgRwmtSX6wCYGTnFNmvMnYblLD5xK6IMnyYrAg9jfX66gXhwL6ZxfSkL/A/j27YbtHXE824Sq8RF6akGM5J+cRn+gtxfxBh44Tc+MDPsN2w3Yfz3u7YMkIxDHXpqsfxP34oc+DZS9E6HhOc+/NdKq9zbJweRkyS7AiAfKDBPxN/KxpPD5jQ9a2Wcv+TAH1Ix/XT4vfglA/cEYPqJO+Uew/tP/XDd1V1w8K6OzTTp+zq6WQDGVgzuFh1zityKbcZxpxJkHGth1x/zcxnhECN26f1RQf8BW4F64/lhf98DROGQfvXd9fxBf3DntFNeCkvi8JPJhExPdQRP+fbKfjDh/iAkOMDwCNNTgMnXXRP7eLKZMAvrlj/J13Oa7I5iw79nc542MuAO8FcFXAR4V/XMwwULOYv+n7G3J/4bptDfD3sT/P78vEdycUnhzXnzvlg61iHTX7p/SP2p4z3K3rVbNPZ2dX0QR0WsX6lo4/n305/zr7eP6GWsvaVvXnmeI/TI953Nw3T4mYC1k1WVG/ylbwfOk7lWyzPZmKYflIYpgsmoVKlkellHXVHK3qNE4jj/OSxxkbQJd6hCnlkcbcCi/UbcrjrUUvbqPYuWtMswsCaUZ9vDu1rSXHazjePW+KZKtvJdZPxfumWyt8uBxNJmVd13ISlxbdmeW6WSUnkjP1i6xPyYsMur+PXj21'.decode('base64').decode('zip')

Try it online!

This is extremely impressive. Well done!

Befunge, 1220 1198 1186 bytes
<v5,,$$_\#!:,#-\#1<,".N-."+55p00&
v>1-:10p:1-!30p7>1-::0`\5`+3+8g40p::6\`\1-!+6+8g50p" |",:,,:530g
>-1-:20p:1-!30g* 35**60p10g5*+9+8g57*-:70p00g`!\6\`*40g,v
|01g07p09!`3%7+5 :p08+*27-\*4/8-1g07:,g05,g8+2`4:,g8!%5:_:2-v
>-8%7*60g7+:!v!:-1\+1,+*g05< v!\$_1#!-#:\:#,<:g05-*3\+9g06:!<
# +%68*+,:,v$_\: 80gg90g*:!^v_70g:55+/:68*+\!88+*-,55
^^<<<<0<<<<>$50>0$#<>#5g#$,#<40g,48*:,,:v>1
"|_M|"+55_^#!:$_^#!,,"|"+55$_>#!:$#g02$#<^v!:\,<
 \| |.- _1860'5;,3#*:2-&9(7.)$/+4%   @,,$$_1-\:^
   +    _(")_   _n_     $      .     ____ __.==,_  |~|
  /~\  (_ . _)  (")    |,|  __/ \__ /_%_/|--|XX|-  | |
 /~*~\  / : \ >( o )<  | |  `.   .'|_|_| | _|  |    Y
/~*~~*\(_/ \_)(  o  )._|_|_. /.^.\ |_|_|/ (____'   _|_
 . . .  _   _    i   _{/ _{/    _     b   \  ====   .-.
.i_i_i.( `v' ) .'%'.   \_/    .'.'O .'''. \\\|+-|  //`);
|-~~-~| \   / |^~~.~|  /O \  /___\ {*=*=*}\\\\\+| %%
|_____|   V   _'._.'_@__,/\\(_____) '._.' \\\\\\\//
  \O/  __/\__  ('v')  \   /    .==.   .;'   ...  .&%$+*.       ~
[ ]|_. \_\/_/ //   \\._o_O_..--'  |  .m_.  '*  ` */'"'\&   ~ MERRY ~
|_____)/_/\_\ |\   /||/\/\/|\_____/ C|  | |_/\*_|$\._./% ~ CHRISTMAS! ~
------'  \/     Y Y  """""""`====='  |__| [_____]'%&*+$'     ~~~~~

Try it online!
Might still be possible to golf this further by compressing the pictures, but that would likely require the use of extended ASCII characters which aren't currently supported on TIO.

How is Extended ASCII not supported?

@Zacharý On TIO the Befunge interpreters are configured to use a UTF-8 character set, so if you try to include an extended ASCII character in the source, it will be converted into some multibyte UTF-8 sequence instead.

Is one of the Befunges you used for the befunge-polyglot answer able to handle extended ascii?

@Zacharý It's not the interpreter that's the problem - most interpreters can handle extended ASCII just fine. The problem is in the way TIO translates the webpage input before it passes it on to the interpreter.

I love that the pictures are fully visible in this!

Python 3 + numpy, 1164 1159 1123 1103 1097 1065 1061 996 994 bytes
Compress all things and use numpy to bind them together.
First build closed doors, then replace the doors that need to be opened. Finally, output everything.
-22 bytes thanks to Mr. Xcoder.-5 bytes thanks to notjagan.
EDIT: <1000 bytes!
import lzma,base64,numpy
def g(i):
 a,b,c=[numpy.array([*map(list,i.split('#'))])for i in lzma.decompress(base64.b85decode('T>t=p0RR90|NsC0{{R;Yb2=9ZB3vrGRZhN&js}K8Jmx>v0UA+%!XNuvypanfw-On6yWAqj;f`A@KhRXYG|EfWG~vnf74-|TMD9O<F~(ETm1ht`IL9PRn$&D6@Y`ipqj|2Ks2<w>M0$9alb)6kEp5V>=}iliy4by-zIAEIDqtxiie`c-6+Y_|0z6A#o^?bVc8rNg(dZq)&RMVNZfUWe9`uW87eke^e(U)p=MxBK<aHfTf^JIaEkVa{$4ct<>U}>seZ>tXR2yYjN4W~W;4T16Lv_gAVbahgLo23$DPcrdfNc#QKNxGKmP}?>l;j`Eqj*EArIMnEHDC^u(JA0-eXP$Dx!}mqnSiX}lV507wtt#)-Y{K8q<bZx*3<UiIyS__cP#9?=eN*+sh{-OgeVPlr}`jFjZnFR5NVI(DC8>d%B9EZ=gGyMp)jVbx#uVGLDHNS8Ht`@nS~?ji$ls${$28WROQ@UlY>?I1yXSuWNx7+$YlLSM2tP^f1Vl92;=q~#2jV2qwZB}$El*yJ9lpEpg5&X=pYfDIT;IHs;wMLzIOhXWsm-1n5J{Afro^Zv~Fw$_ylaND7>_!(y1hiO*la?Xms}*M82nm86zo6Lpf%>K)!16qKK7m8<A!0_88GZtXScr*7YoejPFWfmdKNN&;MKgQUoU')).decode().split(':')]
 if i>23:a[23:27,45:59]=c[:,168:]
 while i:i-=1;h=ord('EAKUIFOCQLGDVYMPBTWHXJNR'[i]);v,u=h//5*7-89,h%5*15+6;a[v:6+v,u-3:u]=b;a[v:4+v,u+1:u+8]=c[:,i*7:i*7+7]
 for i in a:print(''.join(i))

Try it online!

C (gcc), 1296 1291 1211 1166 1164 bytes
That super-long string, though (59% of the whole thing!). There's gold in them hills; I can feel it.
Edit: If there is gold, I've only found specks so far.
Edit: -2 bytes thanks to ceilingcat
#define D"BQHLAFKTEVCJOWGPIX@RDMSUN"[p=r*5+c]-64
#define O D<=n
#define P printf(
#define G(x)for(x&&P"  |\n|"),c=0;w=D^24?7:22,c<5;c+=1+(D==24))
#define m(c,n)memset(calloc(n+1,1),c,n)
char*x[]={"_|","\\","33 ","6 ","__",".'","  "," ."},*v,*u;U(char*q){for(;*q;q++)*q>47&*q<56?U(x[*q-48]):(*u++=*q);}t[4],r,c,s,w,p;f(n){P".%s.\n",m(45,77));for(v=u=m(r=0,732),U(".W.7W.|*| |*||*| |*|'M' 'M'_'_3 ) (^.^_1./v`v' oO833+36/~13/~*~1 /~*~~*16.^o3(';') {1|+|/}6d-b3_(\")_ (_7 _) / : 1 (_/ 1_)6_n_3 (\")6>( o )<(6o6)3$36|,|3 | |6.00_.3.34/ 14`.35 /.^.16.1^/. <->o<-> '/v1`23446/_%_/||00 ||00/ 4.==,_--|XX|- 06| (44'3.*.3 /.13|_-0 (.-o-.) _3_ (O X O) / ^ 161/ 1/6.777i_i_i.|-~~-~||4404444j_j_j_ ||_0 0/$$|_ _3_ ( `v' ) 13/3 V33i3 5%'. |^~~.~|_'._5_ 4/142~2 1_1/_/3~ MERRY ~3 /_/1_1 ~ CHRISTMAS! ~31/2~~~~~2|=|3 / 13|(%)|6|4037;'3.m_.6C|6|3|_06,3* +6. +3. '7~~~~~~~3.-.3//`); %%3 //2 b3 5''. {*=*=*} '._536_3 55O /4_1 (44_)");r<5;r++){P"|");G(s=0)P"  .%s.",m(45,w+4));for(;s<4;s++)G(1)sprintf(t,"%d ",D),P"  |%2s %*.*s |",O?s?"|":"\\ ":"",w,w,O?v+p*28+p/18*32+w*s:s^3?"":t);G(1)P"  |%s%s|",O?" |":"__",m(95,w+2));G(1)P"   %-*s",w+5,O?"\\|":"");P"  |\n");}P"|%s|",m(95,77));}

Try it online!
Non-ASCII version
-30 bytes thanks to ceilingcat.
GCC on my machine produces something that crashes immediately, making it unlikely that I will pursue this fork. (Not to mention that TiO reckons 1120 bytes for some reason (same as its reported amount of characters).).
#define D"BQHLAFKTEVCJOWGPIX@RDMSUN"[p=r*5+c]-64
#define P printf(
#define G(x)for(x&&P"  |\n|"),c=0;w=D^24?7:22,c<5;c-=~(D==24))
#define m(c,n)memset(calloc(n+1,1),c,n)
char*v,*u;U(char*q){for(;*q;q++)*q<48|*q>55?*u++=*q:U(L"籟\\\x203333‶彟✮†⸠"+*q-48);}t[4],r,c,s,w,p;f(n){P".%s.\n",m(45,77));for(v=u=m(r=0,732),U(".W.7W.|*| |*||*| |*|'M' 'M'_'_3 ) (^.^_1./v`v' oO833+36/~13/~*~1 /~*~~*16.^o3(';') {1|+|/}6d-b3_(\")_ (_7 _) / : 1 (_/ 1_)6_n_3 (\")6>( o )<(6o6)3$36|,|3 | |6.00_.3.34/ 14`.35 /.^.16.1^/. <->o<-> '/v1`23446/_%_/||00 ||00/ 4.==,_--|XX|- 06| (44'3.*.3 /.13|_-0 (.-o-.) _3_ (O X O) / ^ 161/ 1/6.777i_i_i.|-~~-~||4404444j_j_j_ ||_0 0/$$|_ _3_ ( `v' ) 13/3 V33i3 5%'. |^~~.~|_'._5_ 4/142~2 1_1/_/3~ MERRY ~3 /_/1_1 ~ CHRISTMAS! ~31/2~~~~~2|=|3 / 13|(%)|6|4037;'3.m_.6C|6|3|_06,3* +6. +3. '7~~~~~~~3.-.3//`); %%3 //2 b3 5''. {*=*=*} '._536_3 55O /4_1 (44_)");r<5;r++){P"|");G(s=0)P"  .%s.",m(45,w+4));for(;s<4;s++)G(1)sprintf(t,"%d ",D),P"  |%2s %*.*s |",D>n?"":L"|⁜"+!s,w,w,D>n?s^3?"":t:v+p*28+p/18*32+w*s);G(1)P"  |%s%s|",D>n?"__":" |",m(95,w+2));G(1)P"   %-*s",w+5,D>n?"":"\\|");P"  |\n");}P"|%s|",m(95,77));}

Ideone link

C (gcc), 2798 1976 1963 ... 1862 1742 1703 1651 1634 1632 bytes
-2 Bytes thanks to ceilingcat
I've replaced a few icons to avoid unnecessary ESC '\' characters.
(*L)()=printf;
#define E else L
#define W"  |"
#define V W" | %.7s "
#define S(x)else if(i<x)L
#define D(x)for(i=0,++j;i++<x;)
#define R L("%s.%1$s.%1$s",I);L(q^7?".%s.%1$s":"%2$s----.%1$s",I,I+3);L(".  |\n|");D(30)d(n)
char*P="_______   +    _(\")_   _n_     $      .     ____ __.==,_  .*.   _   _  . . .  _   _   |~|   //'`\\   |=|   ,   *    j   .&%$+* |  _  | ('v')    .==..W. .W.  ...     .-. _j_j_j_  /~\\  (_ . _)  (\")    |,|  __/ \\__ /_%_/|--|XX|-  /.\\  (O X O).i_i_i.( `v' )  | |  //....\\  / \\  +  . +  .'''. */'\"'\\&| ($) |//   \\\\.--'  ||*| |*| '*  `   //`); ||__|  /~*~\\  / : \\ >( o )<  | |  `.   .'|_|_| | _|  |  |_-_|  / ^ \\ |-~~-~| \\   /    Y   ||()()| |(%)|   . ' .{*=*=*}$\\._./%|  \" o||\\   /|\\_____/|*| |*||_/\\*_| %%    _|/$$|_/~*~~*\\(_/ \\_)(  o  )._|_|_. /.^.\\ |_|_|/ (____' (.-o-.) \\/ \\/ |_____|   V     _|_  ||_[]_| |___| ~~~~~~~ '._.' '%&*+$'| === |  Y Y  `=====''M' 'M'[_____]//     CRIMBGLUFWDKPXHQJYASENTVO",*I="  .-----------",*T="_________";q,i,j,k,l,g;d(o){l=(i-1)%5+j*5;k=7*l+168+168*(i>10)-(g=7*(l>17));if(q=P[672+l]-65)if(q>o)if(q^24)if(i<16)L(W"%9c"W,32);S(21)(W"%10d |",q);S(26)(W"_%s_|",T);E("%15c",32);S(16)(W"%26c|",32);S(21)(W"%25d |",q);S(26)(W"%s%1$s%s|",T,T+1);E("%30c",32);else if(q^24)if(i<6)L(W"\\%9.7s |",P+7*l-g);S(16)(V"|",P+k);S(21)(V"|",P+7*l+504-g);S(26)(W" |%s|",T);E("   \\|%10c",32);S(6)(W"\\%9.7s %7c%9c",P+7*l,'~','|');S(11)(V"%s"W,P+k,"  ~ MERRY ~  ");S(16)(V"%s |",P+k,"~ CHRISTMAS! ~");S(21)(V"%9.7s    "W,P+7*l+504,P+608);S(26)(W" |%s%1$s%s|",T,T+3);E("   \\|%25c",32);i%5||L(W"\n|");}f(n){L(".");D(77)L("-");L(".\n|",j=-1);R;R;R;R;R;D(77)L("_");L("|");}

Try it online!

I don't know if it'll cost you any bytes, but the images aren't quite in the right position within the windows...

@DomHastings Thanks, I hadn't noticed it.  It's fixed now.

@ceilingcat That's a really neat trick.  I like it a lot.

1576 bytes

Ruby, 966 bytes
->n{a=%w{8. 99|/ 99|1 8' .;.. |//| |// |=_ 9.W. 9|*| 9|*| 9'M' _99| $)9| "9o| ==9| ~| 9| Y9 |__ .9. i_i. ~8~| ___| $ ,| 9| _|_. ^/. o<8> v1` 9 _9. O/{ *1{ **1 n_ ") o9)< o99) v') 9911 99/| 9Y *. .1 8_| o8.) _.8 +. W9) "` 993 _O_. /1/| """" + ~1 *~1 ~451 . 91__ 99.' ^.1 =| 91 %)| __| ")_ .9_) :91 91_) 99_ X9O) ^91 91/ 99_ v'9) 99/ V ^o ;') +|/} 8b b ''. *=*} _.' i9 %'. ~2~| _.'_}
b=(0..34).map{?|+" "*77+?|}
96.times{|i|z="EAKUIFOCQLGDVYMPBTWHXJNR"[j=i/4].ord-65;y=z/5*7
t=j<n
b[l=1+y+k=i%4][x=z%5*15+3]=b[l][x+12+m=i/92*15]=?|
b[y+(k+4)%7][x,13+m]=["|%*d  |"%[9+m,j+1],(t ?"| |":?|).ljust(12+m,?_)+?|,(t ?" \\|":"").ljust(13+m),?.+?-*(11+m)+?.][k]
w=i>91?["~%14s"%".-. ","~ MERRY ~     //`);","~ CHRISTMAS! ~ %%    ","~~~~~     %-6s "%"//  "][k].rjust(24):(a[i][1,3].reverse.tr("1/;o)8~`></1{)O3451')/bo}~2"[j,5],"/1, (~8'<>1/}(o1*~/`(1d.{^~"[j,5])+a[i]).center(9)
t&&b[l][x+1,11+m]="\\  | | |"[k*2,2]+w.tr('1345298','\\\\/~*. -')}
puts ?.+?-*77+?.,b,?|+?_*77+?|}

Try it online!
More golfed, but harder to see the pictures in the code.
Ruby, 974 bytes
This is a function, to be assigned to a variable such as f and called as f[n]. It prints to stdout.
Turned out longer than expected. I think there are a few more bytes to squeeze out by laying out the picture data differently, which I will try later.
I use symmetrical or near symmetrical pictures, and only the righthand half is found in the code. The left half may have up to 5 character subsitutions compared to the right. The code for making the substitutions is quite long, which partially negates the compression. Only about 60 bytes are saved.
->n{a=%q[8.
  |/
  |1
8'
.;..
|//|
|//
|=_
 .W.
 |*|
 |*|
 'M'
_  |
$) |
" o|
== |
~|
 |
Y
|__
. .
i_i.
~8~|
___|
$
,|
 |
_|_.
^/.
o<8>
v1`

_ .
O/{
*1{
**1
n_
")
o )<
o  )
v')
  11
  /|
 Y
*.
.1
8_|
o8.)
_.8
+.
W )
"`
  3
_O_.
/1/|
""""
+
~1
*~1
~451
.
 1__
  .'
^.1
=|
 1
%)|
__|
")_
. _)
: 1
 1_)
  _
X O)
^ 1
 1/
  _
v' )
  /
V
^o
;')
+|/}
8b
b
''.
*=*}
_.'
i
%'.
~2~|
_.'_].split($/)
b=(0..34).map{?|+" "*77+?|}
96.times{|i|z="EAKUIFOCQLGDVYMPBTWHXJNR"[j=i/4].ord-65;y=z/5*7
t=j<n
b[l=1+y+k=i%4][x=z%5*15+3]=b[l][x+12+m=i/92*15]=?|
b[y+(k+4)%7][x,13+m]=["|%*d  |"%[9+m,j+1],(t ?"| |":?|).ljust(12+m,?_)+?|,(t ?" \\|":"").ljust(13+m),?.+?-*(11+m)+?.][k]
w=i>91?["~%14s"%".-. ","~ MERRY ~     //`);","~ CHRISTMAS! ~ %%    ","~~~~~     %-6s "%"//  "][k].rjust(24):(a[i][1,3].reverse.tr("1/;o)8~`></1{)O3451')/bo}~2"[j,5],"/1, (~8'<>1/}(o1*~/`(1d.{^~"[j,5])+a[i]).tr('134528','\\\\/~*.-').center(9)
t&&b[l][x+1,11+m]="\\  | | |"[k*2,2]+w}
puts ?.+?-*77+?.,b,?|+?_*77+?|}

Try it online!

Nice! It was my intention for the picture choices to be the focus of golfing!

Clojure, 1530
Try it out
The clojure solution probably could be a little shorter, but here's my first attempt.
(defn a[x](let[k clojure.string/join b" . _ .  }\\O/{  }/*\\{  /***\\  _'_    ) (^.^ \\./v`v  oO8     +     /~\\   /~*~\\ /~*~~*\\  .^o   (';') {\\|+|/}  d-b   _(\")_ (_ . _) / : \\ (_/ \\_)  _n_    (\")  >( o )<(  o  )   $     |,|    | |  ._|_|_.   .   __/ \\__`.   .' /.^.\\  .\\^/. <->o<-> '/v\\`          ____  /_%_/||_|_| ||_|_|/ __.==,_--|XX|- _|  | (____'   .*.    /.\\   |_-_| (.-o-.) _   _ (O X O) / ^ \\  \\/ \\/  . . . .i_i_i.|-~~-~||_____|________j_j_j_ ||__| _|/$$|_ _   _ ( `v' ) \\   /    V      i    .'%'. |^~~.~|_'._.'_  |~|    | |     Y     _|_   //'`\\ //....\\||()()|||_[]_|  |=|    / \\   |(%)|  |___| _{/ _{/  \\_/    /O \\ @__,/\\\\ ,   * +  . +   . ' .~~~~~~~\\  ====\\\\\\|+-|\\\\\\\\\\+|\\\\\\\\\\\\\\   b    .'''. {*=*=*} '._.' " z(fn[n]#(.substring %1(* n %2)(+ (* n %2)n)))i(z 28)j(z 7)s str r #(apply s(repeat %1 %2))m["       ~       ""   ~ MERRY ~   "" ~ CHRISTMAS! ~""     ~~~~~     "] c #(let[w(if(= 24 %)26 11)](concat[(s"."(r w"-")".")](for[i[0 1 2]](s"|"(r w" ")"|"))[(s"|"(r(- w 4)" ")(if(< % 10)" ")%"  |")(s"|"(r w"_")"|")(r(+ w 2)" ")]))o #(let[w(if %2 26 11)](concat[(s"."(r w"-")".")(s"|\\  "(j %1 0)(if %2(m 0))" |")](for[i[1 2 3]](s"| | "(j %1 i)(if %2(m i))" |"))[(s"| |"(r(- w 2)"_")"|")(s" \\|"(r(- w 1)" "))]))d #(if(< x %)(c %)(o(i b(- % 1))(= % 24)))](println(s"."(r 77"-")".\n|  "(->>(for[p[[2,17,8,12,1][6,11,20,5,22][3,10,15,23,7][16,9,24,18][4,13,19,21,14]]](map #(d %1)p))(mapcat #(apply map vector %))(map #(k"  " %))(k"  |\n|  "))"  |\n|"(r 77" ")"|\n""."(r 77"-")"."))))

I wonder if you'd be able to save bytes using run length encoding? I don't know how short the decoding would be, but there are quite a few runs of identical characters...


text:
128 years? Hypothetical leap year reform
The solar year is 365 days, 5 hours, 48 minutes, 45 seconds, and 138 milliseconds, according to this video. With the current Gregorian calendar, the rules for leap years are as follows:
if      year is divisible by 400, LEAP YEAR
else if year is divisible by 100, COMMON YEAR
else if year is divisible by 4,   LEAP YEAR
else,                             COMMON YEAR

Unfortunately, this method is off by one day every 3216 years.
One possible method of reforming the calendar is the following rule:
if      year is divisible by 128, COMMON YEAR
else if year is divisible by 4,   LEAP YEAR
else,                             COMMON YEAR

This has the benefit of not requiring us to change our calendars again for another 625,000 years, give or take.
Say the entire world decides that, starting now, we use this system of every fourth year is a leap year except every 128th year, changing our calendars as follows:
YEAR    GREGORIAN    128-YEAR
2044    LEAP         LEAP
2048    LEAP         COMMON
2052    LEAP         LEAP
 ...
2096    LEAP         LEAP
2100    COMMON       LEAP
2104    LEAP         LEAP
 ...
2296    LEAP         LEAP
2300    COMMON       LEAP
2304    LEAP         COMMON
2308    LEAP         LEAP

How would this affect our day of the week algorithms?
The challenge

Given a date from the year 2000 to the year 100000, find the day of the week under this new calendar.
Any input and output format is allowed as long as you clearly specify which formats you are using.
This is code golf so try to make your solutions as golfy as possible!

Test cases
"28 February 2048" -> "Friday"
"March 1, 2048"    -> "Sat"
(2100, 2, 29)      -> 0           # 0-indexed with Sunday as 0
"2100-02-29"       -> 7           # 1-indexed with Sunday as 7
"28 Feb. 2176"     -> "Wednesday"
"1-Mar-2176"       -> "Th"
"28/02/100000"     -> "F"         # DD/MM/YYYYYY
"Feb. 29, 100000"  -> 6           # 1-indexed with Sunday as 7
"03/01/100000"     -> 1          # MM/DD/YYYYYY and 1-indexed with Sunday as 1

Suggestions and feedback on the challenge are welcome. Good luck and good golfing!

For test case #4, you mean 1-indexed, right? Otherwise there would have to be 8 days in that week.

Also, you say "good golfing", so is this a #code-golf challenge? If so, put in the winning criteria (e.g. lowest number of bytes/characters) and add that as a tag.

@Sebastian You are correct on both counts. I've already edited the challenge. Thank you for your feedback

My answer disagrees with the test cases from the year 100000 (labeling them Friday and Sunday, respectively), but I believe my answer over the test cases. I've brute-force checked my answer in two respects over the range 2000 to 100000: that Jan 1 is always the day after Dec 31 of the previous year, and that the years in which Mar 1 is not the day after Feb 28 are precisely the years divisible by 4 but not 128. Can you double-check those test cases?

When reading the title I immeadiately though of Matt Parker's video. Nice to see it linked in the thread as well :D

@MishaLavrov I'm getting Saturday for both

@ericw31415 They can't both be Saturday, they're two days apart.

@MishaLavrov Whoops, that was due to a careless "simplification" on my part. I'm now getting Friday and Sunday like you.

Just take the standard day-of-the-week libraries and modify the global constants accordingly, right?  ;)

@MishaLavrov I figured I had 100000 wrong somehow. Thanks for the feedback.

I enjoy seeing how the order of the function parameters is m, d, y for some answers and d, m, y for others––and then there are those implicit parameter answers that apparently like to keep an air of mystery about them.

C (gcc), 60 bytes
f(m,d,y){y-=m<3;return(y+y/4-y/128+"-bed=pen+mad."[m]+d)%7;}

Try it online!
Simple modification of Sakamoto's method. Takes input as integer arguments in the order month, day, year, and outputs the number of the day (0-indexed on Sunday).

What does the "-bed=pen+mad." part do?

@ericw31415 It accounts for the length of each month in days, and simply for the sake of appearance it is shifted up by multiples of 7 instead of being characters at ordinals (31, 28...).

Right, I forgot that char still represents a number, so you can do mod 7 directly.

Wolfram Language (Mathematica), 57 55 53 bytes
DayName@{m=#~Mod~128;6+Mod[(9#-m)/8-6Clip@m,28],##2}&

Try it online!
Takes three inputs: the year, the month, and the day, in that order. For example, if you save the above function as fun, then fun[2048,2,28] tells you the day of week of February 28, 2048.
How it works
The formula m=#~Mod~128;6+Mod[(9#-m)/8-6Clip@m,28] converts the year into an equivalent year (a year with exactly the same days of week) between 6 AD and 33 AD. To do this, we subtract an offset and then take the year mod 28; but the offset changes every 128 years, and for years divisible by 128, we have to make a further adjustment because the equivalent year shouldn't be a leap year.
Anyway, once that's done, we look up the month and day in that equivalent year using the built-in DayName.

JavaScript, 65 59 bytes
(d,m,y)=>(y-=m<3,(+"0032503514624"[m]+y+(y>>2)-(y>>7)+d)%7)

(d,m,y)=>(y-=m<3,(+"0032503514624"[m]+~~y+~~(y/4)-~~(y/128)+d)%7)

Uses Sakamoto's method. Gives 0=Sunday, 1=Monday, 2=Tuesday...
-2 bytes thanks to Misha Lavrov
-4 bytes thanks to Arnauld

I think ~~y can just be changed to y. You're not going to get a fractional year in the input, right? But I admit I'm not fluent in JavaScript.

How about +y+(y>>2)-(y>>7)?

@MishaLavrov Yes, that is true. For some reason I decided I should floor everything.

Python 2, 67 bytes
def f(m,d,y):y-=m<3;return(y+y/4-y/128+int("0032503514624"[m])+d)%7

Try it online!
int("..."[m]) can be replaced by ord("-bed=pen+mad."[m]).

Actually, 37 bytes
This is a port of notjagan's modification of Sakamoto's algorithm, but with a few stack-based tricks as described below. Input format is day, year, month. Output format is 0-indexed with Sunday as 0. Golfing suggestions welcome! Try it online!
;"0032503514624"Ei)3>±+;¼L;¼¼½L±kΣ7@%

Explanation
                     Implicit input: day, year, month (month is at TOS)
;"0032503514624"Ei)  Get the month code, convert to float, rotate to bottom of the stack
3>±+                 If 3>month, add -1 to year
;¼L                  Push floor(year/4) to stack
;¼¼½L±               Push floor(year/4) and append -floor(year/128) to stack.
kΣ                   Wrap the stack (y/128, y/4, y, month_code, d) in a list and sum
7@%                  Get the sum modulo 7
                     Implicit return

Jelly, 32 31 30 28 bytes
Another port of notjagan's modification of Sakamoto's algorithm but with a base-250 number in place of 032503514624 (don't need the extra 0 because Jelly is 1-indexed). Input format is month, year, day. Output format is 0-based with Sunday as 0. Golfing suggestion are very welcome as the way the links were tough to arrange and may still be golfable. Try it online!
Edit: -1 byte from using bit shift instead of integer division. -1 byte from rearranging the beginning and the input format. -2 bytes thanks to Erik the Outgolfer and caird coinheringaahing.
3>_@µæ»7,2I+µ“Ṿ⁵Ḥ9{’D³ị+⁵+%7

Explanation
         Three arguments: month, year, day
3>_@     Subtract (month<3) from year. Call it y.
µ        Start a new monadic chain.
æ»7,2    Bit shift y by both 7 and 2 (equivalent to integer division by 128 and by 4).
I+       y + y/4 - y/128
µ        Start a new monadic chain.
“Ṿ⁵Ḥ9{’  The number 732573514624 in base 250.
D        The list [7, 3, 2, 5, 7, 3, 5, 1, 4, 6, 2, 4].
³ị       Get the month code from the list (1-based indexing).
+⁵+      Add y, our month code, and day together.
%7       Modulus 7.

29 bytes

source: Stack Exchange

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

sort: votes


text:
Coffee Machine Machine
You left your computer for too long, and it went to sleep. Wake it up again by printing the following coffee maker.
________._________
|      | \   -   /
|  ||  |  \  -  /
|  ||  |___\___/
|  ||  |     X
|      |    ___
|      |   / - \
|______|  /  -  \
| ____ | /_______\
||7:30||__________
||____|           |
|_________________|

Reference image I used.
Specs

Any input must be included in the byte total.
Leading newlines and trailing whitespace is allowed.
Shortest code in bytes wins.

I'm usually fine with different types of KC challenges, but the ASCII art (while pretty good) has no patterns that submissions could benefit from.

@totallyhuman better now?

@Pavel that'll be for the microwave challenge.

Bah, this question changed invalidating the 88-byte answer I had been writing: 7:30⸿⁴↑²←←⁴↓↓²Ｐ¹⁷←↑χ⁸Ｐχ.⸿↘↓²↗↑²Ｍ³→↓²Ｐ⁸↓³Ｐ←⁷↓³↗→χＰ↓³↖ ↑→¹↖²←²Ｐ<⁴←²Ｐ>⁴ＵＭＫＡ⎇⁼-ι_ι_↓x--Ｐ-×_⁴ Try it online!

@totallyhuman Ironically, from my POV, the new version has fewer patterns than the old does. (Also, I keep trying to ping you regarding https://codegolf.stackexchange.com/a/141095)

@Pavel the microwave challenge

Can the program send an unrelated message to stderr, or should it only print the coffee maker??

@luk3yx it should only print to one stream. If you want you can put the coffee maker in stderr, but only one stream should have non-whitespace printed.

@luk3yx If you didn't ask and OP wouldn't have stated otherwise that would have been allowed by default for code-golf as far as I know.

SOGL V0.12, 78 bytes
≈p⁽.*%θ|»Y?v▼mB8█[=ρļiρKτ¾Γb    2⁴⅟┼¤Μ╬(׀⁾⌠○Yyλ{╝<-³|k¤↑E*UH∙æ¹ΘNσx↔§÷πm‛⁾ņμ׀⁴@≤‘

Try it Here!
SOGL compression beats bubblegum!

@totallyhuman the whole thing is a compressed string - it ends with ‘ and there is no starting ".

Well of course it beats Bubblegum, it was designed with ASCII-art in mind :P

CoffeeScript, 219 bytes
Thanks to @totallyhuman for saving 4 bytes!
->"""#{l="________"}.#{l}_
#{s="|      |"} \\   -   /
#{t="|  ||  |"}  \\  -  /
#{t}___\\___/
#{t}     X
#{s}    ___
#{s}   / - \\
|______|  /  -  \\
| ____ | /_______\\
||7:30||#{l}__
||____|           |
|#{l}#{l}_|"""

Try it online!

The irony of your language is not lost on me.

This is not ironic. It is apt.

Befunge, 166 162 bytes
55+31p"kvvvvvvvvgf:::::kvugvvvvvj6,jHvvvs>?vqg[@:P>vvvg[|P:f::>Jv"v
:0  /\|_-37X.v"vvvv{vvvvg:::>=:@:G>f>f:=|:G>f>fv`vUg:j:>::N>::f::"<
g1+2%+56:-*49<_@#:,g1/+56,

Try it online!
Explanation
This is using a fairly simple compression scheme where every two characters are encoded into a pair as a base 11 number.
We start by translating the characters into indices in a lookup table to minimise their size - this gives us one index in the range 0 to 11, and a second in the range 0 to 8. These indices are combined into a single number as n = i1 + i2*11. We then add a additional offset to translate that number into the range of printable ASCII characters, so it can be stored in a Befunge string.
When decoding we just perform this process in reverse. We subtract the offset, split the value into two parts with i1 = n%11 and i2 = n/11, and then lookup those indices in the translation table to obtain the final characters to output.
Bonus Coffee Mug
55+37p"kvvvvvvvvgf::"v
v",6jvvvvvguvk:::"   <
>"jHvvvs>?vqg[@:P"   v
v"vJ>::f:P|[gvvv>"   <
>"::f::>N::>:j:gU"   v
v"f>f:=|:G>f>fv`v"   <
>">G:@:=>:::gvvvv"   v
:0 X/\|_-37X.v"vvvv{"<
 @v2%+56:-*49<<_>
  >+7g,65+/7g,:^

Try it online!

JavaScript (ES6), 176 bytes
_=>`22__.222511| 31-1/4636-6/4232/416X511| 12511|1/ - 3522|6/6-635 2_ | /2_235|7:0||222_5|2_|6111|522222__|`.replace(/\d/g,s=>[30,'   ','___','\\',`
|  ||  |`,`
|`,'  '][s]||s)

Try it online!
RegPack'd version, 186 184 bytes
_=>[...'CaFfEiNe!'].reduce((s,c)=>(x=s.split(c)).join(x.pop()),`!E_.C!
f| \\a-aiN\\e-ei|!\\!iNaX
fNe!
fN / - FCN/e-eF E | /!EF|7:30||CE
||Efea|
|CCE_|E__a N|ei/
N|NE!_fNeeF\\
|ae C!!`)

Try it online!

Bubblegum, 83 bytes
00000000: 4d8c d501 0230 1403 ff3b 4507 c01d 16c1  M....0...;E.....
00000010: c922 199e abf7 9eab 2a2b 3582 63c6 f183  ."......*+5.c...
00000020: 5f62 eb60 4a0c a5b7 9c3b 923e d8bc 028f  _b.`J....;.>....
00000030: f104 e6a7 d89a 0f9f 6065 4c9d 5fd2 8902  ........`eL._...
00000040: 56d6 2ad0 f2f9 b6df d8ea d0aa 671d d75f  V.*.........g.._
00000050: 33fe 03                                  3..

Try it online!

C# (.NET Core), 189 bytes
()=>@"uu__.uuu
|ss| \s-s/
|  ||  |  \  -  /
|  ||  |u\u/
|  ||  |s  X
|ss| su
|ss|s/ - \
|uu|  /  -  \
| u_ | /u_u\
||7:30||uuu_
||u_|  sss|
|uuuuu__|".Replace("u","___").Replace("s","   ")

Try it online!

The lazy solution:
C# (.NET Core), 223 bytes
()=>@"________._________
|      | \   -   /
|  ||  |  \  -  /
|  ||  |___\___/
|  ||  |     X
|      |    ___
|      |   / - \
|______|  /  -  \
| ____ | /_______\
||7:30||__________
||____|           |
|_________________|"

Try it online!

@StephenLeppik I'm keen to see a C# way of compressing this that is shorter than the hardcoded solution, but I haven't been able to find anything.

@StephenLeppik If I go down the Replace route I save some bytes, but I'm still thinking that run-length encoding, or decompressing some compressed string will be longer than hardcoding (keen to be proven wrong though).

Bash, 169 165 bytes
Thanks to Nahuel Fouilleul for saving 4 bytes!
base64 -d<<<H4sIAECtIFoCA1WOUQqAMAxD/3uKXmBO8EPwJH4MepEc3sRVrQ86WJZkjZgs8WDwG/jg2ThdEjQurVWFgcGpFnJ+JeRXyjAbhmH+Bt1VSUXGoKXnJpSwH9sKRNkOGXuBlfcEdgGenVY82QAAAA==|zcat

Try it online!
gzip seems to compress it a lot better than bzip2 and xz.

Python 2, 282 265 bytes
a,b,c,d,e,u='_ . | \ / ||'.split();s=' ';t=s*2;z=c+t;y=c+s*6;v=z+u+t
for x in a*8+b+a*9,y+c+s+d+s*3+a+s*3+e,v+z+d+t+a+t+e,v+c+a*3+d+a*3+e,v+c+s*5+"X",y+c+s*4+a*3,y+c+s*3+e+s+a+s+d,y+z+e+t+a+t+d,c+s+a*4+s+c+s+e+a*7+d,u+"7:30"+c*2+a*10,u+a*4+c+s*11+c,c+a*17+c:print x

Try it online!
Actually a fair bit longer than just
print'''TheCoffeePot'''

which would be 227 but it works so posting it anyway as it's the shortest (and so far only) Python answer :)

You can shave of a few bytes from that first line: a,b,c,d,e,s='_.|\/ ';u=2*c;t=s*2;z=c+t;y=c+s*6;v=z+u+t

@DanielHepper - many thanks but I don't think this is going to go under 200 so have had enough of this challenge now. Will remember your tips for next time and thanks again :)

Actually in python 2 print '''the coffee pot''' doesn't work because of the backslashes at the end of the line, you have to escape them which costs you 3 bytes, giving a total of 230.

brainfuck, 689 bytes
+++++++++>+++>++++++++++++>++++>+++++++++>+>++++>++++>++++>+++++>+++++>++++++++>+++++<<<<<<<<<<<<[[->>>>>>>>>>>>>>++++++++++<<<<<<<<<<<<<<]>]>+++++>++>++++>+++++++>++>>+++++>++++++>++++++++>+>+++++>++++++++>++++++++<<<<<<<<<<<<........>>>>>>>.<<<<<<<.........>>>>>.<<<.<......>.<.>>>.<<<...>>>>>.<<<<<...>>.>>.<<<.<..>..<..>.<..>>>.<<<..>>>>>.<<<<<..>>.>>.<<<.<..>..<..>.<<...>>>>.<<<<...>>>.>>.<<<.<......>.<.....>>>>>>>>>>.<<<<<<.<<<.<......>.<....<...>>>>>.<<<.<......>.<...>>.<<.>>>>>.<<<<<.>>>.>.<<<.<<......>>.<..>>.<<..>>>>>.<<<<<..>>>.>.<<<.<.<....>.>.<.>>.<<<.......>>>>.>.<<<..>>>>>>>>.>>.<<<.<.<<<<<<..<<..........>>>>>.<<<..<<....>>.<...........>.>>>.<<<.<<.................>>.

Try it online!
First I generate a table of 13 characters that are used. To save bytes, I first generate their closest character codes that are divisible by 10. Then I add 0-9 to each of them. Finally I just print them in particular orders.
Unminified source:
+++++++++>+++>++++++++++++>++++>+++++++++>+>++++>++++>++++>+++++>+++++>++++++++>+++++<<<<<<<<<<<<
[[->>>>>>>>>>>>>>++++++++++<<<<<<<<<<<<<<]>]
>
+++++>++>++++>+++++++>++>>+++++>++++++>++++++++>+>+++++>++++++++>++++++++
<<<<<<<<<<<<
........>>>>>>>.<<<<<<<.........>>>>>.
<<<.<......>.<.>>>.<<<...>>>>>.<<<<<...>>.>>.
<<<.<..>..<..>.<..>>>.<<<..>>>>>.<<<<<..>>.>>.
<<<.<..>..<..>.<<...>>>>.<<<<...>>>.>>.
<<<.<......>.<.....>>>>>>>>>>.<<<<<<.
<<<.<......>.<....<...>>>>>.
<<<.<......>.<...>>.<<.>>>>>.<<<<<.>>>.>.
<<<.<<......>>.<..>>.<<..>>>>>.<<<<<..>>>.>.
<<<.<.<....>.>.<.>>.<<<.......>>>>.>.
<<<..>>>>>>>>.>>.<<<.<.<<<<<<..<<..........>>>>>.
<<<..<<....>>.<...........>.>>>.
<<<.<<.................>>.

Nice but seems to miss out the 3rd || on the 5th line

You can change the initialization to ++++++++++[>+++++++++>+++>++++++++++++>++++>+++++++++>+>++++>++++>++++>+++++>+++++>++++++++>+++++<<<<<<<<<<<<<-]. And after adding 0-9, use [<]> to get back to origin. That would save 37 bytes.

And round to nearest would save another 19 bytes. Try it online!

Good stuff. Since brainfuck only understands eight symbols, I contend that this solution is only 258 and three eighths of a byte long.

@Fax That would be for binaryfuck.

J, 174 164 bytes
Some silly RLE-like compression, lengths encoded as base 99 number :)
_19]\(10#.inv 99x#._28+a.i.'Ls}DR#Er-B{SBh(+dXQwBE=]|LrC$v:x5u}sa"z>f=#Y*?Tzzo8PmK7rZay')#,'_._||\-/|||\-/|||_\_/|||x||_||/-\|_|/-\|_|/_\|7:30|__|_| ||__|',.' '

Try it online!

brainfuck, 546 bytes
-[+>+[+<]>+]>>++++++++++>------->-[<++>-----]<........<<.+>>.........<.>>>++++[<++++++++>-]--->--[<+>--]++>-[<+>-----]+++>-[<+>---]<<<.<......>.<.<---.>...<<<--.++>>>...<<<.>.>>>.<..>..<..>.<..<.+++>..<<<--.++>>>..<<<.>.>>>.<..>..<..>.<<...---.+++...<<.>.>>>.<..>..<..>.<.....>>>.<<<<<.>>>.<......>.<....<...<.>>>.<......>.<...<<<.>>>.<<<--.++>>>.<---.+++<.>>>.<<......>>.<..<<<.>>>..<<<--.++>>>..<---.+++<.>>>.<.<....>.>.<.<<<.>>.......---.+++<.>>>..>++.+++.-------.---.<..<<..........<.>>>..<<....>>.<...........>.<<<.>>>.<<.................>>.

Try it online!

Python 3, 220 216 213 bytes
b=0;c='\n -./037:X\\_|'
for i in r"*Z_7stu{NzKBNJ,IOOe-0qj9?s7C?r/XYUX_Fs\hM-\NY+VJ+A.E]?vAx&=gUVSBRq4>PB+]OtO3%PWn%^0c0'B]d5P-$X,(7U$nVq02NRjMp'AAvl!Da(zyVyI":b=b*92+ord(i)-32
while b:print(c[b%13],end='');b//=13

Try it online!
Code to generate code

print(c[b%13],end='') can be print(end=c[b%13]) for -3 bytes

Cubically, 652 626 bytes
⇒@@@@@@@@
RU+532f1-411@+411f1@-3320@+5432@-4422@@@@@@+4422@-4422@+220@-220@@@+4-0@-4+0@@@+1@-4000@+5432@-4422@@+4422@@-4422@@+4422@-4422@@+220@-220@@+4-0@-4+0@@+1@-4000@+5432@-4422@@+4422@@-4422@@+4422@-50+4@@@-1+00@+1-00@@@-50@-4000@+5432@-4422@@+4422@@-4422@@+4422@-4422@@@@@+311@-333@+5432@-4422@@@@@@+4422@-4422@@@@+510@@@-3320@+5432@-4422@@@@@@+4422@-4422@@@+1@-1@+4-0@-4+0@+220@-3311@+5432@-50+4@@@@@@+50-4@-4422@@+1@-1@@+4-0@-4+0@@+220@-3311@+5432@-4422@+510@@@@-510@+4422@-4422@+1@+50@@@@@@@-1+00@-3311@+5432@@-52@+1-00@-3+4@-1+00@+541@@-50+4f1@@-3320@+5432@@-50+4@@@@+50-4@-4422f1@@@+4422@-5432@+5432@-50+4f1f1@+50-4@

Found via this tool and golfed via search-and-replace, plus a couple custom optimizations.
Try it online!

Bash, 108 bytes
zcat
Input is a 104 byte sequence on stdin (represented in hexadecimal below) of the coffee pot compressed in gzip format:
1F 8B 08 01 0F 2D 32 5A 02 00 5D 8C 41 0A 80 30
0C 04 EF 7D 45 3E A0 15 3C 08 BE C4 43 20 1F D9
C7 3B B1 96 56 87 A6 90 21 BB F1 B2 46 A7 C8 1E
64 CE BF 30 35 95 18 9E A3 66 43 C0 99 F9 04 AE
51 02 9F 52 C2 34 78 11 16 94 3B 22 8D 05 70 52
A3 81 D2 71 EE 9B B8 ED A0 5A 6C 20 BA FE A8 DC
9E 9D 56 3C D9 00 00 00

Might as well be Bubblegum.

all_licenses: 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/


text:
Spiral out the Alphabet!
Look at the following string. Notice a pattern?

ABEFNOPEFGH
DC G  Q   I
M  H  R   J
LKJI  S   K
D     T   L
C     U   M
BAZYXWV   N
E         O
D         P
C         Q
BAZYXWVUTSR

As some might have noticed, it's basically a spiral of the alphabet, where the distances between rows / columns are gradually increasing by 1 space / newline.
Rigorous definition

Let's have a counter c, which is initially 0.
We write out the first c + 1 letters of the alphabet from left to right: A.
Then, from top to bottom the next (c + 1)(c + 2)/2 letters (add B): AB.
From left to right, the next (c + 1)(c + 2)/2 (add C):
AB
 C

And from bottom to top, the next c + 1 letters (add D):
AB
DC

Reached the end of the cycle. Hence, let's increment c (which becomes 1). Then, it starts back from the first step, the only difference being that instead of using the first c + 1 letters of the alphabet, we use the next c + 1 letters, starting from the last element of this cycle (D in this case, so we continue with EFG...). When Z is reached, it cycles back from A.

Task
Given an integer N (which is positive for 1-indexing or non-negative for 0-indexing), output the first N cycles of the spiral.
Rules

You can either use the lowercase or the uppercase alphabet, but your choice must be consistent (only use one of them, mixing is not allowed).
You can take input and provide output through any of the standard methods, in any programming language, while noting that these loopholes are forbidden by default.
Acceptable output formats: multiline string, a list of strings representing lines, a list containing multiple lists of characters, each representing one line, or anything else you find suitable. In case you don't choose the first format, it would be nice to include a pretty-print version of your code.
This is code-golf, so the shortest code in bytes (in each language) which fulfils the requirements wins!

Test cases
The input integer will be separated by its corresponding output through a newline, and the tests will be separated using dashes. Note that these are 1-indexed.

1

AB
DC

--------

2

ABEF
DC G
M  H
LKJI

--------

3

ABEFNOP
DC G  Q
M  H  R
LKJI  S
D     T
C     U
BAZYXWV

-------

4

ABEFNOPEFGH
DC G  Q   I
M  H  R   J
LKJI  S   K
D     T   L
C     U   M
BAZYXWV   N
E         O
D         P
C         Q
BAZYXWVUTSR

-------
5

ABEFNOPEFGHFGHIJ
DC G  Q   I    K
M  H  R   J    L
LKJI  S   K    M
D     T   L    N
C     U   M    O
BAZYXWV   N    P
E         O    Q
D         P    R
C         Q    S
BAZYXWVUTSR    T
R              U
Q              V
P              W
O              X
NMLKJIHGFEDCBAZY

------

6

ABEFNOPEFGHFGHIJSTUVWX
DC G  Q   I    K     Y
M  H  R   J    L     Z
LKJI  S   K    M     A
D     T   L    N     B
C     U   M    O     C
BAZYXWV   N    P     D
E         O    Q     E
D         P    R     F
C         Q    S     G
BAZYXWVUTSR    T     H
R              U     I
Q              V     J
P              W     K
O              X     L
NMLKJIHGFEDCBAZY     M
S                    N
R                    O
Q                    P
P                    Q
O                    R
NMLKJIHGFEDCBAZYXWVUTS

The testcases should be n=1,2,3,5,6, I think.

Charcoal, 31 bytes
Ｆ⮌…⁰ＮＢ⁺²⊘×ι⁺³ι⭆α§α⁺λ÷×ι⊕×ι⁺⁹⊗ι⁶

Try it online! Link is to verbose version of code. Note: The deverbosifier outputs a trailing separator for some reason. Explanation:
Ｆ⮌…⁰ＮＢ

Draw boxes in reverse order of size (largest to smallest).
⁺²⊘×ι⁺³ι

Calculate the size of the box.
⭆α§α⁺λ

Draw the border of the box using a rotated alphabet.
÷×ι⊕×ι⁺⁹⊗ι⁶

Calculate the letter that would appear at the top left of the box (0-indexed).

Python 2, 176 bytes
n=input()
k=n*-~n/2+1
a=eval(`[[' ']*k]*k`)
x=y=z=0
for s in range(4*n+4):exec s/4*(s/4+1)/2*"if'!'>a[y][x]:a[y][x]=chr(z%26+65);z+=1\nx+=abs(2-s%4)-1;y+=s%2-s%4/3*2\n"
print a

Try it online!
Explanation
We construct an empty array of spaces of the right size, then move over it like this, starting in the top-left corner:

1 step →, 1 step ↓, 1 step ←, 1 step ↑
3 steps →, 3 steps ↓, 3 steps ←, 3 steps ↑
6 steps →, 6 steps ↓, 6 steps ←, 6 steps ↑
10 steps →, 10 steps ↓, 10 steps ←, 10 steps ↑
…

Every time we find a blank cell, we put a letter there and cycle to the next letter in the alphabet.
In the code, s%4 is the direction (→↓←↑), and we step this many times:
TriangularNumber(s/4) = s/4*(s/4+1)/2.

Golf opportunities

Is there a shorter way to map s%4 to 1,0,-1,0 than abs(2-s%4)-1?
Is there a shorter way to map s%4 to 0,1,0,-1 than s%2-s%4/3*2?

Credits

Mr. Xcoder saved a byte.

+1 Wow, this is just brilliant. Took me a while to figure out how it works. I found a shorthand for 21/(s%4+3)%3-1: s%2-2*(s%4>2) (179 bytes). It might still be golfable though

C,  305  281 bytes
Thanks to @Mr. Xcoder for saving four bytes!
#define L(x,y)l[x][y]=a++%26+65;
#define F for(
c,i,j,a,p;f(n){char**l=calloc(8,i=a=n*n*4);F;i--;memset(l[i],32,a))l[i]=malloc(a);F c=a=p=i=0;c<n;++c){F i=p;i<c+p+!c;)L(j=0,c+i++)F p=i;j<=-~c*(c+2)/2;)L(j++,c+i)F;c+i-1;)L(j-1,c+--i)F i=0;i<=c;)L(j+~i++,0)}F i=0;i<j;)puts(l[i++]);}

Try it online!

First time I see a #define for for( (that actually saves bytes). +1 from me. :)

Python 2, 262 260 254 245 bytes
lambda n:[[[' ',chr(65+(4*(i<j)+sum((i<j)*8+2+I*[5,9][i<j]+sum(2*R(I))for I in R(S(i,j)-1))+[i+j,-i-j][i<j])%26)][max(i,j)==S(i,j)*-~S(i,j)/2or i*j<1]for i in R(1+n*-~n/2)]for j in R(1+n*-~n/2)]
R=range
S=lambda x,y:int((8*max(x,y)+1)**.5+.99)/2

Try it online!
New method with more maths!
Returns a list of char-lists.

Old version:
Python 2, 322 321 308 298 bytes
R=range
n=input()
w=1+n*-~n/2;r=[w*[' ']for _ in R(w)];r[0][0]='A';l=R(1,w*w*9);c=lambda:chr(65+l.pop(0)%26)
for i in R(n+1):
 w=1+i*-~i/2;W=w-i
 for x in R(W,w):r[0][x]=c()
 for y in R(1,w):r[y][w-1]=c()
 for x in R(1,w):r[w-1][w+~x]=c()
 for x in R(1,w-W):r[w+~x][0]=c()
for l in r:print`l`[2::5]

Try it online!

@Mr.Xcoder Isn't just .49 sufficient enough in that case, or does it fail for very big inputs?

@KevinCruijssen Not sure, but this works for sure, 260 bytes.

I don't know Python that well, but is it possible to make an inline-variable for i<j, since you are using it four times?

245 bytes by golfing +1==1+ from my previous method

Perl 5, 177 +2 (-nl) = 179 bytes
2 bytes saved thanks to Xcali
sub n{chr 65+$c++%26}@O=(n);while($,++<$_){$_.=$"x$,for@O;push@O,($"x length$O[0])x$,;$O[0]=~s/ /n/eg;s/ $/n/e for@O;1while$O[-1]=~s/.*\K /n/e;s/^ /n/e for reverse@O}print for@O

Try it online

You can save a byte by using -1 instead of $#O.  Also using $, instead of $n will let you remove the space before for in $_.=$"x$n for@O

thank you, i was looking for other improvements but could not find for the moment

saved 2 more bytes changing regex s/ (?=\S)/n/e to s/.*\K /n/e

APL (Dyalog Classic), 47 bytes
(⎕a⍴⍨≢i)@i⍴∘''⊃⌈/i←∪+\↓1⍪⊃⍪⌿(+\⍳⎕)⌿¨⊂⍪∘-⍨∘.≠⍨⍳2

Try it online!


text:
The leading zeroes challenge
The challenge
Given two integers as input (x and y), output x as a string with as many leading zeroes necessary for it to be y characters long without the sign.
Rules

If x has more than y digits, output x as string without modification.
Output as integer is not accepted, even if there are no leading zeroes.
When x is negative, keep the - as is and operate on the absolute value.
Negative y should be treated as 0, meaning you output x as is (but as string)

Examples:
IN: (1,1)   OUT: "1"
IN: (1,2)   OUT: "01"
IN: (10,1)  OUT: "10"
IN: (-7,3)  OUT: "-007"
IN: (-1,1)  OUT: "-1"
IN: (10,-1) OUT: "10"
IN: (0,0)   OUT: "0"
IN: (0,1)   OUT: "0"
IN: (0,4)   OUT: "0000"

Shortest code in bytes wins, standard loopholes apply.

sandbox: https://codegolf.meta.stackexchange.com/a/14264/69737

Can I take x as string?

what does (-1,1) give?

@Adám added it to the examples.

wow this appeared on the HNQ, i'm happy my first challenge is so well received :D

Test case suggestion: -5, -4

codegolf questions with snazzy titles almost aways do hit the HNQ. But it is a very good feeling, congrats.

Is a leading + sign acceptable for positive numbers?

Most answers are based on printf if you change it they would all get better.

Japt, 13 8 bytes
Takes first input (x) as a string.
®©ùTV}'-

Try it
Saved a massive 5 bytes thanks to ETHproductions.

Explanation
Implicit input of string U=x and integer V=y.
®   }'- splits U to an array on the minus symbol, maps over it and rejoins it to a string with a minus symbol.
© is logical AND (&&) so if the current element is truthy (a non-empty string) then pad left (ù) with 0 (T) to length V.

Nice one! You can save quite a bit by simply mapping around -: https://ethproductions.github.io/japt/?v=1.4.5&code=rqn5VFZ9Jy0=&input=Ii04Iiw4

@ETHproductions: Great call. Thanks. Been so long since I've done so, I'd completely forgotten you can split, map and rejoin a string all in one method!

Yes, I suppose that functionality should be moved to q, which would then be q-_©ùTV to save 1 byte :-)

@ETHproductions, if I'm understanding that right, you're suggesting that if a function is passed as a second argument of S.q() (giving us S.q(s,f)) then S would be split on s, run through f and rejoined with s? I like it! :)

Yeah, did I talk to Oliver and not you about doing that (if passed a function, do the normal functionality, run through the function, and undo the first change; N.s, S/A.y, N.ì do this already) with a bunch of methods? I had a conversation with someone, I just can't remember who now :s

Pyth, 12 bytes
%"%0*d",+E>0

Try it here!

Python 2, 29 bytes
lambda x,y:x.zfill(y+(x<'.'))

Try it online!
Just str.zfill comes so close.

Python, 29 bytes
Take input as f(x,y). Using Python's % operator.
lambda x,y:'%0*d'%(y+(x<0),x)

Try it online!

05AB1E, 11 10 bytes
Input given as amount_of_digits, number
ÎIÄg-×ì'-†

Try it online!
Explanation
Î            # push 0 and first input
 IÄ          # push the absolute value of the second input
   g         # length
    -        # subtract, (input1-len(abs(input2))
     ×       # repeat the zero that many times
      ì      # prepend to the second input
       '-†   # move any "-" to the front

Seems like this is the winning answer so far, if not bettered tomorrow i'll accept it.

you've been outgolfed :(

@BrianH. Indeed I have :)

C#, 56 bytes
Try it Online!
a=>b=>(a<0?"-":"")+((a<0?-a:a)+"").PadLeft(b<0?0:b,'0')

Python 3.6, 28 37 bytes
lambda x,y:f'{x:0{(y,0)[y<0]+(x<0)}}'

Try it online! (Test case from Colera Su's answer)
Taking advantage of the new way to format strings in python 3.6
+9 bytes to handle y<0

Looks like this fails when y is negative: https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUaFCp9IqTb26wsqgulJbo8LGQLO2Vv1/QVFmXolGmoahgY6uoabmfwA

Indeed. So i'm up with 37 bytes.

Java (OpenJDK 8), 47 bytes
x->y->"".format("%0"+((y<1?1:y)-(x>>31))+"d",x)

Try it online!
At first I thought, easy, 30 chars max (which is quite short when manipulating strings in Java). Then the exceptions happened.

JavaScript (ES6), 42
Recursive, parameters in reverse order, first y then x. And Currying
y=>r=x=>x<0?'-'+r(-x):`${x}`.padStart(y,0)

Test

var F=
y=>r=x=>x<0?'-'+r(-x):`${x}`.padStart(y,0)

;`IN: (1,1)   OUT: "1"
IN: (1,2)   OUT: "01"
IN: (10,1)  OUT: "10"
IN: (-7,3)  OUT: "-007"
IN: (-1,1)  OUT: "-1"
IN: (10,-1) OUT: "10"
IN: (0,0)   OUT: "0"
IN: (0,1)   OUT: "0"
IN: (0,4)   OUT: "0000"`
.split(`\n`).map(r => r.match(/[-\d]+/g))
.forEach(([x,y,k])=>{
  o = F(y)(x)
  ok = o == k
  console.log(ok?'OK':'KO',x,y,'->', o)
})

While impressive, I feel this answer skirts the rules slightly by defining the function f(y)(x) instead of f(x,y).

Reading up on the "currying" rules, I wanted to add that my objection was more with the reversed params and not with the currying itself.

@styletron the order of the parameters is not specified in the challenge. So I can take advantage of this

Dang, y=>r=x=>x<0?'-'+r(-x):(x+='')[y-1]?x:r(0+x) comes so close...

i have no issues with people reversing the input order.

bash, 27, 25 bytes
-2 bytes thanks to Bruce Forte
printf %0$[$2+($1<0)]d $1

try it online

You can save two bytes by inlining the padding length. Also another interesting one (28 bytes): printf %\ 0$[1+$1]d $2|xargs.

maybe you mean printf %\ 0$[1+$2]d $1|xargs, i didn't remember this format for signed numbers also xargs trick to remove leading space

R, 56 48 bytes
function(x,y)sprintf(paste0("%0",y+(x<0),"d"),x)

Try it online!
-8 bytes thanks to djhurio
Explanation

sprintf("%0zd",x) returns x as a string padded with zeros to be of length z
paste0("%0",y+(x<0),"d") constructs the string "%0zd", where z is y, plus 1 if x is less than zero
If z is less than the number of digits in x, x is printed as a string as is

48 bytes function(x,y)sprintf(paste0("%0",y+(x<0),"d"),x)

@djhurio brilliant! I think that would warrant another answer rather than an edit of mine, what do you say?

You can make it as an edit. This solution is not so much different, just using different function.

Husk, 12 bytes
Ö±Ωo≥⁰#±:'0s

Try it online!
Explanation
Ö±Ωo≥⁰#±:'0s  Inputs are y=4 and x=-20
           s  Convert x to string: "-20"
        :'0   Prepend '0'
  Ω           until
      #±      the number of digits
   o≥⁰        is at least y: "00-20"
Ö±            Sort by is-digit: "-0020"
              Print implicitly.

Retina, 39 bytes
\d+$
$*0
((\d)*),(?<-2>-0+|0)*(0*)
$3$1

Try it online!
Input should be comma-separated with the number first and the width second.

Alice, 23 bytes
/oRe./'+Ao
\I*tI&0-R$@/

Try it online!
Input should be linefeed-separated with the number on the first line and the width on the second.
Explanation
/...
\...@/

This is the usual framework for linear programs in Ordinal mode. The only catch in this case is this bit:
.../...
...&...

This causes the IP to enter Cardinal mode vertically and execute just the & in Cardinal mode before resuming in Ordinal mode.
Unfolding the zigzag control flow then gives:
IRt.&'-A$o*eI/&/0+Ro@

I    Read the first line of input (the value) as a string.
R    Reverse the string.
t.   Split off the last character and duplicate it.
&    Fold the next command over this string. This doesn't really do anything,
     because the string contains only one character (so folding the next
     command is identical to executing it normally).
'-   Push "-".
A    Set intersection. Gives "-" for negative inputs and "" otherwise.
$o   If it's "-", print it, otherwise it must have been a digit which we
     leave on the stack.
*    Join the digit back onto the number. If the number was negative, this
     joins the (absolute value of the) number to an implicit empty string,
     doing nothing.
e    Push an empty string.
I    Read the width W.
/&/  Iterate the next command W times.
0    Append a zero. So we get a string of W zeros on top of the absolute
     value of the input number.
+    Superimpose. This takes the character-wise maximum of both strings
     and appends extraneous characters from the longer string. Since the
     string of zeros can never be larger than the digits in the input,
     the input itself will be uneffected, but extraneous zeros are appended,
     padding the string to the required length.
R    Reverse the result.
o    Print it.
@    Terminate the program.

Here are two alternatives, also at 23 bytes, which use Cardinal H (abs) to get rid of the -:
/R.I&0-RoH
\Ie#\'+Ao\@/

/R.H#/.+Xo
\Ie\I&0QRo@/

In principle, these are a command shorter, but the & doesn't fit into a position where there's a 1-character string on the stack, so we need to skip it with a #.

Charcoal, 16 13 bytes
‹Ｎ⁰﹪⁺⁺%0ηd↔Ｉθ

Try it online!
This is the shortest I could get using Charcoal without printing leading or trailing whitespaces. At least I am now starting to understand how to use the Modulo function to format strings.
The deverbosed code is as follows:
Print(Less(InputNumber(),0));    # Prints a - if the first input is less than 0
Print(Modulo(Add(Add("%0",h),"d"),Abs(Cast(q))));   # q: first input;  h: second input

3 bytes saved thanks to Neil!

To print - or nothing is really easy in Charcoal: Printing 1 prints - while printing 0 prints nothing. So, the ternary is superfluous, saving 3 bytes.

If you swap the InputNumber() with the Cast(q), I think you can then switch to a string comparison to save another byte.

@Neil I knew that I could simplify the Ternary!

PHP, 45 bytes
printf("%0".($argv[2]+(0>$n=$argv[1])).d,$n);

or
[,$n,$e]=$argv;printf("%0".($e+(0>$n)).d,$n);       # requires PHP 7.1 or later

Run with -nr or try them online.

Getting an error when executing the code in that link.

@Shaggy The second version requires PHP 7.1

I went on and on about this, and I arrived to exactly this answer. I believe this is the optimal version

C, 33 bytes
f(x,y){printf("%0*d",y+(x<0),x);}

Try it online!

Mathematica, 118 bytes
(j=ToString;If[#2<=0,j@#,If[(z=IntegerLength@#)>=#2,t=z,t=#2];s=j/@PadLeft[IntegerDigits@#,t];If[#>=0,""<>s,"-"<>s]])&

Try it online!

Mathematica, 63 62 bytes
If[#<0,"-",""]<>IntegerString[#,10,Max[#2,IntegerLength@#,1]]&

Try it online!

Welcome to PPCG! I think this isn't quite doing what you want. You probably meant IntegerLength instead of IntegerDigits. You can save a byte by using IntegerLength@# instead of IntegerLength[#] though.

Thank you! I was copying the code from another computer by hand where I was testing it and I indeed mistyped IntegerDigits for IntegerLength. It should work now. I have also added a TIO link with all the test cases in the challenge description (+1) showing that it works as expected. Thank you also for the suggestion for saving an extra byte! I don't know how I missed it before. :)

Haskell, 54 bytes
x#y|s<-show$abs$x=['-'|x<0]++('0'<$[length s+1..y])++s

Try it online!

Excel, 29 bytes
Using Excel's TEXT functionality ("Converts a value to text in a specific number format").
x in A1, y in B1
=TEXT(A1,REPT("0",MAX(1,B1)))

You can drop the ))) for -3 Bytes by converting to Google Sheets

Octave, 44 bytes
@(x,y)fprintf(['%0',num2str(y+(x<0)),'d'],x)

Try it online!

For 31 bytes

If leading + signs are allowed for positive numbers (waiting to hear from op if ok), this works for 28.

Japt, 14 12 bytes
Saved 2 bytes thanks to @ETHproductions
s r"%d+"_ù0V

Try it online

It's a bit cheaper to keep the minus sign in and just mess with the digits: Test it online

@ETHproductions: Or take x as a string for 10 bytes.

@ETHproductions thanks fellas. I'll update it when I get back to my desk.

@Shaggy Looks like you posted your own answer, so I'll use ETHproduction's trick. Thanks though.

Oliver, that 10-byter is just @ETHproduction's 12-byte solution upgraded to Japt 2.0a0 with U as a string allowing us to golf off the first 2 characters.

Ruby, 31 28 bytes
Thanks Carl for saving 3 bytes using interpolation.
->x,y{"%0#{y+(x<0?1:0)}d"%x}

Try it online!

28: ->x,y{"%0#{y+(x<0?1:0)}d"%x}

PowerShell, 25 40 bytes
param($a,$b)$a|% *g $("D$b"*($b|% *o 0))

Try it online!
Explanation
This calls .ToString() on the number with a generated format string, but multiplies it by -1, 0, or 1 based on whether $b (y) is negative, 0, or positive respectively; this is to handle negative y values which format strings don't by themselves.
This seems to require wrapping negative numbers in a substatement () for it to work which is just a quirk of the invocation when using literals; if passed variables of type integer, it would not need that.

It looks like both of these fail when y is negative.

@Shaggy ugh good catch. Removed second solution altogether and fixed up the first, thanks!

Ouch, 15 bytes! Sorry!

@Shaggy heh, one of these days I'll actually write the PowerShell-based golfing language I've been thinking about. This actually pushed me to research a bit more and get closer to starting it, so thanks for that ;)

C# 6.0, 35 bytes
(x,y)=>(x.ToString($"D{y<0?0:y}"));

Alternative solution (51 bytes)
(x,y)=>(x.ToString(string.Format("D{0}",y<0?0:y)));

Clean, 90 86 83 bytes
import StdEnv
@x y=if(y<0)"-"""+++{if(c>'-')c'0'\\c<-rjustify x[k\\k<-:toString y]}

Try it online!

Perl 5, 22 + 1 (-n) = 23 bytes
printf"%0*d",<>+/-/,$_

Try it online

Loops infinitely on 10,-1

fixed +5 bytes

found another solution -5 bytes

Sweet. I'm working on one as well... stay tuned

I managed it in 26 bytes

your comment just appeared, while I found also a similar solution, indeed the newline is not necessary -> 23 bytes

Stacked, 30 bytes
[@x'@:'!'\d+'['0'x pad]1/repl]

Try it online!
Highlighted:

Explanation
[@x'@:'!'\d+'['0'x pad]1/repl]
[                            ]   anonymous function, take two args: (y x)
 @x                              name pad length argument
   '@:'!                         convert to string*
        '\d+'[        ]1/repl    replace all runs of digits with...
              '0'x pad              ...the digits padded to x '0's

Stringification
Usually, one would use tostr to convert something to a string; however, due to the way string formatting works...
'@:'!
    !   format the string
'@:'    apply the `:` function t the top of the stack
        this creates a sub-stack, and : duplicates.
        the formatting obtains the top value, which is just the original TOS,
        and casts it to a string

The reason we use '@:'! instead of tostr is to avoid the space between @x and tostr.

C (gcc), 45 bytes
f(x,y){printf("%s%0*i","-"+(x>=0),y,abs(x));}

Try it online!
Explanation
printf formats three arguments:
%s      ->    "-"+(x>=0)
%0*i    ->    y
        ->    abs(x)

%s formats the string "-"+(x>=0). "-" is really just an address, something like 41961441. In memory, this looks something like this:
MEMORY ADDRESS | 41961441  41961442 ...
VALUE          | 45 ('-')  0 (0x00) ...

When formatted into a string, C takes the address (say 41961441) and keeps on acquiring characters until a null byte (0x00) is met. When x is less than zero, the value "-"+(x>=0) has that of the original address (41961441). Otherwise, x>=0 is 1, so the expression becomes "-"+1, which points the null byte after "-", which prints nothing.
%0*i prints an integer padded with a specified number of 0s. y denotes this number. We pad abs(x) to avoid the negative in some arguments.

Perl, 25 + -n flag = 26 bytes
printf"%0*d",<>+($_<0),$_

Try it online!

Perl 6,  39 31  30 bytes
->\a,\b{'-'x(0>a)~a.abs.fmt("\%0{b}d")}

Test it
->\a,\b{a.fmt("\%0{b+(0>a)}d")}

Test it
{$^a.fmt: '%0'~$^b+(0>$a)~'d'}

Test it
Expanded:
{  # bare block lambda with placeholder parameters ｢$a｣ and ｢$b｣

  $^a         # declare and use first parameter
  .fmt:       # format it

  '%0'        # '%05d'
  ~
    $^b       # make it ｢$b｣ digits wide
    + (0>$a)  # add 1 if ｢$a｣ is negative
  ~
 'd'
}

PHP, 49 bytes
echo str_pad($argv[1],$argv[2],'0',STR_PAD_LEFT);

Instead of STR_PAD_LEFT, you can use 0. Also, this fails for -7,3 (returns 0-7 instead of -007).

Husk, 18 bytes
Likely not the right approach, this is feels really long for Husk, but there wasn't one already.
F+Ṁ+R'0-Ld⁰¹↕='-s⁰

Try it online!

Pip, 13 bytes
aR+XD0Xb-#_._

Takes the number and minimum number of digits as command-line arguments. Try it online!
Explanation
               a, b are cmdline args; XD is regex `\d` (implicit)
aR             In the number a, replace
  +XD           a run of digits (regex `\d+`)
                with this callback function:
     0X          0 string-multiplied by
       b-#_      minimum digit count minus length of match
           ._    to which concatenate the match itself
               Autoprint the result of the replacement

Since string-multiplication gives an empty string when the right operand is negative, this works correctly for all test cases.

Jelly, 20 bytes
0;$L<⁹$$¿
ṣ”-Ç€0¦j”-

Try it online!
Take first input x as a string.
Apparently there is no existing Jelly answer...
L<¥ doesn't seem to work.

SNOBOL4 (CSNOBOL4), 95 89 bytes
	DEFINE('F(X,B)')
F	L =GT(B) B
	N =LT(X) 1
	F =DUPL('-',N) LPAD(-1 ^ N * X,L,0)	:(RETURN)

Try it online!
defining a function is equivalent to a full program in bytes, so I figured I'd do this instead.

Thunno 2 j, 9 bytes
AṘṛ$ʂṄ'-×

Try it online!
Explanation
AṘṛ$ʂṄ'-×  '# Implicit input
AṘ          # Take the absolute value and convert to string
  ṛ         # Pad with zeros to length of second input
   $ʂṄ      # Check if the first input was negative
      '-×  '# If it was, push a "-"
            # Implicit output of joined stack

Vyxal, 70 bitsv2, 8.75 bytes
ȧS∆Z¹±SṪp

Try it Online!
Bitstring:
1001110000000100000100010000100111100010101011011000110001011000011111

Idk why Vyxal 2 doesnt have an "is negative?" element but i found a way around that

Tcl, 46 bytes
proc Z n\ p {format %0[expr $n<0?$p+1:$p]d $n}

Try it online!

Swift, 37 bytes (65 inside a function):
String(format:"%0\(y+(x<0 ?1:0))d",x)

Inside a function:
func c(x:Int,y:Int){print(String(format:"%0\(y+(x<0 ?1:0))d",x))}

Java, 218 bytes
 import org.apache.commons.lang3.StringUtils;interface B{static void main(String z[]){int x=Integer.parseInt(z[1]);if(x>z[0].length()){System.out.printf(StringUtils.leftPad(z[0],x,"0"));}else{System.out.printf(z[0]);}}}

Ungolfed:
import org.apache.commons.lang3.StringUtils;

interface B {
   static void main(String z[]) {
      int x = Integer.parseInt(z[1]);
      if (x > z[0].length()) {
        System.out.printf(StringUtils.leftPad(z[0], x, "0"));
      } else {
        System.out.printf(z[0]);
      }
  }
}

Sinclair ZX81/Timex TS1000/1500 BASIC, ~163 tokenized BASIC bytes
 1 DIM A(SGN PI,VAL "2")
 2 LET A(SGN PI,SGN PI)=NOT PI
 3 LET A(SGN PI,VAL "2")=INT PI
 4 IF A(SGN PI,SGN PI)<NOT PI THEN PRINT "-";
 5 IF A(SGN PI,VAL "2")=SGN PI THEN GOTO INT PI*PI
 6 FOR I=VAL "2" TO A(SGN PI,VAL "2")
 7 PRINT NOT PI;
 8 NEXT I
 9 PRINT ABS A(SGN PI,SGN PI)

Explanations: ZX81 BASIC is quite costly when storing numbers as each number is stored as a 5 byte (I think) floating point number even if you store an integer value like 1. Even line numbers cost 5 bytes per line, then add in the NEW LINE character at the end of each line, and the lowest byte count for a BASIC line in Sinclair ZX81 BASIC is 7 (for instance, 1 PRINT). SGN PI is 1, and costs fewer bytes than 1 on this basis, NOT PI is 0 and costs two bytes etc.

Line 1 sets up a numeric array 1, 2; arrays are not zero-indexed in this case.
Line 2 sets A[1, 1] to zero.
Line 3 sets A[1, 2] to 3, so the test case is (1,3).
Line 4 tests to see if the number to be printed is negative; if so, a minus sign is displayed.
Line 5 checks if the padding is set to 1, if so we don't need to print any leading zeros.
Line 6 then loops through from 2 to the value of our padding (in this case, 3).
Line 7 prints the leading zeros.
Line 8 ends the loop.
Line 9 prints the positive value of our A[1,1], which in this case is zero.

Jelly, 18 bytes
R¬+Ṛ}AṚṾ€”-x⁴<0¤¤;

Try it online!
Takes y and x (in that order) as integers.
Explanation
Example input 5 and -123.
R¬+Ṛ}AṚṾ€”-x⁴<0¤¤;  Dyadic link
R¬                  Not the range of y. This gives a list of y zeroes. [0,0,0,0,0]
   Ṛ}               Reverse the digits of x. [-3,-2,-1]
  +                 Add these lists. [-3,-2,-1,0,0]
     A              Absolute value. [3,2,1,0,0].
      Ṛ             Reverse. [0,0,1,2,3]
       Ṿ€           Make each digit a string. '00123'
         ”-         The character '-'.
            ⁴<0     x<0? 0 or 1. (1 in this example)
           x        Repeat '-' 0 or 1 times
               ¤¤   Closes ”-x⁴<0 as a nilad
                 ;  Prepend '-' to '00123'

The absolute difference atom ạ would work here over + making A unnecessary except for the case where y is zero or negative where it doesn't work.

Excel VBA, 33 Bytes
Anonymous VBE immediate window function that takes input as n from [A1] and length from [B1] and outputs the appropriately formatted string to the VBE immediate window
?Format([A1],[Rept(0,Max(1,B1))])

Gema, 40 characters
<y><D>,<N>=$1@subst{\\ =0;@right{$3;$2}}

(Not really for Gema. For some weird reason it can only pad with spaces.)
Sample run:
bash-5.2$ gema '<y><D>,<N>=$1@subst{\\ =0;@right{$3;$2}}' <<< '-7,3'
-007

Try it online! / Try all test cases online!


text:
Advent Challenge 1: Help Santa unlock his present vault!
Next >>
Descriptive Keywords (for searching): Make Two Matrices Equivalent, Overlap, Array, Find
Challenge
Santa has had a history of elves stealing presents from his vault in the past, so this year he designed a lock that is very hard to crack, and it seems to have kept the elves out this year. Unfortunately, he has lost the combination and he can't figure out how to open it either! Fortunately, he has hired you to write a program to find the combination. It doesn't need to be the shortest one, but he needs to find it as fast as possible!
He has a very strict schedule and he can't afford to wait for very long. Your score will be the total run-time of your program multiplied by the number of steps your program outputs for the scoring input. Lowest score wins.
Specifications
The lock is a square matrix of 1s and 0s. It is set to a random arrangement of 1s and 0s and needs to be set to a specified code. Fortunately, Santa remembers the required code.
There are a few steps he can perform. Each step can be performed on any contiguous sub-matrix (that is, you must select a sub-matrix that is entirely bounded by a top-left and bottom-right corner) (it can be a non-square sub-matrix):

Rotate right 90 degrees*
Rotate left 90 degrees*
Rotate 180 degrees
Cycle each row n elements right or left (wraps)
Cycle each column m elements up or down (wraps)
Flip Horizontally
Flip Vertically
Flip on the Main Diagonal*
Flip on the Main Anti-diagonal*

*only if the sub-matrix is square
Of course, he can also perform these steps on the entire matrix. Since 1s and 0s can only be swapped on the matrix but the value of a square cannot be directly changed, the number of 1s and 0s is the same for the start and end configuration.
Formatting Specifications + Rules
You will be given the input as two square matrices (starting position and ending position) in any reasonable format you want. The output should be a sequence of these steps in any readable format. Since this isn't code-golf, please make it an easily verifiable format, but that's not a strict requirement. You can choose to take the side-length of the matrices in the input if you want.
Your program will be run on my computer (Linux Mint, exact version details available upon request if anyone cares :P) and I will time it based on the amount of time between the time I press "enter" on the command line and when the command exits.
Test Cases
1 0 0 1    0 0 0 0
0 1 1 0 -> 0 0 0 0
0 1 1 0 -> 1 1 1 1
1 0 0 1    1 1 1 1

Take the entire matrix. Cycle each column up 1.
Take the middle two columns as a sub-matrix. Cycle each column down 2.

1 0 1 0 1    0 1 0 1 0
0 1 0 1 0    1 0 1 0 1
1 0 1 0 1 -> 0 1 1 1 0
0 1 0 1 0    1 0 1 0 1
1 0 1 0 1    0 1 0 1 0

Take the entire matrix. Cycle each column down 1.
Take the middle column. Cycle it down 2.
Take the top 2 rows. Flip it vertically.
Take the top row's rightmost 2 elements. Swap them (rotate right/left 1, flip horizontally).
Take the top row's leftmost 2 elements. Swap them.

There might be more efficient methods, but that doesn't matter. Feel free to point them out in the comments if you find one though :)
Judging Test Case
This test case will be used to judge your submission. If I believe that an answer is specializing for the test case too much, I have the right to repick a random input and rejudge all answers with the new case. The test case can be found here where the top is the start and the bottom is the desired configuration.
If I believe answers are specializing too much, the MD5 of the next test case is 3c1007ebd4ea7f0a2a1f0254af204eed. (This is written here right now to liberate myself from accusations of cheating :P)
Standard Loopholes Apply. No answer will be accepted. Happy coding!
Note: I drew inspiration for this challenge series from Advent Of Code. I have no affiliation with this site
You can see a list of all challenges in the series by looking at the 'Linked' section of the first challenge here.

Information: The test case has 192 0's and 64 1's, and there are total 256 choose 64 ≈ 1.9 × 10⁶¹ reachable matrices. (which is comparable to a Megaminx, and is larger than a Rubik's Revenge, although much less than a Professor's cube)

Java
import java.util.Arrays;

public class SantaMatrix4 {

	public static void flipV(int[][] matrix, int row1, int col1, int row2, int col2) {
		for (int row = row1; row <= (row2 - row1) / 2 + row1; row++) {
			for (int col = col1; col <= col2; col++) {
				int tmp = matrix[row][col];
				matrix[row][col] = matrix[row2 - row + row1][col];
				matrix[row2 - row + row1][col] = tmp;
			}
		}
	}

	public static void flipH(int[][] matrix, int row1, int col1, int row2, int col2) {
		for (int row = row1; row <= row2; row++) {
			for (int col = col1; col <= (col2 - col1) / 2 + col1; col++) {
				int tmp = matrix[row][col];
				matrix[row][col] = matrix[row][col2 - col + col1];
				matrix[row][col2 - col + col1] = tmp;
			}
		}
	}

	public static void main(String[] args) {
		int counter = 0;
		int n = Integer.parseInt(args[counter++]);
		int[][] matrix1 = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				matrix1[i][j] = Integer.parseInt(args[counter++]);
			}
		}

		int[][] matrix2 = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				matrix2[i][j] = Integer.parseInt(args[counter++]);
			}
		}

		int[] ops = new int[5 * matrix1.length * matrix1.length * 2];
		int numOps = 0;
		int opsI = 0;

		for (int row = 0; row < n; row++) {
			for (int col = 0; col < n; col++) {
				int goal = matrix2[row][col];
				boolean gotIt = false;

				//Look for required number to the right
				for (int i = row; i < n && !gotIt; i++) {
					for (int j = col; j < n && !gotIt; j++) {
						if (i == row && j == col) continue;
						if (matrix1[i][j] == goal) {
							flipH(matrix1, row, col, i, j);
							flipV(matrix1, row, col, i, j);
							ops[opsI++] = 1;
							ops[opsI++] = row;
							ops[opsI++] = col;
							ops[opsI++] = i;
							ops[opsI++] = j;
							numOps++;

							gotIt = true;
						}
					}
				}

				//Look for required number below and to the left
				for (int i = row + 1; i < n && !gotIt; i++) {
					for (int j = 0; j < col && !gotIt; j++) {
						if (matrix1[i][j] == goal) {
							flipH(matrix1, i, j, i, col);
							ops[opsI++] = 2;
							ops[opsI++] = i;
							ops[opsI++] = j;
							ops[opsI++] = i;
							ops[opsI++] = col;

							flipV(matrix1, row, col, i, col);
							ops[opsI++] = 3;
							ops[opsI++] = row;
							ops[opsI++] = col;
							ops[opsI++] = i;
							ops[opsI++] = col;

							numOps += 2;
							gotIt = true;
						}
					}
				}

			}
		}

		System.out.println(Arrays.toString(ops));
		System.out.println(numOps);
	}
}

Slightly faster hard-coded version: Try it online!
Input is space separated integers via the command line. The first integer is the width of the two matrices. The remaining integers are their elements, row-by-row.
Every permutation of a matrix can be obtained with just the horizontal flip and vertical flip operators, so I ignored the rest except for replacing a consecutive vFlip and hFlip in the same region with a rotation by 180 degrees.
The program scans through each element. Whenever we encounter an element that has the wrong bit, it looks further ahead through the array to find a spot that has the correct bit. I've divided the search region in two: those with an equal or larger column coordinate, and those with a smaller column coordinate. Note that the latter must have a larger row coordinate based on the way we're traversing the array. If we find a correct bit in the first search region, we can just rotate by 180 degrees the sub-matrix spanning the two elements for a total of one operation. If it's in the second region, we can use a horizontal flip to move the correct bit to the same column as the wrong bit and then vertically flip the sub-matrix spanning the two for a total of two operations.
The output of the program is an array that should be mentally split into groups of five. Each group is (i, row1, col1, row2, col2) where i is 0 for a no-op, 1 for a rotation by 180 degrees, 2 for a horizontal flip, and 3 for a vertical flip. The remaining 4 components describe the region over which the operation runs. I am not sure if this is a readable format.
For the given test case, I get 258 operations and two to three milliseconds on my computer.

@Erik the Outgolfer It was not specified, and hard-coding it makes it easier to judge.

I have changed it to take input from the command line

This output format is reasonable enough. I'm getting 1000 numbers in the array though (200 operations?) so where is the 258 coming from? I'm slightly confused as to how to read the output from this :P

When I run it, I get a length of 1290 (until the no-ops start), which is five times the number of operations. The 258 is just the number of operations.