text:
Game of Life and Fatigue
Stewie's Game of Life and Fatigue is quite similar to the more famous Conway's Game of Life.

The universe of the Stewie's Game of Life and Fatigue (GoLF) is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of three possible states, alive, dead or tired. Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
Any live cell with two or three live neighbours lives on to the next generation.
Any live cell with more than three live neighbours dies, as if by overpopulation.
Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Any cell that has been alive for two consecutive generations dies, as if by fatigue. It can't wake to life again until next generation
Any cell that is outside the boundary of the input grid are dead, as if it's fallen off a cliff.

Challenge:
Your challenge is to take a grid of dimensions n-by-m representing the initial state of a GoLF, and an integer p, and output the state of the Game after p generations.
Rules:

Input and output formats are optional, but the input/output grids should have the same representation
You may choose any printable symbols to represent live and dead cells (I'll use 1 for live cells and 0 for dead cells).
You may choose if you have 0 or 1-indexed. In the examples, p=1 means the state after one step.
Shortest code in each language wins
Built-in function for cellular automation are allowed

Test cases:
In the examples, I've only included the input grid in the input, not p. I've provided outputs for various p-values. You shall only output the grid that goes with a given input p.
Input:
0   0   0   0   0
0   0   1   0   0
0   0   1   0   0
0   0   1   0   0
0   0   0   0   0

--- Output ---
p = 1
0   0   0   0   0
0   0   0   0   0
0   1   1   1   0
0   0   0   0   0
0   0   0   0   0

p = 2
0   0   0   0   0
0   0   1   0   0
0   0   0   0   0
0   0   1   0   0
0   0   0   0   0

p = 3 -> All dead
---

Input:
0   1   0   0   0   0
0   0   1   0   0   0
1   1   1   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

--- Output ---
p = 1
0   0   0   0   0   0
1   0   1   0   0   0
0   1   1   0   0   0
0   1   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

p = 2
0   0   0   0   0   0
0   0   0   0   0   0
1   0   0   0   0   0
0   1   1   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

p = 3
0   0   0   0   0   0
0   0   0   0   0   0
0   1   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0
0   0   0   0   0   0

p = 4 -> All dead
Input
0   1   1   0   1   1   0
1   1   0   1   1   1   1
0   1   0   0   0   1   0
0   0   0   1   1   0   1
1   0   0   1   0   1   1
0   0   1   1   0   1   1
1   1   0   0   0   0   1

--- Output ---
p = 1
1   1   1   0   0   0   1
1   0   0   1   0   0   1
1   1   0   0   0   0   0
0   0   1   1   0   0   1
0   0   0   0   0   0   0
1   0   1   1   0   0   0
0   1   1   0   0   1   1

p = 2
1   0   0   0   0   0   0
0   0   0   0   0   0   0
1   0   0   1   0   0   0
0   1   1   0   0   0   0
0   1   0   0   0   0   0
0   0   0   0   0   0   0
0   0   1   1   0   0   0

p = 3
0   0   0   0   0   0   0
0   0   0   0   0   0   0
0   1   1   0   0   0   0
1   1   0   0   0   0   0
0   1   1   0   0   0   0
0   0   1   0   0   0   0
0   0   0   0   0   0   0

p = 4
0   0   0   0   0   0   0
0   0   0   0   0   0   0
1   1   1   0   0   0   0
1   0   0   0   0   0   0
1   0   1   0   0   0   0
0   1   1   0   0   0   0
0   0   0   0   0   0   0

p = 5
0   0   0   0   0   0   0
0   1   0   0   0   0   0
1   0   0   0   0   0   0
0   0   1   0   0   0   0
1   0   0   0   0   0   0
0   1   0   0   0   0   0
0   0   0   0   0   0   0

p = 6
0   0   0   0   0   0   0
0   0   0   0   0   0   0
0   1   0   0   0   0   0
0   1   0   0   0   0   0
0   1   0   0   0   0   0
0   0   0   0   0   0   0
0   0   0   0   0   0   0

p = 7
0   0   0   0   0   0   0
0   0   0   0   0   0   0
0   0   0   0   0   0   0
1   1   1   0   0   0   0
0   0   0   0   0   0   0
0   0   0   0   0   0   0
0   0   0   0   0   0   0

p = 8
0   0   0   0   0   0   0
0   0   0   0   0   0   0
0   1   0   0   0   0   0
0   0   0   0   0   0   0
0   1   0   0   0   0   0
0   0   0   0   0   0   0
0   0   0   0   0   0   0

p = 9 -> All dead

Yes, I'm aware that all initial seeds won't end in all cells being dead.

You should perhaps clarify that transition item 5 is applied "at the same time" as items 1--4, that is, it is based on the state before having applied 1--4

"cells, each of which is in one of two possible states, alive or dead" seems like a deliberately perverse definition given that the later fatigue rule can only be expressed in a standard finite automaton by making each cell have three states (dead, newly alive, alive for two consecutive generations)

I have a Golly rule for this if anyone wants it.

Playing GoD, eh?

Golly RuleLoader, 295 bytes
@RULE Y
@TABLE
n_states:3
neighborhood:Moore
symmetries:permute
var z={1,2}
var y=z
var x=z
var w=z
var u=z
var a={0,z}
var b=a
var c=a
var d=a
var e=a
var f=a
var g=a
var h=a
0,z,y,x,0,0,0,0,0,1
z,a,0,0,0,0,0,0,0,0
z,y,x,w,u,a,b,c,d,0
2,a,b,c,d,e,f,g,h,0
1,a,b,c,d,e,f,g,h,2
@COLORS
2 255 0 0

Input grid should be pasted in, boundaries are in the rulename (eg 5*3 is Y:P5,3), press space to advance.

MATL, 34 30 25 bytes
5 bytes removed thanks to a suggestion by @CalculatorFeline!
0ii:"wy*~wt3Y6QZ+5:7mb*]&

Try it online!
Inputs are a matrix and a number. The matrix uses ; as row separator. The matrices for the three test cases are entered as
[0 0 0 0 0; 0 0 1 0 0; 0 0 1 0 0; 0 0 1 0 0;0 0 0 0 0]
[0 1 0 0 0 0; 0 0 1 0 0 0; 1 1 1 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0]
[0 1 1 0 1 1 0; 1 1 0 1 1 1 1; 0 1 0 0 0 1 0; 0 0 0 1 1 0 1; 1 0 0 1 0 1 1; 0 0 1 1 0 1 1; 1 1 0 0 0 0 1]

Explanation
0     % Push 0. This represents the generation previous to the input one. Actually
      % This should be an array of zeros, but thanks to broadcasting it is
      % equivalent (and saves bytes)
i     % Input: array with starting generation
i     % Input: number of iterations, p.
      % STACK (bottom to top): 0, array with initial generation, p
:"    % Do the following p times
      %   STACK: previous gen, current gen
  wy  %   Swap, duplicate from below
      %   STACK: current gen, previous gen, current gen
  *~  %   Multiply element-wise, negate. This creates a mask of cells that do not
      %   die of fatigue (they were 0 in the current or in the previous generation)
      %   STACK: current gen, fatigue mask
  wt  %   Swap, duplicate
      %   STACK: Fatigue mask, current gen, current gen
  3Y6 %   Push predefined literal: 8-neighbourhood: [1 1 1; 1 0 1; 1 1 1]
      %   STACK: Fatigue mask, current gen, current gen, 8-neighbourhood
  Q   %   Add 1 element-wise. This gives [2 2 2; 2 1 2; 2 2 2], which will be
      %   used as convolution kernel. Active cells with 2 neighbours will give 5;
      %   inactive cells with 3 neighbours will give 6; and active cells with 3
      %   neighbours will give 7
      %   STACK: Fatigue mask, current gen, current gen, convolution kernel
  Z+  %   2D convolution, keeping size
      %   STACK: Fatigue mask, current gen, convolution result
  5:7 %   Push array [5 6 7]
  m   %   Ismember, element-wise. Cells that give true will survive, unless fatigued
      %   STACK: Fatigue mask, current gen, cells that can survive
  b   %   Bubble up
      %   STACK: Current gen, cells that can survive, fatigue mask
  *   %   Multiply element-wise. This tells which cells survive considering fatigue.
      %   The result is the new generation
      %   STACK: "Current" gen which now becomes old, "new" gen which now becomes
      %   current
]     % End
&     % Specify that implicit display will show only top of the stack

Can you explain 3Y6 in more detail? Also, if the middle element of the kernel was .5, you could check CGOL with just 2<value<4. Might help.

@CalculatorFeline That's a very good suggestion, thanks! It led to saving 5 bytes, using twice the mask and then testing that 5<=value<=7. As for 3Y6, it's just a predefined literal. There's also 1Y6, which is the 4-neighbourhood

Huh. That actually worked. Neat.

APL (Dyalog Classic 16.0), 59 bytes
⌊{((3∊⌊{⍵,⍵-c}+/,⍵)∧.1>1|c)×(.1×c)+1⌈c←2 2⌷⍵}⎕U233A 3 3⍣⎕⊢⎕

Try it online! (emulated on Classic 15.0)

APL (Dyalog Unicode 16.0), 85 bytes
⌊{((3∊⌊{⍵,⍵-c}+/,⍵)∧.1>1|c)×(.1×c)+1⌈c←2 2⌷⍵}⌺3 3⍣⎕⊢⎕

Try it online! (emulated on Unicode 15.0)

Prompts for grid and then for p. Prints the new grid after p generations.
Note that this uses the new ⌺ (Stencil) primitive which is not included in the Classic character set, hence a shorter version and a less-bytes version.
Explanation to follow…

APL's display format is nice :-)

@LuisMendo Actually, it isn't "APL's" but rather the interpreter does a callback to this APL function when it wants to output. The function then analyzes what we want to output and modifies it accordingly. Explanation for the display function is here.

Java 8, 333 bytes
int[][]G(int p,int[][]s){for(int h=s.length,w=s[0].length,y,x,n,a,b,t[][]=new int[h][w],i=0;i++<2*p;)for(y=0;y<h;++y)for(x=0;x<w;++x)if(i%2>0){for(n=0,a=y-2;++a<y+2;)for(b=x-2;++b<x+2;)n+=a>=0&a<h&b>=0&b<w&(a!=y|b!=x)&&s[a][b]>0?1:0;t[y][x]=s[y][x]<1?n==3?1:0:n<2|n>3|s[y][x]>1?0:2;}else s[y][x]=i==2*p&t[y][x]>1?1:t[y][x];return s;}

