text:
Forecast Palindromic Dates
Palindromic dates are dates that appear as palindromes: the string of digits can be read the same way backwards as forwards. For the North American date format (MM/DD/YYYY), the next few palindromic dates are:
02/02/2020
12/02/2021
03/02/2030
The Challenge
Create a function that returns all palindromic dates in a consistent, common date format (of your choosing) that fall within a range of dates (edit: including the range itself).
Rules

To qualify as a palindrome, only the numeric characters of the date should be
checked.
The date can be in any common format (MM/DD/YYYY, DD-MM-YYYY), as
long as it uses two digits for both the month and day and four for
the year, and it uses a character to separate parts of the date. The output must preserve seperating characters (/, -, etc.). Your function only needs to handle one distinct date format. Please include the format in your answer.
If there are more than one dates returned, they should be comma or
new-line separated.
Shortest answer wins!

Example
date_palindrome('05/02/2050', '12/12/2060')
>>>['05/02/2050', '06/02/2060']

If i want to post a  Oracle SQL answer can I use the input type DATE avoiding a to_date() or I have to use the less golfable VARCHAR2?

I don't know enough about Oracle SQL to answer this.

MATL, 24 23 bytes
YOZ}&:"@23XOtt47>)tP=?8M

Accepts  input in the form of an array of string {lower, upper} where the date format is 'MM/DD/YYYY'. Output is in the format MM/DD/YYYY as well.
Try it Online
Explanation
        % Implicitly grab the two inputs
YO      % Convert to serial date format
Z}      % Push them onto the stack separately
&:      % Create an array from [lower...upper] incrementing 1 day
"       % For each day
  @23XO % Get the string version of the date (mm/dd/yyyy)
  tt    % Duplicate twice
  47>)  % Get the numeric parts
  tP=   % Compare numeric part with the flipped version of the numeric part
  ?8M   % If they are the same push it to the stack
        % Implicitly display stack contents

Python 2, 197 bytes
One byte saved thanks to @cat!
from datetime import*
def g(a,b):
 for s in"ab":exec"%s=date(*[int(x)for x in %s.split('-')])"%(s,s)
 for d in range((b-a).days+1):
    x=str(a+timedelta(d));y=x.replace("-","")
    if y==y[::-1]:print x

Try it here!
Input and output format is YYYY-MM-DD. First intendation level is spaces, second one is tabs.
Nothing too special going on here. Uses some exec abuse to convert the input to date objects by splitting the date string on - and splatting the list into the date constructor. Then we just iterate over all dates in their inclusive range and print the ones which are palindromic.

Put the from datetime import* on the first line to save a byte

Not sure, but does \a+timedelta(d)`the same asstr(a+timedelta(d))`?

@Mathias711 Unfortunately not, repr is usually only equivalent to str for primitive datatypes. For date objects I get datetime.date(2012, 12, 12) for instance.

Bash + GNU utilities, 116 84
Requires 64-bit version of date for the given testcase.
set date -uf- +%
jot -w@ - `$@s` 86400|$@F|sed -r 'h
:
s/-|^(.)(.*)\1$/\2/
t
/./d
g'

I/O is in YYYY-MM-DD format.  Input is taken from two lines of stdin, e.g.
printf "%s\n" 2050-05-02 2060-12-12 | ./palindate.sh

Explanation

set saves the date command template so it may be accessed using the $@ parameter
date -uf- +%s converts endpoint dates to number of seconds since the Unix epoch
jot interpolates this to give a list of seconds-from-the-epoch, one per day, each prefixed with @
date -uf- +%F formats each list entry as YYYY-MM-DD
sed checks for palindromes:

h save the input line to the hold buffer
: define "unnamed" label
s/-|^(.)(.*)\1$/\2/ if a dash is found, remove it or if the first and last characters match, remove them
t if there was a match above, jump back to the unnamed label
/./d if there are any characters left over, the line is not a palindrome - delete it and continue to the next line
g if we got here, then no line deletion happened, thus the line must have been a palindrome.  Get the line back from the hold buffer and implicitly display it.

PowerShell v2+, 127 bytes
for($a,$b=[datetime[]]$args;$a-le$b){if(($c="{0:yyyyMMdd}"-f$a)-eq-join$c[$c.length..0]){"{0:MM/dd/yyyy}"-f$a}$a=$a.AddDays(1)}

Takes input as command-line arguments $args in MM/DD/YYYY (or similar) format and recasts as a [datetime] array, stores them in $a and $b. That's the setup step of the for loop. The conditional is so long as $a is less-than-or-equal-to $b.
Each iteration, we set $c equal to a -formatted string of yyyyMMdd style, based on $a. We then compare if that's -equal to $c reversed (using an array-join trick). If so, we output $a in the proper format. Either way, we increment $a with .AddDays(1) to move to the next day.
Example
PS C:\Tools\Scripts\golfing> .\forecast-palindromic-dates.ps1 '06/23/2016' '12/12/2020'
02/02/2020

Julia, 132 bytes
f(a,b,t=s->DateTime(s,"mm/dd/y"),g=d->Dates.format(d,"mm/dd/yyyy"))=map(g,filter(d->(r=replace(g(d),"/",""))==reverse(r),t(a):t(b)))

This is a function that accepts two strings and returns an array of strings.
Ungolfed:
function f(a, b)
    # Define a function to create a DateTime object from a string
    t = s -> DateTime(s, "mm/dd/y")

    # Define a function to create a string from a DateTime object
    g = d -> Dates.format(d, "mm/dd/yyyy")

    # Filter the range a:b to palindromic dates
    p = filter(d -> (r = replace(g(d), "/", "")) == reverse(r), t(a):t(b))

    # Format all dates in the array
    m = map(g, p)

    return m
end

Try it online!

JavaScript (ES6), 159 154 bytes
(s,e)=>{for(r=[],s=Date.parse(s),e=Date.parse(e);s<=e;s+=864e5){d=new Date(s).toJSON().slice(0,10);`${a=d.match(/\d/g)}`==a.reverse()&&r.push(d)}return r}

I/O in ISO format. Ungolfed:
function date_palindrome(start, end) {
    start = Date.parse(start);
    end = Date.parse(end);
    var result = [];
    while (start <= end) {
        var date = new Date(start).toISOString().slice(0, 10);
        var digits = date.match(/d/g);
        if (digits.join() == digits.reverse.join()) {
            result.push(date);
        }
        start += 24 * 60 * 60 * 1000; // ms
    }
    return result;
}

Java 7, 436 435 416 bytes *sigh..*
import java.text.*;import java.util.*;void c(String...a)throws Exception{DateFormat f=new SimpleDateFormat("dd-MM-yyyy");Calendar s=Calendar.getInstance(),e=Calendar.getInstance();s.setTime(f.parse(a[0]));e.setTime(f.parse(a[1]));for(Date d=s.getTime();s.before(e);s.add(5,1),d=s.getTime()){String o=f.format(d),x=o.replaceAll("\\W|_",""),w="";for(char c:x.toCharArray())w=c+w;if(x.equals(w))System.out.println(o);}}

Input & Output format: dd-MM-yyyy
Ungolfed & test code:
Try it here.
import java.text.*;
import java.util.*;

class Main{
  static void c(String... a) throws Exception{
    DateFormat f = new SimpleDateFormat("dd-MM-yyyy");
    Calendar s = Calendar.getInstance(),
             e = Calendar.getInstance();
    s.setTime(f.parse(a[0]));
    e.setTime(f.parse(a[1]));
    for(Date d = s.getTime(); s.before(e); s.add(Calendar.DATE, 1), d = s.getTime()){
      String o = f.format(d),
             x = o.replaceAll("\\W|_", ""),
             w = "";
      for(char c : x.toCharArray()){
        w = c + w;
      }
      if(x.equals(w)){
        System.out.println(o);
      }
    }
  }

  public static void main(String[] a){
    try{
      c("05-02-2050", "12-12-2060");
    } catch (Exception e){}
  }
}

Output:
05-02-2050
15-02-2051
25-02-2052
06-02-2060

+1. Cause, y'know, Java.

@cat Thanks for the comment I guess, but you forgot to actually +1 the answer. ;P

Well, actually, my lazy browser didn't feel like agreeing that I +1'd and so when I refresh, bam, my vote is gone D:

TSQL, 88 bytes
Using ISO8601 format for date(yyyy-mm-dd)
DECLARE @ date='2050-05-02',@t date='2060-12-12'

a:IF stuff(reverse(@),3,1,'')=stuff(@,8,1,'')PRINT @
SET @=dateadd(d,1,@)IF @<=@t GOTO a

Fiddle

Oracle 11: SQL:  246 bytes (hey, at least I beat Java :P lol )
with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);

Output:
  SQL> with d as(select to_date('&1','yyyy-mm-dd')s,to_date('&2','yyyy-mm-dd')e from dual),r as(select level-1 l from d connect by level<=e-s+1),x as(select s+l y,to_char(s+l,'yyyymmdd')w from d,r)select to_char(y,'yyyy-mm-dd')from x where w=reverse(w);
  Enter value for 1: 2000-01-01
  Enter value for 2: 2021-01-01

  TO_CHAR(Y,
  ----------
  2001-10-02
  2010-01-02
  2011-11-02
  2020-02-02

  SQL>

In readable format:
  with d as (select to_date('&1','yyyy-mm-dd') s,
                    to_date('&2','yyyy-mm-dd') e
              from dual),
        r as (select level-1 l
                from d connect by level <= e-s+1),
        x as (select s+l y, to_char(s+l,'yyyymmdd') w
                from d,r)
  select to_char(y,'yyyy-mm-dd')
    from x
   where w=reverse(w);

Explained:
d: get input for start/end
r: generate rows needed, 1 per day.
x: calculate the actual dates, and convert them to a minimal string.
final: use REVERSE function to verify the palindroms, return in proper format.

Learned about the REVERSE function today :)

C#, 97 94 bytes
(a,b)=>{for(;a<b;a=a.AddDays(1))if($"{a:yyy}".SequenceEqual($"{a:MMdd}".Reverse()))a.Dump();};

C# lambda (Action) where inputs are DateTime and the output is printed by using the .Dump() method (@EvilFonti's trick).

C#, 115 112 bytes
(a,b)=>{var r="";for(;a<b;a=a.AddDays(1))if($"{a:yyy}".SequenceEqual($"{a:MMdd}".Reverse()))r+=a+",";return r;};

C# lambda (Func) where inputs are DateTime and output is a string.
Code:
(a,b)=> {
    var r="";
    for(;a<b;a=a.AddDays(1)) {
        if($"{a:yyy}".SequenceEqual($"{a:MMdd}".Reverse()))
            r+=a+",";
    }
    return r;
};

Try them online!

VBA, 240 193 bytes
Function f(a, b)
Dim j, g()
For i = CDate(a) To CDate(b)
    If Format(i, "yyyy") = StrReverse(Format(i, "mmdd")) Then
        ReDim Preserve g(j)
        g(j) = Format(i, "yyyy-mm-dd")
        j = j + 1
    End If
Next
f = g()
End Function

That's it in a comprehensible format. Test case:
Sub e()
MsgBox Join(f("5/2/2050", "6/2/2060"), ", ")
End Sub

Without that much redundancy:
Function f(a,b)
Dim j, g()
For i=CDate(a) To CDate(b)
If Format(i,"yyyy")=StrReverse(Format(i,"mmdd")) Then
ReDim Preserve g(j)
g(j)=Format(i,"yyyy-mm-dd")
j=j+1
End If
Next
f=g()
End Function

Javascript (using external library) (158 bytes)
(a,b)=>_.RangeTo(a%1e20,b%1e20,864e5).Select(y=>new Date(y)).Where(x=>z=(_.From(x.toJSON()).Where(y=>!isNaN(y)).Take(8)).SequenceEqual(z.Reverse())).ToArray()

Link to lib: https://github.com/mvegh1/Enumerable
Code explanation: Ok, I finally used some actual code golfing here for once. So the inputs a,b are Date objects. Create a range of integers from a to b, where a and b are coerced into integers, and the distance between values in the range is 86400000, i.e the amount of ticks in one day. Map each value in the range to a date object. Filter that range by the predicate that represents palindromic dates. The logic to determine that is simple...cast the JSON string representation of the current date object to a char array using the library and filter out the non-numeric entries, and only take the first 8 values (because the that would be yyyyMMdd) and store that into variable z, then check if z is equivalent to z Reversed. Finally, cast back to native JS array
Edit: Shaved 2 bytes by removing unnecessary parens..

Java, 269 bytes
import java.time.LocalDate;void q(String...a)throws Exception{LocalDate s=LocalDate.parse(a[0]);while(!s.isAfter(LocalDate.parse(a[1]))){String d=s.toString().replace("-","");if(d.equals(new StringBuffer(d).reverse().toString()))System.out.println(d);s=s.plusDays(1);}}

Ungolfed:
import java.io.IOException;
import java.time.LocalDate;

public class UnGolfedPalindromicDates {
    public static void main(String...a) throws IOException {
        LocalDate start = LocalDate.parse(a[0]), end = LocalDate.parse(a[1]);
        while (!start.isAfter(end)) {
            String d = start.toString().replace("-","");
            if (palindrome(d)) System.out.println(d);
            start = start.plusDays(1);
        }
    }

    public static boolean palindrome(String s) {
        return s.equals(new StringBuffer(s).reverse().toString());
    }
}


text:
Index sum and strip my matrix
Index sum and strip my matrix
Given a matrix/2d array in your preferable language
Input:

The matrix will always have an odd length
The matrix will always be perfectly square
The matrix values can be any integer in your language (positive or negative)

Example:
1  2  3  4  5  6  7
2  3  4  5  6  7  8
3  4  50 6  7  8  9
4  5  6 100 8  9  10
5  6  7  8 -9  10 11
6  7  8  9  10 11 12
7  8 900 10 11 12 0

Definitions:

The "central number" is defined as the number that has the same amount of numbers to the left,right,up and down

In this case its middlemost 100

The "outer shell" is the collection of numbers which their x and y index is or 0 or the matrix size

1  2  3  4  5  6  7
2                 8
3                 9
4                 10
5                 11
6                 12
7  8 900 10 11 12 0

Your task:
Add to the central number the sum of each row and column after multiplying the values in each by their 1-based index
A single row for example
4  5  6  7  8

for each number
number * index + number * index.....

4*1 + 5*2 + 6*3 + 7*4 + 8*5 => 100

example:
 2 -3 -9  4  7  1  5  => 61
-2  0 -2 -7 -7 -7 -4  => -141
 6 -3 -2 -2 -3  2  1  => -10
 8 -8  4  1 -8  2  0  => -20
-5  6  7 -1  8  4  8  => 144
 1  5  7  8  7 -9 -5  => 10
 7  7 -2  2 -7 -8  0  => -60
                         |
78 65 60 45 -15 -89 10   => 154
                     |
                     => -16

For all rows and columns you combine these values..
Now you sum these too => 154-16 = 138
You add that number to the "central number" and remove the "outer shell" of the matrix

 0 -2 -7 -7 -7     => -88
-3 -2 -2 -3  2     => -15
-8  4 1+138 -8  2  => 395
 6  7 -1  8  4     => 69
 5  7  8  7 -9     => 26

19 69 442 30 -26

do this untill you end up with a single number
-2 -2 -3     => -15
 4  1060 -8  => 2100
 7 -1  8     => 29

27 2115 5

Add 2114+2147 to 1060
Remove the "outer shell" and get 5321
Now we have a single number left

this is the output!
test cases:
-6

-6

-7 -1  8
-4 -6  7
-3 -6  6

2

 6  7 -2  5  1
-2  6 -4 -2  3
-1 -4  0 -2 -7
 0  1  4 -4  8
-8 -6 -5  0  2

-365

 8  3  5  6  6 -7  5
 6  2  4 -2 -1  8  3
 2  1 -5  3  8  2 -3
 3 -1  0  7 -6  7 -5
 0 -8 -4 -9 -4  2 -8
 8 -9 -3  5  7  8  5
 8 -1  4  5  1 -4  8

17611

-9 -7  2  1  1 -2  3 -7 -3  6  7  1  0
-7 -8 -9 -2  7 -2  5  4  7 -7  8 -9  8
-4  4 -1  0  1  5 -3  7  1 -2 -9  4  8
 4  8  1 -1  0  7  4  6 -9  3 -9  3 -9
-6 -8 -4 -8 -9  2  1  1 -8  8  2  6 -4
-8 -5  1  1  2 -9  3  7  2  5 -6 -1  2
-8 -5 -7 -4 -9 -2  5  0  2 -4  2  0 -2
-3 -6 -3  2 -9  8  1 -5  5  0 -4 -1 -9
-9 -9 -8  0 -5 -7  1 -2  1 -4 -1  5  7
-6 -9  4 -2  8  7 -9 -5  3 -1  1  8  4
-6  6 -3 -4  3  5  6  8 -2  5 -1 -7 -9
-1  7 -9  4  6  7  6 -8  5  1  0 -3  0
-3 -2  5 -4  0  0  0 -1  7  4 -9 -4  2

-28473770

This is a codegolf challenge so the program with the lowest bytecount wins

you are correct, thats a typo

why would negative numbers be an issue? I dont think the challenge should adjust for esolangs but maybe the other way around is more appropriate

@LuisMendo I think it's not a problem, the rule "The matrix values can be any integer in your language" means to me that if your language doesn't have negative numbers, it shouldn't support them.

actually thats correct. but then the test cases wont work properly

@Fatalize Actually I hadn't seen that rule :-D Removing comments

"I dont think the challenge should adjust for esolangs but maybe the other way around is more appropriate" that should be engraved in stone

MATL, 36 34 bytes
tnq?`t&+stn:*sytn2/)+ 7M(6Lt3$)tnq

Input is a 2D array with ; as row separator
Try it online! Or verify all test cases.
Explanation
tnq       % Take input. Duplicate, get number of elements, subtract 1
?         % If greater than 0
  `       %   Do...while
    t     %     Duplicate
    &+    %     Sum matrix with its transpose
    s     %     Sum each column. Gives a row vector
    tn:   %     Vector [1 2 ...] with the same size
    *     %     Multiply element-wise
    s     %     Sum of vector. This will be added to center entry of the matrix
    y     %     Duplicate matrix
    tn2/  %     Duplicate, get half its number of elements. Gives non-integer value
    )     %     Get center entry of the matrix, using linear index with implicit rounding
    +     %     Add center entry to sum of previous vector
    7M    %     Push index of center entry again
    (     %     Assgined new value to center of the matrix
    6Lt   %     Array [2 j1-1], twice. This will be used to remove shell
    3$)   %     Apply row and col indices to remove outer shell of the matrix
    tnq   %     Duplicate, number of elements, subtract 1. Falsy if matrix has 1 entry
          %   End do...while implicitly. The loop is exited when matrix has 1 entry
          % End if implicitly
          % Display stack implicitly

Python 2.7, 229 bytes
This is my first attempt at something like this, so hopefully I followed all the rules with this submission. This is just a function which takes in a list of lists as its parameter. I feel like the sums and list comprehension could probably be shortened a little bit, but it was too hard for me. :D
def r(M):
  t=len(M)
  if t==1:return M[0][0]
  M[t/2][t/2]+=sum(a*b for k in [[l[x] for l in M]for x in range(0,t)]for a,b in enumerate(k,1))+sum([i*j for l in M for i,j in enumerate(l,1)])
  return r([p[+1:-1]for p in M[1:-1]])

Thx to Easterly Irk for helping me shave off a few bytes.

