text:
Fill the maze with a wall-following Snake until it gets stuck
Make a snake fill any maze (until it gets stuck).
The snake
The snake starts at a given starting point, pointing EAST. It moves by always having a wall or a part of its body immediately to the LEFT of its head ("left-hand rule wall follower"), until it gets stuck because all four directions around its head are occupied.
(Note: a stuck snake can possibly not fill all the reachable space, but that is not the goal!)
The challenge
Write a program or function that accepts a maze as input in the form of a 2D text:

The input can be in any reasonable format: e.g. a list of strings, a single string with newlines, a file.

The maze has walls ("#"), empty spaces (" ") and exactly one starting point ("o").

You can choose to

either assume that the first and last row and column are entirely walls;
or assume that every input is considered to have an implicit outer layer of walls

You can assume that the starting point has a wall (or an implicit wall) directly above it (NORTH) and that the snake can make a valid starting move in the EAST or SOUTH direction.

You can assume that no other characters are present in the text (except newlines if your input needs them).

You can assume that all lines are the same length.

and prints / returns a "filled maze" as output, with a snapshot of the snake at the moment it got stuck:

The body of the snake is represented by the characters >v<^ pointing to where its next segment is
The starting point of the snake is either its direction at the start (">" unless it had to turn immediately) or an o character (no need to be consistent)
The end point of the snake is an o character

Scoring
Usual code golf: the shortest code wins
Example
in:
#################################
#                    o          #
#                               #
#     ##       ###       ##     #
#    ##     ##     ##     ##    #
#    ##     ##     ##     ##    #
#    ##      ##   ##      ##    #
#   ##       ##   ##       ##   #
#   ##         ###         ##   #
#    ##       #####       ##    #
#    ##       #####       ##    #
#    ##        ###        ##    #
#     ##                 ##     #
#                               #
#                               #
#################################

out:
#################################
#>>>>>>>>>>>>>>>>>>>v>>>>>>>>>>v#
#^>>>>>>>>>>>>>>>>>v>>>>>>>>>>vv#
#^^   ##>>>>>>v###o>>>>>v##   vv#
#^^  ##>^   ##>>>>^##   >v##  vv#
#^^  ##^    ##     ##    v##  vv#
#^^  ##^     ##   ##     v##  vv#
#^^ ##>^     ##   ##     >v## vv#
#^^ ##^<       ###       v<## vv#
#^^  ##^      #####      v##  vv#
#^^  ##^      #####      v##  vv#
#^^  ##^<      ###      v<##  vv#
#^^   ##^<<<<<<<<<<<<<<<<##   vv#
#^^<<<<<<<<<<<<<<<<<<<<<<<<<<<<v#
#^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<#
#################################

Animated (for illustration purposes):

Edit: note that, when in doubt, the snake should "keep its left hand" on the wall it is already on, following corners, not jumping to a wall 1-block away.

Thanks Jonathan Allan for bringing it up, and Draco18s for the explanatory snapshot above.
Other examples
in:
####################
#               o# #
#                ###
#                  #
#      ##          #
#                ###
####################

out:
####################
#>>>>>>>>>>>>>>vv# #
#^>>>>>>>>>>>>vvv###
#^^   v<<<o<<<<v>>v#
#^^<<<<##^<<<<<<v<<#
#^<<<<<<<<<<<<<<<###
####################

in:
####################
#         o    #####
#              #####
#                  #
#                 ##
####################

out:
####################
#         >>>>v#####
#             v#####
#             >>>>o#
#                 ##
####################

in:
################
#o             #
#   ########## #
# #          # #
# #          # #
# #          # #
# #  #       # #
# #          # #
# #          # #
# #          # #
# ############ #
#              #
################

out:
################
#>>>>>>>>>>>>>v#
#>>v##########v#
#^#>>>>>>>>>v#v#
#^#>>>>>>>>vv#v#
#^#^>>>>>>vvv#v#
#^#^^#    vvv#v#
#^#^^o<<<<<vv#v#
#^#^^<<<<<<<v#v#
#^#^<<<<<<<<<#v#
#^############v#
#^<<<<<<<<<<<<<#
################

In the GIF example, when it enters the pattern why would it not turn back to fill in the other parts of the empty spaces? It was definitely possible to turn left then up then left then down then back around, but the snake chose straight down instead. Is the goal to fill as many spaces as possible with the snake or follow only the "turn right when encountering a wall and end if turn right twice" strategy?

@MagicOctopusUrn I'm not sure I understand at what point you see the ambiguity. But, to answer your question, the goal is not to fill as much space as possible. However, the algorithm ("wall follower") is not just "turn right once or, if not possible, twice": if the snake finds itself without a wall on its left, it will have to turn left instead (keeping the "left hand" on the wall/on itself)

(sorry I misread your algorithm rundown)

In the main example the 12th time the head turns (immediately right of the end o) the snake could turn to it's right and still have body to its head's left. Is there an unwritten rule that turning left should be the first option it tries, or are either acceptable at that point? (or have I missed something else?)

so the amount of fill does not have to be optimal among all possible paths?

Does the snake always start with a wall to the left?

@ jonah: correct. There is a single deterministic path and it's not optimal. @ value ink: yes. @ jonathanallan I struggle to see the ambiguity but it may be just me. My version of the wall-following algorithm is: keep your direction unless you don't have an obstacle to your left anymore [evaluated first], in which case turn left, or you hit a wall [evaluated second] in which case turn right if possible, or game over.

@NicolaSap, note: you can't ping multiple people in one comment.

If I solved this with a ZX81, for instance, could I replace the ^ symbol with A?

I had to dissect the gif to figure out why the end state was the way it was. It isn't apparent from the final displayed frame, but rather from the state just before: https://i.stack.imgur.com/kj67V.png I hope that helps people.

This is basically TRON, right?

@Draco18s, thanks for the snapshot, I've added it to the post

Charcoal, 94 68 bytes
Ｆ²⊞υＳＷ¬⁼§υ⁰§υ±¹⊞υＳ≔⪫υ¶θＰθ…θ⌕θo≔⁰θＷ№ＫＶ «≧⁺⊖⌕Ｅ³§ＫＶ⁺θκ θ✳§rdluθ§>v<^θ»o

Try it online! Link is to verbose version of code. Explanation:
Ｆ²⊞υＳＷ¬⁼§υ⁰§υ±¹⊞υＳ≔⪫υ¶θ

Slurp the input into a string. This could be avoided by using a less convenient input format.
Ｐθ…θ⌕θo

Print the input without moving the cursor, and then print up to the o again, so that the cursor ends up under it.
≔⁰θ

Initialise the current direction.
Ｗ№ＫＶ «

Repeat while there's still a free space in some direction.
≧⁺⊖⌕Ｅ³§ＫＶ⁺θκ θ

Calculate whether the snake can turn left, or whether it is forced to turn right. The code ≦⊖θＷ¬⁼§ＫＶθ ≦⊕θ also works for this for the same byte count although it considers 0 as up instead of right so the rest of the code needs to be adapted.
✳§rdluθ§>v<^θ

Output the appropriate body character in the appropriate direction.
»o

Restore the head. This can also be written as Ｐo which prints the head without moving the cursor each pass through the loop instead (but this allows the loop to be implicitly closed for the same byte count).

Python 2, 273 253 242 bytes
-11 bytes thanks to ArBo

g=input()
d=0
t=lambda g,k=1:'\n'.join(map(''.join,zip(*g.split('\n')[::k])[::-k]))
h='o '
while 1:
 l,r=t(g,-1),t(g)
 if h in l:g=l;d-=1
 elif h in g:g=g.replace(h,'>v<^'[d%4]+'o')
 elif h in r:g=r;d+=1
 else:break
exec-d%4*'g=t(g);'
print g

Try it online!
This working by searching the string 'o ', and replacing it by '[>v<^]o', if it is in the maze.
The same check will also be made on the rotated maze, printing the filled maze when the string isn't there anymore.
The function t=lambda g,k=1:'\n'.join(map(j,zip(*g.split('\n')[::k])[::-k])) is used to rotate the grid

Ruby, 126 118 bytes
-8 bytes saved by abusing += instead of manually searching for o again after repositioning it.
->s{d=[q=1,1+l=s=~/$/,-1,~l];i=s=~/o/;(s[i]=">v<^"[q];s[i+=d[q]]=?o)while q=[~-q%4,q,-~q%4].find{|e|s[i+d[e]]==' '};s}

Try it online!

Jelly, 72 56 bytes
œṣ€⁾o j€ṛị“v<^>”;”oʋ,
UZ$ṛ¡+ƭ€Ɱ3r5¤ç/€ḟ$Ḣß$ṛ¹?
,0ÇZU$ṛ¡/

Try it online!
A full program that takes the input as a list of strings and returns a list of strings with the final snake. Note the footer on TIO converts a single newline separated string into the desired input and restores the newlines at the end; this is merely for convenience.
Solution somewhat inspired by the method used by @Rod’s Python 2 answer, though implementation is very different.

T-SQL 2008 query, 373 371 366 bytes
I had a priority list, always slither left, straight, right. I changed that priority to always slither back, left, straight, right. Slithering back will always be blocked, so the priority is still the same except the first slither. By turning the snake down initially (C=4), it attempts to slithering up when backslithering. This little stunt saved me 2 bytes. Because I didn't need to add 1 to ~-~-c%4.
I inserted 2 line breaks to make it readable
DECLARE @ varchar(8000)=
'################
#o             #
#   ########## #
# #          # #
# #          # #
# #          # #
# #  #       # #
# #          # #
# #          # #
# #          # #
# ############ #
#              #
################';

WITH s as(SELECT 0i,4c,@ m
UNION ALL
SELECT~-i,x,stuff(stuff(m,~-a+x/3*2+(x-3)%2*s,1,'o')
,a,1,char(59+x+~x%2*11*~x))FROM(SELECT
charindex(' ',replicate(stuff(substring(m,~-a,3),2,1,substring(m,a+~s,1))+
substring(m,a-~s,1)+'~',2),-~-~c%4)%5x,*FROM(SELECT*,charindex('o',m)a,charindex('
',M)S FROM S)Q)L
WHERE x>0)SELECT top 1m FROM s
ORDER BY i
OPTION(MAXRECURSION 0)

I had to make some minor adjustments to execute this online, the posted version runs in MS-SQL server management studio.
Push Ctrl-T before execute in MS-SQL server management studio, this will show result as text.
Try it online

I have no flipping idea how this works, but I can verify that it does. Amazing job!

@BradC thanks for confirming and the compliment. Sql solutions doesn't get much love these days.

Python 3, 343 bytes
import sys
X=0,1,0,-1
F,*Y=*X,0
L=3
g=[*map(list,sys.stdin.read().split("\n"))]
e=enumerate
r,c=[[r,c]for r,R in e(g)for c,C in e(R)if"o"==C][0]
while 1:
	if" "==g[r+X[L]][c+Y[L]]:F,L=L,~-L%4
	elif" "<g[r+X[F]][c+Y[F]]:
		if" "<g[r-X[L]][c-Y[L]]:g[r][c]="o";break
		L,F=F,-~F%4
	g[r][c]=">v<^"[F];r,c=r+X[F],c+Y[F]
for r in g:print("".join(r))

Try it online!
-11 bytes thanks to ArBo
-4 bytes thanks to Jonathan Frech

You can golf the initialisation of X, Y and F to X=0,1,0,-1;F,*Y=*X,0 if I'm not mistaken. Also, the import* costs you more bytes than it saves.

@ArBo Oh, I thought it was saving some lol. Also that's pretty clever, thanks!

I think you can save a byte with *g,=map(...). And does sys.stdin.readlines() work perhaps?

Alternatively, you can probably save a few of bytes by assuming a single-line input and using input().

if C=="o" ~> if"o"==C, if g[r+X[L]][c+Y[L]]==" ", elif g[r+X[F]][c+Y[F]]>" ", if g[r-X[L]][c-Y[L]]>" " accordingly.

@AndrasDeak What do you mean by a single line input?

@JonathanFrech Good one, thanks

I meant using a '\n'-filled string on a single line, but now I see that this would be more compkicated than I thought. So nevermind that part.

05AB1E, 54 52 bytes
[S¶¡øí3FDíø})J€»¼D¾èU¼.Δ.¼„o ©å}DÄiXqë®">^<v"¾è'o«.;

I/O both as a single multi-line string.
Try it online or verify all test cases.
Explanation:
[                      # Start an infinite loop:
 S                     #  Split the multi-line string into a list of characters
                       #  (which will use the implicit input in the first iteration)
  ¶¡                   #  Then split by newlines
    øí                 #  Rotate the matrix once clockwise
      3F               #  Loop 3 times:
        D              #   Create a copy of the matrix
         íø            #   And rotate this copy once counterclockwise
       })              #  After the loop: wrap all four matrices into a list
 J                     #  Join each inner-most character-list to string-lines again
  €»                   #  And join each inner list of lines by newlines again
    ¼                  #  Increase variable `c` by 1 (variable `c` is 0 by default)
     D¾<è              #  Index the updated variable `c` in a copy of the list of matrices
                       #  (note that indexing wraps around in 05AB1E)
         U             #  Pop and store it in variable `X`
    ¼                  #  Then increase variable `c` again
    .Δ                 #  Find the first multi-line string in the list which is truthy for:
      .¼               #   Decrease variable `c` by 1 first
        „o             #   Push string "o "
           ©           #   Store this string in variable `®` (without popping)
            å          #   Check if the current multi-line string contains this "o "
    }D                 #  Duplicate the result (results in -1 if none were truthy/found)
      Äi               #  If no result was found:
        X              #   Push variable `X`
         q             #   And stop the program, after which this multi-line string of
                       #   variable `X` is output implicitly as result
       ë               #  Else:
         ">^<v"¾è      #   Get the `c`'th character in string ">^<v"
                       #   (note that indexing wraps around in 05AB1E)
                 'o«  '#   Append a trailing "o" to this character
        ®           .; #   And replace the first variable `®` ("o ") in the
                       #   multi-line string with this