Explanation:
int[][]G(int p,int[][]s){
    for(int h=s.length,w=s[0].length,y,x,n,a,b,t[][]=new int[h][w],       //height, width, vars, temp array
            i=0;i++<2*p;)                                                 //for 2*generations: 1. calculate in temporary t, 2. copying to s
        for(y=0;y<h;++y)                                                  //for each row
            for(x=0;x<w;++x)                                              //for each column
                if(i%2>0){                                                //1. calculate
                    for(n=0,a=y-2;++a<y+2;)                               //n = number of alive cells around [y][x]. row above, at and below y
                        for(b=y-2;++b<y+2;)                               //column left, at and right of x
                            n+=a>=0&a<h&b>=0&b<w&(a!=y|b!=x)&&s[a][b]>0?1:0;    //if within bounds and not the cell itself, add 1 if alive.
                    t[y][x]=s[y][x]<1?n==3?1:0:n<2|n>3|s[y][x]>1?0:2;     //save next state in temporary, depending on rules. alive cells become 2.
                }
                else                                                      //2. copy temporary t to s
                    s[y][x]=i==2*p&t[y][x]>1?1:t[y][x];                   //if last generation, replace 2 by 1
    return s;
}


text:
Print the Russian Cyrillic alphabet
Apparently, we really like printing the alphabet in different languages.
How about the Russian Cyrillic alphabet?
Print/output/return this exact text (trailing whitespace is permitted)
АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя

This is the Russian Cyrillic alphabet with upper and lower case interleaved (eg AaBbCc...)
This is code-golf so crunch those bytes folks!

@EriktheOutgolfer This Unicode order of these make for a very different challenge.

Is outputting an array of individual characters permitted?

For Ёё, may we output codepoints U+00CB and U+00EB instead of U+0401 and U+0451?

@ETHproductions no, the text must be outputted exactly

Do we have to use Unicode? Or can we use an 8-bit Cyrillic encoding?

FFS I asked this a while ago and it got deletd

For users that can see it: https://codegolf.stackexchange.com/questions/97469/print-the-russian-alphabet

Last time this was posted, it was output as a duplicate of this question. Given how similar the solution is, I'm strongly tempted to close this as a duplicate, but I have a dupehammer so I can't do it with community review into the decision. Would someone else care to start the dupe vote?

Mendeleev, you say ‘it got deleted’, but the page itself says ‘This question was voluntarily removed by its author.’ What's going on here?

Рапира (Rapira), 172 142 bytes
ВЫВОД: "АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"

Try it online!
Just for fun, given the challenge. It may not be golfed; I'm not really familiar with the language.

@user202729 That's because it was a function definition that was never called, and there was a typo. It works now.

Mathematica, 43 42 bytes
Alphabet is a built-in function.
-1 byte from Martin.
ToUpperCase@#<>#&/@Alphabet@"Russian"<>""&

This may not work on some older versions of Mathematica, but it does work on Wolfram sandbox and Try it online!.

Another version without builtin Alphabet or ToUpperCase:
Mathematica, 82 66 bytes (64 chars)
Insert[FromCharacterCode@{#,#+32}&/@(1039+Range@32),"Ёё",6]<>""&

or
Insert[FromCharacterCode@{#,#+32}&/@1040~Range~1071,"Ёё",6]<>""&

Unfortunately Martin's trick (use a<>b instead of {a,b}) doesn't work here.
Try it online!

Of course Alphabet is a built-in. Freaking goats is a built-in.

@Downvoters Well, don't downvote this just because it's over-upvoted. It's a completely valid answer, and not overly boring, eithre. I hate seeing my reputation being "fractional"...

For what it's worth, I didn't downvote. There shouldn't be a punishment for knowing a built-in.

Jelly, 18 bytes
40r71s6j25Q+ȷỌżŒl$

A full program. Pretty similar in nature to an existing answer by Erik the Outgolfer, but I think it's different enough.
Try it online!
How?
40r71s6j25Q+ȷỌżŒl$  Main link: no arguments
40r71               inclusive range from 40 to 71: [40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]
     s6             split into sixes: [[40,41,42,43,44,45],[46,47,48,49,50,51],[52,53,54,55,56,57],[58,59,60,61,62,63],[64,65,66,67,68,69],[70,71]]
       j25          join with 25s: [40,41,42,43,44,45,25,46,47,48,49,50,51,25,52,53,54,55,56,57,25,58,59,60,61,62,63,25,64,65,66,67,68,69,25,70,71]
          Q         de-duplicate: [40,41,42,43,44,45,25,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71]
            ȷ       literal 1000
           +        addition: [1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071]
             Ọ      cast to characters: "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"
                 $  last two links as a monad:
               Œl     lowercase: "абвгдеёжзийклмнопрстуфхцчшщъыьэюя"
              ż       zip: ["Аа","Бб","Вв","Гг","Дд","Ее","Ёё","Жж","Зз","Ии","Йй","Кк","Лл","Мм","Нн","Оо","Пп","Рр","Сс","Тт","Уу","Фф","Хх","Цц","Чч","Шш","Щщ","Ъъ","Ыы","Ьь","Ээ","Юю","Яя"]
                    implicit print: АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя

I think it's different enough too, not because of +ȷ but because of the s6(...)Q approach.

Thanks @EriktheOutgolfer - I created it, then saw yours and almost commented to give the improvement.

BTW I'm incorporating the improvement, but keeping my approach for 19 bytes.

C#, Java, Javascript 137 bytes
Note: Java is only valid if you replace => with ->
s=>"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"

Ahhhh!!! Found a shorter way for
C#, 102 99 bytes
a=>string.Concat(new string[32].Select((x,i)=>(x=(char)(i+1040)+"")+x.ToLower())).Insert(12,"Ёё")

Shortened it by using a different approach
Try it Online!

What encoding is this? Pretty sure it's 138 bytes.

This is 138 bytes. Also, replace () with a single character to save a byte.

@Shaggy Sorry misread the TIO, question doesn't specify that unused parameters are allowed but I will edit them in

In UTF-8 this is 138 bytes, but 72 characters

Japt, 75 38 32 24 23 22 bytes
;Bi";<=>?@," c+981 ®+v

Test it

1 byte saved thanks to ETHproductions.

Explanation
;B        :The uppercase alphabet
i         :Prepend ...
";<=>?@," :  this string
c         :Map over the charcodes of each character in the string...
+981      :  and increment them by 981
®         :Map over each character in the string, replacing them with themselves...
+Zv       :   and their lowercase selfs
          :Implicit output of resulting string

History
75 bytes, 38 bytes, 32 bytes, 24 bytes

I think this works: http://ethproductions.github.io/japt/?v=1.4.5&code=I2gwbyNrMl9kCu1VbXYpYw==&input=LVAKCg==

@obarakon; nice one. But Ё & ё are missing. Also, you can save a couple of bytes with multiline and small tweak: http://ethproductions.github.io/japt/?v=1.4.5&code=I2gwbyNrMl9kCu1VbXYpYw==&input=LVAKCg== EDIT: See you got those improvements already.

That's what I did in my edit :P And darn Ёё. You can do i"Ёё"B but that would cost too many bytes.

Adding Ãi'ЁB to the end of the first line would be a byte shorter: http://ethproductions.github.io/japt/?v=1.4.5&code=I2gwbyNrMl9kw2knXHUwNDAxQgrtVW12KWM=&input=LVAKCg==

I think you'd have to do Ãi'Ё6, but yeah good idea.

@obarakon, you should post yours as a separate answer when you've figured it out. Ping me in chat if you want to talk through it more.

Jelly, 20 19 bytes
71r40s26j25+ȷṚỌżŒl$

Try it online!
Thanks to Jonathan Allan for posting his answer (even though he outgolfs me) for -1 :)

Since Jelly's code page does not have the Cyrillic alphabet, don't you need to count the bytes in UTF-8? I might be misunderstanding something.

@ComradeSparklePony The output codepage doesn't have to do with the code codepage.

PHP, 68 66
for(;$i++<33;)echo$c=ڀ^"
".chr($i-7?16+$j++:1),mb_strtolower($c);

slight improvement over the previous attempt by xoring instead of appending.
ڀ^"\n" constructs the necessary "\0xd0\128" and xors in the lower 7 bit.

Cool 'for' loop. Never seen that in my life.

Pyth, 26 bytes
X12ssmCM+B+1040d32U32"Ёё

                  U32     generate the range [0, 1, 2, ..., 30, 31]
     m         d          for each element in the range,
          +1040           add 1040, giving the uppercase cyrillic letter
        +B      32        bifurcate over adding 32, giving [upper, lower]
      CM                  convert each into a character
   ss                     join into a single string
X12                  "Ёё  insert this string at index 12

Try it here.

Because the output is different.

@LeakyNun Ah, TIO seems to have mangled the encoding. It does work locally, however.

Ñ doesn't belong there...

@LeakyNun I've changed the link to the other online Pyth interpreter, which runs it correctly.

You can save 2 bytes with rB ... Z: X12ssmrBC+1040dZU32"Ёё

JavaScript (ES6), 106 bytes

f=
_=>"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ".replace(/./g,c=>c+c.toLowerCase())
console.log(f())

05AB1E, 22 bytes
žv47ŸžB+çJ6т‚£'ЁýDløJ

Try it online!
Explanation
žv47Ÿ                    # push range [16 ... 47]
     žB+                 # add 1024 to each
        çJ               # convert to a string of characters with those code points
          6т‚£           # split into 2 pieces, the first being 6 chars long
              'Ёý        # merge the 2 strings on "Ё"
                 Dlø     # zip with a lower case copy
                    J    # join to a string

Oh, wow, I didn't even see you had an answer posted; let alone that there were 4 05AB1E answers already lol.

AND l WORKS ON RUSSIAN ALPHABETS?! WHAT.

@carusocomputing: Hehe, yeah. Pretty practical :P

05AB1E, 20 bytes = 18 bytes + 2 UTF-8 bytes
T„(GÇ«ŸçJ„ЁЖ6ǝDløJ

Try it online!

Credit to Emigna for the lowercase trick and for 3° isntead of 3Tm.

How?
T                  # Push 10.               | [10]
 „(G               # Push "(G"              | [10, "(G"]
    Ç              # Convert to ASCII.      | [10, [40, 71]]
     «             # Concatenate.           | [[1040, 1071]]
      Ÿ            # Range.                 | [[1040, ..., 1071]
       çJ          # Convert to char, join. | ["А..Я"]
         „ЁЖ       # Push "ЁЖ"              | ["А..Я", "ЁЖ"]
            6ǝ     # Replace "Ж" w/ "ЁЖ"    | ["А.Ё.Я"]
              Dl   # Duplicate, lowercase.  | ["А..Ё..Я", "а..ё..я"]
                øJ # Zip together and join. | ["АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"]

Alternate 20 byte version (no UTF-8): T„(GÇŸ„.Ç6ǝ˜«çJDløJ
Even more random 20 byte nonsense: T„(GÇŸ„.Ç6ǝ˜«vyçDlJ
(The key takeaway is that I don't think I'm getting below 20 here).

@Emigna figures I missed the hard part of the challenge heh...

@Emigna none of my answers would be valid without you ._. lol.

Nice trick with T and «!

@Emigna took a minute, knew there was something I could to to make 40 79 not awful.

@ETHproductions the two alternate ones use no UTF-8.

Heads up: This is displaying as 18 bytes in the userscript's leaderboard.

@Shaggy wow, sorry it took so long to see this, next time you have permission to edit it for me.

Braingolf, 58 bytes
"ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_`"{#Ϗ+..#Ёe#P:# |+}>&@

Try it online!
Woo!
Explanation
Adds Ϗ (975) to each character in ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\]^_`
Then duplicates and adds space (32), unless the character is Ё, in which case it adds P (80)

Would it shave a byte to duplicate and test before adding Ϗ, since Ё is two bytes?  I'm assuming UTF-8 - is that what's here?

@TobySpeight no because we're checking if the original value plus Ϗ is Ё, and yes, Braingolf uses UTF-8

My thinking was if we test before adding Ϗ, then that's a test against 2 (1 byte) rather than against Ё (2 bytes).

@TobySpeight we have to duplicate before pushing the space or P though, otherwise it'll cost us a byte to swap the values

Ah, I see.  You already have my vote, anyway.

Java, 93 bytes
s->"АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"

Source file should be saved in Windows-1251 encoding so the source makes for 71 bytes, plus flag to compiler -encoding WINDOWS-1251 for 22 bytes more.

Beaten to it

@Shaggy Well, I would've posted an idea to use different encoding there as a comment, but that answer was intended for 3 languages, and the flag to the compiler is specific to Java, so I posted this as a separate answer.

Also, you don't need to specify the flag. Since Windows-1251 is the default charset on Russian Windows (and javac always uses the default charset by default). Just mention that and you're good with only 71 bytes. But my answer even beats that ;)

Python 3,  69  66 bytes
-3 bytes using the form (using '%c' to directly apply chr()) from totallyhuman's answer, do go give some credit!
v=32
while v:print('Ёё'*(v==26),end='%c%c'%(1072-v,1104-v));v-=1

A full program (two double-byte characters used, Ё and ё).
Try it online!

Heh... I thought my answer looked different enough until I just actually read your code and turns out I just reversed the order. >_>

Dyalog APL, 55 47 bytes
8 bytes saved thanks to @Zacharý
⎕UCS 66⍴⍉2 33⍴1025+(14+⍳6),0,(20+⍳32),80,52+⍳26

Try it online!

(,⍪,819⌶)⎕ucs¯6⌽1040+¯15,6⌽⍳32

05AB1E, 64 47 46 bytes
5ÝD1040+s1072+‚øžB>D80+‚«25ÝD1046+s1078+‚ø)˜çJ

Try it online!

You can save a byte by using žB> instead of 1025

@Datboi True, but the 20 byte Jelly solution makes me sad.

@Okx there's a 22 byte 05AB1E solution ;).

Pyth, 71 bytes
."Ёё    kdâ¿Ããä©ÃòçÅD´fjÃØÜr
ÔE®8CðÒº[£÷6ÓþC0"

Try it online!

Python 3, 96 92 bytes

@Mayube suggested this to save 2 bytes, and succeeded to golf it down by 1 byte by declaring chr(i).

@Rod golfed 4 bytes by removing chr(i).

for i in[chr(ord(i)+975)for i in"ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_`"]:print(end=i+i.lower())

Try it online!

Python 3, 104 99 bytes
Any suggestions are welcome.
for i in"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ":print(end=i+i.lower())

Try it online!

With map(chr,range(65,91)) you have "ABC..Z" in 21 byte instead of 29. //  So we have: i in map(chr,range(65,91))+"[\\]^_'" (37byte)  vs i in"ABCDEF2GHIJKLMNOPQRSTUVWXYZ[\\]^_"` (40byte).

@P.Siehr note the problematic Ё and hence the 2 placed between F and G, which mapping chr over range does not yield (see my Python answer for a different workaround).

@JonathanAllan I didn't notice that - sorry. But here is another solution for your Python3 version: print(*[i+i.lower() for i in"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"]), if whitespaces are ok in the output.  TIO  (-1 Byte)

@P.Siehr that is 98 bytes due to Python using UTF-8 encoding. White space is only allowed after the text in this challenge too (usually Kolmogorov-complexity challenges only allow an optional trailing newline).

C# (.NET Core), 94 93 90 bytes
_=>{var r="";for(var i='А';i<='Я';)r+=""+i+(char)(i+32)+(i++=='Е'?"Ёё":"");return r;}

Try it online!

05AB1E, 29 bytes
1040ÐU5+ŸžB>X6+D25+Ÿ)˜çDl)ø˜J

Try it online!
Uses the lowercase / uppercase trick from the python answer
Explanation
1040ÐU5+ŸžB>X6+D25+Ÿ)˜çDl)ø˜J
1040                          # Push 1040
    Ð                         # Triplicate top of stack
     U                        # Saves top of stack in X
      5+Ÿ                     # Push range [1040, ..., 1045]
         žB>                  # Push 1025
            X                 # Push X (1040)
             6+D25+Ÿ          # Push range [1046, ..., 1071]
                    )         # Wrap stack to array
                     ˜        # Flatten array
                      ç       # Convert to character
                       Dl     # Create a lowercase copy
                         )ø   # Zip both together
                           ˜J # Flatten and join
                              # Implicit output

PHP>=7.0, 77 Bytes
for($t=IntlChar;$i++<33;)echo$c=$t::chr($i-7?1040+$j++:1025),$t::tolower($c);

IntlChar Class
PHP, 136 Bytes
for(;$i<mb_strlen($r=АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ);)echo$m=mb_substr($r,$i++,1),mb_strtolower($m);

PHP Sandbox Online
PHP, 136 bytes
<?=АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя;

Try it online!

Currently at 68 byte :)

