text:
Bit delivery in Bin City
sandbox
Story
Similar to a newspaper route you have been tasked with delivering bits to the residents of Bin City.  Just as certain people like certain newspapers, the citizens of Bin City prefer either \$1\$s or \$0\$s delivered to their doorstep.  Unfortunately, your new boss has arranged the deliveries in an awkward manner.
The residential streets of Bin City all have multiples of \$8\$ houses. So naturally, your delivery routes are organised as a series of one or more bytes. Your boss has laid out the deliveries as follows: first off, start at the house at the beginning the street on the left-side, followed by the house opposite on the right-side of the street, then the next house after the first one on the left-side of the street, then the one opposite it on the right-side, etc.  The \$1\$s and \$0\$s to be delivered along this route are stored, in order, in the
 bits of the bytes.
Task
You've quite rightly deduced it would be far easier and more time effective to deliver the bits starting from the first house on the left-side of the street and continue on delivering bits up the left-side to the end. Then cross the street to the house opposite on the right-side and continue on down the right-side back to what would have originally been your second delivery at the end.
Illustration for eight houses (one byte)
The original input route is on the far left next to the byte containing the bits to be delivered along that route. Beside it, to the right, is the output byte with the bits rearranged for the new improved delivery route on the far right.

Input and output
The input will be between \$1\$ and \$8\$ bytes long, organised by your boss in a  back-and-forth left-side to right-side manner as above. This can be in any convenient byte-wise way (eg not a list of bits, but a list of bytes, words, or double-words etc is ok). A 64-bit integer along with the bit-length is ok too. A bit-length will be needed for any structure using elements larger than a byte. The order can be in any convenient bit-wise way (i.e. least-significant to most-significant bit or vice versa) and any convenient byte-wise way (eg first element in a byte list to last or vice versa, least--significant to most-significant byte or vice versa in a list or words or double-words etc  traversed first to last or vice versa) so long as the output follows the same convention. The output must use the same structure and ordering convention as the input but with the bits rearranged to be up the left-side then back down the right-side in the manner described above.
Please state your bit-wise and byte-wise ordering as well as your i/o structure.
Scoring and winning criterion
Standard code-golf rules apply. Shortest code in bytes wins.
Test cases
As lists of bytes ordered least-significant bit to most-significant bit and first  byte to last byte in the list.
[85] -> [15]
[85, 85] -> [255, 0]
[85, 85, 85] -> [255, 15, 0]
[85, 85, 85, 85] -> [255, 255, 0, 0]
[85, 85, 85, 85, 85] -> [255, 255, 15, 0, 0]
[85, 85, 85, 85, 85, 85] -> [255, 255, 255, 0, 0, 0]
[85, 85, 85, 85, 85, 85, 85] -> [255, 255, 255, 15, 0, 0, 0]
[85, 85, 85, 85, 85, 85, 85, 85] -> [255, 255, 255, 255, 0, 0, 0, 0]
[170] -> [240]
[170, 170] -> [0, 255]
[170, 170, 170] -> [0, 240, 255]
[170, 170, 170, 170] -> [0, 0, 255, 255]
[170, 170, 170, 170, 170] -> [0, 0, 240, 255, 255]
[170, 170, 170, 170, 170, 170] -> [0, 0, 0, 255, 255, 255]
[170, 170, 170, 170, 170, 170, 170] -> [0, 0, 0, 240, 255, 255, 255]
[170, 170, 170, 170, 170, 170, 170, 170] -> [0, 0, 0, 0, 255, 255, 255, 255]
[208] -> [28]
[96] -> [40]
[155, 36] -> [37, 210]
[232, 33] -> [24, 114]
[174, 18, 247] -> [66, 191, 248]
[130, 143, 125] -> [48, 111, 157]
[76, 181, 117, 107] -> [122, 159, 46, 67]
[158, 238, 106, 124] -> [166, 232, 230, 223]
[233, 87, 232, 152, 182] -> [249, 72, 182, 117, 120]
[142, 61, 195, 199, 218] -> [114, 185, 220, 153, 214]
[107, 131, 170, 25, 103, 171] -> [25, 80, 27, 175, 244, 233]
[71, 41, 113, 118, 202, 26] -> [27, 237, 72, 220, 42, 134]
[30, 226, 236, 110, 111, 211, 202] -> [134, 170, 219, 216, 233, 126, 203]
[162, 53, 89, 29, 128, 172, 134] -> [112, 125, 32, 146, 23, 68, 178]
[112, 71, 252, 192, 100, 176, 108, 71] -> [188, 142, 74, 186, 104, 35, 113, 40]
[111, 58, 224, 222, 231, 246, 214, 200] -> [75, 232, 235, 142, 149, 187, 61, 238]

Same test cases in hex
These may look odd, but remember they are byte-wise from beginning to end, and bit-wise from least-significant to most-significant bit (i.e. in opposite directions).
55 -> 0F
55 55 -> FF 00
55 55 55 -> FF 0F 00
55 55 55 55 -> FF FF 00 00
55 55 55 55 55 -> FF FF 0F 00 00
55 55 55 55 55 55 -> FF FF FF 00 00 00
55 55 55 55 55 55 55 -> FF FF FF 0F 00 00 00
55 55 55 55 55 55 55 55 -> FF FF FF FF 00 00 00 00
AA -> F0
AA AA -> 00 FF
AA AA AA -> 00 F0 FF
AA AA AA AA -> 00 00 FF FF
AA AA AA AA AA -> 00 00 F0 FF FF
AA AA AA AA AA AA -> 00 00 00 FF FF FF
AA AA AA AA AA AA AA -> 00 00 00 F0 FF FF FF
AA AA AA AA AA AA AA AA -> 00 00 00 00 FF FF FF FF
D0 -> 1C
60 -> 28
9B 24 -> 25 D2
E8 21 -> 18 72
AE 12 F7 -> 42 BF F8
82 8F 7D -> 30 6F 9D
4C B5 75 6B -> 7A 9F 2E 43
9E EE 6A 7C -> A6 E8 E6 DF
E9 57 E8 98 B6 -> F9 48 B6 75 78
8E 3D C3 C7 DA -> 72 B9 DC 99 D6
6B 83 AA 19 67 AB -> 19 50 1B AF F4 E9
47 29 71 76 CA 1A -> 1B ED 48 DC 2A 86
1E E2 EC 6E 6F D3 CA -> 86 AA DB D8 E9 7E CB
A2 35 59 1D 80 AC 86 -> 70 7D 20 92 17 44 B2
70 47 FC C0 64 B0 6C 47 -> BC 8E 4A BA 68 23 71 28
6F 3A E0 DE E7 F6 D6 C8 -> 4B E8 EB 8E 95 BB 3D EE

Reference implementation in Python.

So the TL:DR here is to pack and concatenate the even bits, with bit-reversed odd bits.  For some multiple of 8 number of total bits.  If only AArch64 had x86's pext, or x86 had ARM's rbit, a machine-language answer could be very compact (and efficient without a SIMD lookup table for nibbles).

@PeterCordes Yes indeed. :-)

x86-64 machine code function, 22 bytes
Callable with the Windows x64 calling convention: bit length in ECX, bit-pattern in RDX (first = least significant bit aka right-most).  Returns in the low ECX bits of RAX.
NASM listing with machine code and the source it was assembled from:
 5                         bit_even_reverseodd:
 6 00000000 D1E9               shr  ecx, 1
 7 00000002 51                 push rcx                    ; save n/2 for later
 8                         .loop:               ; do {
 9 00000003 48D1EA             shr  rdx, 1                 ; shift low bit into CF (carry flag)
10 00000006 49D1D8             rcr  r8, 1          ; rotate even bits into the top of R8
11 00000009 48D1EA             shr  rdx, 1
12 0000000C 11C0               adc  eax, eax       ; odd bits into the bottom of RAX (reversing).  Same as rcl but faster
13 0000000E E2F3               loop .loop       ; }while(--rcx);
14
15                             ; return in EDX:EAX?  Nope, that has a gap for bit lengths less than 64, as well as hard to justify
16 00000010 59                 pop  rcx
17 00000011 4C0FA5C0           shld rax, r8, cl    ; shift even bits into the bottom
18 00000015 C3                 ret

Explanation:
Loop N/2 iterations, separating the odd and even bits into different registers, 2 input bits per iteration.  (Into the carry flag then rotate-through carry back out).
Shifting into the top and bottom of 64-bit registers sets us up for a shld double precision shift that shifts in bits from another register instead of zeros.
The return value is the low ECX bits of RAX.  It gets there by being shifted one bit at a time for the first half, then the 2nd half all at once.  Bits above that bit position may be non-zero, depending on the initial value of RAX.  These bits are not part of the return value.
If you think this is too much of a stretch of the rules, it costs 2 bytes for an xor eax, eax before the loop.  Or a BMI2 bzhi on the return value, using the BIT_LEN in a register.  But presumably the caller in this question's example use-case wants to loop over the resulting bits, and they're in the right order for that.  Real x86 calling conventions allow high garbage in return-value registers, the only differences here are that the width isn't a power of 2, and is runtime variable.
Try it online! - includes a test _start caller that hexdumps the selected number of bytes before / after calling the function.  (Tweaked version of the SSSE3 qword->hex version on https://stackoverflow.com/questions/53823756/how-to-convert-a-binary-integer-number-to-a-hex-string)
The test caller only prints the selected number of bits in the return value.  If it wanted to avoid leading zeroes, that would take the same effort as avoiding leading garbage.
Example output with input loaded from db 170, 170, 170, 170, 170, 170, 170, 170, and bit-length = 8 * 5
aaaaaaaaaa
fffff00000

i.e. the 64-bit return value was 0x000000fffff00000, or would be after clearing high bits outside the low 40.  Bits in a register have no endianness.  The caller can iterate them in low-to-high order by right shifting.
Since x86 is little-endian, if we stored that to memory the significant 00 bytes would be at the low 2 addresses, and the 0xf0 (240) byte would be the 3rd, followed by two 0xff bytes.
The test cases in the question use that little-endian byte-order to dump bytes separately, not printing as a single wide integer with high/late/most-significant bits left-most as per standard arabic-numeral ordering for the whole thing as one number.
It's easy to input that ordering with db 170, 170, ... (even with decimal chunks like the original form of the test cases), if you don't mind loading from memory, but less convenient to output.  I didn't want to write a bigger loop, and hex is obviously the more useful way to look at bit-pattern manipulation like this.

The TL:DR of the bit manipulation is to pack and concatenate the even bits with the bit-reversed odd bits.  For some multiple of 8 number of total bits.
If only AArch64 had x86's BMI2 pext, it could be very compact.  If x86 had ARM/AArch64's rbit, that would be fun, but x86 takes a 10-byte mov reg, imm64 to create an 8-byte alternating-bits constant.  (Unlike AArch64 which can do it in one 4-byte instruction with its repeating-bit-pattern immediates for logical instructions).
To do this efficiently on x86 you'd use pshufb as a nibble LUT to bit-reverse maybe after packing with BMI2 pext.  Or maybe palignr and another pshufb with a shuffle control from a bit-length lookup table.  (pext/pdep are very slow on AMD, but single-uop / 3-cycle latency on Intel)

Great answer +1, and the unused bits can have anything in them since they're, er, not used! :-) And I'll post the test-cases in hex.

@Noodle9: Fun question, nice to have one that CPUs were made for, but which high-level languages often don't expose easily.  (At least ISAs with a carry flag and rotate-through-carry or double-shift instructions, e.g. not MIPS.)

Posted test cases in hex, probably not the exact format you'd like. Note that the structure is still as a list of bytes from beginning to end of list, lsb to msb within the bytes.

@Noodle9: Thanks. Yeah, sorting out the test-case byte-order vs. bit-order to make sure I didn't have a bug in combining the halves the wrong way took almost as long as writing the function. (Longer if you count writing the test harness, too).  Eventually grokked that your test cases are N-bit integers in little-endian byte order, which is something totally familiar x86 asm hackers. (And that my hex print function was working the way I thought it did, after double-checking register values with GDB.  Had to add code to discard the high garbage to stop confusing myself!)

The middle byte for odd lengths has bits from both halves, and 0x0f vs. 0xf0 is fairly definitive, so at least I was pretty sure my actual answer was right for most of the time, but using my own hexdump code (in hindsight I could maybe have called printf) added room for doubt there.

Yeah, the middle bytes of odd length test cases worried me until I methodically went through the byte-wise and bit-wise ordering a few times.

+1! I contemplated trying this with 16-bit 8086 but dealing with cascading bit shifts lost any elegance of being able to use rotate/shift and carry operations. So nice and clean with 64 bit regs!

@640KB: Thanks, fixed.  That was left over from before I noticed that I could make it compatible with __attribute__((ms_abi)) instead of x86-64 System V with dummy args to pad the count into RCX.  And Windows x64 has very few call-clobbered "low" regs, but both uses of RDI were the 64-bit reg and needed a REX prefix anyway so I could just change to R8.

And RDI is nonvolatile and you'd be required to put it back on return, no?

@640KB: yes, exactly.  x86-64 SysV uses RDI as the first arg-passing reg; in Windows x64 it's call-preserved like in 32-bit calling conventions.  Of course this is an asm answer so I get to make up whatever calling convention I can justify as reasonable. (e.g. returning in EDX:EAX would be a stretch, even if it only had to work for bit_length=64.  Some CPU instructions like RDTSC produce or take 64-bit integers split across EDX:EAX even in 64-bit mode, but that's nasty and only justified by using the same microcode as 16/32-bit modes.)

