text:
579085261 is CRAZY, 725582 is GOLF, 10757494 is ...?
Your task is to translate a 103-smooth number into an English word, using the method described below.
How?

Generate the list of prime factors (with repetition) of the input number.
Sort the list:

If 2 is not one of the prime factors, sort the list in ascending order.
If 2 is one of the prime factors, remove it from the list and sort the remaining factors in descending order.

Translate each factor into a letter, using the following table:
 3 = S   13 = L   29 = X   43 = O   61 = Z   79 = H  101 = K
 5 = P   17 = Q   31 = N   47 = R   67 = T   83 = V  103 = Y
 7 = M   19 = U   37 = C   53 = A   71 = E   89 = D
11 = F   23 = I   41 = W   59 = G   73 = J   97 = B

Note: This table was built empirically to maximize the number of possible words. For the curious, here is a list of 2,187 words that can be encoded that way (may include rude language). It's definitely not guaranteed to be optimal, but it's good enough for this challenge.
Examples
Example 1: 579085261 (ascending order)

The prime factors are [ 37, 47, 53, 61, 103 ].
2 is not a prime factor, so we keep the list sorted in ascending order.
37 = C, 47 = R, etc. The output is "CRAZY".

Example 2: 725582 (descending order)

The prime factors are [ 2, 11, 13, 43, 59 ].
2 is a prime factor, so we remove it and sort the list in descending order, which gives:
[ 59, 43, 13, 11 ].
59 = G, 43 = O, etc. The output is "GOLF".

Example 3: 10757494 (with a repeated factor)

The prime factors are [ 2, 11, 71, 71, 97 ].
2 is a prime factor, so we remove it and sort the list in descending order, which gives:
[ 97, 71, 71, 11 ].
97 = B, 71 = E, 11 = F. The output is "BEEF".

Clarifications and rules

The input number is guaranteed to be 103-smooth and divisible by 2 at most once.
By definition, a smooth-number is a positive integer.
Input and output can be handled in any reasonable format. The output can be in lowercase or uppercase. Trailing whitespace is acceptable. Leading whitespace is not.
If your program/function can't support large inputs, please specify it in your answer.
This is code golf, so the shortest answer in bytes wins.

Test cases
34874          --> ARM
483254         --> BAR
353722         --> EAR
494302         --> EGG
39061          --> FAT
6479           --> FUN
60421          --> ICE
54166          --> JAM
48911474       --> BETA
2510942        --> BOOM
2303854        --> DOOM
844261         --> FIRE
1606801        --> MAZE
1110085        --> PAGE
5212974        --> BALLS
67892046       --> BEANS
885396199      --> CREEK
67401037       --> FUNKY
27762173       --> QUICK
1238440506     --> ARROWS
33045832681    --> CRAGGY
1362714005     --> PIRATE
137302698      --> TROLLS
358310128062   --> BEGGARS
40255151586    --> DETAILS
164633248153   --> FIXATED
621172442227   --> UNRATED
2467812606     --> VACUUMS
86385078330    --> GROWNUPS
26607531423091 --> UNWORTHY

Ohhh crap... 05AB1E cache hit when using Ò on 579085261, feel like Emigna Adnan has already started.

You could've allowed multiple factors of 2, then made it so that increasing the number of factors changes the index at which the reversal starts.

@mbomb007 Yes, there are many possible variants. My initial idea was to encode any word by working on groups of letters.

The test cases on this challenge remind be of those "discover your X name" things on Facebook. Find the title of the movie you're in! Step one, choose your favorite prime number <=103... your result is PIRATE MAZE, or DOOM VACUUMS...

I'm curious as to how you assigned each number to a letter. Was it random, or did you have a specific pattern to it?

@Qwerp-Derp It was first randomly shuffled and tested against a dictionary of ~106K words, up to 11 letters (the file is on my HD for a long time -- I think it was originally extracted from the TWL). Then I forced 'S' to be either first or last to maximize plural words and tried a couple of individual letter exchanges on a good combination (recursively). Finally, I lost patience and wrote the challenge. :-) Actually, before all of this, I tried to take Letter Counts by Position Within Word into account but it wasn't all that great.

What's the rule on trailing whitespace?

@ValueInk Updated. Trailing whitespace is allowed.

Jelly, 29 27 bytes
ÆEµØA“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?xḊṚḢ}¡

Thanks to @JonathanAllan for golfing off 1 byte!
Try it online!
Background
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’

is a numeric literal. The characters between the quotes are replaced with their 1-based indices in the Jelly code page, and the resulting array is interpreted as a base-250 number. This yields the integer c := 288824892868083015619552399.
How it works
ÆEµØA“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?xḊṚḢ}¡  Main link. Argument: n

ÆE                           Yield the exponents of n's prime factorization, with.
                             zeroes. This yields an array A.
  µ                          Begin a new monadic chain with argument A.
   ØA                        Set the return value to “ABC...XYZ”.
     “¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?        Select the c-th permutation of the alphabet, yielding
                             s := “SPMFLQUIXNCWORAGZTEJHVDBKY”.
                      Ḋ      Dequeue; yield A without its first element, stripping
                             the exponent of 2.
                     x       Repeat the k-th letter of s r times, where r is the
                             exponent of the k-th odd prime number.
                          ¡  Combine the two links to the left into a quicklink:
                        Ḣ}     - Apply head to the right argument (A), yielding the
                                 exponent of 2. Since n is at most divisible by the
                                 first power of 2, this yields 1 for even numbers
                                 and 0 for odd ones. Call the link to the left that
                                 many times on the previous return value.
                       Ṛ       - Reverse the string to the left.

Jelly, 36 bytes
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?ØA1;;⁶
×107ÆE¢×UḢ¡t⁶

Try it online!
Explanation
Helper constant 1£ (produces “SPMFLQUIXNCWORAGZTEJHVDBKY ” with a 1 prepended)
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?ØA1;;⁶
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’          288824892868083015619552399 (compressed representation)
              œ?ØA      th permutation of the alphabet
                  1;    prepend 1
                    ;⁶  append a space

Main program
×107ÆE¢×UḢ¡t⁶
×107           Multiply {the input} by 107
    ÆE         Convert to a list of frequencies for each factor
      ¢×       {Vectorized} multiply by the return value of 1£
        UḢ¡    Delete the first value, reverse the list that many times
           t⁶  Delete trailing/leading space

I have a feeling that my compression of the list easily beats the other Jelly answer, but that my algorithm for using it could be a lot more efficient. Maybe I'll try to combine them.
Jelly, 31 bytes, inspired by @Leakynun's answer
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?ØA⁷;
ÆfÆCị¢U⁸¡U

Try it online! (slightly modified to run a lot faster)
Is inconsistent in whether it prints a trailing newline (but PPCG normally allows answers either with or without a trailing newline, so I guess this works too?). Is very slow (O(n) where n is the input, and those numbers aren't exactly small…)
Explanation
Helper constant 1£ (produces “¶SPMFLQUIXNCWORAGZTEJHVDBKY”, where ¶ is newline)
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?ØA⁷;
“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’          288824892868083015619552399 (compressed representation)
              œ?ØA      th permutation of the alphabet
                  ⁷;    prepend newline

Main program
ÆfÆCị¢U⁸¡U
Æf          Produce list of prime factors (repeating repeated factors)
  ÆC        Map the nth prime to n
    ị¢      Index into the output of 1£
      U     Reverse
        ¡   a number of times
       ⁸    equal to the input
         U  Reverse again

That's a very nice way to store a permutation of the alphabet...

Ah you have used my permutation atom too :D

Ruby, 139 138 134 125 120 115+7 = 146 145 141 132 127 122 bytes
Uses the -rprime flag for +7 bytes.
-1 byte from @daniero. -4 bytes by remembering that I can just do a regular divisibility check instead of checking the prime division for the existence of 2.
-9 bytes from @mbomb007's Python solution reminding me of a shorter way to retrieve the matching letter.
-5 bytes because trailing whitespace is now allowed.
-5 bytes from discovering Enumerable#find_index
->n{x=Prime.prime_division n;x.reverse!if n%2<1;x.map{|i,c|" SPMFLQUIXNCWORAGZTEJHVDBKY"[Prime.find_index i]*c}*''}

Try it online! (all test cases)
Explanation
->n{                                   # Anonymous procedure with one argument n
    x=Prime.prime_division n;          # Get prime factorization of n, sorted
                                       # p0^e0 * p1^e1 ... -> [[p0,e0],[p1,e1],...]
    x.reverse!if n%2<1;                # Reverse if divisible by 2
    x.map{|i,c|                        # For each prime/exponent pair:
        " SPMFLQUIXNCWORAGZTEJHVDBKY"[ # Get corresponding character by obtaining:
            Prime.find_index i]        # Determine index of the current prime
                               *c      # Repeat the letter by the supplied exponent
                                 }*''} # Join all letter sequences together

Nice one. You can remove the space between zip and "

05AB1E, 39 38 bytes
ÒW<iR¨}26LØR•6Ê2"£´õþÕàçŸôëÂÛ*™•36BS:J

Uses the CP-1252 encoding. Try it online!

I knew it was one of you hahaha. scrapes halfway finished answer into the garbage

@carusocomputing the cache hits can bring up some time pressure haha

Ø was the part of this that beat mine by 20 bytes anyway :P.

I think you can do Ò26ÝØR•1Sî?¾±=&ÔìÍècS¦ÁÜ7d•36BS:Já¹GR for 37.

@Emigna Yeah, but the only problem is that it would take forever for the bigger test cases so I'm probably not going to include that version, but thanks anyway!

It's not very efficient no ;)

Python 2, 220 217 bytes
n=input()
i=1
L=[]
exec'i+=1;c=0\nwhile n%i<1:c+=1;n/=i\nif c:L+=[i]*c\n'*n
T='SPMFLQUIXNCWORAGZTEJHVDBKY'
print''.join(T[[p for p in range(3,104)if all(p%k for k in range(2,p))].index(q)]for q in[L,L[:0:-1]][L[0]<3])

Try it online - only runs the smallest test case without running out of memory
Ungolfed:
This version doesn't use exec, so you can actually test all of the test cases without running out of memory.
n=input()
i=1
L=[]
while~-n:
 i+=1;c=0
 while n%i<1:c+=1;n/=i
 if c:L+=[i]*c
if L[0]<3:L=L[:0:-1]
T='SPMFLQUIXNCWORAGZTEJHVDBKY'
print''.join(T[[p for p in range(3,104)if all(p%k for k in range(2,p))].index(q)]for q in L)

Try it online

Bash + GNU utilities + bsd-games package, 170
Seems pretty non-optimal, but it works:
p='printf %03d\n'
a=(`factor $1`)
x=$[a[1]<3]
$p `primes 3 104`|paste - <(fold -1<<<SPMFLQUIXNCWORAGZTEJHVDBKY)|join -o1.2 - <($p ${a[@]:x+1})|(((x))&&tac||cat)|tr -d \\n

Try it online.

Japt, 51 50 bytes
49 bytes of code, +1 for the -P flag.
%2?Uk :Uk Åw)£`yspmflquixncÙgz’jhvdbk`g#ho fj bX

Try it online!
This could be way shorter if only Japt had a couple more features...
Explanation
`yspmflquixncÙgz’jhvdbk` is just the same string everyone else is using compressed as much as Japt can compress it (3 bytes shorter than the original!). Japt's only built-in compression tool at the moment replaces common pairs of lowercase letter with a single-byte char.
So let's examine the actual code:
%2?Uk :Uk Å  w)
%2?Uk :Uk s1 w)
%2?             // If the input mod 2 is non-zero,
   Uk           //   take the prime factors of the input (U).
      :Uk       // Otherwise, take the prime factors of the input,
          s1 w  //   slice off the first one (2), and reverse.

Then £ is used to replace each item X in the result like this:
"string"g#h o fj bX
"string"g104o fj bX

         104o         // Create the range [0...104).
              fj      // Filter to only items Z where Z.j() is truthy (Z is prime).
                      // This results in the list of prime numbers from 2 to 103.
                 bX   // Take the index of X in this list.
"string"g             // Get the char in the compressed string at that index.
                      // For `y`, the index is 26, but since the string is only 26 chars
                      // long, Japt wraps around and grabs the first char in the string.

The result is an array of characters at this point, so the -P flag joins it into a single string, and the result is implicitly sent to output.

Jelly, 33 bytes
ÆfÆCUṖ$¹e@?1’ị“¡3ḅḲ+Ṿɼ¡ẏƙẊƘ’œ?ØA¤

Try it online!

Jelly, 40 bytes
Æfḟ2ÆCṚ⁸Ḃ¤¡Ṛị“YSPMFLQUIXNCWORAGZTEJHVDBK

Try it online!
Verify all testcases at once! (slightly modified)

J, 59 bytes
'SPMFLQUIXNCWORAGZTEJHVDBKY'{~(p:>:i.26)i.[:|.@}.^:(2={.)q:

Try it online!
Quite simple...
'SPMFLQUIXNCWORAGZTEJHVDBKY'{~(p:>:i.26)i.[:|.@}.^:(2={.)q:
                              (p:>:i.26)                      first 26 primes after 2
                                        i.                    for which the indices is
                                                         q:   prime factors
                                            |.@}.             remove first and reverse
                                                 ^:           if
                                                   (2={.)     the first entry is 2
                            {~                                reverse index
'..........................'                                  hardcoded string

Pyth, 54 47 bytes
7 bytes thanks to isaacg
s__W%Q2@L."AZ❤O❤❤❤❤❤❤Q❤9❤❤×❤❤"xL_MP#r_3_103-PQ2

(❤ represents an unprintable character)
Pyth doesn't have many prime built-ins...
Hexdump:
0000000: 73 5f 5f 57 25 51 32 40 4c 2e 22 41 5a 03 4f f3 s__W%Q2@L."AZ.O.
0000010: 14 af 15 ed f5 51 90 39 d5 18 d7 20 a8 22 78 4c .....Q.9... ."xL
0000020: 5f 4d 50 23 72 5f 33 5f 31 30 33 2d 50 51 32    _MP#r_3_103-PQ2

Try it online!

https://pyth.herokuapp.com/?code=.%22AZ%03O%C3%B3%14%C2%AF%15%C3%AD%C3%B5Q%C2%909%C3%95%18%C3%97%C2%A0%C2%A8%22&debug=0

@isaacg I tried it, and I don't know why it produces strange result for the last one.

I don't know what you mean: https://pyth.herokuapp.com/?code=s__W%25Q2%40L.%22AZ%03O%C3%B3%14%C2%AF%15%C3%AD%C3%B5Q%C2%909%C3%95%18%C3%97%C2%A0%C2%A8%22xL_MP%23r_3_103-PQ2&test_suite=1&test_suite_input=34874%0A483254%0A353722%0A494302%0A39061%0A6479%0A60421%0A48911474%0A2510942%0A2303854%0A844261%0A1606801%0A1110085%0A5212974%0A67892046%0A885396199%0A67401037%0A1238440506%0A33045832681%0A1362714005%0A137302698%0A358310128062%0A40255151586%0A164633248153%0A621172442227%0A2467812606%0A86385078330%0A26607531423091&debug=0

@isaacg That's very weird.

PHP, 173 Bytes
for($i=2;1<$n=&$argn;$n%$i?++$i:$r[]=$i.!$n/=$i)for($t=$i;$i>2&!$w[$i]&&$i%--$t;$t>2?:$w[$i]=SPMFLQUIXNCWORAGZTEJHVDBKY[$p++]);$r[0]>2?:rsort($r);foreach($r as$s)echo$w[$s];

Online Version
Expanded
for($i=2;1<$n=&$argn; # loop till input is 1
$n%$i?++$i:$r[]=$i.!$n/=$i) #after loop add value to result if input is divisible and divide input
  for($t=$i;$i>2&!$w[$i]&&$i%--$t; # loop if number is gt 2 and not in letter array till number is divisible
  $t>2?:$w[$i]=SPMFLQUIXNCWORAGZTEJHVDBKY[$p++]) # if is prime add to letter array
  ; # make nothing in the loop
$r[0]>2?:rsort($r); # reverse result array if 2 is in result array
foreach($r as$s) # loop result array
  echo$w[$s]; # Output

PHP, 178 Bytes
for($z=2;$p<26;$t>1?:$w[$z]=SPMFLQUIXNCWORAGZTEJHVDBKY[$p++])for($t=++$z;$z%--$t;);for($i=2;1<$n=&$argn;)$n%$i?++$i:$r[]=$i.!$n/=$i;$r[0]>2?:rsort($r);foreach($r as$s)echo$w[$s];

Online Version
Expanded
for($z=2;$p<26;
$t>1?:$w[$z]=SPMFLQUIXNCWORAGZTEJHVDBKY[$p++]) # after loop if is prime add to letter array
  for($t=++$z;$z%--$t;);
for($i=2;1<$n=&$argn;)  # loop till input is 1
  $n%$i?++$i:$r[]=$i.!$n/=$i; #add value to result if input is divisible and divide input
$r[0]>2?:rsort($r); # reverse result array if 2 is in result array
foreach($r as$s) # loop result array
  echo$w[$s]; # Output

Vyxal, 27 bytes
∆Ǐḣ«
‹ṀnΠ⌈≈Ǐ¶¨≤½꘍Qr←«f*∑$ßṘ

Try it Online! Port of Dennis' Jelly answer.
∆Ǐ             # Exponents of prime factors
  ḣ            # Remove the first item and leave it on the stack
   «...«f      # Compressed string "spmflquixncworagztejhvdbky", as a char list
         *∑    # Repeat each character by its corresponding exponent, and concatenate
           $ß  # If the popped item is nonzero (i.e. factor of 2)
             Ṙ # Then reverse the string

Python, 1420 bytes
lambda x:(lambda a,b,e,k,l,m,q,p:len.__name__[:a].join(dict(zip((lambda n:(lambda n,f,g:f(n,e,[],f,g))(n,lambda n,i,r,f,g:g(n,i+b,r,f,g)if i<n else r,lambda n,i,r,f,g:f(n,i,[r,r+[i]][all(i%x!=a for x in[e]+r)],f,g)))(l*e*(k*l+b)),(lambda n,o,t:(lambda n,f,g:f(n, len.__name__[:a],f,g))(n,lambda n,s,f,g:g(n,s,f,g)if n>o else s,lambda n,s,f,g:f(n//t,s+chr(n%t),f,g)))((((((k<<e)-b)<<m)+m)<<((k<<q)+(k<<b)))+(((((k<<e)-b)<<e)+b)<<((k<<q)-(b<<b)))+((((((b<<k)+b))<<l)+b)<<((((k<<e)-b)<<l)+(b<<b)))+(((((k<<e)-b)<<l)-k)<<((m<<m)+p))-(((p<<m)-b)<<((m<<m)-(b<<b)))+(((m<<k)+b)<<((((m<<e)-b)<<k)-(b<<b)))+(((((k<<e)-b)<<l)-m)<<((((b<<l)+b)<<k)+k))-(((((b<<l)-b)<<l)-p)<<((b<<p)+(b<<b)))-(((p<<k)-b)<<((((b<<l)-b)<<k)+k))-(((k<<q)-b)<<((p<<l)))+(((m<<m)+m)<<((((k<<e)+b)<<k)-b))-(((k<<m)+b)<<((k<<m)-b))-(((m<<m)+k)<<((((k<<e)-b)<<k)-(b<<b)))+(((((k<<e)+b)<<e)+b)<<((m<<l)-(b<<e)))-(((((k<<e)+b)<<e)+b)<<((((b<<l)+b)<<e)-b))+((((((b<<k)+b))<<k)+b)<<((p<<k)))+(((((k<<e)-b)<<k)-k)<<((k<<l)))+(((m<<l)+b)<<((m<<k)))+(((m<<e)-b)<<((b<<m)+(b<<b)))+((((((b<<k)+b))<<e)-b)<<((k<<k)+b))+(((m<<k)-b)<<((b<<l)+b))-((((k<<e)-b))<<((k<<e)))+(((m<<e)+b)<<e)-b,b,b<<l*e)))[i]for i in(lambda x: [x.remove(e), x[::-b]][b] if e in x else x)((lambda x:(lambda x,g,h:g(x,b,[],g,h))(x,lambda x,n,r,g,h:h(x,n+b,r,g,h)if x>b else r,lambda x,n,r,g,h:h(x//n,n,r+[n],g,h)if x%n==a else g(x,n,r,g,h)))(x))))(*[x for x in range(True<<len(len.__name__))])

This could definitely by shorted some, but it's my attempt at solving it with no numbers or string literals. I realize this is a code-golf problem and this isn't exactly short but wanted to share anyway, not sure if this breaks any rules or not.
Was a lot of fun to make, I used the algorithm on this blog post to reduce the ASCII numerical representation of "SPMFLQUIXNCWORAGZTEJHVDBKY" in to the bit-shift expression I use. I also generally took a lot of inspiration from this blog, I wanted to try it out myself and this seemed like a good challenge to do it with.
Here is a slightly more readable version, with some more sensible variable names too

There's at least one space that can be removed.

Welcome to Programming Puzzles & Code Golf! This is a code golf competition, so your objective should be to make your code as short as possible. Our help center states that all solutions to challenges should [...] be a serious contender for the winning criteria in use. [...] An entry to a code golf contest needs to be golfed


text:
There's no such thing as a free lunch
...or is there?
Your challenge is to parse my lunch bill, which contains the base price, tips, discounts, coupons, and extras and find out if my lunch was $0 or less. If this is the input:
12.34
15 tip
25 discount
1.5 extra
2 coupon

Then the output might be false. Here's how it works:
12.34 is the base price.
15 tip means to add 15% to the total.
25 discount means to subtract 25% from the total.
1.5 extra means to add 1.5 to the total.
2 coupon means to subtract 2 from the total.
There may be any amount of tips, discounts, coupons, and extras, but there will always be one base price.
Then we do (12.34 * 1.15) * 0.75 + 1.5 - 2 for an output of 10.14. 10.14 is greater than 0, so we output false. My lunch was not free.
Rules
number tip means to add number percent to the total.
number discount means to subtract number percent from the total
number extra means to add number to the total
number coupon means to subtract number from the total
Another example:
10
20 tip
20 discount
2 coupon
2 coupon
1 coupon
50 discount
2.55 coupon

The price is -0.24 ((10 * 1.20 * 0.80 - 2 - 2 - 1) * 0.5 - 2.55), so the output is true (my lunch was free.)
Notes:

Precision must be at least 2 decimal places.
You can take input as a string with newlines (trailing newline optional) or another separation character, or an array/list of the inputs.

Does the input need to have the name, or can we assume the order if we just input an array of numbers [12.34,15,25,1.5,2]?

@StewieGriffin You can't chose the order. There may be more than 5 rows or maybe less. You can take 2 coupon as 2.00 coupon, and 15 tip as 0.15 tip

Is this input case-sensitive? Is that all of the words we need to support?

@Riker that is all the words needed, and the input will always be lower case.

How does the evaluation order work? For example, if we have a discount, then a tip, does the tip apply to the original amount or the discounted amount?

Will the base price always be first in the list?

@Sinusoid yes..

Is the bill guaranteed to contain at least 2 rows? (Total + Tip is the bare minimum, I suppose.)

@Arnauld yes, it is.

"Then the output might be false" -- I think "Then the output will be false" would be better. Note the lack of code formatting, and the definitive statement. "Falsy" is also a word you could use in that place.

Can the floating point error be ignored? (such as 0.9-0.3-0.3-0.3 is more than 0 in some cases)?

@12431234123412341234123 yes.

05AB1E, 37 33 34 bytes
I|vy#`0èÇ7%`">* - (>* +"#sè.V}î0›_

Try it online!
Explanation
Borrows the mod 7 trick from Jonathan Allan's Jelly answer
I                                  # initialize stack with first input
 |v                                # loop over all other inputs
   y#`                             # split input on space as separate to stack
      0èÇ                          # get the character code of the first letter of the type
         7%`                       # mod by 7
            ">* - (>* +"#          # push the list ['>*','-','(>*','+'] where
                                   # '>*' =  increment and multiply
                                   # '-' =   subtract
                                   # '(>*' = negate, increment, multiply
                                   # '+' =   add
                         s         # swap the top 2 items on the stack
                          è        # use the mod result to index into the list
                           .V      # run as 05AB1E code
                             }     # end loop
                              î0›_ # check if the result rounded up to nearest integer
                                   # is less than or equal to 0

I get 1 when the value is <1.

@12431234123412341234123: Good catch. The comparison apparently cast to integer :/

JavaScript (ES6), 88 85 bytes
Takes input as an array of strings. Returns 0 for not free or 1 for free.
a=>a.map(s=>([a,b]=s.split` `,t+={e:+a,c:-a,t:x=t*a/100,d:-x}[(b||'e')[0]]),t=0)|t<=0

How it works
Each line is split on the space to get a = amount, b = type of operation. If there's no operation at all (which is the case on the first line), b is set by default to "e" for "extra".
To add the correct amount to the total t, we use an object whose keys are the first letter of the operation:
{
  e: +a,           // extra
  c: -a,           // coupon
  t: t * a / 100,  // tip
  d: -t * a / 100  // discount
}

Note: If the bill consisted of only one element, map() would return a single-element array which would be coerced to an integer when applied the | operator, making the final test fail. But the OP confirmed that this can't happen. (Arrays of 2 or more elements are coerced to 0.)
Demo

let f =

a=>a.map(s=>([a,b]=s.split` `,t+={e:+a,c:-a,t:x=t*a/100,d:-x}[(b||'e')[0]]),t=0)|t<=0

console.log(f([
'12.34',
'15 tip',
'25 discount',
'1.5 extra',
'2 coupon'
]))

console.log(f([
'10',
'20 tip',
'20 discount',
'2 coupon',
'2 coupon',
'1 coupon',
'50 discount',
'2.55 coupon'
]))

Jelly,  42 39 bytes
⁾_@
⁾C×
”+
⁾‘×
ḲµṪḢO%7µĿṭ
ḢW;Ç€j”µFV>0¬

Takes a list of strings with decimal formatted numbers
(Leading zeros will work, but have the side effect of printing zeros to STDOUT prior to the final result).
Try it online! - not free; or free.
How?
⁾_@ - Link 1: a coupon
⁾_@ - literal "_@" - the Jelly code for subtraction with reversed arguments

⁾C× - Link 2: a discount
⁾C× - literal "C×" - the Jelly code for complement (1-input) then multiply

”+ - Link 3: extra cost
”+ - literal '+' - the Jelly code for add

⁾‘× - Link 4: a tip
⁾‘× - literal "‘×" - the Jelly code for increment (input+1) then multiply

ḲµṪḢO%7µĿṭ - Link 5, switch: char list
Ḳ          - split on spaces (gives [amount, type] as char lists)
 µ     µ   - monadic chain separation to get a value, say v
  Ṫ        - tail (get the type: "coupon", "discount", "extra", or "tip")
   Ḣ       - head (get the first character: 'c', 'd', 'e' or 't')
    O      - cast to ordinal (99, 100, 101, or 116)
     %7    - mod 7 (1, 2, 3, or 4)
        Ŀ  - call link v as a monad
         ṭ - tack to the amount char list

ḢW;Ç€j”µFV>0¬ - Main link: list of strings (char lists)
Ḣ             - head - the base price char list
 W            - wrap in a list
   Ç€         - call the last link (5) as a monad for €ach of the rest
  ;           - concatenate
      ”µ      - literal 'µ' - Jelly's monadic chain separator
     j        - join all the parts with 'µ's             "10",".2 tip",".2 discount", "2 coupon","2 coupon","1 coupon",".5 discount","2.55 coupon":
        F     - flatten (makes a char list, for example: "10µ.20‘×µ.20C×µ2_@µ2_@µ1_@µ.50C×µ2.55_@")
         V    - evaluate as Jelly code (the above evaluates to -0.2499999999999991)
          >0  - greater than 0?
            ¬ - not

Consistently outputs 0 for me...

Ah, maybe I should say the format uses decimal?

Oh. Yes, you should.

I am writing up the explanation at the mo, here is an example of a free lunch.

CJam, 45 42 bytes
q~Sf/(sd\{L(d\~ci6%"1\-* + )* -"S/=~}fL0>!

Take input as an array of strings, and takes the tip and discount as decimals.
Try it online!
Explanation
q~                e# Read and eval the input.
Sf/               e# Split each string by spaces.
(sd               e# Pull out the first element (base price) and cast it to a double.
\                 e# Bring the array back to the top.
{                 e# For each element L in the array:
 L                e#  Push L.
 (d               e#  Pop out the first element and cast it to a double.
 \~               e#  Bring the second element to the top of the stack.
 ci6%             e#  Mod its first character's ASCII value by 6. (c,d,e,t) -> (3,4,5,2)
 "1\-* + )* -"S/  e#  Push this string and split it on spaces.
 =                e#  Get the element given by number from the mod. CJam uses modular arrays,
                  e#    so 4 and 5 get elements 0 and 1 respectively.
 ~                e#  Eval whichever string was retrieved.
}fL               e# (end of loop)
0>!               e# Check if it's not greater than 0.

The code which is evaluated depending on the first letters:
t -> ")*"    Adds 1 to the tip amount and multiplies it by the current price.

d -> "1\-*"  Subtracts the discount amount from 1 and multiplies it by the current price.

e -> "+"     Adds the extra amount to the current price.

c -> "-"     Subtracts the coupon amount from the current price.

GNU sed + dc, 117 111 107 bytes
Using -z interpreter flag (included in score as 1 byte):
s/discount/_tip/g
s/tip/.01*1+*/g
s/extra/+/g
s/coupon/-/g
s/.*/dc -e '& 0r-p'/e
s/[^-]*$/free/
s/-/not /

Explanation
#!/bin/sed -fz

# Convert to dc expression (discount is just a negative tip)
s/discount/_tip/g
s/tip/.01*1+*/g
s/extra/+/g
s/coupon/-/g

# Run dc
s/.*/dc -e '& 0r-p'/e

# Convert to pretty output
s/[^-]*$/free/
s/-/not /

Since the input is already very close to Reverse Polish notation, it's a simple matter to transform extra and coupon to + and -, and not much more to change the percentages into multipliers.  Then invoke dc and produce a readable result depending on whether - is found (we have to negate the result, so a - implies "not free", otherwise 0 would be a special case that would need its own handling).
Example
The second case from the question is:
10
20 tip
20 discount
2 coupon
2 coupon
1 coupon
50 discount
2.55 coupon

That becomes this dc program:
10
20 .01*1+*
20 _.01*1+*
2 -
2 -
1 -
50 _.01*1+*
2.55 -
 0r-p

Resulting in:
free

JavaScript, 173 169 145 bytes
i=>{w=i.split`\n`.map($=>$.split` `);t=+w.shift()[0];p=$=>t*$/100;w.map(x=>{k=+x[0];f=x[1][0];l={e:k,c:-k,t:p(k),d:-p(k)},t+=l[f]});return t<=0;}

There should still be plenty of golfing to do
Try it online! (145 bytes currently)
Try it out:

<textarea oninput="document.querySelector('pre').innerText=_(this.value)"></textarea>

Thanks to programmer5000 for all his golfing advice

Why is node required?

Also, you can do {w=i.split\`` where  is a literal newline

Node is not required. I just used it for testing on TIO

I added a stack snippet for trying it out. Feel free to rollback if you don't like it.

I am getting errors when testing it there (f is not a function).

You can remove the f= part, it is allowed by the rules, and you can replace $.split(' ') with $.split\ ``.

I didn't know you don't need the brackets when using backticks. Pretty useful.

Fixed the errors. Replace i=>{ with i=>, and ;return t<=0;} with ,t<=0 to save a few bytes.

Let us continue this discussion in chat.

JavaScript (ES6), 97 107
Input as a multiline string with a trailing newline.
t=>t.replace(/(\S+) ?(.*)?\n/g,(x,d,b)=>t-=b>'t'?-t*d/100:b>'e'?d:b>'d'?t*d/100:b?-d:d,t=0)&&t>=0

The regexp splits the numeric and optional text part for each line in d and b.
The calculations should be more or less obviuos. Just some note:
 - using -= to avoid problems mixing number with strings
 - the sum is negated to save 1 byte, so the last check is for >= 0 instead of <= 0
PS still way longer than @Arnauld's. Rats.
Test

var f=
t=>t.replace(/(\S+) ?(.*)?\n/g,(x,d,b)=>t-=b>'t'?-t*d/100:b>'e'?d:b>'d'?t*d/100:b?-d:d,t=0)&&t>=0

a=`12.34
15 tip
25 discount
1.5 extra
2 coupon
`
b=`10
20 tip
20 discount
2 coupon
2 coupon
1 coupon
50 discount
2.55 coupon
`

console.log('Not free: '+a,f(a))
console.log('Free: '+b,f(b))

Python 133 bytes
def f(b):
 t=float(b.pop(0))
 for l in b:
  v,a=l.split(' ');v=float(v);t+={'t':t*v/100,'d':-t*v/100,'c':-v,'e':v}[a[0]]
 return t<=0

Similar to the JavaScript ES6 version. But type conversion is required for float values in Python.
Explanation:
Extract the first value and convert it to float.
For each other line in the bill:

split and convert the value to float
Use a dict to select the right operation according to the first letter
Accumulate the value

Usage:
print(f([
'12.34',
'15 tip',
'25 discount',
'1.5 extra',
'2 coupon'
]))

print(f([
'10',
'20 tip',
'20 discount',
'2 coupon',
'2 coupon',
'1 coupon',
'50 discount',
'2.55 coupon'
]))

Welcome to the site!

PowerShell, 218 156 143 bytes
($n=$args)|%{[float]$v,$w=$_-split' ';switch -w($w){"t*"{$t+=$v}"d*"{$d+=$v}"e*"{$e+=$v}"c*"{$c+=$v}}};($n[0]*(1+$t/100)*(1-$d/100)+$e-$c)-lt 0

Try it online!
EDIT Saved bytes by splitting the piped variable beforehand
EDIT 2 Stored second part of string so I could make better wildcard calls

Seems to work, and your input format is fine.

C# 324 219 bytes
bool a(string[] l){var x=0f;foreach(var s in l){var b=float.Parse(s.Split(' ')[0]);if(s.EndsWith("p"))x*=b;else if(s.EndsWith("t"))x*=1-b;else if(s.EndsWith("n"))x-=b;else if(s.EndsWith("a"))x+=b;else x=b;}return x<=0;}

It's not pretty, and probably not the best way, but here it is.
Requires input be passed as a string array, and tips/discounts passed as floats (0.15 tip instead of 15 tip) as this has been clarified as acceptible in the comments of the spec.
Explaination:
bool a(string[] l){                         //Define method with input string array l and bool output
    var x=0f;                               //Initialize float x
    foreach(var s in l){                    //Iterate through lines
        var b=float.Parse(s.Split(' ')[0]); //Parse the number from the line and store it in float b
        if(s.EndsWith("p"))                 //If line ends with "p" then line is "tip"
            x*=b;                           //Parse number from line to float add 1 and multiply by x
        else if(s.EndsWith("t"))            //If line ends with "t" then line is "discount"
            x*=1-b;                         //Parse number from line to float, subtract from 1 and multiply by x
        else if(s.EndsWith("n"))            //If line ends with "n" then line is "coupon"
            x-=b;                           //Parse number from line to float and subtract from x
        else if(s.EndsWith("a"))            //If line ends with "a" then line is "extra"
            x+=b;                           //Parse number from line to float and add to x
        else x=b;                           //Line is base price
    }                                       //End foreach
    return x<=0;                            //Return x less than or equal to 0
}                                           //End method

There's gotta be a better way to do this, but this works at least

If you've been given tips/discounts as floats then you don't want that 100 in the t branch.

@WaiHaLee oops, good point, forgot to change that to 1

Tip: put float.Parse(s.Split(' ')[0]) into something to reduce duplication. That'll save about 80 characters.

oh wow I'm a terrible golfer I didn't even remove unnecessary whitespace. I blame Visual Studio.

Not a bad effort at all!

Java 227 bytes
Been a while and still no Java answer that I can see, so here's my C# answer ported to Java, at the cost of 8 bytes
boolean a(String[] l){Float x=0f;for(String s:l){Float b=Float.parseFloat(s.split(" ")[0]);if(s.endsWith("p"))x*=b;else if(s.endsWith("t"))x*=1-b;else if(s.endsWith("n"))x-=b;else if(s.endsWith("a"))x+=b;else x=b;}return x<=0;}

For an explanation and such, see my C# answer
Like that answer, this answer expects that the tip and discount be passed as floats (0.15 not 15)

Pretty good...for Java!

@programmer5000 to be fair C# is only slightly less verbose than Java, main advantages being things like C#'s support of var generic type, and lambdas (I know Java has them, but C#'s are golfier)

Jq 1.5, 129 119 114 112 bytes
reduce (.[]/" "|.[0]|=tonumber|.[1]|=length)as[$n,$c](0;[$n,0,0,.+.*($n/100),0,.+$n,.-$n,0,.-.*($n/100)][$c])<=0

Expanded
  reduce (
      .[]/" "             # split each element into [value,command]
    | .[0]|=tonumber      # convert value to number
    | .[1]|=length        # convert command to length
  ) as [$n,$c]
  (  0
   ; [ $n                 # "" -> set base
     , 0
     , 0
     , .+.*($n/100)       # "tip"
     , 0
     , .+$n               # "extra"
     , .-$n               # "coupon"
     , 0
     , .-.*($n/100)       # "discount"
     ][$c]                # ... depending on command length
  ) <=0                   # true if lunch was free

Try it online!

source: Stack Exchange

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

sort: votes


text:
Generate all Brain-Flak Snippets

This question is the second of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday here

Challenge
For this challenge you'll be generating all fully matched strings from a list of brackets. To borrow DJMcMayhem's definition of a fully matched string:

For the purpose of this challenge, a "bracket" is any of these characters: ()[]{}<>.

A pair of brackets is considered "matched" if the opening and closing brackets are in the right order and have no characters inside of them, such as
()
[]{}

Or if every subelement inside of it is also matched.
[()()()()]
{<[]>}
(()())

Subelements can also be nested several layers deep.
[(){<><>[()]}<>()]
<[{((()))}]>

A string is considered "Fully matched" if and only if each pair of brackets has the correct opening and closing bracket in the right order.

Input
Your program or function will take a list of four non-negative numbers in any convenient, consistent format. This includes (but is not limited to) a list of integers, a non-digit delimited string, or separate arguments. These four numbers represent the number of matched pairs of each type of bracket. For example, [1,2,3,4] would represent:

1 pair of ()

2 pairs of {}

3 pairs of [] and

4 pairs of <>

You may choose which pair of brackets each input corresponds to as long as it is consistent.
Output
You should output all fully matched string that can be formed from this list of brackets without duplicates. Output can be in any reasonable format which includes printing a non-bracket delimited string to STDOUT, or a list of strings as a return value from a function.
Your algorithm must work for any arbitrary input, but you don't need to worry about memory, time or integer size limits (e.g. if your answer is in C you won't get 233 as an input).
This is code-golf, so the shortest answer in bytes wins.
Example Input and Output
For these example I will use the same input order as above.
For each example, the first line will be input and the following lines will be the output
Example 0:
[0,0,0,0]

Example 1:
[1,0,0,0]
()

Example 2:
[0,2,0,0]
{}{}
{{}}

Example 3:
[0,0,1,1]
[]<>
[<>]
<[]>
<>[]

Example 4:
[0,1,2,0]
{}[][]  {}[[]]  {[]}[]  {[][]}  {[[]]}
[{}][]  [{}[]]  [{[]}]  []{}[]  []{[]}
[][{}]  [][]{}  [[{}]]  [[]{}]  [[]]{}

Example 5:
[1,0,0,3]
()<><><>  ()<><<>>  ()<<>><>  ()<<><>>  ()<<<>>>  (<>)<><>  (<>)<<>>
(<><>)<>  (<><><>)  (<><<>>)  (<<>>)<>  (<<>><>)  (<<><>>)  (<<<>>>)
<()><><>  <()><<>>  <()<>><>  <()<><>>  <()<<>>>  <(<>)><>  <(<>)<>>
<(<><>)>  <(<<>>)>  <>()<><>  <>()<<>>  <>(<>)<>  <>(<><>)  <>(<<>>)
<><()><>  <><()<>>  <><(<>)>  <><>()<>  <><>(<>)  <><><()>  <><><>()
<><<()>>  <><<>()>  <><<>>()  <<()>><>  <<()><>>  <<()<>>>  <<(<>)>>
<<>()><>  <<>()<>>  <<>(<>)>  <<>>()<>  <<>>(<>)  <<>><()>  <<>><>()
<<><()>>  <<><>()>  <<><>>()  <<<()>>>  <<<>()>>  <<<>>()>  <<<>>>()

Example 6:
[1,1,1,1]

(){}[]<>  (){}[<>]  (){}<[]>  (){}<>[]  (){[]}<>  (){[]<>}  (){[<>]}
(){<[]>}  (){<>}[]  (){<>[]}  ()[{}]<>  ()[{}<>]  ()[{<>}]  ()[]{}<>
()[]{<>}  ()[]<{}>  ()[]<>{}  ()[<{}>]  ()[<>{}]  ()[<>]{}  ()<{}[]>
()<{}>[]  ()<{[]}>  ()<[{}]>  ()<[]{}>  ()<[]>{}  ()<>{}[]  ()<>{[]}
()<>[{}]  ()<>[]{}  ({})[]<>  ({})[<>]  ({})<[]>  ({})<>[]  ({}[])<>
({}[]<>)  ({}[<>])  ({}<[]>)  ({}<>)[]  ({}<>[])  ({[]})<>  ({[]}<>)
({[]<>})  ({[<>]})  ({<[]>})  ({<>})[]  ({<>}[])  ({<>[]})  ([{}])<>
([{}]<>)  ([{}<>])  ([{<>}])  ([]){}<>  ([]){<>}  ([])<{}>  ([])<>{}
([]{})<>  ([]{}<>)  ([]{<>})  ([]<{}>)  ([]<>){}  ([]<>{})  ([<{}>])
([<>{}])  ([<>]){}  ([<>]{})  (<{}[]>)  (<{}>)[]  (<{}>[])  (<{[]}>)
(<[{}]>)  (<[]{}>)  (<[]>){}  (<[]>{})  (<>){}[]  (<>){[]}  (<>)[{}]
(<>)[]{}  (<>{})[]  (<>{}[])  (<>{[]})  (<>[{}])  (<>[]){}  (<>[]{})
{()}[]<>  {()}[<>]  {()}<[]>  {()}<>[]  {()[]}<>  {()[]<>}  {()[<>]}
{()<[]>}  {()<>}[]  {()<>[]}  {([])}<>  {([])<>}  {([]<>)}  {([<>])}
{(<[]>)}  {(<>)}[]  {(<>)[]}  {(<>[])}  {}()[]<>  {}()[<>]  {}()<[]>
{}()<>[]  {}([])<>  {}([]<>)  {}([<>])  {}(<[]>)  {}(<>)[]  {}(<>[])
{}[()]<>  {}[()<>]  {}[(<>)]  {}[]()<>  {}[](<>)  {}[]<()>  {}[]<>()
{}[<()>]  {}[<>()]  {}[<>]()  {}<()[]>  {}<()>[]  {}<([])>  {}<[()]>
{}<[]()>  {}<[]>()  {}<>()[]  {}<>([])  {}<>[()]  {}<>[]()  {[()]}<>
{[()]<>}  {[()<>]}  {[(<>)]}  {[]()}<>  {[]()<>}  {[](<>)}  {[]}()<>
{[]}(<>)  {[]}<()>  {[]}<>()  {[]<()>}  {[]<>()}  {[]<>}()  {[<()>]}
{[<>()]}  {[<>]()}  {[<>]}()  {<()[]>}  {<()>}[]  {<()>[]}  {<([])>}
{<[()]>}  {<[]()>}  {<[]>()}  {<[]>}()  {<>()}[]  {<>()[]}  {<>([])}
{<>}()[]  {<>}([])  {<>}[()]  {<>}[]()  {<>[()]}  {<>[]()}  {<>[]}()
[(){}]<>  [(){}<>]  [(){<>}]  [()]{}<>  [()]{<>}  [()]<{}>  [()]<>{}
[()<{}>]  [()<>{}]  [()<>]{}  [({})]<>  [({})<>]  [({}<>)]  [({<>})]
[(<{}>)]  [(<>){}]  [(<>)]{}  [(<>{})]  [{()}]<>  [{()}<>]  [{()<>}]
[{(<>)}]  [{}()]<>  [{}()<>]  [{}(<>)]  [{}]()<>  [{}](<>)  [{}]<()>
[{}]<>()  [{}<()>]  [{}<>()]  [{}<>]()  [{<()>}]  [{<>()}]  [{<>}()]
[{<>}]()  [](){}<>  [](){<>}  []()<{}>  []()<>{}  []({})<>  []({}<>)
[]({<>})  [](<{}>)  [](<>){}  [](<>{})  []{()}<>  []{()<>}  []{(<>)}
[]{}()<>  []{}(<>)  []{}<()>  []{}<>()  []{<()>}  []{<>()}  []{<>}()
[]<(){}>  []<()>{}  []<({})>  []<{()}>  []<{}()>  []<{}>()  []<>(){}
[]<>({})  []<>{()}  []<>{}()  [<(){}>]  [<()>{}]  [<()>]{}  [<({})>]
[<{()}>]  [<{}()>]  [<{}>()]  [<{}>]()  [<>(){}]  [<>()]{}  [<>({})]
[<>{()}]  [<>{}()]  [<>{}]()  [<>](){}  [<>]({})  [<>]{()}  [<>]{}()
<(){}[]>  <(){}>[]  <(){[]}>  <()[{}]>  <()[]{}>  <()[]>{}  <()>{}[]
<()>{[]}  <()>[{}]  <()>[]{}  <({})[]>  <({})>[]  <({}[])>  <({[]})>
<([{}])>  <([]){}>  <([])>{}  <([]{})>  <{()}[]>  <{()}>[]  <{()[]}>
<{([])}>  <{}()[]>  <{}()>[]  <{}([])>  <{}[()]>  <{}[]()>  <{}[]>()
<{}>()[]  <{}>([])  <{}>[()]  <{}>[]()  <{[()]}>  <{[]()}>  <{[]}()>
<{[]}>()  <[(){}]>  <[()]{}>  <[()]>{}  <[({})]>  <[{()}]>  <[{}()]>
<[{}]()>  <[{}]>()  <[](){}>  <[]()>{}  <[]({})>  <[]{()}>  <[]{}()>
<[]{}>()  <[]>(){}  <[]>({})  <[]>{()}  <[]>{}()  <>(){}[]  <>(){[]}
<>()[{}]  <>()[]{}  <>({})[]  <>({}[])  <>({[]})  <>([{}])  <>([]){}
<>([]{})  <>{()}[]  <>{()[]}  <>{([])}  <>{}()[]  <>{}([])  <>{}[()]
<>{}[]()  <>{[()]}  <>{[]()}  <>{[]}()  <>[(){}]  <>[()]{}  <>[({})]
<>[{()}]  <>[{}()]  <>[{}]()  <>[](){}  <>[]({})  <>[]{()}  <>[]{}()

Related

Haskell, 128 bytes
f is the main function, it takes a list of Ints and returns a list of Strings.
f=g.($zip"({[<"")}]>").zipWith replicate
g=max[""].(#g)
l#c=[b:s|x@(b,e):r<-l,s<-(r:filter(/=x:r)l)?(map(e:).c)]
l?c=c l++l#(?c)

Try it online!
How it works

f transforms its input list into a list of lists of tuples, each tuple containing a bracket pair, with each type of bracket in its own sublist. E.g. [1,2,0,0] becomes [[('{','}')],[('[',']'),('[',']')]]. Then it calls g with the transformed list.
The remaining functions use a partially continuation-passing style intermingled with list manipulation. Each continuation function c takes a list l of remaining bracket tuple lists and returns a list of possible strings to be suffixed to what's already been generated.
g l generates the list of fully matched strings formable by using all the brackets in l.

It does this by calling l#g to generate strings beginning with some bracket. The recursive g parameter is itself used as a continuation by #, to generate what comes after the first bracketed subelement.
In the case where there are no such strings (because l has no brackets left inside) g instead returns [""], the list containing just the empty string. Since [""] compares smaller to all nonempty lists produceable by #, we can do this by applying max.

l#c generates strings from l beginning with at least one bracketed subelement, leaving to the continuation c to determine what follows the element.

b and e are a selected pair of brackets in the tuple x, and r is the list of remaining tuples of the same bracket type.
r:filter(/=x:r)l is l with the tuple x removed, slightly rearranged.
? is called to generate the possible subelements between b and e. It gets its own continuation map(e:).c, which prefixes e to each of the suffix strings generated by c.
# itself prepends the initial b to all the strings generated by ? and c.

l?c generates the fully matched strings formable by using zero or more bracket pairs from l, and then leaves to its continuation c to handle what's left over. The c l part goes directly to c without adding any subelements, while l#(?c) uses # to generate one subelement and then call (?c) recursively for possible further ones.

Jelly, 50 40 34 bytes
-6 bytes thanks to Leaky Nun (getting reduce to work where I couldn't)
“()“{}“[]“<>”©ẋ"FŒ!QµW;®œṣF¥/µÐLÐḟ

Plain and inefficient.
Try it online! (times out at TIO for [1,1,1,1] - yes, inefficient.)
How?
Recursively removes pairs of matching brackets that reside right next to each other until no more may be removed for every possible string one may form, keeping such strings which reduce to nothing (hence have all matching content).
“()“{}“[]“<>”©ẋ"FŒ!QµW;®œṣF¥/µÐLÐḟ - Main link: list: [n(), n{}, n[], n<>]
“()“{}“[]“<>”                      - literal ["()", "{}", "[]", "<>"]
             ©                     - copy to register
               "                   - zip with:
              ẋ                    -   repeat list
                F                  - flatten
                 Œ!                - all permutations (yeah, it's inefficient!)
                   Q               - de-duplicate
                    µ              - monadic chain separation
                                Ðḟ - filter discard if (non empty is truthy):
                             µÐL   -   loop until no change:
                       ®           -     recall value from register
                     W             -     wrap loop variable in a list
                      ;            -     concatenate
                           ¥/      -     reduce with last two links as a dyad:
                        œṣ         -       split left on occurrences of sublist on the right
                          F        -       flatten the result

No need to use eval tricks... use reduce instead. 35 bytes

Moving the first line to the second... 34 bytes

@LeakyNun Thanks! I tried but couldn't get a reduce to work (hence resorted to using eval).

Nice, I used the same approach of œṣ-F-µÐL in a somewhat related problem.

05AB1E, 33 32 30 27 25 bytes
Saved 7 bytes thanks to Riley.
Input order is [(),<>,[],{}]
žu4ä×©JœJÙD[D®õ:DŠQ#]€g_Ï

Try it online!
Explanation
žu                             # push the string "()<>[]{}"
  4ä                           # split in 4 parts
    ©                          # store a copy in register
     ×                         # repeat each bracket a number of times decided by input
      JœJÙ                     # get the unique permutations of the string of brackets
          D                    # duplicate
           [                   # start infinite loop
            D                  # duplicate current list of permutations
             ®õ:               # replace any instance of (), [], <>, {}
                               # with an empty string
                DŠ             # duplicate and move down 2 places on stack
                  Q#           # if the operation didn't alter the list, exit loop
                    ]          # end loop
                     €g        # get the length of each subtring
                       _Ï      # keep only the strings in the original
                               # list of unique permutations
                               # that have a length of 0 in the resulting list

I think : vectorizes (you can skip most of the infinite loop). 2. It's 1 bytes shorter to use UX at the beginning and X when you need the list of brackets again.

@Riley: I did try just : first, but we get issues when for example replacements on {} creates possible replacements on () as we've already tried replacing all (). Good point about UX though. We can get another byte with ©® as well.

The fact that U pops the top was always frustrating. I didn't know about ©®.

I was looking at this answer. Did 05AB1E get an update that broke it, or is that answer not valid?

That answer works for [([]{})<{[()<()>]}()>{}], but not for [({})<{[()<()>]}()>{}]. The only difference is the removed []. I'll ask about it in TNB.

Why is the output empty?

@user202729: Some feature of the language has likely changed since this was posted. If you want to run it, I think you'll have to download the version that was live back then. It can probably be made shorter today as well.

@user202729: this seems to be working with minimal changes. Edit: changed to legacy since it was more efficient for the big test case.

Pyth - 83 74 71 63 bytes
K("\[]""{}""\(\)""<>")Fd{.psm*:@Kd*\\2k@QdU4JdVldFHK=:JHk))I!Jd

Try It
1: Kc"[] {} () <>")Fd{.ps*V-R\KQJdVldFHK=:JHk))I!Jd
Also, this 53-byte version thanks to Leaky Nun
Kc"\[] \{} \(\) <>")Fd{.ps*V-R\\KQJdVldFHK=:JHk))I!Jd

Here

Jelly beaten by Pyth? What is this sorcery?

@mathjunkie  I didn't beat Jelly; I screwed up the input syntax.

...and I think I can improve :D

@JonathanAllan so can this answer.

Step 1: instead of ("\[]""{}""\(\)""<>"), we do c"\[] \{} \(\) <>") (split on whitespace); instead of :@Kd*\\2k, we do -@Kd followed by two backslashes; then, instead of mapping on U4, we do *V-R\\KQ (multiply two arrays in parallel). The first array is generated using R, namely -R\\k This will give you a 54-byte version

A note: I hope that you know you can use V in a nested manner. The variable changes from N to H and then to b as you go into a deeper level. It is documented.

Step 2: We use u (reduce) two times. The first time is a fixed-point, i.e. do the substitutions repeatedly until there is no change. The second layer inside where we do the substitution also require reduce, as we have 4 substitutions to do one-by-one. Also, we use V instead of F. This would give you a 46-byte version.

Step 3: instead of using a for-loop and printing when a condition is satisfied, we use f to filter those who satisfy the condition, i.e. V[array]I[condition]N becomes f[condition][array]. This also changes the output format to a list of strings. Now, instead of storing an escaped string, we store an unescaped string and escape it in regex. This makes each component of the string 2 letters long, which allows us to do c"[]{}()<>"2. 37-byte version

Step 4: instead of building a regex to replace, we don't use regex at all. Notice that replace(a,b,"") is essentially the same as join(split(a,b)). This would give you a 32-byte version.

@LeakyNun wow nice.

@JonathanAllan the "split-and-join" alternative to regex-replacing is inspired by your answer :p

Ruby, 123 bytes
->a{"<>{}[]()".gsub(/../){$&*a.pop}.chars.permutation.map(&:join).uniq.grep /^((\(\g<1>\)|\[\g<1>\]|\{\g<1>\}|<\g<1>>)*)$/}

Try it online! It's inefficient, though, so even inputs like [1,2,1,1] will time out online. All the listed examples will work, at least!
Explanation
->a{                                        # Procedure with input a
    "<>{}[]()".gsub(/../){                  # For all pairs of brackets
                          $&*a.pop          # Pop last item in input, then repeat
                                            #   the bracket pair by that number
                                  }.chars   # Get characters
        .permutation                        # All permutations of characters
                    .map(&:join)            # For each permutation, join the chars
                                .uniq       # Get unique permutations only
            .grep /^((\(\g<1>\)|\[\g<1>\]|\{\g<1>\}|<\g<1>>)*)$/}
                                            # Only return permutations that match
                                            #   this bracket-matching regex

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


text:
Hare Krishna Hare Krishna Krishna Krishna Hare Hare
Recently, I've seen Hare Krishna people with their mantra on the emblem and I've found it may be quite interesting to code golf.
The challenge
Write the Hare Krishna mantra, i.e.:
Hare Krishna Hare Krishna
Krishna Krishna Hare Hare
Hare Rama Hare Rama
Rama Rama Hare Hare

Winning criteria
This is code-golf, so shortest code in bytes wins!
Rules

Casing must be preserved.
Text should contain new lines.
Lines may have trailing space(s).
Trailing newline is allowed.
Parsing from web or any other external resource disallowed.

From the title I was expecting something to decode binary strings into ASCII characters. The title represents a backslash.

All the mantra has 97 bytes. Surpisingly enough, there are answers with more than that many bytes.

Jelly, 22 bytes
“t,ȧṫÞċḅ»Ḳ“¡¥Ɓc’ṃs4K€Y

Try it online!
How it works
“t,ȧṫÞċḅ»Ḳ“¡¥Ɓc’ṃs4K€Y  Main link. No arguments.

“t,ȧṫÞċḅ»               Use Jelly's dictionary to yield the string
                        "Hare Rama Krishna". Fortunately, the words Rama, Krishna,
                        and hare (lowercase H) are in the dictionary.
         Ḳ              Split at spaces, yielding ["Hare", "Rama", "Krishna"].
          “¡¥Ɓc’        Base-250 literal; yielding 15973600.
                ṃ       Convert 15973600 to base ["Hare", "Rama", "Krishna"]
                        (ternary), where "Krishna" = 0, "Hare" = 1, and "Rama" = 2.
                 s4     Split the resulting string array into chunks of length 4.
                   K€   Join each of the four chunks by spaces.
                     Y  Join the resulting strings by linefeeds.

Convert 15973600 to base ["Hare", "Rama", "Krishna"] Thank goodness you explained that further, because that made no sense.

I need to use base ["Hare", "Rama", "Krishna"]  more.

05AB1E, 38 bytes
Can be shortened by 2 bytes if trailing newlines are okay.
“«Î‡Ä¦í¥Â“#€¦`«'kì)™ð«•2ÍZì•3BSè#4ô¨»?

Try it online!
Explanation
“«Î‡Ä¦í¥Â“                              # push the string "drama share irish dna"
          #                             # split on spaces
           €¦                           # remove the first character of each word
             `                          # split to stack as separate words
              «'kì                      # concatenate the last 2 and prepend "k"
                  )™                    # wrap in list and title-case
                    ð«                  # append a space to each
                      •2ÍZì•            # push 27073120
                            3B          # convert to base-3: 1212221110100011
                              Sè        # index into the list with each
                                #       # split on spaces
                                 4ô     # split into pieces of 4
                                   ¨    # remove the last
                                    »   # join on spaces and newlines
                                     ?  # print without newline

drama share irish dna, really? Where did that idea come from? +1 :)

Tell me frankly, did you built a generator of 05AB1E golfed code?

@YSC that's not a bad idea for dictionary compression. I'm on it.

32 bytes

How did nobody notice that this is the same length as without any compression at all?

Python 2, 60 bytes
a="Hare"
for x in"Krishna","Rama":print a,x,a,x+'\n',x,x,a,a

Try it online!
This seems to beat template-replacement approaches like this attempt.

Octave, 74 59 bytes
[{'Hare ','Krishna ','Rama ',10}{'ababdbbaadacacdccaa'-96}]

Verify the output here.
Explanation:
{'Hare ','Krishna ','Rama ',10} creates a cell array with three strings, where the fourth is 10 (ASCII-value for newline).
{'ababdbbaadacacdccaa'-96} is a vector that indexes the cell array above. The vector is [1 2 1 2 4 ...] since we subtract 96 from the string ababd....
The surrounding square brackets are used to concatenate the results, instead of getting ans = Hare; and = Krishna; ans = ...

I didn't know you can index cell like that in Octave (unlike MATLAB)!

Retina, 39 bytes

hkhk¶kkhh
h
Hare
*`k
Krishna
k
Rama

Try it online!
Mostly plain substitutions, the only "trick" is the modifier * which prints the result of the substitution and then reverts the string back to what it was before.

PHP, 61 Bytes
<?=strtr("0101
1100
0202
2200",["Hare ","Krishna ","Rama "]);

simply replacement from the digits as key in the array with the values strtr
Try it online!

JavaScript, 75 70 bytes
`0101
1100
0202
2200`.replace(/./g,n=>['Hare ','Krishna ','Rama '][n])

Try it online!

console.log(`0101
1100
0202
2200`.replace(/./g,n=>['Hare ','Krishna ','Rama '][n]))

Better use literal newline characters in the template string directly instead of digit 3. The template string will have the same length, but you will not have to replace them later. (Will not cause array index issue, because /./ not matches newline characters.)

I liked the root idea. ♥

C
154 bytes, 124 bytes, 96 bytes
i;main(){char*c="agagvggaavapapvppaaHare \0Krishna \0Rama \0\n";while(i<19)printf(c+c[i++]-78);}

Try it online!
28 bytes saved, thanks to Dennis

Welcome to Programming Puzzles and Code Golf.

It's a pretty standard acronym for programming puzzles and code golf, the name of this stack exchange. Sorry, I should have made this clear. Welcome to our site, good first post.

This won't work with all compilers, but gcc doesn't require the include statement. Also, if you restrict your submission to C, you can drop the int and declare i globally so it defaults to zero. https://tio.run/nexus/c-gcc#@59pm5uYmaehWZ2ckViklWyrlJiemF6Wnp6YWJZYkFhQVlCQmOiRWJSqEGPgXZRZnJGXCGQFJeaCqJg8JevyjMycVI1MG0NLzYKizLySNI1k7eToTG3tWF1zC03r2v//AQ

Thanks, I just realized that a few second before you answered. Is it ok if I include my progress in my answer, or just final version?

We usually just leave the final version and post strikethoughs of our previous byte counts. The former versions will still be visible in the revision history.

But that's just what most of us do. It's not a rule and you can keep them if you want to.

Woah cool solution

This is probably OK as K&R C, but not as standard C. Even the first C standard (ANSI C, C89/90) would formally consider this code syntactically incorrect.

@Dennis Just because it does not require the include does not mean the code is OK. In pre-C99 C failure to pre-declare a variadic function results in undefined behavior, not in a compile-time diagnostic message..

@AnT That's correct, but code golf competitions don't require "proper" code. Here on PPCG, we define languages by their implementation. As long as there is a compiler that produces a working executable, the answer is valid.

main(){for(char*t="BG@ESCB;:N8F6DIBA10Hare \0Krishna \0Rama \0\n";*t^72;printf(t+*t++-48));} Saves 4 bytes.

Thanks, Johan, someone has submitted a similar answer to yours. Very clever.

V, 40, 36 bytes
iHare Krishna
 Rama ç^/ä$Ùdww.$2p

Try it online!
Hexdump:
00000000: 6948 6172 6520 4b72 6973 686e 6120 0a0e  iHare Krishna ..
00000010: 2052 616d 6120 1be7 5e2f e424 d964 7777   Rama ..^/.$.dww
00000020: 2e24 3270                                .$2p

Explanation:
iHare Krishna   " Enter 'Hare Krishna' on line 1
<C-n> Rama      " Enter 'Hare Rama' on line 2. This works because <C-n>
                " autocompletes alphabetically, and 'Hare' comes before 'Krishna'
<esc>           " Return to normal mode
ç^/             " On every line:
   ä$           "   Duplicate the text on the line horizontally
     Ù          "   Make a new copy of the line
      dw        "   Delete a word
        w       "   Move forward a word
         .      "   Delete a word again
          $     "   Move to the end of the line
           2p   "   And paste what we've deleted twice

The <C-n> command is extremely useful for challenges like this. :)

C#, 109 bytes
void a(){Console.Write("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}

Fairly straightforward, Console.Write implicitly formats the string, and using Write instead of WriteLine not only saves 4 bytes, but avoids a trailing newline. Uses Unix-style newlines so might not work so well on windows, extra 6 bytes for windows by changing \n to \r\n
This method will output directly to the console, if you prefer a method that returns a string:
C#, 118 bytes
string a(){return string.Format("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}

Alternatively if you need a fully stand-alone and compilable program:
C#, 135 bytes
class A{static void main(){System.Console.Write("{0}{1}{0}{1}\n{1}{1}{0}{0}\n{0}{2}{0}{2}\n{2}{2}{0}{0}","Hare ","Krishna ","Rama ");}}

This should work as a compiled program provided you set A as the entry class.

Looks a bit weird without spaces between the words.

@manatwork good point, thankfully spec says trailing spaces are okay, so only cost 3 bytes

Could start a flame war, but you can use var instead of string to reduce the second example even more.

@JohnBaughman A method's return value cannot be var as far as I know, and var.Format() is definitely not a thing

Duh... Didn't think of that. You are correct, I just got myself into lamba world and misinterpreted what I was reading.

In the full program you can save some Byte by writing System.Consol.Write and removing the using-Statement.

Sorry for pinging as this is a bit old now, but... If you swap to the interactive C# compiler you can save quite a bit by omitting System.Console, and you don't need a semicolon at the end because it's only one line. The interactive compiler lets you write code outside of the main function / namespace. The total becomes 90 bytes. Try it online!

Python 2, 92 88 74 bytes
for i in'0101311003020232200':print['Hare','Krishna','Rama','\n'][int(i)],

Try it online!
No, it's not clever, no, it's not the shortest but hey, I'm new to this and it works.
Another solution (84 80 bytes):
h='Hare'
k='Krishna'
r='Rama'
n='\n'
print h,k,h,k,n+k,k,h,h,n+h,r,h,r,n+r,r,h,h

Swap the zeroes and ones, along with 'Hare' and 'Krishna' in the list. This removes the leading zero. Then convert the new number (1010300113121232211) to hex (0xe054e999f20c553), surround it by backticks, and finally realize xnor's answer is still ahead by 12 bytes! https://tio.run/##K6gsycjPM/r/Py2/SCFTITMvwaAi1cDUJNXS0jLNyCDZ1NQ4waqgKDOvJFrduyizOCMvUV1H3SOxKBVIBSXmgngxeeqx0UAVGpmasTr//wMA

C, 85 bytes
i;f(){for(i=0;printf("$0$0900$$9$*$*9**$$)"[i++]-36+"Hare \0Rama \0Krishna \0\n"););}

I would prefer a secular mantra, but I hope this is one of those peaceful religions.
See it work here.
This compacts a naive implementation by 23 bytes.

PowerShell, 73 53 52 Bytes
absolutely demolished by Jeff Freeman - using an actual newline instead of \n saves another byte, and also saved one more on the array format. (from (1,2) to ,1,2)
-1 thanks to TesselatingHeckler, no comma in the array notation.
$a="Hare ";"Krishna ","Rama "|%{"$a$_$a$_
$_$_$a$a"}

My old answer - Tried a few other replace methods but all ended up being slightly longer somehow.
$a,$b,$c="Hare ","Krishna ","Rama ";"$a$b$a$b
$b$b$a$a
$a$c$a$c
$c$c$a$a"

there are newlines in the string.
pretty straightforward, uses the fact that powershell will expand variables within doublequotes, and a shorter method of assigning variables to save some bytes.

Good solution, but I challenge you to get it down more by noticing a pattern in the output and pipelining.  I've got it down to 55 Bytes.  I don't know how to spoiler a comment, so just reply here if you'd like to see it (or if you'd like some hints!).

Instead of a spoiler tag, I figured out how to share via a link.  Try it online!

@JeffFreeman nice one, shaved two more off that on the newline and array - down to 52, beating almost all the non-golfing languages.

Perl, 67 bytes
Inspired by this JavaScript entry.
$_='0101
1100
0202
2200
';s/./qw'Hare Krishna Rama'[$&].$"/ge;print

Perl, 67 bytes
@_=<Hare Krishna Rama>;print"@_[split//]\n"for<0101 1100 0202 2200>

(Hare,Krishna,Rama) saves two bytes in your first code.

MySQL, 115 100 bytes
(Thanks @manatwork!)
SELECT CONCAT(a,b,a,b,d,b,b,a,a,d,a,c,a,c,d,c,c,a,a)FROM(SELECT'Hare 'a,'Krishna 'b,'Rama 'c,'\n'd)t

You can remove all AS .

Good trick, I'll definitely be using this method for some challenges.

R, 75 85 83 bytes
cat(x<-c("Hare ","Krishna ","\n")[c(1,2,1:3,2,2,1,1,3)],sub(x[2],"Rama ",x),sep="")

It creates a vector with Hare , Krishna , and the newline, takes the ones needed, and then repeats it replacing Krishna  by Rama .
Needed to include the space on every word and sep="" because otherwise cat() would put a space at the beginning of each line.

I can't get this to work in TIO

Probably needs a print() or something.

@Giuseppe I'm using here that R automatically prints. But depending how you call it, print() or cat() would be needed. That would require way more bytes. I'll post an alternative with them this weekend :)

@AlbertMasclans no I'm getting an error saying object 'h' not found  https://tio.run/nexus/r#@19gW5BYXJJqXaCRYavkkViUqqSTbavkXZRZnJGXqKSToZOtCZTL1skGMjNAzAydIluloMRcsGQRSKRIpwgs@f8/AA

I think you need to replace the h= with h<- inside the calls to p

Also it outputs a [1] on every line and a bunch of "s.

@Flounderer solved, though adding extra characters.

Yes, outputting exact strings in R is annoying.

Matlab 139 136  105 bytes (thanks to @2501)
fprintf('Hare Krishna Hare Krishna\nKrishna Krishna Hare Hare\nHare Rama Hare Rama\nRama Rama Hare Hare')

Try it Online in Octave!

or 126 bytes if the trailing new line is allowed

@2501: haha that's great. Actually I think it's 105 bytes may be you should post it as an answer

Welcome to PPCG!

You can add it to your answer if you want.

I'm pretty sure further improvements are possible.

FYI, TIO supports Octave :) https://tio.run/nexus/octave#@59WUJSZV5Kmoe6RWJSq4F2UWZyRl6iAzInJg4miyIKImDwwMygxFyoIYsXkgfkIQRChrvn/PwA

x={'Hare ','Krishna ','Rama ',10};[x{'ababdbbaadacacdccaa'-96}] is 64 bytes. :P  (translating @Stewie Griffin's octave submission)

Husk, 22 bytes
ṁSeÖ>m´+Πmw¶¨Hȧeȷ#,R□m

Try it online!
I've worked for quite some time on this answer since I wanted to beat the "compressed number" algorithm of the current top answer by exploiting more of the regularities in the text.
In the end I "only" managed to tie its score. I actually have in mind a couple of builtins for Husk that could easily save more bytes, but implementing them before posting this answer would have felt too much like cheating.
Explanation
Husk automatically prints a matrix of strings by joining them with spaces and newlines. In this case we are actually trying to build the matrix
[["Hare","Krishna","Hare","Krishna"],
["Krishna","Krishna","Hare","Hare"],
["Hare","Rama","Hare","Rama"],
["Rama","Rama","Hare","Hare"]]

which will implicitly get printed to StdOut as the required text. For simplicity, I will show each step of computation as if it was printed by a full program, joining strings with spaces and newlines.
We need to work with "Hare" and ("Krishna" and "Rama"): mw¶¨Hȧeȷ#,R□m
¨Hȧeȷ#,R□m is a compressed string; Husk has a dictionary containing common n-grams (sequences of characters) which are encoded with symbols possibly reminding of the original n-gram. For example, the H here is a plain "H", while ȧe is "are\n".
The plaintext string this decodes to is "Hare\nKrishna Rama" (where \n is an actual newline).
¶ splits this string on the newline, and mw splits each line into words. The output we get up to here is:
Hare
Krishna Rama

"Hare" should pair with both of the other words: Π
Cartesian product of all the lines. This means that we pair each element of the first line with each element of the second line. Our result is:
Hare Krishna
Hare Rama

The first and third lines are just those words repeated twice: m´+
Concatenate each of the lines with itself. (´ makes + use a single argument twice, and m maps this function to each line). We get:
Hare Krishna Hare Krishna
Hare Rama Hare Rama

The other lines are the previous lines sorted in reverse alphabetical order: ṁSeÖ>
This is not as weird as it looks. Ö> sorts a list in descending order. With SeÖ> we create a two-element list with the original argument before and after having been sorted. ṁ maps this function to each line, and concatenates the resulting lists. This is finally:
Hare Krishna Hare Krishna
Krishna Krishna Hare Hare
Hare Rama Hare Rama
Rama Rama Hare Hare

Bash, 93 90 bytes
h="Hare " k="Krishna " r="Rama " s="$h$k$h$k\n$k$k$h$h\n$h$r$h$r\n$r$r$h$h"
echo -e "${s}"

Nice first try. May I suggest a couple of minor improvements? https://pastebin.com/0bYQF26n

@manatwork you should add it as your answer.

Without the variable s= it's down to 79 h="Hare " k="Krishna " r="Rama ";echo -e "$h$k$h$k\n$k$k$h$h\n$h$r$h$r\n$r$r$h$h"

Ruby, 62 61 bytes
As I worked on this it eventually became almost identical to @xnor's Python answer, except Ruby doesn't have spaces between arguments in its print function, forcing me to use joins instead and resulting in a longer answer...
-1 bytes from @manatwork
%w"Krishna Rama".map{|i|puts [h=:Hare,i]*2*' ',[i,i,h,h]*' '}

Try it online!

Make :Hare a Symbol.

Sed, 72
Score includes +1 for the -r flag.
s/^/Hari Krishna/
s/.*/& &/
s/(\S+)(.*)\b(.+)/&\n\3\2\1/p
s/K\S+/Rama/g

Try it online.

Pretty sure there's a way to remove some bytes using change, append or insert instead of substitute. Edit : not that sure anymore ; Edit edit : yeah no that doesn't work because they don't work on the pattern space but instead directly output

Pyth -- 45 41 bytes
Ms(GHGHbHHGG)K"Hare "gK"Krishna "gK"Rama

Try It

AHK, 107 92 bytes
This feels ridiculous but I can't find a shorter means in AHK to do this:
h=Hare
k=Krishna
Send %h% %k% %h% %k%`n%k% %k% %h% %h%`n%h% Rama %h% Rama`nRama Rama %h% %h%

Here's what I tried first that was 107 bytes and tried to be fancy. As Digital Trauma pointed out, though, it would have been shorter to just send the raw text.
n=1212422114131343311
a=Hare |Krishna |Rama |`n
StringSplit,s,a,|
Loop,Parse,n
r:=r s%A_LoopField%
Send %r%

StringSplit creates a pseudo-array with 1 as the first index. So the first term is referenced with s1, the second with s2, etc. Otherwise, there's nothing fancy here.

The entire output is only 92 bytes.  Would it be better simply to Send Hare Krishna ...?

@DigitalTrauma HA! Yes, probably, then. I presumed fancy was better and didn't even check. AHK is not a good language for this.

C 96 bytes
*v[]={"Hare ","Krishna ","Rama ","\n"};
main(){for(long a=0x30ae2305d10;a/=4;printf(v[a&3]));}

You only need two bits of information to figure out which word from the prayer is needed next, so instead of using a bunch of memory and encoding it as a string, you can just encode it as a 40 bit integer (i.e. inside a long int).

APL (Dyalog), 47 bytes
Requires ⎕IO←0 which is default on many systems.
↑∊¨↓'Krishna ' 'Hare ' 'Rama '[(4⍴3)⊤8×4 1 5 2]

Try it online!
8×4 1 5 2 multiply; [32,8,40,16]
(4⍴3)⊤ convert to 4-digit base 3; matrix [[1,0,1,0],[0,0,1,1],[1,2,1,2],[2,2,1,1]]
…[…] index
↓ split into list of lists
∊¨ enlist (flatten each)
↑ mix into matrix (padding with spaces)

Batch, 75 bytes
@for %%h in (Krishna Rama)do @echo Hare %%h Hare %%h&echo %%h %%h Hare Hare

ksh / bash / sh, 66 bytes
h=Hare;for j in Krishna Rama;do echo $h $j $h $j"
"$j $j $h $h;done

@nimi Thanks. Changed it to an , makes it even shorter.
Can't test it myself, but this should work. At least it works in bash and even (busybox)sh.

seems I added a blank in editing, but did subtract one, due to the change from '\n' to

Haskell, 92 91 bytes
g=mapM_ putStr$(!!)["Hare ","Krishna ","Rama ","\n"]<$>(read.(:[]))<$>"0101311003020232200"

Edit: removed concat, used mapM_ for putStr instead
Try it online!

Batch, 117 111 103 89 bytes
@set a=Hare
@for %%A in ("Krishna " "Rama ") do @echo %a%%%~A%a%%%~A^

%%~A%%~A%a%%a%

Down to 103 now that trailing newlines are allowed. Down to 89 after adapting the Powershell answer.
^\n\n is used to insert a newline at the end of the first line and there's a space after Hare.

Brainfuck Substitutor, 277 bytes
{--y{-z[<]w++v->u>+<t-[x[-]Hxtuyy-]>-.ax+[ty<]>>-]<-.rx>+[-vwz>-]>.ext>w<y{]>-. x>tt-<]>u]>-.Kxtuyy-]>w.ix+[v-z>{]>.sx+[vv-z>{]>.hx+[v-z>{]>-.nxt>{<yy-]>.!xwwwww.Rxtuy]>y.mx+[v-z>+>{]>.
Hare Krishna Hare Krishna!Krishna Krishna Hare Hare!Hare Rama Hare Rama!Rama Rama Hare Hare

Brainfuck Substitutor (or BFS for short) can redefine characters to be replaced with other characters.
This program redefines the characters of the Hare Krishna mantra with brainfuck 'mini' programs that prints the appropiate characters.
As this is run in succinct mode (which doesn't need any command line arguments and is on my default), we can't redefine newlines (at least, in the current version) so I use the character ! instead - but it still outputs a newline.
This first bit of the program: {--y{-z[<]w++v->u>+<t-[x[-] is short replacements for patterns that come up often in the future.
The interpreter breaks them down like this:
{ equals --
y equals {- equals ---
z equals [<]
w equals ++
v equals ->
u equals >+<
t equals -[
x equals [-]

Similar thing goes for every other character. I used the shortest brainfuck constants on the esolangs wiki page to get my algorithms, and replaced common patterns. There may be other patterns I can replace (my original attempt was 320 bytes), but this is what I have for now.

Could you replace Hare, Krishna, and Rama with their own macros?

@ETHproductions Maybe I could, but that wouldn't be too interesting ;)

Retina, 60
Direct port of my sed answer:

Hari Krishna
.+
$0 $0
:`(\S+)(.*)\b(.+)
$0¶$3$2$1
K\S+
Rama

Try it online.

Perl, 98 72 bytes
@a=("Hare ","Krishna ","Rama ","\n");foreach(split//,'ababdbbaadacacdccaad'){print $a[ord($_)-97]}
98 now reduced to 72, following @hobbs reworking, nice.
print+("Hare ","Krishna ","Rama ",$/)[$_]for'01013110030202322003'=~/./g

Good start! Here are some tips: https://gist.github.com/arodland/c061dd7b0207a9b77a768391c3ff3e64

And the PPCG Perl golfing tips

Retaining the ideas from yours but just golfing it harder puts it within a few bytes of the best perl solutions

Nice work, have revised the answer accordingly.

Perl, 76 74 bytes
$_=121202211;$_.=0 .y/2/3/r;print$_?(0,Hare,Krishna,Rama)[$_].$":$/for/./g

2 bytes shorter: Try it online! (I'm pretty sure the output is the right one)

Java 7, 104 103 bytes
String c(){return"xyxy\nyyxx\nxRama xRama\nRama Rama xx".replace("x","Hare ").replace("y","Krishna ");}

Explanation:
String c(){                                      // Method without parameters and String return-type
  return"xyxy\nyyxx\nxRama xRama\nRama Rama xx"  //  Return this String
    .replace("x","Hare ")                        //  after we've replaced all "x" with "Hare "
    .replace("y","Krishna ");                    //  and all "y" with "Krishna "
}                                                // End of method

Try it here.

Hack 68 bytes
<?hh echo strtr("0101
1100
0202
2200",["Hare ","Krishna ","Rama "]);

Straight port of the PHP Answer, just wanted to finally get an excuse to use hack in PPCG :D

Haskell 103 95 Bytes
main=putStr$concat$concat$[[h,x,h,x,n,x,x,h,h,n]|x<-["Krishna ","Rama "]]where h="Hare ";n="\n"

Old 103 Bytes:
main=putStr$concat[h,k,h,k,n,k,k,h,h,n,h,r,h,r,n,r,r,h,h] where h="Hare ";k="Krishna ";r="Rama ";n="\n"

C++ 158 Bytes
#include <iostream>
#define H "Hare "
#define K "Krishna "
#define R "Rama "
#define N "\n"
void m(){std::cout<<(H K H K N K K H H N H R H R N R R H H);}

C# 103 99 Bytes
()=>{string a="Hare ",b="Krishna ",c="Rama ",d="\n";return a+b+a+b+d+b+b+a+a+d+a+c+a+c+d+c+c+a+a;};

Ungolfed full program:
class A
{
    static void Main()
    {
        System.Func<string> f =
            () =>
            {
                string a = "Hare ",
                    b = "Krishna ",
                    c = "Rama ",
                    d = "\n";
                return a + b + a + b + d + b + b + a + a + d + a + c + a + c + d + c + c + a + a;
            };
        System.Console.Write(f());
    }
}

You could golf it by 1 byte by using a port of my Java 7 answer: ()=>{return"xyxy\nyyxx\nxRama xRama\nRama Rama xx".Replace("x","Hare ").Replace("y","Krishna ");}; Try it here.

Clojure(Script), 70 bytes (69 bytes?)
(def a"Hare")(run! #(println a % a %(str"\n"%)% a a)["Krishna""Rama"])

This version with 69 bytes will only work at the repl, because map is lazy and I don't use the return value for anything. Dunno how the rules work in this case...
(def a"Hare")(map #(println a % a %(str"\n"%)% a a)["Krishna""Rama"])

Welcome to Programming Puzzles & Code Golf! I'd say that your 69-byte solution is correct, because here on PPCG, a language is defined by its implementation.

Perl 6, 61 60
my $a="Hare ";"$a$_ $a$_\n$_ $_ $a$a".say for <Krishna Rama>

Emacs Lisp, 109 bytes
(lambda()(apply'concat(mapcar(lambda(x)(nth(- x ?a)'("Hare ""Krishna ""Rama ""\n")))"ababdbbaadacacdccaad")))

Can theoretically be reduced to 103 bytes by using ^@,^A,^B and ^C instead of a, b, c and d and x instead of (nth(- x ?a)), but then it could not be pasted due to NULL characters.

How long would it be to output the original raw string directly?

@Cœur 91 as the length of the string itself, +2 for quotes, +10 if you wrap it in a lambda, resulting in 103 total. Emacs Lisp is not a good language for golfing.

Wolfram Mathematica, 71 75 bytes
{"Krishna ","Hare ","Rama ","\n"}[[IntegerDigits[73825885093,4]+1]]<>""

Every part of result was encoded as an index in a list, and every index was encoded as digit of 4-ary integer.

Welcome to Programming Puzzles and Code Golf! :)

///, 46 bytes
/4/Hare //k/Krishna //X/4k4k
kk44/X
/k/Rama /X

Try it online!
There was already one answer in ///, but this one adds a bit of complexity to remove some bytes.
In pseudocode this could translate to:
4="Hare "
k="Krishna "
X=4+k+4+k+'\n'+k+k+4+4
print(X+'\n')
replace k with "Rama "
print(X)

(I wanted to use h as the letter to substitute with "Hare ", but "Krishna" also contains an h, so that messed up the substitutions and I had to switch it with 4)

Wren, 91 bytes
Fn.new{
var n="Hare"
return["Krishna","Rama"].map{|i|[n,i,n,i,"
"+i,i,n,n].join(" ")+"
"}
}

Try it online!
Explanation
Fn.new{                                    // New anonymous function
var n="Hare"                               // Define a template constant
return["Krishna","Rama"].map{|i|[n,i,n,i,  /* Map using the rule*/"
"+i,i,n,n].join(" ")+                      /* [n,i,n,i,"\n",i,i,n,n]*/"
"}
}

CSS: 132 Bytes
No use of HTML. Not the best, not the worst but the Brainfuck (No. of bytes) and Matlab solutions (Direct output) made me post this. Can some CSS wizards help save some bytes?

body:after{content:"Hare Krishna Hare Krishna\AKrishna Krishna Hare Hare\AHare Rama Hare Rama\ARama Rama Hare Hare";white-space:pre}

CSS with superpowers could not beat it until someone can prove me wrong.
SASS: 163 Bytes
$a:Hare;$b:Krishna;$c:Rama;body:after{content:"#{$a} #{$b} #{$a} #{$b}\A#{$b} #{$b} #{$a} #{$a}\A#{$a} #{$c} #{$a} #{$c}\A#{$c} #{$c} #{$a} #{$a}";white-space:pre}

Run it on:

Fourier, 94 bytes
|72a97a114a101a32a|H|75a114a-9a115a104a+6a97a32a|K|82a97a109a97a32a|RHKHK10aKKHH10aHRHR10aRRHH

Try it on FourIDE!
Makes good use of functions: H for Hare, K for Krishna and R for Rama.
Now I can't get the song My Sweet Lord out of my head :P

05AB1E, 54 bytes
•4Ñ••}ò´••9Ä•)©\•2}¾S•3BRv®yè8ÝJ"ahrekisnm"‡})4ôvyðý™,

Try it online!
•4Ñ•                          # Hare
    •}ò´•                     # Krishnu
         •9Ä•)©\              # Rama
                •2}¾S•3BR     # Sequencing data.
v®yè8ÝJ"ahrekisnm"‡}          # For each sequence part, push the right word.
                    )4ôvyðý™, # Format it correctly.

05AB1E changed its base-214 encryption to base-255; this is the reason this submission no longer works; however, it was valid at the time.

@DLosc 05AB1E changed it's base-214 encryption to base-255; this is the reason this submission no longer works.

@DLosc I think this would be like ~34 bytes now.

Does 05AB1E also change Krishna to Krishna?

SmileBASIC 3, 76 bytes
Straightforward answer with string multiplication. ? is print.
?"Hare Krishna "*2?"Krishna "*2+"Hare "*2?"Hare Rama "*2?"Rama "*2+"Hare "*2

cat 97 bytes
Hare Krishna Hare Krishna<CR>
Krishna Krishna Hare Hare<CR>
Hare Rama Hare Rama<CR>
Rama Rama Hare Hare<^D>

I consider <^D> as two characters, whence 97

I would really like to know what's wrong with the answer. It's working, and it's shorter than many "clever" answers by people around. So what?!

Is is not very clever of semi boring

There are many puzzles where the "trivial" output is, in fact, the shortest. Even if it isn't, I always start with the trivial solution so I have something to compare against. This answer is straight-forward, but perfectly fine.

https://mothereff.in/byte-counter this site would beg to differ with your byte count

@BrianH. Right, it should be even lower; I'm not sure how I counted, I probably considered <CR> as 2 charaters rather than 1.

it's giving 107 bytes...

@BrianH. Well, <CR> stands for carriage return, i.e., enter (1 keypress).

Groovy, 82 bytes
a=["Hare ","Krishna ","Rama ","\n"]
"0101311003020232200".each{print a[it as int]}

An improvement of my previous answer (1 byte longer)
h="Hare "
k="Krishna "
r="Rama "
n="\n"
print h+k+h+k+n+k+k+h+h+n+h+r+h+r+n+r+r+h+h

Recursiva, 57 53 bytes
r2r1r0"0101/n1100/n0202/n2200"'Hare ''Krishna ''Rama

Try it online!

///, 49 bytes
/#/Hare //k/Krishna //j/Rama /#k#k
kk##
#j#j
jj##

Try it online!
Although /// is an esoteric language, this one is shorter than most of the other (non-golfing, and a bad implementation of this problem in Retina) languages here. Mostly because /// has too few functionalities, that they can be represented in few bytes.

Javascript 85 bytes
I know there's a better answer already, but i wanted to give it a try anyway, the method is pretty different as you'll see:
a=["Krishna ","Rama "];q="Hare ";b=(z)=>q+a[z]+q+a[z]+`
`+a[z]+a[z]+q+q+`
`;b(0)+b(1)

a=["Krishna ","Rama "];q="Hare ";b=(z)=>q+a[z]+q+a[z]+`
`+a[z]+a[z]+q+q+`
`;console.log(b(0)+b(1));

Please note that i had to put the console.log() in a weird spot, if you just paste the code block into the console it'll print the mantra.
dumbded down better golfed version 76 bytes:
a="Krishna ";b="Rama ";c="Hare ";d=`
`;c+a+c+a+d+a+a+c+c+d+c+b+c+b+d+b+b+c+c

a="Krishna ";b="Rama ";c="Hare ";d=`
`;console.log(c+a+c+a+d+a+a+c+c+d+c+b+c+b+d+b+b+c+c)

Jq 1.5, 59 57 54 52 bytes
def h:"Hare "+.;"Krishna ","Rama "|h*2,.*2+"Hare "*2

Try it online!

J, 49 41 bytes
;"1{&(<;.2'Hare Krishna Rama ')(,-)#:5 12

How it works
                                   #:5 12 to binary [(0 1 0 1), (1 1 0 0)]
                               ( -)       negate    [(0-1 0-1),(-1-1 0 0)]
                               (, )       append    [(0 1 0 1),(1 1 0 0),(0-1 0-1),(-1-1 0 0)]
     (<;. 'Hare Krishna Rama ')           split by
         2                                the last character, keep it in
   {&                                     negative argument selects from the end
;"1                                       get rid of the ASCII boxes

Try it online!

SmileBASIC, 58 bytes
We can use the fact that the second half is the same as the first, with "Krishna" replaced by "Rama"
P"Krishna
P"Rama
DEF P K?("Hare "+K)*2?K*2;"Hare "*2
END

(Note trailing spaces)
Storing "Hare " in a variable is the same length.

Vyxal, 73 bytes
`Hλ½ K≥τ⇧¨ Hλ½ K≥τ⇧¨
K≥τ⇧¨ K≥τ⇧¨ Hλ½ Hλ½
Hλ½ R□• Hλ½ R□•
R□• R□• Hλ½ Hλ½`

Try it Online!

K (ngn/k), 65 bytes
{`0:,/("Hare ";"Krishna ";"Rama ";"\n")@"ababdbbaadacacdccaa"-97}

Try it online!
This has to be the longest K program I have ever written. Takes "aba..."-97 from the Octave answer.

Vyxal 3, 39 bytes
"ᶜ₂ᶠ„•;DJ$Ṙd½Jf:•"ᵇcð₇₁„r$•"ᴳ=Ṡ„rJᵛV4Ẇ'

Try it Online!

Tcl, 87 bytes
puts "[set h Hare] [set k Krishna] $h $k
$k $k $h $h
$h [set r Rama] $h $r
$r $r $h $h"

Try it online!

[set h Hare]?
[set r Rama]?

@Scrooble: What are you trying to ask? set puts the value in a var that can later be consulted if prefixed by $

Your code does not output quite what the challenge specifies. I was giving corrections; sorry for my lack of clarity.

@Scrooble: Thanks. Now fixed. Sorry for misunderstanding you

Go, 167 bytes
func f(){w,i,k:=[]string{"Hare","Krishna","Rama"},[]int{0,1,0,1,1,1,0,0,2,0,2,0,2,2,0,0},0
for _,e:=range i{if k>3{print(`
`)
k=0}
if k>0{print(" ")}
print(w[e])
k++}}

Attempt This Online!
Prints to STDERR.

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