@Christoph nice idea

Bash+coreutils, 101 100 93 92 74 bytes
printf %b\\n \\u04{51,{3,4}{{0..9},{a..f}}}|sort|sed 's/./\u&&/'|tr -d \\n

This requires a UTF-8 locale such as ru_RU.utf8 (English UTF-8 locales also sort correctly).  I've not added any score for this, as per the consensus on meta.

Python 3, 66 bytes
for i in range(32):print(end='%c%c'%(i+1040,i+1072)+'Ёё'*(i==5))

Try it online!

Ruby, 59 56 55 54 51 bytes
32.times{|x|$><<((x==6?"Ёё":"")<<x+1040<<x+1072)}

Thanks to manatwork for at least 4 bytes.
Try it online!

Japt, 26 24 bytes
22 bytes of code (encoded in UTF-8), +2 for the -P flag.
#h0o#k2_dÃi'Ё6
®+Zv

Similar to the below method, except instead of pairing two arrays, I join each capital letter with itself, lower-cased.
Try it Online!
26 byte solution:
I had some help from @Shaggy, who discovered that Ё wasn't in the [1040...1071] char range.
#h0o#k2_dÃi'Ё6
íUmv)c

Explanation:
#h0o#k2_dÃi'Ё6
íUmv)c
                   // Implicit U =
   o               //   Range
#h0                //     [1040...
    #k2            //             1071]
       _           //   Map; At each char,
         d         //     Get the char-code
          Ã        //   End mapping;
           i'Ё6    //   Insert "Ё" into index 6;
í                  // U paired with:
 Um                //   U, where each char:
   v               //   Converted to lowercase
     c             // Flatten
-P                 // Join into a string

Try it online!

Ruby, 60 bytes
u=?Џ
l=?Я
32.times{$><<u.next!+l.next!+(l==?е?"Ёё":"")}

