text:
Shortest hex dumping program
Challenge
Create a console program to display each byte of a file.

Winning
Since this is code-golf, fewest bytes wins.

Rules

Program must be a console application, meaning that it will be ran from some sort of command-line interpreter;
Every byte must be uppercase hexadecimal, separated by a space, and it must be 2 digits; (put number 0 before it if it has 1 digit)
File must be read using IO or alternative, and not hard-coded;
File path must be specified as a command-line argument or a user prompt (like STDIN);
No loopholes please;

Example
test.txt (ends with LF)
Hello World!

$ ./hexdump.exe test.txt
48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0A

@facepalm42 To avoid facepalms, I strongly recommend using the Sandbox to help you design future challenges before posting them.

How is it possible to display all byte values at once, if it won't fit on the screen? Scrolling clearly isn't "at once". Also, what's wrong with (a function) just returning the values?

@facepalm42 Please don't change the spec so long time after posting the challenge. The original post didn't specify the exact format of the hexadecimal numbers, leaving it up to the answerers. Your latest edit invalidated my existing answer!

Is there a particular reason you only allow command-line argument or a user prompt? What's wrong with e.g. taking the file name as a function argument?

It would be helpful if you had a simple hello.txt text file as an example as an input and what the expected output should be. For instance, if the hello.txt contained simply the word hello with a line break, how would this be expressed in the output? Are you grouping the bytes in 16-bit,32-bit or 64-bit words? Or is each byte expressed as two-digit hex? Are spaces acceptable after each byte as hex, or after each x-bit word? Do you require an 0x pre-fix for each byte?

I'm not sure about all the rules but would this in-browser JS solution taking a JS File object as input work for the "console application" and "command-line argument or a user prompt" points?  https://jsfiddle.net/xrbaohkz/1 It doesn't take care of the fetching and thus reads the file from the path that the browser made (be it to memory or disk). (Ps: not that this solution is good enough yet, but don't want to spend time on it if I'm blocked by these rules I'm not sure to understand)

What's a command line interpreter? Can I use a minecraft console?

Brainfuck doesn't have arguments, but this is trivial to implement with piping to stdin. Eg beef hex.bf < test.txt

@Sylwester But at that point you're taking input from STDIN, not as a command line argument as the question has unfortunately specified

@JoKing I have specified: "File path must be specified as a command-line argument or a user prompt". Which can be stdin.

@JoKing No, because the rules say "File must be read".

@JoKing I can't see anywhere where we specify the full contents as input? Just test.txt which is a filename.

Let us continue this discussion in chat.

C (gcc) on *nix, 73 71 bytes
i;main(c,v)int**v;{for(c=open(v[1],0);read(c,&i,1);printf("%02X ",i));}

Try it online! Test suite
-2 bytes thanks to Johan du Toit
This relies on O_RDONLY == 0 and on int_one == 1 where int int_one; *(char*)&int_one = 1;.

Java 11, 156 154 bytes
import java.nio.file.*;interface M{static void main(String[]a)throws Exception{for(int b:Files.readAllBytes(Path.of(a[0])))System.out.printf("%02X ",b);}}

-2 bytes thanks to @Holger.
Try it online by using ./.input.tio as argument file-path, which will have a given input as file-content.
Explanation:
import java.nio.file.*;        // Required import for Files and Paths
interface M{                   // Class
  static void main(String[]a)  //  Mandatory main method
      throws Exception{        //  With mandatory thrown clause for the readAllBytes builtin
                                         a[0]    // Get the first argument
                                 Path.of(    )   // Get the file using that argument as path
              Files.readAllBytes(             )  // Get all bytes from this file
    for(int b:                                 ) // Loop over each of them:
      System.out.printf(                         //  And print the current byte
                        "%02X ",b);}}            //  As uppercase hexadecimal with leading 0
                                                 //  and trailing space as delimiter

What's the rationale behind using interface instead of class?

@JakeDot main is required to be public, interface methods are always public, interface is shorter than class + public.

With Java 11, you can use Path.of instead of Paths.get

@Holger Thanks! :)

@JakeDot It's indeed as Grimy said. class M{public void main(... is 3 bytes longer than interface M{static void main(....

@Grimy since Java 9, interface methods are not always public, but they are public unless explicitly declared private.

Ruby, 26 bytes
$<.bytes{|b|$><<"%02X "%b}

Try it online!

Does this read the contents of a file given a file-path as program argument? Based on the TIO it seems to just read from STDIN, but I don't know Ruby well-enough to say it's incorrect.

@KevinCruijssen Yes, it takes the file path(s) as program argument. If there are no arguments, $< switches to reading from STDIN instead.

PHP, 60 59 54 bytes
<?=wordwrap(bin2hex(implode(file($argv[1]))),2,' ',1);

-1 byte thanks to manassehkatz
-5 bytes thanks to Blackhole

Try it online!

Should be able to drop the trailing ?> and save 2 bytes, or if that doesn't work then replace ?> with a semicolon and save 1 byte.

Use implode(file($x)) instead of file_get_contents($x) (-4 bytes).

And wordwrap(), with 1 as the last parameter, is one byte shorter than chunk_split().

PowerShell, 45 40 bytes
"$(gc $args -ra|% *ay|%{'{0:X2}'-f+$_})"

Try it online!
-5 bytes thanks to mazzy

thanks for ./.input.tio. 40 bytes with CRLF preserved.

I learned this from the Kevin Cruijssen solution.

Perl 5 (-aF//), 23 bytes
printf"%02X ",ord for@F

TIO

Python 3, 59 bytes
-11 bytes thanks to Mostly Harmless!
-8 bytes thanks to James K Polk!
-24 bytes thanks to Blue!
print(' '.join('%02X'%ord(i)for i in open(input()).read()))

Try it online!
This is pretty straightforward; it opens a filename given as input on STDIN, reads it, converts each character to its ASCII value, converts each number to hex, strips off the "0x" that precedes hexademical values in Python, pads the value with a zero if necessary, then joins the values together with spaces.

Can save a few bytes with '%02X'%ord(i) instead of slicing the output of hex

@MostlyHarmless Done! -11 bytes. Thanks!

how about '%02X' instead of '%02x', and get rid of .upper()

You can save the bytes from the import sys by using raw_input() as the filename instead; rules allow user prompting.

@Blue Thanks! And it's even shorter in Python 3, where you can just do input()

Drat f'{ord(i):02X}' is like 2 chars longer then '%02X'%ord(i) and loading as a byte stream doesn't save anything either e.g. print(' '.join(f'{i:02X}'for i in open(input(),'br').read()))

APL (Dyalog Unicode), 16 bytes
Anonymous tacit prefix function. Returns (and implicitly prints, if the value isn't otherwise consumed) a two-row matrix with the top 4 bits represented as a decimal number 0–15 in the top row and the bottom 4 bits similarly represented in the bottom row. That is, the matrix has as many columns as the file has bytes.
16 16⊤83 ¯1∘⎕MAP

Try it online!
⎕MAP map the argument filename to an array
∘ with parameters:
¯1 the entire length of the file
83 read as 8-bit integers
16 16⊤ convert (anti-base) to 2-position hexadecimal

@facepalm42 It very much is in hexadecimal. E.g. H is 72, which is 4×16¹+8×16⁰ or [4,8]₁₆. Hence the first column in the example reads [4,8].

Oh, I completely forgot! Sorry.

Bash,  33  23 bytes
...with a lot of help:
-3 thanks to manatwork
-4 thanks to spuck
-3 thanks to Nahuel Fouilleul
echo `xxd -c1 -p -u $1`

Try it online!
Note that the TIO link above uses input - we can write files locally, so this shows it working as a program taking a file path.

Minor reductions: xxd -u -p $1|fold -2|tr \\n \ .

Thanks, any idea how to get the \n and \  to work in the 'this' link version? EDIT: I added another escape character.

If I understand you correctly, you just want to change from double quotes to single quotes: Try it online!

Awesome thank you!

xxd -c1 -p -u $1|tr \\n \

maybe echo \xxd -c1 -p -u $1``, if newline at the end is allowed

@spuck - I looked at -c for a no-limit option but didn't think of restricting to 1, thanks!

@NahuelFouilleul I can't see anything forbidding that. Thanks!

Kotlin, 130 127 104 93 92 bytes
fun main(a:Array<String>){java.io.File(a[0]).readBytes().forEach{print("%02X ".format(it))}}

Try it online!
Edit: -11 bytes thanks to @ChrisParton
Edit: Working TIO
Edit: -1 byte thanks to @KevinCruijssen

Could you ditch the import and reference File as java.io.File instead?

@ChrisParton right you are, thanks!

Here a working TIO. You can use ./.input.tio as file-path argument, and it will use the STDIN as file-content. :)

@KevinCruijssen thanks! just updated answer

I don't know Kotlin, but the TIO still works if I remove the space at a:Array, so I think you can save a byte.

@KevinCruijssen oh haha, whoops yeah I can totally save a byte there thanks, rookie mistake

Haskell, 145 143 bytes
import System.Environment
import Text.Printf
import Data.ByteString
main=getArgs>>=Data.ByteString.readFile.(!!0)>>=mapM_(printf"%02X ").unpack

A little bit shorter: import Data.ByteString plus main=getArgs>>=Data.ByteString.readFile.(!!0)>>=mapM_(printf"%02X ").unpack.

Dart, 140 134 bytes
import'dart:io';main(a){print(new File(a[0]).readAsBytesSync().map((n)=>n.toRadixString(16).toUpperCase().padLeft(2,'0')).join(' '));}

Try it online!
-6 bytes because I forgot to reduce variable names

+1 for dart. Such an underrated language.

Hard to golf with, since it's basically JS without the very lax type system

Perl 6, 45 bytes
@*ARGS[0].IO.slurp(:bin).list.fmt('%02X').say

Try it online!

@*ARGS[0] is the first command-line argument.
.IO turns that (presumed) filename into an IO::Path object.
.slurp(:bin) reads the entire file into a Buf buffer of bytes.  (Without the :bin the file contents would be returned as a Unicode string.)
.list returns a list of the byte values from the buffer.
.fmt('%02X') is a List method that formats the elements of the list using the given format string, then joins them with spaces.  (Convenient!)
.say prints that string.

Based on the Python answer, a TIO Link is in fact quite possible.

Some rearranging can remove the .list for 41 bytes

Rust, 141 bytes (contributed version)
use std::{io::*,fs::*,env::*};fn main(){for x in File::open(args().nth(1).unwrap()).unwrap().bytes(){print!("{:02X} ",x.unwrap())}println!()}

Rust, 151 bytes (original version)
fn main(){std::io::Read::bytes(std::fs::File::open(std::env::args().nth(1).unwrap()).unwrap()).map(|x|print!("{:02X} ",x.unwrap())).count();println!()}

-10 bytes: TIO

Emojicode, 186 162 bytes
filesb❗❗b❗➕256 16❗1 2❗ ❗❗

Try it online here.
Ungolfed:
 files    Import the files package into the default namespace
    Main code block
 b   For each b in ...
     (ignoring IO errors)
       ... the byte representation of the file ...
       ... read from user input:
  ❗ ❗
       Print ...
       ... in upper case (numbers in bases > 10 are in lower case) ...
       ... the concatenation of:
         b ❗ ➕ 256   b + 256 (this gives the leading zero in case the hex representation of b is a single digit) ...
              16   ... represented in hexadecimal ...
           ❗
         1 2   ... without the leading one,
      ❗
          ... and a space

    ❗❗

bash+Stax, 6+4+1=11 bytes
This is complete theory craft at this point. You can't actually run this. If everything works according to its spec this would work, but not everything does yet.
The bash script is
]<$1