Pyth, 161 bytes
J.zK[Z1Z_1)=Y+tKZVlJFTl@JNIq@@JNT\oA[NT;=N3=TZ#Iq@@J+G@KN+H@YNd=TN=N%tN4.?In@@J+G@KT+H@YTdIn@@J-G@KN-H@YNd XJGX@JGH\oB=NT=T%hT4)) XJGX@JGH@">v<^"TA(+G@KT+H@YT;jJ

Try it online!
Port of HyperNeutrino's Python 3 solution. Now that I'm done with it, I'm thinking maybe I should have ported Rod's Python 2 solution instead, but I already spent way too much time on this.


text:
Print the new site header
The new site header has some bits of source code from various questions as the background. Here are the first 3 lines:
--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+. Hello, World! IT'S SHOWTIME TALK TO THE HAND "Hello, World!" YOU HAVE BEEN TERMINATED "9!dlroW ,olleH"ck,@ 72a101a+7aa+3a44a32a87a111a+3a-6a-8a33a Take Circle Line to Paddington Take Circle Line to Wood Lane Take Circle L
alert'Hello, World!' target byteorder little;import puts;export main;section"data"{s:bits8[]"Hello, World!\0";}foreign"C"main(){foreign"C"puts("address"s);foreign"C"return(0);} aeeeaeeewueuueweeueeuewwaaaweaaewaeaawueweeeaeeewaaawueeueweeaweeeueuw H class H{public static void main(String[]a){System.
World!");}}+[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+. "Hello, World!"o| :after{content:"Hello, World!" H;e;P1;@/;W;o;/l;;o;Q/r;l;d;2;P0 ('&%:9]!~}|z2Vxwv-,POqponl$Hjihf|B@@>,=<M:9&7Y#VV2TSn.Oe*c;(I&%$#"mCBA?zxxv*Pb8`qo42mZF.{Iy*@dD'<;_?!\}}|z2VxSSQ main(){puts("Hello, W

However, a few microseconds of extra load time can cause the user to click away from the site, so the page header download really should be optimized as much as possible.
Write a program that takes no input and produces the (first 3 lines of) text from the new header as output.

Trailing newline is optional
Must include the line breaks from the original header
code-golf, so shortest code wins!

I'm cautiously hopeful that the patchwork of kinds of text in the header will encourage more tailored approaches than the generic text compression methods that plague kolmogorov complexity challenges.

@xnor Yeah, there are multiple "Hello, World"s, but then the BF and evil likely have their own interesting compression.

Just an FYI the naive bubblegum answer is 594 bytes.

@FryAmTheEggman I get 588

That System.alert is triggering

What header is this? Mine appears to start with Circle.

@Mast Inspect element on the header and look at the css background-img. It's a bit clearer if you look at the header from the meta site.

@DanielM. Oops, just saw that. Comment deleted.

Stax, 601 584 574 564 553 539 bytes
«=¬█j▼sw│╥═7♫çÿñ╦*‼e"!‼╤Å╟D·εWÜå╖L♂@#î╚å♫▐ô;(┤┼»Kî→δäû║h◘│¶zurΘ█┐£ë}∞è┼$÷gôwg¬≤╒Ñ╧]∙ì▄╦╕ís│\☺'┴♫Φ^┐╤å{1█♠₧ï∩∙↑▀⌂d▲╡⌡3J‼¡qâ╧3¥Çƒwe▀≡╔MjZΣΩyüO╬ªÉΩö^Y╡►8K₧óN·ÿjg≈Cö9^◘■~Ä_ßx▐Å┌ Q>/♫╤QΩzN╤V½▓▀◙ß╗╗◄►(╔☺╡┘Ah╙¢√ß▼GΩ→ù◄:─◘#♫úq•ø≤>↨)Å│╤[ïmgBX┤╛v\ⁿ╛å╘╕7d╪TµbW#2¶ø╙╜~êê[↨>K►♪0∞#XJ°ñntG∞⌐V♥Z<ÿº'║☺;┤é⌡♠gáσßÑ+♂z♥‼S9 l≈╫ºÜT»↕▀τ♣¡gWe¥_çà(┬f╜n[╗╤fσ╞R₧▲V▌═◙úKÆÜ▄☺╥s1▼╩ûû╗▌▌Ω■g∞Y╡9╦tè┴y♂w∟⌂┌'╣W▀M╓·uBôúPm◘ ☻ⁿFh<╘sú▲Ö╘¶¿_2♦Θb{╪δC\lô+▀9¶ß§╡╓)ú}○8∟⌡nÑôI )╓îFbH[î║╞e&"¶↓~A#ç╔▄─áσ∙:═Æ▬ª▄ÄêQSNM◙∞Z╜≈±╘▬LIÿ|#.¿Φµ║▌Lväv▓♣;└Æ▲▄♣↕{╪½)╚φ╡♦:oÉ▀j╠ΔP<ç↔|±╦=╣▓Φ▒─4D▄■ìà>↓┐

Run and debug it
It does at least attempt to use different strategies for different pieces.
I've still got some hope for a few sections, but here's an explanation of the approaches so far.
                                    The general approach is to push a bunch of stuff on the stack.
                                    Then join it all together and split it in thirds.
'                                   just a space
`jaH1"jS3!`X                        compressed literal for "Hello, World!" assigned to the x register
`38dZl;i#D]|@Y@*`                   compressed literal for "It's showtime talk to the hand"
^                                   convert to upper case; it compresses better in lower case
n'"|SY                              Wrap the x register in quotes and save it in the y register
`=j("sx6c1 ob`^                     compressed literal for "you have been terminated" in upper
."9                                 literal for '"9'
yrD                                 register y (quoted hello world), reversed, first character dropped
"ck,@ "                             literal
"^h{ai{W>bJ,^T+NLDK(G$s@+"!         crammed array [725, 101597559, 354, 45325875, 1115935, -65, -85335]
$"5a9+"|t                           concat as strings, then map '5' to 'a' and '9' to '+'
`='9%[mh++PxF!`                     compressed literal for " Take Circle Line to "
`~J@[E<`n                           compressed literal for "Paddington"; copy the one about the circle
`jj_kmZ5`                           compressed literal for "Wood Lane"
n7T                                 copy " Take Circle Line to " and truncate last 7 characters
"alert'"x''                         some literals and x register
`~lLKPq'III^) .tI:G8?uMolVwpnT&u#`  compressed literal with commas in place of semi-colons
.,;|t                               replace with semi-colons, which aren't allowed in compressed literals
`/zOXzN`",data,{s:bits8[],`x\0_;}`cC,main(){`cC,puts(,address,s);` C,return(0);} ".,"|t
                                    compressed literal for "foreign", followed by a string template
"Nm\{<\3VdH,FF:c~7&u!n"96|E         carefully chosen string literal interpreted in base 96
"eawu":B                            encoded in custom base "eawu"
`dzJxVHC"`'{`pS7yzeENLM%_'`         two compressed literals with a '{' in the middle
"(String[]a){System."               literal
x6)                                 last 6 characters of register x
"`");}}"                            literal with escaped uote
"0;pKll>r&.sSP}JLNL==(>eP>-2\6fc8|)4&.:,1jA66O{t0>GpALk4I{.iDM:Gr_50ga"
90|E                                literal of ascii characters decoded in base 90
"[+-><],.":B                        re-encoded with a custom base of brainfuck
72:/                                split at position 72
~                                   push the right half to the input stack, effectively the beginning
" `yo| :after{content:`y H;e;P1;@/;W;o;/l;;o;Q/r;l;d;2;P0 ('&%:9]!~}|z2Vxwv-,POqponl$Hjihf|B@@>,=<M:9&7Y#VV2TSn.Oe*c;(I&%$#`"mCBA?zxxv*Pb8``qo42mZF.{Iy*@dD'<;_?!\}}|z2VxSSQ main(){puts("
                                    big string template including y register a few times
y9(                                 first 9 characters of y
Lr$                                 wrap all stacks in array and concatenate
3Mm                                 split into 3 equal parts and print as lines

Please do add a description of the strategies you employed.

Nice, thanks for the breakdown!

That yo| :after{content make it look like some kind of rap.

Jelly, 568 bytes
“¢lẊḊ%ñẇÄNị¡ẸVþṾɲXØ?^ÆÐX⁷®bWċ’b7ị“-+[>].<”” “3ḅaė;œ»©“×;-¢İiĖƝÞth⁴"Ạ⁺Xṙ{»Œu®“JṁkKɼġʋḲỴ9|ḤḲ»Œu®U“ƭJ&çȯ»” Ȯø“¡ŻAÆ¡ ⁾Ʋ⁵(S0-’b122_⁵ȯ€“”ṭ"3,5,10Ṭ×”+¤j”a“Æ¬>hPḢ¤Ġ2fɠjẆȤ¬ṬwḷÇRy_ỴṬƓO¶~^YG³ẸṂḊỤÇ»®“¡ñA¦ɗɱṪḅạðEṘ/Ḋ_³ṢÑ⁺ċßs³m0>*Ḥıo7Ʋ>[;ɼ⁽¢OẆ9Ɓ€»®“¤Z!ƤḂĊlðiƝṘŻqọ6³Ṣṡḃ8Þœn⁶ʠẉ>yuẆ{»Ḳj“ṢẈ,ẊL»” ø“×©K⁸ƁƬ÷FġƬṘ¹^Ẉ§ṭƁḅ’b4ị“wuae”“£¦ƊNỴŻw;ƊFɦȦnœĠÐẇṀu½X*ṠOJ8ȷḍu&)ṫ)⁼ẏµ×ẏ`ȯ»ø“¡-P⁽Rȯ$@°ḤėXƙ€ṭ⁶Vė7-²ɦ{NỌQ’b7ị“+-><].[”⁾ "®“ıȷ®⁻ʂ£Þȷ⁹ṣp°⁷»®ø“Ṛ|ġcßỵiṃ^ɱrÐẏNạŀiUĠ¥ĿSʂĊ⁷Ð+¦ŻvIṖj~ż¹kĿƥð¿ƘeḶZƤLɱ ṭṡ¥⁷ė$ ėƬ ċ⁵Ṛ¿⁷¢²_ṛż⁽p£⁽n#/i½ɱ`M3BƓḳ?¥ạuẹ09ʠ;"J!ṢIMkIoÐȯ²&_ẋẓṗḲ>½Q>ẈȯĠ ŀJṇḢC.(Eı’b128ịØJ“¡ʂh;⁼µ:ȮçṛƤb7ḋ2ṢR»

Try it online!
I tried to add optimizations per section. The optimized string compressor compresses this to 730 bytes (which should be the best possible just using basic Jelly syntactical constructs rather than any actual methods), so it appears I have done something.
(Fun fact: after I posted this answer, Chrome started suggesting translating this page to Vietnamese :P)

Interestingly enough, pasting your full answer into google translate detect language uses Igbo. It "translates" the part corresponding to œ»©“×;-¢İiĖƝÞth⁴"Ạ⁺Xṙ{ as "the rest", but then if I paste that substring by itself, it detects as Viatnamese and translates to gibberish.

@DanielM. Huh, that's interesting. Wonder why it recommended Vietnamese then; probably based on the Stax answer and the surrounding English. Thanks for sharing!

SOGL V0.12, 542 527 bytes
Hello, World!”³³"ī←≥/ī⁹βņ	fi▼pΛtι¤Υ8Th4ΚT~v‛θ5→č■⌡‘o"′]◄⅟ō&÷2}≠Θ←⁷┌∙‽↓æ³ΘZ°β╔¶ļ¹‘U┌⁷ŗo±"ē‛V)≥u∆↕]ē׀~σφ‰τ┘^|i≡»┼y3┐X3Η‛Χ4±2‘o"ΣΤ°ε⁵↑p$J↑³∫ū²▼!⁄B²⌠3τ}σS⁷bu¹1∆Ν²‘ū#Ƨtoŗo"JνΠ◄ī÷$λ⅜Zø@Pθθ╚XΔBPø√:┘¦z#│y⁹oΣ⁄½Λ'7⅞Fģ′σv+&≥μ_¦≠⅔v]lπlsβ╥^D#,℮⁾§Aα‛ķκņ▼%ķW═g!ōΜ¬`}⅛čņ█≠⁄⅔‛mZÆ~⁴πzWl─xτ▼'Η↓#ΗΩ►φL8!Ƨ:e¡′ž|Τr^+≡▒GπεΓW≥7±λxw׀ Κν⁷cP\ιYΤp|A╝æƧO∑b►\÷Q²OΟč⅔⁽(╬( ρn⁽BoG=Υ→m▒‽¤/►iΟ√PqΩ∙φ4√VΥæl‽υΧ$f0╬Dkμ⌠Lāč¾↓′∫Ε╚Βæ║↑Ν▲γB#⁶5⁹B|l↔ƨ╗6Σŗ⁄⅟ω±μξydA┼*ģ⁴Z►xa^■7O═ģΖ4Γ⅞6═¾χ‰⁷‛[‚⅓D⅞π▓z⁶‼Æņ2Υ√θ']7┐⁰īS╗<čfφ┘lθ⁄{=æ⁹Δ<¡⁾Υ□ι¹λzFΗ▲-β▒╤ÆAΩ/xff⁰ΞΠIæ┘*⁾h⁷╗ΧG─`⁾⁄@p*‘p

Try it here!
Almost all compression, but broken up every now and then because English compression works only on lowercase words and case is important. I still had to split the text up in compressible parts though.
This finally made me fix a bug in the compressor, making it unresponsive sometimes (the result still works in the previous versions though)

Retina, 793 bytes

--<-<<+[+[<+>--->->->-<<<]>]<<--.<6*+.<<-..<<.<+GG.<<<.+++GG-.<<<+. ^ IT'S SHOWTIME TALK TO THE HAND "^" YOU HAVE BEEN TERMINATED "9!dlroW ,olleH"ck,@ 72a101a+7aa+3a44a32a87a111a+3a-6a-8a33aXine to PaddingtonXine to Wood LaneX¶alert'^' target byteorder little;import puts;export 5;section"data"{s:bits8[]"^\0";}J5(){Jputs("address"s);Jreturn(0);} aeeeaeeewueuueweeueeuewwaaaweaaewaeaawueweeeaeeewaaawueeueweeaweeeueuw H class H{public static void 5(String[]a){System.¶World!");}}+[-->-[>>+>5*-<<]<--<---]>-G>+G..+++[.>]4*<.+++.6*-.<<-G>>+. "^"o| :after{content:"^" H;e;P1;@/;W;o;/l;;o;Q/r;l;d;2;P0 ('&%:9]!~}|z2Vxwv-,POqponl$Hjihf|B@@>,=<M:9&7Y#VV2TSn.Oe$*c;(I&%$#"mCBA?zxxv$*Pb8`qo42mZF.{Iy$*@dD'<;_?!\}}|z2VxSSQ 5(){puts("Hello, W
5
main
G
.>>
J
foreign"C"
X
 Take Circle L
\^
Hello, World!

Try it online! Well, I tried. The desired output uses all but five printable ASCII characters, but fortunately I could only find five strings with enough repetition to be worth compressing. There are also four characters repeated more than three times in a a row; these are run length encoded. Would be 1 byte longer in Retina 0.8.2 as the four run length encodings cost an extra byte each but it's then no longer necessary to quote the three desired *s.

Deadfish~, 6462 bytes
{iiii}iiiiicc{i}iiiiic{d}dddddc{i}iiiiicc{dd}iiic{iiiii}ddc{ddddd}iic{iiiii}ddc{ddd}dc{dd}iiic{ii}dc{dd}iiiccc{ii}dddc{dd}iiic{ii}dddc{dd}iiic{ii}dddc{dd}iiic{i}iiiiiccc{iii}iiic{ddd}dc{iii}ic{ddd}dddcc{d}dddddccic{i}iiiic{dd}iiicccccciiic{i}iiiicc{d}dddddcicc{i}iiiicc{d}ddddc{i}iiiic{dd}iiiciiic{i}iiiiiicc{d}ddddddc{i}iiiiiicc{d}ddddddc{i}iiiiccc{d}ddddcdddccciiic{i}iiiiiicc{d}ddddddc{i}iiiiiicc{dd}iiicic{i}iiiiccc{dd}iiiciiic{d}ddddc{iiii}c{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiicdc{iiii}ic{i}ic{dddd}dddddc{iiii}iiiic{ddddd}dc{iiiii}ic{d}dc{i}dddc{i}ddcdddc{d}dciiiic{d}iic{dddd}iiic{iiiii}iic{dd}ic{i}icdc{dddd}dddc{iiiii}iicdddddc{ddddd}iiic{iiiii}iic{d}ddcdddc{dddd}iiic{iiii}c{d}iiic{i}iiic{d}c{ddd}ddddddciic{iiii}ddc{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiicicddc{iiiiii}dddc{d}ciiiiiic{ddddd}dddc{iiii}c{d}iiic{ii}ic{dd}iiic{dddd}iiic{iii}iiiiciiicc{i}dc{dddd}ddddddc{iiiii}iic{d}dddddc{i}iiicdddddcddddciiiiic{d}dddc{ii}dc{d}dddddcdc{ddd}ddddddciic{ii}iiic{dd}ddddc{{i}ddd}dddc{i}ddciiiiiicdddc{dd}ddddc{ddddd}dddddc{i}iic{{i}ddd}dddcdddcc{d}iiic{ddd}ic{dddd}iic{iiiiii}iiiiic{i}ddc{dddddd}dddc{ii}c{ddd}ddc{ii}iiicdddddc{iiiii}dddc{ddddd}iicdcic{iiiii}ddc{ddddd}ddddc{i}iic{iiii}iicc{ddddd}ddddc{i}ddc{iiii}iiiiiic{dddd}dddddcc{iiii}iiiiic{dddd}ddddddcdc{iiiii}dddc{dddd}dcdc{iiii}iic{ddddd}iiccc{iiiii}ddc{ddddd}ddddc{i}ddc{iiii}iiiiiic{ddddd}ddc{i}dc{iiii}iiic{ddddd}ddc{i}ic{iiii}ic{dddd}ddddddcc{iiii}iiiiiic{dddddd}dddddc{iiiii}iic{i}iiic{i}cddddddc{{d}iii}ic{iii}iiiiic{iiii}ddc{i}dc{d}dddddc{i}dc{d}iiic{{d}iii}ic{iiii}iiiic{iii}dciiiiic{d}ic{{d}iii}ic{{i}dd}iiiicdddddc{{d}ii}ic{iiiii}ddc{ii}dddciiicciiiiiciiiiic{d}iiic{i}iiicdddddcdc{{d}ii}iic{iiiii}iic{i}iiic{i}cddddddc{{d}iii}ic{iii}iiiiic{iiii}ddc{i}dc{d}dddddc{i}dc{d}iiic{{d}iii}ic{iiii}iiiic{iii}dciiiiic{d}ic{{d}iii}ic{{i}dd}iiiicdddddc{{d}ii}ic{iiiii}iiiiic{ii}iiiicc{d}dc{{d}iii}iic{iiii}iiiic{ii}ic{i}iiic{d}ic{{d}iii}ic{iiiii}iic{i}iiic{i}cddddddc{{d}iii}ic{iii}iiiiic{iiii}ddc{i}dc{d}dddddc{i}dc{d}iiic{{d}iii}ic{iiii}iiiic{ii}ic{i}ic{d}iiic{i}iiiciic{{d}ii}iiic{iii}iiic{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiiciiiiiic{d}iiic{{i}dd}iiiic{dd}ic{ii}dddc{d}dcddc{i}iiiiic{{d}ii}ddddc{iiiiii}iiiiiic{ii}iiicdddddc{d}dddddc{i}ciiic{d}ddddcic{i}iiic{{d}ii}ddc{{i}ddd}iiiiiicdddc{i}icc{d}iic{d}iiic{dddd}ddc{iiii}iiiiiiciiiiciiicdciiiciic{{d}ii}ddddc{{i}dd}ciiiiicdcdc{ddddd}ddddddc{iiii}iic{ii}dc{d}iicdciiiciic{{d}ii}ddddc{{i}dd}dddc{d}ddc{i}ddciiiiic{ddddd}dc{iiiii}iiiiiic{d}ddddcddc{ii}dddc{d}dciiiiiicdc{{d}iii}ddddddc{iiiiii}iiiiiicdddc{ii}dc{dd}ic{dddddd}dddc{{i}d}dc{d}iic{dddddd}iiic{iiii}c{i}dddc{i}icdc{dddddd}ic{iii}iiiiiciic{dddddd}ic{iiii}ddc{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiic{iiiiii}dc{dddd}ddddc{d}ddddc{ii}iiiiic{iiiiii}iiiiiic{dd}dddc{i}dciiic{d}dddciiiicddc{i}dddc{{d}iii}ddddddc{iii}iiic{ddd}dddc{{i}ddd}iiiiic{d}ddc{i}ddciiiiic{{d}iii}cic{{i}dd}iic{dd}dc{i}dciiic{d}dddciiiicddc{i}dddc{{d}iii}ddddddc{iii}iiic{ddd}dddc{{i}dd}ddciiiiicdcdc{{d}iii}dddddcddddddc{iiiiii}iiiciiicc{i}iiiic{d}dddc{i}iiiicc{{d}ii}dc{{i}dd}ic{{d}iii}ddddc{ii}ddc{iiii}iiic{i}dciiic{d}dddciiiicddc{i}dddc{{d}iii}ddddddc{iii}iiic{ddd}dddc{{i}dd}c{d}dddc{i}iiiiicicdddcddddc{{d}iii}c{i}ddc{d}iiic{ii}ddc{iiiiii}iiiiiic{{d}i}dddc{iiiiii}iiiiiciiiicccddddciiiiccc{ii}ddcddc{d}ddddddc{i}iiiiiicc{d}ddddddc{ii}ddc{dd}iicc{i}iiiiiic{d}ddddddcc{i}iiiiiic{d}ddddddc{ii}ddcc{dd}ddccc{ii}iic{dd}iicddddcciiiic{ii}ddc{dd}ddciiiicddddcc{ii}iicddc{d}ddddddc{ii}ddc{dd}iicccddddciiiiccc{ii}ddc{dd}ddccc{ii}iicddc{d}ddddddcc{i}iiiiiic{d}ddddddc{ii}ddc{dd}iiccddddc{ii}iic{dd}iiccc{i}iiiiiic{d}ddddddc{i}iiiiiiciic{{d}i}iiic{iiii}c{dddd}c{{i}ddd}dddc{i}dc{d}dc{ii}ddcc{{d}ii}dddc{iiii}c{iiiii}ic{d}dciiiiic{dd}ic{i}cdddcddddddc{{d}iii}iiic{{i}dd}iiicic{dd}ic{ii}dc{d}dcddddddc{{d}iii}iiic{{i}dd}iiiiiic{d}iiicddddddcdddddc{{d}iii}iic{{i}dd}dddc{d}ddc{i}ddciiiiic{{d}iii}c{iiii}iiic{iii}iiicddc{d}iciiiiic{d}iiic{d}ddciiciiiic{ddddd}ddddddc{{i}dd}iic{dddd}c{iiii}ddcddddddcic{d}dddddc{i}ddc{dddddd}dddc{iiii}ic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiicic{i}dddc{ii}ddc{iiiiii}iiiiiicc{{d}ii}ddc{iiiii}ddc{dddd}ddddddcc{ii}dddc{dd}iiic{iiii}iiiiiic{ddd}icc{dd}ic{ii}dc{dd}iiiccccc{i}iiiiicc{iii}iiic{ddd}dddc{d}dddddcc{i}iiiiic{d}dddddccc{iiiii}ddc{ddd}dc{dd}iiicic{i}iiiiiiccc{dd}iciiic{i}iiiiiicc{d}ddddddccdddccc{iiiii}ddc{dddd}dddddc{i}iiiiiic{iii}ic{ddd}dddcccc{d}ddddcdddccciiicdccccccic{i}iiiicc{d}dddddcic{i}iiiiiicccc{dd}iciiic{d}ddddciic{iiii}ddc{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiicic{{i}dd}dddc{i}iiic{{d}i}ddc{ii}iiiiiic{iiii}dciiiiic{i}iiiic{d}dddddc{i}iiic{i}dc{dd}ddddc{i}iicdciiiiiic{d}dddddc{i}dciiiiiic{dddddd}iic{dd}ddddc{iiii}ddc{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{ii}iiiiciiicddddddc{d}iic{{d}iii}iiicicddc{iiii}c{d}dddc{iiii}iic{dddd}ddc{ii}ic{ddd}dc{i}ciiiiic{dd}iiic{i}iic{iii}ddc{ddd}iic{iiiii}iic{ddddd}ddc{d}ddc{iiiiii}ic{ddddd}icc{iiiii}iic{ddddd}ddc{ii}iic{ddd}ddddc{{i}ddd}dddc{ddddd}dddddc{iiiii}dc{ddddd}ic{iiii}ic{dddd}dc{d}ic{i}dc{ii}ic{ddd}ddc{d}ddddddc{i}ddcdcdcdc{ii}icdc{iii}iiiiiic{dddddd}c{{i}d}iiicdcdcddc{{d}iii}ddc{iii}iiiiiic{iii}iiiicdcdc{{d}iii}dddcdc{iii}iiiiiicdc{iii}iiiicdcdcdcddc{{d}iii}ddc{iii}iiiiiic{iii}iiiicdcdcddc{ii}iic{dddddd}iicddccddc{dd}iic{ii}dddcdc{ii}dddc{dd}icdc{dd}ic{ii}dddc{iii}iiiic{ddddd}ddddc{iiiii}icc{ddd}ddddddc{iii}iiiicdc{iii}dddc{dddddd}ddddc{iii}iiic{ii}iic{dddddd}ic{iiiiii}dddc{dddd}c{dd}ic{iii}iiic{ddd}dddddcdcdcdcdc{{i}ddd}iiiiic{dddd}ddcdcdcddc{iiiiii}dcddccddc{{d}iii}ddddddc{iiii}ddc{ii}ddc{dddd}ddc{iiii}c{ii}dddcddc{dddddd}icddc{iiiiii}dc{dd}ic{dd}c{dd}ddddc{{i}dd}dddc{ddddd}c{iiiii}ddc{{d}ii}ic{ii}iic{iii}iiiiiic{ddd}ddc{ddd}ic{ii}icdc{iii}iiiiiic{ddd}ddc{ddd}c{iiiiii}dc{iii}iiiccdcddc{{d}iii}ddc{iii}iiiiiic{iii}iiiic{dddd}iiiccddc{ddddd}ic{{i}dd}dddc{d}ddc{i}ddciiiiic{{d}iii}cic{{i}dd}iic{d}dciiiiicdcdc{{d}iii}dddddcddddddc{iiii}ddc{iii}dc{i}dddcciiic{{d}iii}iiic{d}ddc{iiiii}iiiiic{i}iiiiiciiiciiic{d}iiic{dddd}dddc{d}dccc{{i}ddd}cddc{d}ddddc{i}iiicic{{d}iii}iic{iiiii}ic{i}dcddddddciiiic{i}ic{d}ddc{dddddd}iiic{iiiii}iiic{i}ic{d}ddc{ii}ddc{d}iic{d}iic{i}dciiiiiicdc{{d}iii}iic{iiiii}iiiiiic{i}ddc{d}ddddddc{ii}ic{d}dddddc{i}iiiicic{{d}iii}ic{iiiiii}dc{d}ic{ii}ic{dd}dc{ddddd}c{iiiiii}ddciiiiic{d}cic{ii}dc{{d}iii}ddddc{iiiiii}ddc{i}iic{d}iiicdc

source: Stack Exchange

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

sort: votes


text:
Reroute the Path
Given a grid of directions and a start and end position, determine the minimum number of substitutions in the direction grid that needs to be made to complete the path between the two points. The grid is doubly-cylindrical. This is clearer given an example.
Example
Let's take the following grid as an example:
>>>>v
>>>><
<<<<<

Let's start at (1, 1) and end at (1, 3) (where the coordinates are (x, y) or (col, row), with the top row and left column being 1). Then, one possible solution is to replace the (1, 1) and (1, 2) with v, so that the final grid looks like this:
v>>>v
v>>><
<<<<<

Starting from (1, 1), the path would lead us to (1, 3). However, a shorter solution exists, which is to replace (5, 2) with v, so the final grid is this:
>>>>v
>>>>v
<<<<<

Starting from (1, 1), a rather long path leads to (1, 3).
Replacing anything in the top row with ^ works too (thanks @Spitemaster).
Input
The input will consist of a rectangular grid of 4 possible values, as well as two coordinates. You can take the grid in any reasonable format; for example, character or integer matrix, string list, etc. You can also request the dimensions of the grid. You can take the coordinates in any reasonable format; for example, integer pair, complex number, etc. You can choose 0- or 1-indexing.
Output
The output should be a single integer, the minimal number of grid replacements necessary to close the path from the start to the end.
Rules and Specifications

Standard Loopholes Apply
the grid is doubly cylindrical, meaning that moving up from the top goes to the bottom, left from the left goes to the right, etc.

Sample Cases
The sample cases are given as a character matrix and 1-indexed coordinates.
Case 1
Input
>>>>v
>>>><
<<<<<
1 1
1 3

Output
1

Explanation
See example.
Case 2
Input
<<<<<
v>v>v
>>>>>
1 1
5 3

Output
1

Explanation
You can either replace (1, 1) with v or (2, 1) with v. In the first case, starting from (1, 1), the path goes straight down and then to the right to the destination. In the second case, the path loops off the left to the right, reaches (2, 1), goes down, right, down, and then right until it hits the destination.
Case 3
Input
^^^^^^
><<>>>
vvvvvv
2 2
5 2

Output
2

Explanation
The best change is to make the center row wrap around the left to the point; that is, make the first and last items in the center row <. Alternatively, make 2 2 and 3 2 both >.
This is a code-golf challenge, so the shortest code wins!

ex 2 will work changing any of the top row with either ^ or v.

I suggest adding a test case or two requiring more than one change.

+1 to Jonathan's suggestion -- I think a problem like this deserves like 5-10 test cases, covering a variety of edge cases.

what you have >< does it ping pong back and forth (so that both positions are arrived at) or is it like there's a wall in between them?

@Jonah It jumps between them (so yes, it hits both)

JavaScript (ES6),  140  135 bytes
Takes input as (a, width, height, x1, y1)(x0, y0) where a[] is a matrix of integers and all coordinates are 0-indexed.
Directions: \$-2\$ for left, \$-1\$ for up, \$0\$ for right and \$1\$ for down.
(a,w,h,X,Y)=>m=g=(x,y,n=0,r=a[y%=h],v=r[x%=w])=>x-X|y-Y?[-1,0,1,2].map(d=>r[v<2&&g(x+w+d%(r[x]=2),y+h+--d%2,n+(v!=d)),x]=v)|m:m=m<n?m:n

Try it online!
How?
We use a breadth-first search to try all possible paths from \$(x,y)\$ to \$(X,Y)\$ without visiting twice the same cell.
We keep track of the number of times \$n\$ where the direction that was chosen did not match the direction stored in the input matrix.
We eventually return \$m\$, which is defined as the minimum value of \$n\$.

Jelly, 73 72 bytes
W,0+Ɱ⁴PṬ€×Ɱ3¤Ẏ¤,€ɗ/€Ẏ$‘ƭ€ịØ.,N;U$¤;ɗ/0ị+æ.Ɱ⁴‘Ṫịʋ¥Ɗ%⁴ṭƲ⁴P¤¡ŒHṪe¥/Ʋ€Ẹ¬Ɗ/¿Ṫ

Try it online!
Example using case 3 that requires two changes (also has a footer to translate the ><v^ into numbers).
A full program that expects the following arguments:

Left: a list of two lists; first the flattened direction grid encoded as 1=right, 2=left, 3=down, 4=up, followed by a list of the end position and start position as zero-indexes [row, column]. For first example, [1,1,1,1,3,1,1,1,1,4,2,2,2,2,2],[[2,0],[0,0]].
Right: a list of the number of rows followed by columns. For first example [3,5]

Returns the number of changes required to get from start to end. Slow once this is more than one change. On TIO the third example case takes approx. 30 seconds to complete.
Full explanation below, but overview is:

Initialise a counter to zero.
Work out positions after each of \$\mathit{row} × \mathit{column}\$ moves.
Check if the end position is included:

If false, increment a counter and create \$3 × \mathit{row} × \mathit{column}\$ new versions of the grid, each with a single grid position changed to one of the three possible alternative moves. Then go back to step 2.
If true, terminate and output the counter

Full explanation:
W,0 | Wrap input in a list, and then pair with 0 (thus initialising the counter)

                                           Ɗ/¿ | While the following is true for the first item of the input pair (i.e. the list of all grids to be tested, paired with the end and start grid positions):
                                       Ʋ€      | - For each member of the list:
          ɗ/                                   |   - Reduce using the following as a dyad (so left argument is flattened grid and right is end/start positions)
ị       ¤                                      |     - Index into the following as a nilad
 Ø.                                            |       - [0, 1]
   ,N                                          |       - Pair with negative [[0, 1], [0, -1]]
     ;U$                                       |       - Concatenate to upended version of this [[0, 1], [0, -1], [1, 0], [-1, 0]]
         ;                                     |     - Concatenate (to end/start positions)
                            Ʋ⁴P¤¡              |   - Repeat the following links the number of times indicated by the product of the grid dimensions:
                        Ɗ                      |     - Following as a monad:
            0ị                                 |       - Last item (current grid position)
              +        ¥                       |       - Add to the following as a dyad:
               æ.Ɱ⁴                            |         - Dot product of current position with each of grid dimensions
                   ‘                           |         - Increase by 1
                    Ṫ                          |         - Tail (which is current position in flattened grid)
                     ị                         |         - index into flattened grid
                         %⁴                    |        - Mod grid dimensions
                           ṭ                   |        - Tack onto end of current grid/position list
                                 ŒH            |   - Split into halves (first half will be flattened grid and desired end position, second half will be all positions reached after moving through grid)
                                     ¥/        |   - Following as a dyad, with the first half from above step as left argument and the second half as right
                                   Ṫ           |     - Tail (i.e. the desired end position)
                                    e          |     - Exists within (the list of all positions reached)
                                         Ẹ¬    | - Not true for any of the input grids

                    ƭ€ | For each of the pair (list of grids, counter), do one of the following:
                  $    | - For the list of grids, do the following as a monad:
              ɗ/€      |   - Do the following as a dyad, with the flattened grid as the left argument and end/start positions as the right:
+Ɱ                     |     - Add to the flattened grid list each of:
           ¤           |       - The following as a nilad
         ¤             |         - The following as a nilad:
  ⁴P                   |           - The product of the grid dimensions
    Ṭ€                 |           - Convert each (using an implicit range from 1 to the grid dimension product) to a boolean list with a 1 at the relevant position (i.e. [[1], [0, 1], [0, 0, 1]...])
      ×Ɱ3              |           - Multiply by each of 1..3
          Ẏ            |        - Flatten to a single list of lists
            ,€         |    - Pair each with the end/start positions
                 Ẏ     |   - Tighten to a single list of grids paired with end/start positions
                   ‘   | - For the counter increment it

Ṫ | Finally, take the tail (which is the final value of the counter)

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


text:
Print 'A' 1000 times with BrainFuck
What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ?
My approach is:

set 'A' to p[0]
set 255 to p[1] to display 255 'A', 3 times
set 235 to p[1] to display 235 'A'

This is not effective but I cannot find a way to use tow counters simultaneously like a multiplication
Is there a better approach than a multiplication ?
A more general question: is there a rule to make a multiplication with a large number with the smallest possible code?

This is a good place to start. Welcome to Code golf! :)

I think you want to just use a nested loop, but I don't know BF very well. Have you seen Brainfuck tips? Also probably the esolangs page on Brainfuck constants would be a useful resource here.

I think you should clarify best BrainFuck code. Are you in search of most readable, most elegant, using the least amount of + characters or simply highest brevity?

@Jonathan Allan: Yes, that's the purpose of this question : How to use a nested loop. It's a fascinating language close ASM but I don't understand some aspects

Could I use this variant on BF -> https://github.com/gergoerdi/brainfuck64

Question author had edited the question to clarify best means smallest code size. It about asking golf tips for a clear defined task with some certain language. I would consider it clear and on topic. So this question should be reopen imo.

It is tagged code-golf. It's pretty clear and this is on-topic.

There is still some confusion on my part. Is the OP looking for the shortest code to generate 1000? Or, given any arbitrary n, generate the shortest BF code to produce it?

The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>] (not including getting the A) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 250 times and print 4 times each time (thanks to jimmy23013 for optimizing this over my original loop-4 loop-250 print-1 solution):
>------[<....>-] (16 bytes)
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-] (42 bytes).

this seems to assume 8-bit cells, though...

@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.

@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.

250 times .... would be shorter.

@jimmy23013 ... not sure how I didn't think of that an still optimized my 10x10x10 solution to do that LOL. thanks!

the shortest way to get the number 65 for 'A' is >+[+[<]>>+<+]>, and then you just add HyperNeutrino's >------[<....>-] to the end of that.
so the full code becomes >+[+[<]>>+<+]>>------[<....>-] (30 bytes)

How do you know that way is shortest?  It certainly is shorter but do you know for certain that noone will find a shorter one?

28: >+[+[<]>>+<+]------[>....<-]

@SriotchilismO'Zaic yeah I didn't really mean it was the shortest lol

47 Bytes ( No Underflows )
I just did this solution in 47 bytes. I tried doing it in a different manner than I normally would trying to save space by juggling counters between two values. It assumes that A is preloaded into p[4].
+++++[>++++>+++++<<-]>[>[>+>.<<-]>[->.<<+>]<<-]

Explained
Place 5 into p[0]
+++++
Loop 5 times to put p[1]=20, p[2]=25
[>++++>+++++<<-]>
Loop 20 times
[>
Move pointer to p[2] and loop 25 times.
Also move p[2] to p[3]

[
Increment p[3] from 0, effectively moving the value from p[2] to p[3]
>+
Print p[4]
>.
Decrement p[2]
<<-]
Shift over to p[3]
>
[
Decrement p[3]
->
Print p[4]
.<
Increment p[2]
<+>]
Move back to p[1] and decrement
<<-
Repeat until p[1] is 0
]


text:
Print the total length of all "quoted" characters
Rules
In this challenge, I'm going to redefine the definition of "quotes" a bit.

Quotation marks (AKA quotes) are any identical characters used in pairs in various writing systems to set off direct speech, a quotation, or a phrase. The pair consists of an opening quotation mark and a closing quotation mark, which is the same character(case-sensitive).
If there are quote-pairs overlapping each other,

If a pair nesting another, both pairs are still valid.
If a pair not nesting another, the first starting pair remains valid. The other is no longer considered as a pair.

When counting quoted characters(length of a pair of quotes),

The quotes themselves don't count.
Each pair's length is counted independently. Overlapping doesn't affect another.

Goal
Your goal is to print the total length of all valid quotes. This is code golf, therefore the code with the fewest bytes wins.
Examples
Legend:
    <foo>: Valid quotes
    ^    : Cannot be paired character

Input   : ABCDDCBA
`A`  (6): <BCDDCB>
`B`  (4):  <CDDC>
`C`  (2):   <DD>
`D`  (0):    <>
Output  : 12

Input   : ABCDABCD
`A`  (3): <BCD>
`B`  (0):  ^   ^
`C`  (0):   ^   ^
`D`  (0):    ^   ^
Output  : 3

Input   : AABBBBAAAABA
`A`  (0): <>    <><> ^
`B`  (0):   <><>    ^
Output  : 0

Input   : ABCDE
Output  : 0

Input   : Print the total length of all "quoted" characters
`r` (40):  <int the total length of all "quoted" cha>
`n` (14):    <t the total le>
`t` (15):     < >   <o>       <h of all "quo>
` `  (7):      ^   <total>      <of>   ^        ^
`h`  (0):        ^             ^                  ^
`e`  (8):         < total l>                 ^          ^
`o`  (0):            ^           ^         ^
`a`  (0):              ^            ^              ^ ^
`l`  (0):               ^ ^          <>
`"`  (0):                               ^      ^
`c`  (0):                                        ^    ^
Output  : 84

Input   : Peter Piper picked a peck of pickled peppers
`P`  (5): <eter >
`e`  (9):  <t>     ^      <d a p>           <d p>  ^
`r`  (0):     ^     ^
` `  (3):      ^     ^      <a>    <of>       ^
`i`  (5):        <per p>
`p`  (3):         <er >        ^       ^       ^ <>
`c`  (8):               <ked a pe>       ^
`k`  (7):                ^        < of pic>
`d`  (0):                  ^                 ^
Output  : 40

Input   : https://www.youtube.com/watch?v=dQw4w9WgXcQ
`h` (27): <ttps://www.youtube.com/watc>
`t`  (0):  <>            ^          ^
`/`  (0):       <>               ^
`w` (14):         <><.youtube.com/>         <4>
`.`  (7):            <youtube>
`o`  (0):              ^       ^
`u`  (1):               <t>
`c`  (0):                     ^      ^             ^
`Q`  (8):                                  <w4w9WgXc>
Output  : 57

@NickKennedy I fixed the rules to be more like actual quotes. I think this is what you expected. Can you review this?

looks good! Thanks for listening to my feedback.

Jelly, 12 bytes
œṡ¹¡ḢṖẈ;ß€ƲS

Try it online!

APL (Dyalog Unicode), 36 bytesSBCS
Full program. Prompts for input from stdin.
≢∊t⊣{t,←'(.)(.*?)\1'⎕S'\2'⊢⍵}⍣≡⍞⊣t←⍬

Try it online!
t←⍬ set up an accumulator t (for total)
⍞⊣ discard that in favour of string input from stdin (symbol: quote in console)
{…}⍣≡ apply the following anonymous lambda until stable (fix-point; previous ≡ next)
 ⊢⍵ on the argument
 …⎕S'\2' PCRE Search for the following, returning group 2 for each match:
  (.) any character (we'll call this group 1)
  (.*?) as few characters as possible (we'll call this group 2)
  \1 the group 1 character
 t,← update t by append that to t's current value
t⊣ discard that (the final list of no matches) in favour of t
≢ count the number of characters in that

Brain-Flak, 100 bytes
({{<({}<>)<>(({<>(({}({})<>[({}<>)]))(){[{}()](<>)}{}}{}){(<>)})<>{}>{<>({}<<>({}<>)>)<>}<>[{}]}{}})

Try it online!
Commented
# Loop over each character in input and sum iterations:
({{

  # Evaluate matching quote search as zero
  <

    # Move opening "quote" to right stack
    ({}<>)<>

    # Until match or end of search string found:
    # Note that the character to search for is stored as the sum of the top two entries in the right stack.
    (

      ({

        <>((

          # Character to search for
          {}({})

          # Subtract and move next character
          <>[({}<>)]

        # Push difference twice
        ))

        # Add 1 to evaluation of this loop
        ()

        # If no match, cancel out both 1 and pushed difference to evaluate iteration as zero (keep one copy of difference for next iteration)
        # (compare to the standard "not" snippet, ((){[()](<{}>)}{}) )
        # Then move to other stack
        {[{}()](<>)}{}

        # If a match was found, this will instead pop a single zero and leave a zero to terminate the loop, evaluating this iteration as 0+1=1.

      # Push 1 if match found, 0 otherwise
      }{})

      # If match found, move to left stack and push 0 denote end of "quoted" area.
      {(<>)}

    # Push the same 1 or 0 as before
    )

    # Remove representation of opening "quote" searched for
    # The closing quote is *not* removed if there is a match, but this is not a problem because it will never match anything.
    <>{}

  >

  # Move searched text back to left stack, evaluating each iteration as either the 1 or 0 from before.
  # This counts characters enclosed in "quotes" if a match is found, and evaluates as 0 otherwise.
  {<>({}<<>({}<>)>)<>}

  # Remove 0/1 from stack; if 1, cancel out the 1 added by the closing "quote"
  <>[{}]

# Repeat until two consecutive zeroes show up, denoting the end of the stack.
# (Because closing quotes are not removed, it can be shown that all other zeroes are isolated on the stack.)
}{}})

Ruby, 49 bytes
Recursive solution. Find quote groups, count their lengths, and then recursively look for sub-group lengths and sum everything together.
f=->s{s.scan(/(.)(.*?)\1/).sum{|a,b|b.size+f[b]}}

Try it online!

JavaScript (ES6), 64 bytes
f=([c,...a],i=a.indexOf(c))=>c?(~i&&i+f(a.splice(0,i+1)))+f(a):0

Try it online!
Commented
f = (                       // f is a recursive function taking either the input string
                            // or an array of characters, split into
  [c, ...a],                // c = next character and a[] = all remaining characters
  i = a.indexOf(c)          // i = index of the 1st occurrence of c in a[] (-1 if not found)
) =>                        //
  c ?                       // if c is defined:
    ( ~i &&                 //   if i is not equal to -1:
      i +                   //     add i to the final result
      f(a.splice(0, i + 1)) //     remove the left part of a[] up to i (included) and
    )                       //     do a recursive call on it
    + f(a)                  //   add the result of a recursive call on a[]
  :                         // else:
    0                       //   stop recursion

Jelly, 17 bytes
œṡḢẈṖ$Ḣ+ɼṛƲ)Ẏ$F¿®

Try it online!
A full program that takes a single argument, the input string wrapped in a list, and returns the number of quotes characters as an integer.

JavaScript (Node.js), 65 64 62 bytes
f=s=>(s=/(.)(.*?)\1(.*)/.exec(s))?f(s[3])+f(s=s[2])+s.length:0

Try it online!
Original approach (64 bytes):
f=(s,r=/(.)(.*?)\1/g,t=r.exec(s))=>t?f(t=t[2])+t.length+f(s,r):0

Try it online!
f=s=>                              // Main function:
 (s=/(.)(.*?)\1(.*)/.exec(s))?     //  If a "quoted" segment can be found:
  f(s[3])                          //   Return the recursive result outside this segment,
  +f(s=s[2])                       //   plus the recursive result of this segment,
  +s.length                        //   plus the length of this segment
 :0                                //  If not: no quoted segment, return 0.


text:
Cut the gold chain
A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links.
The rule in this hotel is that residents should pay their rent every morning. The traveler comes to an agreement with the manager to pay one link of the golden chain for each day. But the manager also demands that the traveler should make the least possible damage to the chain while paying every day. In other words, he has to come up with a solution to cut as few links as possible.
Cutting a link creates three subchains: one containing only the cut link, and one on each side. For example, cutting the third link of a chain of length 8 creates subchains of length [2, 1, 5]. The manager is happy to make change, so the traveller can pay the first day with the chain of length 1, then the second day with the chain of length 2, getting the first chain back.
Your code should input the length n, and output a list of links to cut of minimum length.
Rules:

n is an integer > 0.
You can use either 0-based or 1-based indexing for the links.
For some numbers, the solution is not unique. For example, if n = 15 both [3, 8] and [4, 8] are valid outputs.
You can either return the list, or print it with any reasonable separator.
This is code-golf, so the shortest code in bytes wins.

Test cases:
Input          Output (1-indexed)
1              []
3              [1]
7              [3]
15             [3, 8]
149            [6, 17, 38, 79]

Detailed example
For n = 15, cutting the links 3 and 8 results in subchains of length [2, 1, 4, 1, 7]. This is a valid solution because:
 1 = 1
 2 = 2
 3 = 1+2
 4 = 4
 5 = 1+4
 6 = 2+4
 7 = 7
 8 = 1+7
 9 = 2+7
10 = 1+2+7
11 = 4+7
12 = 1+4+7
13 = 2+4+7
14 = 1+2+4+7
15 = 1+1+2+4+7

No solution with only one cut exists, so this is an optimal solution.
Addendum
Note that this problem is related to integer partitioning. We're looking for a partition P of n such that all integers from 1 to n have at least one patition that is a subset of P.
Here's a YouTube video about one possible algorithm for this problem.

I don't understand your "making change" reference. In your posted example, on the second day you pay with the 2-link chain (and get the 1-link-chain (which you paid with the day before) back as change, as per your explanation). But on the third day, you pay with 1+2. Where did the second 2-link-chain come from?

@Flater The manager already has it. We just pay the additional one. In fact, the RHS are the links that manager owns each day

05AB1E, 23 11 8 bytes
ΔÍN-;иg=

Try it online!
Uses 0-based indexing.
Explanation:
             # start from the implicit input
Δ            # loop forever
 Í           # subtract 2
  N-         # subtract the current iteration number
    ;        # divide by 2
     и       # create a list of length x
      g      # get the length of the list
       =     # print

иg looks like a noop, but it actually does two useful things: it truncates to an integer (; returns a float), and it crashes the interpreter if x is negative (this is the only exit condition).

The 23 byte solution used a very different approach, so here it is for posterity: ÅœʒR2äθP}ʒæOê¥P}θ2äθη€O (TIO, explanation).

I've deleted my answer. Mine being 42 and yours being 11 is too big of a difference for me to not feel embarrassed, haha. ;) Nice answer though, and lol at the Ø.Ø. Did you just try some random things in order to both floor and map all negatives to -1? Regardless, very nice answer and much shorter than I anticipated. I was thinking around 20 bytes after i posted my bad 42-byter.

@KevinCruijssen Nnope, Ø.Ø was actually my first idea. Your comment inspired me to try random things: I found ®Ÿà, ï®M, and more importantly, иg, which yields this nice 8-byter. I always found it annoying that osabie prefers doing nothing over crashing in many cases (div by 0, wrong type, etc), so this crash will come in handy.

Hehe, 05AB1E is supposed to never crash, but you're right that it sometimes is a bit annoying it never does.. In the legacy I wouldn't even know how to crash, and in the past we even had an explicit division by zero error we could call manually. xD In the new version it still crashes with an error pretty often when giving incorrect arguments to certain builtins. And nice -3 again.

"crashes the interpreter if x is negative (this is the only exit condition)." - I love that

Python 2, 75 bytes
f=lambda n,i=0:n>=i<<i and f(n,i+1)or[min(n,2**j*i-i+j)for j in range(1,i)]

Try it online!

Explanation:
Builds a sequence of 'binary' chunks, with a base number matching the number of cuts.
Eg:
63 can be done in 3 cuts, which means a partition in base-4 (as we have 3 single rings):
Cuts: 5, 14, 31, which gives chains of 4 1 8 1 16 1 32 (sorted: 1 1 1 4 8 16 32).
All numbers can be made:
1       1
2       1 1
3       1 1 1
4       4
...
42      1 1 8 32
...
62      1 1 4 8 16 32
63      1 1 1 4 8 16 32

Other examples:
18: 4,11        ->  3 1 6 1 7
27: 5,14,27     ->  4 1 8 1 13 1
36: 5,14,31     ->  4 1 8 1 16 1 5
86: 6,17,38,79  ->  5 1 10 1 20 1 40 1 7

Shouldn't you add f= to the start? Since you use a call to f in the lambda function, and I can only assume that you refer to the same lambda you're defining.

@randomdude999, Yeah, I forgot...

@randomdude999 does that rule apply to all languages, or just python? Cause I see a javascript answer that is a pure lambda in this challenge...

@Shadow It applies to all languages, but only for recursive lambdas.

@Shadow A more generic rule is that you can't reference something that is neither defined in your code nor globally defined in your language, unless it is explicitly allowed by the challenge. The most common case is a recursive function, but this applies to other situations. This answer is another example: f is not recursive, but it's however referenced in the code and therefore has to be named.

R, 77 69 bytes
-8 bytes thanks to Aaron Hayman
pmin(n<-scan(),0:(k=sum((a=2:n)*2^a<=n))+cumsum((k+2)*2^(0:k))+1)[-n]

Try it online!
Let \$k\$ be the number of cuts needed; \$k\$ is the smallest integer such that \$(k+1)\cdot2^k\geq n\$. Indeed, a possible solution is then to have subchains of lengths \$1,1,\ldots,1\$ (\$k\$ times) and \$(k+1), 2(k+1), 4(k+1), 8(k+1), \ldots, (k+1)\cdot 2^{k-1}\$. It is easy to check that this is sufficient and optimal.
(The last subchain might need to be made shorter if we exceed the total length of the chain.)
Ungolfed (based on previous, similar version):
n = scan()                            # read input
if(n - 1){                            # If n==1, return NULL
  k = match(F, (a = 2:n) * 2 ^ a > n) # compute k
  b = (k + 1) * 2 ^ (1:k - 1)         # lengths of subchains
  c = 1:k + cumsum(b)                 # positions of cuts
  pmin(c, n )                         # if last value is >n, coerce it to n
}

(Proof that the value of \$k\$ is as I state: suppose we have \$k\$ cuts. We then have \$k\$ unit subchains, so we need the first subchain to be of length \$k+1\$. We can now handle all lengths up to \$2k+1\$, so we need the next one to be of length \$2k+2\$, then \$4k+4\$... Thus the maximum we can get out of \$k\$ cuts is obtained by summing all those lengths, which gives \$(k+1)\cdot 2^k-1\$.)
If \$a(k)\$ is the smallest integer \$n\$ requiring \$k\$ cuts, then \$a(k)\$ is OEIS A134401.

I doubt it would help with the special case for n=1, but an alternative way to generate the cutoffs is the recurrence 1, 4, 4a(n-1)-4a(n-2).

@PeterTaylor I had a similar recurrence for computing k; this corresponds to OEIS A134401: https://oeis.org/A134401
But my implementation of the recurrence relation takes up more bytes than the current code.

A bit of rearrangement I got it down to 73. Try it online!

@AaronHayman Thanks! Smart move using sum instead of match.

69 bytes and got rid of that if statement that was upsetting you: Try it online!

@AaronHayman Wonderful, thanks!

Jelly, 12 bytes
’_‘ɼ:2»-µƬṖḊ

Try it online!
Translation of Grimy's 05AB1E answer so be sure to upvote that one too! Slightly disappointed this comes in a byte longer, but does at least have something a bit like an emoticon as the first three bytes!

JavaScript (ES6), 66 bytes
This is a port of TFeld's answer.
n=>(g=a=>n<++i<<i?a.map(j=>(j+=(i<<j)-i)>n?n:j):g([...a,i]))(i=[])

Try it online!

C++, 109,107 bytes
-2 bytes thanks to Kevin
#include<iostream>
main(){int n,k=0;for(std::cin>>n;++k<<k<n;);for(n-=k;n>0;k*=2,n-=k+1)std::cout<<n<<',';}

The algorithm is similar to the Robin Ryder's answer. The code is written in a compilable, whole form. Try it!
Details:
std::cin>>n;               // get the value of n as input
while(++k<<k<n);           // determine k
for(n-=k;n>0;k*=2,n-=k+1)  // we don't need n, so the lengths...
    std::cout<<n<<' ';     // of links are subtracted repeatedly

This has a C variation with the same byte length (doesn't seem to need a separate answer):
#include<stdio.h>
main(){int n,k=0;for(scanf("%d",&n);++k<<k<n;);for(n-=k;n>0;k*=2,n-=k+1)printf("%d,",n);}

Two minor things to golf: =0 after k can be removed, since its 0 by default. std::cin>>n;while(++k<<k<n); can be for(std::cin>>n;++k<<k<n;);. I also have the feeling for(n-=k;n>0;k*=2,n-=k+1) can be simplified somehow by combining stuff, but not sure how. PS: Changing the comma-delimiter to a space looks slightly better since you don't see the trailing one imo, but this is purely cosmetic :)

@KevinCruijssen Thanks, but some compilers don't assign a default value to non-static variables. So I thought =0 was necessary for portability ;)  I also realized that the space after #include is not necessary.

Ah ok. I don't know C++ too well, so I've used that online compiler you linked in your answer to test some things. :) You forgot the second change I proposed in my comment: the while-loop to a for-loop and putting the std::cin>>n inside it.

103 bytes

Retina 0.8.2, 61 bytes
.+
11,$&$*
+`\b(1+),(\1(1*)1?\3)$
1$2¶1$1,$3
1+,
1
1A`
1+
$.&

Try it online! 1-indexed port of @Grimy's answer. Explanation:
.+
11,$&$*

Start with N=2 and the input converted to unary.
+`\b(1+),(\1(1*)1?\3)$

Repeatedly try to subtract N from the input and then divide by 2.
1$2¶1$1,$3

If successful, remember 1 more than the input on the previous line, increment N on the current line, and update the input to the new value.
1+,
1

Remove N and increment the last value so that it's also 1-indexed.
1A`

Remove the incremented original input.
1+
$.&

Convert the results to decimal.

Ruby, 62 bytes
->n{(1...c=(0..n).find{|r|n<r<<r}).map{|b|[n,b-c+(c<<b)].min}}

Try it online!
Mostly stolen from TFeld's Python answer.


text:
Subtract the Folded Matrix
Challenge:
Given an NxN matrix where \$N\geq2\$ and one of eight distinct 'folding options', output a 2D array/list with the subtracted values.
The eight folding options are: left-to-right; right-to-left; top-to-bottom; bottom-to-top; topleft-to-bottomright; topright-to-bottomleft; bottomleft-to-topright; bottomright-to-topleft.
Step by step examples:
Input matrix:
[[ 1, 3, 5, 7],
 [ 0, 8, 6, 4],
 [ 1, 1, 1, 1],  (a'th row in the explanation below)
 [ 1,25, 0,75]]

With folding option top-to-bottom we output the following as result:
[[ 1,-7,-5,-3],
 [ 0,22,-5,68]]

Why? We fold from the top to the bottom. Since the matrix dimensions are even, we don't have a middle layer to preserve as is. The \$a\$'th row [1, 1, 1, 1] will be subtracted by the \$(a-1)\$'th row (would have been \$(a-2)\$'th row for odd dimension matrices); so [1-0, 1-8, 1-6, 1-4] becomes [1, -7, -5, -3]. The \$(a+1)\$'th row [1, 25, 0, 75] will then be subtracted by the \$(a-2)\$'th row (would have been \$(a-3)\$'th row for odd dimension matrices); so [1-1, 25-3, 0-5, 75-7] becomes [0, 22, -5, 68].
With folding option bottomright-to-topleft instead (with the same input-matrix above) we output the following as result:
[[-74,  2,  1,  7],
 [  0,  7,  6],
 [-24,  1],
 [  1]]

With the following folding subtractions:
[[1-75,  3-1,  5-4,    7],
 [ 0-0,  8-1,    6],
 [1-25,    1],
 [   1]]

Challenge rules:

You can use any eight distinct letters [A-Za-z] or distinct numbers in the range \$[-99,99]\$ for the folding options. Numbers \$[1..8]\$ or \$[0..7]\$ are probably the most common options, but if you want to use different numbers within the range for some smart calculations, feel free to do so. Please state which folding options you've used in your answer.
The input-matrix will always be a square NxN matrix, so you don't have to handle any rectangular NxM matrices. \$N\$ will also always be at least 2, since an empty or 1x1 matrix cannot be folded.
The input of the matrix will always contain non-negative numbers in the range \$[0, 999]\$ (the numbers in the output will therefore be in the range \$[-999, 999]\$).
With the (anti-)diagonal folding or odd-dimension vertical/horizontal folding, the middle 'layer' will remain unchanged.
I/O is flexible. Can be a 2D array/list of integers; can be returned or printed as a space-and-newline delimited string; you can modify the input-matrix and replace the numbers that should be gone with null or a number outside of the [-999, 999] range to indicate they're gone; etc. etc.

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Test cases:
Input-matrix 1:
Input-matrix (for the following eight test cases):
[[ 1, 3, 5, 7],
 [ 0, 8, 6, 4],
 [ 1, 1, 1, 1],
 [ 1,25, 0,75]]

Input-folding option: left-to-right
Output: [[2,6],[-2,4],[0,0],[-25,74]]

Input-folding option: right-to-left
Output: [[-6,-2],[-4,2],[0,0],[-74,25]]

Input-folding option: top-to-bottom
Output: [[1,-7,-5,-3],[0,22,-5,68]]

Input-folding option: bottom-to-top
Output: [[0,-22,5,-68],[-1,7,5,3]]

Input-folding option: topleft-to-bottomright
Output: [[7],[6,-1],[1,-7,-2],[1,24,0,74]]

Input-folding option: topright-to-bottomleft
Output: [[1],[-3,8],[-4,-5,1],[-6,21,-1,75]]

Input-folding option: bottomleft-to-topright
Output: [[1,3,4,6],[8,5,-21],[1,1],[75]]

Input-folding option: bottomright-to-topleft
Output: [[-74,2,1,7],[0,7,6],[-24,1],[1]]

Input-matrix 2:
Input-matrix (for the following eight test cases):
[[17, 4, 3],
 [ 8, 1,11],
 [11, 9, 7]]

Input-folding option: left-to-right
Output: [[4,-14],[1,3],[9,-4]]

Input-folding option: right-to-left
Output: [[14,4],[-3,1],[4,9]]

Input-folding option: top-to-bottom
Output: [[8,1,11],[-6,5,4]]

Input-folding option: bottom-to-top
Output: [[6,-5,-4],[8,1,11]]

Input-folding option: topleft-to-bottomright
Output: [[3],[1,7],[11,1,-10]]

Input-folding option: topright-to-bottomleft
Output: [[17],[4,1],[8,-2,7]]

Input-folding option: bottomleft-to-topright
Output: [[17,-4,-8],[1,2],[7]]

Input-folding option: bottomright-to-topleft
Output: [[10,-7,3],[-1,1],[11]]

Does the order of the folding options matter?

Also, can we just output the 8xNxN matrix of all possible folds?

Shouldn't this test sample
Input-folding option: bottom-to-top
Output: [[-1,7,5,3],[0,-22,5,-68]]
be flipped?

also for matrix 2, 17-11 is 6, not 4?

@ExpiredData As specified in the rules, you can use any letter A-Za-z or any integer in the range [-999,999], so order doesn't matter. And sorry, but you must output the correct fold based on the input, so outputting all eight isn't allowed.

@OrangeCherries You're indeed right. Both are fixed, thanks for noticing!

@Arnauld Ah, similar as the one mentioned by OrangeCherries, but then top-to-bottom instead of bottom-to-top. Thanks, fixed.

Octave, 256 248 244 248 bytes
m=d=x=@(a,b=1)rot90(a,b)
y=@(a,b=2)flip(a,b)
z=@(a,b=1)tril(a+1e3,-1)+a-x(y(tril(a)))+b*diag(diag(a))
f=@(a,b){m=((a-y(a))(:,1:(d=size(a,2)/2))),-y(m),m=y(x((a=x(a))-y(a)))(d+1:end,:),y(m,1),-y(z(a,-1)),x(z(x(a,2)),2),z(a=x(a,3)),x(z(x(a,2)),2)}{b}

Try it online!
-2 bytes (and a bity of tidying up) thanks to Luis Mendo
+2 bytes due to the correction for T-B
1-Indexed operations for values of b from 1-8:
R-L
L-R
B-T
T-B
BR-TL
TR-BL
BL-TR
TL-BR

This gave me a headache, I'll golf it properly later

Suggest rows(a) instead of size(a,2)

Jelly,  39  34 bytes
There is possibly further golfing possible by combining some of the two "functions".
...yep: -5 thanks to NickKennedy!
ṃ“Z“Ṛ“U“ “ŒDṙL ZZṚ”ŒḄFḲj“ŒH_Ṛ}¥/”v

Try it online!
A dyadic link accepting an integer (the instruction) and a list of lists of numbers (the matrix).
Uses the option to take the instruction as an integer in \$[-99,99]\$ to our advantage, and hence has the following seemingly bizarre mapping:
           Instruction  |  integer
------------------------+---------
         left-to-right  |     4
         right-to-left  |    14
         top-to-bottom  |     9
         bottom-to-top  |    39
topleft-to-bottomright  |    65
topright-to-bottomleft  |    15
bottomleft-to-topright  |    10
bottomright-to-topleft  |     0

How?
The link creates Jelly code which is then evaluated using M as an input...
ṃ“Z“Ṛ“U“ “ŒDṙL ZZṚ”ŒḄFḲj“ŒH_Ṛ}¥/”v - Link: integer, I; matrix, M
 “Z“Ṛ“U“ “ŒDṙL ZZṚ”                - list of lists of characters = ["Z", "Ṛ", "U", " ", "ŒDṙL ZZṚ"]
ṃ                                  - base decompress (I) using those lists as the digits
                                   -  ...i.e. convert to base 5 and then convert the digits:
                                   -          [1,2,3,4,0] -> ["Z", "Ṛ", "U", " ", "ŒDṙL ZZṚ"]
                   ŒḄ              - bounce
                                   -  ...e.g. [a, b, c] -> [a, b, c, b, a]
                     F             - flatten to a list of characters
                      Ḳ            - split at spaces
                       j           - join with:
                        “ŒH_Ṛ}¥/”  -   list of characters = "ŒH_Ṛ}¥/"
                                 v - evaluate as Jelly code with an input of M

Each of the eight options are then:
left-to-right           (4): ŒH_Ṛ}¥/
right-to-left          (14): ṚŒH_Ṛ}¥/Ṛ
top-to-bottom           (9): ZŒH_Ṛ}¥/Z
bottom-to-top          (39): ZṚŒH_Ṛ}¥/ṚZ
topleft-to-bottomright (65): ṚUŒDṙLŒH_Ṛ}¥/ZZṚUṚ
topright-to-bottomleft (15): UŒDṙLŒH_Ṛ}¥/ZZṚU
bottomleft-to-topright (10): ṚŒDṙLŒH_Ṛ}¥/ZZṚṚ
bottomright-to-topleft  (0): ŒDṙLŒH_Ṛ}¥/ZZṚ