You can remove a couple spaces between operators (...) + sum([i*j... -> ...)+sum([i*j...), but overall, great first post!!!!

oooh missed that. Thanks!

Also, ...]for ... works. You can remove at least 2 space like that. (end of list hits the for loop)

C#, 257 bytes
here is a non esolang answer
void f(int[][]p){while(p.Length>1){int a=p.Length;int r=0;for(int i=0;i<a;i++)for(int j=0;j<a;j++)r+=(i+j+2)*p[i][j];p[a/2][a/2]+=r;p=p.Where((i,n)=>n>0&&n<p.Length-1).Select(k=>k.Where((i,n)=>n>0&&n<p.Length-1).ToArray()).ToArray();}Console.Write(p[0][0]);

ungolfed:
void f(int[][]p)
    {
        while (p.Length>1)
        {
            int a=p.Length;
            int r=0; //integer for number to add to middle
            for (int i = 0; i < a; i++)
                for (int j = 0; j < a; j++)
                    r +=(i+j+2)*p[i][j]; //add each element to counter according to their 1 based index
            p[a / 2][a / 2] += r; //add counter to middle
            p = p.Where((i, n) => n > 0 && n < p.Length - 1).Select(k => k.Where((i, n) => n > 0 && n < p.Length - 1).ToArray()).ToArray(); //strip outer shell from array
        }
        Console.Write(p[0][0]); //print last and only value in array
    }

Hey now, J isn't an esolang.

This doesn't compile if you don't include using System.Linq and using System. I'm not sure if it's required by the rules though.

its not a full program, its only a function so its ok as far as i know.
i mean, would i also need to include the App.config and all the bytes in the properties and makefile? no

@downrep_nation It's just weird, since I've seen some people include them in the source when it has only been a function and they've included the bytes on the score.

Now when I think about it, I'm on the line that you should import atleast System.Linq. Other languages that require importing in order to use certain features go through the same process, so I think it's unfair to assume that every module is loaded to memory in C#.

@TuukkaX System.Linq is absolutely default in c# 5. Im not implying Console is statically define so i just Write() or something like that right

@downrep_nation I see. If you're using C# 5+ features then edit the title to say something like C# 5+ or C# 5.

J, 66 bytes
([:}:@}."1@}:@}.]+(i.@,~=](]+*)<.@-:)@#*[:+/^:2#\*]+|:)^:(<.@-:@#)

Straight-forward approach based on the process described in the challenge.
[:+/^:2#\*]+|: gets the sum. ]+(i.@,~=](]+*)<.@-:)@#* is a particularly ugly way to increment the center by the sum. [:}:@}."1@}:@}. removes the outer shell. There probably is a better way to do this.
Usage
   f =: ([:}:@}."1@}:@}.]+(i.@,~=](]+*)<.@-:)@#*[:+/^:2#\*]+|:)^:(<.@-:@#)
   f _6
_6
   f _7 _1 8 , _4 _6 7 ,: _3 _6 6
2
   f 6 7 _2 5 1 , _2 6 _4 _2 3 , _1 _4 0 _2 _7 , 0 1 4 _4 8 ,: _8 _6 _5 0 2
_365
   f 8 3 5 6 6 _7 5 , 6 2 4 _2 _1 8 3 , 2 1 _5 3 8 2 _3 , 3 _1 0 7 _6 7 _5 , 0 _8 _4 _9 _4 2 _8 ,8 _9 _3 5 7 8 5 ,: 8 _1 4 5 1 _4 8
17611
   f (13 13 $ _9 _7 2 1 1 _2 3 _7 _3 6 7 1 0 _7 _8 _9 _2 7 _2 5 4 7 _7 8 _9 8 _4 4 _1 0 1 5 _3 7 1 _2 _9 4 8 4 8 1 _1 0 7 4 6 _9 3 _9 3 _9 _6 _8 _4 _8 _9 2 1 1 _8 8 2 6 _4 _8 _5 1 1 2 _9 3 7 2 5 _6 _1 2 _8 _5 _7 _4 _9 _2 5 0 2 _4 2 0 _2 _3 _6 _3 2 _9 8 1 _5 5 0 _4 _1 _9 _9 _9 _8 0 _5 _7 1 _2 1 _4 _1 5 7 _6 _9 4 _2 8 7 _9 _5 3 _1 1 8 4 _6 6 _3 _4 3 5 6 8 _2 5 _1 _7 _9 _1 7 _9 4 6 7 6 _8 5 1 0 _3 0 _3 _2 5 _4 0 0 0 _1 7 4 _9 _4 2)
_28473770

Brachylog, 114 bytes
{l1,?hh.|:{:Im:I:?:{[L:I:M]h:JmN,Ll:2/D(IJ,M{$\:?c:{:{:ImN,I:1+:N*.}f+.}a+.}:N+.;'(DIJ),N.)}f.}f:7a$\:7a&.}.
brbr.

I'm suprised this even works to be honest. At least I realized that Brachylog really needs a "change value of that element" as a built-in though…
Usage example:
?- run_from_file('code.brachylog', '[[0:_2:_7:_7:_7]:[_3:_2:_2:_3:2]:[_8:4:139:_8:2]:[6:7:_1:8:4]:[5:7:8:7:_9]]', Z).
Z = 5321 .

Explanation
More readable (and longer) version:
{l1,?hh.|:2f:7a$\:7a&.}.
:Im:I:?:3f.
[L:I:M]h:JmN,Ll:2/D(IJ,M:4&:N+.;'(DIJ),N.)
$\:?c:5a+.
:6f+.
:ImN,I:1+:N*.
brbr.

I'm just gonna explain roughly what each predicate (i.e each line except the first one which is Main Predicate + predicate 1) does:

Main predicate + predicate 1 {l1,?hh.|:2f:7a$\:7a&.}. : If the input has only one row, then end the algorithm and return the only value. Else find all rows which satisfy predicate 2, then apply predicate 7 on the resulting matrix, then predicate 7 on the transposition, then call recursively.
Predicate 2 :Im:I:?:3f. :Take the Ith row of the matrix, find all values of that row which satisfy predicate 3 with I and the matrix as additional inputs.
Predicate 3 [L:I:M]h:JmN,Ll:2/D(IJ,M:4&:N+.;'(DIJ),N.) : L is the row, I is the index of the row, M is the matrix. N is the Jth element of L. If the length of L divided by 2 is equal to both I and J, then the output is the sum of N with the result of predicate 4 on the matrix. Otherwise the output is just N. This predicate essentialy recreates the matrix with the exception that the center element gets added to the sum.
Predicate 4 $\:?c:5a+. : Apply predicate 5 on each row and column of the matrix, unify the output with the sum of the results.
Predicate 5 :6f+. : Find all valid outputs of predicate 6 on the row, unify the output with the sum of the resulting list.
Predicate 6 :ImN,I:1+:N*. : N is the Ith value of the row, unify the output with N * (I+1).
Predicate 7 brbr. : Remove the first and last row of the matrix.

APL, 56 chars
{{1 1↓¯1 ¯1↓⍵+(-⍴⍵)↑(⌈.5×⍴⍵)↑+/(⍵⍪⍉⍵)+.×⍳≢⍵}⍣(⌊.5×≢⍵)⊣⍵}

In English:

⍣(⌊.5×≢⍵) repeat "half the size of a dimension rounded"-times
(⍵⍪⍉⍵)+.×⍳≢⍵ inner product of the matrix and its transpose with the index vector
(-⍴⍵)↑(⌈.5×⍴⍵)↑ transform result in matrix padded with 0s
1 1↓¯1 ¯1↓ removes outer shell

source: Stack Exchange

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

sort: votes


text:
Professor Schwartzman's Acme Canine Decoder 2000
Introduction
We -- especially the geeks among us, who tend to be fans -- all remember this old Far Side cartoon:

Clearly, Professor Schwartzman could have brushed up on his programming skills just a wee bit more before he put his invention to use. But can you replicate it yourself... using as few bytes as possible?
Input Specs
You must create a script that translates dog sounds into appropriately intonated "Hey"s. This is pure code golf; the lowest number of bytes wins.
Your input will consist of some combination of the following tokens:

Bark, Baark, Baaark, Baaaark, ... (that is, B*rk  with at least 1 a replacing the asterisk)
Woof, Wooof, Woooof, ... (W*f with at least 2 os replacing the asterisk)
Grr, Grrr, Grrrr, ..., (G followed by at least 2 rs)
Any number of . (period), ! (exclamation mark) and/or ? (question mark) characters, which may occur anywhere in the input

Note, again, that the Woof-based and Grr-based tokens always require at least two os and rs respectively; Wof and Gr are not valid tokens.
There is no limit on how long a token can be (e.g., how many repeated as there can be in a Bark token); however, your decoder only needs to work correctly for input tokens with up to 10 total as, os, or rs to pass this challenge.
Output Specs
Faithful to Schwartzman's design, your canine decoder program must process it into output text as follows:

Bark, Woof, and Grr become Hey;
Baark, Wooof, and Grrr become Heyy;
Baaark, Woooof, and Grrrr become Heyyy; etc.
For all Bark-based tokens, the number of ys in the output Hey-based token must be equal to the number of as;
For all Woof-based tokens, the number of ys in the output Hey-based token must be one less than the number of os;
For all Grr-based tokens, the number of ys in the output Hey-based token must be one less than the number of rs;
All punctuation (., !, and ?) is left unchanged.

Remember to drop one y from the output for Woofs and Grrs only! The input Baaaaaaaark?, with 8 as, will become Heyyyyyyyy?, with a matching set of 8 ys. However, Woooooooof? becomes only Heyyyyyyy?, with 7 ys.
Again, if you can get your program to work for input tokens of unlimited size, that's great, but for purposes of this challenge, your program will only be checked to ensure that it works properly for input tokens that have no more than 10 repeated letters.
All Bark-, Woof-, and Grr-based tokens in your input are assumed to begin with capital letters. Therefore, there is no need to handle turning Bark grrr into Hey heyy or anything similar.
Example Inputs and Outputs

Input: Bark. Bark! Bark!!
Output: Hey. Hey! Hey!!

Input: Baaaaaark? (six as)
Output: Heyyyyyy? (six ys)

Input: Grrrrrrrr... (eight rs)
Output: Heyyyyyyy... (seven ys)

Input: ?...!
Output: ?...!

Input: Wooof Woof? Grrrr. Baaaark Grr!
Output: Heyy Hey? Heyyy. Heyyyy Hey!

Hi, and welcome to the site! Just so you know, it is customary on this site to wait a while before accepting the shortest answer. I'd encourage you to unaccept the answer you have accepted, and wait until activity on this question dies down before accepting the shortest answer. This will also encourage more answers.

Related.

Thanks for the tips regarding the acceptance process. I was actually planning to check the list of answers every few hours and, if I noticed that a better answer had come along, accept it. Sorry for anyone that I may have denied reputation to here.

@A.Mirabeau That's honourable and how it would work ideally, but some people aren't that attentive, so most answerers might assume that the winner has already been chosen. While there's nothing wrong with choosing a winner right away if you're planning to update it, you're likely going to get fewer answers because of it along with some complaints, so it's usually better to wait at least a week.

Retina, 24 18 17 16 bytes
1 byte saved based on an idea in MT0's answer.
\wf?k?
y
\byy
He

Try it online!
Explanation
\wf?k?
y

This simply turns all letters into y, but if they are followed by an f or k we immediately replace that as well. By removing f and k we "normalise" the lengths of the words so that they now all have two more ys than they need.
\byy
He

This turns the first two y of every word into He, completing the transformation.

The most efficient answer so far, well done. I'm not going to accept it just yet, but I can tell you that you deserve CAT FUD.

Perl, 51 41 39 bytes
s/(G.|[BW]..)(\w+)/He."y"x length$2/ge

Usage
perl -pE 's/(G.|[BW]..)(\w+)/He."y"x length$2/ge'

Input
Bark. Bark! Bark!!
Baaaaaark?
Grrrrrrrr...
?...!
Wooof Woof? Grrrr. Baaaark Grr!

Output
Hey. Hey! Hey!!
Heyyyyyy?
Heyyyyyyy...
?...!
Heyy Hey? Heyyy. Heyyyy Hey!

How it works
Simple regexp substitution using the auto-printing -p adding 1 byte to the count. /ge executes the substitution for every pattern, and runs the replacement as code.

An older version used a three-way detection, but Martin Ender noticed that I was not aggressive enough, which saved me 10 bytes.
msh210 informed me that you don't need quotes around the string He, saving two bytes.

Best one so far, congrats.

@A.Mirabeau Thanks, that's quite a compliment considering I just registered here a few minutes ago!

Having three solves is motivating considering I just registered here a few hours ago.

You don't need the quotes around He.

@msh210 Interesting, didn't know you were allowed to omit them there!

Yeah, it's an instance of a general rule that any string that has only letters, numbers, and underscores (and doesn't start with a number) is the name of a variable whose value is itself. (Or something like that, anyway.) Thus, you can use hello instead of 'hello'. (Note that it doesn't work with function names like y or operators like x.) It's a bad idea in general, of course, but useful in golfing.

Python, 106 bytes
f=lambda s,a="B,He,Gr,He,Wo,He,a,y,r,y,o,y,f,,yk,".split(","):s if a==[]else f(s.replace(a[0],a[1]),a[2:])

Demo
https://repl.it/C6Rr

Although not the accepted answer, this one deserves an honorable mention for being the most byte-efficient solution that changes only the three necessary dog-language keywords.

Vimscript, 51 39 37 33 32 29 28 bytes,
%s/\hk\?f\?/y/g|%s/\<yy/He/g

Regex credits for shaving 9 more bytes: MT0, Martin Ender, msh210

Demo
Explanation:
                               1. Normalize words to same length & replace letters with ys

%s                             Regex search and replace
  /                            Regex search begin
   \hk\?f\?                    Find any letter (\h) optionally followed by k or f
           /                   Regex search end and replace start
            y                  Replace with y
             /                 Replace end
              g                Replace globally

               |               New command

                               2. Overwrite first two y of every word with He

                %s             Regex search and replace
                  /            Regex search begin
                   \<yy        Find yy at a word's beginning
                        /      Regex search end and replace start
                         He    replace with He
                           /   Replace end
                            g  Replace globally

I don't know Vimscript, but can you use \<yy instead of \<\hy?

@msh210 yes it's possible and I updated the solution, thanks

JavaScript (ES6) - 57 55 52 51 Bytes
f=s=>s.replace(/\wk?f?/g,'y').replace(/\byy/g,'He')

Test:

f=s=>s.replace(/\wk?f?/g,'y').replace(/\byy/g,'He');

[
  'Bark. Bark! Bark!!',
  'Baaaaaark?',
  'Grrrrrrrr...',
  '?...!',
  'Wooof Woof? Grrrr. Baaaark Grr!'
].forEach( s=>{console.log( f(s) );} );

Thanks to @MartinEnder for bytes 56 & 51 and the inspiration for some of the other shavings.

Perl 5, 25 bytes
A Perl copy of Martin Ender's Retina answer. 24 bytes, plus 1 for -pe instead of -e.
s;\wf?k?;y;g;s;\byy;He;g

Javascript, 72 66 64 Bytes
f=
t=>t.replace(/k|f/g,'').replace(/\w/g,'y').replace(/\byy/g,'He')

Edit: separated f= and function + reduced byte count

You don't need the f= (as a default of PPCG), so 64 bytes works.

@EᴀsᴛᴇʀʟʏIʀᴋ Great, I didn't know this

Pyke, 35 bytes
.cFDlR\G.^+3-\y*"He"R+)Rdc~lL-],AsJ

Try it here!
Generates Heys, Generates punctuation, zips together, joins

Python 3, 140 135 134 bytes
from re import*
f=lambda s:''.join('He'+'y'*len(x)+y for x,y in[(a+b+c,d)for a,b,c,d in findall('(?:Wo(o+)f|Gr(r+)|B(a+)rk)(\W+)',s)])

Using regex to find occurences of replacable characters.
Edit: Golfed 1 byte whitespace and 4 bytes on getting the values from findall result.
Edit2: Golfed 1 byte (Bark's "a" was not counted properly)

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


text:
Theoretically output Graham's number
Graham's number \$G\$ is defined in this way:
\begin{align*}
u(3,n,1) & = 3^n \\
u(3,1,m) & = 3 \\
u(3,n,m) & = u(3,u(3,n-1,m),m-1)
\end{align*}
Then,
\begin{align*}
g_1 & = u(3,3,4) \\
g_2 & = u(3,3,g_1) \\
g_3 & = u(3,3,g_2) \\
& \vdots \\
G & = u(3,3,g_{63})
\end{align*}
You are given that \$u(3,3,2)=7625597484987\$ to check your code.
Your task is to write a program/function that will output the value of \$G\$ deterministically, given enough integer size and enough time.
References

Graham's number
Knuth's up-arrow notation
Conway chained arrow notation

Leaderboard

var QUESTION_ID=83873,OVERRIDE_USER=48934;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+(?:\.\d+)?)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Related.

Is randomness allowed? If I just output random values, eventually Graham's number must be produced.

@miles Why on earth isn't it already a standard loophole? Clarified.

Are there any small intermediate values for u you could give us so we can check our code?

@xnor Added in.

I've added it as a loophole

Related

@PeterTaylor How is not known to terminate?

It's not that. The form of the recursive function is very similar.

Warning: u(3, 3, 2) = u(3, 2, 3) = 7625597484987, so you’ll also want to test on other values such as u(3, 5, 1) = 243 to make sure you got the argument order right.

@miles No, that's not true. Even with infinite trials there's no guarantee that you will ever generate a specific number because the numbers are infinite too.

@Bakuriu Solution: i = 0; while True: print(i); i += 1

@immibis He said generating numbers at random. Yours is a deterministic algorithm.

@Bakuriu i = 0; while(true) {if(random() < 0.5) {print(i); print(i+1);} else {print(i+1); print(i);} i += 2;}

@immibis That's still a fundamentally deterministic algorithm because you always choose either i or i+1. The point is, given random oracle that returns natural numbers completely at random, without using monotonic or "quasi-monotonic" sequences, even infinite numbers generated aren't enough to produce all natural numbers with certainty.

@Bakuriu I thought the point was to demonstrate a potential loophole?

@immibis Miles wanted to propose a solution like "n=get_random_number(); if n == graham; print n else: loop" saying that this program would fit the requirements. My point is that it does not fit the requirements, because even with infinite time there is no guarantee that it will ever output anything. Also, i don't really see why we should exclude this as a loop hole. Given that the program must output only the graham number you have to basically add some kind of check to avoid printing other invalid results, which fundamentally amounts to computing Graham number itself.

Does the base of the output matter? Obviously base-G wouldn't be allowed, but could e.g. base-256 be used?

@Mego Any base between 1 and 256 inclusive, would that be ok? Or should I extend to 1114112?

Up to you. Base-unicode could make for some interesting outputs. Unary would be terrifying.

Graham's number?

You should have made the challenge to output Gn(m)

You can shorten your example by a lot as I have done here by noting that when evaluating Graham's number, the number on the left is always 3.  Basically, make a two argument function that represents 3^^...^^x.

@LeakyNun can you please put challenge rules in the post? Because it was not in the comments, I did not see the rule of a number base restriction.

@TheEmptyStringPhotographer bro this challenge is 7 years old

@LeakyNun So???

Binary lambda calculus, 114 bits = 14.25 bytes
Hexdump:
00000000: 4457 42b0 2d88 1f9d 740e 5ed0 39ce 80    DWB.-...t.^.9..

Binary:
010001000101011101000010101100000010110110001000000111111001110101110100000011100101111011010000001110011100111010

Explanation
01 00                                           (λx.
│    01 00                                        (λy.
│    │    01 01 01 110                              x
│    │    │  │  └─ 10                               y
│    │    │  └─ 00                                  (λm.
│    │    │       01 01 01 10                         m
│    │    │       │  │  └─ 00                         (λg.
│    │    │       │  │       00                         λn.
│    │    │       │  │         01 01 10                  n
│    │    │       │  │         │  └─ 110                 g
│    │    │       │  │         └─ 00                     (λz.
│    │    │       │  │              10                     z))
│    │    │       │  └─ 00                            (λn.
│    │    │       │       00                            λf.
│    │    │       │         01 111110                    x
│    │    │       │         └─ 01 110                    (n
│    │    │       │            └─ 10                      f))
│    │    │       └─ 1110                             x)
│    │    └─ 10                                     y)
│    └─ 00                                        (λf.
│         00                                        λz.
│           01 110                                   f
│           └─ 01 01 1110                            (x
│              │  └─ 110                              f
│              └─ 10                                  z)))
└─ 00                                           (λf.
     00                                           λz.
       01 110                                      f
       └─ 01 110                                   (f
          └─ 01 110                                 (f
             └─ 10                                   z)))

This is (λx. (λy. x y (λm. m (λg. λn. n g 1) (λn. λf. x (n f)) x) y) (λf. λz. f (x f z))) 3, where all numbers are represented as Church numerals.  Church numerals are the standard lambda calculus representation of natural numbers, and they are well suited to this problem because a Church number is defined by function iteration: n g is the nth iterate of the function g.
For example, if g is the function λn. λf. 3 (n f) that multiplies 3 by a Church numeral, then λn. n g 1 is the function that takes 3 to the power of a Church numeral. Iterating this operation m times gives
m (λg. λn. n g 1) (λn. λf. 3 (n f)) n = u(3, n, m).
(We use multiplication u(–, –, 0) rather than exponentiation u(–, –, 1) as the base case, because subtracting 1 from a Church numeral is unpleasant.)
Substitute n = 3:
m (λg. λn. n g 1) (λn. λf. 3 (n f)) 3 = u(3, 3, m).
Iterating that operation 64 times, starting at m = 4, gives
64 (λm. m (λg. λn. n g 1) (λn. λf. 3 (n f)) 3) 4 = G.
To optimize this expression, substitute 64 = 4^3 = 3 4:
3 4 (λm. m (λg. λn. n g 1) (λn. λf. 3 (n f)) 3) 4 = G.
Remember 4 = succ 3 = λf. λz. f (3 f z) as a lambda argument:
(λy. 3 y (λm. m (λg. λn. n g 1) (λn. λf. 3 (n f)) 3) y) (λf. λz. f (3 f z)) = G.
Finally, remember 3 = λf. λz. f (f (f z)) as a lambda argument:
(λx. (λy. x y (λm. m (λg. λn. n g 1) (λn. λf. x (n f)) x) y) (λf. λz. f (x f z))) 3 = G.

Where could one find an interpreter for this language?

@Dennis https://tromp.github.io/cl/cl.html has a couple of them.

This is awesome. this deserves a sizeable bounty

14.25 bytes seems to be messing up the leaderboard. It is parsed as 25 bytes, and you are therefore placed as second.

@Dan I fixed the leader board snippet, I think.

Neat, I did this in 120 bits here, nice work shaving off 6 of them! BTW 120 bits is how many bits it takes to write "Graham's Number", assuming 8 bits per character and including the apostrophe and space.

Haskell, 41 bytes
i=((!!).).iterate
i(($3).i(`i`1)(*3))4 64

Explanation:
(`i`1)f n = i f 1 n computes the nth iterate of the function f starting at 1.  In particular, (`i`1)(*3)n = 3^n, and iterating this construction m times gives i(`i`1)(*3)m n = u(3, n, m).  We can rewrite that as (($n).i(`i`1)(*3))m = u(3, n, m), and iterate this construction k times to get i(($3).i(`i`1)(*3))4 k = g_k.

Haskell, 43 bytes
q=((!!).).iterate
g=q(`q`1)(3*)
q(`g`3)4$64

There has be a better way to flip g inline.
46 bytes:
i=iterate
n%0=3*n
n%m=i(%(m-1))1!!n
i(3%)4!!64

48 bytes:
n%1=3^n
1%m=3
n%m=(n-1)%m%(m-1)
iterate(3%)4!!64

Just writing down the definitions.
The base cases are a bit cleaner backed up to 0, though it saves no bytes. Perhaps it will make it easier to write an alternate definition.
n%0=3*n
0%m=1
n%m=(n-1)%m%(m-1)
z=iterate(3%)2!!1

Can you use another function which has precedence lower than + so as to remove the parentheses between m-1?

I count 44 bytes, and what happened to 4 and 64?

Oops, I copied in my smaller-parameter test. I don't think I can change the operator precedence because I'm defining a new function and those have a default precedence. I can't overwrite an existing function.

I mean, I count 44 bytes after you change it back to 64.

I think you mean (`g`3), not (3`g`).

@AndersKaseorg Oh yes. Your handling of that is much nicer. I've been searching for a shorter way to define q or its flip, but everything recursive is long and foldr(.) is messy.

Pyth, 25 bytes
M?H.UgbtH*G]3^3Gug3tG64 4

The first part M?H.UgbtH*G]3^3G defines a method g(G,H) = u(3,G,H+1).
To test the first part, check that 7625597484987=u(3,3,2)=g(3,1): g3 1.
The second part ug3tG64 4 starts from r0 = 4 and then compute rn = u(3,3,r(n-1)) = g(3,r(n-1)) 64 times, outputting the final value (r is chosen instead of g to avoid confusion).
To test this part, start from r0=2 and then compute r1: ug3tG1 2.

If g(G, H) = u(3, G, H + 1), you should have r(n) = u(3, 3, r(n − 1)) = g(3, r(n − 1) − 1), not g(3, r(n − 1)). I think your code is right but your explanation is missing the − 1.

You can save a byte by using unoffsetted u arguments (^3 ↦ *3, tG ↦ G), and another byte with .UgbtH*G]3 ↦ e.ugNtHG1.

An alternate way to save that second byte is *G]3 ↦ ShG.

JavaScript (ES7), 63 bytes
u=(n,m)=>n>1&m>1?u(u(n-1,m),m-1):3**n
g=n=>n?u(3,g(n-1)):4
g(64)

@AndersKaseorg Ugh, in that case I might as well revert that change.

This causes a stack overflow, might need to recheck your reccursion pattern.

This isn't simple ES7. This is unbounded ES7 (an imaginary variant of ES7 but with bignum, able to oracle infinitely, and is using decimal with /#xE^ as shorthand).

Sesos, 30 bytes
0000000: 286997 2449f0 6f5d10 07f83a 06fffa f941bb ee1f33  (i.$I.o]...:....A...3
0000015: 065333 07dd3e 769c7b                              .S3..>v.{

Disassembled
set numout
add 4
rwd 2
add 64
jmp
    sub 1
    fwd 3
    add 3
    rwd 1
    add 1
    jmp
        sub 1
        jmp
            fwd 1
            jmp
                jmp
                    sub 1
                    fwd 1
                    add 1
                    rwd 1
                jnz
                rwd 1
                jmp
                    sub 1
                    fwd 3
                    add 1
                    rwd 3
                jnz
                fwd 3
                jmp
                    sub 1
                    rwd 2
                    add 1
                    rwd 1
                    add 1
                    fwd 3
                jnz
                rwd 1
                sub 1
            jnz
            rwd 1
            jmp
                sub 1
            jnz
            add 1
            rwd 1
            sub 1
        jnz
        fwd 1
        jmp
            sub 1
            rwd 1
            add 3
            fwd 1
        jnz
        rwd 2
    jnz
    rwd 1
jnz
fwd 2
put

Or in Brainfuck notation:
++++<<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[->>>+++<+[-[>[[->+<]<[->>>+<<<]>>>[-<<+<+>>>]<-]<[-]+<-]>[-<+++>]<<]<]>>.

Testing
To compute u(3, n, u(3, n, … u(3, n, m) … )) with k nested calls to u, replace the first three add instructions add 4, add 64, add 3 with add m, add k, add n, respectively.  Because Sesos can’t build numbers faster than in linear time, you’re practically limited to small values like u(3, 2, 2) = 27, u(3, 5, 1) = 243, and u(3, 1, u(3, 1, … u(3, 1, m) … )) = 3.

You can replace [-] with , since EOF is 0.

Brachylog, 57 bytes
4:64:1iw
:3{[1:N],3:N^.|t1,3.|hM:1-X,?t:1-:Mr:2&:Xr:2&.}.

Expects no Input nor Output and writes the result to STDOUT. This will produce a stack overflow at one point.
To check that this works for small values (e.g u(3,3,2)) you can replace the 4 with the value of m and 64 with 1.
Explanation
This is basically a straightforward implementation of the explained way of computing the number.

Main predicate:
4:64:1i                    Call Predicate 1 64 times with 4 as initial input (the second
                           call takes the output of the first as input, etc. 64 times).
       w                   Write the final output to STDOUT

Predicate 1:
:3{...}.                   Call predicate 2 with input [Input, 3]. Its output is the
                           output of predicate 1.

Predicate 2:
[1:N],                     M = 1
      3:N^.                Output = 3^N
|                          Or
t1,                        N = 1
   3.                      Output = 3
|                          Or
hM:1-X,                    X is M - 1
       ?t:1-:Mr:2&         Unify an implicit variable with u(3,N-1,M)
                  :Xr:2&.  Unify Output with u(3,u(3,N-1,M),X)

Caramel, 38 bytes
(64 ((f->(f,1)),(n f->(3 (n f))),3) 4)

This is syntactic sugar for the lambda calculus expression 64 (λm. m (λf. λn. n f 1) (λn. λf. 3 (n f)) 3) 4, where all numbers are represented as Church numerals.

(n f->3 (n f)) shouldn't it read n-1?

@LeakyNun No. (n f->3 (n f)) is a function for multiplication by three in Church numerals.

This challenge seems excessively simple in lambda calculus. Why?

C, 161 bytes
u(int a, int b){if(a==1)return 3;if(b==1)return pow(3,a);return u(u(a-1,b),b-1);}
g(int a){if(a==1)return u(3,4);return u(3,g(a-1));}
main(){printf("%d",g(64));}

EDIT: saved 11 bytes by removing tabs and newlines.
EDIT: thx auhmann saved another byte and fixed my program

You could remove g(int a){if(a==1)return u(3,4);return g(a-1);} since it's not being used at all... Or are you forgetting something?

@auhmaan oops sorry, I used that number for testing and forgot to change it back. Thanks!!

Your return g(a-1) should be return u(3,g(a-1)).

I don't know if I should make a proper answer or just comment on this, but you can get this solution down to 114 bytes quite easily by realizing: Newlines between functions can be omitted. Omitting types for all argumens default them to int (think K&R). If statements like these can be written with nested ternary ops.
Code: u(a,b){return a<2?3:b<2?pow(3,a):u(u(a-1,b),b-1);}g(a){return a<2?u(3,4):u(3,g(a-1));}main(){printf("%d",g(64));}

@algmyr wow amazing! you should go post your own answer XD.

Mathematica, 59 bytes
n_ ±1:=3^n
1 ±m_:=3
n_ ±m_:=((n-1)±m)±(m-1)
Nest[3±#&,4,64]

Uses an undefined infix operator ± which requires only 1 byte when encoded in ISO 8859-1. See @Martin's post for more info. Mathematica functions support pattern matching for their arguments, such that the two base cases can be defined separately.

Since when did Mathematica use ISO 8859-1?

n_ ±m_:=Nest[#±(m-1)&,3,n]

Prolog (SWIPL), 129 / 137 bytes
g(1,R):-u(3,4,R).
g(L,R):-M is L-1,g(M,P),u(3,P,R).
u(N,1,R):-R is 3**N.
u(1,_,3).
u(N,M,R):-K is N-1,L is M-1,u(K,M,Y),u(Y,L,R).

To output Graham's number, query for g(64,G). (if the 8 bytes of this query are to be counted, the length is 137 bytes):
?- g(64, G).
ERROR: Out of local stack

But as can be expected, this runs out of stack.
Test
?- u(3, 2, X).
X = 7625597484987

Backtracking causes it to run out of stack:
?- u(3, 2, X).
X = 7625597484987 ;
ERROR: Out of local stack

Ungolfed
The ungolfed version adds the general up-arrow notation, not just for 3, and uses cuts and checks to avoid backtracking and undefined situations.
% up-arrow notation
u(X, 1, _M, X) :- !.
u(X, N, 1, R) :-
    R is X**N, !.
u(X, N, M, R) :-
    N > 1,
    M > 1,
    N1 is N - 1,
    M1 is M - 1,
    u(X, N1, M, R1),
    u(X, R1, M1, R).

% graham's number
g(1,R) :- u(3, 3, 4, R), !.
g(L,R) :-
    L > 1,
    L1 is L - 1,
    g(L1,G1),
    u(3, G1, R).

How did you manage to do it without having the number 64 anywhere in your code?

@LeakyNun I edited to clarify; better?

Well, then add it into your code as well as your byte-count.

C, 114 109 bytes
Based on the answer by @thepiercingarrow (link) I golfed the answer down quite a bit. Most savings are due to the abuse of default typing of arguments when doing K&R style functions and replacement of if statements with ternary operators. Added optional newlines between functions for readability.
Improved to 109 thanks to @LeakyNun.
u(a,b){return a<2?3:b<2?pow(3,a):u(u(a-1,b),b-1);}
g(a){return u(3,a<2?4:g(a-1));}
main(){printf("%d",g(64));}

g(a){return u(3,a<2?4:g(a-1));}

@LeakyNun That's a really good one. Thanks.

Python, 85 bytes
v=lambda n,m:n*m and v(v(n-1,m)-1,m-1)or 3**-~n
g=lambda n=63:v(2,n and g(n-1)-1or 3)

The v function defines the same function as the one found in Dennis's answer: v(n,m) = u(3,n+1,m+1). The g function is a zero-indexed version of the traditional iteration: g(0) = v(2,3), g(n) = v(2,g(n-1)). Thus, g(63) is Graham's number. By setting the default value of the n parameter of the g function to 63, the required output can be obtained by calling g() (with no parameters), thus meeting our requirements for a function submission which takes no input.
Verify the v(2,1) = u(3,3,2) and v(4,0) = u(3,5,1) test cases online: Python 2, Python 3

It's kinda hard to verify, but your function g seems off. Shouldn't v(2,n-1) be g(n-1) or something similar?

@Dennis Good catch. I'll fix that.

Actually the offset between u and v means it should be g(n-1)-1.

@AndersKaseorg I should not do programming while sleepy. I have to re-learn this every few days.

@AndersKaseorg In the future, please do not edit other people's submissions, even if it is to fix a mistake in an improvement/bugfix that you suggested.

@Mego Very well, my apologies.

Dyalog APL, 41 bytes
u←{1=⍺:3⋄1=⍵:3*⍺⋄(⍵∇⍨⍺-1)∇⍵-1}
3u 3u⍣64⊣4

Test case:
      3u 2
7625597484987

You should be able to convert 1=⍺:3⋄1=⍵:3*⍺ to just 1=⍵:3*⍺ (3=3*1)

Ruby, 64 bytes
Borrowing from Theoretical algorithm to compute Graham's number.
def f(a,b=3)b<2?3:a<1?3*b:f(a-1,f(a,b-1))end;a=4;64.times{a=f a};p a

Simply put, f a = u(3,3,a) and it applies this 64 times.

A good explanation on why and how this code works would be nice.

It is a straightforward application of the definition of Graham's number.

Jelly, 22 bytes
’ß’ß’}ð‘3*ða?
4’2çƊ64¡

Try it online!
I believe this is close to identical to Dennis' deleted Jelly answer but was developed independently and uses a language feature that wasn't available at the time of his answer.
The first line defines a function \$v(n, m) = u(3, n+1, m+1)\$ and the TIO footer demonstrates this for \$u(3, 3, 2)\$, \$u(3, 5, 1)\$ and \$u(3, 1, 5)\$.
With our defined \$v\$, we then have the recurrence relation
\begin{align*}
g_1 & = v(2, 3) \\
g_{i+1} & = v(2, g_i - 1) \\
G = g_{64} & = v(2, g_{63} - 1)
\end{align*}
A more standard approach, which defines \$w(n, m) = u(3, n, m)\$ and then uses
\begin{align*}
g_1 & = w(3, 4) \\
g_{i+1} & = w(3, g_i) \\
G = g_{64} & = w(3, g_{63})
\end{align*}
comes out at 23 bytes:
3*ð’ßṛß’}ð«Ị¥?
4 3ç$64¡

Try it online!
How they work
\$v(n, m)\$
’ß’ß’}ð‘3*ða? - Helper link, v(n, m). Takes n on left, m on right
            ? - If:
           a  -   n and m are both non-zero
      ð       - Then:
’             -   n-1
 ß            -   v(n-1, m)
  ’           -   v(n-1, m)-1
    ’}        -   m-1
   ß          -   v(v(n-1, m)-1, m)
          ð   - Else:
       ‘      -   n+1
        3*    -   3^(n+1)

4’2çƊ64¡ - Main link. No arguments
4        - Set the return value and left argument to 4
    Ɗ    - Last 3 links as a monad f(x):
 ’       -   x-1
  2ç     -   v(2, x-1)
     64¡ - Starting with x = 4, iterate f(x) 64 times

\$w(n, m)\$
3*ð’ßṛß’}ð«Ị¥? - Helper link, w(n, m). Takes n on left, m on right
            ¥? - If:
          «    -   min(n, m)
           Ị   -   is insignificant (abs(x) ≤ 1)
  ð            - Then:
3*             -   3^n
         ð     - Else:
   ’           -   n-1
     ṛ         -   m
    ß          -   w(n-1, m)
       ’}      -   m-1
      ß        -   w(w(n-1, m), m-1)