But when I can do so for no byte cost, I write a C prototype like int foo(int dummy, int dummy, unsigned long bit_pattern, unsigned bit_length); for x86-64 System V or whatever.

05AB1E, 12 bytes
Port of the Python answers. -1 Thanks to Kevin Cruijssen. -2 Thanks to Grimmy.
₁sm+b¦2ι`R«C

Try it online!
Explanation
₁            Push 256.
 s           Swap to get another input.
  m          Push 256 ** (input).
   +         Add by the other input.
    b        Convert to base 2.
     ¦       Remove the first item of ^
      2ι     Uninterleave.
        `    Dump onto stack.
         R   Reverse second copy.
          «  Merge.
           C Convert from base 2.

@KevinCruijssen Is there a shorthand for 2ι here? I feel like it's definitely golfable..

Not that I'm aware of. I was actually about to post that exact same answer when you beat me to it.

I don't think this one works. Both python answers do multiple-of-8 padding (which requires the second input: the number of bytes) to the binary digits before rearranging the bits; this answer doesn't.

@Bubbler Mine was a port of dingledooper's answer, forgive me as I also checked with the wrong test cases.

Your current approach with the absolute different of 8 only works for inputs of 1 byte.. Why not just take the length as additional input like the Python answer does. Then you can do bs8*jð0:2ι`R«C for 14 bytes: try it online or verify all test cases.

You can take the bit-length as a number of bits, not bytes, if you want.  That would save multiplying it, IIUC.

12

J, 40 34 31 29 bytes
_8#.\[:(\:[:-/\#\.)@,(8$2)#:]

Try it online!
-3 bytes thanks to Bubbler's suggestion of applying the alternating sequence trick from APL
-2 bytes thanks to FrownyFrog
Takes input in little-endian format.

_8(#.\((\:-/\)#\.))&,(8$2)#:]. Which is really _8#.\[:(\:[:-/\#\.)@,(8$2)#:] but obfuscated.

Very nice, thank you!

APL (Dyalog Unicode), 22 bytes
{83⎕DR⍵[⍒-\⍳≢⍵]}11∘⎕DR

Try it online!
Another case of alternating sequence trick.
I/O format is signed 8-bit integers, and the byte order is reversed from the OP's (bit order within each byte is the same).
How it works
{83⎕DR⍵[⍒-\⍳≢⍵]}11∘⎕DR  ⍝ Input: a vector of signed bytes
                11∘⎕DR  ⍝ Reinterpret as boolean vector (8bit/byte)
{              }        ⍝ Pass into inline function
      ⍵[⍒-\⍳≢⍵]  ⍝ Use alternating sequence trick to rearrange bits
 83⎕DR           ⍝ Convert back to a vector of signed bytes

Python 3.8, 50 bytes
lambda n,x:int((t:=f"{x:0{n*8}b}")[::2]+t[::-2],2)

Try it online!
Format: visit from MSB to LSB. Input is number of bytes n and an integer x representing the boss's order.
Simply converts x to a binary string t of length 8*n, then perform the following string slicing:
t[::2]+t[::-2]

which takes all the even indexed bits, then takes all the odd indexed bits in reverse order.

K (oK), 46 bytes
{|t/'0N 8#{(*x),|x@1}|:+:0N 2#,/(|(t:8#2)\)'x}

Try it online!
A naive solution. I'll try to improve it later.

Motorola M68HC11 machine code function, 96 bytes
Hexdump:
300808E6003A17343436860418306400
18660264001869014A26F3095A270C17
18A800850126E3325D26DC33C5012716
86041866011866024A26F73C543A18A6
02A701383131E60054173A59C4013C18
383A33E701083318E70018094A26F339
Takes input as a length-prefixed byte array on the stack and returns as a length-prefixed byte array on the stack.
If you run this on an emulator, you may get "uninitialized memory" warnings at SUB+0x10 and SUB+0x15; these can be ignored.
ASM source:
SUB
    TSX
    INX
    INX
    LDAB 0,X
    ABX
    TBA

TRANSFORM_LOOP
    DES
    DES

    PSHA
TRANSFORM_BYTE_PAIR_LOOP
    LDAA    #4
    TSY
TRANSFORM_BYTE_LOOP
    LSR 0,X
    ROR 2,Y
    LSR 0,X
    ROL 1,Y
    DECA
    BNE TRANSFORM_BYTE_LOOP

    DEX

    DECB
    BEQ TRANSFORM_DONE
    TBA
    EORA    0,Y
    BITA    #01
    BNE TRANSFORM_BYTE_PAIR_LOOP * ODD
    PULA     * EVEN
    TSTB
    BNE TRANSFORM_LOOP
TRANSFORM_DONE
    * Now, size, array is at 0,X and output(ish) is at 0,Y
    PULB
    BITB    #01
    BEQ BYTES_READY
    LDAA    #4
FIX_MIDDLE_BYTE_LOOP
    ROR 1,Y
    ROR 2,Y
    DECA
    BNE FIX_MIDDLE_BYTE_LOOP

    PSHX
    LSRB * B /= 2
    ABX
    LDAA    2,Y
    STAA    1,X
* Now the middle byte is dealt with for odd-sized arrays
    PULX
    INS
    INS

BYTES_READY
    LDAB 0,X
    LSRB
    TBA
    ABX  * 1.X is after the middle
    PSHX
    PULY * 0,Y is before the middle
    ROLB
    ANDB #01
    ABX

MOVE_BYTES_LOOP
    PULB
    STAB 1,X
    INX
    PULB
    STAB 0,Y
    DEY
    DECA
    BNE MOVE_BYTES_LOOP

    RTS

Charcoal, 37 bytes
≔⪪⭆⮌Ａ◧⍘ι²¦⁸¦²θＩＥ⪪⁺⮌ＥθΣ§ι¹ＥθΣ§ι⁰¦⁸↨²⮌ι

Try it online! Link is to verbose version of code. Explanation:
≔⪪⭆⮌Ａ◧⍘ι²¦⁸¦²θ

Take the input array, reverse it, convert each byte to binary padded to 8 bytes, concatenate the result, then split the bits into a list of pairs.
ＩＥ⪪⁺⮌ＥθΣ§ι¹ＥθΣ§ι⁰¦⁸↨²⮌ι

Take the second of each pair of bits, reverse the list, append the first of each pair of bits, split back into bytes, reverse each byte, convert each byte back from binary, convert to decimal.


text:
Find the min and max number of substitutions
The Levenshtein distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other.  Let us call insertions, deletions and substitutions "edit operations".  We will say that any sequence of \$k\$ edit operations that transforms one string into another one is optimal if \$k\$ is also the Levenshtein distance between the two strings.
For example, take the strings \$ab\$ and \$ba\$.  The optimal sequence of edit operations "insert \$b\$ at index 0", "delete the final character" transforms \$ab\$ into \$ba\$.  However a different optimal sequence "substitute the first character for a \$b\$",  "substitute the second character for an \$a\$" also transforms \$ab\$ into \$ba\$. In general there may be many different optimal sequences of edit operations for a given pair of strings.
For an optimal sequence of edit operations we are interested in counting the number of substitutions in the sequence.  In particular, for a given pair of strings, we want to count the smallest possible number of substitutions in an optimal sequence of edit operations and also the largest possible.  We will assume that both strings have the same length.
Example
0000 0000 . In this case every optimal sequence has length 0 and so min = max = 0.
0010 1001 . Levenshtein distance 2 by one insertion and one deletion. min = max = 0.
1100 1110 . Levenshtein distance 1. min = max = 1. There is no optimal sequence with an insertion or deletion.
1010 1100 . Levenshtein distance 2. min = 0. max = 2.
1010 0111 . Levenshtein distance 3. min = 1. max = 3.
0011 1100 . Levenshtein distance 4. min = 0. max = 4.
10000011 11110100. Levenshtein distance 6. min = 2. max = 6.
000111101110 100100111010. Levenshtein distance 5. min = 1. max = 5.
0011011111001111 1010010101111110. Levenshtein distance 7. min = 3.  max = 7.
0010100001111111 0010010001001000. Levenshtein distance 7.  min = 5. max = 7.
10100011010010110101011100111011 01101001000000000111101100000000. Levenshtein distance 15. min = max = 9.
11011110011010110101101011110100 00100010101010111010000000001110. min = 8. max = 12.
32123323033013011333111032331323 13100313103110123321321211233032. min = 6. max = 14.
17305657112546416613111655660524 23146332512152524313021536474017. min = 11. max = 21.

Task
For a given pair of strings of the same length, output the minimum and maximum number of substitutions in an optimal sequence of edit operations for those two strings.
You can assume the input is given in any convenient form you choose and may similarly provide the output in any way that is convenient for you.

Would it be OK to output all valid number of substitutions instead of just the minimum and the maximum? (e.g. [0,2,4] for the 6th test case)

@Arnauld Just the min and max please.

JavaScript (ES10),  169 168  161 bytes
Saved 7 bytes thanks to @KevinCruijssen
Takes the strings as (s)(t). Returns [min, max].
s=>t=>[[...Array(d=(g=(k,m=s.length,n=m,c)=>m*n?1+Math.min(g(k,m,n-1),g(k,--m,n),g(k-=c=s[m]!=t[--n],m,n)-!c):k?1/0:m-~n)())].flatMap((_,i)=>g(i)-d?[]:j=i)[0],j]

Try it online! (fast test cases)
Try it online! (a longer test case which may time out if TIO is overloaded)
Commented
Helper function \$g\$
\$g\$ is a function that computes the standard Levenshtein distance when it's called with \$k\$ undefined, or the edit distance with exactly \$k\$ substitutions when it's called with \$k\ge0\$. An additional offset of \$+1\$ is added to the result in both cases.
NB: It is presented separately for readability but must be defined within the scope of the main function so that the source string \$s\$ and the target string \$t\$ are defined.
g = (                         // g is a recursive function taking:
  k,                          //   k = allowed number of substitutions, or undefined
  m = s.length,               //   m = 1st pointer, initialized to the length of s
  n = m,                      //   n = 2nd pointer, initialized to the length of s
  c                           //   c = substitution cost
) =>                          //       (needs to be defined in the local scope)
  m * n ?                     // if both m and n are greater than 0:
    1 +                       //   add 1 to the final result
    Math.min(                 //   add the minimum of:
      g(k, m, n - 1),         //     recursive call for insertion with (m, n - 1)
      g(k, --m, n),           //     recursive call for deletion with (m - 1, n)
      g(                      //     recursive call for substitution:
        k -=                  //       set c if s[m - 1] is not equal to t[n - 1]
          c = s[m] != t[--n], //       and decrement k if c is set
        m, n                  //       use (m - 1, n - 1)
      ) - !c                  //     subtract 1 from the result if c is not set
    )                         //   end of Math.min()
  :                           // else (leaf node):
    k ?                       //   if k is not equal to 0 or NaN:
      1 / 0                   //     return +Infinity
                              //     (to make sure that this branch is not chosen)
    :                         //   else:
      m - ~n                  //     return m + n + 1

Main function
s => t =>                     // s = source string, t = target string
  [                           // the final result is a pair:
    [                         //   build an array containing:
      ...Array(d = g()),      //     d entries, where d = Levenshtein distance (+1)
    ]                         //
    .flatMap((_, i) =>        //   for each entry at position i in there:
      g(i)                    //     if the edit distance (+1) with i substitutions
      - d ?                   //     is not equal to d:
        []                    //       reject this entry
      :                       //     else:
        j = i                 //       append it to the array and copy i to j
    )[0],                     //   end of flatMap(); return the 1st entry (minimum)
    j                         //   followed by the last entry (maximum)
  ]                           // end of result

This is very nice. It can't run most of the test cases as it is exponential time I assume.

@Anush Yes. This can only work for at most 12 characters on TIO. But the test cases go directly from 4 to 16 characters. Maybe you could add a couple of intermediate ones?

Done. Would either memoization or making your code iterative would solve the speed problem?

@Anush Yes, we really should work on a matrix rather than doing so many recursive calls. But that's code-golf, right? ;)

What is the official policy on code-golf code that doesn't run on all the test cases given in the question?  My guess is that it's fine.

@Anush AFAIK, the consensus is that it doesn't matter as long as it would work in theory, given enough memory and time. (For all code-golf challenges on this site that imply some kind of combinatorial explosion, I think there might be more answers that do not run all test cases than answers that do.)

source: Stack Exchange

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

sort: votes


text:
The ultimate inequality challenge
Task
Given two positive integers a, b and a Unicode mathematical inequality symbol c, determine if a c b is true.
You many take the character or its Unicode codepoint for the input c. You may output your language's truthy/falsy values, or two distinct values for true and false respectively.
Standard code-golf rules apply. The shortest code in bytes wins.
List of symbols to support
Symbol  |  Hex   |  Dec   |  Name
--------+--------+--------+-------------
<       |  003C  |  60    |  Less than
=       |  003D  |  61    |  Equal to
>       |  003E  |  62    |  Greater than
≠       |  2260  |  8800  |  Not equal to
≤       |  2264  |  8804  |  Less than or equal to
≥       |  2265  |  8805  |  Greater than or equal to
≮       |  226E  |  8814  |  Not less than
≯       |  226F  |  8815  |  Not greater than
≰       |  2270  |  8816  |  Neither less than nor equal to
≱       |  2271  |  8817  |  Neither greater than nor equal to

The last four symbols may look broken in Chrome. They are four symbols <>≤≥ with slash overstrike, indicating negation.
Truthy test cases
1 < 2
1 = 1
2 > 1
1 ≠ 2
2 ≠ 1
1 ≤ 1
1 ≤ 2
2 ≥ 1
1 ≥ 1
2 ≮ 1
1 ≮ 1
1 ≯ 1
1 ≯ 2
2 ≰ 1
1 ≱ 2

Falsy test cases
1 < 1
2 < 1
1 = 2
2 = 1
1 > 1
1 > 2
1 ≠ 1
2 ≤ 1
1 ≥ 2
1 ≮ 2
2 ≯ 1
1 ≰ 1
1 ≰ 2
2 ≱ 1
1 ≱ 1

Kind-of related: Evaluate a chain of inequalities

I'm pleased to report that Mathematica does not have built-in support for the symbol ≱.

There must be some language where the empty program will work here.

@GregMartin It does support that symbol and detect that it is the NotGreaterEqual function, but it doesn't have a built-in meaning :(

This would be a lot more "fun" if it included complex numbers, NaN, or something else lacking a total order, so that ≮ wouldn't be equivalent to ≥.

Given that the inputs are integers, is there any distinction between "less than or equal to" and "not greater than"?

@SteveBennett They are the same.

does it need to support both the char and the codepoint, or is it My choice.

@NithinDanday It's your choice to pick one of them to support.

@Bubbler thanks, I'm still not smart enough to figure out how to do this in google sheets

Can we take acb with no spaces, or abc?

@emanresuA acb looks fine. abc would need a space between a and b anyway I guess.

Ok. Trivial eval-as-Vyxal solution, here I come!

JavaScript (ES6),  58 45  42 bytes
Saved 3 bytes thanks to @Neil
Expects the Unicode code point for \$c\$. Returns \$0\$ or \$1\$.
(a,c,b)=>'14353426'[c%61%9]>>(a>b?2:b>a)&1

Try it online!
How?
Each comparison character is assigned a 3-bit mask describing if it should be truthy for a > b, a < b or a == b.
 char. | code | meaning                           | > | < | = | mask
-------+------+-----------------------------------+---+---+---+------
   <   |   60 | Less than                         | 0 | 1 | 0 |  2
   =   |   61 | Equal to                          | 0 | 0 | 1 |  1
   >   |   62 | Greater than                      | 1 | 0 | 0 |  4
   ≠   | 8800 | Not equal to                      | 1 | 1 | 0 |  6
   ≤   | 8804 | Less than or equal to             | 0 | 1 | 1 |  3
   ≥   | 8805 | Greater than or equal to          | 1 | 0 | 1 |  5
   ≮   | 8814 | Not less than                     | 1 | 0 | 1 |  5
   ≯   | 8815 | Not greater than                  | 0 | 1 | 1 |  3
   ≰   | 8816 | Neither less than nor equal to    | 1 | 0 | 0 |  4
   ≱   | 8817 | Neither greater than nor equal to | 0 | 1 | 0 |  2

We store these masks in a 8-character lookup string whose index is computed by applying two consecutive modulos to the code point:
 code | mod 61 | mod 9 | mask
------+--------+-------+------
   60 |   60   |   6   |  2
   61 |    0   |   0   |  1
   62 |    1   |   1   |  4
 8800 |   16   |   7   |  6
 8804 |   20   |   2   |  3
 8805 |   21   |   3   |  5
 8814 |   30   |   3   |  5
 8815 |   31   |   4   |  3
 8816 |   32   |   5   |  4
 8817 |   33   |   6   |  2

42 bytes: '14353426'[c%61%9]>>(b<a?2:b>a)&1

@Neil This is precisely what I was trying to do, but I got bogged down with the lookup update. Thanks!

Python 2, 45 bytes
lambda a,o,b:o%83*45%555%16%6+1>>cmp(a,b)+1&1

Try it online!
Improved based on @Arnauld's answer, make sure to upvote him!
The bitmask here is a different from @Arnauld's answer because bit 0 and 1 are swapped. As usual, the lookup table is replaced by some cool magic numbers.
Python 3, 51 48 47 bytes
lambda a,o,b:o%83*45%555%16%6+1>>(a>b)+(a>=b)&1

Try it online!

Python 2, 47 46 bytes
lambda a,o,b:(cmp(a,b)==1-o*6%43%7%3)^o*3%58%3

Try it online!
Every operation can be expressed by (cmp(a,b)==a)^b. For example, a<b iff (cmp(a,b)==-1)^0. We then use some dirty magic numbers to compress a and b.
Python 3, 51 49 48 bytes
lambda a,o,b:((a<b)+(a<=b)==o*6%43%7%3)^o*3%58%3

Try it online!

05AB1E, 34 33 24 23 18 bytes
•1P42•b3ôs61%èŠ.Sè

-9 bytes by porting @ovs' Python 3 answer, so make sure to upvote him!
-6 bytes thanks to @Grimmy.
Input of the character as codepoint integer. Input-order as c,b,a.
Try it online or verify all test cases.
Explanation:
•1P42•             # Push compressed integer 18208022
      b            # Convert it to binary 1000101011101010100010110
       3ô          # Split it in parts of size 3:
                   #  [100,"010",101,110,101,"010","001","011",0]
         s         # Take the first codepoint input
          61%      # Take modulo-61
             è     # Index it into the binary list (0-based and with wraparound)
              Š    # Triple-swap to take the next two inputs
               .S  # Compare them (-1 if a<b; 0 if a==b; 1 if a>b)
                 è # And use that to index into the triplet (where -1 is the last item)
                   # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to compress large integers?) to understand why •1P42• is 18208022.

Here's 18

Python 3, 99 82 bytes
17 bytes saved thanks to @ovs!
Uses the operator similarities a<b <=> a≱b, etc.
lambda a,o,b:[a<b,a>b,a<=b,a>=b,a==b,a!=b]['<≱>≰≤≯≥≮= ≠'.find(o)//2]

Try it online!

This is shorter without operator: https://tio.run/##XZDBioMwEIbP9SlmTzEQWszeSuKLWA8JRVboGmk92EfIW/Sg162@Ul7ENUIxk0DCfPw/M/OnfXY/pvleKpBwWW7qV18VKGaYPhdKaKby9QrpC/9I/3xJXRZEODvnzk7ODs6@nR2d/ZPg7Iscq7q5poaeTrxcKnOHHuoGigTWQzIQwAn7gITsAxzyHTLfaTfyDZE6xIjMI1bHcMy6KFYjfMeIOk9YnTd1zxbMEaFThl1kqOQYOP4CtPcQp@I4Blo0ijHFiMxznCojSXlODoqBYaDXjfvjo73VXUqTQ3uvmy7tGRBJGFSpJ0U3py81pXT5Bw

@ovs right, thanks!

Python 2, 42 41 38 bytes
Takes in as input two operands \$ a \$ and \$ b \$, and the operator \$ c \$ in codepoint form. Test cases nicely borrowed from @newbie.

lambda a,c,b:(cmp(a,b)+63)*c%1895%57&1

Try it online!

The idea is the same as @newbie's, generating pseudorandom numbers until they match the output. The cmp function returns -1, 0, or 1 if the left argument is less, equal to, or greater than the right argument, respectively. And also because MathJax looks nice, here is the formula in MathJax:
$$ ((((\text{cmp}(a,b) + 63) * c) \bmod 1895) \bmod 57) \bmod 2 $$

Nice :)))))))))

39 bytes, i guess i'll leave my answer unchanged

@newbie That's a great answer, but I think you should post it as yours, since you found it.

Python 3, 68 59 bytes
Takes the unicode code point of the operator as input.
lambda a,o,b:[a==b,a>b,a<=b,a>=b,a<=b,a>b,a<b,a!=b][o%61%9]

Try it online!

APL (Dyalog Unicode), 50 bytes
{⍎('≥≤><',⍵)[⍵⍳⍨'≮≯≰≱',⍵]}

Try it online! (the test cases)
Dyalog APL supports many of those operators and a simple "eval()" ⍎ will handle them as given. This answer swaps the last four which are not supported '≮≯≰≱' with replacements that are supported, e.g. "not less than" becomes "greater than or equal to", then "eval()"'s the resulting string. Output is 1 for true, 0 for false.
(NB. on the score: It's only 26 characters which would be competitive, however because it has ≮≯≰≱ characters in it, it does not fit in a pre-existing 8-bit APL character set so must be scored with the UTF-8 byte count instead of the number of characters).

QuadR, 34 bytes
⍎⍵
≮
≯
≰
≱
≥
≤
>
<

Try it online!
Simply replaces the redundant symbols with their simpler equivalents, and then evaluates as APL.

Dyalog APL, 23 bytes.
⎕(⍎'=>≤≥≤><≠'[9|61|⎕])⎕

With Adám's assistance. Try it online! (the test cases)
Explained:
The ⎕ are prompts for numeric input, it takes the numbers on the outsides, and the codepoint of the comparison operator in the middle. Codepoint modulo | 61 then 9 produces indices into the string ''[] which pick the comparison operator to run. This maps the unsupported ones (≮ ≯ ≰ ≱) to their supported equivalents ("not less than" maps to "greater than or equal to", etc).
Code demonstrates an unusual APL feature: 1 (⍎'<') 2 where the string '<' evaluates ⍎ to a function which can be called in-place like any other 1 f 2 dyadic APL function call.
NB. I'm submitting this as a separate answer both because it's a different approach to my other APL answer, and because it does not contain the unsupported comparison characters in it, which means it fits in a pre-existing 8-bit APL character set, and can be scored as 1-byte-per-character instead of UTF-8 byte count, for a much lower score.

Sledgehammer, 17 bytes
16.75, to be overly specific
⣕⢌⢲⢼⠴⢺⢟⢼⣑⣮⣊⠞⠀⢄⡕⡝⢥

There's no point in trying to read that, so here's the corresponding Mathematica code with a reasonable explanation:
ToExpression@StringReplace[ToString@FullForm@ToExpression@Input[],"ot"->"ot@"]

The code evaluates the expression first. Unfortunately, the ≱ operator (and a few other similar ones) is not supported, and is kept verbatim. The code then rewrites the expression into a prefix-ish form (NotGreaterEqual[1, 1]), and replaces ot with ot@, turning NotGreaterEqual[1, 1] into Not@GreaterEqual[1, 1], a call of the function Not on the result of GreaterEqual. Of course, since that was a string replacement, the result is then evaluated once again.

Io, 90 bytes
Port of the Python answer.
method(a,o,b,list(a<b,a>b,a<=b,a>=b,a==b,a!=b)at("<≱>≰≤≯≥≮= ≠"findSeq(o)/2))

Try it online!

Retina 0.8.2, 80 bytes
\d+
$*
≠
<>
≤|≯
<=
≥|≮
=>
≰
>
≱
<
^(1+)(<.?1\1|.?>(?!\1)|<?=>?\1$)

Try it online! Link includes test suite. Takes input as acb, but the test suite deletes spaces to make the input more readable. Explanation:
\d+
$*

Convert to unary.
≠
<>
≤|≯
<=
≥|≮
=>
≰
>
≱
<

Replace the Unicode operators with ASCII-based logical operators. The => is reversed to make the final condition golfier.
^(1+)(<.?1\1|.?>(?!\1)|<?=>?\1$)

Match the first number, then check whether one of the relations can be fulfilled.

If the character after the first number is a <, then after an optional > or =, then to fulfil this relation the second number needs to equal 1 or more than the first number.
If after an optional < or =, there is a > before the second number, then to fulfil this relation the second number must not be at least equal to the first number.
If after an optional < there is an = before an optional >, then to fulfil this relation the second number must be equal to the first number.

C (gcc), 46 bytes
f(a,c,b){a="14353426"[c%61%9]>>(a>b?2:b>a)&1;}

Try it online!
Port of Arnauld's JavaScript answer.

Vyxal D, 16 bytes
4ɾ8813+C`≥≤><`ĿĖ

Try it Online!
Luckily, Vyxal supports all but the last four characters as operations.
               Ė # Evaluate...
              Ŀ  # The input, with characters in...
       C         # The charcodes of
4ɾ               # 1...4
  8813+          # + 8813
              Ŀ  # Replaced...
        `≥≤><`   # with the cooresponding character

Charcoal, 38 bytes
Ｎθ≔Ｉ§”←⧴LH⎚G₂ⅉυ”℅ＳηＮζ⁼§⟦‹θζ⁼θζ›θζ⟧η÷η³

Try it online! Link is to verbose version of code. Takes input as a c b and outputs a Charcoal boolean, i.e. - for true, nothing for false. Explanation:
Ｎθ

Input a.
≔Ｉ§”←⧴LH⎚G₂ⅉυ”℅Ｓη

Input c and cyclically look up its ordinal in the compressed string __20__345___02531_ (the _s are arbitrary; the linked code uses spaces) and save its value.
Ｎζ

Input b.
⁼§⟦‹θζ⁼θζ›θζ⟧η÷η³

Make a list of the comparisons a<b, a=b, a>b, cyclically index using the c value, and negate the result if the c value is less than 3.

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


text:
Construct the suffix automaton

In computer science, a suffix automaton is the smallest partial deterministic finite automaton that recognizes the set of suffixes of a given string. (Wikipedia)

Given a string \$S\$ consisting of lowercase letters (a-z), construct the suffix automaton for it.
A suffix automaton is an array of states, 0-indexed or 1-indexed, depending on your implementation. The ID of a states is defined to be its location in the aforementioned array. The initial state \$t_0\$ is the state that corresponds to the empty string, and must be first in the array of states.
A state is defined as a sequence of 27 integers:

The first integer is the state's suffix link, or the ID of the state that corresponds to the current state's longest suffix that occurs more times than the current state in \$S\$. In the case the this state is \$t_0\$, this value should be equal to a special value that is not a state ID.
The second to 27th integer corresponds to the state's transition pointer, or the state ID that corresponds to this state's string + a letter, for characters a through z respectively. In the case that such a state does not exist, this value should be equal to a special value that is not a state ID.

For further information on a suffix automaton and how to construct it, see the wikipedia page and the CP-algorithms page.
Input
The input string will be given in any acceptable format.
Output
Output the array of states in any acceptable format. Be sure to state the "special values that is not a state ID".
Example
For the string abbbcccaabbccabcabc, the suffix automaton's states should be structured similarly to this (blue edges = transition pointer, green dashed edges = suffix link):

For the string ddbadbdbddddbdbcabcdcaccabbbcbcbbadaccabbadcbdadcdcdbacbcadbcddcadcaaaacdbbbcaaadcaddcbaddbbcbbccdbc:

Scoring
This is code-golf, so shortest program (in bytes) wins.
Your code should run reasonably fast (in at most 10 seconds) for a string of length \$10^6\$. (If this requirement is too strict, I will relax the limit.)

I think the time requirement is too strict. It completely rules out everything except the O(nlogk) algorithm, and in some languages even the O(nlogk) might not run in 2 seconds, rendering some languages completely useless for this challenge. I also think you should set a less ambiguous definition of "your program's return should represent this", because it might lead to conflict regarding what constitutes a representation of a graph and what doesn't.

@WindmillCookies Concerning time limit: You can construct it in O(n). (My C++ code runs in under 1 second.) Concerning representation: I clearly stated the representation as an array of states. (Ok, I reworded it a bit)

This is an awesome question.  If only I had time to answer it. There are tags [tag:restricted-time] and [tag:restricted-complexity].  You may want one of those.

@BaaingCow OK, but still some languages are slow and can't run 10^6 operations in 2 seconds. With that tight of a time limit, everyone will send the port of the same answer and it will not be very interesting.

@WindmillCookies I am not sure this matters does it? The task is sufficiently complicated that answers are likely to be different in detail even if similar in overall approach.  We have lots of trivial code-golf questions on this site and no one complains that all the answers are implementing the same algorithm.  Also, see https://codegolf.stackexchange.com/questions/193011/counting-creatures-on-a-hexagonal-tiling . That's a perfectly good challenge despite the existence of very slow languages.

@WindmillCookies Reasonable, but then can I say "10^6 or the number of array write operations doable in your languages in 0.2 seconds, whichever is less"? Or would it be too complicated?

@Anush What makes an interesting challenge interesting is the different approaches in the answers. When all answers are the same except the programming language, it won't be very interesting. And yes, I do complain all the answers are implementing the same algorithm in those trivial challenges, just not publicly.

@BaaingCow I think something around 10 seconds is reasonable for this

@WindmillCookies Fair, I've changed it to 10 seconds.

@Anush I'm not sure 10 seconds is strict enough to be called "restricted time"? It's not necessary to stop O(n log ∑) in fast languages and all I want to do is to prevent some blatantly wrong methods (n^2 and above? i guess?) and methods that use builtins to find the suffix array (are there any?) and convert it into a SAM (is that even possible?)

@BaaingCow I often want to do the same thing. I think any time restriction is "restricted time". For example it is common in code-golf to give answers that you will never be able to run to completion. I won't complain but maybe other people might.

why not [tag:fastest-code]?

@ngn There's a linear time algorithm, so this is going to be about micro-optimization (assuming anybody will even bother trying to solve this; suffix automatons are annoying...)

For what's worth, here is my implementation of suffix automaton. It's late here and I may golf it tomorrow. Use as you wish. https://ideone.com/M5FNM2 (former one has a typo)


text:
This Question Has _____ Views
Inspired by this Youtube Video from Tom Scott.
Write a program or function that prints the current amount of views this question has.
That's it.
Your program may only access the stack exchange api, any other websites are disallowed.
Output
An integer with the exact amount of views this question has at the moment. Outputs with the k for thousand are disallowed.

It's eventually going to pop the maximum value of the views buffer. By the time we reach that this challenge is going to be extremely trivial to solve.

is directly fetching the stack exchange website allowed? (https://codegolf.stackexchange.com/questions/203590/this-question-has-views)

@CommandMaster Sure.

@petStorm yeah but the challenge remains the same. Even if the amount of views stays the same you can't hardcode the value in

This question is half of this closed question which was closed for being a dupe of a question asking only for the score of the question. The answers to those questions seem very similar to the ones here. For that reason I've closed this for now.

@FryAmTheEggman I am extremely worried that this is the only close vote, so you circumvented all discussion.

@mypronounismonicareinstate This is a common misconception, but I have done no such thing. You, and everyone else, are perfectly free to discuss the merits of this challenge and decide to reopen the question. If anything, closing the question promotes discussion. However, this discussion largely doesn't belong here, so if you have something else to say on this matter I'd recommend making a post on meta about it.

@FryAmTheEggman "I have done no such thing" - that is exactly what you did: you closed the question without allowing for any discussion. "this discussion largely doesn't belong here" - then where does it belong? I can only read your comment as "I do not care, go and complain on Meta if you want to".

@mypronounismonicareinstate I do not think the point of my comment got across. The meta-discussion about whether my actions prevent discussion does not belong here. Though my closing this question has done absolutely nothing to prevent discussion of the merits of this question.

05AB1E, 46 42 36 bytes
Reading from the question-URL: 36 bytes
’ƒËŠˆ.Â‚‹º.ŒŒ/q/’žYì•3X&•«.w'Ž‡¡1èþ¨

-6 bytes thanks to @CommandMaster, by reading from this question's URL instead of the API
No direct TIO, since the .w builtin (to access a website) is disabled on TIO. But:
’ƒËŠˆ.Â‚‹º.ŒŒ/q/’žYì•3X&•«

Try this part online to see the generation of the URL.
'Ž‡¡1èþ¨

Try this part online to see the extraction of the amount of views from the HTML content. (Input doesn't contain the entire HTML content, because the TIO URL would extend 65k+ characters and be too big to post, haha.. xD)
Reading from the API: 46 42 bytes
•3X&•’¸¸.Â‚‹º.ŒŒ/…é/ÿ?€¼=ƒËŠˆ’žYì.w'š‹¡Åsþ

No direct TIO, since the .w builtin (to access a website) is disabled on TIO. But:
•3X&•’¸¸.Â‚‹º.ŒŒ/…é/ÿ?€¼=ƒËŠˆ’žYì

Try this part online to see the generation of the API-URL.
'š‹¡Åsþ

Try this part online to see the extraction of the amount of views from the JSON.
Explanation:
’ƒËŠˆ.Â‚‹º.ŒŒ/q/’
              # Push dictionary string "codegolf.stackexchange.com/q/"
 žY           # Push builtin "https://"
   ì          # And prepend it in front of the url
    •3X&•     # Push compressed integer 203590 (the id of this question)
         «    # Append it to the url
          .w  # Access this URL and read its contents
'Ž‡          '# Push dictionary string "wed"
   ¡          # Split the HTML on this word
    1è        # Get the second item (at index 1)
              #  (i.e. ` 119 times">\n                    <span class="fc-light mr2">Vie`)
      þ       # Only leave the digits (i.e. 1992)
       ¨      # And remove the last digit (2), that was part of the class
              # (after which it is output implicitly as result)

