text:
Sum \$\text{Square}^2\$
Let \$n=42\$ (Input)
Then divisors are : 1, 2, 3, 6, 7, 14, 21, 42
Squaring each divisor : 1, 4, 9, 36, 49, 196, 441, 1764
Taking sum (adding) : 2500
Since \$50\times 50=2500\$ therefore we return a truthy value. If it is not a perfect square, return a falsy value.
Examples :
42  ---> true
1   ---> true
246 ---> true
10  ---> false
16  ---> false

This is code-golf so shortest code in bytes for each language wins
Thanks to @Arnauld for pointing out the sequence : A046655

Can the program output 0 if the result is true, and any other number if the result is false?

R, 39 37 bytes
!sum((y=1:(x=scan()))[!x%%y]^2)^.5%%1

Try it online!
Uses the classic "test if perfect square" approach, taking the non-integral part of the square root S^.5%%1 and taking the logical negation of it, as it maps zero (perfect square) to TRUE and nonzero to FALSE.
Thanks to Robert S for saving a couple of bytes!

Could you use scan() to save a few bytes?

@RobertS. doh! I've been doing too much "real" R coding lately!

JavaScript (ES7),  46 44  42 bytes
Saved 1 byte thanks to @Hedi
n=>!((g=d=>d&&d*d*!(n%d)+g(d-1))(n)**.5%1)

Try it online!
Commented
n =>             // n = input
  !(             // we will eventually convert the result to a Boolean
    (g = d =>    // g is a recursive function taking the current divisor d
      d &&       //   if d is equal to 0, stop recursion
      d * d      //   otherwise, compute d²
      * !(n % d) //   add it to the result if d is a divisor of n
      + g(d - 1) //   add the result of a recursive call with the next divisor
    )(n)         // initial call to g with d = n
    ** .5 % 1    // test whether the output of g is a perfect square
  )              // return true if it is or false otherwise

You can save one byte with d going from n to 0 instead of 2 to n like this: n=>!((g=d=>d?d*d*!(n%d)+g(d-1):0)(n)**.5%1)

05AB1E, 5 bytes
ÑnOÅ²

Try it online!
How?
ÑnOÅ²
Ñ     - divisors
 n    - square
  O   - sum
   Å² - is square?

Shakespeare Programming Language, 434 428 415 bytes
,.Ajax,.Ford,.Puck,.Act I:.Scene I:.[Enter Ajax and Ford]Ford:Listen tothy.Scene V:.Ajax:You be the sum ofyou a cat.Ford:Is the remainder of the quotient betweenyou I worse a cat?[Exit Ajax][Enter Puck]Ford:If soyou be the sum ofyou the square ofI.[Exit Puck][Enter Ajax]Ford:Be you nicer I?If solet usScene V.[Exit Ford][Enter Puck]Puck:Is the square ofthe square root ofI worse I?You zero.If notyou cat.Open heart

Try it online!
-13 bytes thanks to Jo King!
Outputs 1 for true result, outputs 0 for false result.

415 bytes with a third character

@JoKing 371 with [Exeunt]

@JoKing 361 by referring to a variable by name.

Python 2, 55 bytes
lambda n:sum(i*i*(n%i<1)for i in range(1,n+1))**.5%1==0

Try it online!

C (gcc), 67 63 60 59 bytes
-1 bytes thanks to @JonathanFrech
i,s;f(n){for(s=i=0;i++<n;)s+=n%i?0:i*i;n=sqrt(s);n=n*n==s;}

Try it online!

Can ++i<=n be i++<n?

@JonathanFrech that seems to work, thanks.

Neim, 5 bytes
ᛦq

Explanation:
      Factors
 ᛦ      Squared
       Summed
       is in?
   q    infinite list of square numbers

Try it online!

Brachylog, 12 8 bytes
f^₂ᵐ+~^₂

-4 bytes thanks to Fatelize cause i didn't realize brachylog has a factors functions
explanation
f^₂ᵐ+~^₂            #   full code
f                   #       get divisors
 ^₂ᵐ                #           square each one
    +               #       added together
      ~^₂           #       is the result of squaring a number

Try it online!

f^₂ᵐ is 4 bytes shorter than ḋ{⊇×^₂}ᵘ

MathGolf, 5 4 bytes
─²Σ°

Try it online!
Explanation
─     Get all divisors as list (implicit input)
 ²    Square (implicit map)
  Σ   Sum
   °  Is perfect square?

Very similar to other answers, compared to 05AB1E I gain one byte for my "is perfect square" operator.

You know, something called "MathGolf" really should have a norm operator... that would have gotten you down to 3 bytes :)

@MishaLavrov that's not a bad idea! Right now I don't have as many vector operations as I'd like, one of these days I'll change that

MATL, 9 bytes
Z\UsX^tk=

Try it online!
As simple as it gets
Z\ % Divisors of (implicit) input
U  % Square
s  % Sum
X^ % Square root
t  % Duplicate this value
k= % Is it equal to its rounded value?

Thunno 2, 5 bytes
F²SÆ²

Try it online!
Explanation
F²SÆ²  # Implicit input
F      # Factors
 ²     # Square
  S    # Sum
   Æ²  # Perfect square
       # Implicit output

Japt, 11 9 7 bytes
-2 bytes from @Giuseppe and another -2 from @Shaggy
â x²¬v1

â x²¬v1             Full program. Implicity input U
â                   get all integer divisors of U
  x²                square each element and sum
    ¬               square root result
     v1           return true if divisible by 1

Try it online!

-2 more bytes

Matlab, 39 37 bytes
@(v)~mod(sqrt(sum(divisors(v).^2)),1)

Unfortunately, it doesn't work on Octave (on tio) so no tio link.
Note As @LuisMendo stated, divisors() belongs to Symbolic Toolbox.

It looks like divisors belongs to the Symbolic Toolbox. You should state that in the title. Also, you can use ~··· instead of ···==0

You can shorten this by using sum(...)^.5 instead of sqrt(sum(...))

PowerShell, 68 56 bytes
param($n)1..$n|%{$a+=$_*$_*!($n%$_)};1..$a|?{$_*$_-eq$a}

Try it online!
Seems long ...
-12 bytes thanks to mazzy
Does exactly what it says on the tin. Takes the range from 1 to input $n and multiplies out the square $_*$_ times whether it's a divisor or not !($n%$_). This makes divisors equal to a nonzero number and non-divisors equal to zero. We then take the sum of them with our accumulator $a. Next, we loop again from 1 up to $a and pull out those numbers where |?{...} it squared is -equal to $a. That is left on the pipeline and output is implicit.
Outputs a positive integer for truthy, and nothing for falsey.

the rare case where $args[0] is shorter :) 1..$args[0]|%{$a+=$_*$_*!($n%$_)};1..$a|?{$_*$_-eq$a}

@mazzy It's not, because you need $n inside the loop for !($n%$_). But, your rewrite of the sum saved 12 bytes, so thanks!

what a shame. so I would like to find a case where $args[0] is shorter :)

K (oK), 26 25 22 bytes
Solution:
{~1!%+/x*x*~1!x%:1+!x}

Try it online!
Explanation:
{~1!%+/x*x*~1!x%:1+!x} / the solution
{                    } / lambda taking x as input
                   !x  / range 0..x-1                        \
                 1+    / add 1                               |
              x%:      / x divided by and save result into x |
            1!         / modulo 1                            | get divisors
           ~           / not                                 |
         x*            / multiply by x                       /
       x*              / multiply by x (aka square)          > square
     +/                / sum up                              > sum up
    %                  / square root                         \
  1!                   / modulo 1                            | check if a square
 ~                     / not                                 /

Notes:

-1 bytes taking inspiration from the PowerShell solution
-3 bytes taking inspiration from the APL solution

APL (Dyalog Unicode), 18 bytes
0=1|.5*⍨2+.*⍨∘∪⍳∨⊢

Try it online!
Anonymous lambda. Returns 1 for truthy and 0 for falsy (test cases in TIO are prettified).
Shoutouts to @H.PWiz for 4 bytes!
How:
0=1|.5*⍨2+.*⍨∘∪⍳∨⊢   ⍝ Main function, argument ⍵ → 42
                ∨⊢   ⍝ Greatest common divisor (∨) between ⍵ (⊢)
               ⍳      ⍝ and the range (⍳) [1..⍵]
              ∪      ⍝ Get the unique items (all the divisors of 42; 1 2 3 6 7 14 21 42)
             ∘        ⍝ Then
            ⍨         ⍝ Swap arguments of
        2+.*          ⍝ dot product (.) of sum (+) and power (*) between the list and 2
                      ⍝ (sums the result of each element in the vector squared)
       ⍨              ⍝ Use the result vector as base
    .5*               ⍝ Take the square root
  1|                  ⍝ Modulo 1
0=                    ⍝ Equals 0

Can you do the equivalent of not rather than 0= to save a byte?

@streetster unfortunately, I cannot for 2 reasons. First, APL's not operator (~), when used monadically, only works with booleans (either 0 or 1). Since any number modulo 1 never equals 1, if I used ~ instead of 0=, I'd get a domain error on any number that's not a perfect square, since decimal values are out of ~'s domain. Furthermore, I cannot simply omit the 0=, since APL's truthy value is 1, not 0, and it wouldn't have a consistent output for falsy values.

Pyt, 7 bytes
ð²ƩĐř²∈

Try it online!
Explanation
            Implicit input
ð           Get list of divisors
 ²          Square each element
  Ʃ         Sum the list [n]
   Đ        Duplicate the top of the stack
    ř²      Push the first n square numbers
      ∈     Is n in the list of square numbers?
            Implicit output

ð²Ʃ√ĐƖ=

Try it online!
Explanation
            Implicit input
ð           Get list of divisors
 ²          Square each element
  Ʃ         Sum the list [n]
   √        Take the square root of n
    Đ       Duplicate the top of the stack
     Ɩ      Cast to an integer
      =     Are the top two elements on the stack equal to each other?
            Implicit output

ð²Ʃ√1%¬

Try it online!
Explanation
            Implicit input
ð           Get list of divisors
 ²          Square each element
  Ʃ         Sum the list [n]
   √        Take the square root of n
    1%      Take the square root of n modulo 1
      ¬     Negate [python typecasting ftw :)]
            Implicit output

Haskell, 78 64 53 bytes
-14 bytes thanks to Ørjan Johansen. -11 bytes thanks to ovs.
f x=sum[i^2|i<-[1..x],x`mod`i<1]`elem`map(^2)[1..x^2]

Try it online!
Hey, it's been a while since I've... written any code, so my Haskell and golfing might a bit rusty. I forgot the troublesome Haskell numeric types. :P

It's shorter (but slower) to avoid those conversions by searching for the square root with another list comprehension. Try it online!

Shorter: f x|s<-sum[i^2|i<-[1..x],mod x i<1]=round(sqrt$toEnum s)^2==s

Building up on Ørjan Johansen's suggestion, this should work for 53 bytes.

Pari/GP, 23 bytes
n->issquare(sigma(n,2))

Try it online!