4 3ç$64¡ - Main link. No arguments
4        - Set the return value and left argument to 4
    $    - Last two links as a monad g(x):
  3ç     -  w(3, x)
     64¡ - Starting with x = 4, iterate g(x) 64 times

J, 107 bytes
u=:4 :0
if.y=1 do.3^x
elseif.x=1 do.3
elseif.1 do.x:(y u~<:x)u<:y
end.
)
(g=:(3 u 4[[)`(3 u$:@<:)@.(1&<))64

I'm working on converting u to an agenda, but for now it'll do.

Something like u=:3^[\[:(3$:])/[#<:@]@.*@]` (not tested)

F#, 111 108 bytes
Edit
This is using the function below to calulcate Graham's number
let rec u=function|b,1->int<|3I**b|1,c->3|b,c->u(u(b-1,c),c-1)
and g=function|1->u(3.,4.)|a->u(3.,g (a-1))
g 63

Here's my previous answer which, well, didnt:
Pretty straightforward. Just a definition of the u function.
let rec u=function|a,b,1->a**b|a,1.,c->a|a,b,c->u(a,u(a,b-1.,c),c-1)

Usage:
u(3.,3.,2)
val it : float = 7.625597485e+12

If I assumed 3 as the value for a, I could cut it to 60:
let rec u=function|b,1->3.**b|1.,c->3.|b,c->u(u(b-1.,c),c-1)

Usage:
u(3.,2)
val it : float = 7.625597485e+12

The challenge is to write Graham’s number, not u. You can of course include any intermediate functions you need, such as u with or without its first argument fixed at 3.

@AndersKaseorg edited that in. Thanks. My previous comment seems to have disappeared.

R, 154 142 128 126 118 bytes
u=function(n,b)return(if(n&!b)1 else if(n)u(n-1,u(n,b-1))else 3*b)
g=function(x)return(u(if(x-1)g(x-1)else 4,3))
g(64)

I used the Wikipedia definition of this recursive function because for some odd reason the suggested one did not work... or I just suck at R golfing.
UPD: shaved off 12+14=26 bytes thanks to a tip from Leaky Nun. The prior version used the bulky and less efficient
u=function(n,b)if(n==0)return(3*b)else if(n>0&b==0)return(1)else return(u(n-1,u(n,b-1)))
g=function(x)if(x==1)return(u(4,3))else return(u(g(x-1),3))

UPD: shaved off 2+6+2 more bytes (again, kudos to Leaky Nun) owing to an ingenious replacement with “if(x)” instead of “if(x==0)” because x<0 is never fed into the function... right?

@LeakyNun Thank you, updated the answer with acknowledgement.

Just a sec... Today is my first day of code golfing, there is much to learn!

You are invited to join our chat.

More golfing, please see the improvement.

Ta-dam, done, changed the function u in the same key as your g and saved 6 more bytes—awesome!

b==0 is really !b.

I might misunderstand something... OK, if NOT b and n, then the first OR is used, otherwise the second OR. This is clear. But u=function(n,b)return(n&!b|if(n)u(n-1,u(n,b-1))else 3*b) yields infinite nesting... Seems that a pair of braces/parens is needed, but where?

Never mind, I don't think it works.

u=function(n,b)return(if(n&!b)1 else if(n)u(n-1,u(n,b-1))else 3*b)

This is so strange... The long version yields 7.625597e+12 for the test case u(2,3). The one you suggests throws evaluation nested too deeply: infinite recursion / options. Is it really OK that it does not pass the test case?

I was mistaken in my thoughts (it's 3AM here now).

PHP, 114 bytes
ignore the line breaks; they are for readability only.
function u($n,$m){return$m>1&$n>1?u(u($n-1,$m),$m-1):3**$n;}
function g($x){return u(3,$x>1?g($x-1):4);}
echo g(63);

It is possible to integrate the second case into the first one: for n=1, 3^n equals 3.
This will save a few bytes on - as far as I can see - all existing answers; saved two bytes on my
previous version, 62+43+11=116 bytes
function u($n,$m){return$m>1?$n>1?u(u($n-1,$m),$m-1):3:3**$n;}

PHP´s left associativity of the ternary requires parentheses ... or a specific order of tests.
This saved two bytes on the parenthesized expression.

There is probably an iterative approach, which may allow further golfing ...
but I can´t take the time for it now.

wish I knew Sesos or had the time to learn it and translate right now

@Leaky Nun: I broke it down to only loops and addition. Is there a way in Sesos to add the value of one cell to another?

@AndersKaseorg: You´re probably right ... I got blisters on my eyeballs from looking at that algorithm. Will look at it again soon.

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


text:
Visualise Bit Weaving
The esoteric programming language evil has an interesting operation on byte values which it calls "weaving". It is essentially a permutation of the eight bits of the byte (it doesn't matter which end we start counting from, as the pattern is symmetric):

Bit 0 is moved to bit 2
Bit 1 is moved to bit 0
Bit 2 is moved to bit 4
Bit 3 is moved to bit 1
Bit 4 is moved to bit 6
Bit 5 is moved to bit 3
Bit 6 is moved to bit 7
Bit 7 is moved to bit 5

For convenience, here are two other representations of the permutation. As a cycle:
(02467531)

And as a list of pairs of the mapping:
[[0,2], [1,0], [2,4], [3,1], [4,6], [5,3], [6,7], [7,5]]

Your task is to visualise this permutation, using the box-drawing characters ─, │, ┌, ┐, └, ┘, ┼ (Unicode code points: U+2500, U+2502, U+250C, U+2510, U+2514, U+2518, U+253C). This visualisation should satisfy the following constraints:
The first and last line are exactly:
0 1 2 3 4 5 6 7

Between those, you can use as many lines as you want of up to 15 characters each to fit your box drawing characters (you will need at least 4 lines). The lines should start vertically beneath one of the digits on the first row and end vertically above the corresponding digit on the last row. The eight lines must be connected, and may only cross via ┼ (which is always a crossing, never two turning lines which are touching). The exact paths of the lines are up to you (and finding a particularly golfable layout is the core of this challenge). One valid output would be:
0 1 2 3 4 5 6 7
│ │ └─┼┐│ │ └┐│
└─┼─┐ ││└─┼─┐││
┌─┘ │ ││  │ │││
│ ┌─┼─┘│  │ │││
│ │ │ ┌┼──┘ │││
│ │ │ │└┐ ┌─┼┼┘
│ │ │ │ │ │ │└┐
0 1 2 3 4 5 6 7

However, any other layout that correctly connects the right digits is fine too. Please show your chosen output in your answer.
You may write a program or function and will not take any input. Output the diagram either to STDOUT (or closest alternative) or as a function return value in the form of a string or a list of strings (each representing one line).
Standard code-golf rules apply, so the shortest code (in bytes) wins.

This is strangely reminiscent of the utility graph...

Could we use other symbols for languages that do not support unicode?

This challenge essentially boils down to  copy-pasting the provided output... How about taking a permutation of 01234567 as an input and then connecting that to 01234567 ? So that you have to figure out the links yourself? It would be a significantly more challenging a task, especially for golfing.

@shooqie This was discussed in the sandbox. That would indeed be a very different challenge and I'm considering posting that as well at some point. However, I believe there's a lot more to this challenge than copy-pasting the example above. There are countless different admissible outputs and the one above is especially hard to compress whereas others (like the ones used by the existing answers) are much more compressible. The challenge is in finding a single compressible string. That's very different from automatically finding a layout in few bytes.

Someone has to solve this in evil.

It should be allowed to write a string or a string array expression. In Haskell there's no such thing as no-argument functions, though you can write a function that takes a void-typed argument ().

@JanDvorak Printing string/array literals seems rather unclean. A void-typed function returning the string(s) would be fine though.

How about a function that ignores its argument, then?

@JanDvorak I think I'm fine with that too. Might be worth asking on meta for a general rule though.

@JanDvorak Relevant meta post

Great. The top voted answer so far has 131 bytes of program code to produce 95 bytes of constant output. Granted it has found a more compact output, but still proves @shooqie right as a program printing a constant string containing that output is shorter… or well, it depends on the chosen character encoding, of course.

@Holger Just because it has the most votes doesn't mean it's the shortest. Also, unless your language can use a code page that has all  the required characters in a single byte, the output is well over 200 bytes. I admit that this encoding discrepancy is a bit unfortunate, but if you ignore it, then even the PowerShell answer is shorter than its output.

Maybe counting characters would be better…

@Holger There's a good reason we don't do that: then people could just encode the string by packing it in large Unicode characters, which can store several bytes worth of information in a single character. Example.

I just noticed that I should have said code points rather than characters, but anyway, any kind of packing or compressing requires code for extracting which doesn’t differ to the situation we have with the bytes here. I don’t consider the character examples less readable than the examples here…

@Holger It's not about readability but about interesting approaches. In some of the golfing languages, Unicode packing is trivial and doesn't cost a lot of characters at all. (Also I don't see what the difference between characters and code points is for the purpose of the counting.)

U+0041U+0302U+0333 are three code points, but only one character, Â̳…

@Holger Oh right, I believe we normally consider combining marks "characters" as far as counting is concerned. But yeah, that would make things even worse.

@flawr Sorry, I never saw your comment. In most languages you should be able to output a simple byte stream. There are single-byte code pages, like CP437 which contain all of the necessary characters. That means if you just output those bytes and interpret your output as CP437 (or some other suitable codepage), you'd still have a valid answer without having to worry about Unicode.

Is my answering proposal valid? https://tio.run/##K0nO@f@/oLSkWEFJIbo4tUTBScHA0MjYxNTMPJbr0ZSeR1P2PJoy49GUJiQ0BSw4gQvGhyuCSkDEFRQUuFA1NcDlIIgL2TRMu0DSCqg2I5QAJaeoOAHZSlz//wMA

@sergiol Interesting, but no.

Actually, 69 bytes
"│ ┌┘│ │└┐ │└┐└┐""┌┘└┼┐└┼┐ └┼┐└┐""└┼┐│└┐┌┘└┐┌┘│""┌┼─┘"3*"│┌┘"+8r' j;)

Try it online! (the alignment is a little messed up in the online interpreter)
Actually has a HUGE advantage here - all of the box drawing characters are in CP437, so they're only a byte each. Though each character needed could theoretically be encoded in 4 bits (since there are only 9 unique characters), the 31 bytes saved by compressing the string would be lost due to Actually's very poor string processing capabilities. This also means that any 8x4 configuration would result in the same score. Since 8x4 appears to be the (vertically) shortest possible configuration, this is optimal.
Thanks to Martin for 3 bytes!
Thanks to TimmyD for 4 more bytes!
Explanation:
"│ ┌┘│ │└┐ │└┐└┐""┌┘└┼┐└┼┐ └┼┐└┐""└┼┐│└┐┌┘└┐┌┘│""┌┼─┘"3*"│┌┘"+8r' j;)
"│ ┌┘│ │└┐ │└┐└┐""┌┘└┼┐└┼┐ └┼┐└┐""└┼┐│└┐┌┘└┐┌┘│""┌┼─┘"3*"│┌┘"+         push the individual lines, using string multiplication to shorten repeated sections
                                                              8r' j   push the string "0 1 2 3 4 5 6 7" (range(8), join on spaces)
                                                                   ;)  make a copy and move it to the bottom of the stack

Technically a lot of the other answers could have made use of single-byte encodings as well by just using whatever single-byte encoding their language supports (if any), outputting the same bytes as yours and saying "the output is CP437-encoded", but it seems that no one picked up on that. ¯\(ツ)/¯

PowerShell v2+, 172 153 148 145 142 131 123 bytes (81 chars)
($a=""+0..7)
$b='┌┘'
"│$b$('┌┼─┘'*3)
└┼┐$('│└─┐'*3)
$b$('└┼─┐'*3)│
│ $($b*6)│"
$a

I golfed the weaving further, eliminating the need for several variables by using inline code blocks. This is probably within a few bytes of optimal.
We start by setting $a equal to the range 0..7 that's been joined together with spaces. This is because the default $ofs (Output Field Separator) for an array is a space, so when the array is stringified with ""+ (with an operator like this, PowerShell will try to implicitly cast the right-hand object as the left-hand object), the result is the range space-separated.
That's encapsulated in parens, which adds the result onto the pipeline. We then setup a one helper variable $b, followed by four lines of output with the appropriate variable in place (split with literal newlines), and using inline code-blocks for repeat sections, followed by $a again. The four lines and $a are also placed on the pipeline, and output is implicit at the end.
PS C:\Tools\Scripts\golfing> .\visualize-bit-weaving.ps1
0 1 2 3 4 5 6 7
│┌┘┌┼─┘┌┼─┘┌┼─┘
└┼┐│└─┐│└─┐│└─┐
┌┘└┼─┐└┼─┐└┼─┐│
│ ┌┘┌┘┌┘┌┘┌┘┌┘│
0 1 2 3 4 5 6 7

Nice work with going back and forth at the bottom. :)

Javascript ES6, 168 167 bytes
Edit: Whoops, turned out I was using the pipe | char instead of U+2502 │ in part of the function, updated byte count.
_=>((n=`0 1 2 3 4 5 6 7 `)+[...`6452301`].map(i=>`${(d=n=>`│ `.repeat(n))(i)}└┐│ ${r=d(6)}┌┼┘ ${r}│└┐ ${d(6-i)}`).join``+n).match(/.{16}/g).join`
`

Returns a string.
Output:
0 1 2 3 4 5 6 7
│ │ │ │ │ │ └┐│
│ │ │ │ │ │ ┌┼┘
│ │ │ │ │ │ │└┐
│ │ │ │ └┐│ │ │
│ │ │ │ ┌┼┘ │ │
│ │ │ │ │└┐ │ │
│ │ │ │ │ └┐│ │
│ │ │ │ │ ┌┼┘ │
│ │ │ │ │ │└┐ │
│ │ └┐│ │ │ │ │
│ │ ┌┼┘ │ │ │ │
│ │ │└┐ │ │ │ │
│ │ │ └┐│ │ │ │
│ │ │ ┌┼┘ │ │ │
│ │ │ │└┐ │ │ │
└┐│ │ │ │ │ │ │
┌┼┘ │ │ │ │ │ │
│└┐ │ │ │ │ │ │
│ └┐│ │ │ │ │ │
│ ┌┼┘ │ │ │ │ │
│ │└┐ │ │ │ │ │
0 1 2 3 4 5 6 7

Extra: Using @TimmyD's method, I have another 167 byte solution:
(n=`0 1 2 3 4 5 6 7
`,a=`│┌┘ `,b=`└┼─┐`,d=`┌┼─┘`,f=` │└┐`)=>[n,a,a,a,a,`
`,b,b,b,`└┼┐
┌┘`,d,d,d,`│
│`,f,f,f,` │
`,n].join``

JavaScript (ES6), 137 134 bytes

f=
_=>`0
│2525252
1 1 1 1
24242423525252 3 1 1 1 3 242424│
0`.replace(/\d/g,d=>`0 1 2 3 4 5 6 7,└┼┐,┌┘,│
│,│ , │`.split`,`[d])
;
o.textContent=f();

As a bell-ringer I immediately recognised this as the first two rows of Plain Hunt Major (note that the linked image uses 1-8 instead of 0-7).

Pyth - 119 104 100 81 bytes
Extremely simple. (Its actually bytes this time).
js[KjdU8cX."sz¨ú¨ãÆhÆ?\ÕüÓ¼xFNøa"_G"│┌┘└┼─┐ "15K

Try it online here.
I also stole @TimmyD's output:
0 1 2 3 4 5 6 7
│┌┘ │┌┘ │┌┘ │ │
└┼─┐└┼─┐└┼─┐└┐│
┌┘┌┼─┘ └┐│┌┼─┼┘
│ │└┐ ┌─┼┘│└┐└┐
0 1 2 3 4 5 6 7

MATLAB / Octave, 112 109 bytes
a='0 1 2 3 4 5 6 7';d=['└┐│ ';'┌┼┘ ';'│└┐ '];e=repmat('│ ',3,1);[a;d d d d;e d d d e;a]

Output:
0 1 2 3 4 5 6 7
└┐│ └┐│ └┐│ └┐│
┌┼┘ ┌┼┘ ┌┼┘ ┌┼┘
│└┐ │└┐ │└┐ │└┐
│ └┐│ └┐│ └┐│ │
│ ┌┼┘ ┌┼┘ ┌┼┘ │
│ │└┐ │└┐ │└┐ │
0 1 2 3 4 5 6 7

My code is based on the ouputs of @Dendrobium and @Neil.

+1 for golfable output

Notice: The linked comment has been deleted. It was the OP saying your output is more golfable than that of @TimmyD.

MS-DOS Batch, 136 bytes
@echo 0 1 2 3 4 5 6 7
@echo ³ÚÙ ³ÚÙ ³ÚÙ ³ÚÙ
@echo ÀÅÄ¿ÀÅÄ¿ÀÅÄ¿ÀÅ¿
@echo ÚÙÚÅÄÙÚÅÄÙÚÅÄÙ³
@echo ³ ³À¿ ³À¿ ³À¿ ³
@echo 0 1 2 3 4 5 6 7

Using @TimmyD's output. This might work in Windows Batch too, but my code page there is CP850, not CP437.

Works in Windows too, regardless of whether you use CP437 or CP850.

@Holger Huh, I guess I should have tried it anyway, just to see!

///, 112 bytes (100 chars)
/8/0 1 2 3 4 5 6 7//9/│//A/└┐//B/┌┼┘/8/C/9 A9 A9 A9//D/9A 9A 9A 9/
AC
B B B B
DA
C 9
9 B B B 9
9 D
8

Thanks @MartinEnder for -3 bytes!
Thanks @MartinEnder for -9 bytes!
Thanks @MartinEnder (OP) for pointing 15-char rule out
Uses @TimmyD's @Marco's output0 1 2 3 4 5 6 7
└┐│ └┐│ └┐│ └┐│
┌┼┘ ┌┼┘ ┌┼┘ ┌┼┘
│└┐ │└┐ │└┐ │└┐
│ └┐│ └┐│ └┐│ │
│ ┌┼┘ ┌┼┘ ┌┼┘ │
│ │└┐ │└┐ │└┐ │
0 1 2 3 4 5 6 7

Sprects, 99 bytes (87 chars)
$8
AC
BE
DA
C 9
9E 9
9 D
8$E B B B$D9A 9A 9A 9$C9 A9 A9 A9$B┌┼┘$A└┐$9│$80 1 2 3 4 5 6 7

Uses @Marco's output (replace every 16th character with a newline (regex: (.{15}). -> \1\n)).0 1 2 3 4 5 6 7
└┐│ └┐│ └┐│ └┐│
┌┼┘ ┌┼┘ ┌┼┘ ┌┼┘
│└┐ │└┐ │└┐ │└┐
│ └┐│ └┐│ └┐│ │
│ ┌┼┘ ┌┼┘ ┌┼┘ │
│ │└┐ │└┐ │└┐ │
0 1 2 3 4 5 6 7

Bash + GNU sed, 140 bytes
sed 'h
s/$/nxxxacnb b b bnyyycanc xxxcnc b b b cnc yyyc/
:
s/x/ac /
s/y/ca /
s/a/└┐/
s/b/┌┼┘/
t
y/cn/│\n/
G'<<<'0 1 2 3 4 5 6 7'

Output:
0 1 2 3 4 5 6 7
└┐│ └┐│ └┐│ └┐│
┌┼┘ ┌┼┘ ┌┼┘ ┌┼┘
│└┐ │└┐ │└┐ │└┐
│ └┐│ └┐│ └┐│ │
│ ┌┼┘ ┌┼┘ ┌┼┘ │
│ │└┐ │└┐ │└┐ │
0 1 2 3 4 5 6 7

Using @TimmyD's output: 142 bytes
sed 'h
s/$/npbcccnsurdddnbeeepnp bbbbbbp/
:
s/b/qt/
s/c/quot/
s/d/psor/
s/e/suor/
t
y/nopqrstu/\n─│┌┐└┘┼/
G'<<<'0 1 2 3 4 5 6 7'

Output:
0 1 2 3 4 5 6 7
│┌┘┌┼─┘┌┼─┘┌┼─┘
└┼┐│└─┐│└─┐│└─┐
┌┘└┼─┐└┼─┐└┼─┐│
│ ┌┘┌┘┌┘┌┘┌┘┌┘│
0 1 2 3 4 5 6 7

Python3, 209 bytes
lambda s="0 1 2 3 4 5 6 7\n":s+"│┌┘ │┌┘ │┌┘ │ │\n└┼─┐└┼─┐└┼─┐└┐│\n┌┘┌┼─┘ └┐│┌┼─┼┘\n│ │└┐ ┌─┼┘│└┐└┐\n"+s

Returns a string.
Thanks to @Mego for saving 2 bytes!
Credits of the character body go to @TimmyD !

You don't need the a, part, which will also remove the need for it to be called with a parameter.

Tcl, 205 bytes
puts "[set B "0 1 2 3 4 5 6 7"]
│┌┘ │┌┘ │┌┘ └┐│
└┼┐ └┼─┐└┼──┐││
┌┘└─┐│ └┐│┌─┼┼┘
│ ┌─┼┘┌─┼┘│ │└┐
$B"

Try it online!
outputs

0 1 2 3 4 5 6 7
│┌┘ │┌┘ │┌┘ └┐│
└┼┐ └┼─┐└┼──┐││
┌┘└─┐│ └┐│┌─┼┼┘
│ ┌─┼┘┌─┼┘│ │└┐
0 1 2 3 4 5 6 7

SOGL V0.12, 64 bytes
└┼─┐³
┘┌┼─┘²
┐│└─┐¹
┌┘┌┘┌┘⁰
│┌²┌┼─²¶└┼¹│└─¹¶┌┘³³³│¶│ ⁰⁰│”8δ@∑Q;O

Try it Here!
Pattern stolen from the powershell


text:
Decompose the domain
In scientific computing, it is often desirable to decompose some large domain into smaller "subdomains", then parallelize the computation by performing the work on each subdomain in parallel and the interaction of a subdomain with its neighboring subdomains. Since these interactions are typically data sync points, minimizing their size improves the scalability of the code to very large machines.
Consider a domain consisting of an N-dimensional Cartesian grid, where N is between 1 up to 6, inclusive. The minimum extent of this grid is at the coordinate (0,0,...0), and the maximum extent is likewise (n,n,...,n) (note that n may be very large!).
Your goal is to partition the domain into m non-overlapping hyperslabs (N-D rectangles) such that the sum of the surface area of all subdomains is minimized, and the ratio of surface areas of any two subdomains is approximately unity (within 10% of an optimal solution or as close as possible).
Inputs
Your program should take from any input source 3 positive integer numbers: n, N, and m. You may assume that m is smaller than the total volume of the domain (i.e. a valid solution can be found). As mentioned earlier, n can be quite large. For the purposes of this challenge, you may assume it to fit in your language's natural integer type, or a signed 32-bit integer (whichever is larger). Error checking of inputs is not required.
Outputs
Your program should output to any output sink a set of m hyperslabs describing the produced partition (order does not matter).
A hyperslab description must contain enough information to reconstruct the minimum and maximum extents of the hyperslab in the coordinates of the global domain, i.e. you can either output these values directly, or output the centroid+width in each dimension, etc.
None of the output hyperslabs can be empty (i.e. contain 0 volume). Note that every hyperslab edge must be at an integer increment.
The union of all outputted hyperslabs must cover the entire domain.
The output does not need to be deterministic (i.e. concurrent runs with the same inputs need not give the same outputs, so long as all outputs are valid).
Examples
Note that the example outputs for these inputs may not necessarily match what your code produces. Hyperslabs are specified by the min/max extent in each dimension.
input:
4, 1, 1
output:
[(0),(4)]

~
input:
4, 1, 2
output:
[(0),(1)], [(1),(4)]
sidenote:
typically in a "real" partitioner, this would be a bad partition since one subdomain contains more work than the other.
However, for the purposes of this challenge this is a perfectly valid output.

~
input:
4, 1, 2
output:
[(0),(2)], [(2),(4)]
sidenote:
an alternative "better" valid output for the same inputs as above.

~
input:
4, 2, 2
output:
[(0,0),(2,4)], [(2,0),(4,4)]

~
input:
1000000, 6, 7
output:
[(0, 0, 0, 0, 0, 0),(428571, 333333, 1000000, 1000000, 1000000, 1000000)],
[(428571, 0, 0, 0, 0, 0),(1000000, 500000, 500000, 1000000, 1000000, 1000000)],
[(0, 333333, 0, 0, 0, 0),(428571, 1000000, 500000, 1000000, 1000000, 1000000)],
[(0, 333333, 500000, 0, 0, 0),(428571, 1000000, 1000000, 1000000, 1000000, 1000000)],
[(428571, 500000, 0, 0, 0, 0),(1000000, 1000000, 500000, 1000000, 1000000, 1000000)],
[(428571, 0, 500000, 0, 0, 0),(1000000, 500000, 1000000, 1000000, 1000000, 1000000)],
[(428571, 500000, 500000, 0, 0, 0),(1000000, 1000000, 1000000, 1000000, 1000000, 1000000)]

Scoring
This is code golf; shortest code wins. Standard loopholes apply. You may use any built-ins so long as they weren't specifically designed to solve this problem. Your code should be able to run in a reasonable amount of time (say, 10 minutes on whatever hardware you have on hand, assuming m isn't too large)


text:
Autonest an array
Everybody loves nested lists! However, sometimes it's hard to make a nested list. You have to decide if you want to nest it deeper, or if you need to nest it shallower. So for your challenge, you must "Autonest" a list. To autonest a list, compare every pair of items in the list.

If the second item is smaller, separate the two elements by inserting closing and opening brackets between them, like this:
  } {
{2 , 1}

For example, {2, 1} becomes {2}, {1}, and {3, 2, 1} becomes {3}, {2}, {1}
If the second item is the same, then change nothing. For example, {1, 1, 1} stays the same, and {2, 1, 1, 1} would become {2}, {1, 1, 1}.
If the second item is larger, then nest every following item one level deeper. For example, {1, 2} would become {1, {2}} and {1, 2, 3} would become {1, {2, {3}}}

The Challenge
You must write a program or function that takes in a list of numbers, and returns the same list after being autonested. Take this input in your languages native list format (or the closest alternative) or as a string. You do not have to use curly braces like I did in my examples. You can use whichever type of brackets are most natural in your language, as long as this is consistent. You can safely assume the list will only contain integers. You can also assume the list will have at least 2 numbers in it. Here is some sample IO:
{1, 3, 2}                         -->   {1, {3}, {2}}
{1, 2, 3, 4, 5, 6}                -->   {1, {2, {3, {4, {5, {6}}}}}}
{6, 5, 4, 3, 2, 1}                -->   {6}, {5}, {4}, {3}, {2}, {1}
{7, 3, 3, 2, 6, 4}                -->   {7}, {3, 3}, {2, {6}, {4}}
{7, 3, 1, -8, 4, 8, 2, -9, 2, 8}  -->   {7}, {3}, {1}, {-8, {4, {8}, {2}, {-9, {2, {8}}}}}

Standard loopholes apply, and the shortest answer in bytes wins!

Can we take the input in our language's string format?

What is the max size of the integer?

@thepiercingarrow I don't really care too much. It won't be anything ridiculous. You should be able to at least handle [-100, 100] but I'm not planning on giving gigantic inputs.

"If the second item is smaller, then nest all following elements one level higher, by inserting a closing bracket. Then, to make sure all the brackets stay matched, insert an opening bracket. For example, {2, 1} becomes {2}, {1}" How is that one level higher? One level higher would be {2}, 1. What you have is the same level.

@msh210 Yeah, that was a poor explanation. Is the current phrasing better?

Yes, except that now it sounds like the result has to be a string, whereas previously I thought it could be a nested array of arrays.

If I return a string, does it need to include spaces between the commas and braces?

@TuukkaX No, it just has to be a valid array representation.

@mbomb007 yes, you should handle negative numbers.

Can I use space separated list?

In my answer: the output would not be interpreted as a nested list in MATL. It would in other languages, and it satisfies the output specification in the challenge. Is that accepted? That is, produce a string that can be interpreted as nested list/array (for example in other other languages), even if it doesn't have that meaning in the chosen language

MATL, 48 43 bytes
YY_XKx"@K<?93]44@K-?91]@XKV]v93Gd0>sQY"h4L)

This uses square brackets in input and output. The output has commas without spaces as separators.
Note that the output would not be interpreted as a nested list in MATL. It would in other languages, and it satisfies the output specification in the challenge.
Try it online!
Explanation
YY_XKx   % Push -inf. Copy to clipboard K (represents previous input entry). Delete
"        % Take numerical array implicitly. For each entry:
  @K<    %   Is current entry less than the previous one?
  ?93]   %   If so, push 93 (ASCII for ']')
  44     %   Push 44 (ASCII for comma)
  @K-    %   Is current entry different from the previous one?
  ?91]   %   If so, push 91 (ASCII for '[')
  @XKV   %   Push current entry, copy into clipboard K, convert to string
]        % End for each
v        % Concat vertically all stack contents, converting to char
93       % Push 93 (ASCII for ']') (to be repeated the appropriate number of times)
Gd0>sQ   % Determine how many times the input increases, plus 1
Y"       % Repeat 93 that many times
h        % Concat horizontally with previous string. Gives a row array, i.e. string
4L)      % Remove first char, which is an unwanted comma. Display implicitly