These each (except 0 and 4) apply a transform to M using some of Z (transpose), Ṛ (reverse), and U (reverse each); then one of two functions (see below), then the inverse of the setup transformation (if there was one) implemented with the reverse of the code.
The two inner functions are:
ŒH_Ṛ}¥/ - Function A: Fold bottom-to-top: matrix, M
ŒH       - split M into two equal lists of rows (first half bigger by 1 if need be)
      / - reduce by:
     ¥  - last two links as a dyad:
    }   -  using the right argument (i.e. second half):
   Ṛ    -    reverse
  _     -  subtract

ŒDṙLŒH_Ṛ}¥/ZZṚ - Function B: Fold topright-to-bottomleft: matrix, M
ŒD             - diagonals of M
  ṙ            - rotate left by:
   L           -   length of M (puts them in order from bottom left most)
    ŒH_Ṛ}¥/    - same action as calling Function A on the diagonals
           Z   - transpose
            Z  - transpose
             Ṛ - reverse

Ah nice, I was wondering if anyone would make use of the somewhat flexible input-options! Cool to see how you've used the values for a convenient base-conversion to Jelly code to evaluate to the desired folding. :)

Using some of the code from my answer, and reusing code common to both, here’s a 34-byter: https://tio.run/##y0rNyan8///hzuZHDXOigPjhzllAMhSIFYD46CSXhztn@ihERYHF5x6d9HBHi9vDHZuywJIe8UDh2kNL9YFSZf8PL3/UtOb/fxMdBUMgttRRMAZiAyAPhE11FCxM/0dHKxgCxXUUgFzzWB0uhWiQAgsdBTMdBRMIHygPRTC@kSnIGHPT2FgA

