[Question]
  [
# Challenge
Given an integer `n` (where `4<=n<=10**6`) as input create an ASCII art "prison door"\* measuring `n-1` characters wide and `n` characters high, using the symbols from the example below.
---
## Example
```
╔╦╗
╠╬╣
╠╬╣
╚╩╝
```
The characters used are as follows:
```
┌───────────────┬─────────┬───────┐
│ Position      │ Symbol  │ Char  │
├───────────────┼─────────┼───────┤
│ Top Left      │    ╔    │ 9556  │
├───────────────┼─────────┼───────┤
│ Top           │    ╦    │ 9574  │
├───────────────┼─────────┼───────┤
│ Top Right     │    ╗    │ 9559  │
├───────────────┼─────────┼───────┤
│ Right         │    ╣    │ 9571  │
├───────────────┼─────────┼───────┤
│ Bottom Right  │    ╝    │ 9565  │
├───────────────┼─────────┼───────┤
│ Bottom        │    ╩    │ 9577  │
├───────────────┼─────────┼───────┤
│ Bottom Left   │    ╚    │ 9562  │
├───────────────┼─────────┼───────┤
│ Left          │    ╠    │ 9568  │
├───────────────┼─────────┼───────┤
│ Inner         │    ╬    │ 9580  │
└───────────────┴─────────┴───────┘
```
---
## Rules
* You may take input by any reasonable, convenient means as long as it's permitted by [standard I/O rules](https://codegolf.meta.stackexchange.com/q/2447/58974).
* For the purposes of this challenge, in languages where the symbols used to build the "door" are multi-byte characters, they may be counted towards your score as a single byte each.
* All other characters (single- or multi-byte) should be counted as normal.
* Output may not contain any trailing spaces but a trailing newline is permitted if absolutely necessary.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so lowest byte count wins.
---
## Test Cases
```
Input: 4
Output:
╔╦╗
╠╬╣
╠╬╣
╚╩╝
Input: 8
Output:
╔╦╦╦╦╦╗
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╠╬╬╬╬╬╣
╚╩╩╩╩╩╝
Input: 20
Output:
╔╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╦╗
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╠╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╣
╚╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╩╝
```
\* Yes, I'm aware that the bigger it gets the less it looks like a prison door! :D
  
[Answer]
# Java 11, ~~156~~ ~~151~~ ~~148~~ ~~118~~ 89 bytes
```
n->"╔"+"╦".repeat(n-=3)+"╗\n"+("╠"+"╬".repeat(n)+"╣\n").repeat(n+1)+"╚"+"╩".repeat(n)+"╝"
```
[Try it online.](https://tio.run/##hZBNCsIwEIX3nmLIKqG0@LcQRG9gNy7VRYxRonUsbSqIeAtFEARBEARP5UXqGIuCIEJmSN73Fu9lKpfSn45muYpkmkJHGlyXAAxanYyl0hA@nwBdmxicgOJEAEWTxA0NndRKaxSEgNCCHP02u@@2zKN9YUGiYy0tR79VE09p30fmcbqcnOP2cTh8Jizekldx4sFZr1/WI8ubrwBxNowoQJFjuTAjmFMN/orcG4AURYdVavU8WGQ2iAnZCDkGiteFq/OTN/7walkU/7HJHw)
**Old 118 bytes answer in Java 8:**
```
n->{String a="╔",b="╠",c="╚";for(int i=n;i-->3;a+="╦",b+="╬")c+="╩";a+="╗\n";for(b+="╣\n";n-->2;)a+=b;return a+c+"╝";}
```
-30 bytes by creating a port of [*@raznagul* C# (.NET Core) answer](https://codegolf.stackexchange.com/a/126882/52210), after I golfed 5 bytes.
[Try it here.](https://tio.run/##hZDBasMwDIbvewrhU0yaMLodBiZ9g/Wy49qD4rrDXaoExymUkrfoGAwGg8FgsKfai2Ry4msZ2Ejy90v88g4PmNWNod3medAVti3co6XTFYAlb9wWtYFlKAEevLP0BDphAiQVP/Z8@bQevdWwBIICBsoWp6jFQvy@nMWsDPFDzHSIb0JtazdOsQUpm2WLG4VpQF8sHZMfIfWYfIuIXlc09U2Cz1ASt86VZEGpnPGdI8BUp4zfheoHNblrurJid9HkobYb2POOyeTxcQ0o44LH1pt9Xnc@bxj5ihLKdXIrx10v8rt/@Pxaxs/qhz8)
**Explanation:**
```
n->                    // Method with integer parameter and String return-type
  "╔"                  //  The top-left corner
  +"╦"                 //  Appended with the top edge
      .repeat(n-=3)    //  Repeated input-3 times (-2 for the corners, -1 for width)
  +"╗\n"               //  Appended with the top-right corner and a newline
  +("╠"                //   The left edge
    +"╬"               //   Appended with the middle part
        .repeat(n)     //   Repeated input-3 times (-2 for edges, -1 for width)
    +"╣\n"             //   Appended with the right edge and a newline
          ).repeat(n+1)//  And repeat this entire line n-2 times (-2 for first/last rows)
  +"╚"                 //  Appended with the bottom-left corner
  +"╩"                 //  Appended with the bottom edge
      .repeat(n)       //  Repeated input-3 times
  +"╝"                 //  Appended with the bottom-right corners
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 34 - 5 = 29 bytes
```
Ａ⁻Ｎ³γＵＢ╬↓×╠γ╠¶╚×╩γ‖ＢＯγ‖ＢＯ↑⁺γ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DNzOvtFjDM6@gtMSvNDcptUhDU0fBGIjTNa25glNLnBKTs9OL8kvzUjSUHk1dowQUDSjKzCvRsHLJL8/TUQjJzE0tBkktUALpgUuDRGLyHk2dhdABV7oSpjQoNS0nNbnEqbSkJLUoLafSvyy1KCexQCNdE6eUVWiBjkJADtDN6ToKhkBD/v@3@K9b9l@3OAcA "Charcoal – Try It Online") Link is to verbose version of code. 5 byte reduction is for box drawing characters.
`ReflectOverlapOverlap(0)` should be equivalent to `ReflectMirror()` but instead Charcoal just does a `ReflectTransform()` instead, otherwise this solution would also work for `n=3`. Here's a workaround which shows what would happen for `n=3` for 38 - 5 = 33 bytes:
```
Ａ⁻Ｎ³γＵＢ╬↓×╠γ╠¶╚×╩γ¿γ‖ＢＯγ‖Ｍ‖ＢＯ↑⁺γ¹
```
Better still, if `ReflectOverlapOverlap(0)` worked, but I didn't bother supporting `n=3`, then I could do this for 31 - 4 = 27 bytes:
```
Ａ⁻Ｎ³γＵＢ╬↓×╠γ╚×╩γ‖ＢＯγ‖ＢＯ↑⁻γ¹
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~44~~ 42 bytes
[Crossed out 44 is still regular 44](https://codegolf.stackexchange.com/a/123438/26600)
```
Ａ⁺±³ＮαＡ⁺¹αω╔×α╦¦╗Ｊ⁰¦¹×ω╠
¦╚×α╩¦╝Ｍ↖↑×ω╣Ｍ↙¤╬
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWPGncd2nho8/s9685thHJ3ntt4vvPR1CmHp5/b@GjqskPLHk2d/n7PqkeNGw4tO7Tz8HSQ5AIukPAsiJKVIPbc93vWPmqb9qhtIkTFYjB/5qElj6au@f/fAgA "Charcoal – Try It Online")
[Answer]
## Haskell, 75 bytes
```
w i(a:b:c)=a:(b<$[4..i])++c
f n=concat$w(n+1)$w n<$>["╔╦╗\n","╠╬╣\n","╚╩╝"]  
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/v1whUyPRKskqWdM20UojyUYl2kRPLzNWU1s7mStNIc82OT8vObFEpVwjT9tQU6VcIc9GxS5a6dHUKY@mLns0dXpMnpIOkLfg0dQ1j6YuhvJmPZq68tHUuUqx/3MTM/MUbBVS8rkUFApKS4JLihRUFNIUTFC5pv8B "Haskell – Try It Online")
Function `w` takes an integer `i` and a list where `a` is the first, `b` the second element and `c` the rest of the list and makes a new list `a`, followed by `i-3` copies of `b`, followed by `c`. Apply `w` first on each each element of the list `["╔╦╗\n","╠╬╣\n","╚╩╝"]` and then again (with `i` increased by `1`) on the resulting list. Concatenate into a single list.
[Answer]
# Vim, 29 bytes
```
3<C-x>C╔╦╗
╠╬╣
╚╩╝<Esc>h<C-v>kkx@-Pjyy@-p
```
Since there are control characters, here's an xxd dump:
```
00000000: 3318 43e2 9594 e295 a6e2 9597 0de2 95a0  3.C.............
00000010: e295 ace2 95a3 0de2 959a e295 a9e2 959d  ................
00000020: 1b68 166b 6b78 402d 506a 7979 402d 70    .h.kkx@-Pjyy@-p
```
[Try it online!](https://tio.run/##K/v/31jC2dHJmcvXz58rIjJKOkMsO7vCQTcgq7LSQbfg/38LAA "V – Try It Online") (The V interpreter seems to have issues with exotic characters, so that link uses more mundane ones.)
## Explanation
```
3<C-x>     " Decrement the number by 3
C╔╦╗
╠╬╣
╚╩╝<Esc>   " Cut the number (goes in @- register) and enter the "template"
h<C-v>kkx  " Move to the middle column, highlight and cut it
@-P        " Paste @- copies of the cut column
jyy        " Move to the middle line and copy it
@-p        " Paste @- copies of the copied line
```
[Answer]
# GNU sed, 74 + 1 = 75 bytes
+1 byte for `-r` flag. Takes input as a unary number.
```
s/1111(1*)/╔╦\1╗\n;\1╠╬\1╣\n╚╩\1╝/
:
s/(.)1/\1\1/
t
s/;([^;\n]+)/\1\n\1/
t
```
[Try it online!](https://tio.run/##K05N@f@/WN8QCDQMtTT1H02d8mjqshjDR1Onx@RZg@gFj6auAdGLY/IeTZ31aOpKEGeuPpcVV7G@hp6moX6MYYyhPlcJkGutER1nHZMXq60JEswDC///bwgF//ILSjLz84r/6xYBAA "sed – Try It Online")
# Explanation
This is pretty simple. Suppose the input is 6 (unary 111111). The first line drops four `1`s and transforms the remaining input into this:
```
╔╦11╗
;11╠╬11╣
╚╩11╝
```
The third line, in a loop, replaces every `1` with the character preceding it. This creates our columns:
```
╔╦╦1╗
;11╠╬11╣
╚╩11╝
╔╦╦╦╗
;11╠╬11╣
╚╩11╝
...
╔╦╦╦╗
;;;╠╬╬╬╣
╚╩╩╩╝
```
Notice that this has also duplicated the `;` character. Finally, the fifth line, in a loop, replaces every `;` character with a copy of the line that follows:
```
╔╦╦╦╗
;;╠╬╬╬╣
╠╬╬╬╣
╚╩╩╩╝
╔╦╦╦╗
;╠╬╬╬╣
╠╬╬╬╣
╠╬╬╬╣
╚╩╩╩╝
╔╦╦╦╗
╠╬╬╬╣
╠╬╬╬╣
╠╬╬╬╣
╠╬╬╬╣
╚╩╩╩╝
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 33 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
*...is it 33? - it costs 5 to convert from one byte string literals (code page indexes) to the Unicode characters.*
```
_2µ“€ðÐ‘ẋ“¡Ø¤“©ßµ‘js3x€2¦€’+⁽"7ỌY
```
A full program printing the result.
**[Try it online!](https://tio.run/##y0rNyan8/z/e6NDWRw1zHjWtObzh8IRHDTMe7uoG8g8tPDzj0BIQY@Xh@SAVM7KKjSuAqowOLQOSjxpmaj9q3Ktk/nB3T@T///9NAA "Jelly – Try It Online")**
### How?
```
_2µ“€ðÐ‘ẋ“¡Ø¤“©ßµ‘js3x€2¦€’+⁽"7ỌY - Main link: n
_2                                - subtract 2
  µ                               - start a new monadic chain with n-2 on the left
   “€ðÐ‘                          - code page indexes [12, 24, 15] (middle row characters)
        ẋ                         - repeat n-2 times (make unexpanded middle rows)
         “¡Ø¤“©ßµ‘                - code page indexes [[0,18,3],[6,21,9]] (top & bottom)
                  j               - join (one list: top + middles + bottom)
                   s3             - split into threes (separate into the unexpanded rows)
                          ’       - decrement n-2 = n-3
                        ¦€        - sparsely apply to €ach:
                       2          -   at index 2
                     x€           -   repeat €ach (expand centre of every row to n-3 chars)
                            ⁽"7   - literal 9556
                           +      - addition (0->9556; 12->9568; etc...)
                               Ọ  - cast to characters (╠; ╔; etc...)
                                Y - join with newlines
                                  - implicit print
```
[Answer]
# [Rockstar](https://github.com/yanorestes/rockstar-py), ~~150~~ 104 bytes
```
Listen to B
let B be-3
X's-1
say "╔"+"╦"*B+"╗"
While B-X
say "╠"+"╬"*B+"╣"
let X be+1
say "╚"+"╩"*B+"╝"
```
[Copy Paste it here!](https://codewithrockstar.com/online)
-46 bytes from Shaggy.
I was inspired by Shaggy from [this comment.](https://codegolf.stackexchange.com/questions/4244/code-golf-christmas-edition-how-to-print-out-a-christmas-tree-of-height-n/211547?noredirect=1#comment498192_211547)
Here's the *real* rock song (sort of).
```
Listen to the bars
Knock the bars down, down, down
Let the end be the bars
Build the end up
Shout "╔"+"╦"*the bars+"╗"
While the end ain't nothing
say "╠"+"╬"*the bars+"╣"
Knock the end down
Shout "╚"+"╩"*the bars+"╝"
Let the prison be gone
```
[Answer]
# [Python 3](https://docs.python.org/3/), 75 bytes
```
n=int(input())-3
print("╔"+"╦"*n+"╗\n"+("╠"+"╬"*n+"╣\n")*-~n+"╚"+"╩"*n+"╝")
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P882M69EIzOvoLREQ1NT15iroAgkoPRo6hQlbSC5TEkrD0RPj8lT0gYJLwALr4EKLwYKa2rp1oE5s8BSK6FSc5U0//83AQA "Python 3 – Try It Online")
[Answer]
# Dyalog APL, 71 bytes
```
{('╔',('╠'⍴⍨⍵-2),'╚'),((⍵-3)\⍪('╦',('╬'⍴⍨⍵-2),'╩')),'╗',('╣'⍴⍨⍵-2),'╝'}
```
[Try it online!](http://tryapl.org/?a=%7B%28%27%u2554%27%2C%28%27%u2560%27%u2374%u2368%u2375-2%29%2C%27%u255A%27%29%2C%28%28%u2375-3%29%5C%u236A%28%27%u2566%27%2C%28%27%u256C%27%u2374%u2368%u2375-2%29%2C%27%u2569%27%29%29%2C%27%u2557%27%2C%28%27%u2563%27%u2374%u2368%u2375-2%29%2C%27%u255D%27%7D%2020&run)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~60 52 49 48~~ 36 bytes
```
"╔{Uµ3 ç'╦}╗{UÄ ç"
╠{ç'╬}╣"}
╚{ç'╩}╝
```
[Try it online!](https://tio.run/##y0osKPn/X@nR1CnVoYe2GiscXq7@aOqy2kdTp1eHHm4BcpW4Hk1dUA0WXgMUXqxUCxSYBRFYCRSY@/@/KQA)
# Another version (47 bytes + `-R` flag)
```
"8{Uµ3 ç'J};{UÄ ç"D{ç'P}G"}>{ç'M}A"c_+9500ÃòU+2
```
Needs the `-R` flag (added to the input field). [Try it online!](https://tio.run/##y0osKPn/X8miOvTQVmOFw8vVvWqtq0MPtwCZSi7VQH5ArbtSrR2I5VvrqHR4U6i2kcKhdcnx2pamBgb//5sq6AYBAA "Japt – Try It Online")
## How does it work?
Because I originally assumed the 'door-characters' cost more than one byte, I figured I could save quite a few bytes by encoding them. Then, I subtracted 9500 from the character codes, which left me with the characters `8J; DPG >MA`, which only cost one byte each. Then, I could just add 9500 to each character code, and all would be well.
```
 "8{   Uµ 3 ç'J}  ;{   UÄ  ç"D{   ç'P}  G"}  >{   ç'M}  A"c_+9500Ã òU+2
 "8"+((U-=3 ç'J)+";"+((U+1 ç"D"+(Uç'P)+"G")+">"+(Uç'M)+"A"c_+9500} òU+2
 "8"+           +";"+                      +">"+      +"A"              # Take this string of characters
     ((U-=3 ç'J)                                                        # Repeat "J" input - 3 times
                     ((    ç              )                             # Repeat the string
                            "D"+(Uç'P)+"G"                              # "D" + input-3 times "P" + "G"
                       U+1                                              # Input - 2 times
                                                (Uç'M)                  # Repeat "M" input - 3 times
                                                          c_     }      # Take the character code of every character
                                                            +9500       # Add 9500 to it
                                                          c_     }      # And convert it back to a character
                                                                   òU+2 # Split this string on every (input)th character
                                                                        # Print the resulting array, joined with newlines.
```
[Answer]
# Ruby, ~~54~~ 52 bytes
-2 bytes thanks to ymbirtt.
```
->n{?╔+?╦*(n-=3)+"╗
"+(?╠+?╬*n+"╣
")*-~n+?╚+?╩*n+?╝}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6v2v7R1CnaQGKZlkaerq2xprbSo6nTuZS0NYBiC0ASa7TyQGKLuZQ0tXTr8kBCs0DESi0we27t/4LSkmKFtGiz2P8A "Ruby – Try It Online")
## Ungolfed
This is super boring:
```
->n{
   ?╔ + ?╦ * (n-=3) + "╗\n" + 
  (?╠ + ?╬ * n      + "╣\n") * -~n + 
   ?╚ + ?╩ * n      + ?╝
}
```
[Answer]
# Java 8, 102 + 101 bytes
```
java.util.function.BiFunction<String,Integer,String>r=(c,n)->"".valueOf(new char[n]).replace("\0",c);
n->{n-=3;return "╔"+r.apply("╦",n)+"╗\n"+r.apply('╠'+r.apply("╬",n)+"╣\n",-~n)+"╚"+r.apply("╩",n)+"╝";}
```
This is another string repeater of the same length:
```
java.util.function.BiFunction<String,Integer,String>r=(c,n)->{String p=c;for(;--n>0;p+=c);return p;}
```
[Try it online!](https://tio.run/##bZBBS8MwFMfP9lOEXNa6Nih6q@3Bg@BBPOy47RCzrKamryFNK2PUT@EQBEEQhIGfal@kZjTVCeb0Xt4v///LP6cNjUrFIV88dKJQpTYot3ekNkKSZQ3MiBLIcex5qr6TgiEmaVWhGyoArT3kTmWosbN/Xl6KK1deTIwWkIXXYHjGddi3qU58FkIQpRiThsqa3y594I@I3VM9hXlANFeSMu7j2QkOWRB7R87tR3hQRE4SKZSgDqJ0DVFyFmtuag14t3nGY02oUnLl2@4TW9uxLV5m8DsY7Tbvo0Psa8A@LBZGT33z@kdqOzBvOG47m9U@E5eXW7YpxQIVNjW/X3I6R1RnVXAQ4mRVGV6QsjZEWcT4yjmcngf223uk9druGw "Java (OpenJDK 8) – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), ~~Score 123 (141 bytes)~~ Score 118 (136 bytes)
```
n=>{string a="╔",b="╠",c="╚";for(int i=3;i++<n;a+="╦",b+="╬")c+="╩";a+="╗\n";for(b+="╣\n";n-->2;)a+=b;return a+c+"╝";}
```
[Try it online!](https://tio.run/##Sy7WTc4vSv2fnJNYXKwQwFXNpQAExSWJJZnJCmX5mSkKvomZeRqaYGGIJAgEVxaXpObquZXmJdtk5pXoFJcUZeal2ym4Kdgq/M@ztauGCCgk2io9mjpFSScJRC9Q0kkG0bOUrNPyizSA@hQybY2tM7W1bfKsE7VBUsuASsGMNUqayWDGSiWo1PSYPIg@iILFIG6erq6dkbUmUEGSdVFqSWlRnkKidrI2UHquknXtf2suTqhDnfPzivNzUvXCizJLUjXcNEw0Na3RPYOqRikmD2gDIVVuGhZUM8nIAGZULVct138A "C# (.NET Core) – Try It Online")
-5 bytes thanks to [@KevinCruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)
### Explanation:
```
n => 
{
    string a = "╔", b = "╠", c = "╚"; //Initialize the first, last and the middle lines with the starting character.
    for (int i = 3; i++ < n;          //Loop n-3 times
        a += "╦", b += "╬")           //Add the middle character to the first and middle line.
        c += "╩";                     //Add the middle character to the last line.
    a += "╗\n";                       //Add the end character to the first line.
    for (b += "╣\n";                  //Add the end character to the first line.
        n-- > 2;)                     //Loop n-2 times.
        a += b;                       //Add the middle line to the first line.
    return a + c + "╝";               //Add the last line and the final character and return.
}
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 23 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
÷ÅoB↔╒╢Fm|╦a⌐á5µ┐»♫÷d╕Ñ
```
[Run and debug it](https://staxlang.xyz/#p=f68f6f421dd5b6466d7ccb61a9a035e6bfaf0ef664b8a5&i=4%0A8%0A20&a=1&m=2)
Here's the ungolfed version. Amusingly, it's actually smaller for stax *not* to use the literal characters because including them as a literal would prevent source packing.
```
"2Pfj_EQGG]T"!  packed representation of the 9 characters
3/              split into groups of 3
GG              call into trailing program twice
m               print each row
}               trailing program begins here
1|xv\           [1, --x - 1]; x starts as original input
:B              repeat each element corresponding number of times
                effectively, this repeats the internal row of the matrix
M               transpose door; this way it expands the two dimensions
```
[Run this one](https://staxlang.xyz/#c=%222Pfj_EQGG]T%22%21%09packed+representation+of+the+9+characters%0A3%2F++++++++++++%09split+into+groups+of+3%0AGG++++++++++++%09call+into+trailing+program+twice%0Am+++++++++++++%09print+each+row%0A%7D+++++++++++++%09trailing+program+begins+here%0A1%7Cxv%5C+++++++++%09[1,+--x+-+1]%3B+x+starts+as+original+input%0A%3AB++++++++++++%09repeat+each+element+corresponding+number+of+times%0A++++++++++++++%09effectively,+this+repeats+the+internal+row+of+the+matrix%0AM+++++++++++++%09transpose+door%3B+this+way+it+expands+two+different+dimensions&i=4%0A8%0A20&a=1&m=2)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 29 bytes
```
3-…╩╬╦S×`…╔ÿ╗Š…╠ÿ╣IÍ×s…╚ÿ╝Jä»
```
[Try it online!](https://tio.run/##MzBNTDJM/f/fWPdRw7JHU1c@mrrm0dRlwYenJ4D5Uw7vfzR1@tEFYM4CEGex5@Hew9OLwQKzQAJzvQ4vObT7/38LAA "05AB1E – Try It Online")
[Answer]
# Swift, 161 bytes
```
let f:(String,Int)->String={String(repeating:$0,count:$1)};var p={i in print("╔\(f("╦",i-3))╗\n\(f("╠\(f("╬",i-3))╣\n",i-2))╚\(f("╩",i-3))╝")}
```
Un-golfed:
```
let f:(String,Int)->String = {
    String(repeating:$0,count:$1)
}
var p={ i in
    print("╔\(f("╦",i-3))╗\n\(f("╠\(f("╬",i-3))╣\n",i-2))╚\(f("╩",i-3))╝")
}
```
You can try this answer out [here](http://swift.sandbox.bluemix.net/#/repl/594299670d43350685451e57)
[Answer]
# [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 78 bytes
```
[:-3|X=X+@╦`]?@╔`+X+@╗`[b-2|Y=Z[b-3|Y=Y+@╬`]?@╠`+Y+@╣`}[b-3|W=W+@╩`]?@╚`+W+@╝`
```
Fortunately, all of the symbols used in out cell door are on the QBasic codepage.
## Explanation
```
            The TOP
[:-3|       FOR a = 1 to n-3 (-1 for the width, -2 for beginning and end)
X=X+@╦`]    Build out X$ with the parts of the middle-top
?@╔`+X+@╗`  Then print that preceded and followed by the corners
┘           Syntactic linebreak
            
            The MIDDLE
[b-2|       FOR c = 1 to n-2 (all the middle rows)
Y=Z         Reset Y$ to ""
            Build up the middle rows in the same way as the top,
            just with different symbols and once for each middle row
[b-3|Y=Y+@╬`]?@╠`+Y+@╣`
}           Close the FOR loop
            The BOTTOM
            The same as the top, just with different symbols
[b-3|W=W+@╩`]?@╚`+W+@╝`
```
## Sample Output
```
Command line: 7
╔╦╦╦╦╗
╠╬╬╬╬╣
╠╬╬╬╬╣
╠╬╬╬╬╣
╠╬╬╬╬╣
╠╬╬╬╬╣
╚╩╩╩╩╝
```
[Answer]
# [PHP](https://php.net/), 131 bytes, 113 chars
```
for($z=str_split("╔╠╚╦╬╩╗╣╝",3);$i<$a=$argn;)echo str_pad($z[$b=$i++?$i<$a?1:2:0],3*$a-3,$z[$b+3]),$z[$b+6],"\n";
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwJVaVJRfFF@UWpBfVJKZl65R5xrv5x/i6eyqac2lkliUnmerZKJk/T8tv0hDpcq2uKQovrggJ7NEQ@nR1CmPpi54NHXWo6nLHk1d82jqykdTpz@auvjR1LlKOsaa1iqZNiqJtmAjrDVTkzPyFUCaCxJTgOZEqyTZqmRqa9uDFdkbWhlZGcTqGGupJOoa64CltY1jNaEss1gdpZg8oBv@f83L101OTM5IBQA "PHP – Try It Online")
# [PHP](https://php.net/), 133 bytes, 115 chars
```
for(;$i<$a=$argn;)echo str_pad(["╔","╠","╚"][$b=$i++?$i<$a?1:2:0],3*$a-3,["╦","╬","╩"][$b]),["╗","╣","╝"][$b],"\n";
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwJVaVJRfFF@UWpBfVJKZl65R5xrv5x/i6eyqac2lkliUnmerZKJk/T8tv0jDWiXTRiXRFixqrZmanJGvUFxSFF@QmKIRrfRo6hQlHSC5AEzOUoqNVkmyVcnU1rYH67I3tDKyMojVMdZSSdQ11gGpXwZWuQZMrgSrj9UES0wHCy0Gk3MhEjpKMXlAV/z/mpevm5yYnJEKAA "PHP – Try It Online")
[Answer]
## JavaScript (ES6), 86 bytes
This is significantly longer than [the other JS answer](https://codegolf.stackexchange.com/a/126626/58563), but I wanted to give it a try with an alternate method.
```
n=>(g=i=>--i?`╬╣╠╩╝╚╦╗╔
`[(j=i%n)?!--j+2*!(n-j-2)+3*(i<n)+6*(i>n*n-n):9]+g(i):'')(n*n)
```
### How?
We assign a weight to each edge of the grid: 1 for right, 2 for left, 3 for bottom and 6 for top. The sum of the weights gives the index of the character to use.
```
8666667    0 1 2 3 4 5 6 7 8
2000001    ╬ ╣ ╠ ╩ ╝ ╚ ╦ ╗ ╔
2000001
2000001
2000001
2000001
2000001
5333334
```
### Demo
```
let f =
n=>(g=i=>--i?`╬╣╠╩╝╚╦╗╔
`[(j=i%n)?!--j+2*!(n-j-2)+3*(i<n)+6*(i>n*n-n):9]+g(i):'')(n*n)
console.log(f(8))
```
[Answer]
# JavaScript (ES6), ~~80~~ 74 bytes
```
n=>`╔${"╦"[a="repeat"](n-=3)}╗${`
╠${"╬"[a](n)}╣`[a](n+1)}
╚${"╩"[a](n)}╝`
```
[Answer]
## Batch, 126 bytes
```
@set s=
@for /l %%i in (4,1,%1)do @call set s=%%s%%Î
@echo É%s:Î=Ë%»
@for /l %%i in (3,1,%1)do @echo Ì%s%¹
@echo È%s:Î=Ê%¼
```
Works in CP437 or CP850. Looks like this in those code pages:
```
@set s=
@for /l %%i in (4,1,%1)do @call set s=%%s%%╬
@echo ╔%s:╬=╦%╗
@for /l %%i in (3,1,%1)do @echo ╠%s%╣
@echo ╚%s:╬=╩%╝
```
[Answer]
# [Retina](https://github.com/m-ender/retina), ~~56~~ 50 bytes
```
.+
$*╬╣
^╬╬╬
╠
.?
$_¶
T`╠╬╣`╔╦╗`^.*
T`╠╬╣`╚╩╝`.*¶$
```
[Try it online!](https://tio.run/##K0otycxL/P9fT5tLRevR1DWPpi7migPTIMT1aOoCLj17LpX4Q9u4QhKAPIgSIGvKo6nLHk2dnhCnp4UmM@vR1JWPps5N0NM6tE3l/38LAA "Retina – Try It Online") Works by building up a square of ╬s and then fixing up the edges (in particular three colums are deleted when the sides are added).
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 67 bytes
```
'╔'+'╦'*($x=$args[0]-3)+'╗';,('╠'+'╬'*$x+'╣')*($x+1);'╚'+'╩'*$x+'╝'
```
Takes input `$args[0]`, subtracts `3`, saves that into `$x`, uses that in the construction of the top of the door to output the appropriate number of middle sections. Then we're outputting the middle rows, of which we have `$x+1` of. Finally, the bottom row is similar to the top row. All of those are left on the pipeline, and the implicit `Write-Output` inserts a newline between elements for free.
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X/3R1Cnq2kBymbqWhkqFrUpiUXpxtEGsrrEmSHS6urWOBpBeAFazRl1LpQLEWKyuCVKtbahpDeTNAkuuhEnOVf///78FAA "PowerShell – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 61
60 characters of code (90 including the multibyte door characters) + 1 for `-p`
```
$_='╔'.'╦'x($n=$_-3)."╗\n";$_.=y/╔╦╗/╠╬╣/r x++$n.y/╔╦╗/╚╩╝/r
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3lb90dQp6npAcpl6hYZKnq1KvK6xpp7So6nTY/KUrFXi9Wwr9YFKgPJAISBrwaOpax5NXaxfpFChra2Sp4cqO@vR1JWPps7VL/r/3@RffkFJZn5e8X9dX1M9A0OD/7oFAA "Perl 5 – Try It Online")
[Answer]
# C# (.NET Core), 130 bytes
```
n=>"╔"+R("╦",n-=3)+"╗\n"+R("╠"+R("╬",n)+"╣\n",-~n)+"╚"+R("╩",n)+"╝";string R(string c,int n){string r=c;for(;n-->1;r+=c);return r;}
```
[Port of *@RobertoGraham*'s Java 8 answer](https://codegolf.stackexchange.com/a/142008/52210), after I golfed about 70 bytes.
[Try it online.](https://tio.run/##Sy7WTc4vSv2fnJNYXKzgW82loFBckliSmaxQlp@ZouCbmJmnoQkSVVAIriwuSc3VcyvNS7bJzCvRASosysxLt1NwU7BV@J9na6f0aOoUJe0gDSC9TEknT9fWWFMbyJ4ekwcVXQCl1wBlwVKLgVI6unUQziyo7EqY7Fwla4gVCkEaUEayDtBmhTzNaii/yDbZOi2/SMM6T1fXztC6SNs2WdO6KLWktChPoci69j@Su53z84rzc1L1wosyS1I13DRMNDWtuXDJ@2TmpWrgkQfqt6BQv5EBxIBarlqu/wA)
[Answer]
# [MAWP](https://esolangs.org/wiki/MAWP), 73 bytes
```
@=MM"╔":!3-["╦":1-]`"╗
":2-["╠":M3-["╬":1-]`"╣
":1-]`"╚":M3-["╩":1-]`"╝":
```
[Try it!](https://8dion8.github.io/MAWP/v2.0?code=%40%3DMM%22%E2%95%94%22%3A!3-%5B%22%E2%95%A6%22%3A1-%5D%60%22%E2%95%97%0A%22%3A2-%5B%22%E2%95%A0%22%3AM3-%5B%22%E2%95%AC%22%3A1-%5D%60%22%E2%95%A3%0A%22%3A1-%5D%60%22%E2%95%9A%22%3AM3-%5B%22%E2%95%A9%22%3A1-%5D%60%22%E2%95%9D%22%3A&input=4)
Note the strings with newlines
[Answer]
# Mathematica, 106 bytes
```
(T[a_,b_,c_]:=a<>Table[b,#-3]<>c;w=Column;w[{T["╔","╦","╗"],w@Table[T["╠","╬","╣"],#-2],T["╚","╩","╝"]}])&
```
[Answer]
# oK, 38 chars
```
`0:"╔╠╚╦╬╩╗╣╝"{+x+/:3*0,2_x}@&1,|1,-2+
```
[Try it online.](http://johnearnest.github.io/ok/?run=f%3A%600%3A%22%E2%95%94%E2%95%A0%E2%95%9A%E2%95%A6%E2%95%AC%E2%95%A9%E2%95%97%E2%95%A3%E2%95%9D%22%7B%2Bx%2B%2F%3A3%2a0%2C2_x%7D%40%261%2C%7C1%2C-2%2B%0Af%274%208%2020%3B)
k does not seem to want to handle unicode well, so I went with oK.
[Answer]
# [J](http://jsoftware.com/), ~~41~~ 37 bytes
```
ucp@'╬╠╣╦╔╗╩╚╝'{~1 1|.{.&6 3+/<:{.2,*
```
[Try it online!](https://tio.run/##AVYAqf9q//9mPS4gdWNwQCfilazilaDilaPilabilZTilZfilanilZrilZ0ne34xIDF8LnsuJjYgMysvPDp7LjIsKv9lY2hvQGYgZXZlcnkgNyA2IDUgNCAz/w)
Default box drawing takes [13 bytes](https://tio.run/##y/r/P81WT0FXzVDBSMXGITW3oKTyf2pyRr5DmkJqWWpRpYK5gpmCqYKJgvF/AA), unfortunately the best way of [replacing the characters](https://tio.run/##AVoApf9q//9mPS4gdWNwQCfilZTilabilZfilaDilazilaPilZrilanilZ0ne35fMTYrMyB1OjEiOi0mMSAyJDxAZW1wdHn/ZWNob0BmIGV2ZXJ5IDcgNiA1IDQgM/8) I could find costs 28.
]