Python 3, 98 bytes
p,*i=eval(input())
c=[p]
a=b=[c]
for x in i:
 if x>p:b=c
 if x!=p:c=[];b+=[c]
 c+=[x];p=x
print(a)

Example:
$ python3 autonest.py <<< "[7, 3, 1, -8, 4, 8, 2, -9, 2, 8]"
[[7], [3], [1], [-8, [4, [8], [2], [-9, [2, [8]]]]]]

Haskell, 96 bytes
a#b|a<b=",{"|a>b="},{"|1<2=","
f(a:b:c)=show a++a#b++f(b:c)++['}'|a<b]
f[x]=show x++"}"
('{':).f

Usage example: ('{':).f $ [7,3,3,2,6,4] -> "{7},{3,3},{2,{6},{4}}".
As Haskell doesn't have nested lists, I return the result as a string. The nesting algorithm is easy: a) print number, b) if the next number is greater (less, equal), print ,{ ( },{, ,), c) make a recursive call with the rest of the list, d) print } if the number is less than the next one, e) enclose everything in { and }.

Sorry, I miscount

C, 145 138 bytes
Thanks to Giacomo for 7 bytes!
#define P printf(
n;main(c,v,p,t)char**v;{p=-101;for(v++;*v;v++){t=atoi(*v);if(t<p)P"}{");if(t>p)P"{",n++);P"%d ",p=t);}for(;n--;)P"}");}