If we were allowed 16 bit integers it could be even shorter

Non-competing 23 byte answer using 16-bit integers as the parameter for selecting which fold: https://tio.run/##y0rNyan8///hzuZHDXOigPjhzllAMhSIj05yebhzpg@Y5REPFK89tFT/UcNct7L/h5c/alrz/7@BjoKpkY6CkZmOgoUFkDAyNQZyDc1NgWxTS1NjCyBlamZq8T86WsFQR8EYyNVRMI/V4VKIVgDqBUoDFZpA@EB5KILxjYCKDXTMTWNjAQ

@NickKennedy - thanks. I like the split and join! I'll have to come back later to change the description fully.

Jelly, 71 34 bytes
ḃ2ŒḄ,UZṚŒDṙLƊŒH_Ṛ}¥/$ZZṚƊṚZ8ƭ$ị@¥ƒ

Try it online!
Test Suite
A full program. Right argument is the matrix. Left argument is the type of fold:
44 = L-R
40 = R-L
36 = T-B
32 = B-T
50 = TL-BR
34 = TR-BR
54 = BL-TR
38 = BR-TL

Rewritten to use 5-bit bijective binary as input. Note the program given above won’t work repeatedly for multiple folds.

JavaScript (ES6),  149 ... 133  128 bytes
Takes input as (matrix)(d) with \$0\le d\le7\$. Removed values are replaced with NaN.
Folding directions: \$0 =\;\rightarrow\$, \$1 =\;\downarrow\$, \$2 =\;\small\searrow\$, \$3 =\;\small\swarrow\$, \$4 =\;\leftarrow\$, \$5 =\;\uparrow\$, \$6 =\;\small\nwarrow\$, \$7 =\;\small\nearrow\$
m=>d=>m.map((r,y)=>r.map((v,x)=>v-=(w=m.length+~y)-(p=[x+x-y,y,x,q=w+y-x][d&3])&&[r[q],m[w][x],m[q][w],m[x][y]][d>3^p>w?d&3:m]))

Try it online!
Commented
m => d =>                   // m[] = matrix; d = direction
  m.map((r, y) =>           // for each row r[] at position y in m[]:
    r.map((v, x) =>         //   for each value v at position x in r[]:
      v -=                  //     subtract from v:
        (                   //       define w as:
          w = m.length + ~y //         the width of input matrix - y - 1
        ) - (               //       and compare it with
          p = [             //       p defined as:
            x + x - y,      //         2 * x - y for vertical folding
            y,              //         y for horizontal folding
            x,              //         x for diagonal folding
            q = w + y - x   //         q = w + y - x for anti-diagonal folding
          ][d & 3]          //       using d MOD 4
        ) &&                //       if p is equal to w, leave v unchanged
        [                   //       otherwise, subtract:
          r[q],             //         r[q] for vertical folding
          m[w][x],          //         m[w][x] for horizontal folding
          m[q][w],          //         m[q][w] for diagonal folding
          m[x][y]           //         m[x][y] for anti-diagonal folding
        ][                  //       provided that we're located in the target area:
          d > 3 ^           //         test p < w if d > 3
          p > w ? d & 3     //         or p > w if d <= 3
                : m         //         and yield either d MOD 4 or m[]
        ]                   //       (when using m[], we subtract 'undefined' from v,
                            //       which sets it to NaN instead)
    )                       //   end of inner map()
  )                         // end of outer map()

Octave, 482 bytes, 459 Bytes
The inputs for deciding folding directions are:
1)left to right
2)bottom to top
3)right to left
4)top to bottom
5)tr to bl
6)br to tl
7)bl to tr
8)tl to br
Each call only generates the specified fold, rather than all of them (which would probably would take less bytes).  Biggest problem is that for this case I can't figure out how to put folds 1-4 and 5-8 in the same loop.  But at least octave has nice looking matrices.
    function[m]=f(n,o)
    k=length(n);m=NaN(k);if(o<5)
    if(mod(o,2)>0)n=n'end
    q=[0,0,k+1,k+1](o)
    for x=1:ceil(k/2)if(x*2>k)m(x,:)=n(x,:)else
    for a=1:k
    m(abs(q-x),a)=n(abs(q-x),a)-n(abs(q-(k+1-x)),a)end
    end
    end
    if(mod(o,2)>0)m=flipud(m')end
    else
    if(mod(o,2)>0)n=flip(n)end
    q=[0,0,k+1,k+1](o-4)
    for x=1:k
    for a=1:k+1-x
    if(a==k+1-x)m(x,a)=n(x,a)else
    m(abs(q-x),abs(q-a))=n(abs(q-x),abs(q-a))-n(abs(q-(k+1-a)),abs(q-(k+1-x)))end
    end
    end
    end
    if(mod(o,2)>0)m=flip(m)end
    end

Try it online!
Output suppression costs bytes, so ignore everything that isn't the return statement(ans = ).

How many bytes did you lose to writing "end"?

do you not have to write end?

You do unless you restructure it so it's not a bunch of if/else and for statements

wow tbh looking at your code there's tons of stuff I didn't even know you could do in matlab.

I don't know much about octave tbh it can probably save 50-100 bytes pretty easily

Charcoal, 78 77 bytes
Ｆ⁴«ＵＭηＥ⮌η§μλ¿⁼ιθＵＭηＥκ⎇‹⊕⊗νＬη⁻μ§⮌κν⎇›⊕⊗νＬηωμ¿⁼ι﹪θ⁴ＵＭηＥκ⎇‹λν⁻μ§§ηνλ⎇›λνωμ»Ｅη⪫ι,

Try it online! Link is to verbose version of code. Uses the following folding options:
0   top-to-bottom
1   left-to-right
2   bottom-to-top
3   right-to-left
4   bottomright-to-topleft
5   topright-to-bottomleft
6   topleft-to-bottomright
7   bottomleft-to-topright

Folded values are replaced by empty strings. Explanation:
Ｆ⁴«≔ＵＭηＥ⮌η§μλ

Rotate the array four times.
¿⁼ιθＵＭηＥκ⎇‹⊕⊗νＬη⁻μ§⮌κν⎇›⊕⊗νＬηωμ

Fold the array horizontally when appropriate.
¿⁼ι﹪θ⁴ＵＭηＥκ⎇‹λν⁻μ§§ηνλ⎇›λνωμ

Fold the array diagonally when appropriate.
»Ｅη⪫ι,

Output the array once it is rotated back to its original orientation.


text:
Impossible darts scores
I was surprised to not find this asked already, though there is a great question on darts checkouts: Darts meets Codegolf
Your challenge is to calculate which scores are not possible with 'n' darts below the maximum score for 'n' darts. E.g. for n=3, the maximum possible score is 180 so you would return [163,166,169,172,173,175,176,178,179]
For a bare bones rule summary:
Possible scores for a single dart are:

0 (miss)
1-20, 25, 50
double or triple of 1-20

Rules:

standard code golf rules apply
you must take a single parameter 'n' in whatever way your language allows and return a list/array of all unique scores below the maximum score which cannot be scored with n darts. You may also print these values to the console.
order of results is unimportant
shortest code in bytes wins

Apologies for formatting, writing on a phone!

somewhat related; I think there was another one about finding missing values from a range but I can't seem to find it.

Sincere apologies, I pulled those outputs from an answer to the basic question of 3 darts but did not verify! I will update the question!

no worries :-) Looks fine to me!

Python 3, 80 79 59 57 bytes
-1 byte thanks to Arnauld
-20 bytes thanks to ArBo
-2 bytes thanks to negative seven

lambda x:[-i-~x*60for i in(x<2)*b'a[YUSOLI'+b'MJGDCA@>=']

Try it online!

I, errr, what?!

@beirtipol there is a pattern on the numbers after the 2nd dart (well, its on the 1st dart too, but there are another numbers), this calculate the numbers based on this pattern.

Ah, well played, well played indeed

You can compress the second list for -6 bytes.

@EriktheOutgolfer If you're compressing, you might as well compress everything ;) 59 bytes

57 bytes

@negativeseven beat me to the 60 thing, was going to try that :) Good find on keeping the bytestrings separated though, hadn't thought of that.

Perl 6, 42 bytes
{^60*$_∖[X+] [[|(^21 X*^4),25,50]xx$_,]}

Try it online!
Brute force solution that works out all possible dart values.

JavaScript (ES6),  55  54 bytes
Saved 1 byte thanks to @Shaggy
Based on the pattern used by Rod.
n=>[...1121213+[n-1?33:2121242426]].map(x=>n-=x,n*=60)

Try it online!

s=60*n -> n*=60 to save a byte.

@Shaggy Thanks. :) I missed that one because of my initial (unpublished) version where $n$ was re-used later.