and the stax program must be compiled and saved to ] is
╛↕ßú┼_

Set your character set to ISO 8859-1 (Windows-1252 won't work here) and go
Unpacked and explained
_          push all input as a single array
F          run the rest of the program for each element of the array
 |H        write the hex of the byte to standard output
 |         write a space to standard output

Node.js, 118 bytes
console.log([...require("fs").readFileSync(process.argv[2])].map(y=>(y<16?0:"")+y.toString(16).toUpperCase()).join` `)

What the result looks like:

Btw the content of test.txt in the example is as follows:

 做乜嘢要輸出大楷姐，搞到要加番toUpperCase()去轉番，咁就13byte啦。
 (Why on earth is upper-case output necessary. I had to add the conversion with toUpperCase(), and that cost 13 bytes.)

using ... for an array is actually pretty cool

Python 3, 75 bytes
Mostly a copy of Maxwell's python 2 answer.
import sys
print(' '.join('%02X'%b for b in open(sys.argv[1],'rb').read()))

you mean probably sys.argv[1]. with sys.argv[0] this script works more like a quine ;-)

@anion: oops, haha, fixing ...

D, 98 Bytes
import std;void main(string[]s){File(s[1]).byChunk(9).joiner.each!(a=>writef("%02X ",a.to!byte));}

Try it Online!

Forth (gforth), 71 bytes
: f slurp-file hex 0 do dup c@ 0 <# # # #> type space 1+ loop ;
1 arg f

Try it online!
TIO has 3 arg in the last line because TIO passes "-e bye" to the command line parser before passing in the code
Code Explanation
: f             \ start a function definition
  slurp-file    \ open the file indicated by the string on top of the stack,
                \ then put its contents  in a new string on top of the stack
  hex           \ set the interpreter to base 16
  0 do          \ loop from 0 to file-length - 1 (inclusive)
    dup c@      \ get the character value from the address on top of the stack
    0 <# # # #> \ convert to a double-length number then convert to a string of length 2
    type        \ output the created string
    space       \ output a space
    1+          \ add 1 to the current address value
  loop          \ end the loop
;               \ end the word definition
1 arg f         \ get the filename from the first command-line argument and call the function