Input is taken through command line arguments and output is given though
stdout.
sample run:
$ ./autonest 7 3 1 -8 4 8 2 -9 2 8
{7 }{3 }{1 }{-8 {4 {8 }{2 }{-9 {2 {8 }}}}}

Try use t=atoi(*v); instead of sscanf(*v,"%d",&t); Source

Use for(;*++v;) for save the first 4 and then insted of if(t<p)P"}{");if(t>p)P"{",n++); use t>p?P"}{"):P"{",n++); for 10 more.

Building on @GiacomoGarabello 121 bytes

Java 8 197 187 193 192 bytes

Thanks to all the commenters who worked with me on this monstrosity. It was golfed down to 187 bytes until I found a costly bug. However due to the power of Black Magic the "runs down to" operator "-->" the byte count is at a healthy 192 bytes.

String a(int[]b){int l=b.length,d=1,i=0;String c="{";for(;i<l-1;i++)if(b[i]>b[i+1])c+=b[i]+"},{";else if(b[i]<b[i+1]){d++;c+=b[i]+",{";}else c+=b[i]+",";c+=b[l-1];while(d-->0)c+="}";return c;}

Sorry coming right up @Blue

Also, a couple of tips: 1. You can take the input as an array, rather than a sequence: (int[]b) 2. You can define multiple ints at the same time using commas (int l=b.length,d=1,i=0). 3. You should remove as much whites pace as you can (ex. between variable assignments). Hope this helps!