Perl 6, 39 bytes (37 chars)
This is definitely using a massive sledgehammer but it works. (It doesn't just brute force it, it brutally brute forces it)
{^60*$_∖[X+] (|(^21 X*^4),25,50)xx$_}

Try it online!
Here's an explanation of it:
{                                   } anonymous block for the
       ∖                                set difference of
 ^60*$_                                   - 0 .. max score (60 * throwcount)
        [X+]                    xx$_      - the cross addition (throwcount times) of
             (                 )              all possible score values, being
              |(    X*  )                       flattened cross multiplication of
                ^21   ^4                          0..20 and 0..3 (for double and triple)
                         ,25,50                 and 25 and 50

The X* ^4 cross multiplier generates a lot of duplicate values (there will be 20+ zeros involved and that's before doing the cross addition), but that doesn't cause any problems since we use the set difference ∖ which works with the unique values.
This currently fails for $n == 1 (which should return an empty set), but there is an issue filed and will likely work in future versions.   JoKing's version is a teeny bit longer, but works for $n == 1 in current Rakudo.

Wow, awkward... My extra bytes are from fixing the n=1 issue (though you can use $_ instead of $^n for -1)

@JoKing ha, I don't think there's anything wrong with two people getting virtually the same answer (especially since yours works in current versions versus mine that's currently theoretical)  Also, thanks on the $_ , total brainfart on my part

Jelly, 19 bytes
20Ż;25×Ɱ3ẎṖœċ⁸§ṪṖḟƊ

Try it online!

MATL, 25 23 bytes
Thanks to @Giuseppe, who fixed a mistake and golfed 2 bytes!
25tE3:!21:q*vZ^!stP:wX-

Try it online!
Explanation
Brute force approach.
25      % Push 25
tE      % Duplicate, double: gives 50
3:!     % Push column vector [1;2;3]
21:q    % Push row vector [0 1 ... 20]
*       % Multiply with broadcast. Gives a matrix with all products
v       % Concatenate everything into a column vector
Z^      % Implicit input: n. Cartesian power with exponent n
!s      % Sum of each row
tP      % Duplicate, flip: The first entry is now 60*n
:       % Push row vector [1 2 ... 60*n]
w       % Swap
X-      % Set difference. Implicit display

Your version doesn't work for n=2, so I fixed it and golfed off a byte to boot! Try it online!

Oh, found another byte by rearranging things :-) 23 bytes

@Giuseppe Hey, thank you so much!

J, 48 45 bytes
2&>(35 44,q:626b66jh)&,60&*-1 4 8 14,q:@13090

Try it online!
-3 bytes thanks to FrownyFrog
Attempted a brute force solution, but was not able to beat this translation of Rod's idea.

tyvm as always, @FrownyFrog

even shorter 626b66jh

what base is being used and how does J know to use it?

see https://codegolf.stackexchange.com/questions/113103/big-base-small-digits/113107

ah, ty.  i'd forgotten the b was the "delimiter" there and was reading it as part of the number....

i.@*&60-.-+/\;@{@#&(<3(*/&:>:,&,25*/[)&i.20) just a byte shorter

Excellent.  I will digest this one a bit later.

R, 64 bytes
function(n,`!`=utf8ToInt)c(60*n-!"",(!"#%),/")[n<2])

Try it online!
Ports the amazing answer found by Rod.
R, 85 73 68 bytes
function(n)setdiff(0:(60*n),combn(rep(c(0:20%o%1:3,25,50),n),n,sum))

Try it online!
Brute force generates all possible scores with n darts, then takes the appropriate set difference.
Credit to OrangeCherries' Octave solution for reminding me of combn.
5 more bytes thanks to Robin Ryder's suggestion of using %o%.

Very sorry about that, I should have double checked the example!

Nice use of the FUN argument of combn! You can get 68 bytes with %o% instead of x*3,x*2.

@RobinRyder duh. I even tried figuring out how to do broadcasting multiplication on the Octave answer!

Octave, 91 bytes 73 bytes 71 Bytes
Another brute force method.
@(n)setdiff(0:60*n,sum(combnk(repmat([x=0:20,x*2,x*3,25,50],1,n),n),2))

Down to 73 Bytes thanks to Giuseppe
Down to 71 Bytes by replacing nchoosek with combnk
Try it online!

Pyth, 22 bytes
-S*60Q+M^+yB25*M*U4U21

Try it online!
Times out in TIO for inputs greater than 3.
-S*60Q+M^+yB25*M*U4U21Q   Implicit: Q=eval(input())
                          Trailing Q inferred
                 U4       Range [0-3]
                   U21    Range [0-20]
                *         Cartesian product of the two previous results
              *M          Product of each
          yB25            [25, 50]
         +                Concatenate
        ^             Q   Cartesian product of the above with itself Q times
      +M                  Sum each
                            The result is all the possible results from Q darts, with repeats
  *60Q                    60 * Q
 S                        Range from 1 to the above, inclusive
-                         Setwise difference between the above and the possible results list
                          Implicit print

Not shorter, but if you change U4 to S3 the performance is improved a bit because both cartesian products don't have to deal with all those additional useless 0s. Input 3 outputs in ~13 seconds instead of ~30 in that case (although input 4 still times out, and this is code golf, so doesn't matter that much ;p).

@KevinCruijssen Very good point, I hadn't considered that I was including a 0 on both sides of the cartesian product. If I find any more golfs or reasons to edit I'll be sure to include that, thanks!

Too bad there isn't a 0-based inclusive range builtin in Pyth.. I tried this -S*60QsM^*MP*S3aU21 25, but that space between 21 and 25 is a bit annoying.. With a 0-based inclusive range yT could be used instead of 21, kinda like this: -S*60QsM^*MP*S3a}ZyT25 (but then without the Z of course, with the } replaced with the 0-based inclusive range). Maybe you see something to golf in this alternative approach of adding the 25 to the list, and removing the 75 after the first cartesian product?

Python 2, 125 bytes
lambda n:set(range(60*n))-set(map(sum,product(sum([range(0,21*j,j)for j in 1,2,3],[25,50]),repeat=n)))
from itertools import*

Try it online!

Python 3, 126 125 122 bytes
lambda n:{*range(60*n)}-{*map(sum,product(sum([[i,i*2,i*3]for i in range(21)],[25,50]),repeat=n))}
from itertools import*

Try it online!
-3 bytes, thanks to Rod

Stax, 24 bytes
¿ß☺o↕αg╠╩╬ò▼í¬«¥↕▄í■♣▓î►

Run and debug it
It's pretty slow for n=3, and gets worse from there.

05AB1E, 21 20 18 bytes
20Ý25ª3Lδ*˜¨ãOZÝsK

-3 bytes thanks to @Grimy.
Times out pretty quickly the higher the input goes due to the cartesian product builtin ã.
Try it online or verify a few more test cases.
Explanation:
20Ý                 # Push a list in the range [0, 20]
   25ª              # Append 25 to this list
      3L            # Push a list [1,2,3]
        δ*          # Multiply the top two lists double-vectorized:
                    #  [[0,0,0],[1,2,3],[2,4,6],[3,6,9],...,[20,40,60],[25,50,75]]
          ˜         # Flatten this list: [0,0,0,1,2,...,40,60,25,50,75]
           ¨        # Remove the last value (the 75)
            ã       # Create all possible combinations of the (implicit) input size,
                    # by using the cartesian power
             O      # Sum each inner list of input amount of values together
              Z     # Get the maximum (without popping the list), which is 60*input
               Ý    # Create a list in the range [0, 60*input]
                s   # Swap so the initially created list is at the top of the stack again
                 K  # And remove them all from the [0, 60*input] ranged list
                    # (then output the result implicitly)

On that note, maximum is 60 * input, not 180.

@Grimy Yeah, ignore my stupidity.. I saw the incorrect result in the test suite, but of course I just made a mistake myself. I shouldn't codegolf in the evening after a long day at work.. >.>

Jelly, 28 bytes
21Ḷ×þ3R¤;25;50FœċµS€³×60¤R¤ḟ

Try it online!

MathGolf, 26 bytes
╟*rJrN▐3╒*mÅ~*╡ak.ε*mÉa─Σ-

Try it online!
-2 bytes thanks to Kevin Cruijssen
Explanation
╟*r                          push [0, ..., 60*input-1]
   Jr                        push [0, ..., 20]
     N▐                      append 25 to the end of the list
       3╒                    push [1, 2, 3]
         *                   cartesian product
          mÅ                 explicit map
            ~                evaluate string, dump array, negate integer
             *               pop a, b : push(a*b)
              ╡              discard from right of string/array
               a             wrap in array
                k            push input to TOS
                 .           pop a, b : push(b*a) (repeats inner array input times)
                  ε*          reduce list with multiplication (cartesian power)
                    mÉ       explicit map with 3 operators
                      a      wrap in array (needed to handle n=1)
                       ─     flatten array
                        Σ    sum(list), digit sum(int)
                         -   remove possible scores from [0, 60*input-1]

-2 bytes by changing 3╒*mÅ~*N_∞α+ to N▐3╒*mÅ~*╡. (PS: Why do you mention "for input 3" in your explanation header?)

Nice job, I'll change it when I'm back on my laptop! I had a 31-byter when I started writing the answer, which was more complicated, so I wanted to add a thorough explanation, but then I found the solution in the post

Wolfram Language (Mathematica), 69 bytes
Complement[Range[60#],Tr/@{Array[1##&,{4,21},0,##&],25,50}~Tuples~#]&

Try it online!
Based off of lirtosiast's answer.
Array's third argument specifies the offset (default 1), and its fourth argument specifies the head to use instead of List. ##& is equivalent to Sequence, so Array[1##&,{4,21},0,##&] returns a (flattened) Sequence containing members of the outer product of 0..3 and 0..20.

Charcoal, 36 bytes
Ｉ⁺Ｅ…wvtsqpmjgkhea_[YS⎇⊖θ⁹¦¹⁷℅ι×⁶⁰⁻θ²

Try it online! Link is to verbose version of code. Uses @Rod's algorithm; brute force would have taken 60 bytes. Works by truncating the string to 9 characters if the input is greater than 1, then taking the ordinals of the characters and adding the appropriate multiple of 60.

Perl 5 -n, 96 93 91 bytes
$"=',';@b=map{$_,$_*2,$_*3,25,50}0..20;map$r[eval]=1,glob"+{@b}"x$_;map$r[$_]||say,0..$_*60

Try it online!
It was optimized for code length rather than run time, so it's kind of slow.  It generates a lot of redundant entries for its lookup hash.  Running the @b array through uniq speeds it up greatly, but costs 5 more bytes, so I didn't do it.

Wolfram Language (Mathematica), 81 bytes
Complement[Range[60#-1],Total/@Tuples[Flatten[{Array[Times,{3,20}],0,25,50}],#]]&

Try it online!
Mathematica has a few related builtins including FrobeniusSolve and the restricted form of IntegerPartitions, but none of them are shorter than brute force.

This is incorrect - it should return {163,166,169,172,173,175,176,178,179}

@attinat Fixed.

69 bytes

@attinat Post it yourself.

C# (Visual C# Interactive Compiler), 305 bytes
(a,b)=>(int)Math.Pow(a,b);f=n=>{var l=new List<int>(new int[21].SelectMany((_,x)=>new[]{x,x*2,x*3})){25,50};int a=l.Count,b,c,d,e=P(a,n),f;var r=new int[e];for(b=e;b>0;b--)for(c=0;c<n;c++){d=b;while(d>P(a,c+1))d-=P(a,c+1);f=(d/P(a,c))-1;r[b-1]+=l[f>0?f:0];}return Enumerable.Range(0,l.Max()*n).Except(r);}

Well, there doesn't seem to be an easy way of calculating all the possible combinations in C#, so this disaster of a code is all I could come up with.
Plus it takes about 30s to complete...
Would love to see a better solution.
P=(a,b)=>(int)Math.Pow(a,b);
F=n=>
{
    var l=new List<int>(new int[21].SelectMany((_,x)=>new[]{x,x*2,x*3})){25,50};
    int a=l.Count,b,c,d,e=P(a,n),f;
    var r=new int[e];
    for(b=e;b>0;b--)
        for(c=0;c<n;c++)
        {
            d=b;
            while(d>P(a,c+1))
                d-=P(a,c+1);
            f=(d/P(a,c))-1;
            r[b-1]+=l[f>0?f:0];
        }
    return Enumerable.Range(0,l.Max()*n).Except(r);
}

Try it online!

Seems you forgot to post your actual golfed answer. Usually people put the unrolled form of it below the golfed one.

@Veskah well, I usually post the golfed one if it's comprehensible, but since this one was a tad too long I saw no point on doing it since it can be found in the tio link anyway, but I guess you're right nevertheless

295 bytes

Kotlin, 118 bytes
{n:Int->val i=if(n<2)listOf(23,24,31,25,37,41,44,47)
else
List(0){0}
i+List(9){n*60-listOf(17,14,11,8,7,5,4,2,1)[it]}}

Try it online!


text:
Find the diameter of a word graph
Introduction
A popular word puzzle is to convert one word into another via a series of steps which replace only one letter and which always result in a valid word. For example, BAG can be converted to DOG via a path of five steps:
BAG -> BAT -> CAT -> COT -> COG -> DOG
Shorter paths also exist in this case; for example:
BAG -> BOG -> DOG
If one drew a graph whose vertices were labelled by words, with an edge between any pair of words that differ by one letter, then the shortest path from "BAG" to "DOG" would consist of two edges.
Challenge
You are to write a program which receives as input a "dictionary" of words which all have  the same length, representing all allowable words that can appear as steps along a path. It should output at least one "longest shortest path", that is, a path between two of the words which is:

no longer than any other path between those two words;
at least as long as the shortest possible path between any other pair of words in the list.

In the context of the graph described above, the length of such a path is the diameter of the graph.
In the degenerate case where none of the input words can be transformed into any of the others, output at least one path of length zero, that is, a single word.
Examples

The input ["bag", "bat", "cat", "cot", "dot", "dog"] should yield a path traversing all six words in that order (or reverse order), since the shortest path from "bag" to "dog" within this dictionary is the longest achievable, five steps.
The input ["bag", "bat", "bot" , "cat", "cot", "dot", "dog"] should yield the path "bag, bat, bot, dot, dog" and/or its reversal.
The input ["code","golf","male","buzz","mole","role","mold","cold","gold","mode"] should yield a path between "code and "golf".
The input ["one", "two", "six", "ten"] corresponds to a graph with no edges, so output one or more single-word (zero-length) paths.
If the input contains any two words of unequal length, the output is undefined.

Rules

Standard code golf rules apply
There will be multiple "shortest" paths. You must output at least one, but are free to output as many as you wish.
You are free to decide how the input dictionary is passed into your program.
Shortest code in bytes wins.

Mind adding a few more test cases?

Done. Also added  discussion of the case where the graph contains no edges.

Strongly related, possible duplicate

Should we accept an empty input (the answer would be [] or [[]])?

I'm happy for behaviour to be undefined on empty inputs.

Jelly, 20 bytes
ŒPŒ!€ẎnƝ§ỊẠƲƇ.ịⱮḢƙƊṪ

Try it online!

APL (Dyalog Classic), 84 80 77 76 74 66 61 bytes
{⍵⌷⍨{⍵,⍨⊃⍋(1≠a⌷⍨⊃⍵),⍪⍺⌷a}⍣d/⊃⍸a=d←⌈/512|,a←⌊.+⍨⍣≡9*⍨2⌊⍵+.≠⍉⍵}

Try it online!
input and output are character matrices
⍵+.≠⍉⍵ matrix of hamming-like distances between words
9*⍨2⌊ leave 0s and 1s intact, turn 2+ into some large number (512=29, used as "∞")
⌊.+⍨⍣≡ floyd&warshall's shortest path algorithm

⌊.+ like matrix multiplication but using min (⌊) and + instead of + and × respectively
⍨ use the same matrix on the left and right
⍣≡ repeat until convergence

d←⌈/512|, length of longest (not "∞") path, assigned to d
⊃⍸a= which two nodes does it connect, let's call them i and j
{⍵,⍨⊃⍋(1≠a⌷⍨⊃⍵),⍪⍺⌷a}⍣d/ reconstruct the path

{ }⍣d/ evaluate the { } function d times. the left arg ⍺ is always i. the right arg ⍵ starts as j and gradually accumulates the internal nodes of the path
(1≠a⌷⍨⊃⍵),⍪⍺⌷a build a 2-column matrix of these two vectors:

1≠a⌷⍨⊃⍵ booleans (0 or 1) indicating which nodes are at distance 1 to the first of ⍵
⍺⌷a distances of all graph nodes to ⍺

⊃⍋ index of the lexicographically smallest row
⍵,⍨ prepend to ⍵

⍵⌷⍨ index the original words with the path

Python 3, 225 bytes
from itertools import*
def f(a):b=[((p[0],p[-1]),(len(p),p))for i in range(len(a))for p in permutations(a,i+1)if all(sum(q!=r for q,r in zip(*x))<2for x in zip(p,p[1:]))];return max(min(r for q,r in b if x==q)for x,y in b)[1]

Try it online!
Basically, take all possible paths, only keep the ones that are valid, then go through each start-end combination, find the minimum path distance, and find the maximum of that.

Wolfram Language (Mathematica), 105 bytes
f@x_:=MaximalBy[AdjacencyGraph[x,UnitStep[1-DistanceMatrix@x]]~FindShortestPath~##&@@@Tuples[x,2],Length]

Try it online!

Python 3, 228 bytes.
def G(w):
    D={A+B:[A,B]if sum(a!=b for a,b in zip(A,B))<2else[0,0]*len(w)for A in w for B in w}
    for k in w:
        for i in w:
            for j in w:
                p=D[i+k]+D[k+j][1:]
                if len(p)<len(D[i+j]):D[i+j]=p
    return max(D.values(),key=len)

Implements the Floyd-Warshall algorithm for all-pairs shortest-paths, then takes the maximum over the found paths.
16 of the characters in this implementation are tabs, which is unfortunate :(

This seems to break when a vertex with no incident edges exists, e.g., "print G( ['bag','bat','cot'])"

Golfing tip for Python indentation: use a space for the first level, a tab for the second, a tab and a space for the third, two tabs for the fourth, etc.

@PeterTaylor Good tip, but only works for Python 2. Python 3 does not allow mixing tabs with spaces.

Ah, good catch @jnfnt. Now that I think about it, it only works when the graph is connected.

JavaScript (ES6),  195  194 bytes
Returns [optimal_length, [optimal_path]].
f=(a,p=[],w=o=[],l=0)=>Object.values(o,o[k=[w,p[0]]]=(o[k]||0)[0]<l?o[k]:[l,p],a.map((v,i)=>w+w&&[...v].map((c,i)=>s-=c!=w[i],s=1)|s||f(a.filter(_=>i--),[...p,v],v,l+1))).sort(([a],[b])=>b-a)[0]

Try it online!
How?
We use a recursive function \$f\$ which builds an object \$o\$ whose keys consist of a pair of words \$w_0\$ and \$w_1\$ separated by a comma and whose values are defined as \$[l, p]\$, where \$p\$ is the shortest path between \$w_0\$ and \$w_1\$ and \$l\$ is the length of this path.
Given a path \$p\$ of length \$l\$ and the last word \$w\$ added to \$p\$, \$o\$ is updated with:
o[k = [w, p[0]]] = (o[k] || 0)[0] < l ? o[k] : [l, p]

We eventually return the longest path stored in \$o\$:
Object.values(o).sort(([a], [b]) => b - a)[0]

(this code is executed at each recursion depth, but only the root level really matters)
We use the following test to know whether a word \$v\$ differs by exactly one letter with the last word \$w\$:
[...v].map((c, i) => s -= c != w[i], s = 1) | s

For each word \$v\$ that can be added to the path, we process a recursive call as follows:
f(                    //
  a.filter(_ => i--), // remove the i-th word from a[]
  [...p, v],          // append v to p[]
  v,                  // pass v as the last word
  l + 1               // increment the length of the path
)                     //

Wolfram Language (Mathematica), 92 bytes
MaximalBy[Select[Rule@@@a,EditDistance@@#<2&]~FindShortestPath~##&@@@(a=#~Tuples~2),Length]&

Try it online!