Racket, 144 bytes
This submission does output a trailing space, and no trailing newline. Let me know if this is considered a loophole :)
(command-line #:args(f)(for([b(call-with-input-file f port->bytes)])(printf"~a "(string-upcase(~r b #:base 16 #:min-width 2 #:pad-string"0")))))

Cleaned up
(command-line #:args (f)
 (for ([b (call-with-input-file f port->bytes)])
   (printf "~a "
           (string-upcase
            (~r b #:base 16 #:min-width 2 #:pad-string "0")))))

Javascript, 155 bytes
for(b=WScript,a=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(b.Arguments(0));;b.echo(('0'+a.read(1).charCodeAt(0).toString(16)).slice(-2)))

VBScript, 143 bytes
set a=CreateObject("Scripting.FileSystemObject").OpenTextFile(WScript.Arguments(0)):while 1 WScript.echo(right("0"+Hex(Asc(a.read(1))),2)):wend

Wolfram Language (Mathematica), 94 89 bytes
Print@ToUpperCase@StringRiffle@IntegerString[BinaryReadList@Last@$ScriptCommandLine,16,2]

Try it online!
The code is quite self-explanatory because of the long command names. It should be read mostly from right to left:
$ScriptCommandLine       is a list of {scriptname, commandlinearg1, commandlinearg2, ...}
Last@...                 extracts the last command-line argument
BinaryReadList@...       reads the named file into a list of bytes
IntegerString[...,16,2]  converts each byte to a 2-digit hex string (lowercase)
StringRiffle@...         converts this list of strings into a single string with spaces
ToUpperCase@...          converts the string to uppercase
Print@...                prints the result to stdout

Gema, 45 characters
?=@fill-right{00;@radix{10;16;@char-int{?}}}

Sample run:
bash-5.0$ gema '?=@fill-right{00;@radix{10;16;@char-int{?}}} ' <<< 'Hello World!'
48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0A

Try it online!

Pyth, 12 bytes
jdcr1.Hjb'w2

Try it online!
Takes input as user prompt (no way to access command-line arguments AFAIK).
jd           # join on spaces
  c        2 # chop into pieces of length 2
   r1        # convert to uppercase
     .H      # convert to hex string, interpreting as base 256 (*)
       jb    # join on newlines
         '   # read file as list of lines
          w  # input()

(*) I'm not 100% sure if this is intended, but one base 256 digit (as in, one character), will always convert into exactly 2 hex digits, eliminating the need to pad with zeroes.

C# .NET Framework 4.7.2 - 235 213 203 191 175 140 bytes
Try it online!
using System.IO;class P{static void Main(string[]a){foreach(var b in File.ReadAllBytes(a[0])){System.Console.Write(b.ToString("X2")+" ");}}}

using System;
using System.IO;

namespace hexdump
{
    class Program
    {
        static void Main(string[] args)
        {
            // Read the bytes of the file
            byte[] bytes = File.ReadAllBytes(args[0]);

            // Loop through all the bytes and show them
            foreach (byte b in bytes)
            {
                // Show the byte converted to hexadecimal
                Console.Write(b.ToString("X2") + " ");
            }
        }
    }
}

I think the following will save some bytes (now 181 I think):
using System.IO;class P{static void Main(string[] a){if(a.Length>0 && File.Exists(a[0])){foreach(var b in File.ReadAllBytes(a[0])){System.Console.Write($"{b.ToString("X2")} ");}}}}

@PmanAce If you remove some of the whitespace, it gets down to 175.

05AB1E, 18 bytes
IvyÇh2j' 0.:' Jvy?

Try it online!
Explanation:
IvyÇh2j' 0.:' Jvy?
Iv                 Loop through each character in input
  y                Push current character
   Ç               ASCII value
    h              Convert to hexadecimal
     2j            Pad with at least 2 spaces
       ' 0.:       Replace all spaces with 0s
            ' J    Add space to end
               vy? Convert to string and print
IvyÇh2j' 0.:' Jvy?

Free Pascal, 81 B
var c:char;begin while not EOF do begin read(c);write(hexStr(ord(c),2):3)end end.

Note, output has a leading blank and no trailing newline:
 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0A

−3 B:
By default the FPC (FreePascal Compiler) has the “FPC compiler compatibility mode” selected.
When compiling in FPC’s “ISO standard compiler compatibility mode” the file buffer variables (here specifically input^) and “low-level” I/O routines like get become available.
The following code needs to be compiled with fpc ‑MISO sourceCode.pas:
begin while not EOF do begin write(hexStr(ord(input^),2):3);get(input)end end.

−10 B: Furthermore, if input was guaranteed to be non-empty, we can use a repeat … until … loop instead of the bulky while … do begin … end:
begin repeat write(hexStr(ord(input^),2):3);get(input)until EOF end.


text:
Reverse Cat Programme
Simple problem, create a programme that takes one input, and the outputs that input in reverse.
Some test cases are [input -> output]:
 Hello World! -> !dlroW olleH
 Code Golf -> floG edoC
 Reverse Cat Programme -> emmarporG taC esreveR

Shortest answer wins
Note: It doesn’t have to support multi-line inputs and it doesn’t matter how input is taken

@O.O.Balance This one doesn't have unnecessary I/O restrictions

@Adám Fair enough.

Hi EdgyNerd, thanks for your contribution here. What happens if the input is an integer or a numeric value? There is nothing in your challenge that specifies that the input must be a string.

Would be nice to specify whether multiline input strings have to be supported or not.

Multi line inputs don’t have to be supported, and the input doesn’t have to be a string, as long as the output is in reverse order of the input’s characters

I'd suggest removing the (non-default) restriction to it being a program (standard jargon would be "a program or function" or just to remove the reference, e.g. "Simple problem output the input reversed".)

Keg, 4 1 byte
This is in the documentation:
^

The mechanism is simple: Reverse the whole stack. The stack is in fact a string, and input will trivially be the items in the stack.
There isn't an online implementation; download the Python interpreter and run this program, with the input prepending the ^.

C# (Visual C# Interactive Compiler), 30, 29 bytes
s=>string.Concat(s.Reverse())

Try it online!

Whitespace, 80 bytes
[S S S N
_Push_0][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][S N
S _Duplicate_top][T N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve_input][S S S T    S T S N
_Push_10][T S S T   _Subtract][N
T   S S N
_If_0_Jump_to_Label_PRINT_LOOP][S S S T N
_Push_1][T  S S S _Add][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT_LOOP][S S S T   N
_Push_1][T  S S T   _Subtract][S N
S _Duplicate_top][T T   T   _Retrieve_input][T  N
S S _Print_as_character][N
S N
S N
_Jump_to_Label_PRINT_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Since Whitespace inputs one character at a time, the input should contain a trailing newline so it knows when to stop reading characters and the input is done.
Try it online (with raw spaces, tabs, and new-lines only).
Explanation in pseudo-code:
Integer i = 0

Start LOOP:
  Read STDIN as character, and store at heap-address i
  Character c = character at heap-address i
  If(c == '\n'):
    Jump to PRINT_LOOP
  i = i + 1
  Go to next iteration of LOOP

function PRINT_LOOP:
  i = i - 1
  Character c = character at heap-address i
  Print c as character to STDOUT
  Go to next iteration of PRINT_LOOP

APL (Dyalog Unicode), 1 byteSBCS
Anonymous tacit prefix function.
⌽

Try it online!
Do I need to explain this?

05AB1E, 1 byte
R

Try it online!

Japt, 1 byte
Ô

w also works.
Try it

ZX81 BASIC (Timex TS-1000/1500, ZX80 with 8K ROM etc... assuming sting input only) 87 tokenized BASIC bytes
 1 INPUT A$
 2 LET B$=""
 3 FOR I=LEN A$ TO 1 STEP -1
 4 LET B$=B$+A$(I)
 5 NEXT I
 6 PRINT A$;"->";B$

Very simple, enter a string (stored in A$) which is then transferred one character at a time to B$ from the last to first character in the FOR/NEXT loop between lines 3 through 5 inclusive.
Output is shown on line 6.

Haskell, 7 bytes
I think it is self explanatory.
reverse

Try it online!

Pyret, 65 bytes
{(x):string-from-code-points(string-to-code-points(x).reverse())}

Unfortunately Pyret doesn’t have a built in string reverse function, so you have to convert it to a list, reverse it, and convert it back.

Java 8, 14 bytes
s->s.reverse()

I/O is a StringBuilder.
Try it online.
35 bytes with String as I/O instead:
s->new StringBuffer(s).reverse()+""

Try it online.

Dart, 34 bytes
f(s)=>s.split('').reversed.join();

Try it online!
Pretty convoluted, you have to get a String List then reverse it and join it back for it to work.

Octave, 11 bytes
@(a)flip(a)

Try it online!

Jelly, 1 byte
U

Try it online!
Ṛ would also work here.

Python 3 (or 2), 16 bytes
lambda x:x[::-1]

Try it online!
Lambda that reverses its input

source: Stack Exchange

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

sort: votes


text:
Multiplication in Brainfuck - minimum number of evaluations
Given two numbers in tape location #0 and tape location #1 in Brainfuck, compute their product into another tape location (specify with answer). Optimize for the least amount of time-units used, where the interpretation of any command uses one time-unit. As example, here is a quick C++ program to determine the number of time-units used by a Brainfuck program:
#include <iostream>
#include <fstream>
#include <stack>
#include <algorithm>
#define MEMORY 10000
#define DATATYPE uint32_t
#define ALWAYSPOSITIVE true

DATATYPE tape[MEMORY];
int loc, instp;

int main(int argc, char* argv[]) {
    std::string infile = "a.bf";
    bool numeric = false;
    bool debug = false;
    std::string flag;
    for(int i=1; i<argc; i++) {
        std::string arg = argv[i];
        if(arg[0] == '-') flag = arg;
        else {
            if(flag == "-i" || flag == "--in") infile = arg;
        }

        if(flag == "-n" || flag == "--numeric") numeric = true;
        if(flag == "-d" || flag == "--debug") debug = true;
    }
    if(infile == "") {
        std::cerr << "Fatal: no input file specified. Usage: ./pp2bf -i <file> [-n] [-d]" << std::endl;
        return 1;
    }
    std::ifstream progf(infile);
    std::string prog; std::string line;
    std::stack<int> loop;
    while(progf >> line) prog += line;
    instp = 0; uint64_t instc = 0, ptmove = 0, mchange = 0;
    int maxaccessedmem = 0;
    while(instp != prog.size()) {
        char inst = prog[instp];
        if(debug) {
            std::cout << inst << " #" << instp << " @" << loc;
            for(int i=0; i<=maxaccessedmem; i++)
                std::cout << " " << tape[i];
            std::cout << "\n";
        }
        if(inst == '[') {
            if(!tape[loc]) { // automatically advance to matching ]
                int n = 1;
                for(int i=instp+1;;i++) {
                    if(prog[i] == '[') n++;
                    if(prog[i] == ']') n--;
                    if(n == 0) {
                        instp = i+1;
                        break;
                    }
                }
                continue;
            }
            loop.push(instp);
        } else if(inst == ']') {
            if(tape[loc]) {
                instp = loop.top() + 1;
                continue;
            } else {
                loop.pop();
            }
        } else if(inst == '>') {
            loc++;
            maxaccessedmem = std::max(maxaccessedmem, loc);
            ptmove++;
            if(loc == MEMORY) {
                std::cerr << "Fatal: Pointer out of bounds (try increasing memory) @ instruction " << instp << std::endl;
                return 1;
            }
        } else if(inst == '<') {
            loc--;
            ptmove++;
            if(loc == -1) {
                std::cerr << "Fatal: Pointer out of bounds @ instruction " << instp << std::endl;
                return 1;
            }
        } else if(inst == '+') {
            mchange++;
            tape[loc]++;
        } else if(inst == '-') {
            mchange++;
            if(tape[loc] == 0) {
                if(ALWAYSPOSITIVE) {
                    std::cerr << "Fatal: Negative tape value at " << loc << " @ instruction " << instp << std::endl;
                    return 1;
                } else {
                    std::cerr << "Warning: Tape value at " << loc << " @ instruction " << instp << std::endl;
                }
            }
            tape[loc]--;
        } else if(inst == '.') {
            mchange++;
            if(numeric) {
                std::cout << (DATATYPE)(tape[loc]) << std::endl;
            } else {
                std::cout << (char)(tape[loc]);
            }
        } else if(inst == ',') {
            mchange++;
            if(numeric) {
                int inp; std::cin >> inp;
                tape[loc] = inp;
            } else {
                char inp; std::cin >> inp;
                tape[loc] = inp;
            }
        }
        instp++;
        instc++;
    }
    std::cout << "\nTerminated after " << instc << " time-units." << \
                 "\nMoved pointer " << ptmove << " times." << \
                 "\nChanged a memory location " << mchange << " times." << std::endl;
}

Note: In this implementation the tape is allotted 10K locations and each tape is an unsigned 32-bit integer - not the 8 bits used in a standard Brainfuck implementation.
For starters, here's mine:
,>,[<[>>+>+<<<-]>>>[<<<+>>>-]<<-]>.<<

When you compile the C++ program as rbf, save the Brainfuck program as mult.bf, run ./rbf -i mult.bf -n, and type 1000 followed by pressing Enter twice, the following output appears:
1000000

Terminated after 17011009 time-units.
Moved pointer 12006004 times.
Changed a memory location 5001003 times.

Your goal is to minimize the first value (i.e. 17011009). In case of ties minimize the second (12006004) and then the third (5001003).
The standard test case is
1000
1000

However, your code shouldn't be optimized for this test case only, but expend minimal time-units for any two numbers.
EDIT: For well-formedness, and not hardcoding an answer, take the sum of the expended time units in all test cases
x
x

where x = 900...1000 inclusive to get the final time units expended.

Welcome to the site!  This is has the potential to be a good challenge there are just a couple of things I am concerned about.  The first is how are loops timed?  There are two ways that loops can happen that are identical in behavior but different in number of operations.  The first is that the ] always puts the ip back to [ and [ does the checking and skipping.  The second is that [ checks and skips the loop if zero while ] is continues on if zero and returns to the beginning of the loop if not.  You ought to explain how exactly timing is scored.

Firstly, thank you very much for being interested in my question! How it is timed is that the first [ counts towards the time, and every ] is counted towards the time, including the one in which terminates the program. But I appear to have forgot that an address can be 0... oops! ;)

The second thing is: optimizing for time units used on it's own is not a sufficient winning criterion for us here. We require winning criteria to unambiguously rank answers. There should be no debate as to whether which answer is better or if the two answers are the same score. Your criterion does not quite do that. It is clear which answer is faster sometimes, but because there are answers that are faster for some inputs and slower for others how are those ranked? (My personal recommendation is to have answers get a concrete score by summing their scores across a number of specific cases)

I don't think that is possible, since increasing either input will increase the time units expended. But I will make it so that the inputs will always be 1000 and 1000.

I would warn against using a single input, it is possible to hardcode for that input so that the program first checks that the input is that number and then outputs a memorized result and multiplies any other two numbers normally.

Increasing with size of input is not necessarily in conflict with my last comment.  Say for example I have two answers, answer A is faster or slower mostly dependent on the size of the first input (that is that large values here make it very slow but large values in the second have little effect), while B is the opposite being more dependent on the second input.  B will be faster than a sometimes for example if given 10000, 4 but A will also be faster sometimes for example if given 4, 10000.  There are all sorts of other ways for this to happen too (this is just an example).

Ah, yes: this is present in my solution, too (4, 1000 is ~79K time units whilst 1000,4 is ~68K time units). I'll consider on how to improve this.

Another thing that I am just realizing.  Most brainfuck implementations wrap cells at 255 and some even wrap the tape at some point.  What implementation of brainfuck are we expected to use?  It seems obvious it is not the 255 wrapping version but your C++ implementation does seem to have wrapping albeit at a very high point.  This is best to make explicit in the challenge.

uint32_t is 0 to 4294967295 - wraps at 4294967296.

It's not clear whether a specific tape size or cell size is required.

I'd recommend adding all the information from your comments to the actual question itself, as well as specifying the intended brainfuck implementation (I assume infinite sized cells and no negative cells). Perhaps provide a reference implementation that can take a brainfuck program, test it is correct, and provide a score over your given range.

7,009,011 timesteps for \$1000*1000\$
>>,>,[<[-<+<+>>]>-[<<[-<+>>+<]]>[>->]<]<<<.

Try It Online!
This increases the counter on both the initial transfer and the second transfer back to the original position. This makes it almost the same efficiency for both orderings of the input, for example, \$100*1000\$ is \$709011\$ steps, while \$1000*100\$ is \$700911\$ steps.
I'm not really sure I want to attempt calculating sum of the given test cases.

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


text:
Print the last, middle and first character of your code
The challenge is simple: Print the last, middle, and first character of your program's source code, in that order.
The middle character is defined as follows, assuming a source length of n characters, and 1-indexing:

If n is even, print the n/2-th and n/2 + 1-th character. (abcdef == cd)
If n is odd, print (n-1)/2 + 1-th character. (abcde == c)

Rules

Given no input, print the last, middle, and first character in your source code, in the form [last][middle][first]. This will be 3-4 characters long.
Output must not contain any trailing whitespace. However, if whitespace is a first, middle, or last character, it must be printed as such.
Source code must be n >= 3 characters long.
Code must consist of >= 3 unique characters.
Standard loopholes are forbidden.
This is code-golf, so shortest solution in characters wins.

Samples
# Form: [code] --> [output]
xyz --> zyx
abcd --> dbca
1 --> # not allowed: too short
abcde --> eca
aaabb --> # not allowed: not enough unique characters
System.out.print("S;pr"); --> ;prS
this is a test --> ts t
123[newline]45 --> 53[newline]1

Challenge Proposal
Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=188005;
var OVERRIDE_USER=78850;
var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(d){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+d+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(d,e){return"https://api.stackexchange.com/2.2/answers/"+e.join(";")+"/comments?page="+d+"&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(d){answers.push.apply(answers,d.items),answers_hash=[],answer_ids=[],d.items.forEach(function(e){e.comments=[];var f=+e.share_link.match(/\d+/);answer_ids.push(f),answers_hash[f]=e}),d.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(d){d.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),d.has_more?getComments():more_answers?getAnswers():process()}})}getAnswers();var SCORE_REG=function(){var d=String.raw`h\d`,e=String.raw`\-?\d+\.?\d*`,f=String.raw`[^\n<>]*`,g=String.raw`<s>${f}</s>|<strike>${f}</strike>|<del>${f}</del>`,h=String.raw`[^\n\d<>]*`,j=String.raw`<[^\n<>]+>`;return new RegExp(String.raw`<${d}>`+String.raw`\s*([^\n,]*[^\s,]),.*?`+String.raw`(${e})`+String.raw`(?=`+String.raw`${h}`+String.raw`(?:(?:${g}|${j})${h})*`+String.raw`</${d}>`+String.raw`)`)}(),OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(d){return d.owner.display_name}function process(){var d=[];answers.forEach(function(n){var o=n.body;n.comments.forEach(function(q){OVERRIDE_REG.test(q.body)&&(o="
"+q.body.replace(OVERRIDE_REG,"")+"
")});var p=o.match(SCORE_REG);p&&d.push({user:getAuthorName(n),size:+p[2],language:p[1],link:n.share_link})}),d.sort(function(n,o){var p=n.size,q=o.size;return p-q});var e={},f=1,g=null,h=1;d.forEach(function(n){n.size!=g&&(h=f),g=n.size,++f;var o=jQuery("#answer-template").html();o=o.replace("{{PLACE}}",h+".").replace("{{NAME}}",n.user).replace("{{LANGUAGE}}",n.language).replace("{{SIZE}}",n.size).replace("{{LINK}}",n.link),o=jQuery(o),jQuery("#answers").append(o);var p=n.language;p=jQuery(""+n.language+"").text().toLowerCase(),e[p]=e[p]||{lang:n.language,user:n.user,size:n.size,link:n.link,uniq:p}});var j=[];for(var k in e)e.hasOwnProperty(k)&&j.push(e[k]);j.sort(function(n,o){return n.uniq>o.uniq?1:n.uniq<o.uniq?-1:0});for(var l=0;l<j.length;++l){var m=jQuery("#language-template").html(),k=j[l];m=m.replace("{{LANGUAGE}}",k.lang).replace("{{NAME}}",k.user).replace("{{SIZE}}",k.size).replace("{{LINK}}",k.link),m=jQuery(m),jQuery("#languages").append(m)}}
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
  <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654">

Winners by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

Maybe it's only me, but "Code must consist of >= 3 unique characters." suggests all characters of the program should be unique, while you only require to have at least 3 distinct characters.

I also think codes should be allowed to have few unique characters. I'd love to see a whitespace answer, it might even have a newline in the output

@Belhenix Fewer than three unique characters allows solutions as simple as 121 for a great many languages.

If anyone can find a stack-based language that uses - for negation and implicitly prints with a linefeed, \n1- is a three-byter. My search has so far been fruitless.

@GrzegorzOledzki That bit means you can't cheese the challenge by having an answer like aba, which is 2 unique characters. However, abc or aabc would be allowed.

@Belhenix Whitespace is certainly possible, it has enough unique valid characters (space, linefeed, tab).

@bigyihsuan got it. I sympathize with the rule. I just make a minor remark that the wording of the rule is not fully precise.

Just type 1231 into a python interpreter...

@bigyihsuan, aabc definitely doesn't contain >= 3 unique characters. It contains two unique characters and one duplicated one.

Can't change it now with 58 answers, but requiring "first letter of code must be different from last letter of code" would have ruled out a lot of trivial answers, including the current top answer. That may have been the intent of ">= 3 unique characters", but that requirement isn't actually very hard.

Your second from the last sample output looks wrong.  "this is a test --> s tt"

@James Seems to be the case. Need to change that...

JavaScript, 9 7 bytes
N=>a=-N

Outputs: NaN
Try it online!

Very clever. This was the tact I was trying to take, but just couldn't stumble upon a language with curt enough error output.

This is one of the best Javascript answers I've ever seen here

I saw javascript and got shocked. Then I read the actual solution and laughed much harder than I should have. Congratulations!!

Grass, 17 bytes
wWWwwwVVwWWwWWWww

Try it online!
-2 bytes thanks to jimmy23013.
Outputs www. Grass ignores all characters apart from w, W and v. The two Vs are thus ignored; they are there to ensure the middle character is a w – I have no idea how to output v or W in Grass… I could have used another character instead of V, but V preserves the aesthetic of the code.

"Luckily, the middle character ended up being a w and not a v or a W – I have no idea how to output v or W in Grass…" Lol. xD I tried to do something similar in Whitespace having also only three characters (space, tab, newline), but unfortunately I wasn't so lucky.. Luckily I can simply add a bunch of trailing no-ops to fix it, though.

@KevinCruijssen If the middle character had been anything else, I would probably have added in the middle a bunch of xs (or any other non-Grass character, which Grass ignores) to move a w into the correct place.

Ah, I'm an idiot.. I can insert a non-whitespace character as well which Whitespace will ignore. ;) -2 bytes thanks to you.

17 bytes: wWWwww  wWWwWWWww

@jimmy23013 Thanks! And thanks for posting your tip; I needed it to understand what you did! I changed the spaces to Vs because I find it prettier. ;-)

brainfuck, 17 bytes
U-[>+<-UU--]>...U

Try it online!
With unprintables this can be reduced to 7 bytes: ␀..␀_.␀

Within the rules, but BF doesn't use U as an instruction. Functionally,the code is -[>+<---]>., so the expected output would be .--, which it does not output.

@bigyihsuan but the source code still contains the Us and this interpreter happily ignores them. Should every answer which has comments or multiple spaces (or anything else that doesn't necessarily matter to the language) be not counted?

Shouldn't it be U-[>+<-UU--]>...U? In its current form the code only shows one U

@Helena thanks for catching that.

@dzaima: There is an ongoing argument that golfing entails minimizing code to the smallest viable product, thus inherently disallowing comments or ignored characters. I'm on the fence about it. While I usually err on the side of allowing comments in general, it feels less okay to do so for quines as the challenge is in the code. This answer effectively avoids the "middle character of the code" requirement by artificially shifting the middle character.

@Flater "disallowing comments or ignored characters" doesn't follow from "minimizing code to the smallest viable product". Very often it may be the case, but here (and in many other answers in many other challenges) it is
most definitely not. Noone's advocating disallowing comments in general (or I would hope so), only when they obviously don't help golfiness.

@dzaima: It's a matter of conforming to the rules of the challenge. The reason they're generally allowed is because they generally are only to the detriment of an entry (byte count wise - the predominant challenge measure). In other challenges they may even be desirable (e.g. involving ASCII art). However, here they're being used to pretty much circumvent a key requirement of the challenge (it must be the middle character which is also printed). This is different from the usual challenges and here it avoids part of the challenge.

@Flater Yes, here they're used to make the challenge easier, but isn't that the whole purpose of the [tag:code-golf] tag? Many answers here alone make their job easier by adding leading/trailing whitespace, and in general in code-golf here anything following the rules is allowed (and if I had to guess, if there was a rule disallowing unused characters (defining which objectively would already be pretty much impossible) would mean that the challenge might be still hovering at 0 score, and probably be closed as well).

Why don't you simply use ÿ-.ÿ..ÿ? That's printable and short.

Shakespeare Programming Language, 119 bytes
 ,.Ajax,.Page,.Act I:.Scene I:.[Enter Ajax and Page]
Ajax:  You big big big big big cat.Speak thy.Speak thy.Speak thy.

Try it online!
Prints three spaces. Without printing spaces:
Shakespeare Programming Language, 227 bytes
,.Ajax,.Page,.Act I:.Scene I:.[Enter Ajax and Page]Ajax:You is the sum of a big big big big big big cat a big pig.
You is the sum of you a large huge large big pig.
Speak thy.Speak thy.You is the sum of you a big pig.Speak thy.

Try it online!
Like my newline-free INTERCAL answer, this is constructed to make the last character of the program the same as the middle character (although in this case it is not also the first), by un-golfing the second half of the code until they match. (I'm not sure if I could have constructed 46 in fewer bytes or not, or if I could have golfed other parts of the first half more.)

I wasn't expecting Shakespeare to show up for this. This is great

Wish I could +1 just for learning this language existed!

@Stilez It's actually not that uncommon on here. There's a whole [tag:tips] page on it (which I copy-pasted the program header from)

even in the online interpreter's debug output messages, the authors' sense of humor shows: Warning at line 2: 'mind' expected

163 bytes for the second version by ending with a !

@RobinRyder I think that's substantially different enough in how it shows actual understanding of the language that it deserves to be its own answer. Go forth and reap the reputation, you've earned it

@UnrelatedString OK, thanks! Done.

Python 2, 13 11 bytes

print' t'

To make the whitespace clear:
$ xxd solution.py
0000000: 0a70 7269 6e74 2720 7427 20           .print' t'
$ python2 solution.py | xxd
0000000: 2074 0a                                t.

Try it online!
-2 bytes, thanks to wastl !

Both output trailing whitespace (newline), which is not allowed. Python 2 alternative: Try it online!

Also, I don't think this is valid: Python requires you to have an empty newline at the end of your code.

@GezaKerecsenyi As I understand it, a newline at the end of the source code is just a recommendation. See PEP8.

@GezaKerecsenyi Just a guideline

@wastl Thanks! Fixed.

05AB1E, 7 5 bytes

„ RR
Outputs R \n.
-2 bytes by taking inspiration from @Neil's Batch answer, so make sure to upvote him as well!
Try it online.
5 bytes alternative by @Grimy:

12,1
Outputs 12\n.
Try it online.
Initial 7 bytes answer:
'?„«'«?

Outputs ?«'.
Try it online.
Explanation:
          # No-op newline
„ R       # Push 2-char string " R"
   R      # Reverse this string to "R "
          # (output the result implicitly with trailing newline)

          # No-op newline
12,       # Print 12 with trailing newline
   1      # Push a 1 (no implicit printing, since we already did an explicit print)

'?       '# Push 1-char string "?"
  „«'    '# Push 2-char string "«'"
     «    # Concatenate them both together
      ?   # Output without trailing newline

Alternative 5

RProgN 2, 3 bytes
1
0

Try it online!
I think this is valid?

I'm guessing 1 and 0 are pushed onto a stack, then an implicit pop-print at the end of the program?
Yes it's valid

@bigyihsuan that's what I'm guessing too; I don't know the language, I just recall it does stuff like this :p

@dzaima Haha, when you post an answer and you don't even know how it works. xD I've indeed seen RProgN a few times before with old [quine] challenges, before the quine-rules got changed.

I believe this is polyglot in tac on Linux.

Jelly, 5 bytes
001 0

Try it online!
The output has two distinct characters, but the code also has a third one.
Trivial 4-byte version:
1231

Isn't 121 also a valid trivial answer?

@TeleportingGoat: No, because it has only two distinct characters

PHP, 9 bytes
<?=";;<";

Try it online!

Actually, since PHP outputs code as text until the first <? tag, you could use one of the trivial 4-byte solutions like 1231 - anything without a special character as first and last, any other 2 characters in the middle. Your answer may be the shortest real code PHP answer.

Excel, 9 bytes
=("))=" )

So many Parentheses.
Note: The returned middle character can actually be any character since it's the middle of the code.

Parentheses!  (Lightbulb)  I got stuck with the last character needing to be ".  Well done!

Thanks! It was something I was trying to figure out as well, and then I remembered that parentheses would work.

DOS/Windows Batch Language, 9 bytes
@echo @o@

Welcome to Code Golf & Coding Challenges Stack Exchange, +1 for nice first post!

Batch, 9 characters

@echo hh
The middle and last character are both h, and then the echo prints a newline by default, which is the first character of the script.

Ruby, 6 bytes

p " "

Try it online!
This outputs " " plus a newline. The code ends with a ", the middle two characters are  and ", and it starts with a newline.

I like your badge, I believe it's a grayscale xor on N². I generated almost the same picture to help me for a Project Euler Nim problem. Does your badge have a story?

Nice catch! I just like "doodling" during meetings by generating pictures using one-liners; xor was an early favorite.

PowerShell, 3 bytes
00000000: 0a0d 31                                  ..1

Works only in Microsoft Windows.
The output is unfortunately 8 bytes in UTF-16. But the question says output the characters, and not the bytes. Arguably UTF-16 is just one of the supported ways to represent the characters in PowerShell. They are not interpreted differently from an ASCII file.

it's smart answer

allowed because 0x0a != 0x0d != 0x31 :)

Bash (15 11 characters)
echo -n e-e

which prints out
e-e

-4 chars by not using |rev

@racraman Your suggested edit of echo<space>e<space><space>e will output e<space>e<newline> instead of e<space>e, so I've rejected it. The newline is part of the output, which is why GrzegorzOledzki is using the -n option. Try echo -n e-e online vs Try echo e  e online. And again, please don't edit other peoples answer. If you have a golf to suggest, leave a comment.

also 11 bytes with printf  pfp, but only because we need two spaces due to that definition of middle character, otherwise it would be 10 ...

Underload, 9 bytes 7 bytes
Thanks to Khuldraeseth na'Barya for the improved solution!
W(SSW)S

As for as I can tell, this is now unimprovable since:

The first character has to be a no-op character, since every other instruction raises an error due to the stack being empty, with the exception being an opening bracket. However, it can't be that since there is no way to output an opening bracket on it's own in Underload.
You need to use at least 5 characters to add the 3 output characters to the stack.
You need to use S to output it.

Try it online!

Welcome to Code Golf SE! You can save a couple bytes by skipping the copy, like so.

Shakespeare Programming Language, 163 153 bytes
-10 bytes thanks to Jo King.
B,.Ajax,.Page,.Act I:.Scene I:.[Enter Ajax and Page]Ajax:You is
the sum ofa Big Big Big BIG BIG cat a
CAT.Speak thy.You is twice you.Speak thy!SPEAK THY!

Try it online!
My first SPL answer! Outputs !BB.
There is another SPL answer by Unrelated String; in that answer, they output only spaces in 119 bytes, or output non-space characters in 227 bytes. This one comes in between, and also outputs non-space characters.
Two tricks are used here:

An SPL sentence can end with ! rather than ., and ! is easier to get since its ASCII codepoint is 33 (=\$2^5+1\$), whereas the codepoint of . is 46.
Doubling 33 gives 66, the codepoint of B, hence the play title is B and I need the second "big" to be "Big", which works since SPL is case-insensitive.

Since I needed that capital B and an exclamation mark at the end, I decided to have Ajax shout louder and louder through the scene.

It feels cheaty, but
Mornington Crescent, 1005 bytes
Take Northern Line to Euston

Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Victoria
Take Victoria Line to Tottenham Hale
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take District Line to Gunnersbury
Take District Line to Acton Town
Take District Line to Acton Town
Take Piccadilly Line to Turnpike Lane
Take Piccadilly Line to Turnpike Lane
Take Piccadilly Line to Leicester Square
Take Northern Line to Leicester Square
Take Northern Line to Mornington Crescent

There are nine deliberately placed newlines after the first instruction to make the middle character the o of Take District Line to Upminster. The code prints out the first three characters of Tottenham Hale reversed to yield toT. Of course, this challenge was made easier by the fact that Mornington Crescent programs always start with the T of Take and end with the t of Mornington Crescent, barring any extra newlines. Try it online!

I've just realized that this works in TIO (Esoterpret) but not in Esoteric IDE.

Ruby, 11 9 bytes
print:ptp

Try it online!

ArnoldC, 61 bytes
IT'S SHOWTIME
TALK TO THE HAND "D I"
YOU HAVE BEEN TERMINATED

Try it online!
Trivial answer in ArnoldC. The 31st byte is the space just before the string literal.

Chef, 447 bytes
Last Middle First Milkshake.

This recipe prints its last, middle and first character.
You could also use it to make a milkshake.

Ingredients.
76 ml milk
32 ml chocolate syrup
46 teaspoons vanilla ice cream

Method.
Liquefy vanilla ice cream.
Put the milk into 1st mixing bowl.
Put the chocolate syrup into 1st mixing bowl.
Put the vanilla ice cream into 1st mixing bowl.
Pour contents of the 1st mixing bowl into the 1st baking dish.

Serves 1.

Try it online!
A serious submission, 196 177 bytes
thanks to A__
R.

Ingredients.
82 l a
103 l b
46 l c

Method.
Put a into mixing bowl.
Put b into mixing bowl.
Put c into mixing bowl.
Pour contents of mixing bowl into baking dish.

Serves 1.

Try it online!

Seeing Chef programs makes me wonder what is the bare minimum for it.

@bigyihsuan see my edit

You can remove all the "the"'s and make the program still work.

I created a working program. (177 bytes)

TI-Basic, 3 bytes
i+1

i represents the imaginary number.

Knight, 7 bytes

O"OO"O

Try it online!
Prints OO<newline>.
Whitespace is ignored, O is monadic output function which prints the string "OO" without quotes and a trailing newline, and the last O is ignored because the parsing ends at O"OO".
Knight, 7 bytes

O-1 2-

Try it online!
Prints -1<newline>.

Absolutely brilliant, I love it.

CJam, 7 bytes
'@'' _@

Try it online!

Pretty sure 0 1 0 is shorter and also has three distinct characters (I don't want to repost my Jelly approach :P).

@EriktheOutgolfer Well though!. But that's just like your answerm so I'll leave this as is

Yeah, that's why I commented, didn't really want to post the same thing twice. (Hm... this might be the optimal solution for many languages.) Anyway, yours might be applicable elsewhere too!

C (gcc), 21 bytes

main(){puts("}u");;}

Try it online!

Print the last, middle, and first character of your program's source code, in that order. You're printing first, middle, last!

oops, I just realized that.

If there is an even number of characters, you need two middle characters. (sorry ...)

Whitespace, 31 29 bytes
[S aS S T   S S S S S N
_Push_32][S N
S _Duplicate_32][S N
S _Duplicate_32][T  N
S S _Print_as_character][T  N
S S _Print_as_character][T  N
S S _Print_as_character]

-2 bytes thanks to @RobinRyder.
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs, and new-lines only).
Contains a no-op a (can be any non-whitespace character) to make the length odd. It is added before the first halve of the program so the middle character is a space as well, since the middle character would have become a newline if it was at the second halve of the program. All non-whitespace characters are ignored in Whitespace programs.

Befunge-93, 7 bytes
.",  @0

Try it online!
Explanation
Output is 0 .
.       pop value (0) from stack, output as number with a trailing space
 "      toggle string mode, wraps around and pushes every char to the stack
  ,     pop value (".") from stack, output as character
        spaces are no-ops
     @  end the program
      0 trailing 0 to match the output

APL (Dyalog Unicode), 5 4 bytes
Full programs.
Boring solution from J.Sallé:
1231

Prints that number. A much more interesting solution:
010E1

Try it online!
APL ignores leading zeros, so this is simply scaled format for 10×10¹=100.

Brain-Flak, 11 bytes
(((())))

Try it online!
Explanation
We need to put 3 things on the stack.  The fastest way to do that is to put 3 1s (or zeros) on the stack.  Now since  (code point 1) does nothing in Brain-Flak we can add these to the program at the first middle and last places.  Now this feels a bit cheaty so here are two more answers that are less cheaty in my opinion.
Prints braces, 31 bytes
( (((((()()()()()){}){}){}))())

Try it online!
This answer prints braces so that the characters printed are actually relevant to the code, it does have one padding character to make the length odd so we only have to print 1 middle character.
Contains only braces, 32 bytes
(((()((((()(()()){}){}){}){}))))

Try it online!
This is a braces only program both the source and (consequently) the output are made up entirely of braces (character Brain-Flak actually cares about).

Python 3, 19 bytes 13 bytes

print( ')(')

The print function appends a newline by default so the code starts with a newline. The last character of the code is a ")" so that's printed first. To make the number of characters uneven, a space in inserted before the argument of the print function. Please excuse the salaciousness of the code.
Outputs: )(\n
Try it online.

Depending on how the rules work I might have 13 bytes playing with your answer:   print(")(" ) Note there is a new line above print and a whitespace inside print after ")(".  Outputs: )(  with a new line at the end.

Thanks, down to 13 bytes! As the question specifically refers to whitespaces but not newlines I'll assume trailing newlines, as the default end parameter of the print function, don't count.

This prints a trailing newline but doesn't account for it.

Not sure if newlines count as whitespaces but I added the 2nd also 13-byte version.

Yes, newlines count as whitespace, just like tabs and spaces among others

Thanks, removing the now redundant upper part of the submission.

This gives the wrong middle character. I think you need to swap the ( and the previous space.

33, 9 bytes
a"a\\a"pa

The a's do nothing here, they're essentially NOPs in this code to make it shorter. My original thought was "p\\\""p, but that's 8 bytes, so it needs to print another \, making it 10 bytes "p\\\\\""p
This is a language I did create, but I made it legitimately, so I hope it's within the rules.

Husk, 5 bytes
"¨ ¨"

Try it online! In Husk, ¨ is the escape character for ".

Haskell, 17 bytes
main=putStr"\"Sm"

Try it online!

Java 8, 11 bytes (as lambda function)
v->'"'+"'v"

Outputs "'v.
Try it online.
Java 8, 67 bytes (as full program)
interface M{static void main(String[]ar){System.out.print("}ni");}}

Outputs }ni.
Note the ar instead of a as argument. Otherwise the middle part had to be in, but printing that would make the size odd again, which would cause a paradox-loop..
Try it online.

@racraman Please don't go edit other peoples answers. If you have a golf to suggest, leave a comment stating so. Also, your golf on my answer was incorrect. Your code would output vv", but it's supposed to output it in reverse, so it should have output "vv.

-2 https://codegolf.stackexchange.com/a/235169/106557

MathGolf, 5 4 bytes
1231

-1 byte by using the trivial solution presented by @ErikTheOutgolfer in his Jelly answer, which works for any language with implicit output without trailing newline.
Try it online.
Original 5 bytes answer:
ùù xx

Outputs x ù.
Try it online.
Explanation:
ùù x   # Push 3-char string "ù x"
    x  # Reverse it to "x ù"
       # (output the entire string joined together implicitly without trailing newline)

R, 11 bytes
cat("))c" )

Try it online!
Outputs ))c. Space added to make the number of characters odd: otherwise we would need to output 4 characters, and that would make the code longer anyway.

Is this allowed? https://tio.run/##K/r/3y/R7/9/AA  If so, you can cut it down to 3 bytes...

@Sumner18 I don't think it's allowed, because the initial [1] in the output counts. And maybe the trailing newline as well...

HQ9+ 4 characters
+AQ+
Explanation:
+ ; increment accumulator
A ; nop
Q ; print itself
+ ; increment accumulator

Code must consist of >= 3 distinct characters

@Draco18s thanks, I missed that part of the rule. I think I fixed it

Forth (gforth), 9 bytes
Prints an escape-supporting string.
.\"   ."

Try it online

Also 9 bytes:
Prints three spaces.
 ."    "

Try it online

9 bytes with Stack Underflow:
 ." .. ".

Try it online

The 2nd and 3rd solutions also work if you replace first quotations with ( and last quotes with ). Essentially, plenty of ways to do it in 9 bytes, but probably not any shorter.
Documentation

INTERCAL, 65 bytes
PLEASE,1<-#3DO,1SUB#1<-#246DON'TPARSE!!
DO READ OUT ,1
DO GIVE UP

Try it online!
Padding the second half of the program to make the output PPP seems to be shorter than printing multiple distinct characters.
PLEASE ,1 <- #3         Declare that the length of the uint16 array ,1 is 3.
DO ,1 SUB #1 <- #246    Make the first element of ,1 246. (The other elements are 0.)
DON'T PARSE!!           This statement is ignored and nonsense.
DO READ OUT ,1          Print ,1 using C-INTERCAL's "Turing Tape" I/O.
DO GIVE UP              End the program.

This one almost works for 35 bytes, but it prints a space before the first newline:

PLEASE       READ OUT#500DOGIVEUP

MATLAB, 1315 bytes
disp(  ') d')

Outputs ) d
Previous version (15 bytes, less strict output):
'''';1;''''''''

Outputs '''

I see now, now worries.

Doesn't this output trailing whitespace?

@Sanchises nope, size(ans)==3

Yes, but the actual output is ans =\n    '''\n. Usually that's not a problem but this challenge seems to set a stricter standard. But then I may be interpreting the challenge wrong.

@Sanchises hm, i see. i might misunderstand what codegolf considers "output" then, your output seems to be literally the output, formatted by MATLAB

@Sanchises i have added shorter version, that seems to comply. Could you please check? I like the original more though :)

@aaaaaa disp also has a trailing newline. But maybe instead leave the old version and ask if that's OK. I guess this challenge is a little bit unclear because it seems to deviate from the standard but doesn't explicitly say so.

@Sanchises fprintf( ')(f') should work, as it outputs no trailing whitespace

Yeah I posted that as an Octave entry.

AsciiDots - 9 bytes
.---$'.$.

Output: .$.
The code starts with a ., ends with a ., and the middle character is a $.
The single quote in the middle sets the dot print mode to simply read characters straight into the output stream.
It is possible that this could be made smaller, but I'm starting to doubt that it can. In order to print three characters, the single quote must be used, as the double quote would require an end to the string in order to output. However, this means that the single quote has to a) be followed by three characters and b) cannot be the center character. In order to crunch this down to seven bytes, I was considering trying to reuse the dot's start as one of the printed characters (sort of like AsciiDot's quine program). However, I found that the shortest sequence available for printing was ($' which would have had to print four characters in the space of three, or three characters in the space of four. I also tried some hacky alternative methods like trying to print the dot's value (which is 0) as one of the characters. While there may be some system that works, I've found these to be rather complex and large. Thus, I think that the above is the smallest solution. (I will update if I find something smaller)

Welcome to Code Golf SE! I messed around with this for a few minutes and came to the same conclusion you did. Nice first post!

Alternative 9 bytes - /'$'-.[newline]\.Try it online!

GolfScript, 7 5 bytes

".".

Try it online!
Explanation
     # A newline, just to hide the effect of the automatic trailing newline
"."  # The . character: the last and middle character
   . # Copy the character twice

# Implicitly output the whole stack without a delimiter.

# This returns ".." (the . character duplicated) and a trailing newline.

There is a trailing newline at the end of the output; I'm not sure that's allowed. There is a boring 5 byte answer which only outputs 2 spaces and a newline: TIO.

@RobinRyder No, it doesn't. It just outputs a single space and a newline. (TIO renders a newline as a space.)

Itr, 5 characters (6 bytes)
×'×3×
online interpeter
Explanation
×'×3×
×     ; call × on the first two arguments (0 by default) and ignore the result
 '×   ; the character ×
   3× ; repeated 3 times

AppleScript, 4
1021

Outputs the last char (1), the middle chars (02), and the first char (1).
Any four-digit number with the same first and last digits and different middle digits works.

2 Distinct characters are a requirement

@LuisfelipeDejesusMunoz Does this edit qualify?

JavaScript (Babel Node), 11 bytes
_=>(')\)_')

Try it online!

My approach: alert(")"a") - sadly 2 Bytes longer with 13 Bytes

9 bytes using a similar trick you used in your PHP solution.

Kotlin, 39 25 bytes
fun main(){print("}rf")
}

Try it online!
Edit: -14 bytes thanks to @daniero

main doesn't need parameters, you can drop 15 bytes

@daniero Cool, didn't realize that - thanks! (Only dropped 14 bytes and added an extra new line because if otherwise id have to print 4 characters) Also kinda cool that just by chance it still had the same output

PowerShell, 8 7 bytes

' D'

Try it online!
Notice the two spaces after the last quote. Forgot that using implicit output puts a newline afterwards. Fixing that saved a byte though.
Alternative 7 byte solution with 3 unique chars by mazzy

"`"`""

Try it online!

Actually, 1231 doesn't work since PowerShell outputs a trailing newline by default. 1231 only works in languages with implicit output without trailing newline.

@KevinCruijssen Yeah, didn't even think about that even though my current answer takes it into account. Purge inbound.

it seems to me that the output should be '''LF for this source code

@mazzy One day I'll post an answer that's up to spec.

nice. 7 bytes, 3 unique chars :)

APL (Dyalog Unicode), 9 bytes
⎕←'''''⎕'

Try it online!
Both the last and middle characters are ', while the first is ⎕.

Stax, 5 bytes

.PPP

Run and debug it at staxlang.xyz!
The leading linefeed does nothing. .PP pushes the string PP, and the final P prints it with a trailing newline. The last character is P, the middle character is the first P, and the first character is a linefeed.
The implicit print's trailing linefeed invalidates the 4-byte solutions 1231 and .S.S (adapted from Weijun Zhou's quine).

Python 3 12 13 bytes
input(r')ri')

Forth (gforth), 13 bytes
: f ." ; :" ;

Try it online!
Code Explanation
: f         \ start a new word definition
  ." ; :" ; \ print "; :"
;           \ end the word definition

You should add a footer, so people can actually see the output: https://tio.run/##S8svKsnQTU8DUf//WymkKegpKVgrWAGJ/2n/AQ

Fixed, Thanks for the heads up, I totally forgot to call the function

Gaia, 5 bytes

⌋ ”⌋

Try it online!
The ⌋ is just there as a no-op.
            % helper function
⌋ ”⌋         % main function: push "⌋ " and convert to lowercase
            % then implicitly print with trailing newline

Charcoal, 7 bytes
←´←´´´X

Try it online! The final X could be any byte in the Charcoal code page except 0xFF and the two already in use. Works by printing the desired characters leftwards. Alternative approach, also 7 bytes:
←”y←←”y

Try it online! The final y could be any ASCII character but I picked y because of the symmetry. Works by printing two ←s leftwards so that the final character gets printed at the start of the output.

PowerShell, 7 bytes
Another trivial solution. The first and the last lines contains LF.

"`nn"

Try it online!

PowerShell, 9 bytes
non-trivial, no byte sequence hacks. The first line contains LF only. The second line starts with a space.

 echo hh

Try it online!

Code must consist of >= 3 unique characters. But: https://codegolf.stackexchange.com/a/188041/25180

thanks. i removed trivial solution with 3 non-unique bytes

dc, 9 characters
[PP]P91aP

Sample run:
bash-5.0$ dc -e '[PP]P91aP'
PP[

Try it online!

Japt, 5 bytes
Inspired by my JavaScript solution.
N'a*N

Try it

Ah-ha! I knew there had to be a 5 byter! Nice work.

Wolfram Language (Mathematica), 9 bytes

Print@nn

Try it online!

PHP, 11 bytes
<?=';\\<';;

Try it online!

Keg, 7 5 bytes
1\':'

This prints ''1, which are the respective characters.
No Try It Online available for Keg.
Here is an uninteresting 4-byte answer:
1231

Good to see Keg standing up to 05AB1E in code golf!

would abca also work as an uninteresting answer?

Yes. I am trying to keep this simple, so I will not add this to the answer.

C++ (clang) (lambda expression), 17 bytes
[]{return "}n[";}

Try it online!

C++ (clang) (full program), 47 43 bytes

#import<ios>
int main() {std::puts("}n");}

Try it online!

Unfortunately had to leave an extra space in both of the solutions, to make them have an odd number of characters.

Zsh, 9 bytes

<<<\<\<

Try it online!
Hexdump, with first/middle/last bytes highlighted:
00000000: 0a0a 3c3c 3c5c 3c5c 3c                   ..<<<\<\<
          F^        M^        L^                   ^   ^   ^

Output is <<[newline].

Bitwise Cyclic Tag But Way Worse, 26 bytes
ÿ1111111122ÿ2000000002ÿ

Outputs ÿ ÿ ÿ. 26 bytes since ÿ is considered 2 bytes in UTF-8.
Try it Online!

Cubix, 9 bytes

oN/
@oo

Try it online!
Reasonably boring one.  Since the newlines in the first, middle and last positions are ignored by the interpreter the code wraps onto the following cube.  Spaces could be used as well. eg oS/ @oo
  o
N / @ o
  o

Watch it run

N Pushs 10 (newline) onto the stack.
/ redirects around the cube.
ooo outputs the newline 3 times.
/@ redirects again and halts the program

Haskell, 19 bytes

main=($LT)print--L

Try it online! Outputs LT<newline>.

C#, 71 bytes
public class P{public static void Main(){System.Console.Write("pa}");}}

Try Online
I don't think I need to explain anything here

The program should output the last, middle, and first characters, in that order.

Lost, 21 bytes
v<<<<<>>>>>
>%?"v>@"@

Outputs: v>@.
Try it online or verify that it's deterministic.
Explanation:
Explanation of the language in general:
Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.
A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.
In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.
Explanation of the program:
All arrows, including the >v in the string, will lead the path towards the leading > on the second line. From there the program flow is as follows:

>: travel in an east/right direction
%: Put the safety 'off'. In a Lost program, an @ will terminate the program, but only when the safety is 'off'. When the program starts, the safety is always 'on' by default, otherwise a program flow starting at the exit character @ would immediately terminate without doing anything. The % will turn this safety 'off', so when we now encounter an @ the program will terminate (if the safety is still 'on', the @ will be a no-op instead).
?: Clean the top value on the stack. In some program flows it's highly likely we have a partial string on the stack, so we use this to wipe the stack clean of that potential string.
": Start a string, which means it will push the integer code-points of the characters used (rather similar as the Whitespace program).
v>@: Push the code-points for these characters, being 118 62 64 respectively
": We're done pushing code-points of this string
@: Terminate the program if the safety is 'off' (which it is at this point). After which all the values on the stack will be output implicitly. Using the -A program argument flag these code-points will be output as characters instead.

Two things to note:
The top part could also have been v<<<<<<<< instead. Lost will wrap around to the other side when moving in a direction. So using v<<<<>>>> could be a slightly shorter path, and since it's the same byte-count anyway, why not use it. :)
Also, the first line contains an additional < and >. One of them is to avoid having the newline character as the middle of the program, which is rather difficult to output and would have only increased the byte-count. The second is to make the program length odd again, so we'd only have to output a single middle character instead of two.

6502, 17/21 bytes
6502: 17 bytes if running in zero page
For initial testing I used Py65, a 6502-based microcomputer simulator written in Python. Starting Py65 with the command-line parameter -o ff moves the character output port to zero page address $FF, shaving three bytes from the code.
The program must be loaded and run at $0000, to guarantee outputing the correct three characters (in order) from the program with values 00 B5 A5.
Here are the program bytes and their respective disassembly view in Py65:
.mem 0000:0010
0000:  a5  10  85  ff  a9  11  4a  aa  b5  00  85  ff  a5  00  85  ff  00

.d 0000:0010
$0000  a5 10     LDA $10
$0002  85 ff     STA $ff
$0004  a9 11     LDA #$11
$0006  4a        LSR A
$0007  aa        TAX
$0008  b5 00     LDA $00,X
$000a  85 ff     STA $ff
$000c  a5 00     LDA $00
$000e  85 ff     STA $ff
$0010  00        BRK

6502: 21 bytes if running outside zero page
Four additional bytes are required to allow the program to run outside of zero page. Three of the those bytes are the change in the LDA (load accumulator) instructions from zero page to absolute addressing. The fourth is the addition of a NOP (no operation) instruction, to maintain an odd number of bytes in the program.
This version of the program must be loaded and run at $0300, to guarantee outputing the correct three characters (in order) from the program with values 00 00 AD.
Here are the program bytes (character values) and their respective disassembly view:
.mem 0300:0314
0300:  ad  14  03  85  ff  a9  15  4a  aa  bd  00  03  85  ff  ad  00  03  85
0312:  ff  ea  00

.d 0300:0314
$0300  ad 14 03  LDA $0314
$0303  85 ff     STA $ff
$0305  a9 15     LDA #$15
$0307  4a        LSR A
$0308  aa        TAX
$0309  bd 00 03  LDA $0300,X
$030c  85 ff     STA $ff
$030e  ad 00 03  LDA $0300
$0311  85 ff     STA $ff
$0313  ea        NOP
$0314  00        BRK

6502: 21 bytes if running on an Apple II
We've come this far, so let's plop this baby on an Apple II. I don't normally tote around my Apple //c anymore, so I used a2ix on my Android phone.
Instead of sending characters to an addressed port, they will go to COUT (character output), a routine in system ROM.
$0300 is the usual spot for small assembly routines, so that's where I'll enter and list it. Running it yields a flashing space (60), inverse N (0E), and a normal " (A2). On the Apple II, ASCII characters are remapped across the 256-character range to achieve different character effects in text mode.
*300: A2 14 20 0E 03 A9 15 4A AA 20 0E 03 A2 00 BD 00 03 20 ED FD 60

*300L

0300-   A2 14       LDX   #$14
0302-   20 0E 03    JSR   $030E
0305-   A9 15       LDA   #$15
0307-   4A          LSR
0308-   AA          TAX
0309-   20 0E 03    JSR   $030E
030C-   A2 00       LDX   #$00
030E-   BD 00 03    LDA   $0300,X
0311-   20 ED FD    JSR   $FDED
0314-   60          RTS

Relocating this to a free area of zero page (good luck!) would not yield any byte savings. While the absolute indexed LDA (load accumulator) at $030E could be switched to its zero page indexed counterpart to save one byte, an NOP (no operation) would have to be added to avoid additional code to support print two middle characters.

05AB1E, 5 bytes
×'×3×

Try it online!
×   push a string of nothing, repeated nothing times (in other words, push an empty string)
'×  push "×"
3×  push "×", repeated 3 times
    implicitly print top of stack

AWK, 17 bytes
BEGIN{print"}iB"}

Try it online!

naz, 28 24 bytes
0a9a3a9m3a2o0a0a0a0a0m2o

Explanation
0a9a3a9m3a2o # Output "o" twice
0a0a0a0a     # Padding bytes
0m2o         # Output "0" twice

Original 28-byte solution: 0a9a3a9m3a1o0a0a0a9s5s1o0m2o

Brainetry, 181 bytes
This program starts and ends with an upper case L and also has it in the middle of its source code. This golfed version is based off of the program that comes after it.
To try this online, follow this repl.it link, paste my source code in the btry/replit.btry file and hit the green "Run" button.
L b
a b c d
a b c d e f g h
a b c d
a b c
a b c d e f g h
a b c d e
a b c
a b c d e f g h L
a b
a b
a b c d
a b c d
a b c d e f g h i
a b c
a b c d e f g
a b c d e f g
a b c d e f L

The verbose version also starts and ends with an uppercase L and has one of those in the exact middle of its source code.
Lo and
behold: this program has
a self referential property! This code prints its
first, middle and last
chars! How nice!
Of course I cheated a little and made
this program in such a
way that all
3 of those chars are the upper case L,
which I
also had
to properly place in
the middle of this
text to make sure they appeared in those positions.
A bit of
luck and a bit of mathematics allowed
me to accomplish this feat. Let me
check it... Woops, missed by one... LOL

Turing Machine Code, 29 bytes
0 * 2 r 1
1 * 1 r 2
2 * 0 * 2

Try it online!
Prints '210'.

Jelly, 4 bytes
5235

Try it online!
pretty simple, no explination needed

ah i see... i need to learn to read that English stuff

@AaronMiller general question what should i do if a question is not valid? do i delete or leave it?

Malbolge, 67 bytes
Outputs n D. Eventually I thought a space is really necessary.
D'`_$"\\[||98V6Bu@tOq<.'98*ZjE&fe {Ab~,v*)]xZvonsl2ponmfN+cba`ed]#n

Try it online!

GNU dc, 5 bytes
0p
n0

Try it online!
Pushes 0 to the stack, prints 0 with a new line, prints 0 without a new line and again pushes 0 to the stack.
n is a GNU implementation. Might not work with other versions.

Lexurgy, 15 bytes
This was surprisingly difficult. Outputs a>=a.
abc:
*=>a\>\=a

Pyramid Scheme, 115 bytes
   ^     ^
  / \   / \
 /out\ /out\
^-----^-----
-^   ^-
 -^ ^-
  -^-
  / \
 /chr\
^-----
-^
 -^
 / \
/32 \
-----

Try it online!
The middle character is the space after the ^ on the fifth line. Prints three spaces.

Zsh, 9 bytes
print ptp
Attempt This Online!

Pip, 7 bytes

R"R "

Attempt This Online! (Note the trailing space)
Explanation
\nR"R "   ; Full program
\n        ; No-op
   "R "   ; The string "R "
  R       ; Reversed
          ; No-op
          ; Implicit output
          ; (with newline)

Elm 0.19, 11 bytes
f()="\"\\f"

Prints "\f. See it working here.

Runic Enchantments, 9 7 bytes
'@'':r@

Try it online!
-2 bytes by just using char literals. Outputs @''

SNOBOL4 (CSNOBOL4), 19 bytes

	OUTPUT = 'D='
END

Try it online!
Prints D=<newline>, using SNOBOL's trailing newline in OUTPUT.
D=

Lenguage, 292 2340 bytes
Thanks to Jimmy23013 for pointing out I need another 2048 bytes
2340 bytes of any character with the first, middle two and last characters being a null byte.
Prints 4 null characters.
Try it online in brainfuck

@jimmy23013 ok should be fixed now

Haskell, 17 bytes
main=putStr"\"Sm"

Try it online!

Identical with Damien's Haskell solution posted almost 2 hour 50 minutes earlier.

Lua, 31 13 bytes
print (')(p')

Prints )(p
Try it online!

Retina 0.8.2, 7 bytes

01$*$$

Try it online! Retina 0.8.2 outputs a trailing newline by default, so the code starts with that. Conveniently, this also matches the default empty input, allowing the replace stage to get to work. It then suffices to come up with a string of even length > 2 that outputs the other 2 characters.

Retina, 7 bytes
((K`(`(

Try it online! Retina 1 does not output a trailing newline by default, but fortunately it has the K command which allows us to specify a constant string output. The grouping construct ( is used to increase the number of distinct characters to meet the minimum requirement.

Dodos, 22 bytes

	dot
	dot
0         0

Try it online!

Japt, 7 bytes
''ixi''

Try it
''ixi''
''          :Literal "'"
  i         :Prepend
   x        :  Literal "x" (any lowercase letter would work. Except i, of course)
    i       :  Prepend
     ''     :    Literal "'"

Alternatives
"\"ww"w

Try it

Riii'R
Try it
"Q\""+Q

Try it

Brachylog, 7 bytes
"w\\""w

Try it online!
Thanks to Shaggy for correcting this to comply with the challenge specification.
Boring string literal, except thanks to the weird way Brachylog string literals work, the escaped backslash also still escapes the quote afterwards, so it's not actually that boring.

Ah, you're right, I didn't read the spec closely enough. Thanks!

Coincidentally, I'd just added your original version as an alternative to my Japt solution - scrolled down and thought I'd found a polyglot!

Gema, 13 characters
\A=l\\\\@fail

Try it online!

Perl 5, 11 bytes
say "\"\\s"

Try it online!

This violates the rule "Output must not contain any trailing whitespace. However, if whitespace is a first, middle, or last character, it must be printed as such."

@Abigail That still breaks the same rule about trailing whitespace.

HTML, 4 bytes

^db^

^<X>_<X>^

I'm not sure if this is cheating... Really.
First one also worked as PHP or Text.

It's my bad that not creating a page for txeT before this challenge...

MarioLANG, 53 bytes
+>(-[!)
+"===#+
++
++
++
++
++
 +
)!)  <...
=#==="==+

Try it online!
Output: +++. The 27th character is one of the + characters in the second column of the code.

cQuents, 8 bytes
1#11,2&1

Try it online!
Outputs 11,1.
Explanation
1             Prepend 1 to the output
 #11,2        Default input is `11, 2`
      &       Output as many terms as the last input, comma seperated
       1      Each term equals 1

So first 1 is prepended, then the input becomes 11,2. Then, we output 2 terms comma separated, which is 1,1, so the final output is 11,1.

Bash, 9 11 9 bytes
First attempt:
echo e\ o

Output
e o

Second attempt:
echo -n e-e

Output:
e-e

Third attempt

echo  oo

Note the leading newline and the double space
Output:
oo

Welcome to codegolf.se. It should print in the order of the last, middle and first character, o e for your current code.

Also “Output must not contain any trailing whitespace.” I'm afraid your contains, actually outputs 4 characters instead of 3.

Now is correct, but became exact copy of Grzegorz Oledzki's Bash solution posted yesterday.

BitCycle, 5 bytes

11!1

Try it online!
Outputs 11 with a trailing newline. Only the first pair of 1s is actually printed.

LOLCODE, 27 bytes
HAI 1
VISIBLE "E H"
KTHXBYE

Try it online!
Trivial answer in LOLCODE. The 14th character is the space just before the string literal.

Rust (closure), 9 bytes
|| ";;|";

Try it online!

Rust (full program), 25 bytes
fn main(){print!("}}if")}

Try it online!

Pip, 15 bytes
O"}"xxL1{O"1O"}

Needs more golfing
Try it online!
Pip, 9 bytes

O"nn"x
n

shorter version with newline
Try it online!
Pip, 8 bytes
1x000Oh1

another one
Try it online!

Ohm v2, 5 bytes
…Lo…L

Try it online!

Perl 5, 11 bytes

 say '; ';

Try it online!
Note the initial newline and the trailing space. Outputs
;

SmileBASIC, 7 bytes
?":b?":

Output: :b?
(Probably works in most BASIC dialects)
The middle character can be anything except ",  LF, and CR.

F#, 13 bytes (characters)
So many esoteric languages that seem to be made specifically for code golfing… let's try a terse but 'normal' language like F#, where the following line (without a trailing newline) has 13 characters (13 bytes if the source file is saved as ANSI text):
printf"\"\"p"

Output:
""p

Boolfuck, 29 21 bytes
;;;;;;;;;;;;;;;;;+

Outputs 3 null characters
Thanks to Jo King for the improved solution!
Try it online!
BitChanger, 23 bytes
<<<<<<<<<<}<<<}<}<}<

Very similar to the Boolfuck one: uses the fact the null characters require no bit changing to output with tape-based bit output
How it works:
           Used as it is simple to output
<<<<<<<<<< Moves over to one left of the I/O bit
}           Sets the I/O bit to one, for output
<<<         Moves over to the bit that performs I/O
}<}<}       Sets it to one 3 times, to output 3 null characters
<          I used < to waste one byte so it could be an odd number of bytes

Try it Online!

Sure it matched the requirement “Code must consist of >= 3 unique characters.”?

Oh yeah, fixed it

Oh, didn’t realise that. Does it auto fill the last byte of output to 8 bits?

Pyth, 5 bytes

10 1

Prints 10 followed by a newline. Try it online!
Newlines normally print the next result followed by a newline, but at the start of a program it is essentially a no-op. 10 is the literal value, which is printed followed by a newline. The space before the 1 suppresses the usual implicit printing, so the final 1 is ignored.

Octave, 15 bytes
fprintf(')(f' )

Try it online!
As far as I know, using fprintf is the only method of out that doesn't come with extraneous output.

Python 2, 12 bytes 11 bytes
Placeholder to make the leading newline visible

print"\"t"

This is 12 bytes and hence is even, so you must print the 6th and 7th character of your code, which is ' ' and '"' so you should print " "p not " p like you currently do.
Also please consider adding a link to e.g. Try It Online.

It also prints an extra newline, which is not allowed.

This 11 byte solution may be valid. Do you agree? @jimmy23013

@ExpiredData Yes it works.

ink, 5 bytes

/a//

Prints /a and a newline
Try it online!

DOS COM x86 binary
% xxd test.com
00000000: 31c9 4b88 2f80 ffef 75f8 8007 30b4 028a  1.K./...u...0...
00000010: 17cd 2180 3f00 7503 e905 00fe 0fe9 f3ff  ..!.?.u.........
00000020: b402 8a17 cd21 8007 20b4 028a 17cd 2190  .....!.. .....!.
00000030: cd20 4b53 20                             . KS

x86-64 (Mac OS), 35 bytes
b8 04 00 00 02 bf 01 00 00 00 48 be 20 00 00 00
00 00 00 00 ba 03 00 00 00 0f 05 48 31 c0 c3 00
b8 00 b8

can be disassembled to:
[bits 64]

section .text
  global _main

_main:
  mov rax, 0x2000004
  mov rdi, 1
  mov rsi, x
  mov rdx, 3
  syscall
  xor rax, rax
  ret

section .data
  x: db 184, 0, 184

and compiled with:
$ nasm -fmacho64 FILE.asm
$ ld -fSystem FILE.asm

then run
$ ./a.out
<0xb8><0x00><0xb8>

Python 3, 13 bytes
print(')\'p')

Try it online!

Python 3, 13 bytes
This should suffice. Although it has a new line at the end of the output. There is a space in between print and '(' to make the total count of characters odd.

print (')(p')

Try it online!

W, 5 bytes

'+:+

Explanation
     % Newline (no-op)
'+   % The addition operator
  :+ % Multiply the character twice
     % Print with a newline
```

7, 11 characters
57125574032

Try it online!
Prints 255.
Explanation:
The program pushes 5|7255|4632 onto the frame (which starts with ||). Then, the last section of the frame (4632) is executed.
4 swaps the last two sections, and adds another bar between them. The frame is now ||5|4632||7255.
6 pacifies the last section of the frame by converting the active commands 7255 (shown in bold) to their passive equivalents 1255, and removing the bar before it. The frame now looks like ||5|4632|1255.
3 outputs the last section of the frame (1255) and discards the last two sections. The initial 1 means "print the rest unchanged", so 255 is printed. Then, the last two sections are discarded, leaving ||5 on the frame.
2 duplicates the last section of the frame, leaving ||5|5. There are no more characters left on the command list, so the last section of the frame (5) is executed.
5 moves the last section of the frame (which is another 5) to the start of the command list to be executed immediately, and then discards it. This leaves ||5 on the frame.
This happens again, leaving 5 on the command list and | on the frame.
The last 5 moves the last section of the frame (i.e. nothing) to the command list, leaving an empty command list and an empty frame. This causes the program to exit successfully.
Notes:

The 57 at the beginning and the 2 at the end are included because without them, one of the first, middle, or last characters would have been a 7, and printing 7 is hard.

The program can fit into 4 bytes, but the question asks to minimize characters.

Width, 7 bytes
GAPSfeW

Try it online!
Outputs through STDERR.
I used a G to start the string. The ID of G is 39, which turns into eW. The ID of W is 55, which turns into AP. Then I just used Ai which is 50, and checked how close it was to A, saw it became R, then used Sf, which is 51, and becomes S.

Grok, 11 bytes
iq i`  wwwq        # Prints "q i"

Scratch, 23 bytes
when gf clicked
say[wcw

Racket, 15 bytes
(display "(y)")

Try it online!

BRASCA, 5 bytes
9C9$9

Try it!
Explanation
9            - Push 9
 C           - Set implicit output to number mode
  9          - Push 9
   $         - Swap the two nines
    9        - Push 9
<implicit>   - Output stack

Python 3, 13 bytes
print(")\"p")
Try It Online!
Having " as the middle char is lucky, because then I can balance the parity of the code because it requires an escape sequence.
There's a few more Python 3 13-byters, so I imagine this is the shortest possible solution.
I don't there's a shorter solution with exit(), which prints to STDERR.

Vyxal D, 5 bytes

 ‛‛‛

Try it Online!
Note the trailing space and newline.
Simply pushes ‛‛, and prints with trailing newline.

Python 3, 13 bytes
print( ') p')

The last character is ')', the middle is number 7, a space and the first is the letter 'p'.

Julia 1.0, 13 bytes
most python answers work with julia too, but here are a couple very julian 13-byters
"s" |>show;""
"t|\""|>print

Try it online!

Vyxal, 7 bytes
No flags used.
9 99J₴9

Explanation
9        - Push 9
  99     - Push 99
    J₴   - Concatenate and print
      9  - Pushes another 9, but it never gets used.

Try it Online!

Pari/GP, 13 bytes
print1(")("p)

Try it online!

Microscript II, 10 bytes
Welcome to Backslash Hell
"\"\\\\\""
I suspect that a shorter version is possible.

Would " a " with surrounding spaces be valid?

Flobnar, 7 bytes
0..0#@0

Try it online!
The character that is easiest to print is the digit 0. 5 bytes is impossible because it mandates three zero digits and a @ at one of the two positions (2nd or 4th), which makes the program print 0 only once. For 7 bytes, we skip a 0 with # and print zero twice using . (explicit decimal output); the third copy of 0 is produced as the value that @ evalautes to.

Thunno, \$7\log_{256}(96)\approx\$ 5.76 bytes

Z" rr

Attempt This Online!
Port of Kevin Cruijssen's 05AB1E answer.
Explanation
\n\nZ" rr
\n\n       # no-ops
    Z" r   # 2-char string: " r"
        r  # reverse to get "r "
           # implicit output with newline

Go, 25 bytes
func()string{return"}nf"}

Attempt This Online!
Function which returns a string.
Go, 35 bytes
import."fmt"
func f(){Print("} i")}

Attempt This Online!
Function which prints to STDOUT.
Go, 51 bytes
package main
import."fmt"
func main(){Print(`}
p`)}

Attempt This Online!
Full program which prints to STDOUT.

Python REPL, 5 bytes
122-1
yields 121.
This probably works with many other interactive environments as well, but this is the shortest I could think of.

Desmoslang, 9 Bytes
1OOO1ETG1

Outputs 111

Swift 5.9, 13 bytes

print (") ")

This is basically a Swift version of this Python answer by @TFeld. Prints the last character ")", the middle character " " (a space), and the first character "\n" (a newline, printed thanks to print(_:separator:terminator:)'s default terminator of "\n").

Pxem, Filename: 9 bytes + Content: 0 bytes = 9 bytes.

Filename: O.ooo.o.O
Content: empty

abcn, 15 bytes
a120gxgxnba98gx

Explanation :
a120                  --> sets stack at 120
gx                    --> convert to ASCII and print (120 ==> x) as you can see x is last char
gx                    --> convert stack 120 again to ASCII and print `x` mid char (7th) is x
                      --> as well (a120gxg make 7 and nba98gx make 7 so we print x)
b                     --> stack set to -1 (useless just made so we print x twice and
                      --> not have to add more bytes)
a98                   --> add to stack 98 (giving us 97)
gx                    --> convert to ASCII and print (97 == a) a is first char

prints xxa which is the right answer

Java (JDK), 9 bytes
$->"  $"

Try it online!

I'm not so sure that this a valid self-contained answer given that ; is not part of the lambda (I can't write doSomething(v->";;v";), for instance).

@OlivierGrégoire This is easily fixed by replacing all three ; with a space, though. (Also, your TIO is incorrect. The Consumer<Object> should be a Function<Object, String>.)

@KevinCruijssen Possibly, but as is, it's not valid.

Thanks, replacing all with spaces seems like the best solution. Thanks!!

CLC-INTERCAL, 67 bytes.
Outputs 1#D. It was difficult to adjest program length. Eventually I decided to do \#9; this caused no side effects.
DO;1<-#9\#9DO;1SUB#1<-#100DO;1SUB#2<-#374DO;1SUB#3<-#276DOREADOUT;1

Copy and paste to try it online!

FerNANDo, 53 bytes
Outputs aaa, but is it accepted...?
a a a
z a a z z z z a
z a a z z z z a
z a a z z z z a

Try it online!

Ly, 9 bytes
'o:oo"'"o

Try it online!
I had some more interesting versions (IMO anyway), but they were longer. :)
 'o         - push "o" on the stack
   :        - duplicate top of stack
    oo      - print both "o" chars
      "'"   - load a doublequote on the stack
         o  - print it

Prints output oo"

DipDup, 7 bytes
a[aaa]a

Try it online!

Python 3, 15 15 bytes
print("  p")

Try it online!
Previous answer(Incorrect)
print("pp ")

The answer is no longer pp （◞‸◟）

The question asks for last middle first, not first middle last.

@AndersKaseorg Thanks for pointing out, I have made the necessary changes

Pascal, 41 characters
NB:
Despite appearing that way the source code has no trailing newline:
program p(output);begin write('.gp')end .

Thunno 2, 5 bytes

` rr

Attempt This Online!
Port of Kevin Cruijssen's 05AB1E answer. Prints r \n.
Alternative 5 bytes:

12£1

Attempt This Online!
Port of Kevin Cruijssen's alternative 05AB1E answer. Prints 12\n.

COBOL, 67 B
The OpenCOBOL implementation does not seem to process non-lines (i. e. a character sequence that is not concluded by a newline character).
Therefore the COBOL source code contains a newline character.
However, I did not achieve printing a leading newline character (there was a space I could not get rid of).
So I extended the source code with some syntactically acceptable junk.
The 01 is not followed by a newline character.
000000 PROGRAM-ID.P.PROCEDURE DIVISION.DISPLAY"1I0"NO ADVANCING.
01

Output:
1I0