Hello, and welcome to PPCG! Snippets are meant for javascript code that are meant to be executed in the browser, not challenge submissions. Also, you forgot a space after length,

Oh ok my apologies @Maltysen I will embed it into a full java program. I was just going off of the op saying "function or program" which "returns". So should I refactor this to print my output

@RohanJhunjhunwala sorry, should have been more clear. When I said "snippet", I wasn't talking about your code, but rather your formatting. When trying to put code into a post, don't click the "snippet" button, but instead put it in a code block(4 spaces or ctrl-k)

Oh ok sounds good

This doesn't add numbers to the result at all if they are equal to the last one.

@pietu1998 what do you mean?

a(new int[]{3,3,3}) returns {3}, not {3, 3, 3} like it should.

oh ok fixing now

d+=1 could be reduced to d++.

wow... thanks I didnt see that :P

I cant believe I didnt see that @TuukkaX

Retina, 71 70 bytes
Lists are space separated, with curly braces: {1 2 3}. Negative numbers are not supported, so if that's a problem, I'll just delete my answer. Retina + negative numbers = not worth it.
\d+
$*
+`\b(1+) (1+\1\b.*)
$1 {$2}
+`\b(1(1+)1*) (\2)\b
$1} {$2
1+
$.0

Try it online

CJam, 51 49 48 46 bytes
Exploits the fact that the number of last bracket is one more than number of adjacent pair that is increasing in array.
And I don't know ew operator before that I had to reimplement.
The input is space separated list delimited by square brackets.
'[q~_W=\2ew_{~\_@-g)["["S"]["]=}%@@{~>M']?}%']