(Just a demonstration of String#next!, the multibyte literals ruin the 55 characters score.)
Sample run:
bash-4.4$ ruby -e 'u=?Џ;l=?Я;32.times{$><<u.next!+l.next!+(l==?е?"Ёё":"")}'
АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя

Try it online!

Charcoal, 45 44 26 bytes
ＦＥ⮌⪫⪪…⮌…γ⁷²¦³²Ｌαi℅⁺℅ιφ⁺↥ιι

Try it online! Link is to verbose version of code. Explanation:
ＦＥ⮌⪫⪪…⮌…γ⁷²¦³²Ｌαi

Take the first 72 printable ASCII characters, reverse them, then take the first 32 of those (this is actually shorter than slicing and reversing, although slicing didn't exist at original time of posting anyway), then insert the i after the N, then reverse again. The resulting characters happen to have ASCII codes that are exactly 1000 less than the desired Russian lower case letters.
  ℅⁺℅ιφ

Calculate the Russian lower case letter by adding the predefined variable φ (f) which has the value 1000.
    ⁺↥ιι

Print the upper and lower case letters. («↥ιι would probably also work.)

Perl, 37 bytes
print map{chr.chr($_+32)}(1040..1071)

It's annoying that Perl's character autoincrement only works for the Latin alphabet.  I could save so many characters if it worked outside that range.

AWK, 79 bytes
BEGIN{for(x=1039;++i<33;){f="%c%c";f=i==6?f f:f;printf f,i+x,i+32+x,1025,1105}}

Try it online!
This works on TIO, not sure if it's dependent on installed char-set.

Haskell, 80 bytes
import Data.Char;f=putStr$(\x->[x,toLower x])=<<['А'..'Е']++'Ё':['Ж'..'Я']

Welcome to the site! :)

Java (OpenJDK 8), 91 88 bytes
()->{String s="";for(char i=0,u=1039,l=1071;i<33;)s=i++==6?s+"Ёё":s+ ++u+ ++l;return s;}

Try it online!
Encoded in Windows-1251. Must use a default Russian Windows installation.

You're Missing Ёё

@Mayube Fixed, for a great amount of extra bytes :(

You can do i++ and change the code accordingly to save 2 bytes: ()->{String s="";for(char i=0,u=1040,l=1072;i<33;i++)s=i==5?s+"Ёё":s+ ++u+ ++l;return s;}

Indeed, i is only a counter. I intended to use it otherwise at first.

Alice, 31 bytes
gr'v6R,' &w'ѷ~-.O' +'С'ёSOk@

Try it online!
Explanation
g       Read the first character of the source code. That's g itself, with
        code point 103, so this pushes 103. The exact value is irrelevant
        but we need something greater than 31.
r       Range. Turns 103 into 0, 1, 2, ..., 103.
'v      Push 118.
6R,     Move it down the stack by 6 elements, so the top of the stack is
        ..., 96, 97, 118, 98, 99, 100, 101, 102, 103.
' &w    Push the current IP address to the return address stack 32 times,
        which will cause the following part to be executed 33 times.

  'ѷ~-    Subtract the value on top of the stack from 1143, which gives the
          33 code points of the upper case letters.
  .O      Print a copy of this value as a character.
  ' +     Add 32. This turns the upper case letters in the main range to their
          lower case counterparts. However, this doesn't work for Ё/ё, where
          we obtain C instead.
  'C'ёS   Replace the divisor 1057 with 1105. The only value among the 33 which
          is divisible by 1057 is 1057 (C) itself, so that it simply gets turned into
          1105 (ё).
  O       Output the lower case character.

k       Jump back to the w as long as there's a copy on the return address stack.
@       Terminate the program.

Alice, 33 bytes
/ZАе"е"ёяSr@
\"'Я"rЁа""o/

Try it online!
My other Alice solution was entirely in Cardinal mode, this one is entirely in Ordinal mode. It's conceptually much simpler, but unfortunately two byte longer.
Explanation
Ignoring the Ordinal template, the program is entirely linear:
"АЯ"r"ая"rZ'е"еЁё"So@

Alice does have a built-in to convert between lower and upper case, but unfortunately in the Ruby interpreter it only works on ASCII letters, so we still have to get both ranges separately.
"АЯ"r     Push "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ".
"ая"r     Push "абвгдежзийклмнопрстуфхцчшщъыьэюя".
Z         Zip. Interleave the two strings.
'е"еЁё"S  Replace "е" with "еЁё".
o@        Print the result and terminate the program.

source: Stack Exchange

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

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

sort: votes


text:
Compressing RLE data to draw ASCII art

This question is based on what I came up with to answer another question.

Sometimes the questions here ask to draw some ASCII art. One simple way to store the data for the art is RLE (run-length encoding). So:
qqqwwwwweeerrrrrtttyyyy

becomes:
3q5w3e5r3t4y

Now to draw a big ASCII art you maybe be getting data like this (ignoring the new line characters):
19,20 3(4)11@1$20 11@19,15"4:20 4)19,4:20 11@
   ^^^
   Note that this is "20 whitespaces"

(Character count: 45)

The characters used for the ASCII art are never going to be lowercase or uppercase letters or numbers, only signs, marks and symbols but always in the printable ASCII character set.
You want to save some space in that string, so you replace the numbers with the uppercase character set (being 'A' equals to 1, 'B' equals to 2 until 'Z' equals to 26), because you are never going to get more than 26 repetitions of a character. So you get:
S,T C(D)K@A$T K@S,O"D:T D)S,D:T K@

(Character count: 34)

And finally you notice that some groups of (letter+symbol) are repeating, so you substitute the groups that appear 3 times or more in the string by the lowercase character set, in order or appearance in the string, but storing in a buffer the substitutions made (in the format "group+substitution char" for each substitution), and leaving the rest of the string as is. So the following groups:
S, (3 times)
T  (4 times)
K@ (3 times)

gets substituted by 'a', 'b' and 'c', respectively, because there are never going to be more than 26 groups repeating. So finally you get:
S,aT bK@c
abC(D)cA$bcaO"D:bD)aD:bc

(Character count: 9+24=33)

[The last step only saves 1 byte because the groups that actually save characters after being substituted are the ones appearing 4 times or more.]
The challenge
Given a string containing the RLE data to draw an ASCII art (with the restrictions proposed), write the shortest program/function/method you can in order to compress it as described. The algorithm must print/return two strings: the first one containing the dictionary used for the compression, and the second one being the resulting compressed string. You may return the strings as a Tuple, an array, List or whatever, in the given order.
Note that if the string cannot be compressed in the step 2, the algorithm must return an empty string as first return value and the result of the step 1 as second return value.
You do not need to include the result of step 1 in the output values, I just include them in the examples for clarification purposes.
This is code-golf, so may the shortest answer for each language win!
Another test case
Input:                   15,15/10$15,15/10"10$10"10$10"10$10"15,15/

Output of step 1:        O,O/J$O,O/J"J$J"J$J"J$J"O,O/

Final algorithm output:  O,aO/bJ$cJ"d
                         abcabdcdcdcdab

---

Input:                   15,15/10$15,15/10"

Output of step 1:        O,O/J$O,O/J"

Final algorithm output:  <empty string>
                         O,O/J$O,O/J"

because you are never going to get more than 26 repetitions of a character Nope. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

@Okx That can never be the case.

@Okx yes, in the real world. The rules are made up for a restricted set of ASCII art, though.

In a real implementation, S,aT bK@c would probably be stored as just S,T K@ without explicitly naming the substitution characters which can be trivially deduced from that.

@Arnauld you are totally right, I missed that, but I am going to leave the question as is, just in case anybody has started to write his/her answer.

when I was going to hit the "add answer" button, you added the empty string rule @.@

JavaScript (ES6), 168 167 bytes
Returns an array of two strings: [dictionary, compressed_string].
s=>[(a=(s=s.replace(/\d+/g,n=>C(n|64),C=String.fromCharCode)).match(/../g)).map(v=>s.split(v)[a[v]||3]>=''?D+=v+(a[v]=C(i++)):0,i=97,D='')&&D,a.map(v=>a[v]||v).join``]

Test cases

let f =

s=>[(a=(s=s.replace(/\d+/g,n=>C(n|64),C=String.fromCharCode)).match(/../g)).map(v=>s.split(v)[a[v]||3]>=''?D+=v+(a[v]=C(i++)):0,i=97,D='')&&D,a.map(v=>a[v]||v).join``]

console.log(f('19,20 3(4)11@1$20 11@19,15"4:20 4)19,4:20 11@'))
console.log(f('15,15/10$15,15/10"10$10"10$10"10$10"15,15/'))

Python 2, 269 280 268 266 bytes
Nothing fancy going on here. Good opportunity to use some simple regular expressions.
The first version failed for strings containing special characters that were interpreted within the regex. Second version (using re.escape) works with all the test cases. That correction cost 11 bytes.
Second version did not assign substitution characters in order, as required in the problem specification, and as pointed out by @CarlosAlejo.  So, back to the drawing board.
Corrected version, further golfed

-6 bytes saved by not printing output on two lines
+3 bytes: Switching to code substitutions via a string to allow meeting the challenge as specified.
-4 bytes: Since I'm no longer calling re.findall twice, I don't need to rename it
-5 bytes: switching from for loops to while loops.
-2 bytes thanks to @Comrade Sparkle Pony

import re
S=re.sub
b=a=input()
for i in re.findall('\d{1,2}',a):
 b=S(i, chr(64+int(i)),b)
n,s,p=96,'',0
while p<len(b):
 c=b[p:p+2];f=b.count(c)
 if f>2and not c in s:n+=1;s+=c+chr(n)
 p+=2
p=0
while p<len(s):k=s[p:p+2];v=s[p+2];b=S(re.escape(k),v,b);p+=3
print s,b

Try it online!

You're almost there, note that the groups in second step are not created in the proper order (see example). Groups must be created in order of appearance, so the first one should be O,a.

@CarlosAlejo I had not noted that as a requirement, since the substitutions are arbitrary, from a functional point of view.  Python's default dictionaries, a natural way to implement this, are unordered. Will have to consider other possible data structures....

Couldn't you save some bytes by using b=a=input() and n,s,p=96,'',0?

\d+ would be a shorter regex to use. You're never going to go over 26 anyways so there's no reason to ensure that it's specifically 1-2 digits. Also, using re.escape means that a basic string replace ends up slightly shorter: 253 bytes

Lua, 215 bytes
Just a good bit of pattern matching.
I think Lua's underrated when it comes to golfing... look at all those statements squished together!
g,c=string.gsub,string.char
u=g(arg[1],"%d%d?",function(n)return c(n+64)end)l,d=97,""g(u,"..",function(m)n,e=0,g(m,".", "%%%0")g(u,e,function()n=n+1 end)if n>2 then
l,s=l+1,c(l)d,u=d..m..s,g(u,e,s)end
end)print(u,d)

Python 2, 186 bytes
from re import*
S=sub('\d+',lambda m:chr(int(m.group(0))+64),input())
Q=[]
for p in findall('[A-Z].',S):
 if S.count(p)>2:a=chr(len(Q)+97);Q+=[p+a];S=sub(escape(p),a,S)
print''.join(Q),S

I was hoping to finally find use for re.subn :C
# first step - convert all numbers to uppercase letters
S=sub('\d+',lambda m:chr(int(m.group(0))+64),input())
# empty list to hold encoding of second step
Q=[]
# find every encoded pair (uppercase letter and some char)
for p in findall('[A-Z].',S):
 # if it occures 3 or move times
 if S.count(p)>2:
  # get lowercase letter to substitute with
  a=chr(len(Q)+97)
  # store encoding into list
  Q+=[p+a]
  # update string - substitute pair with lowercase letter
  S=sub(escape(p),a,S)
# output
# encodings of second step, space, result
# if nothing was compressed at step 2, space would prepend result (of step 1)
print''.join(Q),S

Compressed at step 2
Not compressed at step 2

Python 2, 246 bytes
Whole second step done in repl lambda of re.sub. Just for fun.
from re import*
Q=[]
S=sub('\d+',lambda m:chr(int(m.group(0))+64),input())
S=sub('[A-Z].',lambda m:(lambda m:S.count(m)>2and(m in Q or not Q.append(m))and chr(Q.index(m)+97)or m)(m.group(0)),S)
print''.join(Q[i]+chr(i+97)for i in range(len(Q))),S

Try it online!

Perl 5 -pl, 81 bytes
s/\d+/chr$&+64/ge;$b=a;for$a(/([A-Z].)(?=.*\1.*\1)/g){s/\Q$a/$b/g&&($\.=$a.$b++)}

Try it online!
Prints the encoded string on the first line, the triples on the second line

Ruby -p, 133 bytes
gsub(/(\d+)(.)/){(64+$1.to_i).chr+$2}
c=?`;s=''
$_.scan(/(..)(?=.*\1.*\1)/){s+=$&+c.succ!if !s[$&]}
puts s.scan(/(..)(.)/){gsub$1,$2}

Try it online!

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


text:
Impossible cube maybe
Problem
Given an input a where a is a truthy/falsy value output the exact impossible cube below if truthy and the exact normal cube below if falsey.
Input truthy:
         ___________________________________
        / _______________________________  /|
       / / _____________________________/ / |
      / / /| |                         / /  |
     / / / | |                        / /   |
    / / /| | |                       / / /| |
   / / / | | |                      / / / | |
  / / /  | | |                     / / /| | |
 / /_/___| | |____________________/ / / | | |
/________| | |_____________________/ /  | | |
| _______| | |____________________ | |  | | |
| | |    | | |___________________| | |__| | |
| | |    | |_____________________| | |____| |
| | |   / / _____________________| | |_  / /
| | |  / / /                     | | |/ / /
| | | / / /                      | | | / /
| | |/ / /                       | | |/ /
| | | / /                        | |   /
| | |/_/_________________________| |  /
| |______________________________| | /
|__________________________________|/

Input falsy:
         ___________________________________
        / _______________________________  /|
       / / _____________________________/ / |
      / / /| |                         / /  |
     / / / | |                        / /   |
    / / /| | |                       / / /| |
   / / / | | |                      / / / | |
  / / /  | | |                     / / /| | |
 / /_/___|_|_|____________________/ / / | | |
/__________________________________/ /  | | |
| ________________________________ | |  | | |
| | |    | | |___________________| | |__| | |
| | |    | |_____________________| | |____| |
| | |   / / _____________________| | |_  / /
| | |  / / /                     | | |/ / /
| | | / / /                      | | | / /
| | |/ / /                       | | |/ /
| | | / /                        | |   /
| | |/_/_________________________| |  /
| |______________________________| | /
|__________________________________|/

Rules

Trailing whitespace allowed.
Trailing newlines allowed.
truthy/falsey values may be swapped (truthy for real cube and falsey for impossible cube)
Input style should be specified
Shortest code in bytes wins

Do we need to output that exact cube or any impossible cube?

@dzaima the exact cube.

At first glance, I thought the input was the ASCII art. sigh of relief

@Arnauld that would end up being pretty trivial, because you could just look at one character at a specific location and tell the two apart.

@JarkoDubbeldam True. What I had in mind was more like "take any similar input of any size and figure out whether the cube is valid or not".

@Arnauld Go for it: https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?cb=1 :P

can I swap the truthy/falsy outputs? (truthy: possible, falsy: impossible)

@dzaima Doesn't look like I would be undermining already posted answers so go ahead.

Should this get tagged kolmogorov-complexity?

@stannius Thought about it, but I am not sure.

@LiefdeWen me either, which is why I commented instead of attempting to add the tag myself :D

SOGL V0.12, 145 bytes
─3n{_⁰
ā"¹K╚=+ƨψ≡tšÆA%εW#žt─M^_ξ0“6²⁰ _*ž}"⁵æκLνbΡ°■=μθΝv╝xxΛTγ►℮ΞyF“'№⁰┐∙ž}"⁸Βλμž╚⅔\Ρ═⁴-θ=╚_>◄4℮`ε║t“'¦⁰ā;∫0 /ž}╬5}'Æ6«@┐2Ο3∙:Aža.?X"≥YΤ%‘5n}L9ž

Try it Here!
This program stores the line data as 3 separate base 36-46 numbers and decodes each and žs the values in the main array.
Because of the abusive way of how I draw the diagonal lines, the output has 27 lines of lines with spaces (which is allowed by the OP)
input:
0 - impossible
1 - possible
Explanation:
The first line is basically a substitute ⁰ with ─3n{_

ā                   push an empty array (the canvas for the whole cube)
 "...“              pushes 29714643711764388252557994982458231735529743027583646902
      6²─           base-36 decodes it
         3n{     }  for each group of 3 numbers do (where the numbers are X, Y, length)
            _         put all the contents on the stack (in the order X, Y, length)
              _*      get POP amount of underscores
                ž     in the canvas at the positions x;y (the position of the 1st char, 1-indexed) put the underscores

"...“             pushes 19564601770087915522037775830252836261712294966673526596188
     '№─          base-46 decodes it
        3n{    }  for each group of 3 numbers do
           _        put all the contents on the stack
            ┐∙      get an array of "|"s with the length of POP
              ž     in the canvas at the position x;y (position of the top char, 1-indexed) put the vertical bar

"...“                    pushes 124633728256573776407884156928319785312464662536125755768
     '¦─                 base-40 decodes it
        3n{           }  for each group of 3 numbers do
           _               put all the contents on the stack
            ā;             one below the stack put an empty array (canvas for the diagonal line)
              ∫    }       for range(length) do
               0             TMP
                 /           push "/"
                  ž          at the position (iter; 0), 1-indexed put a "/". This extends the array one line upward and causes the extra spaces.
                    ╬5     in the canvas at the position x;y(1-indexed, the top position) put the diagonal line canvas without overriding with spaces

'Æ             push 36
  6«           push 12
    @┐2Ο       push two spaces, encased in vertical bars - "| | |"
        3∙     get an array of 3 of those
          :A   save on variable A
            ž  in the canvas, at the positions 36; 12 put the array

a                 push the variable A
 .?         }     if the input is non-0, then
   X                remove the variable A off of the stack
    "≥YΤ%‘          push "|_|_|__________"
          5n        chop that into an array of strings of length 5
             L9ž  at positions 10;9 insert the top of stack (either the ["| | |","| | |","| | |"] or ["|_|_|","_____","","_____"]) in the canvas

How does it change based on input?

0 - impossible, 1 - possible

Shouldn't an input of 1 result in the same output as other truthy inputs like "test"?

@JonathanAllan should it? In SOGL a truthy number input is a non-0 number. Typing test in the input box results to an error. If its that big of a problem I could just make it take string input where "" would be falsy and everything else truthy

Oh right, I guess if the language is strongly typed then handling any type of input may be out of scope.

Jelly,  187  166 bytes
ḣ9;⁾| ṁ5¤oµ€“µ½¿‘¦
“ _/ |/|”;€⁶;”_ṁ"“¡ẇḞ6’D¤ṃ@“Ė⁸ġṾṗ¢œƝṇRK⁹ṄẸŒÐ¤ɓḂı)ḥṆqƓị¹÷ḄƝṁPʠVW1JĊTc;[¤ÆWŒṠṬ#ʋÆ6ẉ⁷ZḷƊḤƑẹẠGḊ|qi×Ƭ®ÐėƁ1(⁸ṪU¹Bgoƭ<Gḋ×c:ȦṚƇĊ¬e*⁽%ḷİ°U’Fs27Ç¹⁸?x€15¦€19Y

A full program.
Try it online!
How?
103 bytes are a 101 digit base 250 number, which is a base-8 compression of a possible cube, with trailing spaces added to equalise the row-lengths, without new lines, and without 18 characters from the middle of each row, like this, but without newlines:
         _________________
        / _____________  /|
       / / ___________/ / |
      / / /| |       / /  |
     / / / | |      / /   |
    / / /| | |     / / /| |
   / / / | | |    / / / | |
  / / /  | | |   / / /| | |
 / /_/___|_|_|__/ / / | | |
/________________/ /  | | |
| ______________ | |  | | |
| | |    | | |_| | |__| | |
| | |    | |___| | |____| |
| | |   / / ___| | |_  / /
| | |  / / /   | | |/ / /
| | | / / /    | | | / /
| | |/ / /     | | |/ /
| | | / /      | |   /
| | |/_/_______| |  /
| |____________| | /
|________________|/

The 8 base-8 digits represent the strings of characters:
1      2    3    4    5    6        7        0
"   ", "_", "/", " ", "|", "/ / /", "| | |", "_____"

So the compression is then like the below where 1s, 6s, 7s and 0s are to be replaced by the strings shown above:
111000__111/ 00___  /|11 / / 00_/ / |116| |11 / /  |1  6 | |11/ /1|1 671  6| |16 71 6 | |  6  7167 6___|_|_|__6 7/000_/ /  7| 00____ | |  771 7_7__771 | |___7____| |71/ / ___7_  / / 7  6176  7 61 7 / /1761  7/ /1 7 / /11| |1/1  7/_/0__| |  /11| |00__| | /11 |000_|/11

The program reverses the process and changes the characters that need changing if the cube should be an impossible one:
“ _/ |/|”;€⁶;”_ṁ"“¡ẇḞ6’D¤ṃ@“ ... ’Fs27Ç¹⁸?x€15¦€19Y  Main link: V
                                                     ...splitting this up...
                                                     ...Main link part 1:
“ _/ |/|”;€⁶;”_ṁ"“¡ẇḞ6’D¤ - make the list of strings of characters
“ _/ |/|”                 - list of characters = " _/ |/|"
           ⁶              - literal space character
         ;€               - concatenate €ach -> ["  ","_ ","/ ","  ","| ","/ ","| "]
             ”_           - literal = '_'
            ;             - concatenate -> ["  ","_ ","/ ","  ","| ","/ ","| ", '_']
                        ¤ - nilad followed by link(s) as a nilad:
                 “¡ẇḞ6’   -   base 250 literal = 31111555
                       D  -   convert to decimal list -> [3,1,1,1,1,5,5,5]
                "         - zip with:
               ṁ          -   mould like
                          -   -> ["   ","_","/"," ","|","/ / /","| | |","_____"]

                                                     ...Main link, part 2:
...ṃ@“ ... ’Fs27 - make the rows of a possible cube without the middle repetitions:
...              - part 1, above
     “ ... ’     - the 101 digit base 250 number
   ṃ@            - base decompression with swapped @rguments
            F    - flatten (because the digit values we are using are actually lists)
             s27 - split into chunks of length 27 (into the rows)

                                                     ...Main link part 3:
...Ç¹⁸?x€15¦€19Y - make "impossible" if need be, add the row middles and output
...              - part 2, above
       ?         -  if:
      ⁸          -    chain's left argument = V
   Ç             - ...then: call last link (1) as a monad
                 -          (make it an impossible cube - see link 1, below)
    ¹            - ...else: identity (do nothing)
            €    - for €ach
         ¦       - apply sparsely:
       15        - ...to index: 15
     x€    19    - ...this: repeat €ach nineteen times
               Y - join with newlines
                 - implicit print

ḣ9;⁾| ṁ5¤oµ€“µ½¿‘¦  Link 1, replace characters to make impossible: rows
                 ¦  apply sparsely:
            “µ½¿‘   ...to indexes: code-page indexes = [9,10,11]
                    ...this:
          µ€          for €ach:
ḣ9                      head to index 9
        ¤               nilad followed by link(s) as a nilad:
   ⁾|                     list of characters = ['|',' ']
      ṁ5                  mould like 5 = ['|',' ','|',' ','|']
  ;                     concatenate
         o              logical or (vectorises) with the row
                          (which has the effect of appending the rest of the row)

I "fattened" the cube on purpose and you took advantage of it +1.

JavaScript (ES6),  352   344  333 bytes
Saved 2 bytes thanks to @YairRand
x=>[...'mnopqrstuvwxyz01~'].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`1yup
1z uux z|
1/z uu_/z |
yqswtqvy|
yys wtyvq|
qs0t sw
ys 0ts w
 snt/v0
v_/x${x?0:'|_|_|'}m/v 0
/~_${b=x?0:'o_'}p/zn
| ~${b}m wnrynuo_0__0ryywp0owryv p0_ vr st0/vrst 0vr/vtn/zrvtqwyzr/_/pow z
wuu__wz
|um|/~xo1yyq0w |z /q o__w| |szp~t111svzr
0qy pu~ox_ny0muxx`)

