text:
Parentheses sequences in lexicographical order
Challenge Taken from here and also here
An n parentheses sequence consists of n (s and n )s.
A valid parentheses sequence is defined as the following:

You can find a way to repeat erasing adjacent pair of parentheses "()" until it becomes empty.
For example, (()) is a valid parentheses, you can erase the pair on the 2nd and 3rd position and it becomes (), then you can make it empty.
  )()( is not a valid parentheses, after you erase the pair on the 2nd and 3rd position, it becomes )( and you cannot erase any more

Task
Given a number n you need to generate all correct parenthesis sequence in lexicographical order
Output can be an array, list or string (in this case a sequence per line)
You can use a different pair of parenthesis such as {}, [], () or any open-close sign
Example

n = 3
((()))
(()())
(())()
()(())
()()()

n = 2
(())
()()

@JoKing Yes of course. I assume that wont make any difference anyway to the main concept of the challenge.

Eh, I can think of a few languages where eval would interpret them differently for example

Related: Catalan Numbers (result of that challenge = number of lines of result of this challenge)

Virtually the same, but with some weird restrictions like "You may not write recursive functions". /// A superset of this challenge (allow all Brain-Flak brackets)

Does "an array, list or string" "of sequences" of "any open-close sign" mean we could output a list of lists of two integers (like 1s and -1s)?

@JonathanAllan You can output a list of list but not using 1, -1.

So what are "any open-close sign"s? Do you mean any pair of open-close characters like <>, ‘’ or ⁽⁾?

@JonathanAllan Exactly. Sorry if I was unclear on that

Perl 6, 36 bytes
{grep {try !.EVAL},[X~] <[ ]>xx$_*2}

Try it online!
Finds all lexographically sorted combinations of \$2n\$ []s and filters the ones that EVAL correctly. Note that all valid combinations (even stuff like [][]) evaluate to [] (which is falsey, but we not it (!) to distinguish from try returning Nil)
Explanation:
{                                  }  # Anonymous code block
                        <[ ]>         # Create a list of ("[", "]")
                             xx$_*2   # Duplicate this 2n times
                   [X~]               # Find all possible combinations
 grep {          },                   # Filter from these
            .EVAL                     # The EVAL'd strings
       try !                          # That do not throw an error

If anyone's curious, [][] is the Zen slice of an empty array which yields the array itself. The slice can be applied multiple times, so [][][][]... evaluates to []. Besides, [[]] doesn't construct a nested array but an empty array because of the single argument rule (you'd have to write [[],] for a nested array). So any balanced sequence of [] brackets results in an empty array which boolifies to false.

R, 112 107 99 bytes
Non-recursive approach. We use "<" and ">" because it avoids escape characters in the regex. To allow us to use a shorter specification for an ASCII range, we generate 3^2n 2n-character strings of "<", "=" and ">" using expand.grid (via their ASCII codes 60, 61 and 62) and then grep to see which combinations give balanced open and close brackets. The "=" possibilities will get ignored, of course.
Via http://rachbelaid.com/recursive-regular-experession/
function(n)sort(grep("^(<(?1)*>)(?1)*$",apply(expand.grid(rep(list(60:62),2*n)),1,intToUtf8),,T,T))

Try it online!
Explanation
"^(<(?1)*>)(?1)*$" = regex for balanced <> with no other characters
^ # match a start of the string
  ( # start of expression 1
    < # open <>
       (?1)* # optional repeat of any number of expression 1 (recursive)
  # allows match for parentheses like (()()())(()) where ?1 is (\\((?1)*\\))
    > # close <>
  ) # end of expression 1
  (?1)* # optional repeat of any number of expression 1
$ # end of string

function(n)
  sort(
    grep("^(<(?1)*>)(?1)*$", # search for regular expression matching open and close brackets
      apply(
        expand.grid(rep(list(60:62),2*n)) # generate 3^(2n) 60,61,62 combinations
      ,1,intToUtf8) # turn into all 3^(2n) combinations of "<","=",">"
    ,,T,T) # return the values that match the regex, so "=" gets ignored
  ) # sort them

R, 107 bytes
Usual recursive approach.
-1 thanks @Giuseppe

f=function(n,x=0:1)`if`(n,sort(unique(unlist(Map(f,n-1,lapply(seq(x),append,x=x,v=0:1))))),intToUtf8(x+40))

Try it online!

ah, I was trying to find a Map golf but couldn't wrap my head around it. I'm not convinced parse + eval is going to work since ()() and the like throw errors.

K (ngn/k), 36 35 37 bytes
{"()"(|/'0>+\'1-2*)_(x=+/')#+!2|&2*x}

Try it online!
+!2|&2*x all binary vectors of length 2*n
(x=+/')# only those that sum to n
(|/0>+\'1-2*)_ only those whose partial sums, treating 0/1 as 1/-1, are nowhere negative
"()" use 0/1 as indices in this string

Python 2, 91 88 84 81 bytes
f=lambda n:n and sorted({a[:i]+'()'+a[i:]for a in f(n-1)for i in range(n)})or['']

Try it online!
-3 bytes thanks to pizzapants184

Also works in Python 3, I think

You can replace set(...) with a set comprehension ({...}) for -3 bytes Try it online!

05AB1E, 13 bytes
„()©s·ãʒ®õ:õQ

Try it online or verify some more test cases.
Explanation:
„()            # Push string "()"
   ©           # Store it in the register without popping
    s·         # Swap to get the (implicit) input, and double it
      ã        # Cartesian product that many times
       ʒ       # Filter it by:
        ®      #  Push the "()" from the register
         õ:    #  Infinite replacement with an empty string
           õQ  #  And only keep those which are empty after the infinite replacement

C (gcc), 114 bytes
f(n,x,s,a,i){char b[99]={};n*=2;for(x=1<<n;x--;s|a<0||puts(b))for(s=a=i=0;i<n;)a|=s+=2*(b[n-i]=41-(x>>i++&1))-81;}

Try it online!
Should work for n <= 15.
Explanation
f(n,x,s,a,i){
  char b[99]={};   // Output buffer initialized with zeros.
  n*=2;            // Double n.
  for(x=1<<n;x--;  // Loop from x=2**n-1 to 0, x is a bit field
                   // where 1 represents '(' and 0 represents ')'.
                   // This guarantees lexicographical order.
      s|a<0||puts(b))  // Print buffer if s==0 (as many opening as
                       // closing parens) and a>=0 (number of open
                       // parens never drops below zero).
    for(s=a=i=0;i<n;)  // Loop from i=0 to n-1, note that we're
                       // traversing the bit field right-to-left.
      a|=              // a is the or-sum of all intermediate sums,
                       // it becomes negative whenever an intermediate
                       // sum is negative.
        s+=            // s is the number of closing parens minus the
                       // number of opening parens.
                        x>>i++&1   // Isolate current bit and inc i.
                    41-(        )  // ASCII code of paren, a one bit
                                   // yields 40 '(', a zero bit 41 ')'.
             b[n-i]=               // Store ASCII code in buffer.
          2*(                    )-81;  // 1 for ')' and -1 for '(' since
                                        // we're going right-to-left.
}

Japt, 15 13 bytes
ç>i<)á Ôke/<>

Try it

Explanation
ç                 :Input times repeat the following string
 >i<              :  ">" prepended with "<"
    )             :End repeat
     á            :Get unique permutations
       Ô          :Reverse
        k         :Remove any that return true (non-empty string)
         e/<>     :  Recursively replace Regex /<>/

Ruby, 70 bytes
f=->n{n<1?['']:(0...n).flat_map{|w|f[n-1].map{|x|x.insert w,'()'}}|[]}

Try it online!

JavaScript (ES6), 112 102 bytes
This is heavily based on nwellnhof's C answer.
f=(n,i)=>i>>2*n?'':(g=(o,k)=>o[2*n]?s|m<0?'':o:g('()'[m|=s+=k&1||-1,k&1]+o,k/2))(`
`,i,m=s=0)+f(n,-~i)

Try it online!

Perl 6, 42 bytes
{grep {!S:g/\(<~~>*\)//},[X~] <( )>xx$_*2}

Try it online!
Uses a recursive regex. Alternative substitution: S/[\(<~~>\)]*//
38 bytes with 0 and 1 as open/close symbols:
{grep {!S:g/0<~~>*1//},[X~] ^2 xx$_*2}

Try it online!
Explanation
{                                        }  # Anonymous block
                              <( )>         # List "(", ")"
                                   xx$_*2   # repeated 2n times
                         [X~]  # Cartesian product with string concat
                               # yields all strings of length 2n
                               # consisting of ( and )
 grep {                },  # Filter strings
        S:g/             # Globally replace regex match
            \(           #   literal (
              <~~>       #   whole regex matched recursively
                  *      #   zero or more times
                   \)    #   literal )
                     //  # with empty string
       !                 # Is empty string?

Red, 214, 184 136 bytes
func[n][g: func[b n][either n = length? b[if not error? try[load b][print b]return 0][g append copy b"["n g append copy b"]"n]]g""2 * n]

Try it online!
Uses Jo King's approach. Finds all possilble arrangements of brackes using recursion (they are generated in lexicographic order) and print it if the arrangement evaluates as a valid block.

Perl 5 -n, 41 39 bytes
-2 bytes with angle brackets
s/<(?R)*>//gr||say for glob'{<,>}'x2x$_

Try it online!
Port of my Perl 6 answer.

Retina 0.8.2, 50 bytes
.+
$*
1
11
+%1`1
<$'¶$`>
Gm`^(?<-1>(<)*>)*$(?(1).)

Try it online! Uses <>s. Explanation:
.+
$*

Convert to unary.
1
11

Double the result.
+%1`1
<$'¶$`>

Enumerate all of the 2²ⁿ 2n-bit binary numbers, mapping the digits to <>.
Gm`^(?<-1>(<)*>)*$(?(1).)

Keep only balanced sequences. This uses a balanced parentheses trick discovered by @MartinEnder.

Jelly,  15  14 bytes
-1 thanks to ChartZBelatedly! (Use a better fixed-point built-in.)
ḤØ(ṗœṣØ(F$ÐLÐḟ

A monadic Link accepting \$n\$ that yields a list of lists of characters.
Try it online! (footer formats the list as lines.)
How?
ḤØ(ṗœṣØ(F$ÐLÐḟ - Link: integer, n
 Ø(            - literal ['(', ')']
Ḥ              - double (n)
   ṗ           - Cartesian power -> all length 2n lists of '(' and/or ')' (already sorted)
            Ðḟ - filter discard if:
          ÐL   -   repeat until a fixed point is reached applying:
         $     -     last two links as a monad, f(current, initially proposed):
    œṣ         -       split at:
      Ø(       -         literal ['(', ')']
        F      -       flatten
                   } -> empty list if balanced (only empty lists are falsey)

-1 byte as ƬṪ$ can be replaced with ÐL

@ChartZBelatedly - Ah, I golfed my way from something that then transposed and head-ed. Thanks!

Haskell, 80 bytes
f n=[x|x<-mapM("()"<$f)[1..2*n],0:y<-[scanr(\b->(sum[2|b>'(']-1+))0x],all(>=0)y]

Try it online!

Jelly, 19 bytes
Ø+xŒ!QÄAƑ>ṪƊ$Ƈ=1ịØ(

Try it online!
Output clarified over TIO.

JavaScript (Node.js), 84 bytes
f=(n,s='')=>n?f(n-=.5,s+'[')+f(n,s+']'):[...s].some(t=>(n+=t<']'?1:-1)<0)|n?'':s+`
`

Try it online!
JavaScript (Node.js), 90 bytes
f=(n,s='')=>n?f(n-=.5,s+'[')+f(n,s+']'):eval("try{eval(s.split``+``),s+`\n`}catch(_){''}")

Try it online!
Is it an array?


text:
Smallest Integer Disk
This challenge is about finding the smallest disk that contains some given points. This is made somewhat trickier, however, by the fact that in this challenge, the disk's coordinates and radius must both be integers.
Your input will be a list of points with integer coordinates x and y. You can take this as a list of tuples, a list of lists, or any other way to represent a collection of pairs. x and y will both be (possibly negative) integers. Every point is guaranteed to be unique, and there will be at least one point.
Your output will be a disk in the form of three numbers, X, Y, and R. X, Y, and R are all integers, X and Y represent the disk's center and R represents its radius. The distance between every given point and the center must be less than or equal to R, and there must not exist such a disk with a smaller R that also satisfies this condition.
It is possible that there will be multiple possible solutions for a given input, your code must output at least one of them in this case.
You can use any kinds of geometry builtins your language supports if there are any, and input/output may be through built-in point/disk objects instead of just numbers.
Test Cases
Input   (Possible) Output(s)
(x,y)   (X,Y,R)
-------------------------
(0,0)   (0,0,0)
-------------------------
(0,1)   (0,0,1)
(1,0)   (1,1,1)
-------------------------
(1,4)   (4,4,3)
(3,2)
(4,1)
(4,5)
(5,2)
(7,4)
-------------------------
(-1,0)  (0,0,2)
(2,0)   (1,0,2)
-------------------------
(-1,0)  (1,0,2)
(2,1)   (0,1,2)
-------------------------
(0,0)   (1,0,1)
(1,1)   (0,1,1)

Fewest bytes wins.

Sandbox

Found a couple typos, if you don't mind me pointing them out: "This is made somewhat trickier..."; "...represents the disk's center and R represents its radius..."; "...and there must not exist such a disk..."

Usually making things integer just make code-golf easier.

@KevinCruijssen That's by coincidence. Inputs can be in any order.

@Pavel The input can be in any order, or we can take the input in any order? As in, the input can be in any order and we should manually sort first in our solution, or can we already take the input pre-sorted?

@KevinCruijssen Any order implies not sorted. You should not make any assumptions about the input already following a certain rule.

Jelly, 25 24 22 21 20 18 bytes
«/r»/Œpµ³_²§½ṀĊ,)Ṃ

Thanks to @EriktheOutgolfer for letting me know about ), saving 1 byte.
Thanks to @Dennis for saving 2 bytes.
Try it online!
Explanation
«/r»/Œpµ³_²§½ṀĊ,)Ṃ      Main link. Arg: points
                        e.g. [[1,4],[3,2],[3,1]]
«/                      Find minimums by coordinate
                        e.g. [1,1]
   »/                   Find maximums by coordinate
                        e.g. [3,4]
  r                     Inclusive ranges by coordinate
                        e.g. [[1,2,3],[1,2,3,4]]
     Œp                 Cartesian product of the x and y ranges
                        e.g. [[1,1],[1,2],[1,3],[1,4],...,[3,4]]
       µ                    Chain, arg: center
                            e.g. [1,3]
        ³                   Get the original points
                            e.g. [[1,4],[3,2],[3,1]]
         _                  Subtract the center from each
                            e.g. [[0,1],[2,-1],[2,-2]]
          ²                 Square each number
                            e.g. [[0,1],[4,1],[4,4]]
           §                Sum each sublist
                            e.g. [1,5,8]
            ½               Square root of each number
                            e.g. [1,2.24,2.83]
             Ṁ              Find the maximum
                            e.g. 2.83
              Ċ             Round up
                            e.g. 3
               ,            Pair with the center point
                            e.g. [3,[1,3]]
                )       Do the above for all points
                        e.g. [[3,[1,1]],[3,[1,2]],[3,[1,3]],...,[3,[3,4]]]
                 Ṃ      Find the lexicographically smallest pair
                        e.g. [3,[1,1]]

@Dennis Thanks! Since when did Jelly's vectorization repeat the shorter list, or am I misinterpreting the removal of €?

Depths are matched first. If you a pair and an array of pairs, the pair gets matched with all pairs.

Brachylog v2, 19 bytes
;Az{\-ᵐ~√ᵐ+}ᵐ≤ᵛ√;A≜

Try it online!
This program was easy to write – Brachylog's almost perfect for this sort of problem – but hard to golf. It wouldn't surprise me if there was a byte saving somewhere here, as few things I did seemed to have any effect (and it contains nested map instructions, normally a sign that you should be using member/findall, but I can't see a way to do it).
This is a function submission. Input is from the left argument to the function in the format [[x,y],[x,y],…], output from the right argument in the form [r,[[x,y]]]. (If you want to try negative numbers in the input, note that Brachylog uses _ for the minus sign, not -. This is confusing because the function → full program wrapper that Brachylog ships with, requested using the command-line argument Z, will present negative numbers in the output with a regular minus sign.)
Explanation
;Az{\-ᵐ~√ᵐ+}ᵐ≤ᵛ√;A≜
;A                   Append something
  z                    to every element of the input
   {       }ᵐ        such that for each resulting element:
     -                 Subtracting
    \ ᵐ                  corresponding elements {of the (input, appended) element}
       ~√              and un-squarerooting
         ᵐ               {the result of} each {subtraction}
          +            and summing {the resulting square numbers}
             ≤       {lets us find} a number at least as large as
              ᵛ        every element {of the list of sums}
               √     which can be square-rooted;
                ;A   append the same list as initially to it.
                  ≜  Find the first integer solution to the above, lexicographically.

This is interesting in that we're asking Brachylog to find a value of certain properties (in this case, the radius of a disk centred at point A that fits all the input points), but hardly placing any requirements on it (all we require is that the radius is a number). However, Brachylog will internally calculate the radius in question symbolically rather than trying to use concrete numbers, so when the final ≜ is reached, it accomplishes two things at once: first, it ensures that only integers are used for the coordinates of A and for the radius (forcing the squared radius to be a square number, and explaining the use of ≤ᵛ to find a "maximum or greater"); second, it finds the smallest possible viable radius (as the radius comes first in the output).
One thing that isn't specified in the program at all is that all the points are measured against the same centre of a disk; as written, there are no constraints that we don't use a different centre for each point. However, the tiebreak order (which in this case is set by the third ᵐ, and which as a structure constraint will be evaluated before the value constraint implied by ≜) wants A to be as short as possible (i.e. a single element, so we use the same centre each time; it tries a zero-length A first but that obviously doesn't work, so it tries a singleton list next). As a result, we end up getting a useful constraint (that we only have one disk) "for free".
This solution happens to generalise to any number of dimensions, with no changes to the source code; there are no assumptions here that things are two-dimensional. So if you happen to need the smallest integer sphere, you can have that too.

Perl 6, 81 bytes
{min [X]([Z]($^p)>>.minmax).map:{$p.map({(@_ Z-$_)>>².sum**.5}).max.ceiling,$_}}

Try it online!
Takes a list of points as 2-element lists ((X1, Y1), (X2, Y2), ...). Returns a list (R, (X, Y)). Uses the same approach as Pietu1998's Jelly answer:
[X]([Z]($^p)>>.minmax)  # All possible centers within the bounding box
.map:{ ... }            # mapped to
$p.map({(@_ Z-$_)>>².sum**.5}).max  # maximum distance from any point
.ceiling                # rounded up,
,$_                     # paired with center.
min                     # Find minimum by distance.

The minmax method is useful here as it returns a Range. The Cartesian product of ranges directly yields all points with integer coordinates.

05AB1E, 26 bytes
øεWsàŸ}`âεUIεX-nOt}àîX‚}{н

Port of @Pietu1998's Jelly answer.
Try it online or verify all test cases.
Explanation:
ø                    # Zip the (implicit) input, swapping the rows and column
                     #  i.e. [[1,4],[3,2],[3,1]] → [[1,3,3],[4,2,1]]
 ε    }              # Map each to:
  W                  #  Push the smallest value (without popping the list)
                     #   i.e. [[1,3,3],[4,2,1]] → [1,1]
   s                 #  Swap so the list is at the top of the stack again
    à                #  Pop the list and push the largest value
                     #   i.e. [[1,3,3],[4,2,1]] → [3,4]
     Ÿ               #  Take the inclusive range of the min and max
                     #   i.e. [[1,2,3],[1,2,3,4]]
`                    # After the map, push both lists separated to the stack
 â                   # And take the cartesian product of the two lists
                     #  i.e. [[1,2,3],[1,2,3,4]]
                     #   → [[1,1],[1,2],[1,3],[1,4],[2,1],[2,2],[2,3],[2,4],[3,1],[3,2],[3,3],[3,4]]
  ε             }    # Map each pair to:
   U                 #  Pop and store the current value in variable `X`
    I                #  Push the input
     ε     }         #  Map each pair in the input to:
      X              #   Push variable `X`
       -             #   Subtract it from the current pair
                     #    i.e. [3,2] - [1,3] → [2,-1]
        n            #   Take the square of each
                     #    i.e. [2,-1] → [4,1]
         O           #   Sum the lists
                     #    i.e. [4,1] → 5
          t          #   Take the square-root of each
                     #    i.e. 5 → 2.23606797749979
            à        #  Pop the converted list, and push its largest value
                     #   i.e. [[3.0,2.23606797749979,2.0],[2.0,2.0,2.23606797749979],...,[2.0,2.0,3.0]]
                     #    → [3.0,2.23606797749979,...,3.0]
             î       #  Round it up
                     #   i.e. [3.0,2.23606797749979,...,3.0] → [3.0,3.0,3.0,4.0,4.0,3.0,3.0,4.0,4.0,3.0,3.0,3.0]
              X‚     #  Pair it with variable `X`
                     #   i.e. [[3.0,[1,1]],[3.0,[1,2]],...,[3.0,[3,4]]]
                 {   # After the map, sort the list
                  н  # And take the first item (which is output implicitly)
                     #  i.e. [[3.0,[1,1]],[3.0,[1,2]],...,[3.0,[3,4]]] → [3.0,[1,1]]

Matlab, 73 bytes
function g(x);[r,~,d]=fminimax(@(a)pdist2(x,a),[0 0]);[round(r) ceil(d)]

Simply find the smallest solution (floating point) and round to nearest point and ceil the radius (worst case for the minimax problem). I don't know for sure if that yields the correct solution for all possible cases (within the precision), but for the test cases it should work (if I didn't make a typing error).
Call it with
g([1 4;3 2;4 1;4 5;5 2;7 4])

wouldn't this fail for $(0,0),(1,1)$? the obvious solution returned by fminimax is the midpoint $(0.5,0.5)$, which MATLAB rounds to $(1,1)$. The radius returned is also $\sqrt 2 / 2$ which rounds up to $1$, but that then excludes $(0,0)$.

You are correct, but the output of fminimax is [0.500000211699422   0.499999788525202], so it rounds correctly. So I'm lucky here. I'm currently thinking how to sidestep this problem (as it only work by pure luck).

Java 10, 283 279 277 257 bytes
C->{int M=1<<31,m=M,X=M,Y=M,x=M-1,y=x,t,a,b,r[]={x};for(var c:C){x=(t=c[0])<x?t:x;X=t>X?t:X;y=(t=c[1])<y?t:y;Y=t>Y?t:Y;}for(;y<=Y;y++)for(t=x;t<=X;r=m<r[0]?new int[]{m,t,y}:r,m=M,t++)for(var c:C){a=c[0]-t;b=c[1]-y;a*=a;m=(a=(int)Math.ceil(Math.sqrt(a+=b*=b)))>m?a:m;}return r;}

-20 bytes thanks to @nwellnhof's tip of using Math.hypot.
The result-array is in the order [R,X,Y].
Try it online.
Explanation:
C->{                  // Method with 2D int-array as parameter & int-array as return-type
  int M=1<<31,        //  Minimum `M`, starting at -2,147,483,648
      m=M,            //  Temp integer, starting at -2,147,483,648 as well
      X=M,            //  Largest X coordinate, starting at -2,147,483,648 as well
      Y=M,            //  Largest Y coordinate, starting at -2,147,483,648 as well
      x=M-1,          //  Smallest X coordinate, starting at 2,147,483,647
      y=x,            //  Smallest Y coordinate, starting at 2,147,483,647 as well
      t,a,            //  Temp integers, starting uninitialized
      r[]={x};        //  Result-array, starting at one 2,147,483,647
  for(var c:C){       //  Loop over the input-coordinates
    x=(t=c[0])<x?t:x; //   If the X coordinate is smaller than `x`, change it
    X=t>X?t:X;        //   If the X coordinate is larger than `X`, change it
    y=(t=c[1])<y?t:y; //   If the Y coordinate is smaller than `y`, change it
    Y=t>Y?t:Y;}       //   If the Y coordinate is larger than `Y`, change it
 for(;y<=Y;y++)       //  Loop `y` in the range [`y`,`Y`]:
   for(t=x;t<=X       //   Inner loop `t` in the range [`x`,`X`]:
          ;           //     After every iteration:
           r=m<r[0]?  //      If `m` is smaller than the first value:
              new int[]{m,t,y}
                      //       Replace the result with `m,t,y`
             :        //      Else:
              r,      //       Leave `r` unchanged
           m=M,       //      Reset `m` to -2,147,483,648 for the next iteration
           t++)       //      And increase `t` by 1
     for(var c:C)     //    Inner loop over the input-coordinates
       m=(a=(int)Math.ceil(Math.hypot(c[0]-t,c[1]-y)))
                      //     Subtract `t` from the X coordinate;
                      //     subtract `y` from the Y coordinate;
                      //     take the hypot (<- sqrt(x*x+y*y)) of those
                      //     ceil it
                      //     And set `a` to this value
          >m?         //     If `a` is larger than `m`:
           a          //      Set `m` to `a`
          :           //     Else:
           m;         //      Leave `m` unchanged
  return r;}          //  Return the result `r`

You can save at least 8 bytes with Math.hypot.

@nwellnhof Ah, completely forgot about Math.hypot, which is perfect for this challenge! -20 bytes right there. Thanks. :)

Pyth, 34 33 bytes
hSm+.EeSm@s^R2-Vdk2Qd*Fm}FhM_BSdC

Output is in the form [R,x,y]
Try it online here, or verify all the test cases at once here.
hSm+.EeSm@s^R2-Vdk2Qd*Fm}FhM_BSdCQ   Implicit: Q=eval(input())
                                     Trailing Q inferred
                                CQ   Transpose (group x and y coordinates separately)
                       m             Map each in the above, as d, using:
                              Sd       Sort d
                            _B         Pair with its own reverse
                          hM           Take the first element of each, yielding [min, max]
                        }F             Generate inclusive range
                     *F              Cartesian product of the above two lists, yielding all coordinates in range
  m                                  Map each coordinate in the above, as d, using:
        m          Q                   Map each coordinate in input, as k, using:
              -Vdk                       Take the difference between x and y coordinates in d and k
           ^R2                           Square each
          s                              Sum
         @        2                      Take the square root
      eS                               Take the largest of the result
    .E                                 Rounded up
   +                d                  Prepend to d
 S                                   Sort the result, first element as most significant
h                                    Take first element

Edit: Saved a byte by rearranging output format, previous version:
heDm+d.EeSm@s^R2-Vdk2Q*Fm}FhM_BSdC

Wolfram Language (Mathematica), 66 bytes
Here's a brute force approach. I considered the much shorter BoundingRegion[#,"MinDisk"]& function but there is no way to force integer coordinates & radius.
Minimize[{r,RegionWithin[{x,y}~Disk~r,Point@#]},{x,y,r},Integers]&

Try it online!

Nice. But, how about {Round@#[[1]], Ceiling@#[[2]]} &@BoundingRegion[#, "MinDisk"]&?

@DavidC, the rounding of the center might move it by up to Sqrt[2]/2=.707 but taking the ceiling won't necessarily add enough length to the radius to counteract that. I think an example of that failing would be just the two points {{0,0},{11,11}}

I see what you mean!

Javascript, 245 bytes
a=>{[b,c,d,e]=a.reduce(([j,k,l,m],[h,i])=>[j>h?j:h,k<h?k:h,l>i?l:i,m<i?m:i],[,,,,]);for(f=c;f<b;f++){for(g=e;g<d;g++){s=a.reduce((o,[p,q])=>o>(r=(p-f)**2+(q-g)**2)?o:r);n=n?n[2]>s?[f,g,s]:n:[f,g,s]}}return [n[0],n[1],Math.ceil(Math.sqrt(n[2]))]}

(Somewhat) more readable version:
a=>{
    [b,c,d,e]=a.reduce(([j,k,l,m],[h,i])=>[j>h?j:h,k<h?k:h,l>i?l:i,m<i?m:i],[,,,,]);
    for(f=c;f<b;f++){
        for(g=e;g<d;g++){
            s=a.reduce((o,[p,q])=>o>(r=(p-f)**2+(q-g)**2)?o:r);
            n=n?n[2]>s?[f,g,s]:n:[f,g,s]
        }
    }
    return [n[0],n[1],Math.ceil(Math.sqrt(n[2]))]
}

Just finds the bounding box, and tests each coordinate in that box for whether it's the best.
I could save 8 bytes with an approximate answer, by replacing:
Math.ceil(Math.sqrt(n[2])) with ~~(n[2]+1-1e-9)

There are for sure more things to golf, but JS isn't my strong suite. Still, you can golf for(f=c;f<b;f++){for(g=e;g<d;g++){s=a.reduce((o,[p,q])=>o>(r=(p-f)**2+(q-g)**2)?o:r);n=n?n[2]>s?[f,g,s]:n:[f,g,s]}} to for(f=c;f<b;f++)for(g=e;g<d;n=n?n[2]>s?[f,g,s]:n:[f,g,s],g++)s=a.reduce((o,[p,q])=>o>(r=(p-f)**2+(q-g)**2)?o:r);. And I'm pretty sure you can remove the space at return[.

You can probably save a few bytes using Math.hypot.

Ruby, 113 bytes
->l{a=l.flatten;(z=*a.min..a.max).product(z).map{|x,y|[l.map{|u,v|(((x-u)**2+(y-v)**2)**0.5).ceil}.max,x,y]}.min}

Try it online!

Charcoal, 65 bytes
≔Ｅθ§ι¹ζ≔Ｅθ§ι⁰ηＦ…·⌊η⌈ηＦ…·⌊ζ⌈ζ⊞υ⟦ικ⟧≔Ｅυ⌈ＥθΣＥιＸ⁻§λξν²ηＩ§υ⌕η⌊ηＩ⌈Ｘ⌊η·⁵

Try it online! Link is to verbose version of code. Explanation:
≔Ｅθ§ι¹ζ

Get the y-coordinates into z.
≔Ｅθ§ι⁰η

Get the x-coordinates into h.
Ｆ…·⌊η⌈ηＦ…·⌊ζ⌈ζ⊞υ⟦ικ⟧

Loop over the inclusive ranges from the minimums to the maximums of h and z generating the list of all potential disc centres.
≔Ｅυ⌈ＥθΣＥιＸ⁻§λξν²η

Loop over all the disc centres, then loop over all of the original points, then loop over both coordinates, subtract, square, sum, take the maximum, and save the resulting list.
Ｉ§υ⌕η⌊η

Find the position of the minimal maximum diameter and print the corresponding disc centre.
Ｉ⌈Ｘ⌊η·⁵

Print the minimal maximum diameter, but round it up to the next integer.

source: Stack Exchange

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

sort: votes


text:
ASCII Art Octagons
Given an input integer n > 1, output an ASCII-art octagon with side lengths composed of n characters. See examples below:
n=2
 ##
#  #
#  #
 ##

n=3
  ###
 #   #
#     #
#     #
#     #
 #   #
  ###

n=4
   ####
  #    #
 #      #
#        #
#        #
#        #
#        #
 #      #
  #    #
   ####

n=5
    #####
   #     #
  #       #
 #         #
#           #
#           #
#           #
#           #
#           #
 #         #
  #       #
   #     #
    #####

and so on.

You can print it to STDOUT or return it as a function result.
Any amount of extraneous whitespace is acceptable, so long as the characters line up appropriately.
Rules and I/O

Input and output can be given by any convenient method.
You can use any printable ASCII character instead of the # (except space), but the "background" character must be space (ASCII 32).
Either a full program or a function are acceptable.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Can we use different output characters, or does it need to be consistent?

@Emigna Different characters are fine.

Quite related.

05AB1E, 3 bytes
7ÝΛ

Try it online!
Explanation
      # implicit input as length
      # implicit input as string to print
7Ý    # range [0...7] as directions
  Λ   # canvas print

See this answer to understand the 05AB1E canvas.

Surely this should be 5 bytes? Or do code golf challenges see bytes and characters as interchangeable

@Doug: It is 3 bytes in 05ab1e's code page

Oh, cool! Thanks for the docs link!

:( damnit, adnan

JavaScript (ES6), 114 106 105 104 103 bytes
n=>(g=x=>v=x*2>w?w-x:x,F=x=>~y?`#
`[~x?(h=g(x--))*g(y)>0&h+v!=n|n>h+v:(y--,x=w,2)]+F(x):'')(y=w=--n*3)

Try it online!
How?
This builds the output character by character.
Given the input \$n\$, we compute:
$$n'=n-1\\w=3n'$$
For each character at \$(x,y)\$, we compute \$(h,v)\$:
$$h=w/2-\left|x-w/2\right|\\v=w/2-\left|y-w/2\right|$$
The cells belonging to the octagon satisfy one of the following conditions:

(\$h=0\$ OR \$v=0\$) AND \$h+v\ge n'\$ (in red below)
\$h+v=n'\$ (in orange below)

For example, with \$n=4\$ (and \$n'=3\$):
$$\begin{matrix}(0,0)&(1,0)&(2,0)&\color{red}{(3,0)}&\color{red}{(4,0)}&\color{red}{(4,0)}&\color{red}{(3,0)}&(2,0)&(1,0)&(0,0)\\
(0,1)&(1,1)&\color{orange}{(2,1)}&(3,1)&(4,1)&(4,1)&(3,1)&\color{orange}{(2,1)}&(1,1)&(0,1)\\
(0,2)&\color{orange}{(1,2)}&(2,2)&(3,2)&(4,2)&(4,2)&(3,2)&(2,2)&\color{orange}{(1,2)}&(0,2)\\
\color{red}{(0,3)}&(1,3)&(2,3)&(3,3)&(4,3)&(4,3)&(3,3)&(2,3)&(1,3)&\color{red}{(0,3)}\\
\color{red}{(0,4)}&(1,4)&(2,4)&(3,4)&(4,4)&(4,4)&(3,4)&(2,4)&(1,4)&\color{red}{(0,4)}\\
\color{red}{(0,4)}&(1,4)&(2,4)&(3,4)&(4,4)&(4,4)&(3,4)&(2,4)&(1,4)&\color{red}{(0,4)}\\
\color{red}{(0,3)}&(1,3)&(2,3)&(3,3)&(4,3)&(4,3)&(3,3)&(2,3)&(1,3)&\color{red}{(0,3)}\\
(0,2)&\color{orange}{(1,2)}&(2,2)&(3,2)&(4,2)&(4,2)&(3,2)&(2,2)&\color{orange}{(1,2)}&(0,2)\\
(0,1)&(1,1)&\color{orange}{(2,1)}&(3,1)&(4,1)&(4,1)&(3,1)&\color{orange}{(2,1)}&(1,1)&(0,1)\\
(0,0)&(1,0)&(2,0)&\color{red}{(3,0)}&\color{red}{(4,0)}&\color{red}{(4,0)}&\color{red}{(3,0)}&(2,0)&(1,0)&(0,0)\end{matrix}
$$

Wow, this is awesome! I think $h + v \geq n'$ can be simplified to $h+v>n'$, although I'm not sure if that helps the golfing logic at all.

@Giuseppe It could indeed be simplified that way if both conditions were tested. But in the code, the cases $hv=0$ and $hv\neq0$ are separated. However, I'm actually testing the opposite condition ($n'>h+v$), which already is 1 byte shorter.

@Giuseppe Your comment prompted me to have a closer look at the formula and I finally saved a byte by writing it a bit differently. :)

heh, well your comment about $hv=0$ prompted me to go look at my port of your logic and save another couple of bytes!

Charcoal, 5 bytes
ＧＨ*Ｎ#

My first answer with Charcoal!
Explanation:
ＧＨ*Ｎ#      //Full program
ＧＨ          //Draw a hollow polygon
   *         //with 8 sides
    Ｎ       //of side length from input
      #      //using '#' character

Try it online!

For those who prefer verbose Charcoal, that's PolygonHollow(:*, InputNumber(), "#");.

Canvas, 15 14 12 bytes
／⁸⇵╷+×＋：⤢ｎ╬┼

Try it here!
Explanation:
/             a diagonal of length n
 ⁸            the input,
  ⇵           ceiling divided by 2, (storing the remainder)
   ╷          minus one
    #×        repeat "#" that many times
      +       append that to the diagonal
       :⤢n    overlap that with its transpose
          ╬┼  quad-palindromize with the overlap being the remainder stored earlier

Alternative 12-byter.

R, 122 117 115 bytes
function(n){n=n-1
m=matrix(0,y<-3*n+1,y)
v=t(h<-(w=3*n/2)-abs(row(m)-1-w))
m[h*v&h+v-n|h+v<n]=' '
write(m,1,y,,"")}

Try it online!
Ports the logic from Arnauld's answer, specifically this revision in case there are further improvements. Another 2 bytes saved thanks to Arnauld's suggestion of inverting the logic!

-2 bytes by doing it the other way around (I can't do h*v&h+v-n in JS because & is a bitwise operator; but it's a logical one in R, so that works).

Python 2, 96 bytes
a=b=n=input()
while a>2-n-n:a-=1;b-=a/~-n+1;s=(-~b*' '+'#').ljust(n);print s+s[-1]*(n-2)+s[::-1]

Try it online!

Python 2, 81 bytes
a=d=n=input()-1
while a<=n:print' '*a+'#'+' #'[a==n]*(3*n-a+~a)+'#';d-=1;a-=d/n+1

Try it online!

Python 2, 75 bytes
a=d=n=input()-1
while a<=n:print' '*a+`' `'[a==n]*(3*n-a+~a)`;d-=1;a-=d/n+1

Try it online!
If mixing output characters is OK.

Powershell, 91 bytes
param($n)($s=' '*--$n+'#'*$n+'#')
--$n..0+,0*$n+0..$n|%{' '*$_+"#$(' '*(3*$n-2*$_+2))#"}
$s

PowerShell, 107 97 bytes
param($n)($z=$n-1)..1+,0*$n+1..$z|%{" "*$_+"#"+($x=" "*($z-$_))+(" ","#")[!($_-$z)]*($n-2)+"$x#"}

Try it online!
If there was a cheap way to reverse the first half, this answer would feel a lot better. It builds the left half, then the core (which is either x #'s or spaces), then mirrors the left's logic to make the right. Fun fact, you don't need to copy over trailing white-space.
Unrolled and explained:
param($n)
($z=$n-1)..1 + ,0*$n + 1..$z |%{  #Range that repeats 0 n times in the middle
" "*$_ + "#" +($x=" "*($z-$_)) +  #Left side
(" ","#")[!($_-$z)]*($n-2) +      #Core that swaps when it's the first or last row
"$x#"}                            #Right side which is left but backwards

C (clang), -DP=printf( -DF=for(i + 179 = 199 180 bytes
i;*m="%*s%*s\n";g(n){P"%*s",n,H;F;--i;)P H;P"\n");}f(n){g(n);F;--i;)P m,i,(H,3*n-i+~i,H;F-2;i--;)P"#%*s\n",3*n-3,H;F;--i;)P m,n-i,(H,n+i+i-1,H;g(n);}

Try it online!
Ungolfed:

f(n){
	int i;
	printf("%*d",n,0);
	for(i=0;i<n-1;i++){
		printf("0");
	}
	printf("\n");
	for(i=1;i<n;i++){
		printf("%*d%*d\n",n-i,0,n+i+i-1,0);
	}
	for(i=0;i<n-2;i++){
		printf("0%*d\n",n+n+n-3,0);
	}
	for(i=n-1;i>0;i--){
		printf("%*d%*d\n",n-i,0,n+i+i-1,0);
	}
	printf("%*d",n,0);
	for(i=0;i<n-1;i++){
		printf("0");
	}
}

-19 bytes thanks to @ceilingcat

173 bytes

APL (Dyalog Unicode), 46 bytesSBCS
(' '@~5 6∊⍨1⊥⊢∘,)⌺3 3⊢<(⍉⌽⌊⊢)⍣2∘(∘.+⍨∘⍳¯2+3×⊢)

This solution was provided by Adám - thanks!
Try it online!
My (almost) original solution:
APL (Dyalog Unicode), 61 bytesSBCS
(((⊃∘' #'¨1+5∘=+6∘=)⊢)1⊥⊢∘,)⌺3 3⊢<(((⊖⌊⊢)⌽⌊⊢)(∘.+⍨(⍳¯2+3×⊢)))

Try it online!
Thanks to Adám for his help!
The idea is to find the "diamond" that lies partly in the square and apply an edge-detect filter to "outline" the octagone.

46: (' '@~5 6∊⍨1⊥⊢∘,)⌺3 3⊢<(⍉⌽⌊⊢)⍣2∘(∘.+⍨∘⍳¯2+3×⊢)

You can't actually use Classic here because of ⌺. Rather count 1 byte/char by referring to SBCS as per Meta.

@Adám Thanks! I don't know how to edit the header, can you do it for me?

What do you mean by editing the header?

@Adám I don't know if  "APL (Dyalog Classic)SBCS" is ok

Edit and copy from here.

Perl 5, 176 bytes
$f=$a=<>;$b=3*$a-4;$c='$"x($e-$_)."#".$"x$f."#\n"';$e=$a-1;$d=$"x$e."#"x$a.$/;print$d,(map{(eval$c,$f+=2)[0]}1..$a-2),("#".$"x$b."#\n")x$a,(map{$f-=2;eval$c}reverse 1..$a-2),$d

Based on Nathan Mills' answer above (which I have insufficient rep to comment on!).
$e can be simplified to $a-1 saving 6 bytes;
$f can be chain assigned; saving two bytes;
Not sure where the other two come from!
While $e can be replaced with $a-1 in the two places it occurs, the extra brackets needed means this only breaks even.
Ungolfed:
$f = $a = <>;
$b = 3 * $a - 4;
$c = '$"x($e-$_)."#".$"x$f."#\n"';
$e = $a - 1;
$d = $" x $e . "#" x $a . $/;
print $d, ( map { ( eval $c, $f += 2 )[0] } 1 .. $a - 2 ),
  ( "#" . $" x $b . "#\n" ) x $a,
  ( map { $f -= 2; eval $c } reverse 1 .. $a - 2 ), $d

Python 2, 130 bytes
def f(n):
 a=[' '*~-n+n*'#']
 b=[' '*(n-i-2)+'#'+' '*(n+2*i) +'#'for i in range(n-2)]
 return a+b+['#%*s'%(3*n-3,'#')]*n+b[::-1]+a

Try it online!
On mobile, so not incredibly golfed.

You can remove the space after (n+2*i).

Batch, 260 bytes
@echo off
set s=
for /l %%i in (1,1,%1)do call set s= %%s%%
echo %s% %s: =#%
call:c %1,-1,3
for /l %%i in (1,1,%1)do echo   #%s:~2%%s%%s:~2%#
call:c 3,1,%1
echo %s% %s: =#%
exit/b
:c
for /l %%i in (%*)do call echo %%s:~,%%i%%#%%s:~%%i%%%s%%%s:~%%i%%#

Outputs two leading spaces on each line. Explanation: Batch has no string repetition operator, limited string slicing capability and requires separate statements to perform arithmetic. It was therefore golfiest to make up a string of the input length in spaces (Batch can at least translate these to #s for the top and bottom lines) and then slice from or to a specific position ranging from 3 to the length to generate the diagonals (this is what the last line of the script achieves).

Ruby, 96 bytes
->n{[*(n-=2).step(z=n*3+2,2),*[z]*n,*z.step(n,-2)].map{|x|([?#]*2*('# '[x<=>n]*x)).center(z+2)}}

Try it online!
Not very golfed yet. Might golf if I find the time.

Red, 171 bytes
func[n][c:(a: n - 1)* 2 + n
b: collect[loop c[keep pad/left copy"^/"c + 1]]s: 1x1 s/1: n
foreach i[1x0 1 0x1 -1x1 -1x0 -1 0x-1 1x-1][loop a[b/(s/2)/(s/1): #"#"s: s + i]]b]

Try it online!
Explanation:
Red[]
f: func [ n ] [
    a: n - 1                                         ; size - 1
    c: a * 2 + n                                     ; total size of widht / height
    b: collect [                                     ; create a block
        loop c [                                     ; composed of size - 1 rows
            keep pad/left copy "^/" c + 1            ; of empty lines of size c (and a newline)
        ]
    ]
    s: a * 1x0 + 1                                   ; starting coordinate
    foreach i [ 1x0 1 0x1 -1x1 -1x0 -1 0x-1 1x-1 ] [ ; for each offset for the 8 directions
        loop a [                                     ; repeat n - 1 times
            b/(s/2)/(s/1): #"#"                      ; set the array at current coordinate to "#"
            s: s + i                                 ; next coordinate
        ]
    ]
    b                                                ; return the block
]

Perl 5, 201 197 188 187 186 bytes:
$a=<>;$b=3*$a-4;$c='$"x($e-$_)."#".$"x$f."#\n"';$e=($b-$a)/2+1;$d=$"x$e."#"x$a.$/;$f=$a;print$d,(map{(eval$c,$f+=2)[0]}1..$a-2),("#".$"x$b."#\n")x$a,(map{$f-=2;eval$c}reverse 1..$a-2),$d

Try it online!
Reads the size of the octagon from first line of STDIN.

Welcome to PPCG! You can probably shave off a few bytes here and there by using tricks found in this post.

@Mego Yep. I was able to save 4 bytes by using $" instead of " ".

C (gcc), 158 153 150 bytes

Saved five eight bytes thanks to ceilingcat.

O,c,t,g;o(n){for(O=2*~-n,t=c=O+n;t--;puts(""))for(g=c;g--;)putchar(33-(!t|t>c-2?g<n-1|g>O:t<n-1|t>O?t+O-g&&t-O-g&&~c+g+t+n+n&&c-g-t+n-3+n:g&&g<c-1));}

Try it online!

@ceilingcat Thank you.

Perl 6, 76 73 bytes
-3 bytes thanks to Jo King
{(' 'x$_-1~\*x$_,{S/.\S(.)+/* {' 'x$0}*/}...*)[^$_,$_ xx$_-2,[R,] ^$_;*]}

Try it online!
Returns a list of lines.

Vyxal RM, 4 bytes
S7ø∧

Try it Online!
new canvas builtin go brr

Python 3, 224 bytes
n=int(input())
z=" "*(n-1)+"#"*n+" "*(n-1)
print(z)
for i in range(n-2):print(" "*(n-i-2)+"#"+" "*(i*2+n)+"#")
print((("#"+" "*(n*3-4)+"#\n")*n)[:-1])
for i in range(n-3,-1,-1):print(" "*(n-i-2)+"#"+" "*(i*2+n)+"#")
print(z)

Try it online!

Perl 5, 170 168 166 bytes
$a=<>-1;$\="#\n";print$x=$_=$"x$a."#"x$a;if(s/^( *)  #*/$1 #  $1 /){print}while (s/ #/#  /){print}$z=$_;for(1..$a){print$_=$z}while(s/#  (\s{$a})/ #$1/){print}print$x

This works by the magic of regex.  The "if" is only needed to deal with the pathological case of n=2, which otherwise outputs something like:
 ##
 ##
#  #
 ##

probably this can be coded away.
I think there may be a lot more to gain by creating a string up to the mid-point then reversing it.  Of course we then need to insert/delete an extra space if n is odd (or use thin-space :p).
Ungolfed
$a = <> -1;                          # Subtracting one is very useful!
$\ = "#\n";                          # Every line ends with a '#' let perl provide.
$x=$_ = " " x $a. "#" x $a;          # The horiz line (one short)
print;                               # print it plus the extra #
if(s/^( *)  #*/$1 #  $1 /){print}    # create a hole and remove a leading space(if n=2 this fails)
while (s/ #/#  /){                   # make the hole bigger
    print;                           # and print (with a trailing #)
}
$z=$_;                               # store $_ for later use
for (1 .. $a) {                      # nice that we don't have to do 2..$a but not golf-nice
  $_ =$z;                            # restore $_ (we could use $z but since we have
  print;                             # to restore somewhere, doing  it here saves us bytes)
}
while (s/#  (\s{$a})/ #$1/){         # now move the # to the right and reduce the trailing spaces
  print;
}
print $x;                            # and finish...

I think this can probably be golfed a bit more, quite apart from significant changes like pushing onto $@ and printing that at the end.
[Golfed spaces around .. and moved print before assigns in two cases, saving on semicolons.]

saved 20 bytes reordering some instructions TIO, why \s and not just a space in last regex

J, 59 45 41 bytes
h=.|.,],~,:@{.#~_2+#
' #'{~h@|.@|:@h@=@i.

Try it online!
Will add explanation tonight.

Perl 5, 98 bytes
$_=2x$_.1x$_.$/;s/2//;s/.$/ #/,y/1/ /while$a.=$_,$b=$_.$b,s/2[#1]/# /;$_=$a.$_ x("@F"-2).$b;y/2/ /

TIO

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


text:
Professor at MIT needs an AP!
The 5-card magic trick involves a magician whose assistant gives them 4 shown cards and a hidden one, in this order, and the magician must guess the hidden one.
WARNING: Solution below! Leave now or get spoiled with it.

The solution
The trick here is that the five cards are given in a specific order!
\$c_1,...,c_5\$ are the 5 cards in the given order.
\$x_n\$ is the card number of \$c_n\$ in \$NO=[\text{A,2,3,4,5,6,7,8,9,T,J,Q,K}]\$ (number order).
\$a+b\$, where \$a\$ is a card number and \$b\$ is an integer, is equal to the card number \$b\$ steps to the right of \$a\$ in \$NO\$, wrapping to the beginning if necessary.
\$s_n\$ is the suit of \$c_n\$ in \$SO=[\clubsuit,\diamondsuit,\heartsuit,\spadesuit]\$ (suit order).
\$a\circ b\$, where \$a\$ is a card number and \$b\$ is a suit, denotes the card with card number \$a\$ and suit \$b\$.
\$a<b\$, where \$a\$ and \$b\$ are cards, is true if \$a\$'s suit is to the left of \$b\$'s suit in \$SO\$, or their suits are equal and \$a\$'s card number is to the left of \$b\$'s card number in \$NO\$.
\$a>b\$, where \$a\$ and \$b\$ are cards, is true if \$a<b\$ is false.
\$PI(a,b,c)\$, where \$a\$, \$b\$ and \$c\$ are cards, is the permutation index of this ordering of them, specified by the table below:
\$\begin{array}{|c|c|}\hline\text{Comparison}&PI(a,b,c)\\\hline a<b<c&1\\\hline a<b>c>a&2\\\hline a>b<c>a&3\\\hline a<b>c<a&4\\\hline a>b<c<a&5\\\hline a>b>c&6\\\hline\end{array}\$
The solution to the 5-card magic trick is problem is:$$c_5=(x_1+PI(c_2,c_3,c_4))\circ s_1$$
The challenge
So far, so good. However, doing the computation specified above is already asked for here. Instead, your challenge is, given the 5 cards in no specific order, to order them properly. This means that the first four cards in the output will represent the fifth. In other words, be the assistant. Requirements:

\$s_5=s_1\$.
\$x_5=x_1+PI(c_2,c_3,c_4)\$ (that is, this must be possible).

Example
Let's consider the set 7H,2D,6D,5C,6C. First of all, we take the 25 pairs:
7H,7H 7H,2D 7H,6D 7H,5C 7H,6C
2D,7H 2D,2D 2D,6D 2D,5C 2D,6C
6D,7H 6D,2D 6D,6D 6D,5C 6D,6C
5C,7H 5C,2D 5C,6D 5C,5C 5C,6C
6C,7H 6C,2D 6C,6D 6C,5C 6C,6C

Then, we obviously remove the 5 pairs that contain the same card twice, they don't exist in a single deck:
      7H,2D 7H,6D 7H,5C 7H,6C
2D,7H       2D,6D 2D,5C 2D,6C
6D,7H 6D,2D       6D,5C 6D,6C
5C,7H 5C,2D 5C,6D       5C,6C
6C,7H 6C,2D 6C,6D 6C,5C

Afterwards, since the suits must be the same, different suits in a pair is a no-no:

            2D,6D
      6D,2D
                        5C,6C
                  6C,5C
Finally, we check if it's possible to get from the first card to the second by adding at most 6, removing half of the remaining pairs:

            2D,6D

                        5C,6C

Now we have the valid pairs: 2D,6D and 5C,6C. The first card of each pair is card 1, while the last is card 5.
We're going to go with 5C,6C here for easiness. The whole set is 7H,2D,6D,5C,6C, so, removing the 2 cards in the pair we've chosen, we have 7H,2D,6D. These cards will represent 6 - 5 = 1, so we have to order them like "min, mid, max". 7H > 2D < 6D < 7H, or simply 2D < 6D < 7H, so we now have 2D,6D,7H.
The last step is to put all of this together, so our result will be 5C,2D,6D,7H,6C.
Clarifications

You may use 10 instead of T.
You may use one of ♠♥♦♣, ♤♡♢♧ or ♠♡♢♣ instead of CDHS, respectively.
This is code-golf, the shortest code wins.

Test cases
You can output one or more of the valid solutions included for each test case.
8S,TD,5C,QS,TS -> 8S,5C,QS,TD,TS
              ... 8S,TD,TS,5C,QS
              ... TS,5C,8S,TD,QS

JD,KH,4S,9D,8S -> 9D,KH,8S,4S,JD
              ... 4S,JD,KH,9D,8S

4H,4D,TH,KH,2C -> 4H,KH,4D,2C,TH
              ... TH,4D,2C,4H,KH
              ... KH,4D,TH,2C,4H

3S,KS,8S,KH,9H -> 9H,8S,KS,3S,KH
              ... 3S,KS,9H,KH,8S
              ... 8S,3S,9H,KH,KS
              ... KS,KH,9H,8S,3S

KH,TS,3C,7H,JD -> 7H,TS,JD,3C,KH

4C,KC,TD,JD,QS -> KC,JD,QS,TD,4C
              ... TD,4C,KC,QS,JD

AC,5H,8D,6D,8S -> 6D,AC,8S,5H,8D

AS,TC,3S,2H,9C -> 9C,2H,AS,3S,TC
              ... AS,9C,2H,TC,3S

4C,JS,AS,8H,JC -> JC,JS,AS,8H,4C
              ... JS,JC,4C,8H,AS

4H,QS,TH,QC,AC -> QC,4H,QS,TH,AC
              ... 4H,QS,QC,AC,TH

It might be easier to visualize the permutations by adding an Example column.

magic - A five card trick - How does it work? - Puzzling Stack Exchange

How lenient is input? Are tuples of card number and house instead of length-2 strings acceptable?

@Οurous That's not specified in the challenge; as long as it's reasonable (in your case, that seems reasonable enough), it's allowed.

Node.js, 190 186 180 bytes
f=(a,p,g=c=>"A23456789TJQK".search(c[0])+10,[A,B,C,D,E]=a.sort(_=>p>>i++&1,i=0))=>A[k=1]!=E[1]|[B,C,D].sort((a,b)=>k=k*2|a[1]+g(a)>b[1]+g(b))|(k^4)%6+1-(g(E)-g(A)+13)%13?f(a,-~p):a

Try it online!
How?
Identifying and comparing the card numbers
The helper function \$g\$ returns an index representing the number of a given card.
g = c => "A23456789TJQK".search(c[0]) + 10

We add \$10\$ to force two digits for all entries, so that these indices can be safely sorted in lexicographical order. Therefore an Ace is \$10\$ and a King is \$22\$.
Given 2 cards \$a\$ and \$b\$ in "NS" format, we can compare them by suit first and number second with:
a[1] + g(a) > b[1] + g(b)

Generating the permutations of the input
We recursively try all \$120\$ possible permutations of the input array \$a\$ by successively sorting it with different permutation seeds \$p\$. The cards are separately loaded into \$A\$, \$B\$, \$C\$, \$D\$ and \$E\$.
[A, B, C, D, E] = a.sort(_ => p >> i++ & 1, i = 0)

This code shows when each permutation is first encountered. It takes \$699\$ iterations to try all of them.
Testing the suits
The first obvious test is to make sure that the first and last cards are of the same suit. We reject the permutation if they're not equal.
A[k = 1] != E[1] // we also initialize k, which is used right after that

Testing the distance
We compute the distance between the first card number and the last card number with:
(g(E) - g(A) + 13) % 13

Now comes the most tricky part. We have to test whether the order of the 3 other cards (\$B\$, \$C\$ and \$D\$) correctly describes this distance.
This test relies on the way the sort() algorithm of Node.js is working.
Assuming that the callback function of sort() is always returning a positive integer, Node.js will sort the array \$[A,B,C]\$ by applying these 3 steps:

compare \$A\$ with \$B\$
compare \$A\$ with \$C\$
compare \$B\$ with \$C\$

Let's consider the following code:
[1, 2, 3].sort((a, b) => k = k * 2 | (a > b), k = 1)

We have \$A<B\$ (\$1<2\$), \$A<C\$ (\$1<3\$) and \$B<C\$ (\$2<3\$). All comparisons processed in the callback function are falsy and \$k\$ is simply multiplied by \$2^3\$. So, we end up with \$k=8\$.
Now, if we do:
[3, 2, 1].sort((a, b) => k = k * 2 | (a > b), k = 1)

All comparisons are now thruthy, which generates the bitmask \$k=15\$.
Each permutation generates a unique bitmask, which is mapped to a unique distance:
 A, B, C | A>B | A>C | B>C | k  | distance
---------+-----+-----+-----+----+----------
 1, 2, 3 |  0  |  0  |  0  |  8 |    1
 1, 3, 2 |  0  |  0  |  1  |  9 |    2
 2, 1, 3 |  1  |  0  |  0  | 12 |    3
 2, 3, 1 |  0  |  1  |  1  | 11 |    4
 3, 1, 2 |  1  |  1  |  0  | 14 |    5
 3, 2, 1 |  1  |  1  |  1  | 15 |    6

Given \$k\$, we can convert it to the distance by doing:
$$d=((k\operatorname{xor}4)\bmod 6)+1$$
  k | xor 4 | mod 6 | +1
----+-------+-------+----
  8 |   12  |   0   |  1
  9 |   13  |   1   |  2
 12 |    8  |   2   |  3
 11 |   15  |   3   |  4
 14 |   10  |   4   |  5
 15 |   11  |   5   |  6

Putting everything together, we have the following test:
[B, C, D]
.sort((a, b) =>
  k = k * 2 | a[1] + g(a) > b[1] + g(b)
)
| (k ^ 4) % 6 + 1
- (g(E) - g(A) + 13) % 13

Python 3,  260 248  232 bytes
N="A23456789TJQK".find
D=lambda x,y="KC":(N(y[0])+~N(x[0]))%13+15*abs(ord(x[1])-ord(y[1]))
def f(l):a,e,b,c,d=[[x,y]+sorted({*l}-{x,y},key=D)for x in l for y in l if D(x,y)<6][0];print(a,*map(eval,"bbccddcdbdbcdcdbcb"[D(a,e)::6]),e)

Try it online!
-12 bytes thanks to Eric the Outgolfer
-14 bytes by removing a list comprehension

Clean, 225 220 209 bytes
import StdEnv,Data.List
n=['A23456789TJQK':n]

filter(\[[x,s],b,c,d,e]#[p,q,r:_]=map snd(sort(zip2[(elemIndices a n,b)\\[a,b]<-[b,c,d]][1..]))
=[snd(span((<>)x)n)!!(p+if(p>q)0if(q<r)(q+r)q),s]==e)o permutations

Try it online!
As a composed function, :: [[Char]] -> [[Char]], with some helpers.
Expanded:
n = ['A23456789TJQK': n] // infinitely repeating card number list

filter (...) o permutations // filter the permutations of the argument by ...
  \[[x, s], b, c, d, e] // deconstruct each permutation via pattern matching
    #[p, q, r: _] = ... // define p, q, r as ...
      map snd (...) // the second component of every element in ...
      sort (...) // the sorted list of ...
      zip2 ... [1..] // pairs of ... and the numbers 1, 2, 3, ..
      [... \\ [a, b] <- [b, c, d]] // ... for every pair of number a and house b in [b, c, d]
      (elemIndices a n, b) // pair of the value of that card number and the house
    = ... == e // check ... for equality against the last card
      [..., s] // ..., paired with house s
      snd (span ((<>) x) n) !! (...) // the card number ... places from x
      p + ... // this is kinda obvious
      if(p > q) 0 ... // if p is greater than q, zero, else ...
      if(q < r) (q + r) q // if q is less than r, q + r, else q

Ruby, 175 bytes
->a{g=->j{j.tr('ATJQKCHS','1:;<=)_z').sum}
e=b=a.sort_by{|i|g[i]}
4.times{|i|(d=g[b[i+1]]-g[b[i]])<13&&(a=b[i,2];e=d)}
[a[e/7],*(b-a).permutation.to_a[e<7?e-1:12-e],a[e/7-1]]}

Try it online!
A lambda function taking an array of cards as strings
Commented
->a{g=->j{j.tr('ATJQKCHS','1:;<=)_z').sum}
#helper function converts card to integer, ATJQK to 1:;<= and CHS to )_z then sum ascii values

e=b=a.sort_by{|i|g[i]}
#sort according to g. we declare 2 variables here in order to avoid undefined variable error at pre-interpretation check stage.

4.times{|i|(d=g[b[i+1]]-g[b[i]])<13&&(a=b[i,2];e=d)}
#compare each pair of values. if in same suit, store the pair of cards to a
#and the value difference to e. Loop exits with the last suitable pair stored

[a[e/7],*(b-a).permutation.to_a[e<7?e-1:12-e],a[e/7-1]]}
#return array containing the two cards of the same suit in the correct order
#with the correct permutation of the remaining cards (b-a) in the middle

Jelly, 41 bytes
ØD;“TJQK”¤io2)1¦€µUḊỤ3R¤œ¿+""Om4%13E
Œ!ÇƇ

A monadic Link accepting a list of lists of characters returning a list of all valid arrangements in the same format.
Try it online! (footer formats the result as a grid to avoid the implicit smashing print as performed by the Link's code when run as a full program)
Or see a test-suite.
I have a sneaking suspicion another approach will be much more terse. I shall have to revisit this challenge later!
...hmm, I had another poke around and got another 41 byter (test):
O¹*@<74$?€€29%⁽:0%⁴UµṪ_Ḣ%13Ḍ⁼Ụ3R¤œ¿Ɗ
Œ!ÇƇ


text:
Count arrays that are really unique
This is a follow up to Count arrays that make unique sets . The significant difference is the definition of uniqueness.
Consider an array A of length n. The array contains only positive integers.  For example A = (1,1,2,2).  Let us define f(A) as the set of sums of all the non-empty contiguous subarrays of A. In this case f(A) = {1,2,3,4,5,6}.  The steps to produce f(A)  are as follows:
The subarrays of A are (1), (1), (2), (2), (1,1), (1,2), (2,2), (1,1,2), (1,2,2), (1,1,2,2). Their respective sums are 1,1,2,2,2,3,4,4,5,6. The set you get from this list is therefore {1,2,3,4,5,6}.
We call an array A unique if there is no other array B of the same length such that f(A) = f(B), except for the array A reversed. As an example, f((1,2,3)) = f((3,2,1)) = {1,2,3,5,6} but there is no other array of length 3 that produces the same set of sums.
Task
The task, for a given n and s is to count the number of unique arrays of that length.  You can assume that s is between 1 and 9. You only need to count arrays where the elements are either a given integer s or s+1. E.g. if s=1 the arrays you are counting only contain 1 and 2.  However, the definition of uniqueness is with respect to any other array of the same length. As a concrete example [1, 2, 2, 2] is not unique as it gives the same set of sums as [1, 1, 2, 3].
You should count the reverse of an array as well as the array itself (as long as the array is not a palindrome of course).
Examples
s = 1, the answers for n = 2,3,4,5,6,7,8,9 are:
4, 3, 3, 4, 4, 5, 5, 6

For s = 1, the unique arrays of length 4 are
(1, 1, 1, 1)
(2, 1, 1, 2)
(2, 2, 2, 2)

s = 2, the answers for n = 2,3,4,5,6,7,8,9 are:
4, 8, 16, 32, 46, 69, 121, 177

An example of an array that is not unique with s = 2 is:
(3, 2, 2, 3, 3, 3).

This has the same set of sums as both of: (3, 2, 2, 2, 4, 3) and (3, 2, 2, 4, 2, 3).
s = 8, the answers for n = 2,3,4,5,6,7,8,9 are:
4, 8, 16, 32, 64, 120, 244, 472

Score
For a given n, your code should output the answer for all values of s from 1 to 9. Your score is the highest value of n for which this completes in one minute.
Testing
I will need to run your code on my ubuntu machine so please include as detailed instructions as possible for how to compile and run your code.
Leaderboard

n = 13 by Christian Sievers in Haskell (42 seconds)

How much memory are we allowed to consume?

@BlackOwlKai My machine has 8GB so I guess 6GB is safe?

I think the last number in the examples should be 472 instead of 427.

@ChristianSievers Thank you. Fixed now.

What is s? What does it represent?

@Gigaflop "You only need to count arrays where the elements are either a given integer s or s+1. E.g. if s=1 the arrays you are counting only contain 1 and 2. "

@Anush Did you notice the updated version? I think it's worth redoing the timing. Of course I'll understand when you won't: we all have other things to do.

Haskell
import Control.Monad (replicateM)
import Data.List (tails)
import qualified Data.IntSet as S
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as V
import Data.Vector.Unboxed.Mutable (write)
import System.Environment (getArgs)
import Control.Parallel.Strategies

orig:: Int -> Int -> M.Map S.IntSet (Maybe Int)
orig n s = M.fromListWith (\ _ _ -> Nothing)
               [(sums l, Just $! head l) |
                   l <- replicateM n [s, s+1],
                   l <= reverse l ]

sums :: [Int] -> S.IntSet
sums l = S.fromList [ hi-lo | (lo:r) <- tails $ scanl (+) 0 l, hi <- r ]

construct :: Int -> Int -> S.IntSet -> [Int]
construct n start set =
   setmax `seq` setmin `seq` setv `seq`
   [ weight r | r <- map (start:) $ constr (del start setlist)
                                           (V.singleton start)
                                           (n-1)
                                           (setmax - start),
                r <= reverse r ]
  where
    setlist = S.toList set
    setmin = S.findMin set
    setmax = S.findMax set
    setv = V.modify (\v -> mapM_ (\p -> write v p True) setlist)
                    (V.replicate (1+setmax) False)

    constr :: [Int] -> V.Vector Int -> Int -> Int -> [[Int]]
    constr m _ 0 _ | null m    = [[]]
                   | otherwise = []
    constr m a i x =
         [ v:r | v <- takeWhile (x-(i-1)*setmin >=) setlist,
                 V.all (V.unsafeIndex setv . (v+)) a,
                 let new = V.cons v $ V.map (v+) a,
                 r <- (constr (m \\\ new) $! new) (i-1) $! (x-v) ]

del x [] = []
del x yl@(y:ys) = if x==y then ys else if y<x then y : del x ys else yl

(\\\) = V.foldl (flip del)

weight l = if l==reverse l then 1 else 2

count n s = sum ( map value [ x | x@(_, Just _) <- M.toList $ orig n s]
                      `using` parBuffer 128 rseq )
  where
    value (sms, Just st) = uniqueval $ construct n st sms
    uniqueval [w] = w
    uniqueval _   = 0

main = do
  [ n ] <- getArgs
  mapM_ print ( map (count (read n)) [1..9]
                    `using` parBuffer 2 r0 )

The orig function creates all the lists of length n with entries s or s+1, keeps them if they come before their reverse, computes their sublist sums and puts those in a map which also remembers the first element of the list. When the same set of sums is found more than once, the first element is replaced with Nothing, so we know we don't have to look for other ways to get these sums.
The construct function searches for lists of given length and given starting value that have a given set of sublist sums. Its recursive part constr follows essentially the same logic as this, but has an additional argument giving the sum the remaining list entries need to have. This allows to stop early when even the smallest possible values are too big to get this sum, which gave a massive performance improvement. Further big improvements were obtained by moving this test to an earlier place (version 2) and by replacing the list of current sums by a Vector (version 3 (broken) and 4 (with additional strictness)). The latest version does the set membership test with a lookup table and adds some more strictness and parallelization.
When construct has found a list that gives the sublist sums and is smaller than its reverse, it could return it, but we are not really interested in it. It would almost be enough to just return () to indicate its existence, but we need to know if we have to count it twice (because it is not a palindrome and we'll never handle its reverse). So we put 1 or 2 as its weight into the list of results.
The function count puts these parts together. For each set of sublist sums (coming from orig) that was unique amongst the lists containing only s and s+1, it calls value, which calls construct and, via uniqueval, checks if there is only one result. If so, that is the weight we have to count, otherwise the set of sums was not unique and zero is returned. Note that due to lazyness, construct will stop when it has found two results.
The main function handles IO and the loop of s from 1 to 9.
Compiling and Running
On debian this needs the packages ghc, libghc-vector-dev and libghc-parallel-dev. Save the program in a file prog.hs and compile it with ghc -threaded -feager-blackholing -O2 -o prog prog.hs. Run with ./prog <n> +RTS -N where <n> is the array length for which we want to count the unique arrays.

This code is pretty amazing (and short!). If you could add some explanation I am sure people would love to understand what you have done.

Your new version doesn't compile for me. I get https://bpaste.net/show/c96c4cbdc02e

Sorry, deleting and pasting bigger code is so uncomfortable that I sometimes just change the few lines by hand. Of course I made a mistake... Fixed now (I hope), and added another improvement, this time only for a few percent. The other changes were much more important.


text:
Colors weave into a spire of flames
https://www.youtube.com/watch?v=6vAhPeqlODg
Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th
Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb values, and turn it into a flame color(heyy see what I did there?)
to turn an average hex number n(0-255) to a "flame color"
you must return a string #rgbwith:
r = n
g = n - 144(the 144 is decimal, hex is 0x90) or if n - 144 is <0, then g = 0
b = 0
Given this is smash, we have to have items off. So no using arrays, maps, or sets(don't get into semantics about how strings are just abstracted arrays, I don't want to hear it)

Standard Loopholes are prohibited
Acceptable answers: a function which takes input through one input
string and returns one output string
If the input string doesn't match the requirements provided above,
your code MUST error out(doesn't matter what kind of Exception or
Error)
This is code-golf, so the shortest(valid)answer (in each language)
wins!
Bonus points for a one-liner  (Not really tho, just cool points)

Hiya, Michael! This is a nice idea for a challenge. I want to let you know that our community has accumulated some Things to avoid when writing challenges over time, and among them are “answer must be a function”, “do X without Y” (i.e. banning arrays and maps) and input validation.

You can read some pretty good cases under those links for why we've found those things generally detract from a challenge, or keep certain languages from competing. (Often they are “loaded” in a way that makes them not even make sense for all languages: for example, there's literally no distinction between strings and arrays of characters in many languages. Either way, it's such a blurred line, and all the bickering hasn't ever been worth it.)

I suggest you allow answers to perform I/O in whatever manner is convenient, with whatever tools they need, and I suggest you allow answers to assume that the input string they're given is always valid. That way, the “heart” of the task (the operation on #rrggbb strings) can really shine!

That said, the only unclear portion of the task I can put my finger on is whether we should compute (r+g+b)/3 rounding down to zero, or to the nearest integer. It's also always a good idea to include some test cases: example inputs along with the expected output. (In the future, the Sandbox can help you iron this stuff out in advance. It's really nifty!) Ack, I hope that all isn't too overwhelming! Welcome to PPCG. ^^

I find the description semi-incoherent. Has it lost a paragraph or two of background / context?

@Peter Taylor have you seen the new Nintendo direct?

No. Perhaps you could add an introductory paragraph explaining the relevance and linking to further information.

Perl 6, 108 bytes
{[$!=S/^\#(<[\d|A..F]>**2)**3$/{"#"~[~] ((sum("0x"X~$0)/3 X-0,144,255)Xmax 0)>>.fmt("%02x")}/,1/0][$! eq$_]}

Try it online!
Anonymous code block that takes a string and returns a string if it is in a valid format, or a div by zero error otherwise. Though I'm not really sure how you're defining arrays,maps or sets, since my code uses sequences (Seq) and Matchs...

Red, 96 bytes
func[s][c: hex-to-rgb do s n: c/1 + c/2 + c/3 / 3
to-hex/size n * 65536 +(256 * max 0 n - 144)6]

Note:
It doesn't work in TIO (doesn't recognize hex-to-rgb- maybe it is not implemented for  Linux yet).
Tests within the Red console:
(first 3 taken from Jo King - thanks!):
>> print f "#012345"
#230000
>> print f "#6789AB"
#890000
>> print f "#AA89AB"
#9F0F00
>> print f "code golf"
*** Script Error: code has no value
*** Where: do
*** Stack: f hex-to-rgb


text:
The first, the last, and everything between
Given two integers, output the two integers, and then the range between them (excluding both).
The order of the range must be the same as the input.
Examples:
 Input        Output
 0,  5   ->   [0, 5, 1, 2, 3, 4]
-3,  8   ->   [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
 4,  4   ->   [4, 4]
 4,  5   ->   [4, 5]
 8,  2   ->   [8, 2, 7, 6, 5, 4, 3]
-2, -7   ->   [-2, -7, -3, -4, -5, -6]

I guess we can't take the inputs in pre-ordered order?

@KevinCruijssen, no, the output order depends on the input order

@StewieGriffin, the output order has to be the same as the input

Is this output format acceptable? Note the newline

@LuisMendo I'll allow it :)

I assume a space or newline delimited string is also allowed as output, instead of an actual array/list/stream?

@KevinCruijssen Any reasonable I/O is acceptable.

The spec (which just uses the word "between") seems to allow the repetition of the extremities of the inclusive range, but the examples assume that this range is exclusive. So is 2 5 2 3 4 5 actually a valid output for 2,5? (I think people have just been assuming "no").

Is it acceptable if we take input in strictly reversed order? so e.g. [5,1] -> [1,5,2,3,4] and [1,5] -> [5,1,4,3,2]. Basically, it preserves that the input order matters, and it gives the correct result for a pair of "first input" and "second input", but the actual input format is [second,first].

@JonathanAllan No ;)

@KamilDrakari That's okay

Can I do something like (0,5,(1,2,3,4))?

R, 39 33 30 bytes
c(a<-scan(),setdiff(a:a[2],a))

Try it online!
Thanks for saved bytes to user2390246 and J.Doe.

You could save a few bytes by taking the input as a vector rather than as two separate integers.

Yeah, that's reasonable, and it actually then becomes even shorter as a full program rather than function.

You can abuse the fact the : operator uses the first element of both args for 30 bytes

05AB1E, 4 bytes
Ÿ¦¨«

Try it online!
Explanation
    Ÿ      # inclusive range [a ... b]
     ¦¨    # remove the first and last element
       «   # append to input

Python 3, 52 48 47 42 41 bytes
lambda a,b:[a,b,*range(a,b,-(a>b)|1)[1:]]

Try it online!

Combined former implementations.

You can remove the space at or-1 to save a byte.

Python 2 (Cython), 36 35 bytes
lambda x:x+range(*x,-cmp(*x)|1)[1:]

Thanks to @nwellnhof for golfing off 1 byte!
Try it online!

Python 2, 37 bytes
lambda x:x+range(*x+[-cmp(*x)|1])[1:]

Thanks to @JonasAusevicius for the port to CPython!
Try it online!

This can be applied to standard Python 2 at 37 bytes, making it the shortest answer yet: lambda x:x+range(*x+[-cmp(*x)|1])[1:]. Nice solution

Perl 6, 26 22 bytes
{|@_,|[...^](@_).skip}

Try it online!
Explanation
{                    }
 |@_,   # Slip args a,b into result
      [...^](@_)  # Reduce args a,b with ...^ operator, same as a...^b
                .skip  # Skip first element
     |  # Slip into result

Python 2, 40 bytes
lambda x,y:[x,y]+range(x,y,-(y<x)|1)[1:]

Try it online!

Really like -(y<x)|1. very cool but I can't work out why it works! Any chance you can explain it?

@ElPedro Basically, y<x checks if y is strictly less than x, and returns True if it is, False otherwise. After that, unary - is applied to it, which converts True to -1 and False to 0. The last step is to bitwise OR this number with 1. This obviously leaves 1 (0b1) unaffected, and also leaves -1 (-0b1) unaffected (the sign bit of -1 is set, so it's kept as such). However, it does convert 0 to 1, so that range doesn't complain about me using a step of 0.

That is seriously cool and very clever. If I could upvote twice I would. Many thanks for the explanation.

Japt, 8 bytes
cUr!õ kU

Try it here
             :Implicit input of array U
c            :Concatenate
 Ur          :  Reduce U by
   !õ        :   Inclusive range
      kU     :  Remove all elements in original U

The 5-byte version seems to now fail for the 4,4 test case...

Python 2, 47 41 40 bytes
lambda a,b:[a,b]+range(a,b,a<b or-1)[1:]

Try it online!
Here's mine, now that a lot of other Python answers have been posted
-6 bytes, thanks to G B

Taking advantage of the empty range when it's invalid is a smart way to deal with forward or backwards lists. I could see that being very useful and is a nice trick to know exists.

41 bytes using a single range: range(a,b,(a<b)*2-1)

a<b or-1 is shorter for the 3rd range parameter. The shortest I got was lambda x,y:[x,y]+range(x+(x<y or-1),y,x<y or-1)

Python 3, 64 62 51 bytes
lambda a,b:[a,b]+[*range(a+1,b)]+[*range(a-1,b,-1)]
Try it online!
Python 2, 58 45 bytes
lambda a,b:[a,b]+range(a+1,b)+range(a-1,b,-1)
Try it online!

Because an empty list is falsey, you can remove the a<=b and  from both answers

You could also use + instead of or

Python 3 down to 47 bytes: lambda a,b:[a,b,*range(a+1,b),*range(a-1,b,-1)]

APL (Dyalog Extended), 5 bytes
Anonymous infix function.
,,…~,

Try it online!
, the first and last (lit. the concatenation of the arguments)
, and (lit. concatenated to)
… the range
~ without
, the first and last (lit. the concatenation of the arguments)

Nice, so I assume you're going to be using this for all of your golfing from now on?

@Zacharý Probably only if the code is significantly shorter or simpler.

Java 10, 109 108 104 102 93 62 bytes
Using a space-delimited String:
b->a->{var r=a+" "+b;for(;a<b?++a<b:--a>b;)r+=" "+a;return r;}

Try it online.
Using a List:
b->a->{var r=new java.util.Stack();for(r.add(a),r.add(b);a<b?++a<b:--a>b;)r.add(a);return r;}

Try it online.
(a<b?++a<b:--a>b can be ++a<b||(a-=2)>b for the same byte-count: Try it online for the String or Try it online for the List.)

Old (109 108 104 102 101 bytes) answer using an array:
a->b->{int s=a<b?1:-1,i=a!=b?(b-a)*s+1:2,r[]=new int[i];for(r[0]=a,r[1]=b;i>2;)r[--i]=b-=s;return r;}

-7 bytes thanks to @nwellnhof.
Try it online.
Explanation:
a->b->{                // Method with 2 int parameters & int-array return-type
  int s=               //  Step integer, starting at:
        a<b?1          //   1 if the first input is smaller than the second
        :-1;           //   -1 otherwise
      i=               //  Array-index integer, starting at:
        a!=b?          //   If the inputs aren't equal:
         (b-a)*s+1     //    Set it to the absolute difference + 1
        :              //   Else:
         2,            //    Set it to 2
      r[]=new int[i];  //  Result-array of that size
  for(r[0]=a,          //  Fill the first value with the first input
      r[1]=b;          //  And the second value with the second input
      i>2;)            //  Loop `i` downwards in the range [`i`,2):
    r[--i]=            //   Decrease `i` by 1 first with `--i`
                       //   Set the `i`'th array-value to:
           b-=s;       //    If the step integer is 1: decrease `b` by 1
                       //    If the step integer is -1: increase `b` by 1
                       //    And set the array-value to this modified `b`
  return r;}           //  Return the result-array

Isn't there anything in Java's standard library for making ranges of integers? Or it is just too verbose to use?

@Οurous It's indeed too verbose: a->b->{var L=java.util.stream.IntStream.range(a,b).boxed().collect(java.util.Collectors.toList());L.add(0,b);L.add(0,a);return L;} (130 bytes)

Is it Java 8 or Java 10 ? Because of "var" ^^'

@Neyt Ah, fixed. My initial version with the array below didn't use var, which is why I usually put those at 8, and the ones that does use var as 10 (and the ones using String.repeat as 11). :) Forgot to update it after adding the List and String answers, should be corrected now. Thanks.

Jelly, 4 bytes
,œ|r

Try it online!
How it works
,œ|r  Main link. Left argument: a. Right argument: b

,     Pair; yield [a, b].
   r  Range; yield [a, ..., b].
 œ|   Perform multiset union.

JavaScript (ES6), 51 bytes
Takes input as (a)(b).
a=>g=(b,c=b)=>(b+=b<a|-(b>a))-a?[...g(b,c),b]:[a,c]

Try it online!
Commented
a =>                // main function, taking a
  g = (             // g = recursive function
    b,              //     taking b
    c = b           // we save a backup of the original value of b into c
  ) =>              //
    (b +=           // add to b:
      b < a |       //   +1 if b is less than a
      -(b > a)      //   -1 if b is greater than a
    )               //   (or 0 if b = a)
    - a ?           // if the updated value of b is not equal to a:
      [             //   generate a new array:
        ...g(b, c), //     prepend all values generated by a recursive call
        b           //     append the current value of b
      ]             //
    :               // else:
      [a, c]        //   stop recursion and return the first 2 values: a and c

Octave, 45 bytes
@(a,b)[a b linspace(a,b,(t=abs(a-b))+1)(2:t)]

Try it online!

IF the first is larger than the second, the range must be descending

Oh man, I can't read

I ended up changing the language

Haskell, 34 bytes
a#b=a:b:[a+1..b-1]++[a-1,a-2..b+1]

Try it online!

This does not work. GHC interprets b-1 as b $ (-1). Use b- 1 instead.

@MarkNeu: it does work. See TIO link.

Oh, sorry! I had NegativeLiterals on.

J, 26 bytes
,,[|.@]^:(>{.)<.+1}.i.@|@-

Try it online!
Explanation:
A dyadic verb (takes left and right argument)
                         -    subtracts the arguments
                       |@     and finds the absolute value
                    i.@       and makes a list 0..absolute difference
                 1}.          drops the fist element
                +             adds to the entire list
              <.              the smaller of the arguments
   |.@]                       reverses the list
       ^:                     only if
  [                           the left argument
         (>{.)                is greater than the first item of the list
 ,                            appends the list to
,                             the right argument appended to the left one

,,[:}.@}:<.+i.@-@(+*)@- for 23 bytes and no special casing on relative argument ordering (rather: it's hidden inside the signum *).  i feel like this could get down under 20 but i'm tired.

@Jonah Thank you! Btw FrownyFrog's solution is way better than mine, so I 'm not going to golf it any further.

J, 13 bytes
,,<.+i.@-~-.=

Try it online!
     i.@-~       range [0 .. |difference|-1], reverse if the difference is positive
          -.=    remove the zero (either "=" is 0 or there’s nothing to remove)
  <.+            to each element add the smaller of the args
,,               prepend args

Nice solution! I totally forgot abouti. with negative argument.

this is gorgeous!

Clojure, 61 bytes
(fn[[a b]](def s(if(> a b)-1 1))(list* a b(range(+ a s)b s)))

An anonymous function that takes a 2-vector as input and returns a list.
Try it online!
Explanation
(fn [[a b]] ; An anonymous function that accepts a 2-vector as input, and destructures it to a and b
  (def s (if (> a b) -1 1)) ; If a > b assigns -1 to s and assigns 1 to s otherwise. This determines the order of the elements of the output list.
  (list* a b ; Creates a list with a and b as the first two elements. The remaining elements will be appended from the following range:
    (range (+ a s) b s))) ; A range starting at a+s and ending at b with step s

D, 85 bytes
T[]f(T)(T a,T b){T[]v=[a,b];T c=2*(b>a)-1;for(T i=a+c;a!=b&&b!=i;i+=c)v~=i;return v;}

Try it online!
A port of @HatsuPointerKun's C++ answer into D.

Ruby, 33 40 bytes
->a,b{[a,b]+[*a..b,*a.downto(b)][1..-2]}

Try it online!
Temporary fix, trying to find a better idea

For [4,4] this gives only one [4]

You are right, I fixed it.

Batch, 107 bytes
@echo %1
@echo %2
@for %%s in (1 -1)do @for /l %%i in (%1,%%s,%2)do @if %1 neq %%i if %%i neq %2 echo %%i

Takes input as command-line arguments. Explanation:
@echo %1
@echo %2

Output the two integers.
@for %%s in (1 -1)do

Try both ascending and descending ranges.
@for /l %%i in (%1,%%s,%2)do

Loop over the inclusive range.
@if %1 neq %%i if %%i neq %2

Exclude the two integers.
echo %%i

Output the current value.

Python 2, 52 47 41 bytes
lambda i,j:[i,j]+range(i,j,(i<j)*2-1)[1:]

Try it online!
-5 with thanks to @JoKing
-6 by slicing the first element from the range (idea stolen from and with credit to @TFeld)
Non-lambda version...
Python 2, 51 49 47 bytes
i,j=input();print[i,j]+range(i,j,(i<j)*2-1)[1:]

Try it online!
-2 with thanks to @JoKing

Pyth, 5 bytes
+QtrF

Input is a two-element list, [input 1, input 2]. Try it online here, or verify all the test cases at once here.
+QtrFQ   Implicit: Q=eval(input())
         Trailing Q inferred
   rFQ   Generate range [input 1 - input 2)
  t      Discard first element
+Q       Prepend Q

Using F instead of .* on 2-element lists is a brilliant trick that I will absolutely be using from here on.

Red, 75 bytes
func[a b][s: sign? d: b - a prin[a b]loop absolute d - s[prin[""a: a + s]]]

Try it online!

Clean, 49 bytes
import StdEnv
@a b=init[a,b:tl[a,a+sign(b-a)..b]]

Try it online!

APL (Dyalog Classic), 29 bytes
{⍺,⍵,(⌽⍣(⍺>⍵))(⍺⌊⍵)+¯1↓⍳|⍺-⍵}

Try it online!
A port of my J solution

Wow, I'm surprised this is so long for a seemingly simple task.

@Quintec Probably it can be golfed, or maybe another algorithm will result in much shorter solution.

TI-BASIC, 35 34 bytes
-1 byte from Misha Lavrov
Prompt A,B
Disp A,B
cos(π(A>B
For(I,A+Ans,B-Ans,Ans
Disp I
End

And one more byte by replacing 1-2(A>B with cos(π(A>B.

@MishaLavrov seq( wouldn't work for inputs where A and B are the same, unfortunately :(

True - also, I left out an argument of seq(, so I'm no longer convinced it even is smaller. Still, the cos( trick should help.

PHP (102 bytes)
function t($a,$b){count($r=range($a,$b))>1?array_splice($r,1,0,array_pop($r)):$r=[$a,$b];print_r($r);}

Sandbox
Unfortunately (for golf) PHP has rather verbose function names, which contribute a lot to the length.  But the basic idea is to create a range, then pop off the last element and stitch it back in at offset 1.  For the 4,4 example I had to add count($r=range($a,$b))>1?...:$r=[$a,$b]; which adds quite a bit, and unfortunately array_splice() is by reference which hit me for a few more bytes ($r= and a ;). All because of that "edge case", lol.
Well anyway enjoy!

I dont think that this is a right approach for code golf. Check this one
function t($a,$b){$o=array($a,$b);for($i=$a+1;$i<$b;$i++)$o[]=$i;print_r($o);}

Or something like this function t($a,$b){echo $a.$b;for($i=$a+1;$i<$b;$i++)echo $i};

It has to be a function and it has to output an array.  If you have a better answer your more then welcome to post it.

I edited it, is that a valid submission now? Shall I put it as a new answer or what?

That is entirely up to you, I just wanted to do it without a loop ... lol

It's embarrassing but my code doesn't even hold up for reverse range. so never mind

I see that.... :-(

JavaScript, 73 bytes
Without recursion:
(s,e,m=s>e?-1:1)=>[s,e,...[...Array(m*(e-s||1)-1)].map((_,i)=>s+m*(i+1))]

Try it:

f=(s,e,m=s>e?-1:1)=>[s,e,...[...Array(m*(e-s||1)-1)].map((_,i)=>s+m*(i+1))]

console.log(JSON.stringify(f(0,5)));
console.log(JSON.stringify(f(-3,8)));
console.log(JSON.stringify(f(4,4)));
console.log(JSON.stringify(f(4,5)));
console.log(JSON.stringify(f(8,2)));
console.log(JSON.stringify(f(-2,-7)));

C++, 143 140 bytes
-3 bytes thanks to Zacharý
#define V std::vector<int
#include<vector>
V>f(int a,int b){V>v{a,b};int c=2*(b>a)-1;for(int i=a+c;a!=b&&b!=i;i+=c)v.push_back(i);return v;}

How to use :
In the main function :
std::cout << f(0, 5) << '\n';
std::cout << f(-3, 8) << '\n';
std::cout << f(4, 4) << '\n';
std::cout << f(4, 5) << '\n';
std::cout << f(8, 2) << '\n';
std::cout << f(-2, -7) << '\n';

also add :
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
    os << "[ ";
    for (const auto& a : v) {
        os << a << ' ';
    }
    return os << ']';
}

You can chance the auto to int, as well as using a #define for std::vector<int>

#define V std::vector<int, and replace V f with V>f and V v with V>v for -1 byte.

Suggest c=b>a?1:-1 instead of c=2*(b>a)-1 and a-b&&b-i instead of a!=b&&b!=i

C (clang), 60 bytes
f(a,b,c)int*c;{for(*c++=a,*c++=b;(a<b?++a<b:--a>b);*c++=a);}

Try it online!

Can ditch the parens in the middle argument of for()

APL(NARS), 14 chars, 28 bytes
{⍺⍵,¯1↓1↓⍺..⍵}

test
  f←{⍺⍵,¯1↓1↓⍺..⍵}
  ¯3 f 8
¯3 8 ¯2 ¯1 0 1 2 3 4 5 6 7
  0 f 5
0 5 1 2 3 4

Haskell, 18 34 bytes as function, 46 52 as an IO action, 56 62 as program
x!y=x:y:[x+1..y-1]++[x-1,x-2..y+1]

or, as an IO action to take input, there are these options (all the same length):
main=(\x y->x:y:[x+1..y-1]++[x-1,x-2..y+1])<$>readLn<*>readLn
--
x!y=x:y:[x+1..y-1]++[x-1,x-2..y+1]
main=(!)<$>readLn<*>readLn
--
f x y=x:y:[x+1..y-1]++[x-1,x-2..y+1]
main=f<$>readLn<*>readLn

or, as an IO action taking input and printing the result:
main=((\x y->x:y:[x+1..y-1]++[x-1,x-2..y+1])<$>readLn<*>readLn)>>=print
--
x!y=x:y:[x+1..y-1]++[x- 1,x-2..y+1]
main=((!)<$>readLn<*>readLn)>>=print
--
f x y=x:y:[x+1..y-1]++[x-1,x-2..y+1]
main=(f<$>readLn<*>readLn)>>=print

The last one is also available on Try It Online! (You can try it online there)
Please remember that TIO requires the input be entered beforehand in the "Input" box.
De-golfed:
enumerate' x y = x : y : [x + 1 .. x - 1] ++ [x - 1 , x - 2 .. y + 1]
main = do x <- readLn
          y <- readLn
          print (enumerate' x y)

Note: : is an operator to prefix an element to a list.
Note: a!b will not work if -XBangBatterns is enabled.
Use a#b instead.
Note: -XNegativeLiterals will break this. Insert a space between x- and 1.
This will parse as x + (negate 1) instead of x $ (-1).

I feel obligated to point out that your shortest solution is essentially the same as nimi's.

Oh, sorry. Should I remove this?

You don't need to. According to this consensus on Meta, duplicate answers are fine.

C# (Visual C# Interactive Compiler), 86 bytes
x=>y=>{var l=new List<int>{x,y};for(int s=x>y?-1:1;x!=y&(x+=s)!=y;)l.Add(x);return l;}

Try it online!
-1 thanks @auhmaan!

You can save a byte by replacing the && with a single &; Also, since your answer isn't for C# (Visual C# Interactive Compiler) you need to add to your byte count the usings - which is System.Collections.Generic for this solution, if I'm not mistaken.

Thanks for the tip - I've updated my answer. I kind of like this compiler better :)

It also lowers your byte count a lot

Charcoal, 15 bytes
ＩＥ²ＮＩ…⊕θηＩ⮌…⊕ηθ

Try it online! Link is to verbose version of code. Explanation:
ＩＥ²Ｎ

Print the inputs on separate lines.
Ｉ…⊕θη

Print the ascending range, if any.
Ｉ⮌…⊕ηθ

Print the reverse ascending reverse range, if any.

Dart, 85 84 bytes
f(a,b)=>[a,b]+((a-b).abs()>1?List.generate((a-b).abs()-1,(i)=>(a>b?-i-1:i+1)+a):[]);

Try it online!
-1 by going from >= to >

QBASIC, 39 53 bytes
INPUT a,b
?a
?b
FOR q=a+1TO b-1 STEP SGN(b-a)
?q
NEXT

Added the STEP parameter to account for a>b, and that uses the SGN() function to get a -1 or a +1 as increment. This however breaks the REPL because the SGN() function isn't implemented there...
Try it (the old answer) online!

C (gcc), 65 bytes
f(a,b){for(printf("%d %d",a,b);a<b?++a<b:--a>b;)printf(" %d",a);}

Try it online!
Not very exciting. The loop increment is borrowed from an early version of Kevin Cruijssen's Java answer.

Powershell, 41 bytes
param($a,$b)$a;$b;$a..$b|?{$_-notin$a,$b}

Less golfed test script:
$f = {

param($a,$b)
$a                # push $a to a pipe
$b                # push $b to a pipe
$a..$b|?{         # push to pipe all integers from $a to $b
    $_-notin$a,$b # ...except $a and $b itself
}

}

@(
    ,( 0,  5  ,   0, 5, 1, 2, 3, 4)
    ,(-3,  8  ,   -3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7)
    ,( 4,  4  ,   4, 4)
    ,( 4,  5  ,   4, 5)
    ,( 8,  2  ,   8, 2, 7, 6, 5, 4, 3)
    ,(-2, -7  ,   -2, -7, -3, -4, -5, -6)
) | % {
    $a,$b,$expected = $_
    $result = &$f $a $b
    "$("$result"-eq"$expected"): $result"
}

Output:
True: 0 5 1 2 3 4
True: -3 8 -2 -1 0 1 2 3 4 5 6 7
True: 4 4
True: 4 5
True: 8 2 7 6 5 4 3
True: -2 -7 -3 -4 -5 -6

Explanation:
The basic concept of Powershell is the pipe. Pipe is an array. All results that push into the pipe fall into the array. So we should just push the values into the pipe in the correct order.

Java, 739, 555 bytes
 public static List<Integer> firstLastAndEverythingBetween(final int a, final int b) { if (a == b) { return addAB(a, b); } final List<Integer> result = addAB(a, b); int initial = getInitial(a, b); for (int n = 1; n < Math.abs(b - a); n++) { result.add(initial); if (b > a) { initial++; } else { initial--; } } return result; } private static int getInitial(int a, int b) { return (b > a) ? (a + 1) : (a - 1); } private static List<Integer> addAB(int a, int b) { final List<Integer> result = new ArrayList<>(); result.add(a); result.add(b); return result; }

This reminds me of my first post on here (in LUA). You should really make an effort to atleast remove the white space. I'm no Java programmer, but even I can see some quicky areas for golfing. Consider taking a look at this before the negative votes start piling up. Also, there is a templated style for posting code with the language name and number of bytes as a heading. I'd incorporate that. Here is a link to an online byte counter https://mothereff.in/byte-counter

Ok, learning about hte Code golf, I will do better with time

Welcome to PPCG! Good to have you with us :)

Good first effort. You'll soon learn the tricks. First one is to delete all of the unneeded spaces and shorten all variable and function names to one letter. Just the kind of things you wouldn't do in "real life" (hopefully!). Welcome on board.

How do I compile this? Simply putting it in a main class doesn't seem to work.

ah it is a method: then if you use main copy and paste this code below your main method and call it as a method.

Python 3, 53 48 bytes
-5 bytes thanks to @mypetlion.
lambda a,b:[a,b,*range(a+1-2*(a>b),b,1-2*(a>b))]

Try it online!

Save 5 bytes with starred expression to unpack the range object lambda a,b:[a,b,*range(a+1-2*(a>b),b,1-2*(a>b))]

JavaScript, 75 bytes
(a,b,n=-~(a>b?a-b:b-a)-2)=>[a,b,...[...Array(n<2?0:n)].map(_=>a<b?++a:--a)]

Try it online!

71 bytes

Husk, 5 bytes
+¹ht…

Try it online!
Thanks to Dominic Van Essen for the fix.

I'm afraid I think you'll need to use 5 bytes to pass the [4,4] test case...

Racket, 68 bytes
(define(f a b)(let([s(if(> a b)-1 1)])(list* a b(range(+ a s)b s))))

Try it online!
The same as TheGreatGeek's Clojure solution

perl -M5.010 -alE, 58 bytes
@_=($F[0]..$F[1],reverse$F[1]..$F[0]);say"$_ @_[1..$#_-1]"

This reads two integers (on a single line, separated by whitespace) from STDIN and writes the result to STDOUT.

Bash, 62 bytes
a=($(seq $1 $2|tr $'\n' ' '))
echo $@ ${a[@]:1:((${#a[@]}-2))}

explanation
seq does we want but produces lines, tr turns the lines into space-delimited output, the outer parens make that into an array.  $@ is the original input, and the rest of it slices the 0-indexed array from 1 and takes the next "array len - 2" chars.
Try it online!
(NOTE: not all test cases work on TIO for reasons i don't understand, but they do work on my local machine)

C# (.NET Core), 99 bytes
a=>b=>new[]{a,b}.Concat(b>a?Enumerable.Range(a+1,b+~a):Enumerable.Range(b+1,a!=b?a+~b:0).Reverse())

Try it online!
First (and probably last) time golfing in C#.

F# (Mono), 68 bytes
let f x y=
 let s=if x<y then 1 else-1
 Seq.append[x;y][x+s..s..y-s]

Try it online!

C# .NET Core, 56 441 bytes
Here is my corrected solution without predefined input variables and without string joining.
(a,b)=>n(a,b).c(k(a-b)>1?b>a?r(a+1,b-a-1):r(b+1,a-b-1).i():n());

Try it online!
n(a,b)               => returns new array with a and b in it
  c(                 => concat the following content
    k(a-b)>1         => when absolute value of a-b greater then one
      b>a            => when b bigger a
        r(a,b-a)     => range from a to b-a
        r(b,a-b).i() => else range from b to a-b reversed
      n()            => else empty array

I've created and used the following declarations. When I include those and the minimum code required to compile in the byte count I get 640 bytes.
public static class Extensions{
  public static IEnumerable<T> c<T>(this IEnumerable<T> a, IEnumerable<T> b) => a.Concat(b);
  public static IEnumerable<T> i<T>(this IEnumerable<T> a) => a.Reverse();
}

public static Func<int, int> k = Math.Abs;
public static Func<int, int, IEnumerable<int>> r = Enumerable.Range;
public static int[] n(params int[] a) => a;

using System.Linq;using System.Collections.Generic;using System;public static class E{public static IEnumerable<T> c<T>(this IEnumerable<T> a,IEnumerable<T> b)=>a.Concat(b);public static IEnumerable<T> i<T>(this IEnumerable<T> a)=>a.Reverse();}public class P{public static Func<int,int> k=Math.Abs;public static Func<int,int,IEnumerable<int>> r=Enumerable.Range;public static int[] n(params int[] a)=>a;public static void Main(string[] args){Console.WriteLine($"[ {string.Join(", ", f(int.Parse(args[0]), int.Parse(args[1])))} ]");}public static Func<int,int,IEnumerable<int>> f=(a,b)=>n(a,b).c(k(a-b)>1?b>a?r(a,b-a):r(b,a-b).i():n());}

What exactly are your "tricks"?

@FireCubez all the declarations which aren't in the body. Is that allowed?

Which body? Take a look at the standard loopholes. If it isn't there then it's allowed

@TFeld I've corrected it. It's just not that nice anymore^^

You dont' need all the string join stuff, returning a list is okay (it looks funny for input 4,5 :P)

@TFeld Thanks for the info. I also corrected the 4,5 case and have now 87 bytes.

One of your 'tricks' seems to be taking input through predeclared variables, which is not allowed as it turns this into a snippet. Additionally, pre-declaring functions is also not allowed. Submissions should be either self containing functions or full programs.

Other than that, welcome to PPCG. Don't be too discouraged, I hope you stick around!

@JoKing Thanks for the info and the welcome. I've just added a second solution without predefined input variables. I hope this is what you ment. I still have declarations for method aliases.

Err no, the method aliases aren't allowed either, unless you include the declarations in your answer

@JoKing And therefore they are part of the byte count or can I just mention them as I did now?

You have to include it in the bytecount

Let us continue this discussion in chat.

Tcl, 85 bytes
proc R a\ b {puts $a\n$b
if $a>$b {lassign $a\ $b b a}
while {[incr a]<$b} {puts $a}}

Try it online!

JavaScript (ES6), 97 bytes
a=>b=>[a,b,...((c,d)=>c==d?[]:(s=(m=Math).min(a,b),Array(m.abs(a-b)-1).fill().map(n=>++s)))(a,b)]

Can probably be improved!!

Python 3, 57 bytes
def m(a,b):s=(1,-1)[a>b];return[a,b]+list(range(a+s,b,s))

Try it online!

Same approach down to 49 bytes: def m(a,b):s=1-2*(a>b);print(a,b,*range(a+s,b,s))

JAVA 147 bytes
f(int a, int b){System.out.print(a+""+b);if(a<b){for(int i=a+1; i<b;i++){System.out.print(i);}}else{for(int i=a-1;i>b;i--){System.out.print(i);}}}

Vyxal 1.0.1, 9 bytes
=[‿|₌‿⁂JU

Don't even think about trying it Online.
Explained
The output for this challenge is the two input numbers paired together joined with the range between those two numbers. However, there can't be any duplicates in the joined list, so it needs to be uniquified by order of appearance. But we also need to make sure that the two numbers aren't the same: otherwise, a singleton will be returned.

Perl 5 -pl, 46 bytes
/ /;$_.=join$",'',$`+1..$'-1,reverse$'+1..$`-1

Try it online!

F#, 67 bytes
let f x y=if(y-x<0)then[x;y]@List.rev[y+1..x-1]else[x;y]@[x+1..y-1]

Try it online!
Appends a list containing x and y and a list iterating from x+1 to y-1 (if positive) or a list in reverse iteration order from y+1 to x-1 (if negative)

Arturo, 30 28 27 bytes
$[x,y][p:@[x,y]p++--x..y p]

Try it
$[x,y][               ; a function taking arguments x and y
    p: @[x,y]         ; assign the list [x,y] to p
    p ++              ; append something to p
    --x..y p          ; the range x to y without p
]                     ; end function, implicit return

Zsh*, 33 bytes
A=({$1..$2});<<<$@\ ;<<<${A:1:-1}

Try it online!
(*) Using set -o err_return

Scala, 87 75 bytes
Golfed version. Try it online!
(a,b)=>a::b::(if(a>b)(a to b by-1).drop(1)else(a to b by 1).drop(1)).toList

Ungolfed version.
object Main {
  def main(args: Array[String]): Unit = {
    val f = (a: Int, b: Int) => {
      a :: b :: (if (a > b) (a to b by -1).drop(1) else (a to b by 1).drop(1)).toList
    }
    println(f(0, 5)) // List(0, 5, 1, 2, 3, 4)
    println(f(-3, 8)) // List(-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7)
    println(f(4, 4)) // List(4, 4)
    println(f(4, 5)) // List(4, 5)
    println(f(8, 2)) // List(8, 2, 7, 6, 5, 4, 3)
    println(f(-2, -7)) // List(-2, -7, -3, -4, -5, -6)
  }
}

Thunno 2, 5 bytes
ẸIḣṫḥ

Attempt This Online!
Explanation
ẸIḣṫḥ  # Implicit input   ->  [8, 2]
Ẹ      # Dump onto stack  ->  8, 2
 I     # Inclusive range  ->  [8,7,6,5,4,3,2]
  ḣ    # Remove head      ->  [7,6,5,4,3,2]
   ṫ   # Remove tail      ->  [7,6,5,4,3]
    ḥ  # Concatenate      ->  [8,2,7,6,5,4,3]
       # Implicit output

Vyxal, 4 bytes
ṡÞẇJ

Try it Online! (inputs are swapped)
ṡ    # Inclusive range
 Þẇ  # Push [first, last] and rest
   J # Concatenate

JavaScript (ES6), 76 bytes
(a,b,c=[a,b])=>{c[c.length]=a<b?++a:--a;return a==b?(c.pop()+1&&c):f(a,b,c)}
invocation should not pass the third argument: f(-9,9)
Try it online!
im still thinking...

Fails for input 4,4

Ly, 22 bytes
nnsaRl=[pr0]pu' oru' o

Try it online!
The tricky bits here are that the range function in Ly only works if the start/end are sorted.  So the code has to conditionally flip the sequence of numbers before printing them.
nna                    - read in the start/end, stash the 2nd number
   aR                  - sort and generate the inclusive range
     l=                - does the 2nd number match the max of the range?
       [p 0]p          - "then" clause
         r             - reverse the stack
             u' o      - output the starting number and a space
                 r     - reverse the stack
                  u' o - output the ending number
                       - the sequence left on the stack prints automatically