Taxi, 4430 4305 bytes
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:s 1 l 1 r.Pickup a passenger going to Cyclone.0 is waiting at Starchild Numerology.0 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 1 l 2 l.Pickup a passenger going to Rob's Rest.Pickup a passenger going to Addition Alley.Go to Rob's Rest:w 1 r 2 l 1 r.Go to Cyclone:s 1 l 1 l 2 l.[B]Pickup a passenger going to Divide and Conquer.1 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 r 3 l.Pickup a passenger going to Addition Alley.Go to Addition Alley:w 1 r 3 r 1 r 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l 1 l.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:n 2 r 2 r 1 r.Pickup a passenger going to Cyclone.Go to Sunny Skies Park:e 1 l 1 l 2 l 1 l.Go to Zoom Zoom:n 1 r.Go to Cyclone:w.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Equal's Corner.Pickup a passenger going to Trunkers.Go to Sunny Skies Park:n 1 r.Go to Trunkers:s 1 l.Pickup a passenger going to Equal's Corner.Go to Equal's Corner:w 1 l.Switch to plan C if no one is waiting.Pickup a passenger going to Riverview Bridge.Go to Sunny Skies Park:n.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Cyclone.Go to Riverview Bridge:n 1 r 1 r.Go to Cyclone:w 2 l.Pickup a passenger going to Cyclone.Go to Sunny Skies Park:n 1 r.Go to Cyclone:n 1 l.Pickup a passenger going to Multiplication Station.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:s 1 l 2 r 4 l.Pickup a passenger going to Addition Alley.Go to Rob's Rest:s 1 r 2 l 1 l 1 r 1 r.Pickup a passenger going to Addition Alley.Go to Addition Alley:s 1 l 1 l 2 r 1 r 1 r.Pickup a passenger going to Rob's Rest.Go to Rob's Rest:n 1 l 1 l 1 l 2 r 1 r.Go to Cyclone:s 1 l 1 l 2 l.Pickup a passenger going to Magic Eight.Go to Sunny Skies Park:n 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:n 1 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Magic Eight.Go to Magic Eight:s 1 l 2 r.Switch to plan D if no one is waiting.Pickup a passenger going to Addition Alley.Go to Cyclone:n 1 l 2 r.Switch to plan B.[C]Go to Sunny Skies Park:n.Pickup a passenger going to Cyclone.Pickup a passenger going to Addition Alley.Go to Cyclone:n 1 l.Switch to plan B.[D]Go to Cyclone:n 1 l 2 r.Pickup a passenger going to Sunny Skies Park.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:n 1 r.Go to Rob's Rest:s 2 r 1 r.Pickup a passenger going to Cyclone.Go to Cyclone:s 1 l 1 l 2 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Cyclone.Go to Zoom Zoom:n.Go to Cyclone:w.[E]Pickup a passenger going to Joyless Park.Pickup a passenger going to Divide and Conquer.Go to Joyless Park:n 2 r 2 r 2 l.Go to Cyclone:w 1 r 2 l 2 l.Pickup a passenger going to Cyclone.Pickup a passenger going to Joyless Park.Go to Joyless Park:n 2 r 2 r 2 l.Go to Cyclone:w 1 r 2 l 2 l.Pickup a passenger going to Divide and Conquer.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:n 2 r 2 r 1 r.Pickup a passenger going to Magic Eight.1 is waiting at Starchild Numerology.Go to Starchild Numerology:e 1 r 3 r 1 l 1 l 2 l.Pickup a passenger going to Magic Eight.Go to Magic Eight:w 1 r 2 r 1 r.Switch to plan F if no one is waiting.Pickup a passenger going to Riverview Bridge.Go to Joyless Park:e 2 l 4 r.Pickup a passenger going to Cyclone.Pickup a passenger going to The Underground.Go to The Underground:w 1 l.Pickup a passenger going to Cyclone.Go to Fueler Up:s.Go to Riverview Bridge:n 3 l.Go to Cyclone:w 2 l.Switch to plan E.[F]Go to Joyless Park:e 2 l 4 r.Pickup a passenger going to What's The Difference.Pickup a passenger going to Cyclone.Go to Cyclone:w 1 r 2 l 2 l.Pickup a passenger going to Multiplication Station.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:s 1 l 2 r 4 l.Pickup a passenger going to What's The Difference.Go to What's The Difference:n 2 l 1 r 3 l.Pickup a passenger going to Knots Landing.Go to Knots Landing:e 4 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:w 1 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.

Try it online!
I went to a lot of places in Townsburg that I've never visited before for this program. Because this program is HUGE (mainly due to the fact that there isn't a one-stop way to take square roots; I still don't actually do that, though), I'm going to attempt to sketch out an explanation of this program.
Go to Post Office:w 1 l 1 r 1 l.

[Take an input line from STDIN.]

Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:s 1 l 1 r.

[Take it to The Babelfishery, which converts the string to a double.]
[If you were to give it a double, it gives back a string.]

Pickup a passenger going to Cyclone.