Demo

let f =

x=>[...'mnopqrstuvwxyz01~'].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`1yup
1z uux z|
1/z uu_/z |
yqswtqvy|
yys wtyvq|
qs0t sw
ys 0ts w
 snt/v0
v_/x${x?0:'|_|_|'}m/v 0
/~_${b=x?0:'o_'}p/zn
| ~${b}m wnrynuo_0__0ryywp0owryv p0_ vr st0/vrst 0vr/vtn/zrvtqwyzr/_/pow z
wuu__wz
|um|/~xo1yyq0w |z /q o__w| |szp~t111svzr
0qy pu~ox_ny0muxx`)

flag = true
setInterval(_ => o.innerHTML = f(flag = !flag), 750)

Removing a= and replacing the one reference to it with 0 (which it always equals when referenced) saves two bytes.

Charcoal, 188 bytes
__¶____¶_¶↙¹↓↑⁷↗³Ｐ↓⁶↗²↓↓⁷←↙⁴↓↓↓↙↗⁸↑¹²←Ｐ←×_³⁵↓↙⁹↑←×_³⁴Ｐ↗⁹↓↓¹¹↗→×_³⁴↑¹¹↖Ｐ←×_²⁹↗⁷←Ｐ←×_³¹↙←×_²⁹↓↙⁶↑←_Ｐ↗⁷↓↘Ｐ↓⁹←←Ｐ×_³²↓↓⁹↗→×_³⁰Ｐ↑⁹↖←×_²⁷↗⁶←←↙⁵↘→→↗⁵ＵＯ²¹±²_↗↗Ｐ×_¹⁹←↙|←Ｐ↑²←←↑²ＦＮＵＯ⁵±³ |↑↑Ｐ↑⁴Ｆ²«→→Ｐ↑⁶

Try it online! Link is to falsy version; change the input from 0 to 1 for the truthy version. Here is the approximate verbose code for the above program:
Print("__\n____\n_\n");

Print the part of the back visible through the right "hole".
Print(:DownLeft, 1);
Move(:Down);
Print(:Up, 7);
Print(:UpRight, 3);
Multiprint(:Down, 6);
Print(:UpRight, 2);
Move(:Down);
Print(:Down, 7);
Move(:Left);
Print(:DownLeft, 4);

Print the right "hole".
Move(3, :Down);
Move(:DownLeft);
Print(:UpRight, 8);
Print(:Up, 12);
Move(:Left);
Multiprint(:Left, Times("_", 35));
Move(:Down);
Print(:DownLeft, 9);
Move(:Up);
Print(:Left, Times("_", 34));
Multiprint(:UpRight, 9);
Move(:Down);
Print(:Down, 11);
Move(:UpRight);
Print(Times("_", 34));
Print(:Up, 11);

Print the outer edge of the cube.
Move(:UpLeft);
Multiprint(:Left, Times("_", 29));
Print(:UpRight, 7);
Move(:Left);
Multiprint(:Left, Times("_", 31));
Move(:DownLeft);
Print(:Left, Times("_", 29));
Move(:Down);
Print(:DownLeft, 6);
Move(:Up);
Print(:Left, "_");
Multiprint(:UpRight, 7);

Print the top "hole" of the cube.
Jump(1, 2);
Multiprint(:Down, 9);
Move(2, :Left);
Multiprint(Times("_", 32));
Move(:Down);
Print(:Down, 9);
Move(:UpRight);
Print(Times("_", 30));
Multiprint(:Up, 9);
Move(:UpLeft);
Print(:Left, Times("_", 27));

Print the front "hole" of the cube.
Print(:UpRight, 6);
Move(2, :Left);
Print(:DownLeft, 5);
Jump(3, 1);
Print(:UpRight, 5);
Oblong(21, Negate(2), "_");
Move(2, :UpRight);
Multiprint(Times("_", 19));
Move(:Left);
Print(:DownLeft, "|");
Move(:Left);
Multiprint(:Up, 2);
Move(2, :Left);
Print(:Up, 2);

Print the part of the back visible through the front "hole".
for (InputNumber()) Oblong(5, Negate(3), " |");

Make the cube impossible if necessary.
Move(2, :Up);
Multiprint(:Up, 4);
for (2) {
    Move(2, :Right);
    Multiprint(:Up, 6);
}

Print the part of the back visible through the top "hole".