•3X&•         # Push compressed integer 203590 (the id of this question)
 ’¸¸.Â‚‹º.ŒŒ/…é/ÿ?€¼=ƒËŠˆ’
              # Push dictionary string "api.stackexchange.com/questions/ÿ?site=codegolf",
              # where the `ÿ` is automatically filled with this integer
  žY          # Push builtin "https://"
    ì         # And prepend it in front of the url
     .w       # Access this URL and read its contents
'š‹          '# Push dictionary string "count"
   ¡          # Split the JSON on this word:
              #  (i.e. `...,"view_count":14,"answer_count":2,...` will be split to
              #   [`...,"view_`, `":14,"answer_`, `":2,...`])
    Ås        # Pop and only leave the middle item (i.e. `":14,"answer_`)
      þ       # Pop and only leave its digits (i.e. 14)
              # (after which it is output implicitly as result)

See this 05AB1E tip of mine (sections How to use the dictionary? and How to compress large integers?) to understand why ’ƒËŠˆ.Â‚‹º.ŒŒ/q/’ is "codegolf.stackexchange.com/q/"; •3X&• is 203590; 'Ž‡ is "wed"; ’¸¸.Â‚‹º.ŒŒ/…é/ÿ?€¼=ƒËŠˆ’ is "api.stackexchange.com/questions/ÿ?site=codegolf"; and 'š‹ is "count".