[We're going to clone this number by sending it to the Cyclone.]

0 is waiting at Starchild Numerology.

[In Taxi, numeric passengers are introduced once they wait at Starchild Numerology.]
[This passenger will be our running squares total.]

0 is waiting at Starchild Numerology.

[This passenger will be our counter, going from 1 to the inputted number.]
[Yes, it's starting at 0 here, but it is incremented at the start of our loop.]

Go to Starchild Numerology:n 1 l 1 l 1 l 2 l.
Pickup a passenger going to Rob's Rest.
Pickup a passenger going to Addition Alley.
Go to Rob's Rest:w 1 r 2 l 1 r.
Go to Cyclone:s 1 l 1 l 2 l.

[Drop off the squares total at Rob's Rest. We'll pick it back up later when we need it.]
[Also, do the actual cloning of the inputted number.]

[At the start of each loop, our only passenger is the counter, going to Addition Alley.]

[B]
Pickup a passenger going to Divide and Conquer.

[Pick up one of the clones of the inputted number.]
[We will leave the other clone here for later.]

1 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 r 3 l.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:w 1 r 3 r 1 r 1 r.
Pickup a passenger going to Cyclone.

[Pick up the number 1, and add it to the counter, then pick up the result.]
[This new passenger is our new counter.]

Go to Cyclone:n 1 l 1 l.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Divide and Conquer.

[First we pick up the other clone of the inputted number, going to Sunny Skies Park.]
[Sunny Skies Park is basically a First-In-First-Out queue, where we will stick it for later.]
[Then we pick up a clone of the counter which we just dropped off, so we can divide the input by it.]
[We will leave the other clone here for later.]

Go to Divide and Conquer:n 2 r 2 r 1 r.
Pickup a passenger going to Cyclone.

[Divide the inputted number by the counter, and prepare to clone it.]

Go to Sunny Skies Park:e 1 l 1 l 2 l 1 l.

[Drop off our clone of the inputted number at Sunny Skies Park.]

Go to Zoom Zoom:n 1 r.

[Can't forget to get gas!]
[Zoom Zoom is a close gas station, and we have so many credits that one stop here every iteration fills us up completely.]

Go to Cyclone:w.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Equal's Corner.
Pickup a passenger going to Trunkers.

[First we pick up the other clone of the counter, going to Sunny Skies Park for later.]
[Then we pick up a clone of the division result, going to Equal's Corner.]
[Equal's Corner takes multiple numeric passengers, and returns the value of one of them if they are equal, but otherwise it returns no one.]
[Finally we pick up the other clone of the division result, going to Trunkers.]
[Dropping off a passenger at Trunkers is equivalent to the floor function. We need it here because division results are "exact".]
[(Well, as exact as double precision arithmetic can be.)]
[We will compare the result of this to the exact result of the division.]

Go to Sunny Skies Park:n 1 r.

[Drop off our clone of the counter at Sunny Skies Park.]

Go to Trunkers:s 1 l.
Pickup a passenger going to Equal's Corner.
Go to Equal's Corner:w 1 l.

[Compare the exact division result with the floored division result.]
[If they are equal, then the value of one of them will be waiting.]
[This also means that the counter is a divisor of the input, and we should add the square of the counter to our running squares total.]
[If they are not equal, no one will be waiting, the counter is not a divisor of the input, and nothing should happen.]

Switch to plan C if no one is waiting.

[This is Taxi's only conditional operator.]
[It jumps to a bracketed label (in this case, C) if there is no one waiting at this stop.]
[Of course, there is an unconditional version of this, too.]

[If we are on this path, we are adding the square of the counter to our running squares total.]

Pickup a passenger going to Riverview Bridge.

[We don't actually need the passenger that's waiting here (and leaving it there will not work at all).]
[So what do you do when you have a pesky passenger you don't want? You take them to Riverview Bridge!]
[Riverview Bridge has a lovely view, but passengers dropped off there always seem to fall in the river.]
[This means you don't collect your fare for bringing them there, but at least the pesky passenger is gone.]

Go to Sunny Skies Park:n.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Cyclone.

[We want to pick up the counter (so we can multiply it by itself). That dang input is in the way, but we still need it.]
[So what do we do? We just take it back to where it was waiting!]
[Yup, even though one would never do this in real life, a passenger's current location is a perfectly legal destination in Taxi.]

Go to Riverview Bridge:n 1 r 1 r.

[So long, Equal's Corner result!]

Go to Cyclone:w 2 l.
Pickup a passenger going to Cyclone.
Go to Sunny Skies Park:n 1 r.

[We clone the counter so we can still use it, then we drop the inputted number back at Sunny Side Park.]
[Again, we will leave the other clone here for later.]

Go to Cyclone:n 1 l.
Pickup a passenger going to Multiplication Station.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station:s 1 l 2 r 4 l.

[Square the counter.]

Pickup a passenger going to Addition Alley.
Go to Rob's Rest:s 1 r 2 l 1 l 1 r 1 r.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:s 1 l 1 l 2 r 1 r 1 r.
Pickup a passenger going to Rob's Rest.
Go to Rob's Rest:n 1 l 1 l 1 l 2 r 1 r.

[Pick up the running squares total from Rob's Rest, add it to the square of the counter, then bring it back.]

Go to Cyclone:s 1 l 1 l 2 l.
Pickup a passenger going to Magic Eight.

[Pick up the counter, going to Magic Eight.]
[Magic Eight takes two numeric passengers, and returns the first passenger if it is less than the second, but otherwise it returns no one.]
[We will compare the counter to the inputted number...]

Go to Sunny Skies Park:n 1 r.
Pickup a passenger going to Cyclone.
Go to Cyclone:n 1 l.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Magic Eight.

[...who we take now, so we can make a clone of it and compare it to the counter.]

Go to Magic Eight:s 1 l 2 r.
Switch to plan D if no one is waiting.

[Compare.]
[If the counter is waiting here, the loop is to continue.]
[If not, switch to plan D, end the loop, and start detecting whether or not the running squares total is a square itself.]

Pickup a passenger going to Addition Alley.
Go to Cyclone:n 1 l 2 r.
Switch to plan B.

[Reset everything, and loop back to the start of plan B.]

[C]

[If we are on this path, the counter is not a divisor of the inputted number, but the loop should continue anyways.]

Go to Sunny Skies Park:n.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Addition Alley.
Go to Cyclone:n 1 l.
Switch to plan B.

[Reset everything, and loop back to the start of plan B.]

[D]

[We are finally out of the loop. Now it's time for the real fun.]

Go to Cyclone:n 1 l 2 r.
Pickup a passenger going to Sunny Skies Park.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park:n 1 r.

[We don't need the inputted number anymore, but we can't change its destination from the Cyclone.]
[So we go to the Cyclone, so we can take the two clones and bring them to Sunny Skies Park forever.]
[We could send them to Riverview Bridge, but that will take more bytes.]

Go to Rob's Rest:s 2 r 1 r.

[Pick up our running squares total from Rob's Rest, so it can go out and see the town.]

Pickup a passenger going to Cyclone.
Go to Cyclone:s 1 l 1 l 2 l.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Cyclone.
Go to Zoom Zoom:n.
Go to Cyclone:w.

[We need to end up with 4 clones of the total.]
[Two of them will actually be used as the counter in this loop.]

[At the start of each loop, we have no passengers.]

[E]
Pickup a passenger going to Joyless Park.
Pickup a passenger going to Divide and Conquer.
Go to Joyless Park:n 2 r 2 r 2 l.

[We will leave one clone of the total at Joyless Park (like Sunny Side Park, but on the opposite side of town).]
[The other clone will be used in a division.]

Go to Cyclone:w 1 r 2 l 2 l.
Pickup a passenger going to Cyclone.
Pickup a passenger going to Joyless Park.
Go to Joyless Park:n 2 r 2 r 2 l.

[We will leave one clone of the counter at Joyless Park.]
[We will clone the other clone (clone-ception?).]

Go to Cyclone:w 1 r 2 l 2 l.
Pickup a passenger going to Divide and Conquer.
Pickup a passenger going to Divide and Conquer.
Go to Divide and Conquer:n 2 r 2 r 1 r.

[We will use both clones of the counter in a division.]
[Divide and Conquer can take 3 arguments, and the result here will be equivalent to total / counter^2 .]
[If the square of the counter is equal to the total, the result will be 1.]
[If the square of the counter is less than the total, the result will be greater than 1.]
[If the square of the counter is greater than the total, the result will be less than 1.]

Pickup a passenger going to Magic Eight.
1 is waiting at Starchild Numerology.
Go to Starchild Numerology:e 1 r 3 r 1 l 1 l 2 l.
Pickup a passenger going to Magic Eight.
Go to Magic Eight:w 1 r 2 r 1 r.
Switch to plan F if no one is waiting.

[We compare the result of the division against 1 to decide our next course of action.]
[If it is greater or equal, the loop should end, and the counter is equal to the floor of the square root.]
[If it is less, the loop should continue.]

Pickup a passenger going to Riverview Bridge.

[Whoops, we don't actually need this anymore.]

Go to Joyless Park:e 2 l 4 r.
Pickup a passenger going to Cyclone.

[We will clone the total later, so we can reuse it in the next loop iteration.]

Pickup a passenger going to The Underground.
Go to The Underground:w 1 l.

[Instead of taking the number 1 and subtracting it from the counter, we can do an optimization here.]
[The Underground is a destination that takes 1 passenger, and subtracts 1 from it.]
[If the result is positive, it returns the result. Otherwise, it returns no one.]
[The latter result will not happen for us, however.]

Pickup a passenger going to Cyclone.

[We will clone the counter later, so we can reuse it in the next loop iteration.]

Go to Fueler Up:s.

[Gotta remember to stop for gas!]

Go to Riverview Bridge:n 3 l.

[So long, Magic Eight result!]

Go to Cyclone:w 2 l.
Switch to plan E.

[Reset everything, and loop back to the start of plan E.]

[F]

Go to Joyless Park:e 2 l 4 r.
Pickup a passenger going to What's The Difference.
Pickup a passenger going to Cyclone.

[Once we've figured out the square root of the total, we're still not done.]

Go to Cyclone:w 1 r 2 l 2 l.
Pickup a passenger going to Multiplication Station.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station:s 1 l 2 r 4 l.

[We actually square the square root...]

Pickup a passenger going to What's The Difference.
Go to What's The Difference:n 2 l 1 r 3 l.

[...and subtract it from the total at What's The Difference (which subtracts dropped-off passengers).]

Pickup a passenger going to Knots Landing.
Go to Knots Landing:e 4 r 1 l.

[If the result is 0, the total is a perfect square, and a truthy value should be output.]
[If the result is nonzero, the total is not a perfect square, and a falsy value should be output.]
[Luckily, Knots Landing does our work for us.]
[Knots Landing inverts the boolean logic of numeric passengers (i.e. 0 becomes 1, nonzero becomes 0).]

Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:w 1 l.

[Convert it to a string...]

Pickup a passenger going to Post Office.
Go to Post Office:n 1 l 1 r.

[...and output it.]

[We would exit the program by going to the Taxi Garage, but that takes bytes.]
[The boss fires us because we didn't bring the taxi back to the garage, but that gets output to STDERR, so that's OK.]

Vyxal, 5 bytes
K²∑∆²

Try it Online!
   ∆² # Is
  ∑   # The sum of
 ²    # The squares of
K     # The factors of the input
   ∆² # A perfect square?

Vyxal, 14 bytes (Test cases)
ɾḊT›ƛ:*;ƒ+√:ṙ=

Try it Online! for 12 bytes

Jelly, 6 bytes
ÆD²SÆ²

Try it online! Or see the test-suite.
How?
ÆD²SÆ² - Main Link: integer
ÆD     - divisors
  ²    - square
   S   - sum
    Æ² - is square?

Husk, 6 bytes
£İ□ṁ□Ḋ

Try it online!
Explanation
£İ□ṁ□Ḋ  -- example input 12
     Ḋ  -- divisors: [1,2,3,4,6,12]
   ṁ    -- map the following ..
    □   -- | square: [1,4,9,16,36,144]
        -- .. and sum: 210
£       -- is it element of (assumes sorted)
 İ□     -- | list of squares: [1,4,9,16..196,225,..

Gaia, 5 bytes
ds¦Σụ

Try it online!

Proton, 41 bytes
a=>sum(q*q for q:1..a+1if a%q<1)**.5%1==0

Try it online!
Similar approach to the Python answer.

Mathematica, 32 bytes
IntegerQ@Sqrt[2~DivisorSigma~#]&

Pure function. Takes a number as input and returns True or False as output. Not entirely sure if there's a shorter method for checking perfect squares.

Octave / MATLAB, 43 bytes
@(n)~mod(sqrt(sum(find(~mod(n,1:n)).^2)),1)

Try it online!

Perl 6, 34 bytes
-1 byte thanks to nwellnhof
{grep($_%%*,1..$_)>>².sum**.5%%1}

Try it online!

**.5 is one byte shorter than .sqrt.

Scala, 68 67 bytes
def j(s:Int)=Math.sqrt((1 to s).filter(s%_<1).map(a=>a*a).sum)%1==0

Try it online!

Java 8, 75 70 bytes
n->{int s=0,i=0;for(;++i<=n;)s+=n%i<1?i*i:0;return Math.sqrt(s)%1==0;}

-5 bytes thanks to @archangel.mjj.
Try it online.
Explanation:
n->{             // Method with integer parameter and boolean return-type
  int s=0,       //  Sum-integer, starting at 0
      i=0;       //  Divisor integer, starting at 0
  for(;++i<=n;)  //  Loop `i` in the range [1, n]
    s+=n%i<1?    //   If `n` is divisible by `i`:
        i*i      //    Increase the sum by the square of `i`
       :         //   Else:
        0;       //    Leave the sum the same by adding 0
  return Math.sqrt(s)%1==0;}
                 //  Return whether the sum `s` is a perfect square

Hi, you can cut 5 bytes by removing the t variable (do the eval and assignment within the body of the for loop), like so: n->{int s=0,i=0;for(;++i<=n;)s+=n%i<1?i*i:0;return Math.sqrt(s)%1==0;}

@archangel.mjj Ah, of course. Not sure how I missed that. Thanks! :)

Red, 67 bytes
func[n][s: 0 repeat d n[if n % d = 0[s: d * d + s]](sqrt s)% 1 = 0]

Try it online!

F#, 111 bytes
let d n=Seq.where(fun v->n%v=0){1..n}
let u n=
 let m=d n|>Seq.sumBy(fun x->x*x)
 d m|>Seq.exists(fun x->x*x=m)

Try it online!
So d gets the divisors for all numbers between 1 and n inclusive. In the main function u, the first line assigns the sum of all squared divisors to m. The second line gets the divisors for m and determines if any of them squared equals m.

Perl 5, 47 bytes
$a+=$_*$_*!($n%$_)for 1..$n;$a=!($a**.5=~/\D/);

Returns 1 for true and nothing for false.
Explanation:
$a+=              for 1..$n;                      sum over i=1 to n
    $_*$_                                         square each component of the sum
         *!($n%$_)                                multiply by 1 if i divides n.
                            $a=                   a equals
                                ($a**.5           whether the square root of a
                               !       =~/\D/);   does not contain a non-digit.

Groovy, 47 bytes
A lambda accepting a numeric argument.
n->s=(1..n).sum{i->n%i?0:i*i}
!(s%Math.sqrt(s))

Explanation
(1..n) creates an array of the values 1 to n
n%i is false (as 0 is falsy) if i divides n without remainder
n%i ? 0 : i*i is the sum of the square of the value i if it divides n without remainder, otherwise is 0
sum{ i-> n%i ? 0 : i*i } sums the previous result across all i in the array.
s%Math.sqrt(s) is false (as 0 is falsy) if the sqrt of s divides s without remainder
!(s%Math.sqrt(s)) returns from the lambda (return implicit on last statement) !false when the sqrt of s divides s without remainder
Try it online!

C# (Visual C# Interactive Compiler), 141 137 135 131 61 bytes
Thanks ASCII-only.

a=>Math.Sqrt(Enumerable.Range(1,a).Sum(b=>a%b==0?b*b:0))%1==0

Explanation:
a => Math.Sqrt(                                                    ) % 1 == 0 //Square root, test for whole number
               Enumerable.Range(1, a).Sum(                        ) //Sum 1 through a with..
                                          b => a % b==0 ? b * b: 0 //b^2 if a modulo b = 0, else 0

Try it online!

Divide by zero exception because division by zero is undefined...

Fixed?

Wait... this isn't valid

here

using the implicit imports of the REPL (mostly for free LINQ)

Thanks @ASCII-only!

Note that REPL counts as a different language (well, different implementation) because it behaves differently to normal C# (mostly the imports)

@ASCIIOnly - How about a%b==0 vs a%b<1 ?

Pyth, 26 16 bytes
!%@s^R2*M{yPQ2 1

Try it online!
I'm new to Pyth (and golfing in general) so this is pretty bad. Pyth doesn't have a built-in to get divisors, so I had to do that. Up until the perfect-square check, it was pretty alright, but after that it became a bit cluttered because of the if statement. Criticism is welcome.
-10 bytes thanks to Sok
Explanation:
            Q               #get user input
       *M{yP                #get the divisors
    ^R2                     #square each divisor
   s                        #sum the list
  @          2              #get square root
 %             1            #check if sqrt is a whole number (mod 1)
!                           #invert (0 -> True, any other num -> False)

A few savings for you - m^d2 can be ^R2, and @ functions as the root operator, so ^...c1h1 can be @...2. The return value is if the root mod 1 is non-zero - that is, should return True if the result of the mod is 0, and False otherwise - this means we can just use ! to invert the truthiness of the mod. Full program is then !%@s^R2*M{yPQ2 1 - demonstration

Stax, 10 9 bytes
▀ùj╦┬44eR

Run and debug it at staxlang.xyz!
Unpacked (11 bytes) and explanation:
:d{J+kc|qJ=
:d             Implicit input. Make list of divisors.
  {  k         Reduce using block:
   J+            Square and add to the running total.
      c        Copy this sum of squares on the stack.
       |qJ     Take square root, rounding down. Square.
          =    Check for equality.

Wolfram Language (Mathematica), 24 20 bytes
1∣Norm@Divisors@#&

Try it online!
Divisors finds all the divisors of a number, Norm takes the square root of the sum of squares, and then we test if this is divisible by 1 (i.e., is an integer).

C# (.NET Core), 115 74 bytes
Thanks to user Misha Lavrov for teaching me how to properly do code golf! :)
a=>{int s=0;for(int i=0;i++<=a;)s+=a%i==0?i*i:0;return Math.Sqrt(s)%1==0;}

Try it online!
Ungolfed:
a => {                              // reads input
    int s = 0;                      // holds sum of squares
    for(int i = 0; i++ <= a;)       // index from 1 to input, inclusive
    {
        s +=                        // add to sum
            a % i == 0 ?            // check if remainder of input divided by current index is zero
                i * i : 0;          // if true, add square of current index, else add zero
    }
    return Math.Sqrt(s) % 1 == 0;   // prints "True" if square root is whole number, "False" otherwise
}

I think it's standard to do input and output via a pure function, something like this. So you don't have to count the length of Console.ReadLine() and such, that way.

Good to know, thank you. I'll keep this in mind for the future!

using the interpreter saves a bit, although i've already posted this link on the other C# answer, so not sure what to do

Also, invalid, you need to use System.Math.Sqrt - the System import isn't free, so this is the cheapest alternative

also, no need to convert input since this is a function

Ok, still working on how it wants a link..

70 bytes.  a=>{int s=0,i=0;for(;i++<=a;)s+=a%i>0?0:i*i;return Math.Sqrt(s)%1==0;}

Ohm v2, 5 bytes
V²ΣÆ²

Try it online!
Explanation:
V²ΣÆ²
V      Pushes input's divisors
 ²     Squares
   Σ   Sum
    Æ² Returns whether value is a proper square.

APL(NARS), 23 chars, 46 bytes
{0=1∣√+/×⍨(0=a∣⍵)/a←⍳⍵}

test:
   g←{0=1∣√+/×⍨(0=a∣⍵)/a←⍳⍵}
   g¨ 42 1 246 10 16
1 1 1 0 0

Arturo, 39 bytes
$=>[=floor<=sqrt∑map factors&'x->x*x]

Try it!
$=>[              ; a function where input is assigned to &
    factors&      ; divisors of the input
    map _ 'x->x*x ; square each
    ∑             ; sum
    sqrt          ; square root
    <=            ; duplicate
    floor         ; floor
    =             ; are the equal?
]                 ; end function

Ruby, 45 bytes
->n{(1..n).map{n%_1<1?_1*_1:0}.sum**0.5%1==0}

Attempt This Online!

ARBLE, 33 bytes
nt(sqrt(1+sum(factors(n)|x^2))%1)

Try it online!


text:
Cayley Table of the Dihedral Group \$D_3\$
The Dihedral group \$D_3\$ represents the symmetries of an equilateral triangle, using the identity (represented by id), rotations (represented by r1 and r2), and reflections (represented by s0, s1, and s2).
Your task is to compute the composition \$yx\$ of the elements \$x, y \in D_3 \$. They are given by the Cayley table below:
  x  id  r1  r2  s0  s1  s2
y  +-----------------------
id | id  r1  r2  s0  s1  s2
r1 | r1  r2  id  s1  s2  s0
r2 | r2  id  r1  s2  s0  s1
s0 | s0  s2  s1  id  r2  r1
s1 | s1  s0  s2  r1  id  r2
s2 | s2  s1  s0  r2  r1  id

Input
Any reasonable input of x and y. Order does not matter.
Output
y composed with x, or looking up values in the table based on x and y.
Test Cases
These are given in the form x y -> yx.
id id -> id
s1 s2 -> r1
r1 r1 -> r2
r2 r1 -> id
s0 id -> s0
id s0 -> s0

Notes on I/O
You may use any reasonable replacement of id, r1, r2, s0, s1, s2, for example 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, or even [0,0], [0,1], [0,2], [1,0], [1,1], [1,2] (here the first number represents rotation/reflection and the second is the index).

Python 2, 27 bytes
lambda o,O:[o[_]for _ in O]

Try it online!

can u explain this code?

@taritgoswami Both o and O are three-element lists containing a permutation of the integers 0, 1, 2. In the list comprehension, the former is indexed by the latter, implementing permutation composition.

JavaScript (ES6), 39 bytes
Uses the following mapping:
 id | r1 | r2 | s0 | s1 | s2
----+----+----+----+----+----
 2  | 0  | 4  | 1  | 3  | 5

Takes input as (x)(y).
x=>y=>'450123234523012323'[(x*51^y)%18]

Try it online!

JavaScript (ES6), 20 bytes
Using Jonathan Frech's I/O format:
x=>y=>y.map(n=>x[n])

Try it online!

Jelly, 1 byte
ị

A dyadic link taking y on the left and x on the right.
Uses the representations of the fist three natural numbers transformed as their actions describe:
   name:  id          r1          r2          s0          s1          s2
  value:  [1,2,3]     [2,3,1]     [3,1,2]     [2,1,3]     [1,3,2]     [3,2,1]
(action:  identity    rot-Left    rot-Right   swap-Left   swap-Right  swap-Outer)

A port of
Jonathan Frech's Python answer
ị is Jelly's "index into" atom, and it vectorises; note that Jelly is 1-indexed.
Try it online! Or see a table using the question-names.

To take x on the left and y on the right, these values may be used instead:
id       r1       r2       s0       s1       s2
[1,2,3]  [3,1,2]  [2,3,1]  [1,3,2]  [3,2,1]  [2,1,3]

...see here.

Python 2, 27 26 23 bytes
lambda x,y:(y+x*5**y)%6

Try it online! Edit: Saved 3 bytes thanks to @NieDzejkob. Uses the following mapping:
 id | r1 | r2 | s0 | s1 | s2
----+----+----+----+----+----
 0  | 2  | 4  | 1  | 3  | 5

@JonathanFrech ... I don't have x*-1... I have x*(-1**y)

@JonathanFrech Ah, I'd typoed my test code, I thought I was getting (-1)**y. Oh well, that's still 1 byte shorter...

Hm ... And I thought I golfed a byte ...

Like on the D4 challenge, you can replace (-1) with 5 for -3 bytes.

APL (Dyalog Classic), 3 bytes
+.×

Try it online!
+.× is matrix multiplication
we represent the group as
id     r1     r2     s0     s1     s2
1 0 0  0 0 1  0 1 0  0 0 1  0 1 0  1 0 0
0 1 0  1 0 0  0 0 1  0 1 0  1 0 0  0 0 1
0 0 1  0 1 0  1 0 0  1 0 0  0 0 1  0 1 0

K (ngn/k), 1 byte
@

Try it online!
x@y is list indexing, which is the same as composition of permutations; we represent the group as
id:0 1 2; r1:1 2 0; r2:2 0 1; s0:2 1 0; s1:1 0 2; s2:0 2 1

Japt, 2 bytes
Uses Jonathan's I/O format.
gV

Try it online

JavaScript (Node.js), 24 19 bytes
(x,y)=>(y+x*5**y)%6

Try it online! Edit: Saved 2 bytes by switching to ** and 3 bytes thanks to @NieDzejkob. Uses the following mapping:
 id | r1 | r2 | s0 | s1 | s2
----+----+----+----+----+----
 0  | 2  | 4  | 1  | 3  | 5

The old 24 byte version also works in old versions of JavaScript:
(x,y)=>(y%2?y+6-x:y+x)%6

Racket, 42 bytes
(lambda(x y)(modulo(+ y(* x(expt 5 y)))6))

Try it online!
A boring port of Neil's Python answer. Uses the same I/O format, so:
 id | r1 | r2 | s0 | s1 | s2
----+----+----+----+----+----
 0  | 2  | 4  | 1  | 3  | 5

Wolfram Language (Mathematica), 16 bytes
Mod[#+#2*5^#,6]&

Try it online!
Another boring port of Neil's answer, this time in Mathematica. It is an anonymous function that takes arguments in the order [y, x].
Here’s the input representation:
 id | r1 | r2 | s0 | s1 | s2
----+----+----+----+----+----
 0  | 2  | 4  | 1  | 3  | 5

05AB1E, 1 byte
è

Port of @JonathanAllan's Jelly answer, but with 0-based indices, so the representations are:
id       r1       r2       s0       s1       s2       # Original values
[0,1,2]  [1,2,0]  [2,0,1]  [1,0,2]  [0,2,1]  [2,1,0]  # Values instead

Try it online or verify all possible combinations or verify all mapped back to ids.
Explanation:
è  # Index the second (implicit) input-list vectorized into the first (implicit) input-list
   # And output the result implicitly

source: Stack Exchange

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

sort: votes


text:
Simplistic Lava Lamp
Introduction:
I think everyone knows what a Lava Lamp is, but in case they do not:

(Image source)
They're basically glass tubes that contain wax in a translucent liquid. The bottom part is heated when the lamp is turned on, causing a change in density and thus the wax floats to the top. When it cools down, it falls down again, causing the effect we see above.
It usually takes about 45-60 minutes for the base of the lamp to rise in temperature high enough to change the solid wax to liquid wax (if the lamp is located in an area at room temperature).
More information on Wikipedia, which is also used as source for some of the text above.
Challenge:
Given a positive integer n indicating the amount of minutes that have passed since we've turned the Lava Lamp on, output a random state of the Lava Lamp based on integers on five levels.
For this challenge we'll say the Lava Lamp contains 1000 units of wax in total, and we have five levels where the wax can be at.
1) If n is below 45, the Lava Lamp is still heating up, so the output will be four empty lines with 1000 at the bottom:

1000
2) If n is in the range [45, 60) the Lava Lamp has increased in temperature enough for wax to move around, but no very high yet. The wax can reach up to and including the third level.
3) If n is 60 or higher, the wax can be at any of the five levels.
So given the positive integer n as input, we'll output a random state with the three rules above in mind.
Here are some example outputs:
Possible outputs for any n that is >= 45:

523
106
371

913

87
Possible outputs for any n that is >= 60:
73
113
312
5
497
284
55
637

24
Constant output for n that is <= 44 (and possible output for any n):

1000
Challenge rules:

There can be empty lines, even though the level above it is not empty.
Just 0 isn't allowed on any line. Should be empty instead.
Output is somewhat flexible. You are allowed to output a list/array of strings/objects instead of a new-line delimited result as above. The reason I say strings/objects is due to the rule above. An empty line should be "", null, [], etc., but cannot be 0 or a negative integer (nor can it be false) (I.e. ["", "", 913, "", 87] for n >= 45). You are also allowed to reverse the output (I.e. 1000\n\n\n\n instead of \n\n\n\n1000 or [87, null, 913, null, null] instead of [null, null, 913, null, 87]).
The numbers should all be integers. The can be decimals with 0 as decimal value, but none of the numbers should have any decimal digits, and the integers should always sum to exactly 1000.
All possible random outputs based on n should have a non-zero chance of occurring.
A trailing new-line (so there are six lines of output) is allowed.

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, 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.
Also, adding an explanation for your answer is highly recommended.

Semi-related: "Random numbers with fixed sum" and Related stackoverflow answer for "Random numbers that add to 100"

May an empty level be represented with a single space?

@Arnauld Sure. Can be anything except for 0, a negative number, or false.

Is the output always 5 levels, even when n < 60?

@Emigna Yes, the output is always 5 levels. For n < 45 only 1 level is filled however (top or bottom depending on the order you output it in), which is 1000. With 45 <= n < 60 three of the five, and with n >= 60 all five. But the output will always contain five 'lines'.

I assume it's not allowed, but it would be funny to bypass the 0 is an empty string by outputting in unary.

MathGolf, 21 20 bytes
5º*♪{k[K∞╟(]m<Σ∞wΦ}σ

Try it online!
This is my first answer in my new language. I based my solution on Emigna's 05AB1E solution, but used some neat features of MathGolf to make it a tiny bit shorter.
Explanation
5º*                   push 5, [0], multiply (yielding [0,0,0,0,0]
   ♪                  push 1000
    {                 start block
     k                push input as integer
      K∞              push 22 and double it, yielding 44
        ╟(            push 60 and decrease, yielding 59
          α           wrap last two elements in array, yielding [44,59]
           m<         map is less than, giving [0,0], [1,0] or [1,1]
             Σ        sum array, giving 0, 1 or 2
              ∞       double, giving 0, 2 or 4
               w      push random integer in range
                Φ     increase array element
                 }    execute for loop (loops 1000 times)
                  σ   convert to string and remove leading zeroes (implicit map)

If the features aren't builtins for this challenge in of itself, the non-competing tag won't be necessary. Since mid last year non-competing is no longer a thing. Since it's very new I assume there isn't an online compiler for your language yet? Could you instead perhaps add some screenshots (or links to screenshots if it would clutter the post too much) as verification? And I would contact @Dennis' to ask if your language could be added to TryItOnline.

@KevinCruijssen Thanks for the feedback! I'll add some screenshots, and I'm working on getting the language to TIO. I'll contact Dennis once I feel that I'm not constantly adding new features.

Have you considered creating a room for your language? I'm very interested in learning it!

@JoKing glad to hear you're interested! I'll try to create a room sometime this weekend. I only just got the language on TIO thanks to Dennis, I'm working on making it accessible to everyone!

@JoKing I created a room for MathGolf. I'll try to answer any questions as soon as I can, I know the documentation is a bit unfinished.

Python 2, 117 113 108 107 106 105 bytes
from random import*
def f(n):a=['']*5;exec"i=randint(0,(n>44)+(n>59)<<1);a[i]=(a[i]or 0)+1;"*1000;print a

Try it online!
Returns a reversed list (bottom first)

Version inspired by the stackoverflow answer in the comments (edgecases are more likely):
Python 2, 129 bytes
from random import*
def f(n):a=sorted([1000]*5+sample(range(1001)*5,(n>44)+(n>59)<<1));print[y-x or''for x,y in zip([0]+a,a)[:5]]

Try it online!

I don't know exactly how your code work, but does every state have a non-zero chance of occurring? All your numbers are hovering near the 333 or 200 for the 3 or 5 parts respectively. I don't see any spikes/outliers towards 0 or 1000. Or are the chances for those just astronomically small (but still non-zero) in comparison to integers near 333 and 200?

@KevinCruijssen Each of the 1000 lava-units are put into a random bin (0 or 0-2 or 0-4), and counted.
The chances of none of then going into either is there, but very small.

Ah ok, that makes sense. Now I also understand your code better already. Thanks! +1 from me.

JavaScript (ES6), 78 bytes
Returns a reversed array where empty levels are filled with a space.
t=>(a=[...'     '],g=k=>k?g(k-1,a[Math.random()*(t>59?5:t<45||3)|0]++):a)(1e3)

Try it online!
Commented
t => (                      // t = input
  a = [...'     '],         // a[] = output array, initially filled with 5 spaces
  g = k =>                  // g = recursive function taking an iteration counter k
    k ?                     //   if k is not equal to zero:
      g(                    //     do a recursive call:
        k - 1,              //       decrement k
        a[                  //       update a[]:
          Math.random() * ( //         pick a random slot:
            t > 59 ? 5 :    //           among all 5 slots if t > 59
            t < 45          //           force the 1st slot if t < 45
            || 3            //           among the 3 first slots otherwise
          ) | 0             //         round the above result to an integer
        ]++                 //       increment the wax amount on this slot
      )                     //     end of recursive call
    :                       //   else:
      a                     //     stop recursion and return a[]
)(1e3)                      // initial call to g() with k = 1000

I actually have the same question as the comment I made for the Python answer: Does every state have a non-zero chance of occurring?

@KevinCruijssen Each state has a non-zero chance of occurring, but extreme values have a very low probability. If I did my maths correctly, you are ~$10^{90}$ times more likely to be hit by a meteorite than to get an intermediate empty slot in there. :p

Rofl, nice analogy with the meteorite. ;) I now indeed see that your method is similar to the Python answer in that it puts values in one of the 3 or 5 spots in the array, up to a count of 1000. Nice answer, so +1 from me.

R, 85 84 bytes
function(n)write(ifelse(t<-table(cut(runif(1e3,2*(n<60)+3*(n<45),5),0:5)),t,""),1,1)

-1 byte thanks to @Giuseppe
Try it online!
Explanation (ungolfed):
function(n){
      # Generate 1000 random uniform numbers in [5,5] (if n<45),
      # in [2,5] (if 45<=n<60) and in [0,5] (if n>=60).
    x = runif(1e3,2*(n<60)+3*(n<45),5)
      # Code each by the number of the interval it falls in (0,1],(1,2]...(4,5]
    cx = cut(x,0:5)
      # Tabulate the intervals. Because cut() returns a factor,
      # zero counts are included
    t = table(cx)
      # Vector-wise replace zero elements with "" and cat out, 1 per line.
    t1 = ifelse(t,t,"")
    write(t1,1,1)
}

If NA is allowed as empty line/element, here's a 77 byte solution (Try it online!) or an 80 byte solution (Try it online!) if the element names are a problem

C (gcc), 131, 116, 90, 89, 87 bytes
L(l,a,v,A){for(A=5,v=1e3;A--;v-=a)printf("%d\n"+!a*2,a=l>59|A<3&l>44?rand()%-~v:!A*v);}

Try it online!
Update: Fixed a bug in the original. Fused in the helper function, reducing an additional 15 bytes.
Update 2: -25 bytes thanks to ErikF.
Update 3: -1 byte thanks to ceilingcat.
Degolf
L(l,a,v,A){
    for(A=5,v=1e3;A--;v-=a)
        printf("%d\n"+!a*2, // No clue how this works anymore, but it'll advance the pointer
                            // to the string constant when a number shouldn't be printed.
        a=l>59|A<3&l>44?rand()%-~v // Random integer to print in [0, v]
        :!A*v); // If bottom layer, return remaining volume
}

You can eliminate the puts() by combining the printing into a single printf() and putting the subtraction into the loop end. Also, I think you're allowed to put the srand() initialization into the caller. Try it online!

I realized that I missed the "no zeroes" restriction. Here's the fixed version: Try it online!

Some last tweaks! Try it online!

Great; I golfed it down by an additional byte.

Also, we did it! We beat Python!

05AB1E, 27 26 25 bytes
Saved a byte thanks to Adnan.
Saved another byte thanks to Kevin Cruijssen.
5Å0₄FD„,;ÇI‹O·ÝΩ©è>®ǝ]ε0Û

Try it online!
Explanation
5Å0                         # initialize with a list of 5 zeroes
   ₄F                       # 1000 times do:
     D                      # duplicate the list
      „,;ÇI‹                # check if the input is larger than 44 and/or 59
            O·              # sum and double, yielding (0,2 or 4)
             ÝΩ             # pick a random number between and 0 and the number above
               ©è           # get the count in that level
                 >          # increment it
                  ®ǝ        # insert it at the same position
                     ]      # end loop
                      ε0Û   # remove leading zeroes on each level

Nice answer! I like the way you've used 5Å0 and ǝ, and ε0Û at the end. I tried to come up with something shorter, but I'm unable to. I have the feeling it can somehow still be golfed, but I'm currently not seeing it (perhaps it cannot and it's just a random feeling). •A–•60в is 1 byte longer than 44 59‚ instead of shorter. And ε0Û to replace the 0s with empty strings also seems to be the shortest possible, since 0K simply removes the 0-items completely and 0м removes any digit 0 in all numbers.

@KevinCruijssen: Yeah I've looked and looked to find a shorter way of doing 44 59‚, but I can't find it (•H|•2ô is the same count). My previous solution (also 27 bytes) used 45 and 60 which are easier to generate in different ways, but I think that was invalid as it output 1, 3 or 5 levels depending on input and not always 5.

Ah, •H|•2ô is indeed also a smart way, hadn't thought about that. And it should indeed output 5 lines. I saw your previous answer indeed and was about to comment it only outputted 1 line for n < 45, but then you deleted it. Glad you've found another 27-byte solution. :)

I think ŽH|2ô is what you are looking for?

@Adnan: Oh, nice. I didn't know about Ž, only Ƶ. Thanks :)

@Adnan Oh, never seen Ž used before either. Does that only apply to compressed integers as alternative for •..•? Or does it have some other use cases as well?

@KevinCruijssen It acts exactly like that. Did some research using previous answers using 05AB1E and this was one of the things I added in the rewrite. It does not have any other use cases right now.

@Adnan I've edited my 05AB1E tip about compression to mention it as well. :)

-1 byte by changing ŽH|2ô to „,;Ç. Not sure why I hadn't thought about this before..

@KevinCruijssen: Oh yeah, that's smart. Thanks :)

JavaScript (Node.js), 87 86 bytes
f=(n,w=1e3,s=5,r=n<45|n<60&s<4|s<2?w:Math.random()*w|0)=>s?`${r||""}
`+f(n,w-r,s-1):""

Try it online!
The 83-byte solution ((n/15-2|0)*s<4) is reserved first because I need to check for larger n.
UPDATE: Yeah, (n/15-2|0)*s<4 didn't work because for larger n because n large enough makes the sum fail to reach 1000.

PHP, 92 bytes
$i=5;for($n=1e3;$i--;$n-=$x)echo($x=rand($i?0:$n,$i<($argn<60?$argn<45?:3:5)?$n:0))?:"","
";

Run as pipe with -R or try it online.

Java (JDK 10), 121 117 113 111 bytes
m->{for(int w=1000,j,i=5;i-->0;w-=j=i>0?j*=Math.random():w,System.out.println(j<1?"":j))j=m>59|m>44&i<3?w+1:0;}

Try it online!
It's biased towards putting more wax near the top, but it's theoretically possible for any legal arrangement of wax to appear.
edit: 4 bytes were saved by @KevinCruijssen
In Human-readable Java:
(int minutes /* golfed variable m */) -> {
  int waxRemaining = 1000; // golfed variable w

  // golfed version goes from index 4 to 0 in a bit of a roundabout way
  // starting at 5 but decrementing right away
  for (int level = 4 /* golfed variable i */; level <= 0; level--) {
    // golfed variable j
    // the golfed version initializes this to (waxRemaining + 1)
    // in order to juice out some extra bytes during the Math.random() call
    int waxAtLevel = 0;

    // the golfed version does all of these ifs as ternary operations
    // and avoids using 2-character operators wherever possible
    // so e.g. "a == 0" becomes "a<1" and "a && b" becomes "a&b"
    // since here we are certain things can't be negative,
    // and took a good look at the Java operator precedence cheat-sheet
    // to make sure "&" and "|" would work properly to give a truthy value
    if (level == 0) {
      // if we are at the bottom level, just put the rest of the wax there
      waxAtLevel = waxRemaining;
    } else if (minutes >= 60 || (minutes >= 45 && level < 3)) {
      // otherwise if we are at a legal level put a random portion of the remaining wax there
      // note: the random portion can be between 0 and waxRemaining inclusive
      waxAtLevel = (int) (Math.random() * (waxRemaining + 1));
    }

    if (waxAtLevel > 0) {
      // only print the amount of way at this level if its greater than 0
      System.out.print(waxAtLevel);
    }
    System.out.println();

    waxRemaining -= waxAtLevel;
  }
}

Math.random()*(w+1) can be Math.random()*-~w for -2 bytes. Here the relevant tip as reference why.. Nice answer! +1 from me. EDIT: Actually, 2 more bytes can be saved by using j temporary as variable for w+1 (since it will be overwritten right after in the print anyway) and use j*=Math.random() instead so you won't need the cast to (int) (117 bytes).

@KevinCruijssen nice! Also I just noticed that the &i>2 condition isn't necessary

Clean, 215 bytes
import StdEnv,Math.Random,Text
? ::!Int->Int
?_=code{ccall time "I:I"
}
$n#l=take(max(2*min(n/15-2)2)0+1)(genRandReal(?0))
#l=map toInt[1E3*e/sum l\\e<-l]
|sum l==1000=map(\v|v>0=v<+"\n"="\n")(l++repeat 0)%(0,4)= $n

Try it online!
So I've finally found a shorter way to get a random seed than importing System._Unsafe, System.Time and using toInt(accUnsafe time)...
And boy is it truly in the spirit of codegolf - embedding a call to C, ignoring the world state type normally used to ensure the evaluation order of such things.

Powershell, 188 162 bytes
param($m);$t=0;$a=,0*5;$s=if($m-lt45){4}elseif($m-lt60){2}else{0};$s..4|%{$t+=$a[$_]=if($_-eq4){1e3-$t}elseif($t-ne1e3){Random(1000-$t)}}$a|%{if($_){$_}else{''}}

Try it online!
-2 bytes by @Kevin Cruijssen
-4 bytes by removing optional Get- verb
-20 bytes by shortning loop and removing spaces

Hi, welcome to PPCG! Great first answer! I did some basic testing, and everything seems to work great. I know barely anything about Powershell, but is it possible to change else{if($t-ne 1e3){Get-Random(1000-$t)}} to elseif($t-ne 1e3){Get-Random(1000-$t)}? I see you've used an elseif earlier in your code, so this should save you 2 bytes. Also, maybe Tips for golfing in Powershell or Tips for golfing in  might give some inspiration for more? Enjoy your stay! :)

totally correct about the ifelse. Removed its else counterpart earlier in the process. Link gave some inspiration too!

Pascal (FPC), 192 190 bytes
var n,a:word;z:array[0..4]of word;begin read(n);if n>44then a:=a+3;if n>59then a:=a+2;Randomize;for n:=0to 999do inc(z[random(a)]);for n:=0to 4do if z[n]>0then writeln(z[n])else writeln end.

Try it online!
Using packing into bins method by TFeld. Prints bottom row first with a trailing newline.
It seems that FPC doesn't have problems with random(0), so I have some unusual adding there.

My original submission, golfed down to 209 bytes:
var n,i,a,r:int32;begin read(n);if n>44then a:=a-2;if n>59then a:=a-2;r:=1000;Randomize;for i:=-3to-0do begin if i>a then begin n:=random(r+1);if n>0then write(n);r:=r-n;end;writeln;end;if r>0then write(r)end.

Try it online!

PHP, 113 108 99 97 93 bytes
<?php $i=$argv[1];while($a++<1e3){${r.rand(1,$i<60?$i<45?:3:5)}++;}echo"$r5
$r4
$r3
$r2
$r1";

Try it online!
-11 bytes thanks to @titus
-9 bytes because everything is a string

Jelly, 28 bytes
>“,;‘SḤ‘µȷŻṗS⁼¥ƇȷX;0ẋ5¤ḣ5Yḟ0

A full program printing the result (upside down, as has been allowed).
Try it online! - this is altered to use 7 rather than ȷ (1000) because the implementation is golf-tastically slow! (...for \$n>59\$ a list of \$10^{15}\$ 5-tuples is built and then filtered, from which to choose)
How?
>“,;‘SḤ‘µȷŻṗS⁼¥ƇȷX;0ẋ5¤ḣ5Yḟ0 - Main Link: integer, n
 “,;‘                        - list of code-page indices = [44,59]
>                            - greater than? (vectorises)
     S                       - sum (i.e. 0, 1 or 2)
      Ḥ                      - double (i.e 0, 2 or 4)
       ‘                     - increment (i.e. 1, 3 or 5)
        µ                    - start a new monadic link, call that x (i.e. f(x))
         ȷ                   - literal 1000
          Ż                  - zero-range = [0,1,2,...,1000]
           ṗ                 - Cartesian power (all tuples of length x using those numbers)
               Ƈ             - filter keep if:
              ¥              -   last two links as a dyad:
            S                -     sum
             ⁼  ȷ            -     equals 1000? (i.e. only valid tuples)
                 X           - random choice (get one of these tuples)
                      ¤      - nilad followed by link(s) as a nilad:
                   0         -   zero
                    ẋ5       -   repeat five times = [0,0,0,0,0]
                  ;          - concatenate     (e.g. [354,388,258,0,0,0,0,0])
                       ḣ5    - head to index 5 (e.g. [354,388,258,0,0])
                         Y   - join with newlines
                          ḟ0 - filter out zeros
                             - implicit print

"You are also allowed to reverse the output (I.e. 1000\n\n\n\n instead of \n\n\n\n1000 or [87, null, 913, null, null] instead of [null, null, 913, null, 87])." So yes, you are allowed to use the 28-byte version without the Ṛ.

Charcoal, 37 36 bytes
Ｆ²Ｆ²⊞υ∧‹³⁺ι÷Ｉθ¹⁵‽⊕⁻φ↨υ¹⊞υ⁻φΣυＥυ⎇ιＩιω

Try it online! Link is to verbose version of code. Edit: Saved 1 byte by converting the empty list from base 1 instead of trying to sum it. Explanation:
Ｆ²Ｆ²

Loop twice, twice. Alternatively I could have integer divided the loop index by 2 for the same byte count.
‹³⁺ι÷Ｉθ¹⁵

If the outer index plus a fifteenth of the temperature is greater than three...
⊞υ∧...‽⊕⁻φΣ∨υω

... then push a random integer up to and including 1000 - the sum so far. Unfortunately Charcoal can't calculate the sum of an empty list so I have to convert from base 1 instead.
⊞υ⁻φΣυ

Push the leftover amount to the list. (The sum is safe here because the list is no longer empty.)
Ｅυ⎇ιＩιω

Convert the list to string, but use the empty string instead of zero.

Perl 6, 62 bytes
{($!=1e3)||@,|((+$!-($!-=$!.rand+|0)||@)xx($_/15+|0)*2-4)[^4]}

Try it online!
An anonymous code block that takes a string and returns a list of integers, with Nil or an empty list ([]) in place of 0s.
Explanation:
{($!=1e3)||@,|((+$!-($!-=$!.rand+|0)||@)xx($_/15+|0)*2-4)[^4]}
{                                                            }  # Anonymous code block
 ($!=1e3)  # Initialise $! to 1000
                +$!-($!-=$!.rand+|0)     # Pick a random value from 0 to $!
                                    ||@  # Or an empty array if it is zero
            ,  (                       )xx  # Repeat this
                                          ($_/15+|0)*2-4  # The given value mapped to 0,2,4
             |(                                         )[^4] # Get the first four values
 ($!    )||@  # Where the first value is the leftover number in $! or an empty array

Twig, 126 bytes
This was an actually fun challenge!
This code creates a macro that has to be imported.
{%macro a(s,z=1000)%}{%for _ in 4..1%}{%set t=s>59or(s>44and _<3)?random(z):''%}{%set z=z-t%}{{t}}
{%endfor%}{{z}}{%endmacro%}

To import it, just do this:
{%- import 'macro.twig' as a -%}
{{- a.a(50) -}}

This should do the trick.
You can try it on https://twigfiddle.com/t4dfgy
Notice: Due to the page removing whitespaces, I was forced to add an - at the end of the line, to prove that it is outputting the correct number of lines.
On a regular installation, you would just see the newlines without issues.

J, 56 55 54 48 43 40 bytes
5{.1e3(2<@-/\[,0,~[:\:~?@$~)2*1#.>&44 59

Try it online!
-3 bytes thanks to FrownyFrog

Another conceptually nice method that's a bit longer but guarantees perfectly uniform distribution over all possibilities, per the method here:
J, 53 bytes
5$!.a:[:<@(+/);._1 0:,(1e3#1)({~#?#)@,0$~2*1#.>&44 59

Try it online!

Isn't $!.a: just {.?

@FrownyFrog Thanks.  I had forgotten that taking more elements than are available results in "zero" fill.

PowerShell, 115 105 98 bytes
-17 bytes thanks to mazzy
$a=,0*5
45,60-ge"$args"|%{$i+=2}
$i..4|%{$t+=$a[$_]=random(1001-$t)}
$a[4]+=1e3-$t
$a|%{"$_"*!!$_}

Try it online!
A golf of Edwin's lovely answer. If you like this, upvote him.

nice. a bit more golf Try it online!

golf again 98 bytes

Ruby, 62 55 bytes
->n{w=1000;[4,4,3,3].map{|r|r*15>n||w-=q=rand(w);q}<<w}

Try it online!
Tests are limited to 0-99 degrees, because lava lamps could be dangerous at higher temperatures:

Hi there. I'm afraid your answer is invalid. It currently has 0 for the empty lines. The empty lines in the array can be anything except for 0, false or a negative number. So it can be null, "", [], etc., but not 0. Not sure if Ruby has object-arrays/lists so you can transform the 0s to something else, but if not you'll have to print them instead of returning an array/list.

Fixed, but I think it's a little too arbitrary.

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


text:
What is the simplest reversible circuit that computes conjugacy of transpositions?
Reversible computation refers to computation in which little or no information is deleted. Reversible computation a major component of quantum computation, and reversible computation is potentially many times more energy efficient than conventional computation. I want to know how easy it is to compute the conjugacy of transpositions reversibly?
Challenge
Let T5 be the set of all transpositions on the set {1,2,3,4,5}. Let  be the conjugacy operation on T5 defined by x * y=xyx^(-1) (here concatenation denotes the symmetric group operation). In other words, the underlying set of T5 consists of all 10 pairs (a,b) of distinct numbers from {1,2,3,4,5} and where we declare (a,b)=(b,a). The operation  is the unique operation on the underlying set that satisfies

(a,b) * (c,d)=(c,d),
(a,b) * (b,c)=(a,c),
(a,b) * (a,b)=(a,b)

whenever a,b,c,d are distinct.
What is the simplest n bit input reversible circuit C along with an injective function R:T5->{0,1}^(n/2) such that C(R(x)||R(y))=R(x)||R(x*y) for all x,y in T5?
The gate cost of a reversible circuit shall be the sum of the costs of every individual logic gate in the reversible circuit.
Here is the price chart per logic gate (see this link for a description of the logic gates) along with a description of the reversible gates.
Each SWAP gate (x,y)->(y,x) will have a cost of 0.
Each NOT gate x-> NOT x shall have a cost of 1.
Each CNOT gate (x,y)->(x,x XOR y) shall have a cost of 2.
Each Fredkin gate (x,y,z)->(x,(NOT x AND y) OR (x AND z),(x AND y) OR (NOT x AND z)) shall have a cost of 4 (the Fredkin gate can also be described as the reversible logic gate where (0,x,y)->(0,x,y) and (1,x,y)->(1,y,x)).
Each Toffoli gate (x,y,z)->(x,y,(x AND y) XOR z) shall have a cost of 5.
No other gates are allowed.
Observe that each reversible gate has the same number of inputs as it has outputs (this feature is required for all reversible gates).
The complexity of your circuit will be the product of the gate cost or your circuit with the number n which you choose. The goal of this challenge will be to minimize this measure of complexity.
Format
Complexity: This is your final score. The complexity is the product of the number n with your total gate cost.
Space: State the number n of bits that your circuit C acts on.
Total gate cost: State the sum of the costs of each of the individual gates in your circuit C.
NOT gate count: State the number of NOT gates.
CNOT gate count: State the number of CNOT gates.
Toffoli gate count: How many Toffoli gates are there?
Fredkin gate count: How many Fredkin gates are there?
Legend: Give a description of the function R. For example, you may write
(1,2)->0000;(1,3)->0001;(1,4)->0010;(1,5)->0011;(2,3)->0100;
(2,4)->0101;(2,5)->0110;(3,4)->0111;(3,5)->1000;(4,5)->1001
.
Gate list: Here list the gates in the circuit C from first to last. Each gate shall be written in the form [Gate type abbreviation,lines where the gates come from]. For this problem, we shall start with the 0th bit. The following list specifies the abbreviations for the type of gates.
T-Toffoli gate
S-Swap gate
C-CNOT gate
F-Fredkin gate
N-Not gate.
For example, [T,1,5,3] would denote a Toffoli gate acting on the 1st bit, the 5th bit, and the 3rd bit. For example, [T,2,4,6] produces the transformation 01101010->01101000 and [C,2,1] produces 011->001,010->010 and [N,3] produces 0101->0100. For example, one could write
[S,7,3],[N,2],[T,1,2,3],[F,1,2,5],[C,7,5]
for the gate list.
The gates act on the bit string from left to right. For example, the gate list [C,0,1],[C,1,0] will produce the transformation 01->11.
Sample answer format
Complexity: 128
Space: 8
Total gate cost: 16
NOT gate count: 3
CNOT gate count: 2
Toffoli gate count: 1
Fredkin gate count: 1
Legend: (1,2)->0000;(1,3)->0001;(1,4)->0010;(1,5)->0011;(2,3)->0100;
(2,4)->0101;(2,5)->0110;(3,4)->0111;(3,5)->1000;(4,5)->1001
Gate list: [N,1],[N,0],[N,3],[S,1,2],[S,2,3],[C,0,1],[C,2,3],[T,3,2,1],[F,2,3,1]
The sample answer format is not a solution to the problem but is a template for the format for a solution.

@user202729 R is just the I/O format. You choose 10 distinct, consistent values for the transpositions.

By the way, the post format is way too strict, and not very readable. I guess you have a verifier, in that case can you post that?

I am still working on the verifier. I will post it as soon as possible.

I might be mistaken, but isn't the function f((x, y)) = (x, x * y) an involution? f((x, y)) = (x, xyx^(-1)), f(f(x, y)) = (x, x(xyx^(-1))x^(-1)) = (x, x^2yx^(-2)) = (x, y). If so, just have paired elements differ on two bits; have one with 01, and the other with 10, or 00 for elements mapping to them-self. Then you only need a single swap gate.

@user1502040. You are right. I need to edit the question once again. I apologize for my sloppiness.

I don't understand the question. What is a transposition? Just swapping one pair of elements? I don't understand the * operation.

@orlp. Yes. A transposition is a pair of element. The element (a,b)*(c,d) is the pair where we swap a for b in the second pair (c,d).

I didn't read the three rules correctly, and that part makes sense now.

You say your circuit has a space cost of 5, but your codes are 4-bits long. Doesn't this mean your cost should be 8?

What does || represent?

@WW  '||' means concatenation.

Maybe you should mention that the sample answer doesn't solve problem but provide format

Is verifier ready?

I have verified that your circuit is correct.

640 480
Complexity: 480
CSWAP count: 12
Legand: (1,2)->11000, (1,3)->10100, ..., (4,5)->00011
Gate:
[1,6,7],
[3,6,8],[3,6,7],
[4,6,9],[4,6,7],
[5,6,10],
[SWAP,6,7],
[5,6,10],
[4,6,7],[4,6,9],
[3,6,7],[3,6,8],
[1,6,7]

Use 6 and 7 as a stack to push the two mentioned pairs, then swap them and pop back. the chosen one of 6 or 7 is initially on stack top, if the other isn't

4 bit would lead to score 576

This is standard notation


text:
A Chiral Puzzle
A shape is chiral if no amount of rotation can make it look like it's mirror image.  In this puzzle we will be writing chiral computer programs.
For this puzzle we will think of a program as a rectangular matrix of characters.  As such all solutions to this challenge must be rectangular (that is all lines must be of the same length).  We can rotate these programs in quarter turn increments. For example the program
The quickish fish
    lept deftly
  rightwards

When rotated a quarter turn clockwise looks like
  T
  h
r e
i
glq
heu
tpi
wtc
a k
rdi
des
sfh
 t
 lf
 yi
  s
  h

We can also reflect these programs.  Here is the same program reflected over a vertical axis:
hsif hsikciuq ehT
  yltfed tpel
    sdrawthgir

A chiral program is a program that when rotated any number of times will always output "left".  However when reflected produces a program that outputs "right" no matter how many times it is rotated.
Your task is to write a chiral program in as few bytes as possible.
Additional Rules

Output is not-case sensitive but should be consistent. (e.g. You may output "LEFT" and "rIgHt" but this casing must be consistent under rotations)
Lines are to be split either on a newline or a newline and a linefeed.
Your program must be a rectangle, you can pad it with spaces or comments but each line must have the same length.
You may optionally have a trailing newline (or newline and linefeed) on all of your programs if you wish.

Does anyone have a program that can autorotate its' input, cause that would at least make the process of creating all of this easier

@KrystosTheOverlord I used this together with Vim's block commands and :set virtualedit=all mode. The initial Bool output checks if the input is equal to its own rotation, which simplifies things. Removing the {- makes it print the reflected input.

@ØrjanJohansen Thank you, that really helps, up until now, I have been turning the screen of my laptop, thinking of what the outcome would be and trying to figure out how to rotate it!!!

Pascal (FPC), 2161 755 349 bytes
///////bw(,,),(wb///////
///////er'''e''re///////
begin//girgtnflig//nigeb
write//itih'dteti//etirw
('le'//ne'' .''en//'ir'(
,'ft'//////////////'hg',
)end.////////////// 't',
,'t' //////////////.dne)
,'gh'//////////////'tf',
('ri'//ne''. ''en//'el'(
write//itetd'hiti//etirw
begin//gilfntgrig//nigeb
///////er''e'''re///////
///////bw(,),,(wb///////

Try left
Try right
@tsh motivated me to try again when I saw his program (in comment) and here it is!

Previous one with 755 bytes:
 begin write('left')end.//
/e .dne)'thgir'(etirw nigeb
/g                        e
.i                       .g
dn                       di
n                        nn
ew                       e
)r                       )w
'i                       'r
tt                       ti
fe                       ht
e(                       ge
l'                       i(
'r                       r'
(i                       'l
eg                       (e
th                       ef
it                       tt
r'                       i'
w)                       r)
 e                       we
nn                        n
id                       nd
g.                       i.
e                        g/
begin write('right')end. e/
 //.dne)'tfel'(etirw nigeb

Try left
Try right
If you saw my previous submission, just forget it :)
All rotations for both left and right programs are the same.

450 bytes

I know those mirrored brackets are correct, but they still upset me.

It looks like a framed mirror!

@tsh Excellent idea! You motivated me to find better layout.

299 bytes

Klein (000), 109 87 bytes
."left"@\.
\"right"..
@"thgir">.
..@"tfel"\
\"left"@..
.>"right"@
.."thgir"\
.\@"tfel".

Try it online!
Should be possible to get a shorter version of this answer so good luck!
This answer is inspired by spirals.  In particular the idea is two interlocked spirals, one for left and one for right. It has two fold symmetry,  So we can check the following programs to know it works:
Quarter turn
...\.@\.
\.>"."""
@""l@trl
"tre"hie
thiftggf
fggtfiht
eih"ert"
lrt@l""@
""".">.\
.\@.\...

Try it online!
Mirrored
.\@.\...
""".">.\
lrt@l""@
eih"ert"
fggtfiht
thiftggf
"tre"hie
@""l@trl
\.>"."""
...\.@\.

Try it online!
Mirrored and Quarter turn
.\@"tfel".
.."thgir"\
.>"right"@
\"left"@..
..@"tfel"\
@"thgir">.
\"right"..
."left"@\.

Try it online!

Klein (000), 27 25 bytes
\(("right"@/
\(("left"@!\

Try it online! Rotated once! Rotated twice! Rotated three times!
And flipped: Try it online! Rotated once! Rotated twice! Rotated thrice!
The only one that gave me a bit of trouble was the flipped and rotated once, which looks like:
\/
!@
@"
"t
th
fg
ei
lr
""
((
((
\\

This is the only reason for the two sets of ((.

JavaScript (Node.js), 1481 599 505 461 341 305 271 bytes
/g+///g/g"c.c"g/
g=//////=rolol=g
"left"///inone/+
console//gsgsf//
.log(g)//ho(ot//
console//tlgl"//
"right"//"e)e//g
g=//////////////
//////////////=g
g//e)e"//"thgir"
//"lglt//elosnoc
//to(oh//)g(gol.
//fsgsg//elosnoc
+/enoni///"tfel"
g=lolor=//////=g
/g"c.c"g/g///+g/

Mirrored
/g"c.c"g/g///+g/
g=lolor=//////=g
+/enoni///"tfel"
//fsgsg//elosnoc
//to(oh//)g(gol.
//"lglt//elosnoc
g//e)e"//"thgir"
//////////////=g
g=//////////////
"right"//"e)e//g
console//tlgl"//
.log(g)//ho(ot//
console//gsgsf//
"left"///inone/+
g=//////=rolol=g
/g+///g/g"c.c"g/

Try it online!
(Please see the TIO Link for all test cases, including mirrored version)
Although further golfed, size 22x22 -> 21x21 on credit of @JoKing!
Size 38x38 24x24 22x22 21x21 18x18 17x17 16x16, 4-fold symmetry.
Here comes a question -- is it possible to have 15x15 or smaller for JS? It seems that what I need at least is the comment separator between two sub-blocks and at the edge, so at least 7+2+2+5=16 lines?

@JoKing Oh that seems practicable. I'd have a try ;)

@JoKing Got down to 21x21, thanks ;)

Klein (211), 37 bytes
!\"left"@"thgir"\!
!/............../!

This has a different program for each rotation.
Explanation
Note that each of these programs is padded to a square with no-ops before execution
No change
!\"left"@"thgir"\!
!/............../!

Try it online!
! makes execution jump over the \ and "left"@ loads the string "left" into the stack and terminates the program printing the stack
Quarter turn
!!...IP->
\/
".
r.
i.
g.
h.
t.
".
@.
".
t.
f.
e.
l.
".
\/
!!
^
|
P
I

Try it online!
Execution runs off the top right corner of the square, continues in the bottom left corner and once again !\"left"@ prints "left.
Half turn
                ^
                |
                P
                I
!/............../!
!\"right"@"tfel"\!
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
..................
................^.
................|.
IP->............P.
................I.

Try it online!
Here, the execution path exits from the North side, re-enters through the West side, exits again from the East Before entering in the south. \ bounces the path into "left"@ to print it.
Three-quarter turn
!!..IP->
/\
."
.l
.e
.f
.t
."
.@
."
.t
.h
.g
.i
.r
."
/\
!!
^
|
I
P

Try it online
Execution exits from the top right corner then re-enters in the bottom left. Once again the mirrors /\ redirect the path into "left"@ to print it.
Reflection
!\"right"@"tfel"\!
!/............../!

This is essentialy the same as for left in all rotations.

Canvas, 109 89 71 bytes
（tfel⁸（（
（h（right
⁸g   q（f
li    re
er    il
f（    g⁸
thgir（h（
（（⁸left（

Try it here | Try reversed! Those are the only two possible programs, as the program is rotationally symmetric.
Made in this.

What an empty canvas over there... :/

Gol><>, 23 bytes
\"thgir"H /
\"tfel"H.9\

Try it online!
This is the same format as my Klein answer, but 2 bytes shorter. Maybe there's another 2D language out there that can golf those last 2 bytes off... But for now, this is as short as it gets.

oof, I just spent the past hour making this in gol><>, then I scroll down to find this. Good job though!

Ruby, 131 bytes
#######:$:#
:right#l>r#
$><<###e<i#
:left##f<g#
####   t#h#
#t##   ##t#
#h#t   ####
#g<f##tfel:
#i<e###<<>$
#r>l#thgir:
#:$:#######

Try it online!

Hexagony, 98 bytes
\.@.t;./r.
.)@.;...;.
ll..)gt.;$
;.i<;;;i);
e;@.)@e;.l
.;e;d.g|.|
rt/;t.;)g\
@f.#l.;..r
\.;\.;i\.i

Try it online! | Rotated 90° | Rotated 180° | Rotated 270°
Reversed | Rotated 90° & Reversed | Rotated 180° & Reversed | Rotated 270° & Reversed
Hexagony was kind of fun for this challenge, because a rotation or a reversal can drastically change the actual program. Each Rotation/Reversal is its own unique program. Some of the program execution paths are much more interesting than others.
I will admit that coming up with this took longer than it probably should have. I am pretty sure a shorter answer can be done in Hexagony, so good luck!

APL (dzaima/APL), 181 bytes
The program has rotational symmetry so only two cases need to be checked

Left
⍝⍝⍝⍝⍝⍝⍝  t⎕t⍝
t←'lef'⍝ ←←←⍝
⎕←t,     't'⍝
t←'righ'⍝r,l⍝
   ⍝     i e⍝
 ⍝ '     g f⍝
⍝' h     h '⍝
⍝f g     t ⍝
⍝e i     ⍝
⍝l,r⍝'hgir'←t
⍝'t'     ,t←⎕
⍝←←← ⍝'fel'←t
⍝t⎕t  ⍝⍝⍝⍝⍝⍝⍝

Try it online!
Right
⍝t⎕t  ⍝⍝⍝⍝⍝⍝⍝
⍝←←← ⍝'fel'←t
⍝'t'     ,t←⎕
⍝l,r⍝'hgir'←t
⍝e i     ⍝
⍝f g     t ⍝
⍝' h     h '⍝
 ⍝ '     g f⍝
   ⍝     i e⍝
t←'righ'⍝r,l⍝
⎕←t,     't'⍝
t←'lef'⍝ ←←←⍝
⍝⍝⍝⍝⍝⍝⍝  t⎕t⍝

Try it online!
Explanation
This is my first APL program so it is pretty simple.  It only uses one trick that I think is interesting.
If we start by stripping away all the comments we get the following programs
Left
t←'lef'
⎕←t,     't'
t←'righ'

Right
t←'righ'
⎕←t,     't'
t←'lef'

Starting from the left program we do three things.

Assign 'lef' to the variable t
Print the variable t and the letter 't'
Assign 'righ' to the variable t

Now because it is the mirror the right program does these three steps but in the opposite order.  This means that we print 'left' for the left program and 'right' for the right program.
The one trick here is that the 't' actually comes from a rotated copy of the code.  If you look at the third colum of our code you will see that it is 't'.  We reuse this 't' in the rotated versions to append the t that is needed.

Alice, 25 bytes
}/"regttoo {
{/"lifh""@@{

Left: Normal, 1/4 turn clockwise, 1/2 turn, 1/4 turn counterclockwise
Right: reflect across horizontal axis, down-right diagonal, vertical axis, up-right diagonal
Explanation
This program has three parts.  The first part is the three {s and one } on the corners.  The { turn the IP left until it reaches the }, at which point it turns right.  In the reflected version, the IP goes along the top row in the original program.  In the original version, turning right will immediately hit the adjacent {, pointing the IP along the bottom row in the original program.
Next are the two slashes in the second column.  If the program is horizontally oriented, either type of slash would simply change to ordinal mode, sending the IP in the same left/right direction it was already going.  If the program is vertically oriented, the IP bounces around quite a bit more, but making them both forward slashes gives the same end result.  (Two backslashes would give the opposite result, and one of each would create an infinite loop.)
The rest of the program is straightforward.  The IP in ordinal mode bounces diagonally, so either "left"o@ or "right"o@ will be run depending on how this section was entered.

Haskell, 461 379 bytes
82 bytes saved by Ørjan Johansen
--_----------mppr--
-- ----------a  l--
rl=p  p--   niam= _
p m="left"-- n==p--
p a="right"++ "" --
main  =putStr rl --
--n +r       =iep--
-- -+t       pgf---
-- -"S       uht---
-- "tt       tt" --
---thu       S"- --
---fgp       t+- --
--pei=       r+ n--
-- lr rtStup=  niam
-- "" ++"thgir"=a p
--p==n --"tfel"=m p
_ =main   --p  p=lr
--l  a---------- --
--rppm----------_--

Try it online!
Since this one has 4-fold symmetry you only need to test the mirror:
--rppm----------_--
--l  a---------- --
_ =main   --p  p=lr
--p==n --"tfel"=m p
-- "" ++"thgir"=a p
-- lr rtStup=  niam
--pei=       r+ n--
---fgp       t+- --
---thu       S"- --
-- "tt       tt" --
-- -"S       uht---
-- -+t       pgf---
--n +r       =iep--
main  =putStr rl --
p a="right"++ "" --
p m="left"-- n==p--
rl=p  p--   niam= _
-- ----------a  l--
--_----------mppr--

Try it online!
This is a start.  It is far from ideal, but there are a few interesting things going on here.  Haskell is a certainly an interesting language for this challenge.  I look forward to an answer that beats this be it mine or someone else's.

Shortened this to 379 bytes (19x19)

Python 2, 209 bytes (14 x 14)
Normal (left):

##########sps#
s="left"##=r=#
print s###"i"#
s="right"#rnl#
####      ite#
###"      g f#
#"#t      hst#
#tsh      t#"#
#f g      "###
#eti      ####
#lnr#"thgir"=s
#"i"###s tnirp
#=r=##"tfel"=s
#sps##########

Try it online!
Reflected (right):

#sps##########
#=r=##"tfel"=s
#"i"###s tnirp
#lnr#"thgir"=s
#eti      ####
#f g      "###
#tsh      t#"#
#"#t      hst#
###"      g f#
####      ite#
s="right"#rnl#
print s###"i"#
s="left"##=r=#
##########sps#

Try it online!

Vyxal, 55 bytes
####‛‛#
‛⟑ǒ#¬⟑#
‛¬ẋ#ẋǒ#
#######
#ǒẋ#ẋ¬‛
#⟑¬#ǒ⟑‛
#‛‛####

Try it Online! | Try it flipped
The code is rotationally symetrical.

Prolog (SWI), 649 188 bytes
Unflipped, Unrotated
:-%    l :%r     %-:
write(%e%-(i %(etirw
left).%f.weg%.)right
%      t)rth.      %
%      )tiit)      %
%      .htr)t      %
right).%gew.f%.)left
write(% i(-%e%(etirw
:-%     r%: l    %-:

Try it online!
Unflipped, Rotated
:wr%%%lw:
-ri   er-
%ig   fi%
 th   tt
 et   )e
 ()   .(
 %.   %%
  %.)tfel
right).%
%(etirw-:
:-write(%
 %.)thgir
left).%
 %%   .%
 (.   )(
 e)   re
 tl   it
%ie   gi%
-rf   hr-
:wt%%%tw:

Try it online!
Flipped, Unrotated
:-%     r%: l    %-:
write(% i(-%e%(etirw
right).%gew.f%.)left
%      .htr)t      %
%      )tiit)      %
%      t)rth.      %
left).%f.weg%.)right
write(%e%-(i %(etirw
:-%    l :%r     %-:

Try it online!
Flipped, Rotated
:wl%%%rw:
-re   ir-
%if   gi%
 tt   ht
 e)   te
 (.   )(
 %%   .%
left).%
 %.)thgir
:-write(%
%(etirw-:
right).%
  %.)tfel
 %.   %%
 ()   .(
 er   )e
 ti   lt
%ig   ei%
-rh   fr-
:wt%%%tw:

Try it online!

Prolog (SWI), 239 223 209 181 bytes
%%%%%%%  l:r%
right).% e-i%
:-write(%fwg%
left).%  trh%
  %      )it%
 %(      .t)%
%.e%     %e.%
%)t.      (%
%ti)      %
%hrt  %.)tfel
%gwf%(etirw-:
%i-e %.)thgir
%r:l  %%%%%%%

Try it online!
Since the program has 4 fold symmetry you only need to check the mirror:
%r:l  %%%%%%%
%i-e %.)thgir
%gwf%(etirw-:
%hrt  %.)tfel
%ti)      %
%)t.      (%
%.e%     %e.%
 %(      .t)%
  %      )it%
left).%  trh%
:-write(%fwg%
right).% e-i%
%%%%%%%  l:r%

Try it online!

Clean, 1331 1055 bytes
-276 bytes thanks to Ørjan Johansen
// ////////////;/;/////////// //
// ////////////S/S/////////// //
  module m////mtmt////m eludom
//o///////////=a=a///////////o//
//d///////////"r"r///////////d//
//u///////////tttt///////////u//
//l///////////f#h#///////////l//
//e///////////emgm///////////e//
// ///////////loio/////////// //
//m///////////"drd///////////m//
//////////////=u"u//////////////
//////////////ml=l//////////////
//////////////#eme//////////////
////////////// =#=//////////////
;Start#module= 0   #m="left"=m//
//m="thgir"=m#   0=eludom#tratS;
;Start#module=0   #m="right"=m//
//m="tfel"=m#   0 =eludom#tratS;
//////////////=#= //////////////
//////////////eme#//////////////
//////////////l=lm//////////////
//////////////u"u=//////////////
//m///////////drd"///////////m//
// ///////////oiol/////////// //
//e///////////mgme///////////e//
//l///////////#h#f///////////l//
//u///////////tttt///////////u//
//d///////////r"r"///////////d//
//o///////////a=a=///////////o//
  module m////tmtm////m eludom
// ///////////S/S//////////// //
// ///////////;/;//////////// //

Try "left" online!
Try "right" online!
This was difficult for many reasons:

Clean requires a file header module <filename> be present at the start, and only the start of the file. Unfortunately, this means that for the rotations of the mirrored program to be valid it also has to appear at the bottom of the file. To make this worse, module .. is invalid for global, let .. in, where .. and with .. definitions; and the token module appearing if it hasn't been defined causes an error.
Both block comments and line comments nest: /* /* */ leaves one level of comment open, and so does /* // */ (as well as commenting the rest of the line out).
The same function can be defined multiple times, but only directly after itself.

Fortunately, we can define module as something in a #.. (let-before) expression, which is all we need. Because Clean doesn't type-check alternatives that are never used (and a variety of other equally unused things), the requisite second definition of Start can be complete garbage. This allows us to use the second Start to consume the module header at the bottom of the file because Clean treats m module m as calling the function m on module and m (which since we've defined module and m, doesn't cause an error). It doesn't matter that m is a string and not a function, because the Start alternative never gets type-checked.
This is easier to see if you look at it through the compiler's eyes:
module m;
Start#module=0#m="left"=m;
Start#module=0#m="right"=m module m

1055 merging m and s.

@ØrjanJohansen Oooh nice catch!

Brachylog, 341 bytes
Ẹw"thgir"∧"left"wẸ
w"              "w
"                "
t                t
f                h
e                g
l                i
"                r
∧                "
"                ∧
r                "
i                l
g                e
h                f
t                t
"                "
w"              "w
Ẹw"tfel"∧"right"wẸ

Try it online!
!enilno ti yrT
Takes advantage of Brachylog taking the main predicate to be the one on the first line and not much caring about the other lines beyond requiring that they can compile. Unreflected, it prints an empty string followed by "left" on the same line, and reflected it prints an empty string followed by "right" on the same line. I'm tempted to think there might be a way to make a (usefully) non-square version using ṇ, but that might be plenty tricky without trying to make it work differently under reflection.

Ruby, 181 bytes
#########tpt#
t=:left##=u=#
puts t###:t:#
t=:right#rsl#
####     i e#
###t     gtf#
#t#h     h#t#
#ftg     t###
#e i     ####
#lsr#thgir:=t
#:t:###t stup
#=u=##tfel:=t
#tpt#########

Try it online!
This is a port of Curtis Bechtel's Python answer to Ruby, golfed a little more.
Actually, his Python program is a polyglot and runs on Ruby too, so my first answer was a copy-paste of it, but it seemed unfair. So I wrote a script that generates a new answer starting from a base script. You can try it here:
Build your own

05AB1E (legacy), 89 55 bytes
'…¸q©ƒ'
ƒ     …
©     ¸
q     q
¸     ©
…     ƒ
'ƒ©q¸…'

Very basic approach. Outputs in full lowercase.
Try it online or try it online reflected (each rotation is the same).
Explanation:
'…¸   '# Push the dictionary string "left" to the stack
   q   # Stop the program (and output the top of the stack implicitly)
       # Everything else after it is ignored

Reversed:
'ƒ©   '# Push the dictionary string "right" to the stack
   q   # Stop the program (and output the top of the stack implicitly)
       # Everything else after it is ignored

See this 05AB1E tip of mine (section How to use the dictionary?) to understand why '…¸ is "left" and 'ƒ© is "right".

Are the ignored commands really no-ops, or just never reached because of the  q?

@ØrjanJohansen Second indeed, they are never reached. So technically not really no-ops (which is the term I usually use for all code that's ignored in my answers). This also doesn't work in the new version of 05AB1E, because it seems to look at the code first (sort of compile), and only then executes. Whereas the Legacy version just starts executing I think. Which is why I specified I've used the (legacy) version of 05AB1E.

Stax, 131 bytes
 .Cq"tfel"
""`KT?`qC".
lC       `C
eq       Kq
f`       T"
t?       ?t
"T       `f
qK       qe
C`       Cl
."Cq`?TK`""
 "left"qC.

Run and debug it
This is the "right" variant.

Batch, 438 321 bytes
:::::::::::::@@@:
@echo left&: eee:
@exit/b&:    cxc:
@echo right&:hih:
:  :         oto:
:: &          / :
:& t         rbl:
:t h         i&e:
:f:g         g:f:
:e&i         h t:
:lbr         t &:
: /          & ::
:oto         :  :
:hih:&thgir ohce@
:cxc    :&b/tixe@
:eee :&tfel ohce@
:@@@:::::::::::::

Explanation: A : is used to indicate a label, which is as good as a comment, so as the program has rotational symmetry the only difference between the two versions is which of the @ lines is first, in which case either left or right is output before the script exits.
I did try creatively overlapping the rotated lines with each other but my attempt actually ended up with a larger grid.
Edit: Saved 117 bytes thanks to @ØrjanJohansen.

I think you can replace &rem  by &:.

@ØrjanJohansen I seem to remember trying that before on a similar challenge, but I don't think it worked well.

This (don't mind the Haskell, TIO doesn't seem to have Batch) worked for me as test.bat in the Win10 command prompt.

@ØrjanJohansen Fair enough, it might have been a bug in a previous version of CMD.EXE or something.

Runic Enchantments, 116 bytes
> \ !U\L
 ...@..
 \.R"""
 @""trl
 "lrhie
 teiggf
 ffgiht
 ethrt"
 l"t""@
 " "R.\
 .\@.@.
DR\!!/R
     !!

Try it online!
And reversed
Not exactly a port, but utilized Post Left Garf Hunter's Klein 000 answer as a starting point, given the typical near-compatibility of the two languages (most commands are the same and the edge wrapping in Runic is identical to Klein 000). The only issue was that Klein IPs always start from the top left and Runic's do not. As such the . are all part of the original code and still treated as NOP by Runic, while the  are NOPs I had to add as part of controlling the flow.
Prints "left" in all 4 rotations and "right" when mirrored (and in all four rotations thereof). Two middle columns were completely unused after my modifications, so I was able to remove them.
In theory a rotation with lots of trailing whitespace could be used for a lower byte count (eg. this variant), however the spaces are needed to correctly rotate the structure using external tools and so I included them.
Below variants contain the unused chunks that were removed, but are otherwise identical:
All four lefts. Outputs leftleftleftleft (the fact that all four can be run like this is coincidence).
Right 1, Right 2, Right 3, Right 4

Gol><>, 342 bytes
 8A_          _A8
9       ""       9
A       LR       A
_       EI       _
        FG
        TH
        "T
         "
 "TFEL" HH"RIGHT"
 "THGIR"HH "LEFT"
        "
        T"
        HT
        GF
_       IE       _
A       RL       A
9       ""       9
 8A_          _A8

Wow! That took longer than I expected, halfway through I realized the reflection was vertically, not horizontally like I had been coding for! I'm pretty sure that this works, but if I made a mistake please let me know. This can most likely be golfed a ridiculous amount more, I just took an extreme brute force method to do so. The shape itself is actually a square, it is technically symmetric, except on across the x-axis, so when it flips, it returns "RIGHT" instead!!!
The character that made this program possible is the 'A', which allows for teleportation to the beginning of a certain line!
Try it online!

Vertical and horizontal reflection shouldn't make a difference since they are the same after a rotation.

@TRITICIMAGVS Huh, didn't think of that, thanks for pointing that out, also I just realized this entire thing is pointless, JoKing made one that was 27 bytes in size

Eh, I think it is always worth it if you enjoyed the process.