Explanation
'[q~_W=\2ew_{~\_@-g)["["S"]["]=}%@@{~>M']?}%']
'[                                             e# Opening bracket
  q~                                           e# Read the input
    _W=\2ew                                    e# Save the last item and turn array into array of pair of next item and the item itself.
            _                                  e# We need two copies of that item
             {~\_@-g)["["S"]["]=}%             e# Build the "body" that consist of the item and the suitable delimiter, space if equal, opening brace if the first item is the smallest, otherwise, closing bracket and opening bracket.
                                  @@           e# Put in the last item. (It was omitted in previous phase)
                                    {~<']""?}% e# Create the closing bracket as many as the number of increasing adjacent pair
                                               '] e# And one more bracket.

I will find out how to do this with actual nested array instead of relying on prettyprinting.
Finally, at par with beaten MATL's answer.

Finally, beaten MATL's answer Not now :-P

@LuisMendo Ugh.

JavaScript (ES6), 73 bytes
a=>a.map(r=>l-r?(n=l<r?m:n).push(m=[l=r]):m.push(l),l=a[0],o=n=[m=[]])&&o

Explanation: The case of consecutive equal items is easy; the item is just added to the innermost array (here represented by the m variable; n is the array that contains m as its last element, while o is the output). For the case of different items, the item always goes in a new innermost array, the only difference being whether that array is a sibling or a child of the previous innermost array. For extra golfiness I set up the arrays so that the initial item counts as a consecutive equal item.


text:
Fred's water bill
Fred is a quasi-friendly guy, but in reality he is mean.
Because of this, Fred lives alone in a small apartment in Los Altos, CA. Fred is so mean because he is very particular about water. He, therefore, needs your help with figuring out what his water bill is.
Your job is to write a function or program that returns his water bill given the amount of water used as input (which is always an integer).
Water consumption comes in tiers. This means that there are ranges of prices depending on the amount of water.
These are the tiers, their prices, and the amounts of water they correspond to:
Tier I
   First 10 Ccf: $3.8476/Ccf
Tier II
   Next 17 Ccf: $4.0932/Ccf
Tier III
   All subsequent water: $4.9118/Ccf

For n hundreds of cubic feet (Ccf), there are the following additional charges as well:
CPUC fee: 1.5% of above charges
LIRA quantity surcharge: $0.047*n
PBOP amoritization surcharge: $0.004*n

The sum of the Tier I, Tier II, Tier III, CPUC, LIRA, and PBOP fees is the total water bill. This sum you should either return or print to the console rounded to two decimal places.
Here are two examples:
Input: 15
... Calculations which you do not need to output but here to help explain:
Tier I: 10*3.8476 = 38.476
Tier II: (15-10)*4.0932 = 20.466
Tier III: 0*4.9118 = 0
Tiers sum: 58.942
CPUC: 1.5% of 58.942 = 0.88413
LIRA: 0.047*15 = 0.705
PBOP: 0.004*15 = 0.06
Total sum: 58.942 + 0.88413 + 0.705 + 0.06 = 60.59113
...
Output: 60.59

Input: 100
... Calculations which you do not need to output but here to help explain:
Tier I: 10*3.8476 = 38.476
Tier II: 17*4.0932 = 69.5844
Tier III: (100-10-17)*4.9118 = 358.5614
Tiers sum: 466.6218
CPUC: 1.5% of  = 6.999327
LIRA: 0.047*100 = 4.7
PBOP: 0.004*100 = 0.4
Total sum: 478.721127
...
Output: 478.72

This is code golf so shortest code in bytes wins!

Please check that my edit matches your intent.

Yeah thanks @msh210, that's much clearer than what I had

If you are willing to waste reputation on down-voting could you at least please explain why?

@Dopapp Some people just might not like the challenge. Nothing you can do there. For what it's worth, downvoting challenges doesn't subtract from the downvoter's reputation - only answers.

Do we have to handle non-integer n?

Hundreds of cubic feet? I can't wait for the U.S. to go metric.

@Pietu1998, the input is always an integer

Pyth, 55 41 bytes
.R+s*Vv.",9t¬®Ï0NwÝ"lMcUQ,T27*.051Q2

The code contains unprintable characters, so here's a xxd hexdump.
00000000: 2e52 2b73 2a56 762e 222c 3904 1874 c2ac  .R+s*Vv.",9..t..
00000010: c2ae c280 c293 c38f 301c 4e77 c39d 226c  ........0.Nw.."l
00000020: 4d63 5551 2c54 3237 2a2e 3035 3151 32    McUQ,T27*.051Q2

Explanation

."…" is a packed string that contains 3.8476,4.0932,4.9118.
v evaluates that to the tuple (3.8476, 4.0932, 4.9118). These are the tiers' prices multiplied with CPUC added.
UQ generates the range 0…n-1.
c…,T27 splits that range at indices 10 and 27, with extra empty lists in the end if the range is too short.
lM finds the length of each part, giving the amount of water for each tier.
*V multiplies that by the tuple from step 2 to get the prices for the tiers.
s sums the results.
+…*Q.051 adds the input multiplied by 0.051, i.e. LIRA + PBOP.
.R…2 rounds the result to 2 decimals.

Try it online.

Mathematica, 83 76 69 bytes
1.015{3.8476,.2456(b=Boole)[#>10],.8186b[#>27],51/1015}&~Array~#~Total~2~Round~.01&

Anonymous function that constructs an array of the three tiers in the first column plus the LIRA and PBOP represented as an arbitrary-precision number in the fourth column. The whole thing is multiplied by 1.015 and all elements of the array are summed and rounded to .01. Since 51/1015*1.015 will be the desired 0.051 the output is exactly as precise, as the specification in OP.
A shorter solution, in 76 bytes, as I have suggested in my comment under the Perl solution
{3.956314,.249284(b=Boole)[#>10],.830879b[#>27]}&~Array~#~Total~2~Round~.01&

where 1.015 is factored into the prices from the start and then the LIRA and PBOP is added on top of the first tier.
73 bytes (but I'm reluctant to update my byte-count since this is quite close to the straightforward Perl solution):

69 bytes -- ah what the heck, golfing took some effort too.
.01Round[395.6314#+{24.9284,83.0879}.(UnitStep[#-1]#&/@{#-10,#-27})]&

EDIT regarding floating point error
The first three iterations of my answer are indeed exact in their decimal representation, since all coefficients involved have terminating decimal representations. However, since the coefficients are explicitly floats, stored in binary and having non-terminating binary representations, large enough inputs will start to accumulate errors in the least-significant digits of the binary representation. I would guess, when the float is so large, that it fits only 3-4 digits to the right of the decimal point, we can expect errors of around 1 cent. See below for an exact answer.
72 bytes, somewhat-immune to float inaccuracies
.01Round[{3956314,249284,830879}.(UnitStep[#-1]#&)/@(#-{0,10,27})/10^4]&

The multiplication by the leading .01 is done at the very last step. Until that point, all calculation are done with integers. This means, that if the .01 is omitted, there will be an exact result, but expressed in cents, rather than dollars. Of course, the multiplication by a float converts the entire thing to a float, and, as mentioned, it needs to be small enough to fit into 64 bits and still be accurate to .01.

05AB1E, 64 58 51 bytes
0T27¹)vy¹‚ï{0è})¥•_ÄÄ™wu24@•2'.:7ô)ø€PO¹"5.1"*+ïTn/

Explained
0T27¹)                                               # list of price brackets
      vy¹‚ï{0è})                                     # min of each with input
                ¥                                    # calculate deltas to get amounts within each bracket
                 •_ÄÄ™wu24@•2'.:7ô                   # list of price rates with CPUC included
                                  )ø                 # zip with amounts for each rate
                                    €PO              # multiply amounts by their rates and sum
                                       ¹"5.1"*+      # add LIRA/PBOP
                                               ïTn/  # round to 2 decimals

Try it online

Perl 5, 73 bytes
The obvious solution. 72 bytes, plus 1 for -ne instead of -e.
printf'%.2f',$_*3.956314+($_-10)*($_>10)*.249284+($_-27)*($_>27)*.830879

Saved 5 bytes thanks to LLlAMnYP. Thanks!

Re my previous comment, this edit turns out to actually eliminate the floating point errors you had in the original.

@LLlAMnYP, surely any approximation must have an error for high enough value of the input. Hopefully that bound is high enough that the OP doesn't care (because it's an unreasonable amount of water for a single person's residence).

@msh210 You don't know Fred's story!!

No, because you are multiplying and adding numbers with finite decimal representation. Of course, when you represent them as floats, they may have a not so great binary representation. You can then expect errors when the float representation allows for only 3-4 digits to the right of the decimal. My "bonus-answer" at the bottom of my post overcomes this, using integers until the very last step (which converts cents to dollars). If I were to omit multiplication by .01, it would remain accurate so long as the integer can be stored.

Oracle SQL 11.2, 151 bytes
SELECT ((DECODE(SIGN(:1-10),1,10,:1)*3.8476)+(DECODE(SIGN(:1-27),1,17,:1-10)*4.0932)+(DECODE(SIGN(:1-27),-1,0,:1-27)*4.9118))*1.015+:1*0.051 FROM DUAL;

Un-golfed
SELECT ((DECODE(SIGN(:1-10),1,10,:1)*3.8476)+
       (DECODE(SIGN(:1-27),1,17,:1-10)*4.0932)+
       (DECODE(SIGN(:1-27),-1,0,:1-27)*4.9118))*1.015+
       :1*0.051
FROM DUAL

Get rid of the space between SELECT and ((DECODE to save one byte. Save more 10 bytes using a named table! 7 by removing the colons and using a one char column name plus three using a one char table name.

@Giacomo Garabello : removing the space always returns null with toad and returns an error with SQLDeveloper. The create table script adds more than 10 bytes.

you don't have to add the creation script... look here

JavaScript ES6, 77 bytes
x=>(x>27?(x-27)*4.985477+109.681:(x>10?(x-10)*4.1546+39.053:x*3.9053))+.051*x

Un-golfed
f = x => {
  if (x > 27) {
    res = (x - 27) * 4.985477 + 109.681306
  } else if (x > 10) {
    res = (x - 10) * 4.154598 + 39.05314
  } else {
    res = x * 3.905314
  }
  return res + 0.051 * x
}

I factored in the LIRA and PBOP coefficients. The extra 1.5% gets added at the end.
Probably not the most efficient solution in terms of golfing but somewhat different from the Perl one.
Floating point error should occur with larger numbers and can be fixed by adding 1 or 2 extra bytes to each coefficient.

f=x=>(x>27?(x-27)*4.985477+109.681:(x>10?(x-10)*4.1546+39.053:x*3.9053))+.051*x

console.log(f(15))
console.log(f(100))
console.log(f(200000))

You don't need the ()s around the x>10?:, ?: associates right-to-left. I think you can also save some bytes by multiplying out the parentheticals e.g. (x-10)*4.154598+39.05314 equals x*4.154598-41.54598+39.05314 equals x*4.154598-2.49284.

R, 52 bytes
approxfun(c(0,10,27,10^6),c(0,39.56,111.06,5036475))

Try it online!
Generates a linear approximation function, based on  my previous answer's values at 0,10,27 and 10^6. The catch: the upper limit on the input is 10^6.
approxfun (with ecdf, stepfun, splinefun, etc.) is one of the many nice features of R.

VBA, 88 bytes
Function W(V):W=Round(.051*V+.203*(V*19.238-(V-10)*(V>10)*1.228-(V-27)*(V>27)*4.093),2)

The base rate and higher use differential rates have been multiplied by 5, and the CPUC fee multiplier divided by 5 (0.203).
The VB editor will add an End Function line, which is why the terminal line feed is included.

Pyth - 58 51 bytes
.Rs+*Bs*V++m3.8476Tm4.0932 17m4.9118Qm1Q.015*.051Q2

Test Suite.

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