Does it actually need the https:// schema on the url with .w? Don't have 05AB1E installed on this machine

Is there anything I need to configure to run it locally? when I try to run it the .w returns the string unchanged

@ExpiredData I think it indeed does need it, although I'm not sure. I've only installed 05AB1E locally for the first time a month ago when TIO was having issues for 2 days straight. Without the https:// it doesn't return anything, but it seems it also doesn't seem to work with for some reason.. :/ If I access a website like google (i.e. "www.google.com".w) it reads it HTML-contents just fine, but if I use "https://api.stackexchange.com/questions/203590?site=codegolf"=.w, it seems there is some kind of encoding issue.. :S Here is the output.

Unfortunately I only ever programmed once in Elixir, so I'm not entirely sure why normal HTML websites are read fine, but that JSON api url is having encoding issues.. In the get_url method it uses HTTPoison.get!(url).body to get the website contents (and the url is already casted to a string earlier).

Does it work better if you just directly get this question and parse view count from that?

37 bytes: •3X&•’ƒËŠˆ.Â‚‹º.ŒŒ/…é/ÿ’žYì.w'Ž‡¡¦¬þ¨

36 by using q instead of …é

@KevinCruijssen Thanks for clarifying

JavaScript (browser), 129 121 129 117 bytes
-12 bytes thanks to Kevin Cruijssen, Command Master!
await fetch`//api.stackexchange.com/questions/203590?site=codegolf`.then(x=>x.json()).then(x=>x.items[0].view_count)