text:
Take that frown and turn it around
A celebration of the many faces of APL
Given a string among those in column 1 or column 2 of the below table, return the string's neighbor to its right. In other words, if given a string in column 1 then return column 2's string on that row, and if given a string in column 2 then return column 3's string on that row.
The codepoints (other than :'s) are listed on the far right.
 column 1   column 2   column 3
 :⊢ → ⍡ → ⊣:   U+22a2  U+2361  U+22a3
 :▷ → ⍢ → ◁:   U+25b7  U+2362  U+25c1
 :⋆ → ⍣ → ⋆:   U+22c6  U+2363  U+22c6
 :∘ → ⍤ → ∘:   U+2218  U+2364  U+2218
 :○ → ⍥ → ○:   U+25cb  U+2365  U+25cb
 :≀ → ⍨ → ≀:   U+2240  U+2368  U+2240
 :∧ → ⍩ → ∨:   U+2227  U+2369  U+2228
Anecdote: Most of these symbols are valid or proposed in some APL dialect (they are all links).
Per request, just the symbols:
:⊢ ⍡ ⊣:
:▷ ⍢ ◁:
:⋆ ⍣ ⋆:
:∘ ⍤ ∘:
:○ ⍥ ○:
:≀ ⍨ ≀:
:∧ ⍩ ∨:

JavaScript (ES6), 108 107 bytes
s=>(S="⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨")[S.search(s[1]||s)+7]+(s[1]?'':':')

Demo

let f =

s=>(S="⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨")[S.search(s[1]||s)+7]+(s[1]?'':':')

;[
  ":⊢", ":▷", ":⋆", ":∘", ":○", ":≀", ":∧",
  "⍡", "⍢", "⍣", "⍤", "⍥", "⍨", "⍩"
]
.forEach(s => console.log(s + ' → ' + f(s)))

Python 3, 105 bytes
lambda s:":⊢⍡⊣:▷⍢◁:⋆⍣⋆:∘⍤∘:○⍥○:≀⍨≀:∧⍩∨:".split(s)[1][:3-len(s)]

Try it online!

C# (.NET Core), 148 134 bytes
s=>{var c="⊢⍡⊣▷⍢◁⋆⍣⋆∘⍤∘○⍥○≀⍨≀∧⍩∨";return c[c.IndexOf(s[s.Length-1])+1]+(s.Length<2?":":"");}

Try it online!

14 bytes saved after golfing a little.

Wanted to ask, is it valid to just omit the obvious scaffolding (class Program, static void Main) you need from the byte count? I typically use JVM languages and of course it would be cool if I could just omit the class/main function declaration and just count the meat of my code, but I'm not sure if this is the case.

@Matej Standard code golf rules allow submission of a function/lambda or a full program.

Jelly, 56 bytes
“¤'aẎṚl’b4ạ37ż“ɱaɲṢbḊİcİðdðṖeṖ@h@'i(‘ḅ⁹Ọɓi@€Ṁ‘ị;⁸LḂx@”:¤

A full program.
Try it online!
Note: (ɱaɲ!) While there is some pattern to the non-: ordinals (middle column almost consecutive, many left and rights being the same - only two off by one and one off by ten) it just does not seem quite enough for such a small data set to allow any byte saves over this.
The first thirteen bytes could also be “¡ÐɼU¹’ṃ“"%#‘.
How?
“¤'aẎṚl’b4ạ37ż“ ... ‘ḅ⁹Ọɓi@€Ṁ‘ị;⁸LḂx@”:¤ - Main link: list of characters, frown
“¤'aẎṚl’                                 - base 250 number = 4064044420859
        b4                               - to base 4 = [3, 2, 3, 0, 2, 0, 3, 2, 3, 3, 2, 3, 0, 2, 0, 3, 2, 3, 3, 2, 3]
          ạ37                            - absolute diffence with 37 = [34, 35, 34, 37, 35, 37, 34, 35, 34, 34, 35, 34, 37, 35, 37, 34, 35, 34, 34, 35, 34]
              “ ... ‘                    - code page indexes = [162, 97, 163, 183, 98, 193, 198, 99, 198, 24, 100, 24, 203, 101, 203, 64, 104, 64, 39, 105, 40]
             ż                           - zip together = [[34, 162], [35, 97], [34, 163], [37, 183], [35, 98], [37, 193], [34, 198], [35, 99], [34, 198], [34, 24], [35, 100], [34, 24], [37, 203], [35, 101], [37, 203], [34, 64], [35, 104], [34, 64], [34, 39], [35, 105], [34, 40]]
                      ⁹                  - literal 256
                     ḅ                   - convert from base = [8866, 9057, 8867, 9655, 9058, 9665, 8902, 9059, 8902, 8728, 9060, 8728, 9675, 9061, 9675, 8768, 9064, 8768, 8743, 9065, 8744]
                       Ọ                 - convert to characters = "⊢⍡⊣▷⍢◁⋆⍣⋆∘⍤∘○⍥○≀⍨≀∧⍩∨"
                        ɓ                - dyadic chain separation, call that smiles
                         i@€             - first index of €ach frown character in smiles
                            Ṁ            - maximum (any ':' was not found so yielded 0)
                             ‘           - increment
                              ị          - index into smiles
                                       ¤ - nilad followed by link(s) as a nilad
                                ⁸        -   chain's left argument, frown
                                 L       -   length
                                  Ḃ      -   mod 2
                                     ”:  -   literal ':'
                                   x@    -   repeat with swapped @rguments
                               ;         - concatenate
                                         - implicit print

Employing Emigna's 05AB1E method of compression saves three for 53 bytes:
“ȤỤ.ḍṅfḲBṆ µṾḢƲ¿ṭVÄ⁹L5ı;ṡaÐ’Ds3Ḍ+⁽œẉỌɓi@€Ṁ‘ị;⁸LḂx@”:¤

Try it online!

That's some serious Jelly right there. Ugh.

bashes ordinals with mallet "...fit in there you smiles!"

Your comment made me laugh more than I'm proud to admit

Python 3, 140 137 116 bytes
lambda n,x=":⊢⍡⊣:▷⍢◁:⋆⍣⋆:∘⍤∘:○⍥○:≀⍨≀:∧⍩∨:":x[x.find(n)+len(n):x.find(n)+3]

Try it online!

Fails for column 1 inputs

Strange. It didn't work when I tried it earlier. Anyways, carry on.

Your last character lost its : eyes.

05AB1E, 58 56 54 bytes
• î]D£Èтн»“¿āp÷ŒRÃÙŽ^мηWX·ć•3ô8728+çJ3ô':ý':.øI¡`3Ig-£

Try it online!
Explanation
• î]D£Èтн»“¿āp÷ŒRÃÙŽ^мηWX·ć•  # push a 63-digit base-255 compressed number
3ô                            # split in pieces of 3
  8728+                       # add 8728 to each
       çJ                     # convert to a string with the corresponding code points
         3ô                   # split in pieces of 3
           ':ý                # merge on ":"
              ':.ø            # surround with ":"
                  I¡          # split on input
                    `         # push as separate to stack, the tail on top
                     3Ig-£    # take the first 3-len(input) characters

The above method should work with any number in the range [8676 ... 8728], so if I can find a number there that can be generated in 3 bytes I could save a byte over the current solution.

':ý':.ø could be õ.ø':ý to save a byte. In addition, in the new 05AB1E version, the 8728 can be ŽYw.

PHP, 147 bytes
<?=($f=array_flip($y=str_split(⍣⋆⍤∘⍥○⍨≀∧⍩∨⊢⍡⊣▷⍢◁,3))[trim($argn,":")])>7?$y[$f+1].":"[$f%3>1]:$y[$f^1].":"[$f&1];

Try it online!

+1 just for array_flip!

@Adám  array_flip is one or two bytes shorter as the alternative array_search and the multibyte in this case cost much bytes. It is not nice to be longer as C#

removing the quotes from the symbols string runs as well, it's considered an undefined constant with same value

APL (Dyalog Unicode), 103 bytes
-17 bytes thanks to Adám
(⌷∘S,':'/⍨14∘<)7+(S←'⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨')⍳⊢/

Try it online!
APL (Dyalog Unicode), 118 bytes
Since the asker is an APL programmer...
{(':'/⍨14<X),⍨S⌷⍨X←7+⍸(S←'⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨')∘.=⊢/⍵}

Try it online!
Explanation
S←'⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨'        ⍝ S is the lookup table.
⍸()∘.=⊢/⍵                             ⍝ Find the input in this LUT.
X←7+                                  ⍝ Add the index by 7 and assign to X.
S⌷⍨                                  ⍝ Index into the LUT.
,⍨                                   ⍝ Append:
':'/                                 ⍝ The colon
(⍨14<X)                              ⍝ if X is larger than 14.

103 bytes (⌷∘S,':'/⍨14∘<)7+(S←'⊢▷⋆∘○≀∧⍡⍢⍣⍤⍥⍨⍩⊣◁⋆∘○≀∨')⍳⊢/


text:
Construct a multiparticle quantum state
Sandboxed and made less complicated and hopefully more fun.
Summary of the challenge
Given a number of particles, either identical bosons or identical fermions, output the total wave function of the state assuming they are all independent.
Physics background
Don't worry, you don't need to know quantum mechanics to solve this challenge. I will explain what you need now.
What is a wave function?
In (non-relativistic) quantum mechanics every particle can be described with a function of the position called the wave function. If you have a system with more than one particle you can describe it using a wave function that will depend on the position of all the particles of the system. In this challenge we will only consider independent (i.e. non-interacting) particles. In this case the total wave function can be written as a combination of the wave function of the single particles. The way you can do this depends of the type of particles you have and the statistics they obey.
Distinguishable particles
Let's start from the case of distinguishable particles even if you will not need them for the challenge. Distinguishable particles are what you have in classical physics. Every object has is own identity. If I throw two coins I have a 25% chance of getting TT, 25% for HH and a 50% for TH because TH and HT are two different events.
For a system of distinguishable particles the total wave function is written as the product of the single wave functions. For a system of n particles, if we call di the i-th particle wave function and xi the i-th particle position we have a total wave function:
1 particle:    d1(x1)
2 particles:   d1(x1)d2(x2)
3 particles:   d1(x1)d2(x2)d3(x3)
  ...

Indistinguishable Bosons
Now onto the weird stuff. When you get to the quantum level you will discover that particles with same properties are actually identical and thus obey a different statistics than classical particles. Back to the coin toss example we find that if we assume the coins to be indistinguishable, all the three events are equally likely, that is we have a 33% for TT, 33% for HH and 33% for HT because now TH and HT are the same event.
The total wave function for several bosons is not given by simply the product of the single particle wave functions, but as a sum of all the possible combinations of wave function and positions. You will understand better with some examples, using a similar notation than before:
1 boson:    b1(x1)
2 bosons:   b1(x1)b2(x2) + b2(x1)b1(x2)
3 bosons:   b1(x1)b2(x2)b3(x3) + b2(x1)b1(x2)b3(x3) + b3(x1)b2(x2)b1(x3) + b1(x1)b3(x2)b2(x3) + b2(x1)b3(x2)b1(x3) + b3(x1)b1(x2)b2(x3)
  ...

What you have at the end is a total wave function that is symmetric (i.e. stays the same) for any exchange like xi <-> xj or bi <-> bj.
Indistinguishable Fermions
It gets even weirder! Fermions are not only indistinguishable but they also don't like being in the same state. This means that if you toss two fermion coins you are 100% guaranteed of getting TH since TT and HH are now prohibited.
The total fermion wave function is constructed the same way of the boson one, but instead of having all + signs, you have a + or a - depending on the sign of the permutation. For an odd number of swaps to get from the starting order to that permutation you have a - sign, for an even number you have a + sign.
1 fermion:    f1(x1)
2 fermions:   f1(x1)f2(x2) - f2(x1)f1(x2)
3 fermions:   f1(x1)f2(x2)f3(x3) - f2(x1)f1(x2)f3(x3) - f3(x1)f2(x2)f1(x3) - f1(x1)f3(x2)f2(x3) + f2(x1)f3(x2)f1(x3) + f3(x1)f1(x2)f2(x3)
  ...

The total wave function is now antisymmetric (i.e. changes sign) for any exchange like xi <-> xj or fi <-> fj. If you have two equal wave functions the total wave function is zero.
Algorithmic way of building the wave function
Suppose you have 3 particles of type p (p=bfor bosons and p=f for fermions).

Start from p1(x1)p2(x2)p3(x3)
Build each possible swap of two wave functions (or equivalently coordinates)

p1(x1)p2(x2)p3(x3)
p1(x1)p3(x2)p2(x3)
p2(x1)p1(x2)p3(x3)
p2(x1)p3(x2)p1(x3)
p3(x1)p1(x2)p2(x3)
p3(x1)p2(x2)p1(x3)

Determine the sign of the permutation (only for fermions)
Join everything with the correct sign: + for bosons or the sign of the permutation for fermions

Input
You will get two inputs (or a list of two items). One of them is a number from 0 to 9 inclusive (that will represent the number of particles, the other defines the type of particles in the system. You can choose the order of the input and the format of the two inputs. Some examples of inputs might be:
[n, type]    |    Meaning
---------------------------------------------------------------
[3, "boson"] |    3 bosons
[6, 'f']     |    6 fermions
[4, True]    |    4 fermions (True = fermion, False = boson)

Remember to write in the answer how you are formatting your input.
Output
You have to output the total wave function of the system that obeys the rules explained before. See the examples for an example of formatting. Bosons are represented as bi, fermions as fi and positions as xi where the index i goes from 1 to n (the number of particles).
Each output will have n! terms that contains the product of n terms summed together. The order inside each product or in the total sum does not matter, the important thing is the dependence of each wave function on the positions and the sign of each term.
The output must be a mathematically valid expression, so if you want to add explicit multiplication signs it is fine. You have the freedom of writing the variables and the function as you want, but there needs to be a clear distinction between fermions and bosons.
The output must be written as an explicit sum of explicit products, so no implicit summations or products, no summation signs, no product signs and no determinants of matrices.
The spaces in the example are just for clarity and you can decide not to output them.
Scoring
This is code-golf. Shortest answer in bytes wins. Standard loopholes apply.
Examples
Input  ->   Output
[0, b] ->   0 (or empty string)
[1, b] ->   b1(x1)
[2, b] ->   b1(x1)b2(x2) + b2(x1)b1(x2)
[3, b] ->   b1(x1)b2(x2)b3(x3) + b2(x1)b1(x2)b3(x3) + b3(x1)b2(x2)b1(x3) + b1(x1)b3(x2)b2(x3) + b2(x1)b3(x2)b1(x3) + b3(x1)b1(x2)b2(x3)
[1, f] ->   f1(x1)
[2, f] ->   f1(x1)f2(x2) - f2(x1)f1(x2)
[3, f] ->   f1(x1)f2(x2)f3(x3) - f2(x1)f1(x2)f3(x3) - f3(x1)f2(x2)f1(x3) - f1(x1)f3(x2)f2(x3) + f2(x1)f3(x2)f1(x3) + f3(x1)f1(x2)f2(x3)

Might there be 10 or more particles? This could affect string-based approaches that assume digits are a single character.

It's not clear to me exactly what liberties one can take with the string representation of the algebraic expression. Peter Taylor mentioned some specifics in the sandbox. I think this would have benefited from more sandbox time -- I would have looked more closely after the simplification revision, and Peter Taylor may have followed up on his comment.

@xnor I'll add a rule for the number of particles. For 10 particles the output also gets really long so it makes sense. For your second comment I'm not really sure what to tell you... for sums a+b or b+a are identical outputs and for products b1(x1)b2(x2) or b2(x2)b1(x1) are the same.

Is handling the 0 particle case required?

@CalculatorFeline Yes. You can either output a 0 or have an empty output

I believe the "sign of the permutation" is known as the parity but I could be wrong (?)

@FrodCube For instance, can one use a * or x symbol between terms? Can spaces go anywhere? Can subscripts be like x_1? Can you add a negated term? You offer an algorithm, but I'm not clear how much of it is prescriptive and how much as an example.

Ah, to answer my own question - they are synonyms

@xnor you can do everything you said. The output needs to be a formula that makes sense mathematically and in which the various functions and variables are distinct. The "algorithm" is there to just clarify stuff better

You should be explicit in the challenge that you just want anything that algebraically equals the result. Though the restriction against a useless leading + seems to go against that? I take it though that there's some limit to the mathematical notation than can be used? What about product or sum symbols?

Jelly,  47  46 bytes
He he, what a ṭ€€ż€...
Ṭ€z0ÆḊ×”fe⁴¤«0ị⁾-+
ṭ€”xj@€⁾()
Œ!©ṭ€€ż€⁸Ç¤®Ñ€¤ż

A full program which prints such that the summands are in lexicographical order once the multiplications of particle functions are all ordered by the position arguments.
i.e.:
f1(x1)f2(x2)...fn-1(xn-1)fn(xn) (or b...) will always be first, followed by
f1(x1)f2(x2)...fn(xn-1)fn-1(xn), and so on up to
fn(x1)fn-1(x2)...f2(xn-1)f1(xn).
Try it online!
How?
Ṭ€z0ÆḊ×”fe⁴¤«0ị⁾-+ - Link 1: get the sign character: list, permutation of [1,N], P
Ṭ€                 - untruth €ach - that is [0,0,...,0,1] of length v for each v in P
  z0               - transpose with filler 0 (yields transpose of the permutation matrix)
    ÆḊ             - determinant (yields the parity of the permutation)
           ¤       - nilad followed by link(s) as a nilad:
       ”f          -   literal character 'f'
          ⁴        -   4th command line argument = 2nd program input = particle type, T
         e         -   exists in? (1 for "f", 0 for "b")
      ×            - multiply (force all results from +1 or -1 to 0 for T="b")
            «0     - minimum of that and 0 (force the +1s to 0s)
               ⁾-+ - literal list of characters = ['-', '+']
              ị    - index into (the -1s yield '-'  while the 0s yield '+')

ṭ€”xj@€⁾() - Link 2: construct parenthesised positions: number of particles, N
  ”x       - literal character = 'x'
ṭ€         - tack for €ach -> [['x', 1], ['x', 2], ..., ['x', N]]
       ⁾() - literal list of characters = ['(', ')']
    j@€    - join with swapped @rguments for €ach -> [['(', 'x', 1, ')'],...]

Œ!©ṭ€€ż€⁸Ç¤®Ñ€¤ż - Main link: number of particles, N; type of particle P
Œ!               - all permutations of N -> [[1,2,...,N-1,N],[1,2,...,N,N-1],...]
  ©              - copy to the register and yield
   ṭ€€           - tack T for €ach for €ach (place the type in front of every number)
          ¤      - nilad followed by link(s) as a nilad:
        ⁸        -   chain's left argument, N
         Ç       -   call last link (2) as a monad (get the "(xn)"s)
      ż€         - zip with for €ach (make all the summands)
              ¤  - nilad followed by link(s) as a nilad:
           ®     -   recall value from register (the permutations of N)
            Ñ€   -   call the next link (1) as a monad for €ach (get the signs)
               ż - zip the signs and the summands.
                 - implicit print

Please explain.

@CalculatorFeline I always do... it may take a while to write this up though.

@CalculatorFeline done.

Python3, 320 bytes:
R=range
def f(a,b):
 q,s=[([*R(a)],0)],{str([*R(a)]):0}
 while q:
  c,k=q.pop(0)
  for x in R(a):
   for y in R(x,a):
    C=eval(str(c));O=C[y];C[y]=C[x];C[x]=O
    if str(C)not in s:s[str(C)]=k+1;q+=[(C,k+1)]
 return''.join(['-','+'][b=='b'or s[j]%2==0]+''.join(f'{b}{eval(j)[k]+1}(x{k+1})'for k in R(a))for j in s)[1:]

Try it online!


text:
Interlaced Rotations
Challenge
Given a square matrix of characters (single-byte printable ASCII characters), rotate each "ring" of the matrix in opposite directions.
Let's take an example:
1 2 3 4 5
6 7 8 9 A
B C D E F
G H I J K
L M N O P

Then, the outermost ring is rotated clockwise 90 degrees, like so:
1 2 3 4 5    L G B 6 1
6       A    M       2
B       F => N       3
G       K    O       4
L M N O P    P K F A 5

The second ring is rotated counterclockwise 90 degrees:
7 8 9    9 E J
C   E => 8   I
H I J    7 C H

The final ring is rotated clockwise 90 degrees, but since it is a single number (letter in our example), then it is not really affected.
The final result is:
L G B 6 1
M 9 E J 2
N 8 D I 3
O 7 C H 4
P K F A 5

If the matrix has an even side length, the innermost ring will be a 2x2 square and should still be rotated.
Input
A list of lists in any reasonable standard format. For example, a newline-delimited space-delimited string or a list of space-delimited strings is acceptable, but a list of the values as rings around the matrix is not acceptable.
The characters are not necessarily unique.
Output
A list of lists in any reasonable standard format. Same rules as the input.
Test Cases
1 2 3    7 4 1
4 5 6 => 8 5 2
7 8 9    9 6 3

1 2 3 4 5 6    Y S M G A 1
A B C D E F    Z E K Q W 2
G H I J K L => ! D O I V 3
M N O P Q R    @ C P J U 4
S T U V W X    # B H N T 5
Y Z ! @ # $    $ X R L F 6

Credits
Heavily inspired by a related challenge that rotates each element counterclockwise one position (not by 90 degrees).

Related

@rahnema1 Right, I remember that post. This post is mostly inspired by that one; I will credit. Thanks!

@Mr.Xcoder Whoops. You are right, thanks.

@HyperNeutrino can we take the dimension of the matrix as a part of input?

All characters in your examples are unique. Will this always be the case?

@Uriel No, I will say that your submission must figure that out itself. Sorry if that renders it impossible in your chosen language.

@Dennis I will not guarantee that. I will specify, thanks.

@HyperNeutrino I actually asked for C

Haskell, 94 bytes
An anonymous function taking and returning a list of Strings.
Use as (cycle[t.r,r.t,r.t,r.t]?)["123", "456", "789"].
(cycle[t.r,r.t,r.t,r.t]?)
(g:h)?(a:b)=g$a:h?t(r b)
_?a=a
r=reverse;t=zipWith(:)`foldr`repeat[]

Try it online!
How it works

r is reverse. t is one byte shorter than importing Data.List.transpose. t.r rotates a list of lists 90 degrees clockwise, and r.t rotates it counterclockwise.
The operator ? takes two arguments, a list of functions and a matrix as a list of strings.

An empty matrix is just returned.
Otherwise, ? strips the first function f off the list of functions, and the first line a off the matrix.
Then it rotates the remainder b of the matrix clockwise, and recurses with that and the remaining functions. This gradually strips the matrix from the outside in, one ring each four steps.
Then it prepends the original line a to the result, and applies the function f to it to adjust the orientation of the matrix.

The anonymous function calls ? with the input matrix as a list of strings, and an infinite list of functions, which repeats cyclically every four steps.

For most of the steps the function is counterclockwise rotation, which undoes the implicit clockwise rotation done by ? when recursing.
However, the first step and every fourth step afterwards is instead clockwise rotation.

This function is applied when a ring of the matrix is complete, causing each ring to be 180 degrees rotated with respect to the next one.
By luck, this is also the correct transformation to apply to the final, completed matrix to get the final result.

Python 2, 104 bytes
def f(x):l=len(x)-1;r=range(l+1);return[[[x[l-i][j],x[i][l-j]][min(i,j,l-i,l-j)%2]for i in r]for j in r]

Try it online!
x[l-i][j] are the coordenates of a clockwise turn, x[i][l-j] for a counterclowise turn.
min(i,j,l-i,l-j)%2 is used to pick the right direction

returning rotations recursively.

@tuskiomi hmm??

@tuskiomi I tried a recursive approach in ES6. It was about twice as long as a simple port of this answer...

Mathematica, 113 bytes
r=Reverse;(l=Length[s=#];Table[s[[i+1;;l-i,i+1;;l-i]]=r/@r@s[[i+1;;l-i,i+1;;l-i]],{i,⌊l/2⌋}];r/@Transpose@s)&

it is better to input as char string like "E" for special letters like E,I...
input

[{{1, 2, 3, 4, 5, 6}, {A, B, C, D, "E", F}, {G, H, "I", J, K, L}, {M,
     N, O, P, Q, R}, {S, T, U, V, W, X}, {Y, Z, "!", "@", "#", "&"}}]

output

{{Y, S, M, G, A, 1}, {Z, "E", K, Q, W, 2}, {"!", D, O, "I", V,
    3}, {"@", C, P, J, U, 4}, {"#", B, H, N, T, 5}, {"&", X, R, L, F,
    6}}

Octave, 86 bytes
@(a){k=a;k(x=2:end-1,x)=0;a=rot90(a);a(m)=rot90(a,-2)(m=~mod(bwdist(+k,'ch'),2));a}{5}

Try it online!

APL (Dyalog Unicode), 35 bytes (SBCS)
Full program. Prompts for APL matrix expression. Requires 0-based indexing.
⍉⌽m⊣{(b↓e↓m)←⌽⊖b↓m↓⍨e←-b←2⍴⍵}¨⍳≢m←⎕

Try it online!
m←⎕ prompt for matrix and assign to m
≢ tally the number of rows in it
⍳ ɩndices zero through one less than that
{…}¨ apply the following lambda to each element (denoted ⍵ in the code) of that:
 2⍴⍵ reshape the index to a two-element list
 b← assign to b (for beginning)
 - negate that
 e← assign to e (for end)
 m↓⍨ drop that many (negative, so trailing) rows and columns from m
 b↓ drop that many leading rows and columns from that
 ⊖ flip upside down
 ⌽ mirror
 (…m)← assign to the following sub-array of m:
  e↓ drop the appropriate number of rows and columns from the end (bottom right)
  b↓ drop the appropriate number of rows and columns from the beginning (top left)
m⊣ ignore the pass-through values of all the assignments, in favour of the updated value of m
⌽ mirror
⍉ transpose

APL (Dyalog Unicode), 81 bytes
{u⊃+/{⌽[1+2|⍵]∘⍉w×1@(y/⍨∨/¨(⍵,x)∘∊¨y←,∘.,⍨(⍵-1)↓⍳x←1+|⍵-≢w)⊢0×w}¨⍳⌈.5×≢w←⍵}u←⎕UCS

Try it online!
A 2-train which takes the matrix as its right argument.
The idea behind this is to peel the matrix into its rings, like so:
┌──────┬──────┬──────┬──────┐
│123456│123456│      │      │
│ABCDEF│A    F│ BCDE │      │
│GHIJKL│G    L│ H  K │  IJ  │
│MNOPQR│M    R│ N  Q │  OP  │
│STUVWX│S    X│ TUVW │      │
│YZ!@#$│YZ!@#$│      │      │
└──────┴──────┴──────┴──────┘

Then each of these rings are rotated left/right based on their index.
My algorithm for getting the rings has a lot of room for improvement (Porting the python solution may be shorter).
Explanation
⎕UCS convert the matrix to its unicode values
u←⎕UCS store conversion function as u
{...} apply the following function on the matrix:
w←⍵ store argument as w
⍳⌈.5×≢ range 1..ceil(length(w)/2)

Getting the rings
{...}¨ for each value i in the range:
0×w to the input, converted to zeroes,
1@(...) replace the following coordinates with 1s:
1+|⍵-≢⍵ upper limit: length(w) - i
(⍵-1)↓⍳ create range from i to that
,∘.,⍨ get all points in that range
y← store in y
∨/¨(⍵,x)∘∊¨ check which ones are part of the ring, and get a list of booleans
y/⍨ filter y using the boolean array
w× multiply w with that (vectorizes)
⌽[1+2|⍵]∘⍉ Rotate right if i is odd, otherwise left

Finally,
+/ sum all the matrices (vectorizes)
⊃ unwrap
u convert back to character matrix.

Jelly, 19 18 bytes
ŒJUC;L‘_ɗ@ṂḂʋ¦€œịṁ

Try it online!
Explanation
ŒJUC;L‘_ɗ@ṂḂʋ¦€œịṁ   Main monadic link
ŒJ                   Multidimensional indices
  U                  Reverse each
              €      For each
            ʋ          (
    ;                    Join with
        ɗ                (
     L   @                 Length of the input
      ‘                    Increment
       _                   Subtract the argument
                         )
          Ṃ              Minimum
           Ḃ             Parity
            ʋ          )
             ¦         At the obtained index
   C                   subtract it from 1
               œị    Index into the input
                 ṁ   Reshape to be the same as the input

R, 98 bytes
f=function(m,r=T,d=length(m)^.5){n=t(m)[d:1,]
if(r)n[]=rev(n)
if(d>2)n[e,e]=f(m[e<-3:d-1,e],!r)
n}

Try it online!
How?
At each recursive step, rotate the matrix clockwise by transposing it and reversing the rows.
Then, if it should be an anticlockwise rotation, reverse all the elements.
Finally, replace the 'internal matrix' with the results of a recursive call, with the rotation set to the opposite direction.
interlaced_rotate=
f=function(m,r=T,       # recursive function:
                        # m=matrix
                        # r=direction of rotation (TRUE=clockwise, FALSE=anticlockwise)
d=length(m)^.5){        # d=length of matrix side
  n=t(m)[d:1,]          # n=m rotated clockwise by transposing & reversing rows
  if(r)n[]=rev(n)       # if it's an anticlockwise rotation, reverse the elements
  if(d>2)               # if the 'internal matrix' has a side-length of >1:
    n[e,e]=             # replace it with
    f(m[e<-3:d-1,e],!r) # a recursive call, reversing the direction
n}                      # finally, return n