Another version, not using await (136 128 136 bytes):
fetch('https://api.stackexchange.com/2.2/questions/203590?site=codegolf').then(x=>x.json()).then(x=>console.log(x.items[0].view_count))

I think you can save bytes by removing the 2.2/ in the API-URL.

You can also save 3 bytes by replacing https:// with http: (note this won't work in chrome or most other browsers if you loaded the page via https in the first place)

106 bytes - (await(await fetch\http:api.stackexchange.com/questions/203590?site=codegolf`).json()).items[0].view_count`

You can drop the https:, and only use `//api...```

also 111 bytes by directly using the StackExchange site: await fetch('//codegolf.stackexchange.com/q/203590').then(x=>x.text()).then(x=>x.split('wed')[1].split(' ')[1])

96 by using the question directly and @ExpiredData's golf: (await(await fetch`//codegolf.stackexchange.com/q/203590`).text()).split('wed')[1].split(' ')[1]

if you can assume it's run from a specific domain you can (await(await fetch`/q/203590`).text()).split('wed')[1].split(' ')[1] for 68 bytes

You can save a few of bytes on @commandmaster 's 68 by using .split\ `instead of.split(' ')and.split`wed`instead of.split('wed')`

Also on phone so can't test but you may be able to do parseInt(await...split\wed`[1])instead of the.split` `[1]` saving 3 bytes on top

Google Sheets, 99 95 bytes
=Mid(Index(ImportData("https://api.stackexchange.com/questions/203590?site=codegolf"),10),12,99

Sheets will add the trailing parentheses automatically.
ImportData will treat the result as a CSV and split the text into columns.
Index(~,10) pulls the 10th entry from that split result.
Mid(~,12,99) starts at the 12th character and pulls up to the next 99.
So long as the view count doesn't get to 10^99, this will work fine.
Here's a screenshot showing the three steps:

Python 2, 125 117 bytes
-6 bytes thanks to Kaddath
Using only the standard library, unlike the other python answer.
from urllib import*
x=urlopen("http://codegolf.stackexchange.com/q/203590").read()
print x[x.find("wed"):].split()[1]

Python 3, 149 142 bytes
-6 bytes thanks to Kaddath
from urllib.request import*
x=urlopen("http://codegolf.stackexchange.com/q/203590").read().decode("utf-8")
print(x[x.find("wed"):].split()[1])

Do you know that the trailing /70761 is your user id to attribute the link share to you when someone clicks it (for badge I think), but it can be removed from the URL?

sh, 96 bytes
wget -qO- http://codegolf.stackexchange.com/questions/203590|sed -n 's/.*\(V.*mes\).*/\1/p;540q'

This assumes the presence of wget and sed. We can save 5 bytes (the ;540q part) if we can assume there's no more match of V.*mes on the page -- as of this writing, there isn't, but that may not be true after more submissions. This also assumes the first part of the page is fairly static, and the Viewed XXX times sentence appears uniquely before line 540 (which it currently does).
sh, 101 bytes
wget -qO- http://codegolf.stackexchange.com/questions/203590|sed -n 's/.*\(V.*mes\).*/\1/p;/V.*mes/q

Similar to the above, but this variation does not depend on which line the Viewed XXX times appears -- it terminates after the finding the first one.

Python 2 with requests, 113 bytes
from requests import*
t=get('http://codegolf.stackexchange.com/q/203590').text
print t[t.find('wed'):].split()[1]

A pair of () is needed for Python 3 (114 bytes).

You might want to mention that you're using a 3rd party library(requests)

Done, thanks. @SuperStormer

polyglot with python3

oh the print format doesn't work in python3

so for python3 it's +1, with ()

PHP, 96 89 bytes
<?=split(' ',strstr(join(file('http://codegolf.stackexchange.com/q/203590')),'wed '))[1];

Inspired by @newbie's answer. I think I can do better, still a first try. I strangely only got malformed characters from the JSON api :/
EDIT gained 7 bytes using split and strstr instead of preg_match

Bash + common tools, 67
lynx -dump codegolf.stackexchange.com/q/203590|grep -Po 'wed \K\d+'

T-SQL, 43 bytes
T-SQL executed directly against the Stack Exchange Data Explorer:
SELECT ViewCount FROM Posts WHERE Id=203590

Based on my answer to this similar question.


text:
No-Three-In-A-Line
Note: this problem was inspired by the Unsolved Mathematical Problems for K-12 youtube video, which also features other interesting puzzles.
From the wikipedia article:

The no-three-in-line problem asks for the maximum number of points that can be placed in the n × n grid so that no three points are collinear ..... Although the problem can be solved with 2n points for every n up to 46, it is conjectured that fewer than 2n points are possible for sufficiently large values of n.

You must write a program or function which takes in an input \$ n \$ where \$ 2 \leq n \leq 46 \$, and returns/outputs an \$ n \times n \$ grid containing \$ 2n \$ points, such that no three points are collinear (lie on a single line, including diagonals). Here is a checker for your program.
Clarifications

Each point is represented as a square in the grid
Each square must have two states, representing whether a square contains a point or not.
You may return a 2D array of chars, a 1D array of strings, or a string with an arbitrary separator.
It is not expected for your solution to run in time for a \$ 46 \times 46 \$ grid, but it should for at least \$ n \leq 5 \$
This is code-golf, so the shortest code in bytes wins!

Examples
Input
2
3
4
5
10

Output
'#' represents an occupied point, '.' represents an empty square
##
##

.##
#.#
##.

.##.
#..#
#..#
.##.

..#.#
.##..
...##
#..#.
##...

....##....
..#....#..
.#......#.
...#..#...
#........#
#........#
...#..#...
.#......#.
..#....#..
....##....

"including diagonals" -- are all diagonals prohibited, or just 45 degree ones?

@Jonah All diagonals

This would actually make for a pretty good fastest-code challenge.

What exactly does "in time" mean?

@mypronounismonicareinstate It means it does not take an unreasonably lengthy amount of time (e.g. over an hour).

Is outputting a binary matrix allowed? What about a list of complex numbers? Or a list of point coordinates?

@LuisMendo My intention was to output some sort of grid, so only a binary matrix is allowed.

JavaScript (ES6),  208 ... 197  196 bytes
Returns a binary matrix.
f=(n,m=[...Array(n)].map(_=>Array(n).fill(0)),g=(C,z)=>m.some((r,y)=>r.some((v,x)=>v^z&&C(x,V=y,r))))=>!n|g((x,y,r)=>g((X,Y)=>g(H=>(V-=Y)|(H-=X)&&V*(X-x)==H*(Y-y)))?0:r[x]=+!!f(n-++r[x]/2,m),1)&&m

Try it online!
Output
Only \$N=2\$ to \$N=5\$ can be processed on TIO. The output for \$N=6\$ was computed locally.
\$N=2\$:
$$\begin{pmatrix}
1&1\\
1&1
\end{pmatrix}$$
\$N=3\$:
$$\begin{pmatrix}
1&1&0\\
1&0&1\\
0&1&1
\end{pmatrix}$$
\$N=4\$:
$$\begin{pmatrix}
1&1&0&0\\
0&0&1&1\\
1&1&0&0\\
0&0&1&1
\end{pmatrix}$$
\$N=5\$ (check it):
$$\begin{pmatrix}
1&1&0&0&0\\
1&0&0&1&0\\
0&0&0&1&1\\
0&1&1&0&0\\
0&0&1&0&1
\end{pmatrix}$$
\$N=6\$ (check it):
$$\begin{pmatrix}
1&1&0&0&0&0\\
0&0&0&1&0&1\\
0&1&0&0&1&0\\
1&0&1&0&0&0\\
0&0&0&0&1&1\\
0&0&1&1&0&0
\end{pmatrix}$$
Commented
f = (                     // f is a recursive function
  n,                      // n = input
  m = [...Array(n)].map(  // m[] = n x n output matrix,
    _ => Array(n).fill(0) //       initially filled with 0's
  ),                      //
  g = (C, z) =>           // g is a helper function taking a callback C and a flag z:
    m.some((r, y) =>      //   for each row r[] at position y in m[]:
      r.some((v, x) =>    //     for each value v at position x in r[]:
        v ^ z &&          //       if v is not equal to z:
          C(x, V = y, r)  //         invoke C(x, y, r) and copy y to V
      )                   //     end of inner some()
    )                     //   end of outer some()
) =>                      //
  !n |                    // force success if n = 0
  g((x, y, r) =>          // for each 0-cell at (x, y) on row r[]:
    g((X, Y) =>           //   for each 1-cell at (X, Y):
      g(H =>              //     for each 1-cell at (H, V):
        (V -= Y) |        //       update V to V - Y
        (H -= X)          //       update H to H - X
        &&                //       test if either V - Y or H - X is not equal to 0
        V * (X - x) ==    //       and (V - Y) * (X - x) is equal to
        H * (Y - y)       //       (H - X) * (Y - y), i.e (x, y), (X, Y) and (H, V)
                          //       are collinear
      )                   //     end of 3rd iteration
    )                     //   end of 2nd iteration
    ?                     //   if there's a pair of points collinear to (x, y):
      0                   //     do nothing
    :                     //   else:
      r[x] = +!!f(        //     do a recursive call:
        n - ++r[x] / 2, m //       set (x, y) and subtract 1/2 from n
      ),                  //     if falsy, unset (x, y) afterwards
    1                     //   use z = 1 for the 1st iteration
  ) && m                  // end of 1st iteration; return m[]

It currently is incorrect for n > 6. The checking program for the 6x6 board says INCORRECT at (0, 1), (1, 3), (2, 5)

@KevinCruijssen The diff between (0,1) and (1,3) is (1,2), and it's the same diff between (1,3) and (2,5). And since one point is in common, those are definitely linear!

@u_ndefined Thank you for reporting this. I misread the requirements and had to do a complete rewrite.

Wolfram Language (Mathematica), 185 bytes
(d=1~(r=RandomInteger)~{#,#};While[(M=Max)[{M[(z=#;M[Tr/@(Diagonal[z,#]&/@Range[-2,2])])&/@{d,Reverse@d}],M[Tr/@d],M[Tr/@Transpose@d]}]>2||Tr[Join@@d]!=2#,d=1~r~{#,#}];ToString/@#&/@d)&

Try it online!

05AB1E, 62 53 43 bytes
L3‹œêIи[D.rI£DεƶN>δ‚}€`ʒßĀ}3.Æʒ{ü-`R*Ë}g_#\

Random brute-force approach, so obviously pretty slow (n=5 finishes between 15-45 seconds on average).
Output as a list of lines, with 10 instead of #. respectively.
-10 bytes thanks to @Grimmy.
Try it online.
Explanation:
L              # Push a list in the range [1, (implicit) input-integer]
 3‹            # Check for each whether it's smaller than 3
               # (so we'll have a list with 2 zeroes and input-2 amount of 1s)
   œ           # Take the powerset of this list
    ê          # Sort and uniquify the list of lists
     Iи        # Repeat each sublist in the list the input amount of times
[              # Then start an infinite loop:
 D             #  Duplicate the list of potential rows
  .r           #  Randomly shuffle it
    I£         #  And then leave just the first input amount of rows
 D             #  Duplicate it
  ε            #  Map each row to:
   ƶ           #   Multiply each by their 1-based index
      δ        #   For each inner value:
       ‚       #    Pair it with
    N>         #    the 1-based map-index
  }€`          # After the map: flatten one level
     ʒ  }      # Filter each coordinate to:
      ß        #  Get the minimum
       Ā       #  And check that it's NOT 0
               # (we now have a list of all coordinates for the 1-bits)
  3.Æ          # Get all possible triplets of the coordinates
     ʒ         # Filter the list of triplets by:
      {        #  Sort the coordinates from lowest to highest
       ü       #  For each overlapping pair of coordinates:
               #    [[ax,ay],[bx,by],[cx,cy]] → [[[ax,ay],[bx,by]],[[bx,by],[cx,cy]]]
        -      #   Subtract them from one another
               #    → [[ax-bx,ay-by],[bx-cx,by-cy]]
         `     #  Push them separated to the stack
          R    #  Reverse the second
           *   #  Multiply them
               #   → [(ax-bx)*(by-cy),(ay-by)*(bx-cx)]
            Ë  #  And check if they are equal
      }g       # After the filter: get the amount of remaining triplets
        _      # If this is 0 (thus none are remaining anymore):
         #     #  Stop the infinite loop
               #  (after which the duplicated list of binary rows is output implicitly)
          \    # (Else:) discard it before trying again in the next iteration

oLbʒ1¢2Q}Ijð0: => L3‹Jœê for -8. Or skip the J, since you S it later anyway.

@Grimmy Oh, very nice! That's indeed a lot better. Thanks for -10. :)

Some more savings, I think. Change this to that. Not sure how it works with the rest of the solution, though.

@Grimmy Hmm, although a very nice golf, I'm not sure if it's useful in my current approach. The result should be a matrix of 1s and 0s. I could use your code for a different approach, but I end up at 44 bytes that way. Your approach results in a list of coordinates that should contain a 1 in a matrix of 0s of dimensions input x input, and my approach already has this matrix and checks if its valid by checking the coordinates containing 1s.

R, 192 bytes
Outputs a binary matrix. Random brute, found the answer for N=5 in <60s only once.
function(N){m=2*N;c=combn(1:m,3);repeat{p=t(replicate(m,sample(1:N,2,T)));o=matrix(0,N,N);o[p]=1;sum(o)==m&&1>sum(sapply(1:ncol(c),function(x)qr(cbind(p[c[,x],],1:3*0+1))$rank<3))&&return(o)}}

Try it online!
Just started learning R, any help appreciated.
function (N) {
  m = 2 * N
  c = combn(1:m, 3)                        # all 3-point combinations
  repeat {                                 # indefinitely
    p = t(replicate(m, sample(1:N, 2, T))) # 2N random points
    o = matrix(0, N, N)
    o[p] = 1                               # output matrix
    sum(o) == m                            # is each point different?
      && 1 > sum(                          # is it a vector of FALSEs?
        sapply(1:ncol(c),                  # for each combination
          function(x)
            qr(
              cbind(
                p[c[,x],]                  # point coordinates
              ,1:3*0+1)                    # add (1,1,1) column
            )$rank < 3)                    # is the matrix rank 2 or less
        )
      && return(o)}}

Welcome to the site!

The first && can be & to save a byte, but it will definitely make the performance quite a bit worse (since it will do the entire sapply every iteration even if sum(o)==m is already falsey). But that is codegolf I guess; we don't care too much about performance, as long as we can save some bytes. ;) And welcome to CGCC! Nice first answer.

Java (JDK), 325 bytes
n->{int g[]=new int[n],i,r,a,b,d,e,j,x,y,c;for(java.util.Arrays.fill(g,3);;){for(i=-1,r=1;++i<n&r>0;r=g[i]>1<<n?g[i]=3:0)for(;n.bitCount(++g[i])!=2;);for(r=i=0;i<n*n;)for(a=i/n,b=i%n,j=++i;(g[a]&1<<b)>0&j<n*n;r|=c>1?1:0)for(x=j/n-a,y=j++%n-b,c=0,d=a+x,e=b+y;d>=0&d<n&e>=0&e<n;d+=x,e+=y)c+=(g[d]&1<<e)>0?1:0;if(r<1)return g;}}

Try it online!
Works in time on TIO for up to n = 6.
Explanation
(partial explanation)
This answer returns an int-array. Each int has exactly two bits set. The position of those bits represent the dots for that row.
The algorithm first makes sure that exactly two bits are set in each row. If that's the case, we go to the next part. If that's not the case, numbers are increased/reset until exactly two bits are set in each row.
We now have a grid with exactly 2 positions set each row.
For each of those positions, the algorithm checks each possible next position (on the right first, then each position downwards) and traces a line from the base position until the border, through each next positions. If the line goes through 0 or 1 set values, it goes to the next position.
If more than 1 positions are found, the algorithm will check the next grid.
Credits

-8 bytes and a pretty printer thanks to Kevin Cruijssen.
-1 byte thanks to ceilingcat

@KevinCruijssen Thanks! I could get rid of z... by introducing 2 new variables ^_^' This won't be easily golfed. I guess someone has to come with a better algorithm to beat this beast drastically. I'm afraid I didn't have enough courage to try several algorithms.

Suggest g[d]>>e&1 instead of (g[d]&1<<e)>0?1:0

MATL, 41 39 37 36 34 33 bytes
`G:t!J*+tt1eGEZrt&-X/GEXy+Sd~z]m&

The output is a binary matrix.
Running time is random. Input 4 typically takes between 3 and 20 seconds on my computer.
Try it online!
Explanation
`          % Do...while
  G:t!J*+  %   Generate n x n matrix representing a grid of complex numbers a+j*b,
           %   with a, b = 1, 2, ..., n (*)
  t        %   Duplicate
  t1e      %   Duplicate again and reshape as a row vector
  GEZr     %   Randomly choose 2*n entries, without replacement (**)
  t        %   Duplicate
  &-       %   2*n x 2*n matrix of pairwise differences between the chosen numbers
  X/       %   2*n x 2*n matrix with the angle of each of those (complex)
           %   differences, in radians (***)
  GEXy+    %   Add identity matrix of size 2*n x 2*n
  S        %   Sort each column
  d        %   Consecutive differences along each column
  ~z       %   Number of zeros
]          % End. A new iteration is run if the top of the stack is nonzero; that
           % is, if the matrix (***) has been found to have two equal elements in
           % the same column. That indicates that two points are aligned. This is
           % because three complex numbers A, B, C are aligned if and only if
           % there is one of them, say C, such that A-C and B-C have the same
           % angle. The identity matrix has been added to avoid zeros in the
           % diagonal, which would lead to incorrectly detecting alignment when
           % there are just two points at the same vertical position (their
           % complex difference has angle 0). Adding the identity matrix sets
           % those diagonal entries to 1 radian, that is, 1/2/pi of a whole turn.
           % Since the coordinates of the points are integer and pi is
           % irrational, an angle difference of 1 radian will never occur for any
           % pair of points (at least theoretically; in practice there may be
           % numerical precision issues for huge grids).
m          % For each point in the copy of the n x n complex grid (*), determine
           % if it is present in the vector of chosen points (**). Gives an n x n
           % matrix containing true or false, which will be displayed as 1 or 0
&          % Configures the implicit display function so that it will only show
           % the top of the stack

Charcoal, 83 bytes
ＮθＷ‹№ω#⊗θ¿⁼Ｌω×θθ≔⁺…ω⊟⌕Ａω#¦.ω«≔⁻÷⌕Ａω#θ÷Ｌωθη≔⁻﹪⌕Ａω#θ﹪Ｌωθζ≔⁺ω§#.⊙η⊙…ηλ⁼×κ§ζν×μ§ζλω»⪪ωθ

Try it online! Link is to verbose version of code. Brute force so too inefficient for n>5. Explanation:
Ｎθ

Input n.
Ｗ‹№ω#⊗θ

Repeat until a solution was found.
¿⁼Ｌω×θθ

Have we reached the end of the grid?
≔⁺…ω⊟⌕Ａω#¦.ω«

In that case, one of our #s must have been placed incorrectly. Backtrack to the last one and replace it with a ., otherwise:
≔⁻÷⌕Ａω#θ÷Ｌωθη

Get the list of indices of the #s so far, convert to rows, and subtract the current row from each, giving the relative rows.
≔⁻﹪⌕Ａω#θ﹪Ｌωθζ

And again for the columns.
≔⁺ω§#.⊙η⊙…ηλ⁼×κ§ζν×μ§ζλω

Check whether any of the pairs of relative offsets are collinear and if so append a . otherwise append a #.
»⪪ωθ

Print the solution once it has been found.
Tweaking the test for an invalid solution allows n=7 to be calculated on TIO at a cost of 3 bytes:
ＮθＷ‹№ω#⊗θ¿‹№ω#⊗÷Ｌωθ≔⁺…ω⊟⌕Ａω#¦.ω«≔⁻÷⌕Ａω#θ÷Ｌωθη≔⁻﹪⌕Ａω#θ﹪Ｌωθζ≔⁺ω§#.⊙η⊙…ηλ⁼×κ§ζν×μ§ζλω»⪪ωθ

Try it online! Link is to verbose version of code.


text:
What is the longest possible DDL query in PostgreSQL?
We all know and love the corpulent DDL expressions one can write in PostgreSQL with wording like DEFERRABLE INITIALLY DEFERRED, ALTER FOREIGN DATA WRAPPER, or even DROP TEXT SEARCH CONFIGURATION. But how far can one go? Here comes the definitive challenge for the longest DDL expression, with constraints of course. Mwahahaha!
Rules:

The length of the submission is counted in Unicode codepoints.
Whitespaces are contracted to minimally necessary when counting.
The semicolon counts.
The submission must be a valid data definition expression in PostgreSQL 12 as described in the relevant manual section.
Optionally repeatable subexpressions (like column definitions in a CREATE TABLE) must not be repeated.
Every user-specifiable identifier only adds 1 towards the total length. So a table named a is worth the same as aaa.
Function call expressions add exactly 4 towards the total length, as if they were always of the form f(x).
String constants only add as much towards the total length as if they were empty strings.
Numeric constants always add exactly 1 towards the total length, as if all you had were single digit integers.
Recursion is not allowed. For example, the SQL SELECT statement defines the concept of a from_item recursively, where a from_item can be of the form from_item [...] join_type [...] from_item. This is a recursive definition, and its usage is forbidden. This challenge disallows terms embedded in the same type of term, in any depth.

Good luck, have fun. To kickstart your thoughts, here's a beatable example of length 106:
  create function f(x)
  returns table(a float) as $$$$
  language sql
  rows 1
  immutable
  parallel safe
  leakproof;

Is it really impossible to get a infinitely extensible statement?

Could you be a little bit more specific as to what you mean when you say recursion is banned?  All of your other rules are very unambiguous in what they mean, but I feel like this on is a lot more edge casey.  Could you lay out in a way similar to your other rules what exactly counts as recursion?

I've edited the recursion rule, hopefully it makes more sense now. Can you please check @AdHocGarfHunter whether you understand it now?

are subqueries allowed?

Sure, everything is allowed what's not forbidden. But take note - this challenge is specifically targeted to DDL queries. A SELECT in itself is a DML query.

PostgreSQL 12, CREATE TABLE, 482 chars:
CREATE GLOBAL TEMPORARY TABLE IF NOT EXISTS table_name
PARTITION OF parent_table (column_name WITH OPTIONS CONSTRAINT constraint_name REFERENCES reftable (refcolumn) MATCH PARTIAL ON DELETE referential_action ON UPDATE referential_action NOT DEFERRABLE INITIALLY IMMEDIATE CONSTRAINT constraint_name
EXCLUDE USING index_method (column_name opclass DESC NULLS FIRST WITH operator) INCLUDE (column_name) WITH (storage_parameter = value) USING INDEX TABLESPACE tablespace_name WHERE (predicate) NOT DEFERRABLE INITIALLY IMMEDIATE) FOR VALUES WITH (MODULUS numeric_literal, REMAINDER numeric_literal) PARTITION BY RANGE (column_name COLLATE collation opclass) USING method WITHOUT OIDS ON COMMIT PRESERVE ROWS
TABLESPACE tablespace_name;

How?
To produce the largest possible DDL query in PostgreSQL 12, I wrote a script that does the following:

Navigates to the full list of PostgreSQL 12 commands.
For each command, extracts its synopsis.
Parses the synopsis into an Abstract Syntax Tree.
Traverses the Abstract Syntax Tree, producing all queries, pruning branches for rudimentary optimization by choosing the longest keywords.
For the generated queries, finds the maximum by condensing non-keyword identifiers down to a single character, eliminating unnecessary whitespace, etc.

it is... beautiful... truly a marvel to behold


text:
Simulate the isotropic non-totalistic cellular automaton
There are many generalizations of Conway's Game of Life. One of them is the isotropic non-totalistic rulespace, in which the state of a cell in the next generation depends not just on its state and the amount of alive cells around it, but also the relative positions of the cells around it.
Given an rulestring corresponding to an isotropic non-totalistic cellular automaton, an integer \$T\$, and an initial pattern \$P\$, simulate the initial pattern \$P\$ for \$T\$ generations under the given rulestring.
Constraints

The given rulestring is valid and does not contain the B0 transition.
\$0 < T \le 10^3\$
Area of bounding box of \$P \le 10^3\$

Input
The rulestring, \$T\$ and \$P\$ will all be given in any necessary (specified) format.
Output
Output the resulting pattern after \$P\$ is run \$T\$ generations.
Example
Rulestring: B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c
T: 62
Pattern (in canonical RLE format):
x = 15, y = 13, rule = B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c
3b2o$2ob2o$2o4$13b2o$13b2o$3bo$2b3o$2bob2o$2bobo$2b2o!

Output:
x = 15, y = 13, rule = B2c3aei4ajnr5acn/S2-ci3-ck4in5jkq6c7c
3b2o$2ob2o$2o4$13b2o$13b2o$3b2o$b5o$bo3bo$bo2bo$2b3o!

Scoring
This is extended code-golf, which means that the program with smallest (length in bytes - bonuses) wins.
Standard loopholes are not allowed. Your program is not allowed to use any external libraries that deal with cellular automata. Your program is expected to finish relatively quickly (in at most 10 minutes).
Bonuses:

10 for finishing in under 10 seconds under max tests
20 for accepting the rulestring in canonical form (e.g. B2-a/S12)

To clarify, can we invent a custom rulestring specifically for this challenge? And if so, how far can we go with this? Can we input a string of 'born' and 'survival' grids, which would make this a lot easier?

@dingledooper Yes, you can. In fact, you can even require the rulestring be put in a file "t.h" in the form of a function int t(int a, int b, int c, int d, int e, int f, int g, int h, int i).

+1 because I mainly investigate isotropic non-totalistic rules. I think "Hensel notation" should be mentioned in the question, though.

Are you testitem by the way? (I can't think of anyone else who promote X3VI to this level)


text:
Generate Green Spray Paint Patterns
This challenge is about creating these neat "green spray paint" patterns: (more pictures below)

Loosely explained, they are generated by starting with a black image and a point in the center. That point is successively moved by a randomly chosen offset or delta in x and y. Every pixel the point visits has 1 added to its green color channel. This process is then repeated with many many more points, all starting from the center, generating an entire green pattern.
Your task is to write the shortest program possible that takes in the necessary parameters and displays or outputs the resulting green spray paint image. This is code golf so the shortest code in bytes wins!
Specifics
The images require the following parameters, which must be inputs to your program in any order you choose:

Positive integer S is the width and height (Size) of the output image in pixels.
Non-negative integer N is the number of points to move over the image one by one, each adding a trail of green.
Non-negative integer M is the maximum number of moves that each point can take. (Without this they'd never stop.)
D is a list of pairs of integers [(dx1, dy1), (dx2, dy2), ...] that are deltas each point may be offset by each move.

You may also take this flattened [dx1, dy1, dx2, dy2, ...] or as two lists [dx1, dx2, ...] and [dy1, dy2, ...].

Generate the patterns by starting with a pure black S×S pixel image. Then repeat the following process N times, after which your image will be ready to be output:

Start a point in the center of the image. (This means (floor(S/2), floor(S/2)) for most image coordinate systems.)
Add 1 to the green color channel of the pixel currently below the point (up to a max of 255).
Consider moving the point by each of the deltas in D so it becomes like (x + dx, y + dy). Keep track of the valid moves.

A valid move is one that keeps the point inside the bounds of the image, i.e. over a pixel.

If there are no valid moves or the current point has taken M moves then stop and restart at step 1 with a new point.
Otherwise, have the current point take a random valid move. Every valid move should have an equal chance.
Go to step 2 to move the current point again.

Your implementation does not need to follow these precise steps as long as the results produced are the same. Of course they won't be exactly the same due to randomness, but it's easy to visually tell when things are working as expected.
Be sure to keep these corner cases in mind:

When N is 0 there are no points so the output should always be a totally black S×S image.
When M is 0 or D is empty it means no moves can be made, so only the starting pixel will have color. (See example 5.)
D may contain duplicate values that are valid moves, effectively meaning that move is more likely. (See example 7.)

Reference Program
Ungolfed reference code in Python 3. Not strictly a solution since it is hardcoded to output the first example from above.
S = 250
N = 800
M = 7000
D = [(1, 2), (-1, 2), (1, -2), (-1, -2), (2, 1), (-2, 1), (2, -1), (-2, -1)] # chess knight moves

import random
from PIL import Image
img = Image.new('RGB', (S, S), 'black')
pix = img.load()
for i in range(N):
    if (i + 1) % 10 == 0: print(f'{(i + 1)/N:.1%}') # progress tracker, not required output
    x, y, = S//2, S//2
    m = 0
    while True:
        pix[x, y] = 0, pix[x, y][1] + 1, 0
        valid = [(x + dx, y + dy) for dx, dy in D if 0 <= x + dx < S and 0 <= y + dy < S]
        if m >= M or not valid: break
        x, y = random.choice(valid)
        m += 1
#img.save('spraypaint.png') # uncomment to save image
img.show()

Examples

S = 250
N = 800
M = 7000
D = [(1, 2), (-1, 2), (1, -2), (-1, -2), (2, 1), (-2, 1), (2, -1), (-2, -1)]

 (from above)
S = 250
N = 1000
M = 3000
D = [(2, -1), (-2, -1), (-3, 0), (4, 0), (0, 2), (0, -1)]

 (from above)
S = 250
N = 400
M = 10000
D = [(60, 59), (60, -59), (-59, 60), (-59, -60)]

 (from above)
S = 400
N = 600
M = 10000
D = [(0, 1), (-1, 0), (0, -1), (1, 0)]

S = 51
N = 1000
M = 1000
D = []

S = 51
N = 1000
M = 1
D = [(-5, 5), (9, 9), (-15, 1), (20, -25)]

S = 300
N = 1000
M = 1000
D = [(1, 0), (1, 0), (1, 0), (1, 0), (-3, 0), (0, 3), (0, -3)]

 (from above)
S = 345
N = 123
M = 21212
D = [(1, -4), (2, -3), (3, -2), (4, -1), (-9, 9)]

S = 200
N = 1
M = 1500000
D = [(1, 1), (1, -1), (-1, 1), (-1, -1)]

S = 300
N = 4000
M = 1000
D = [(7, 1), (-4, 3), (-4, -3)]

S = 300
N = 1500
M = 1000
D = [(10, -10), (-10, 10), (5, 5), (-5, -5), (1, 0), (-1, 0)]

S = 240
N = 1000
M = 10000
D = [(80, 81), (80, -81), (-81, 80), (-81, -80)]

All example inputs together.
Bonus
This isn't required but I would love to see what other neat patterns are possible. Put any cool images you make in your answer!

Well this is annoying. The top 3 example images fit on one line in the question submitter form but not in the published question...

I have that problem with answers; I try to fit each part of an explanation in a certain width only to find that the actual width is less.

Well, fixed mostly. But yeah, now a bunch of my nicely formatted single lines take up two lines :(

@Neil Yeah, I always have the same issue. I always end up editing the lines again after I posted my answer. After you've posted a first version and edit it later on, the preview is working fine though, which is weird imo.. It's only before you post the actual answer it's fwcked up.. :/

If a pixel is already 0x00FF00 (the maximum green color) and the point travels to it, what happens? Does it become 0x010000 (tiny bit of red) or 0x000000 (black)?

Can we output images via 2D/flattened arrays?

@PkmnQ Neither, it remains the maximum green color 0x00FF00. (I'm not OP, but if it was either of your two suggestions, the output images would have looked different.) I do agree this should be specified somewhere in the challenge description though, since I only noticed it after I had built my Java function.

@PkmnQ Kevin is correct. Greens that are maxed out just stay at full green. Note the line "Add 1 to the green color channel of the pixel currently below the point (up to a max of 255)."

@mypronounismonicareinstate Sorry, no. It has to be an image.

Beautiful! Is this a known algorithm for generating patterns like these, or did you just devise this on your own?

@templatetypedef Nah, I was just thinking about a knight moving randomly on an infinite chessboard, and how frequently it would visit every spot. This was the result.

@DiscreteGames Very cool. This is closely related to finding the stationary distribution of a random walk over a directed graph derived from a grid. I teach intro CS courses, and I've shared this problem (not the golf version - just the regular version) with my colleagues. We're looking into using it as an introductory programming assignment. If we do, we will, of course, provide attribution. :-)

@templatetypedef That's awesome! I'd live to think it reaches a wider audience than just code golfers.

Can we change the points' edge behavior (e.g. to disappearing when attempting to exit the rectangle, or simply exiting it while still able to return)?

@mypronounismonicareinstate No. That changes the behavior too much and things will look too different.

When the numbers are not relatively prime, the output patterns look ugly: I have this irritating feeling that I opened a raw image and specified wrong dimensions.

Does writing the output image to a file count as a valid output?

@ar4093 Sure, that sounds fine.

Ruby, 263...150 147 bytes
->s,n,m,d{c=[0]*3*s*s;n.times{x=y=s/2;0.upto(m){c[3.*x+y*s]+=1;d.shuffle.find{|p,q|(g=x+p,y+q)-[*0...s]==[]&&(x,y=g)}||break}};puts:P3,s,s,255,0,c}

Try it online! (Times out on four of the test cases and truncates output for all but two of the others.)
Explanation
Takes d as an array of arrays and outputs in PPM format to STDOUT. Two features of PPM are exploited:

No attempt is made to avoid G values greater than 255: PPM treats any such values as if they were equal to 255.
Extraneous bytes at the end of the file (i.e. beyond the specified pixel count) are ignored. This allows a byte to be saved by working internally with the red channel rather than green, then shifting all the RGB values by one place on output.

->s,n,m,d{
  c=[0]*3*s*s;         # initialise all pixels to black
  n.times{
    x=y=s/2;           # set initial position
    0.upto(m){
      c[3.*x+y*s]+=1;  # add 1 to red channel at current position (x+y*s is single-digit pixel index, starting from 0 at top left)
      d.shuffle        # randomise moves
       .find{|p,q|     # if there is a move such that
         (g=x+p,y+q)   # the new co-ordinates
         -[*0...s]==[] # are both in [0, s) (i.e. within the image)
         &&(x,y=g)     # take that move
       }
      ||break          # otherwise restart with a new point
    }
  };
  puts:P3,s,s,255,0,c  # print PPM file to STDOUT, inserting 0 to get green output
}

Sample outputs for test cases
Composite image including all test cases, ordered as follows:
1, 2, 3
4, 8
5, 6, 7, 9
10, 11, 12

Bonus
'Excalibur'
S = 400, N = 5000, M = 5000, D = [[1, -1], [1, -1], [-2, 10], [-10, 2]]

'Aurora'
S = 400, N = 2500, M = 2500, D = [[11, 13], [13, -11], [-29, 31], [31, 29], [41, 43], [43, -41], [-59, 61], [-59, -61]]

Java 10, 516 513 508 504 bytes
import java.awt.*;(S,N,M,D)->new Frame(){{add(new Panel(){public void paint(Graphics g){var G=(Graphics2D)g;G.setPaint(Color.BLACK);G.fillRect(0,0,S,S);int c[][]=new int[S][S],x,y,d[],r,n=N,m;for(;n-->0;)for(x=y=S/2,m=M;m-->0;){c[x][y]++;var L=new java.util.Stack<int[]>();for(var q:D)if(q[0]>~x&x+q[0]<S&q[1]>~y&y+q[1]<S)L.add(q);r=L.size();if(r<1)break;d=L.get(r*=Math.random());x+=d[0];y+=d[1];}for(x=S*S;x-->0;G.drawLine(x,y,x,y))G.setPaint(new Color(0,Math.min(c[r=x/S][y=x%S],255),0));}});show();}}

-4 bytes thanks to @ceilingcat.
Some example outputs:
Input: S=250; N=800; M=7000; D=[[1,2],[-1,2],[1,-2],[-1,-2],[2,1],[-2,1],[2,-1],[-2,-1]]
Output:

Input: S=200; N=10000; M=5000; D=[[1,1],[2,2],[30,30],[1,-1],[2,-2],[30,-30],[-1,1],[-2,2],[-30,30]]
Output:

Input: S=200, N=5000, M=5000, D=[[10,11],[11,10],[25,26],[26,25],[50,51],[51,50],[-75,-75]]
Output:

Explanation:
import java.awt.*;            // Required import for almost everything
(S,N,M,D)->                   // Method with the 4 parameters and Frame return-type
  new Frame(){                //  Create the Frame
   {                          //   In an inner code-block:
     add(new Panel(){         //    Add a Panel we can draw on:
       public void paint(Graphics g){
                              //     Overwrite its paint method:
         var G=(Graphics2D)g; //      Cast interface to object so we can use it to draw
         G.setPaint(Color.BLACK);
                              //      Set the color to black
         G.fillRect(0,0,S,S); //      Create the square of size `S` by `S`
         int c[][]=new int[S][S],
                              //      Create an integer-matrix of the same size,
                              //      filled with 0s by default
             x,y,             //      Temp integers for the current coordinates
             d[],             //      Temp integer-array for the randomly selected delta
             r,               //      Temp integer for the random index
             n=N,             //      Copy of the input `N` (since we are in a
                              //      code-block, it has to be effectively final..)
             m;               //      Temp integer
         for(;n-->0;)         //      Loop `n` amount of times:
           for(x=y=S/2,       //       Start `x,y` at the center
               m=M;m-->0;){   //       Inner loop `M` amount of times:
             c[x][y]++;       //        Increase the value at the current `x,y` by 1
             var L=new java.util.Stack<int[]>();
                              //        Create an empty list
             for(var q:D)     //        Loop over the deltas:
               if(q[0]>~x&x+q[0]<S&q[1]>~y&y+q[1]<S)
                              //         If `x,y` + this delta is within bounds:
                 L.add(q);    //          Add the current delta to the list
             r=L.size();      //        Set `r` to the amount of valid deltas left
             if(r<1)          //        If there are no valid deltas:
               break;         //         Stop the inner loop
             d=L.get(r*=Math.random());
                              //        Pick a random delta from the list
             x+=d[0];y+=d[1];}//        And update the `x,y` coordinate with it
         for(x=S*S;x-->0      //      Then loop over all coordinates:
             ;                //        After every iteration:
              G.drawLine(r,y,r,y))
                              //         Draw the current pixel
           G.setPaint(new Color(0,Math.min(c[r=x/S][y=x%S],255),0));}});
                              //       Set the green color based on the value in `c`,
                              //       or 255 if it's exceeding that
     show();}}                //    And finally show the Frame

Wolfram Language (Mathematica), 216 bytes
(s=Table[{0,0,0}~Table~S,S=#];t=1;Do[s[[##&@@(d=Floor[{S/2,S/2}])]]={0,t++,0};Do[s[[##&@@(c=RandomChoice[If[(z=Select[d+#&/@If[#4=={},{0,0},#4],Max@#<S-1&&Min@#>1&])=={},d,z]])]]+={0,1,0};d=c,#3],#2];s~Image~"Byte")&

[400, 600, 10000, {{0, 1}, {1, 0}, {-1, 0}, {0, -1}}]

[1000, 2000, 2000, {{5, 5}, {2, 3}, {1, -1}, {-3, -4}, {4,
       5}, {-5, -5}}]

I think it will be shorter to use an array first and then turn it into an image later.

@mypronounismonicareinstate might try that later

JavaScript (ES6), 279 269 bytes

f=
(c,s,n,m,d)=>{c.width=c.height=s
c=c.getContext('2d',{alpha:0})
i=c.getImageData(0,0,s,s)
for(;x=y=s/2|0,n--;)for(o=m;i.data[(x+y*s)*4+1]++,l=o--&&(e=d.map(([a,b])=>[x+a,y+b]).filter(([a,b])=>a>=0&b>=0&a<s&b<s)).length;)[x,y]=e[l*Math.random()|0]
c.putImageData(i,0,0)}
Size: <input id=s type=number min=1 value=250>
Pixels: <input id=n type=number min=0 value=800>
Moves: <input id=m type=number min=0 value=7000>
Deltas: <input id=d value=[[1,2],[-1,2],[1,-2],[-1,-2],[2,1],[-2,1],[2,-1],[-2,-1]]>
<input type=button value=Go! onclick=f(c,+s.value,+n.value,+m.value,JSON.parse(d.value))>
<canvas id=c>

Takes a fifth parameter which is the canvas element on which to draw the resulting image. Byte count does not include the test driver, which comprises the f= line of JavaScript and all of the HTML. Edit: Saved 10 bytes thanks to @Kaiido. Ungolfed version with incremental rendering:

b.onclick = async function() {
  b.disabled = true;
  try {
    await f(c, +s.value, +n.value, +m.value, JSON.parse(d.value));
  } catch (ex) {
    console.error(ex);
  }
  b.disabled = false;
}
async function f(canvas, size, number, moves, deltas) {
  canvas.width = canvas.height = size;
  let context = canvas.getContext('2d', { alpha: false });
  context.fillRect(0, 0, size, size);
  let image = context.getImageData(0, 0, size, size);
  for (let i = 0; i < number; i++) {
    let x = size / 2 | 0, y = x, j = moves;
    for (;;) {
      image.data[(x + y * size) * 4 + 1]++;
      if (!j--) break;
      let valid = deltas.map(([dx, dy]) => [x + dx, y + dy]).filter(([x, y]) => x >= 0 && y >= 0 && x < size && y < size);
      if (!valid.length) break;
      [x, y] = valid[valid.length * Math.random() | 0];
    }
    context.putImageData(image, 0, 0);
    await new Promise(requestAnimationFrame);
  }
}

Size: <input id=s type=number min=1 value=250>

Pixels: <input id=n type=number min=0 value=800>

Moves: <input id=m type=number min=0 value=7000>

Deltas: <input id=d value=[[1,2],[-1,2],[1,-2],[-1,-2],[2,1],[-2,1],[2,-1],[-2,-1]]>

<input id=b type=button value=Go!>

<canvas id=c>

You can get rid of c.fillRect(0,0,s,s) if you pass
,{alpha:0} to the c.getContext('2d') call.

@Kaiido Thanks, I don't know the Canvas API at all well, so I had not heard of that parameter.

Ooh, the incremental rendering is a great idea!

what does this part do? for (;;)?

@RyanStone That's just an infinite loop, excepting of course the break statements that terminate it. I thought it was clearer to use that in the ungolfed version.

Python 2 + PIL, 217 214 211 bytes
A golf of the reference implementation, but a lot less efficient. Instead of using loops, this generates many many lines of code (N*(M+2)) that will run once.
import random,PIL.Image as I
S,N,M,D=input()
i=I.new('RGB',(S,S))
p=i.load()
exec('v=[[S//2]*2]\n'+'if v:x,y=random.choice(v);p[x,y]=0,p[x,y][1]+1,0;v=[(x+a,y+b)for a,b in D if-1<x+a<S>y+b>=0]\n'*-~M)*N
i.show()

Output for S=51, N=1000, M=1, D=[(-5, 5), (9, 9), (-15, 1), (20, -25)]:

Output of an older version for S=300, N=1500, M=1000, D=[(10, -10), (-10, 10), (5, 5), (-5, -5), (1, 0), (-1, 0)], don't try such a large example with the current version: