text:
What does this button do?
Currently at my work we moved to a new building. It's supposed to be state of the art and has automatic lights, automatic roll-down shutters, and is now known as the most eco-friendly building in this town.
However, it doesn't really work all that well.. The roll-down shutters sometimes go down on cloudy days and up when the sun starts to shine, and the lights sometimes cause disco effects by alternating turning on and off every 5-10 minutes. Also, we don't have any manual way of controlling these roll-down shutters, nor the temperature, BUT we do have a remote for the lights.
These remotes however came without instruction manual and contain little over 20 buttons doing all kind of stuff except for what you seem to want..
PS: I wrote this challenge 1.5 months ago in the Sandbox. Currently we, kinda, know how the remotes work..
One big advantage about this building, it's 30+ degrees Celcius outside, but inside it stays the same 21 room temperature at all time.
So, that was the intro, and the remote control for the lights inspired this challenge.
Challenge:
Let's say we initially have a lamp turned off:
L

Then we push all kind of buttons and output the state of the lamp afterwards.
We use the following numbers for the different functions of the remote control for the lamp. When a minus symbol is in front of that number, we do the opposite.

1 = ON; -1 = OFF.
2 = Increase strength by 25%; -2 = Decrease (dim) strength by 25%.
3 = Increase spread by 50%; -3 = Decrease spread by 50%.
4 = Toggling the type of light.

So, this is all pretty vague, so let's go a little more in depth what each thing means:
So, -1 (OFF) is pretty obvious, and 1 will go to the initial ON-state (50% for 2 and 50% for 3):
   //
  //
L ====
  \\
   \\

2 and -2 is how far the light travels (== is appended for every 25%):
0% (equal to a light bulb that is OFF)
L

25%
L ==

50%
L ====

75%
L ======

100%
L ========

3 and -3 is how far the light spreads:
0%:
L ====

50%:
   //
  //
L ====
  \\
   \\

100%:
|| //
||//
L ====
||\\
|| \\

(NOTE: When 2 and 3 are both at 100%, you'll have this state:
||   //
||  //
|| //
||//
L ========
||\\
|| \\
||  \\
||   \\

4 is to toggle the type of light.
Default:
  //
L ==
  \\

After toggling (note the single space before '/' instead of two):
 /
L --
 \

Input:
You will receive an input containing the possible button-presses. For example:
12-34

Output:
The state of the light lamp after all the buttons of the input are sub-sequential pressed. So with the example input above, we have the following output:
L ------

Challenge rules:

The input only contains 1234- (and never a - before the 4).
You can never go below 0% or above 100%. If a number would increase/decrease beyond these boundaries you can ignore it.
When the lamp is turned off, you can ignore any actions and when turned back on again it resets back to the initial ON-state (50% for both 2 and 3, and default 4). For example: 12-1-341 will just print the initial ON-state mentioned above. (TIP: You can ignore everything before the final 1 of the input - excluding -1.)
Trailing spaces equal to the length of the light or a single trailing new line is uninhibited. Adding extra unnecessary new lines isn't however.
You are allowed to take the input as a list of integers instead of a single string. So instead of 12-34, you can have [1,2,-3,4] as input.

General rules:

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

Test cases:
12-34
L ------

12-1-341
   //
  //
L ====
  \\
   \\

14-3224333-2
||  //
|| //
||//
L ======
||\\
|| \\
||  \\

142-1-314-3-322
L --------

1324-2-3
  /
 /
L ----
 \
  \

134
| /
|/
L ----
|\
| \

1-2-2-214-3-3-3
L ----

What's the output for 134?

@Pietu1998 I've added the test case (and fixed some things regarding spaces after toggle 4). Thanks for asking.

I don't think the spread for the third test case is correct.

@Pietu1998 Again correctly observed. I've changed it.

I take it intensity and spread can't go below zero; so after a long string of -2 and then a single (+)2, the intensity is now 25%?

If the lamp is turned on and 1 is pressed, are the parameters reset?

@JDL Yes, that's indeed true. 2 and 3 can't go below 0% nor above 100%.

@Pietu1998 Hmm.. For the sake of the challenge, let's say it indeed resets back default. I will add a test case for this.

Your office is 21º in this weather? I feel like downvoting you out of envy.

@Neil Hehe. Yeah, we got 4-layer windows, floor cooling/warming depending on temperature, and solar-panels for barely any electrical bills. Doesn't matter if it's -20 or 35 degrees Celcius, the indoor temperature stays the same. Only disadvantage: We can't control this temperature and it's a tiny bit too cold imho for sitting still as software developer. I'm actually wearing t-shirts with sleeves even though it's 32 degrees Celcius outside atm (which I roll up when I get outside, and then I still sweat..) And as I mentioned, the lights and window shutters aren't properly configured..

Python 2, 221 bytes
for b in[-1]+input():exec["p=b>0;d=2;s=1;t=2","d+=b/2*(-2<d+b<6)","s+=b/3*(-3<s+b<5)","t=3-t"][abs(b)-1]
i=c=(s>0)*d*p
q='print" |"[s/2]*t+" "*i+t*%r;'
exec('i-=1;'+q%'/')*c
print"L "+" -="[t]*2*d*p
exec(q%'\\'+'i+=1;')*c

This wound up being longer than I expected. The first line calculates the state of the lamp, the rest implement the printing.
Input is given via STDIN in the array form.
See the test cases on ideone

R, 323 320 bytes
    z=scan();a=c=1;b=d=2;for(i in 1:sum(1|z)){s=sign(y<-z[i]);switch(y/s,b<-d<-2*(c<-a<-y),b<-b+s,c<-c+s,d<-2-d);b=min(b,4);c=min(c,2);b=b*(b>0);c=c*(c>0)}
    s="/";v=if(c>1)"|"else" ";for(i in a*b:-b){if(i)cat(v,if(d)v,rep(" ",abs(i)-1),s,if(d)s,"\n",sep="")else{cat("L ",if(d)rep("==",b)else rep("--",b),"\n",sep="");s="\\"}}

Ungolfed:
z=scan()

reads a line of input (integers separated with spaces)
a=c=1;b=d=2

initialises variables a (on-ness), b (brightness), c (width), d (beam type). d is either zero or two, which means we can call if(d) later rather than a longer if(d>1) or similar and save a couple of bytes.
while(any(z|1))

A golf-y way of writing while(length(z)) where z is an integer vector.
The rest of the first line handles the input via a switch statement.
The second line prints out.
It is possible that some of the <- can be replaced with =, but I think you get eaten alive by lexical scoping...
Also note that in R, backslashes need to be escaped.
c*(c>0) is a golf-y way of writing max(c,0) that saves a character.
If the light isn't on, then since * has lower precedence than :, the for(i in a*b:-b) loop only iterates over 0:0 .
Update; saved 3 bytes by replacing the loop in the first line with a for (rather than while). Note that 1:sum(1|z) is fewer characters than 1:length(z) or seq_along(z). seq(z) would work in most cases, but not when z is of length one. The solution given will not work for input of length zero but I hope that is outside the scope of the competition.

Java 8, 484 483 452 446 440 bytes
z->{int a=1,b=2,c=1,d=0,j,k;for(int i:z){d=i==1?0:i>3?1-d:d;a=i*i==1?i:a;b+=i==1?2-b:i==2&b<4?1:i==-2&b>0?-1:0;c+=i==1?1-c:i==3&c<2?1:i==-3&c>0?-1:0;}String t=d<1?"=":"-",q=d<1?"//":"/",x=d<1?"\\\\":"\\",n="\n",y=" ",w=d<1?y+y:y,g=c>1?d<1?"||":"|":w,r="";if(c>0)for(r+=g,j=b;j-->0;r+=q+n+(j>0?c>1?g:w:""))for(k=j;k-->0;r+=y);for(r+="L ",j=b;j-->0;r+=t+t);r+=n;if(c>0)for(r+=g;++j<b;r+=x+n+(j<b-1?g:""))for(k=j;k-->0;r+=y);return a>0?r:"L";}

Finally.. Ok, my own challenge is a bit harder than I expected.. ;P
This can without a doubt be golfed by using a completely different approach.. I now first determine what to do, and then print it. The printing is actually the hardest of this challenge, imho.
-6 bytes thanks to @ceilingcat.
Explanation:
Try it here.
z->{                          // Method with integer-array parameter and String return-type
  int a=1,                    //  ON/OFF flag, initially ON
      b=2,                    //  Strength, initially 50%
      c=1,                    //  Spread, initially 50%
      d=0,                    //  Type of light, initially two lines
      j,k;                    //  Index-integers
  for(int i:z){               //  Loop over the input-array
    d=i==1?0:i>3?1-d:d;       //   Determine the new type of light
    a=i*i==1?i:a;             //   Determine if the light is ON/OFF
    b+=i==1?2-b:i==2&b<4?1:i==-2&b>0?-1:0;
                              //   Determine the new strength
    c+=i==1?1-c:i==3&c<2?1:i==-3&c>0?-1:0;}
                              //   Determine the new spread
  String t=d<1?"=":"-",       //  Horizontal light symbol
         q=d<1?"//":"/",      //  Upper diagonal light symbol
         x=d<1?"\\\\":"\\",   //  Bottom diagonal light symbol
         n="\n",              //  New-line
         y=" ",               //  Space
         w=d<1?y+y:y,         //  One or two spaces?
         g=c>1?d<1?"||":"|":w,//  Space(s) or vertical light symbol(s)?
         r="";                //  Result String, starting empty
  if(c>0)                     //  Do we have spread >0%?
    for(r+=g,j=b;j-->0;r+=q+n+(j>0?c>1?g:w:""))for(k=j;k-->0;r+=y);
                              //   Create upper light part
  r+="L ";                    //  Light-bulb
  for(j=b;j-->0;r+=t+t);      //  Horizontal light next to the light-bulb
  r+=n;
  if(c>0)                     //  Do we have spread >0%?
    for(r+=g;++j<b;r+=x+n+(j<b-1?g:""))for(k=j;k-->0;r+=y);
                              //   Create bottom light part
  return a>0?                 //  Is the light turned ON?
             r                //   Return the created result-String
            :                 //  Else:
             "L";}            //   Return just "L"

Kotlin, 445 bytes
My first Kotlin golf, 38 bytes less than Java :)
fun f(z:IntArray)={var a=1<0;var b=2;var c=1;var d=a
z.map{when(it){1->{a=1>0;b=2;c=1;d=!a}-1->a=1<0;2->if(b<4)b+=1;-2->if(b>0)b-=1;3->if(c<2)c+=1;-3->if(c>0)c-=1;4->d=!d}}
var r="";val l=if(c>1)if(d)"|" else "||" else if(d)" " else "  "
if(c>0)for(i in b downTo 1)r+="${l+" ".repeat(i-1)+if(d)"/" else "//"}\n"
r+="L ${(if(d)"--" else "==").repeat(b)}\n"
if(c>0)for(i in 1..b)r+=l+" ".repeat(i-1)+"${if(d)"\\" else "\\\\"}\n"
if(a)r else "L"}()

With white-space and tests:
fun f(z: IntArray) = {
    var a = false // ON / OFF
    var b = 2 // Strength [0,4]
    var c = 1 // Spread [0,2]
    var d = a // Type

    // Find state to print
    z.map {
        when (it) {
            1 -> {
                a = true
                b = 2
                c = 1
                d = !a
            }
            -1 -> a = false
            2 -> if (b < 4) b += 1
            -2 -> if (b > 0) b -= 1
            3 -> if (c < 2) c += 1
            -3 -> if (c > 0) c -= 1
            4 -> d = !d
        }
    }

    var r = ""
    val l = if (c > 1) if (d) "|" else "||"
    else if (d) " " else "  "

    // Print state
    if (c > 0) for (i in b downTo 1) {
        r += "${l + " ".repeat(i - 1) + if (d) "/" else "//"}\n"
    }
    r += "L ${(if (d) "--" else "==").repeat(b)}\n"
    if (c > 0) for (i in 1..b) {
        r += "${l + " ".repeat(i - 1) + if (d) "\\" else "\\\\"}\n"
    }

    /* return */ if (a) r else "L"
}()

fun main(args: Array<String>) {
    println(f(intArrayOf(1, 2, -3, 4)))
    println(f(intArrayOf(1, 2, -1, -3, 4, 1)))
    println(f(intArrayOf(1, 4, -3, 2, 2, 4, 3, 3, 3, -2)))
    println(f(intArrayOf(1, 4, 2, -1, -3, 1, 4, -3, -3, 2, 2)))
    println(f(intArrayOf(1, 3, 2, 4, -2, -3)))
    println(f(intArrayOf(1, 3, 4)))
    println(f(intArrayOf(1, -2, -2, -2, 1, 4, -3, -3, -3)))
}

Interestingly, rather than define the function normally and print or return the created string, it was shorter to use function assignment (the fun f() = of an evaluated lambda. (Does that description make sense?)
I just wish SE had proper Kotlin syntax highlighting

Batch, 552 bytes
@echo off
for %%a in (1 %*) do call:l %%a
set/aw*=o,l*=o
if %w% gtr 0 for /l %%a in (%l%,-1,1)do call:w %%a /
set s=----
if %t%==1 set s=====
call echo L %%s:~-%l%%%%%s:~-%l%%%
if %w% gtr 0 for /l %%a in (1,1,%l%)do call:w %%a \
exit/b
:w
set v=
set u=%2
if %w%==2 set v=l
if %t%==1 set u=%2%2&set v=%v%%v%
set s=
call set s=%%s:~-%1%%
echo %v:l=^|%%s:~1%%u%
exit/b
:l
if %1==1 set/ao=w=t=1,l=2
if %1==-1 set/ao=0
if %1==2 set/al+=1-l/4
if %1==-2 set/al-=!!l
if %1==3 set/aw+=1-w/2
if %1==-3 set/aw-=!!w
if %1==4 set/at^=1

Note: set v= contains one trailing space and set s= contains three. This was really awkward, as you can't easily print a variable number of |s in Batch, so you have to use a placeholder and replace it in the echo statement.

05AB1E, 106 bytes
“/|=
L“•Wθ¨S9ƒTª»þúÙ•6вèJ¶¡sŽ8ÃS«1¡θΣÄ}.γÄ}ODd*©н8‚ß8αFć¨šNÈi¨]R®θ8Öi"||//="2ô…|/-S:}®Ås3/©_iθ}®i'|ð:}».∊

Input as a list of integers.
Try it online or verify all test cases.
Explanation:
“/|=
L“               # Push string "/|=\nL"
  •Wθ¨S9ƒTª»þúÙ• # Push compressed integer 9569494169631511496055972036
   6в            # Converted to Base-6 as list: [5,3,2,2,2,2,2,2,2,2,4,1,1,0,0,4,1,1,3,0,0,4,1,1,3,3,0,0,4,1,1,3,3,3,0,0]
     è           # Index each into the string
      J          # Join everything together

We now have the string:
L ========
||//
|| //
||  //
||   //

Then we'll:
¶¡               # Split it by newlines: ["L ========","||//","|| //","||  //","||   //"]
s                # Swap to take the (implicit) input-list
 Ž8Ã             # Push compressed integer 2234
    S            # Converted to a list of digits: [2,2,3,4]
     «           # Append it at the end of the input-list
                 #  i.e. [4,3,3,2,1,3,2,4,-2,-3] → [4,3,3,2,1,3,2,4,-2,-3,2,2,3,4]
 1¡              # Then split on 1
                 #  i.e. [4,3,3,2,1,3,2,4,-2,-3,2,2,3,4]
                 #   → [[4,3,3,2],[3,2,4,-2,-3,2,2,3,4]]
   θ             # Only leave the last inner list
                 #  i.e. [[4,3,3,2],[3,2,4,-2,-3,2,2,3,4]] → [3,2,4,-2,-3,2,2,3,4]
    ΣÄ}          # Sort on the absolute value
                 #  i.e. [3,2,4,-2,-3,2,2,3,4] → [2,-2,2,2,3,-3,3,4,4]
       .γÄ}      # Then group by absolute value
                 #  i.e. [2,-2,2,2,3,-3,3,4,4] → [[2,-2,2,2],[3,-3,3],[4,4]]
           O     # Then take the sum of each group
                 #  i.e. [[2,-2,2,2],[3,-3,3],[4,4]] → [4,3,8]
            Dd   # Duplicate it, and check for each if it's non-negative (>= 0)
                 #  i.e. [4,3,8] → [1,1,1]
              *  # Multiply the two lists
                 #  i.e. [4,3,8] and [1,1,1] → [4,3,8]
               © # And store the result in the register (without popping)
н                # Now take the first value (the strength)
                 #  i.e. [4,3,8] → 4
 8‚              # Pair it with 8
                 #  i.e. 4 → [4,8]
   ß             # Pop and push the minimum of the two
                 #  i.e. [4,8] → 4
    8α           # And then calculate the absolute difference with 8
                 #  i.e. 4 → 4
      F          # Loop that many times:
       ć         #  Extract the head of the string-list
                 #   i.e. ["L ========","||//","|| //","||  //","||   //"] → "L ========"
        ¨        #  Remove the last character
                 #   i.e. "L ========" → "L ======="
         š       #  And prepend it back to the list again
                 #   i.e. ["||//","|| //","||  //","||   //"] and "L ======="
                 #    → ["L =======","||//","|| //","||  //","||   //"]
       NÈi       #  And if the loop-index is even:
          ¨      #   Also remove the last item of the string-list
                 #    i.e. ["L =======","||//","|| //","||  //","||   //"]
                 #     → ["L =======","||//","|| //","||  //"]
      ]          # Close both the if and loop
                 #  i.e. ["L ========","||//","|| //","||  //","||   //"] and 4
                 #   → ["L ====","||//","|| //"]
       R         # Then reverse the list
                 #  i.e. ["L ====","||//","|| //"] → ["|| //","||//","L ===="]
®                # Push the list from the register again
 θ               # Now take the last value (the toggle)
                 #  i.e. [4,3,8] → 8
  8Öi         }  # If it's divisible by 8:
                 #  i.e. 8 → 1 (truthy)
     "||//="     # Push string "||//="
            2ô   # Split into parts of size 2: ["||","//","="]
     …|/-        # Push string "|/-"
         S       # Split into characters: ["|","/","-"]
     :           # And replace all of them in the string-list
                 #  i.e. ["|| //","||//","L ===="] → ["| /","|/","L ----"]
®                # Push the list from the register again
 Ås              # Now take the middle value (the spread)
                 #  i.e. [4,3,8] → 3
   3/            # Divide it by 3
                 #  i.e. 3 → 1
     ©           # Store it in the register (without popping)
      _i }       # If it's exactly 0:
                 #   i.e. 1 → 0 (falsey)
        θ        #  Only leave the last value of the string-list
     ®i    }     # If it's exactly 1 instead:
                 #   i.e. 1 → 1 (truthy)
       '|ð:     '#  Replace all "|" with spaces " "
                 #   i.e. ["| /","|/","L ----"] → ["  /"," /","L ----"]
»                # Then join the string-list by newlines
                 #  i.e. ["  /"," /","L ----"] → "  /\n /\nL ----"
 .∊              # And finally intersect mirror everything vertically
                 # (which automatically converts the slashes)
                 #  i.e. "  /\n /\nL ----" → "  /\n /\nL ----\n \\n  \"
                 # (And output the result implicitly)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why •Wθ¨S9ƒTª»þúÙ•6в is [5,3,2,2,2,2,2,2,2,2,4,1,1,0,0,4,1,1,3,0,0,4,1,1,3,3,0,0,4,1,1,3,3,3,0,0]; and Ž8Ã is 2234.


text:
Output source file name
Write a program that prints the name of its source file. REPL environments are not allowed for this challenge. Your code must work in any file that your language's interpreter will accept. Your answer must also be a full program, not just a function. The source code's file extension must be printed. Leading or trailing newline are both optional. This is a code golf, so shortest answer wins. The winner will be chosen on September 2nd, 2016.

Possibly dupe of the cheating quine challenge? Idk though.

@Mego that question asks to actually reverse the charge filename in the file system. This is just printing the file name. So not a duplicate

@vikarjramun Reading the file name is a significant part of the challenge. This is a trivial subset of that challenge.

V, 3 bytes
"zp

Try it online!
This actually does work in the online interpreter somehow. ¯\_(ツ)_/¯
Explanation:
The 'z' register is predefined to the source file of the program, and p pastes from whatever register you tell it to. P would also work, and not cause any different output.

Bash, 7
echo $0

So trivial, I have to type in this text to make the answer long enough.

C, 23 bytes
main(){puts(__FILE__);}

Try it on Ideone

source: Stack Exchange

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

sort: votes


text:
How can I shorten this multiple assignment in Lua?
Is there any better way to golf this (other than removing newlines/indentation)?
function(a,b,...)
  local c=s(a,b)
  local d=c
  for i,v in ipairs{...} do d=d:push(v) end
  return c
end

I'm particularly bothered by the double local usage, but as Lua does not have multiple assignment, and I cannot use function parameters to declare the locals, I can't see a way to remove them.
For those who care, this is the implementation of the __call metamethod in my quick hack of a linked-list ~class used in this answer.

Lua does have multiple assignment: https://www.lua.org/manual/5.1/manual.html#2.4.3

That's parallel, assignment, though. See this question. You cannot use it to share values.

Could you perhaps declare both variables in the same line and then do assignment later? Like local c,d=s({v=b},a),0 d=c? That takes out one of the local keywords. I don't know anything about Lua, though.

Yes that can be done.

@ValueInk Post that as an answer! Note that you don't need the ,0.

Does s have side effects? If not I guess you could do local c,d=s(a,b),s(a,b).

@feersum Good question. Yes, s() creates a table and returns it. The shared value is a reference to an element, not a simple value.

As requested in the comments, here it is as an answer.
local c,d=s(a,b)  -- d is nil
d=c

This saves you one local declaration, should give you -5 bytes.

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


text:
Standard atmosphere properties
The International Standard Atmosphere (ISA) is a model of the Earth's atmosphere at "reference" conditions. It includes information on pressure, temperature, and density change vs. altitude.
The ISA tabulates these properties at various layers, and an estimation of the value of interest can by found by the following procedure:

Find the highest layer A which has a base altitude lower than or equal to the altitude of interest.
Linearly interpolate between layers A and A+1 to find the properties at the altitude of interest.

For example, suppose you want to find the temperature at a geometric altitude above MSL of 40000m. Thus, A=3, and the temperature is (in degrees C):
T = (-2.5+44.5)*(40000-32000)/(47000-32000)-44.5 = -22.1

The goal of this challenge is given a geometric altitude above MSL, find the standard temperature, pressure, and density at that altitude.
For the purposes of this challenge, use the table of the 1976 ISA model (presented on Wikipedia). Here is a link a Gist containing the data in CSV format. Note that the CSV file includes the missing density values from Wikipedia's page.
Input
The input is a single finite real number representing the geometric altitude above MSL in meters. This number is guaranteed to be between [-611,86000) (i.e. it is greater than or equal to -611, and is strictly less than 86000).
The input may come from any source desired (function input, stdio, etc.)
Output
The output are the 3 real numbers representing the standard temperature, pressure, and density at the input altitude. The answer should be accurate to within 0.1%. The answer may be in order desired, as long as it is obvious which value represents which quantity (ex.: the first number is always temperature, the second number is always density, and the third number is always pressure). Note that the magnitude of the quantity does not count as make it obvious what the value represents.
You are welcome to choose any units to output your answers in as long as they properly describe the quantity of interest. Ex.: you may output temperature in degrees Fahrenheit, Celsius, Kelvin, etc., but you can't output the temperature in meters. Your code does not need to output the units abbreviation if it is always the same for a given quantity, but you should specify in your answer what units your answer uses.
The output may be to any sink desired (stdio, return value, output parameter, etc.).
Examples
All examples use meters for input, and output in the order temperature (C), pressure (Pa), density (kg/m^3).
-611
19, 108900, 1.2985

0
15.0335, 104368, 1.24943

12000
-56.5, 20771, 0.333986

47350
-2.5, 110.91, 0.0014276

71803
-58.502, 3.95614764, 6.42055e-5

Scoring
This is code golf; shortest answer in bytes wins. Standard loopholes are prohibited. You may use any built-ins desired. If you are using any external resources to store the tabulated data, you must include the size of the resource (in bytes) as read into your program as part of your score.
Ex.: Say you read in a compressed version of the CSV table I linked which is 100 bytes long (uncompressed is 333 bytes), and your code is 126 bytes long. Then your net score is 100+126=226.

MATL, 152 bytes
'!Q%:5-aeo\!=XBf=H]3|X"Pj7#UGj{r_DH&!+.eFc;u4 kG9Q[rQA(^D1dW- @[E8{Ul0!AXC|MDi8}:&D(j&1_zMU.`[^HQvWoi5}*1UApz %Ld3A)N<$A*7!wBgm'F4Y2'- .;e'hZaU1&Z)i&1Yn

Output is in the same order as described in the challenge
Try it online! Or verify all test cases.
Explanation
Most of the code, '!Q%:5...!wBgm', is a compressed string containing the table. F4Y2'- .;e'hZa decompresses this into the string -611 19 ... 6.961e-6. Note that some decimals have been removed, as they are not needed to fulfill the 0.1% accuracy criterion.
The decompressed string is interpreted as an array with U. This produces the 8×4 table with the required data. The first column shown in the challenge is not needed. Then 1&Z) separates the first column from the rest.
i takes a number as input, and &1Yn applies linear interpolation using the three types of data: first column of the table, remaining columns, input. The result of the interpolation is implicitly displayed.
The input can also be a column vector, and then each row of the output refers to one of the input values. This is used for verifying all test cases at once.

Python 2, 372 bytes
h=-611,11019,20063,32162,47350,51413,71802,86000
i=input()
p=sum(x<=i for x in h)-1
a,b=h[p:p+2]
d=i-a+.0
d/=b-a
for e,f in[x[p:p+2]for x in[(19,-56.5,-56.5,-44.5,-2.5,-2.5,-58.5,-86.28),(108900,22632,5474.9,868.02,110.91,66.939,3.9564,0.3734),(1.29853103694,0.3639105,0.0880334745,0.0132247926,0.00142755556,0.000862248191,6.42095529e-05,6.96089485e-06)]]:print e+f*d-e*d

Try it online!


text:
The longest period iterating quine
As we know, a quine is a program that outputs its own source code. However, it's also possible to write a program that outputs another, different program, that outputs the first program again. For example, the Python 2 program
x = '''x = {}
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3'''
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3

will, when run, output the following text:
print """x = '''x = {}
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3'''
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3"""

When run as a Python program, this will output the original code again. This is called an iterating quine. Because you have to run it twice to get the original code back, we say it has period 2. But of course, much higher periods are possible.
Your challenge is to write an iterating quine with as long a period as you can, in 100 bytes or less, in the language of your choice. (Note that my example above doesn't fit this spec, as it's 119 bytes, including the trailing newline.)
Please note the following rules and clarifications:

The usual quine rules apply, i.e. your program can't use language features that would let it access its own source code directly.
The iterated outputs have to eventually loop back to exactly your original code, and you have to include a demonstration or proof that it will.
You must also include an explanation of why the cycle is as long as you say it is. This doesn't have to be at the level of a mathematical proof, but it should be convincing to someone familiar with your language. (This rule is here because I expect some of the answers to involve very, very large numbers.)
It's fine to say something like "at least 1,000,000 iterations" rather than giving the exact number, as long as you can prove that it is at least that long. In this case, your score would be 1,000,000. Otherwise, your score is the period of your quine.
The 100 byte limit only applies to your initial program - the programs it outputs can be longer, though of course they'll eventually have to get back down to 100 bytes in order to output your original code.
You can assume your machine has infinite RAM and infinite runtime, but you can't assume unlimited precision data types (such as integers) if your language doesn't have them. You can assume there is no limit to the length of input your parser can handle.
The highest score wins.

Please note: there is an existing challenge called Quit Whining; Start Quining that also involves iterating quines. However, aside from being based on the same concept, these are completely different types of challenge. The other one is straight up code golf, whereas this one is (intentionally!) really a busy beaver problem in disguise. The techniques needed to produce a good answer to this question are likely to be very different from what's needed to answer the other question, and this is very much by design.

@LeakyNun I don't know if it was you or a mod that deleted your answer, but perhaps if I explain what was wrong with it you will understand why this isn't a duplicate. This question specifies a 100 byte limit on the source length, so you actually can't go "as high as you want" using that method. That's the whole point of this question. To answer it, what you would have to do is post the longest version that fits into 100 characters, and say what its period is. What you posted would be a good first attempt but is very unlikely to be the winner.

The other challenge also has an additional level of indirection in that the first program isn't part of the cycle and it actually takes the iteration length as a parameter. That said I'm not 100% sure there isn't a better dupe target. I'll need to have a look later.

@Nathaniel I can see how this isn't quite a dupe, but I think the challenge as it stands boils down to simply "generate the largest number in 40 or so bytes". 1: Find a language with arbitrary precision integers, 2: Find a quine for this language, 3: Adapt the quine to include an incrementing number (100-byte limit does not apply to subsequent programs), 4: in the increment step, compare this number to some large number, (e.g. 3^^^3) and reset to 0 when reached. Overhead of all that will be some small number of bytes, and likely the need to repeat the large number code twice.

In fact, comparing against a large number probably isn't even needed, since no language has truly arbitrary-precision integers (most would cap out at something like 2^(2^64) or so)

@Dave the challenge is precisely about specifying a large number in a small number of bytes, yes. That is the whole principle around which it was designed. The question is, is 3^^^3 the highest number you can specify in 100 bytes in your language, or is there a larger one? That's what this challenge is about. It's the core of it. It's what I wanted to see people do. It's super, super frustrataing to have it closed based on a superficial resemblence to a challenge that has nothing of this structure.

@Dave (second comment) but if you're clever, you need not be limited by machine precision at all. I would expect competitive answers to have a period much longer than 2^(2^64).

So would you prefer it to be closed as a duplicate of http://codegolf.stackexchange.com/q/18028/194 ?

@PeterTaylor that's a much closer theme, but it's still a very different challenge - printing a number is quite different from doing something a large number of times. I would of course prefer it not to be closed at all.

@PeterTaylor a much closer duplicate would be http://codegolf.stackexchange.com/questions/44560/combinator-quines?noredirect=1#comment222555_44560. The big difference is that my question allows any language whereas that one restricts to combinator calculi only, which IMHO is a good reason not to close mine as a duplicate.

Is randomness allowed?

@PyRulez I'd have to say no, because that would require some tricky additional decisions to me made about how to score non-deterministic submissions.

PHP, period 2,100,000,000
Who would've thought that this is possible in PHP?! :-)
This is actually my first ever quine and it's 99 bytes long:
<?$i=1;$i*=21e8>$i;printf($a='<?$i=%d;$i*=21e8>$i;printf($a=%c%s%c,++$i,39,$a,39);',++$i,39,$a,39);

Although PHP supports bigger numbers than 2 * 10^8 by switching from integer to double, the increment no longer works (leads to an infinite loop) and I haven't found another solution which fits into the 100 bytes. Yet.
Proof is fairly simple, since it's just counting up on each iteration until it reaches the reset point at 2.1 billion.
Credits to dave, who posted the approach in pseudo code in the comments and to Bob Twells, from whom I copied the code for a minimal PHP quine.
Test program (sloooooow):
<?php
$o = file_get_contents('quine.php');
for ($i = 0; $i < 22e8; $i++) {
    if ($i%2==0) exec('php q > p'); else exec('php p > q');
    $a = file_get_contents(($i%2==0) ? 'p' : 'q');
    echo "\r" . str_pad($i,6,' ') . ":\t$a";
    if ($a == $o) {
        die;
    }
}

Well, at least I'm the first one to answer.

Side-note: This is on the order of ~10^9.322219295.

Mathematica, period E8.5678#3 E2.1923#4 ~E6.2695#3#2
Print[ToString[#0, InputForm], "[", #1 - 1 /. 0 -> "Nest[#!,9,9^9^99!]", "]"] & [Nest[#!,9,9^9^99!]]

Note that the scores are described in Hyper-E notation. The iterations replace the final Nest[#!,9,9^9^99!] with the decimal expansions of Nest[#!,9,9^9^99!] - 1, Nest[#!,9,9^9^99!] - 2, Nest[#!,9,9^9^99!] - 3, ..., 3, 2, 1, and back to Nest[#!,9,9^9^99!].

wouldn't factorials grow faster?

I don't know Mathematica, but isn't this a violation of the rules for a quine -- reading it's own source code? ToString[#0, InputForm]

so, just 9!!!! doesn't work? idk cuz i don't have my mathematica rpi with me right now.

@Maltysen That computes the double factorial of the double factorial of nine, or (9!!)!! ≈ 2.116870635·10¹²⁰²

@daniero I mean, the idea is similar to a standard CJam {"_~"}_~, so I guess that it should be valid...

IIRC, feeding multiple arguments to Print is the same as using StringJoin first, so you can save a lot of bytes there (because then you also don't need ToString). Also wouldn't it be shorter to use Mod[#1+1, 9^9^99!]?

R, random period with expectation 2^19936-0.5
f=function(){
    options(scipen=50)
    body(f)[[4]]<<-sum(runif(623))
    0
    cat("f=")
    print(f)
}

R's default random number generator has a period of 2^19937-1 and equidistribution in 623 consecutive dimensions. Thus, somewhere (but only once) in its period will be a 623-long vector of zeroes. When we get there (and are aligned with the start of the sequence) the sum of the next 623 random U[0,1] numbers will be zero and we return to our original program.
Note that the program will with very high probability pass through the same non-zero state several times before returning to zero. For instance, the sum 311.5 is the most likely, and there are a great many ways that can happen, but the RNG allows the period for 0 to be longer than the period for 311.5.

Not sure what score you want to assign this entry :P

Per the rules: "It's fine to say something like "at least 1,000,000 iterations" rather than giving the exact number"
So in my opinion it's "at least 1 iteration" because if we get reeeally lucky on the first try... ;)

Unlike many standard loopholes like “I might generate some random input, the answer is there”, this is a really neat proof that the precise answer is bound to occur, and a very good estimate is given. Nice!

Once the program returns to its base state once, then it will have a non-random period of exactly 2^19937-1.

The output of this does not match the actual program (there's a bit of whitespace missing). Also, state won't be preserved between program calls, so the period will not be an exact number, nor will it be consistent

@Jo King the whitespace can be made to match within the 100 character limit (I just indented it here to make it look nice). Is the program not called repeatedly from within the same R session? If it isn't then I guess this is a (positive-)recurrent but nonperiodic quine, in Markov chain terminology.

Python 2
Period: \$9\uparrow((99\uparrow\uparrow(9\uparrow((99\uparrow\uparrow(9\uparrow((99\uparrow\uparrow(9\uparrow\uparrow5-1))\uparrow9)-1))\uparrow9)-1))\uparrow9)+1\$
Thanks to @Bubbler for increasing period from \$9\uparrow9\uparrow(99\uparrow\uparrow12)+1\$ to now
b=0;s="print'b=%d;s=%r;exec s'%(-~b%eval('9**9'*eval('9**9'*eval('9**9'*9**9**9**9**9))),s)";exec s

Try it online!
In the code the b=0 changes to b=1 then b=2 and so on until it reaches b=decimal expansion of the period then resets back to b=0

9**9**9**9**9**9**9**9**9**9**9**9**9**9**9**9**9**9 is much higher than 9**9**99**99**99**99**99**99**99**99**99**99**99**99. That said, you could do something like eval('9**9'*eval('9**9'*eval('9**9'*9**9**9**9**9))) for much MUCH higher numbers.

What does peroid mean?

@S.S.Anne it is written in Knuth's up-arrow notation

@Mukundan I think you might mean period but I'm not sure. I understand what tetration is.

@S.S.Anne sorry it was a typo, thanks for pointing it out

JavaScript, period 9,007,199,254,700,000
Not going to win, but it was fun working with JavaScript on this challenge:
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)

Follows the following cycle:
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254700000-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254699999-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254699998-1||90071992547e5)
// etc...
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),3-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),2-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254700000-1||90071992547e5)
// and so on

Note: You can make it 18 bytes shorter, while only removing only ~0.08% of the score, like so:
a="a=%s;console.log(a,uneval(a),%.0f-1||9e15)";console.log(a,uneval(a),1-1||9e15)

C, period 2,100,000,000
unsigned long long i;main(a){i=1;i*=21e8>i;printf(a="ungisned long long i;main(a){i=%d;i*=21e8>i;printf(a=%c%s%2$c,++i,34,a);}",++i,34,a);}

Based off the PHP answer (obviously).  Will update with explanation when I have time.

C (gcc), 66 bytes, period 2^64
f(s){printf(s="f(s){printf(s=%c%s%1$c,34,s,%lu+1L);}",34,s,0+1L);}

Try it online!
2^64 numbers are available in a unsigned long integer. Therefore, a period of 2^64.

GolfScript, period \$f_{\epsilon_0+1}(126^{126})\$
0".{(}{;]{{x):x;)[.]){+[]\\{[).{f]}{;]x*}if+}:f~~}{;}if.}do{]}x*~}).?:x*`,}if"":n;:c~c`n`":n;:c~c`n`

Try it online!
0"foo"":n;:c~c`n`":n;:c~c`n`
0"foo"":n;:c~c`n`"            # Push this number and these two strings
                  :n;         # Assign the second string to n and remove it from the stack
                     :c~      # Assign the first string to c and execute it
                        c`n`  # Push both strings with "" around
                              # n is automatically printed at the end of the program

Every time this code is executed it prints itsef but replaces the 0 by what foo does to it.
What foo does:
.{(}{;bar}if
.{ }{    }if    # Make a copy of the number and compare it to 0
  (             # If it is not 0, decrement
     ;bar       # If it is 0, replace it by a big number

Here is a version of this code with period 10, so we can see it working:
0".{(}{;9}if"":n;:c~c`n`":n;:c~c`n`

Try it online!
The other 66 bytes compute \$Hydra(Hydra(Hydra(...)))\$, where there are \$126^{126}\$ hydras.
]{{x):x;)[.]){+[]\{[).{f]}{;]x*}if+}:f~~}{;}if.}do{]}x*~}).?:x*`,
]                                                                   # Start with [""], which is equivalent to [[]]
 {                                                     ~})          # The ~}) becomes }126
                                                          .?:x*     # Assign 126^126 to x and execute the block that many times
  {                                           .}do{]}x*             # While the string is not [], redo everything but with a tree with x pairs of []
   x):x;                                                            # Increment x
        )[.])                                                       # Separate the last element and make a copy of it
             {                          }{ }if                      # If it is an empty array
                                          ;                         # False: delete it
              +[]\{[).{f]}{;]x*}if+}:f~~                            # True: execute this function that finds and cuts a head
              +[]\                                                  # Push an empty array under the top of the stack, this will be the outermost pair's parent
                  {                }:f~                             # Assign this function to f and execute it
                   [).                                              # Start a new array and get the last element of the previous array
                      {  }{    }if                                  # If it is an empty array
                       f]                                           # False: keep searching and after that close the array
                           ;]x*                                     # True: delete it, close the array and make x copies of it
                                  +                                 # Put it back in the parent array
                                       ~                            # Remove the outermost pair, which was the [] we added earlier
                                                               `,   # Parse it to a string and get the number of bytes

This is not exactly \$Hydra(x)\$, this never resets x and therefore \$Hydra(x)\$ is a lower bound.
Here is an example of it that takes a tree as input and outputs \$Hydra(tree)+1\$, this confirms it is working.
~1:x;{x):x;)[.]){+[]\{[).{f]}{;]x*}if+}:f~~}{;}if.}do x

Try it online!
\$Hydra(n)>f_{\omega^{\omega^{...^{\omega^{\omega2+4}}}}}(5)\$ with n-3 copies of \$\omega\$. Because of the n-3 and it starting with 5, this program's lower bound should actually be \$f_{\epsilon_0+1}(126^{126}-k)\$, where k is a small number, but that makes it uglier and I doubt it will have more impact on the answer than not resetting x.

Gol><>, 70 bytes, period 325883196621297064957600206175719056476804879488288708188003274919860959534770101079512433396348062803055739640225395758790852315876868469390603793729639715908136196505908165227136154287969475839017544811926036808089596209081885772040898530121921794489026069641113281250
Other wise known as really big (3.25E270)
":1=l8:*6+=S&Q~:'~'=Q~~'H#'||lPffXfX=?1:1=Q$~$~|:1)lPffXfX(Q?:|r2ssH##

This is actually the an altered version of the answer I put on the 500 byte iterator
":1=l8:*6+=S&Q~:'~'=Q~~'H#'||//if last is equal to 1 and length is 71, delete the delete char, if the last char is '~', delete and push 'H#', which will later return to 'H##', completing the cycle!
lPffXfX=?1:1=Q$~$~|          //if length is equal to 15^15^15, then start delete process(append ascii one)
:1)lPffXfX(Q?:|              //if the last character is not 1 (the delete checker), and length is less than 15^15^15, duplicate the last value and append
r2ssH##                      //push the " to the front and output the whole thing

Hopefully I got the score right, and there are no bugs. There is no real way to actually calculate this value, it is theoretical. But man, that is a huge number!!!
Try it online!

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


text:
Brainf*ck Loop Problem
I have a problem for a cyber club that asks you to print:
ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!

Using Brainf**k in 29 bytes or less without using the ',' character.
I have a working code:
++++++++++[>++++++>+++++++++<<-]>-->.<[>-.<-]

However my loop is too long, sending me 16 bytes over the limit.
Is there a more efficient way to set the second and third cell to 58 and 90 so I can run my second loop? Or is there a better way to do this all together that I am just not seeing?

As for your question, while it only saves four bytes, it's actually better to generate 59 and 90 and change the -. to .-, dropping the >.<.

I got +[--->++<]>++++[.-] for 19 bytes but it prints the control chars as well...

@MartinEnder Yeah sorry about that, I saw your comment on the other post and found this group which seemed much more appropriate, I will delete the one on SO since it didn't generate many answers.

I'm honestly curious what this "cyber club" is, because boy they must have some really good golfers!

27 24 bytes
++[<++[++<]>>>+]<[-<-.>]

Spent a whole day basically writing up a brute forcer and watching the results come in. Now I can get back to doing some actual work... Another day of brute forcing later...
Try it online!
The component ++[<++[++<]>>>+] initialises the tape to
[130, 0, 0, 0, 91, 59, 0]
                       ^

which is just perfect for what we need!

Wizardry. (∩｀-´)⊃━☆ﾟ.*･｡ﾟ

@primo To be fair I have no idea what's going on structure-wise in the first half, and I think the fact that you're able to come up with your own algorithms/techniques is amazing :)

Tape at the end of each loop: http://codepad.org/ZoJUlQ8M. It's not at all intuitive that it would terminate at the values that it does, or even at all ;)

An alternative 24: +[[>++<<]>->+>+]<[-<-.>]

30 bytes
-<-[>+>-[---<]>]>++>+[---<.->]

Try it online!
85 and 171 are fairly easy to generate in brainfuck (modular inverses of 3 and -3). 85 is pretty close to 90, and 171 is pretty close to 177 (59·3), which is used here. With a bit of hackery, I'm able to produce 88 and 176 instead.
Still one byte short of the target, though.
Other suggestions
In general, it's shorter to iterate over a list, multiplying by a constant, rather than the other way. This is especially true for 3 or more values. For example, this:
++++++++++[>++++++>+++++++++<<-]

can be written as:
+>++++[+++++[>++++++++++<-]<]>

There were only two inner values, so it's not much of an improvement in this case. In fact, just refactoring is one byte shorter:
+++++[>++++++[>++>+++<<-]<-]>

Multiplying 30 by 2 and 3, rather than 10 by 6 and 9. With Martin Büttner's suggestion, this is already down to 38 bytes, without much change to the original:
+++++[>++++++[>++>+++<<-]<-]>>-[>.-<-]

I never would have thought about multiplying up the 58 and iterating by a larger number, that's much more efficient.

34 bytes
Saved you 11 bytes, but still 5 bytes too long...
+[--->++<]>++++<+[--------->.-<]>.

I've spent hours already, hopefully someone can improve on this.


text:
PKCS#7 padding validation
In cryptography, PKCS#7 padding is a padding scheme which adds a number of bytes N ≥ 1, where the value of each added byte is equal to N.
For example, Hello, World!, which has 13 bytes, is the following in hex:
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21

If we choose to PKCS#7 pad to length 16, then the result is:
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 03 03 03

And if we choose to pad to length 20, then the result is:
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21 07 07 07 07 07 07 07

Note that in the first example we add three 03 bytes, and in the second we add seven 07 bytes.
Your task will be to validate whether a string (or integer array) has correct PKCS#7 padding. That is, if the last byte of the input string is N, then your program should check that the last N bytes of the string are equal to N.
Input
A single nonempty ASCII string containing characters between code points 1 and 127 inclusive. If you wish, you may take input as an array of integers instead.
Output
A truthy value if the input string has valid PKCS#7 padding, otherwise a falsy value.
Both functions and full programs are acceptable. This is code-golf, so the aim is to minimise the number of bytes in your code.
Test cases
The integer array version of inputs is presented here — the string version would have unprintable characters for many of the following test cases:
Truthy:
[1]
[1, 1]
[2, 1]
[2, 2]
[5, 6, 5, 3, 3, 3]
[1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2]
[95, 115, 80, 32, 71, 7, 122, 49, 13, 7, 7, 7, 7, 7, 7, 7, 7]
[27, 33, 54, 65, 97, 33, 52, 55, 60, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
[15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15]

Falsy:
[2]
[1, 2]
[5, 5, 5, 5]
[5, 6, 5, 4, 4, 4]
[3, 3, 3, 94, 3, 3]
[1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 127]
[50, 39, 94, 105, 49, 29, 74, 102, 2, 106, 44, 7, 7, 7, 7, 7, 7]
[26, 27, 59, 25, 122, 110, 20, 30, 114, 6, 9, 62, 121, 42, 22, 60, 33, 12]

Is [1 2 3 3 3 3] truthy or falsey? I think it should be truthy but I'm not positive.

@DJMcMayhem Truthy

@DJMcMayhem Truthy (this parallels the truthy test case ending in 7s). You can think of it as, after stripping, you'd end up with [1 2 3].

Surely you meant to put a comma after Hello. (It's in the hex.)

@rici Thanks for noticing, fixed!

Can I also take the index of the last element of the array as input? Or a pointer to the last element instead of the first (in C)?

@Riley Taking a pointer to/index of the last element feels a bit like preprocessing to me, so no. My intention with C was that since 0 will not be in the input, you can assume the array is null terminated.

Python, 47 34 33 bytes
lambda s:s[-1:]*s[-1]==s[-s[-1]:]

s[-1] is the last member of the list s. Checks that the last s[-1] members of the input array s are the same as an array of s[-1] repeated that many times.
Takes input as an array of integers. This is a lambda expression; to use it, assign it by prefixing lambda with f=.
Try it on Ideone!
To test:
>>> f=lambda s:s[-1:]*s[-1]==s[-s[-1]:]
>>> f([27, 33, 54, 65, 97, 33, 52, 55, 60, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10])
True
>>> f([50, 39, 94, 105, 49, 29, 74, 102, 2, 106, 44, 7, 7, 7, 7, 7, 7])
False

Saved 13 bytes thanks to Leaky Nun!
Saved a byte thanks to Dennis!

def f(s)= is a byte shorter.

@ThreeFx you need to return?

@ThreeFx Yes, but then I have to write return. The lambda version is 7 bytes shorter.

You're right. Sorry.

lambda s:[s[-1]]*s[-1]=s[-s[-1]:]

s[-1:]*s[-1] should work.

Brachylog, 14 bytes
~c[A:B]t#=h~lB

Try it online!
~c[A:B]t#=h~lB
~c[A:B]                input is concatenation of A and B
       t               B
        #=             has all equal elements
          h~lB         the first item of B is the length of B

Jelly, 5 bytes
ŒgṪṫṪ

Input is an array of code points, output is a non-empty array (truthy) or an empty array (falsy).
Try it online! or verify all test cases.
How it works
ŒgṪṫṪ  Main link. Argument: A (array)

Œg     Group all runs of consecutive, equal integers.
  Ṫ    Tail; yield the last run. It should consist of n or more occurrences of n.
    Ṫ  Tail; yield n, the last element of A.
   ṫ   Dyadic tail; discard everything after the n-th element of the last run.
       If the last run was long enough, this will yield a non-empty array (truthy);
       if not, the result will be an empty array (falsy).

Pyth, 5 bytes
gFer8

RLE  on input, take the last pair and check if the number of repeats is greater or equal than the value.
Try it online: Demonstration or Test Suite

CJam, 9 8 bytes
Thanks to Sp3000 for saving 1 byte.
{e`W=:/}

Takes an integer list as input and returns 0 (falsy) or a positive integer (truthy).
Test suite.
Explanation
e`   e# Run-length encoding, yielding pairs of run-length R and value V.
W=   e# Get the last pair.
:/   e# Compute R/V, which is positive iff R ≥ V. Works, because V is guaranteed
     e# to be non-zero.

05AB1E, 9 bytes
No run-length encodings for osabie :(
¤sR¬£¬QOQ

Explanation:
¤           # Get the last element of the array
 s          # Swap the two top elements
  R         # Reverse the array
   ¬        # Get the first element
    £       # Substring [0:first element]
     ¬      # Get the first element
      Q     # Check if they are equal
       OQ   # Sum up and check if equal

With an example:
¤           # [5, 6, 5, 3, 3, 3]  3
 s          # 3  [5, 6, 5, 3, 3, 3]
  R         # 3  [3, 3, 3, 5, 6, 5]
   ¬        # 3  [3, 3, 3, 5, 6, 5]  3
    £       # 3  [3, 3, 3]
     ¬      # 3  [3, 3, 3]  3
      Q     # 3  [1, 1, 1]
       OQ   # 3==3 which results into 1

Uses the CP-1252 encoding. Try it online!

MATL, 10 bytes
Thanks to @Adnan for noticing a problem with an earlier version of the code
P0hG0):)&=

When the input has correct padding, the output is an array containing only ones, which is truthy. When it has incorrect padding, the output is an array containing at least a zero, and so is falsy.
Try it online! Or verify all test cases.
Explanation
P     % Implicitly take numeric array as input. Reverse the array
0h    % Append a 0. This ensures falsy output if input array is too short
G0)   % Push input again. Get its last element
:     % Range from 1 to that
)     % Apply as index into the array
&=    % 2D array of all pairwise equality comparisons. Implicitly display

@Adnan Working now

Nice, looks good :)

Also, congratulations on 25k! :3

Mathematica, 29 bytes
#&@@#<=Length@#&@*Last@*Split

Split the input into runs of equal elements, extract the last, and check that its first element is less than or equal to the length of that run.

Haskell, 50 bytes
import Data.List
((>=)<$>head<*>length).last.group

Takes an array of integers as input.

You need to import Data.List unless you're in the REPL.

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

Input is a list of integers, output is 1 for truthy and empty for falsey.
Explanation
(({})[()]){ Loop a number of times equal to the last integer in the input - 1
    ({}[()] Handle loop counter
        < Silently...
            ({}[({})]) Replace the last code point in the string with its difference with the code point before it
            {<>} If the difference is not zero then switch stacks
            {} Discard the difference
        > End silently
    ) Handle loop counter
} End loop
{} Discard the loop counter
{<>(<(())>)} If the top of the current stack is not 0 (which means we have not switched stacks push 0 then 1
{} Discard the top of the stack (either nothing if falsey or 0 if truthy)

The loop does not immediately end when a value that would result in a falsey return is encountered. It is instead switched to the other stack which is empty and spends the rest of its iterations comparing 0 and 0.

Oh hey, nice to see you on here! Welcome to the site!

J, 13 bytes
#~@{:-:{:{.|.

Takes the list as a single argument and outputs 1 if it is truthy and 0 if falsey.
Usage
   f =: #~@{:-:{:{.|.
   f 5 6 5 3 3 3
1
   f 5 6 5 4 4 4
0

Explanation
#~@{:-:{:{.|.  Input: array A
           |.  Reverse A
       {:      Get the last value in A
         {.    Take that many values from the reverse of A
   {:          Get the last value in A
#~@            Make a list with that many copies of the last value
     -:        Test if the list of copies matches the sublist of A and return

@randomra A case such as 3 4 3 3 3 would have ~. as 3 4 so that the last row of = is 0 1 0 0 0. I think operating on the reverse as {:*/@{.0{=@|. should work, but it ends up as 13 bytes also.

Right, nice catch. I missed that.

Brain-Flak 84 bytes
100000000 beat me here
Try It Online!
((({}))){({}[()]<(({})<([{}]{}<>)<>>)>)}<>([])({<{}>{}<([])>}{}<(())>){((<{}{}>))}{}

Takes input as array of integers.
Explanation to come.
Here is a 64 byte version that outputs the not of the answer:
((({}))){({}[()]<(({})<([{}]{}<>)<>>)>)}<>([])({<{}>{}<([])>}{})

Batch, 101 bytes
@for %%a in (%*)do @set/an=%%a,c=0
@for %%a in (%*)do @set/ac+=1,c*=!(n-%%a)
@if %c% geq %n% echo 1

Takes input as command-line parameters, loops over them all so that it can get the last one into n, loops over them all again to count the run of trailing ns, finally printing 1 if the count is at least equal to n. Alternatively if printing 0 or a non-zero value is acceptable, then for 93 bytes, change the last line to @cmd/cset/ac/n.

Haskell, 49 bytes
f s|x<-(==last s)=x.length.fst.span x.reverse$s

Try it on Ideone.
Shorter version which returns True for truthy and False or an exception for falsy:
((==).head>>=all).(head>>=take).reverse

Javascript (ES6), 51 47 41 bytes
a=>(r=k=>a.pop()^n?k<2:r(k-1))(n=a.pop())

Examples:

let f =
a=>(r=k=>a.pop()^n?k<2:r(k-1))(n=a.pop())

console.log(f([5, 6, 5, 3, 3, 3]))
console.log(f([5, 6, 5, 4, 4, 4]))

Dyalog APL, 10 bytes
(⊃∧.=⊃↑⊢)⌽

⊃ Is the first
∧.= all-equal to
⊃ the first
↑ n taken from
⊢ the
⌽ reversed argument?
TryAPL online!

How many bytes?

@ConorO'Brien Sorry, forgot to fill in the boilerplate.

C 91 Bytes
int f(int*l){int n;for(n=0;l[++n];);l+=n-1;for(int i=*l;i;)if(l[-i--+1]^*l||n<*l)return 0;}

Input: a pointer to a null-terminated array.
Output: returns 0 for invalid padding and non-zero for valid (the last element in the array)
Examples:
int a[] = {5, 6, 5, 3, 3, 3, 0};
printf("%d\n", f(&a[5], 6));

int b[] = {1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 0};
printf("%d\n", f(&b[11],12 ));

int m[] = {5, 6, 5, 4, 4, 4, 0};
printf("%d\n", f(&m[5], 6));

int n[] = {3, 3, 3, 94, 3, 3, 0};
printf("%d\n", f(&n[5], 6));

Gives:
3
2
0
0

This does rely on undefined behavior. If the padding is valid there is no return statement, but using gcc -std=c99 this returns the last element of the array that was passed in (at least on my machine).

Perl 5, 30 bytes
Includes +1 for -p
#!/usr/bin/perl -p
$_=/(.)\1*\z/s+length$&>ord$1

Try it online!

Brachylog, 6 bytes
a₁=.l∈

Try it online!
Outputs through predicate success or failure, as Leaky Nun's Brachylog v1 answer does. Takes a similar approach, as well, but comes out a lot shorter.
a₁        There exists a suffix of the input
  =       the elements of which are all equal
   .      which is the output variable
    l     the length of which
     ∈    is an element of
          the output variable.

Brachylog, 6 bytes
ḅt.l≥∈

Try it online!
An alternate version that comes out to the same length which takes some inspiration from Dennis' Jelly answer.
 t        The last
ḅ         block of consecutive equal elements of the input
  .       is the output variable
   l      the length of which
    ≥     is greater than or equal to
     ∈    an element of
          the output variable.

Retina, 34 bytes
Byte count assumes ISO 8859-1 encoding.
.+
$*
\b(1(1)*)(?<-2>¶\1)*$(?(2)!)

Input is a linefeed-separated list of integers. Prints 0 or 1.
Try it online! (The first line enables a test suite, where there is one space-separated test case per line.)
An alternative idea that ends up at 35 bytes and prints 0 or a positive integer:
.+
$*
\b(?=(1+)(¶\1)*$)(?<-2>1)*1\b

Pyke, 7 bytes
eQ>}lt!

Try it here!

Javascript (ES5), 89 bytes
function(b){for(var d=b[b.length-1],c=0;c<d;c++)if(b[b.length-c-1]!=d)return!1;return!0};

Ungolfed:
function a(arr){
var b=arr[arr.length-1];
for(var i=0;i<b;i++){
    if(arr[arr.length-i-1]!=b)return false;
}
return true;
}


text:
Visible Buildings
This puzzle is derived from CodinGame SamSi's "Heart of the City" puzzle.
Description
You decide to take a walk in an n * n tile city and go to the center tile. All of the buildings are infinitely small, but you have super vision and can see everything close up and far away.
Constraints
n is always odd
You can see any building that is not directly obstructed by another one
Task
Mark each building visible with *. The building is visible iff it is not blocked by another building on the exact same line of vision.
In other words, if @ is the origin, the building is visible iff the x-coordinate and the y-coordinate are co-prime to each other.
Example input and output
Input:
7

Output:
 ** **
* * * *
*******
  *@*
*******
* * * *
 ** **

* is a visible building,
 is an invisible building, and
@ is where you are.
Scoring
Remember, this is code-golf, so the answer with the least bytes wins.

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

Can you clarify on how the output is generated?

I think it'll be good to have an example where the input is much bigger than 5, since the output for 5 isn't particularly illustrative

Are we always at the centre? What about when the input is even?

@LeakyNun "n is always odd"

@LeakyNun The output can be generated however you want, but it has to follow the output specifications. Am I correct with the 7x7 input/output?

By the way, I suggest saying least bytes instead of least characters since least characters tends to lead to people compressing their programs with Unicode

@Sp3000 Edit the post then, it's time for me to get some rest :D

Related, also. Both are more complicated variants which people might also want to try.

Excel-VBA, (47*n^2) bytes and 121 bytes
Instruction:
Excel turns out to be very handy for this challenge and there are combination of Excel formulas to get the exact pattern as the OP's shown for a given input. Luckily enough for me, Excel has a GCD function - a built-in formula to return greatest common divisor of positive integers so I don't have to create one using Euclidean algorithm.  Why do I need a GCD function here? It's because two numbers are called coprime, if their greatest common divisor equals 1. The numbers here is the coordinate of the position, x and y, relative to the origin, @. Here is the Excel formula
=IF(GCD(ABS(COLUMN()-m),ABS(m-ROW()))=1,"*","")

where m is the name of a reference cell and it's equal to the smallest integer greater than or equal to n/2, ceiling(n/2), where n is the name of a reference cell for the input. Paste this formula in cell A1, then drag all over range with the size n x n. The length of the formula is 47 bytes but you have to replicate it n x n times, so it's equal to (47*n^2) bytes.
To automate the process and to reduce the use of characters, we can use VBA since it's integrated with Excel. First thing first, set a worksheet Excel like the following:

Then put the following code in the Immediate Window
n=[A1]:m=Int(n/2)+1:Range("A1",Cells(n,n))="=IF(GCD(ABS(COLUMN()-"&m &"),ABS("&m &"-ROW()))=1,""*"","""")":Cells(m,m)="@"

Ungolfed the code:
Sub A()
    n = [A1]
    m = Int(n / 2) + 1
    Range("A1", Cells(n, n)) = "=IF(GCD(ABS(COLUMN()-" & m & "),ABS(" & m & "-ROW()))=1,""*"" ,"""")"
    Cells(m, m) = "@"
End Sub

Explanation:

n = [A1] : Set n as the input and assign the value of cell A1 to n.
m = Int(n / 2) + 1 : Custom way to return the same output as the ceiling function for argument n/2.
Range("A1", Cells(n, n)) = "=IF(GCD(ABS(COLUMN()-" & m & "),ABS(" & m & "-ROW()))=1,""*"" ,"""")" :  Paste the formula above to every cell in the range with size n x n start from cell A1.
Cells(m, m) = "@"  :  Assign the center of the range with a character @.

Output:
Figure below is the example output for the input n = 11

I set the font color to red to make it look more attractive. Even better

Why do you "paste" the formula in every cell instead of calculating it directly in the VBA function?

@Vale Because it'll be lengthier since I have to use looping statement, IF statement, WorksheetFunction, and so on.

but in your byte count you put 47*n^2...?

@Vale You perhaps haven't read this: "The length of the formula is 47 bytes but you have to replicate it n x n times, so it's equal to (47*n^2) bytes" in my answer. See also the discussion in the comment section of ugoren's answer. I hope it makes the thing clearer.

@Anastasiya-Romanova秀 as per convention, the correct byte count for this solution would be 121 bytes as only the program itself contributes to the bytecount. In the case you referenced, the source must be copied and pasted into each individual cells, whereas in your solution that is all done programmatically.

Jelly, 16 bytes
:2ạḶgþ`«2ị“* @”Y

Try it online!
How it works
:2ạḶgþ`«2ị“* @”Y  Main link. Argument: 2n + 1

:2                Perform integer division by 2, yielding n.
   Ḷ              Yield [0, ..., 2n].
 ạ                Take the absolute difference of the result to both sides.
                  This yields A := [n, ... 0, ... n].
      `           Call the quicklink to the left with left and right argument A.
     þ              Table; call the link to the left for all x in A and all y in A.
    g                 Yield the GCD of x and y.
       «2         Truncate the GCD at 2, leaving 0 for the origin, 1 for coprime
                  coordinates, and 2 otherwise.
         ị“* @”   Index into that string, mapping [1, 2, 0] to ['*', ' ', '@'].
               Y  Join, separating by linefeeds.

Can you add an expanded, commented view of the code?

I already did. Is it missing something?

I wasn't seeing it for some reason.... it's looking good now!

S.I.L.O.S, 236 bytes
GOTO s
funcg
if q p
r=p
return
lblp
t=p
t%q
p=q
q=t
GOSUB g
return
lbls
readIO
m=i
m/2
a=i
lbla
a-1
a-m
b=i
lblb
b-1
b-m
p=a
p|
q=b
q|
GOSUB g
r-1
A=r
A|
r/A
r*-1
r+1
p=r
r*r
r*6
p*4
r+p
r+32
printChar r
b+m
if b b
printLine
a+m
if a a

Try it online!
Port of my answer in C.

the output for 15 is interesting

C, 147 145 135 133 bytes
2 bytes thanks to Dennis.
10 bytes thanks to Arnauld.
2 bytes thanks to H Walters.
r,m,i,j;g(a,b){r=b?g(b,a%b):a;}main(n){scanf("%d",&n);for(m=n/2,i=-m;i<=m;putchar(r?r*r-1?32:42:64),i+=++j%n<1&&puts(""))g(i,j%n-m);}

Ideone it!
Golfing advice welcome as always.

I you define another global variable (say x) and do x= instead of return in the g()function, then I think you can do {g(i,j-m);putchar(x?x*x-1?32:42:64);} and save 7 bytes. (Or 8 bytes if you also remove the line break. Is it really required?)

@Arnauld Thanks, updated

Hmm. You don't need to declare m,i,j twice, do you?

@Arnauld Apparently I'm an idiot.

Change ++j to ++j%n (+2 bytes), and j-m to j%n-m (+2 bytes).  Then you can remove ,j%=n (-5 bytes).

J, 24 bytes
'@* '{~2<.[:+./~<.@-:-i.

A port of Dennis' answer in Jelly.

Perl 6, 77 or 74 bytes
Full program (77 bytes):
my \h=Int(get/2);say |map {$_|$^j??2>$j gcd$_??'*'!!' '!!'@'},-h..h for -h..h

(try it online)
If it is acceptable to return the output from a lambda as a list of lists of 1-character strings (74 bytes):
{my \h=$_ div 2;map {map {$^i|$_??2>$i gcd$_??'*'!!' '!!'@'},-h..h},-h..h}

(try it online)

Javascript (ES6), 114 113 105 bytes
This started as a port of Leaky Nun's C version and was then further optimized. Most optimizations are specific to JS.
n=>(r=j=>i<n?('*@*'[1+(g=(i,j)=>j?g(j,i%j):i)(i-m,j-m)]||' ')+(++j<n?'':(i++,`
`))+r(j%n):'')(i=0,m=n>>1)

Example:

let f =
n=>(r=j=>i<n?('*@*'[1+(g=(i,j)=>j?g(j,i%j):i)(i-m,j-m)]||' ')+(++j<n?'':(i++,`
`))+r(j%n):'')(i=0,m=n>>1)

console.log(f(7))

GolfScript, 98 83 bytes
~:l.2/~):o:i;{o{.abs i abs.!!{{.@\%.}do}*;1={'*'}{' '}if\.i|!{\;'@'\}*)}l*;i):i;n}*

Try it online!
Input = 11
 **** ****
* * * * * *
** ** ** **
* * * * * *
***********
    *@*
***********
* * * * * *
** ** ** **
* * * * * *
 **** ****

Pyth, 40 bytes
L@"@* "hS[b2)jsMcQyM.aMiM*.**2[r_/Q2h/Q2

I'm very new to Pyth, so this can likely be golfed further.
Try it online
How it works
L@"@* "hS[b2)jsMcQyM.aMiM*.**2[r_/Q2h/Q2

L@"@* "hS[b2)                              Lambda y. Input: b
L                                          Declare lambda
         [b2)                              List [b, 2]
        S                                  Sort ascending
       h                                   Head. Yield first element a, clamping to max 2
  "@* "                                    String literal "@* "
 @                                         Index into string with a, yielding string[a]

             jsMcQyM.aMiM*.**2[r_/Q2h/Q2   Program. Input: Q
                                _/Q2 /Q2   -Q//2 and Q//2
                                    h      Head. Q//2+1
                               r           Range [-Q//2, Q//2+1]
                              [            List
                            *2             Duplicate
                          .*               Splat. Unpack
                         *                 Cartesian product. Yield all coordinate pairs
                       iM                  Map GCD over above
                    .aM                    Map absolute value over above
                  yM                       Map y over above, yielding required characters
                cQ                         Chunk. Split above into Q pieces
              sM                           Map concatenate over above
             j                             Join on newlines
                                           Implicitly print

APL (Dyalog Classic), 23 bytes
'@ * '[3⌊∨/|↑(⊖-⌽)⍳2⍴⎕]

Try it online!


text:
The Burnt Pancake Problem
This challenge is related to Flipping Pancakes.
You may have heard of pancake sorting, where a stack of pancakes is sorted by size by inserting spatula into the stack and flipping all of the pancakes above the spatula, until the pancakes are sorted smallest to largest on the plate. The burnt pancake problem is slightly different. All pancakes now have one side that is burnt, and the burnt side of each pancake must face the plate once the sorting is completed.
For example, given the following stack (size of pancake on the left. 0 meaning burnt-side down and 1 meaning burnt-side up on the right):
1 0
3 1
2 1

You may flip the whole stack to get 20 30 11, flip the top two to get 31 21 11 and flip the whole stack again to get 10 20 30, a sorted stack of burnt pancakes. This sequence of moves, flip 3, flip 2, flip 3, could be represented as 3 2 3.
The Challenge

Given an array of pancakes sizes (not necessarily unique) and their orientations, output any valid burnt pancake sorting sequence, that is, a sequence of flips that leads to the stack of pancakes being sorted from smallest to largest with burnt sides down.
Input and output may be any sane format with separators, but please specify which formats you use and state which end of your input format is the top of the stack (TOS).
Flipping zero pancakes is allowed.
Mixing separators in the input/output is allowed.

Test cases
For all of the following test cases, input is a list and output is a space-separated string, and TOS is on the left.
[[1, 0], [3, 1], [2, 1]]
"3 2 3"

[[5, 1], [3, 0], [4, 1], [2, 1], [1, 0]]
"5 3 4 1 3 2 1"

[[5, 1], [3, 0], [3, 0], [1, 1]]
"4 3 2 3"

As always, if anything is unclear or incorrect, please let me know in the comments. Good luck and good golfing!

Python 2, 83
Input is expected to be the list of (size, orientation) tuples with the stack's top at the end. The output is a list of sizes to flip separated by various kinds of whitespace.
a=input()
while a:i=a.index(max(a));print len(a)-i,a[i][1],len(a),i;a=a[i+1:]+a[:i]

Apparently I'm an idiot.

Is 0 in the output list allowed?

@LeakyNun Flipping 0 pancakes is eminently possible. In fact, I'm doing it right now.

@daniero The top of stack is on the right side.

@LeakyNun oh sorry, my bad

Ruby, 101 95 93 bytes
Not very golfy, I just wanted to make a bogo-sort variant. It's an anonymous function that takes an array of arrays and prints random flips to stdout until the pancakes are sorted.
->a{(p r=-~rand(a.size)
a[0,r]=a[0,r].reverse.map{|x,b|[x,1-b]})while a!=a.sort||a.rassoc(1)}

You can for example assign it to f and say f.call [[1, 0], [3, 1], [2, 1]]
-5 bytes from @Jordan with the brilliant use of rassoc
-2 bytes from @Sherlock9

You can save a few bytes by replacing a.all?{...} with !a.rassoc(1).

@Jordan Wow, that's a really brilliant! I don't think I've ever thought of using  (r)assoc before, but thinking about it, it's probably useful in a lot of problems on this site -- I feel that it should go in the Ruby golfing tips post. Anyhow, thanks :) I was also able to kill another byte though the application of deMorgans law and replacing until with while.

Good idea: http://codegolf.stackexchange.com/questions/363/tips-for-golfing-in-ruby/91468#91468

Since b is only ever 0 or 1, 1-b would also work and would save two bytes.

CJam (37 bytes)
q~{__$W>#)_p/(W%\M*2,f.^+(1=p_,)pW%}h

Input is an array in CJam format on stdin; output is a newline-separated list of flip lengths on stdout. The top of stack is at index 0; 0 indicates burnt side up, and 1 indicates burnt side down.
Online demo
Dissection
The output is always 3n flips long, where n is the number of pancakes. First we flip the largest remaining pancake to the top; then if it's burnt side down we flip that one pancake; and then we flip it to the bottom and repeat as though the stack of pancakes were one shorter.
q~         e# Parse input into array
{          e# Loop...
  __$W>#)  e#   Find 1-based index of largest element in array
  _p       e#   Dup and print
  /(       e#   Split into chunks that long, and pull off the first
  W%       e#   Reverse the first chunk. Note that we don't flip the burnt/unburnt bit
  \M*      e#   Merge the remaining chunks into a single array
  2,f.^    e#   Flip *their* burnt/unburnt bits
  +        e#   Concatenate, prepending the first chunk
  (1=p     e#   Pull off the first (largest) element and print its burnt/unburnt bit
  _,)p     e#   Print the number of remaining elements plus 1 (to account for the largest)
  W%       e#   Reverse. Note that the first chunk has now been flipped twice, which is
           e#   why we have left its burnt/unburnt bit alone
}h         e# ... until we get down to an empty array


text:
Find the right path
Given a list of paths, output the correct path.
Example of path:
    /\
----+/
    |

- and | are horizontal and vertical paths.
/ and \ are 90° turns.
+ is treated as a - or a | depending of the current direction.

Paths may go in any direction and a character may be used in multiple paths.
Input will be like this:
       /--\
A------+--+--#
B------/  \--:
C------------#
D------------#

A, B, C and D are path starts
# is a wall (the path is bad)
: is the end (the path is correct)

So here the output will be B.
You can assume:

: and # will always be reached from the left.
The character at the right of the start of a path will always be -.
Paths will always be well formed.
# and : will always be in the same column.
There will always be only one : and 4 paths.

Test cases
A------#
B------#
C------#
D------:
=>
D

A-\ /---:
B-+-/ /-#
C-+---+-#
D-+---/
  \-----#
=>
B

  /-\
A-+\\---#
B-/\-\/-#
C----++-#
D----+/
     \--:
=>
A

A-\
B-+\
C-++\/----#
D-+++//---:
  \++-//--#
   \+--//-#
    \---/
=>
A

  /-\
A-+-/-\
B-+-+-\--#
C-+-/ |/-#
D-\---++-#
  \---+/
      \--:
=>
B

Since this is code-golf, the shortest answer win.

Will there ever be two paths incident on the same / or \?

@MartinEnder Yes

Oh, it's in the last test case. Might be worth mentioning explicitly.

Will the : always be reached from the left or could it be reached from the top or bottom as well? In other words could there be characters other than # or : in the last column?

@MartinEnder : and # will always be reached from the left

Are the letters required to be in the left column?

@feersum Yes they are

SILOS answer please?

May I assume an input that is space padded so it forms a rectangle (all lines have equal length) ? May I assume # and : are always on the last column ? May I assume that the letters are always in the first column ? May I assume that the starts/goals are the only things on the last/first column (except spaces)

@TonHospel 1) No 2) 3) 4) Yes

Slip, 47 bytes
`a(?,[`-+]*((`/<|`\>)[`|+]*(`/>|`\<)[`-+]*)*`:)

Test it here.
Yay for undocumented features...
Explanation
Slip is basically a two dimensional regex syntax and by default Slip programs print the subset of the input that they matched. In this case I'm simply matching a valid path. To prevent printing the entire path, I'm usng the undocumented (?,...) groups which simply indicate that the characters matched inside should be omitted from the output.
As for the regex, unfortunately, there's some duplication because \ and / need to be treated differently depending on whether we're moving horizontally or vertically. On the plus side, since we know that the path starts and ends horizontally, we know that there's an even number of \ or / in every path, so that we can match two of them at a time.
`a             # Match a letter.
(?,            # Match but don't include in output...
  [`-+]*       #   Match a horizontal piece of path, consisting of - or +.
  (            #   Match 0 or more vertical segments...
    (`/<|`\>)  #     Match a / and turn left, or a \ and turn right.
    [`|+]*     #     Match a vertical piece of path, consisting of | or +.
    (`/>|`\<)  #     Match a / and turn right, or a \ and turn left.
    [`-+]*     #     Match a horizontal piece of path, consisting of - or +.
  )*
  `:           #   Match a : to ensure that this is the correct path.
)

+1 for happy code :)

Python, 221 bytes
def P(s,c=""):
 l=s.split("\n")
 v=[0,-1]
 p=[(i,l[i].index(":"))for i in range(len(l))if":"in l[i]][0]
 while c in"-:|+/\\":
    p=map(sum,zip(p,v))
    c=l[p[0]][p[1]]
    v=v[::1-(c=="\\")*2]
    if"/"==c:v=[-v[1],-v[0]]
 return c

The first indention is just one space, in the while loop it's a tab.

Javascript (ES6), 117 104 bytes
p=>(r=d=>(c="\\/ABCD".indexOf(p[x+=[-1,-w,w,1][d]])+1)>2?p[x]:r(d^c))(0,w=p.indexOf`
`+1,x=p.indexOf`:`)

Test cases:

let f =
p=>(r=d=>(c="\\/ABCD".indexOf(p[x+=[-1,-w,w,1][d]])+1)>2?p[x]:r(d^c))(0,w=p.indexOf`
`+1,x=p.indexOf`:`)

var p0 = 'A------#\nB------#\nC------#\nD------:',
    p1 = 'A-\\ /---:\nB-+-/ /-#\nC-+---+-#\nD-+---/  \n  \\-----#',
    p2 = '  /-\\    \nA-+\\\\---#\nB-/\\-\\/-#\nC----++-#\nD----+/  \n     \\--:',
    p3 = 'A-\\        \nB-+\\       \nC-++\\/----#\nD-+++//---:\n  \\++-//--#\n   \\+--//-#\n    \\---/  ',
    p4 = '  /-\\     \nA-+-/-\\   \nB-+-+-\\--#\nC-+-/ |/-#\nD-\\---++-#\n  \\---+/  \n      \\--:';

console.log(p0, '=>', f(p0));
console.log(p1, '=>', f(p1));
console.log(p2, '=>', f(p2));
console.log(p3, '=>', f(p3));
console.log(p4, '=>', f(p4));

Ruby, 140 bytes
->s{(?A..?D).find{|l,c|x=h=1
v=0
y=s[/.*#{l}/m].count$/
(v,h=c==?/?[-h,-v]:c==?\\?[h,v]:[v,h]
y+=v
x+=h)until(c=s.lines[y][x])=~/(:)|#/
$1}}

Try it on repl.it: https://repl.it/CyJv
Ungolfed
->s{
  (?A..?D).find {|l,c|
    x = h = 1
    v = 0
    y = s[/.*#{l}/m].count $/

    ( v, h = c == ?/ ? [-h,-v] : c == ?\\ ? [h,v] : [v,h]
      y += v
      x += h
    ) until (c = s.lines[y][x]) =~ /(:)|#/

    $1
  }
}

Perl 211 Bytes
sub f{for($s=-1;++$s<~~@_;){if($_[$s][0]ne' '){$r=$s;$c=$m=0;$n=1;while($_[$r][$c]ne'#'){if($_[$r][$c]eq':'){return$_[$s][0];}($m,$n)=$_[$r][$c]eq'/'?(-$n,-$m):$_[$r][$c]eq'\\'?($n,$m):($m,$n);$r+=$m;$c+=$n;}}}}

Ungolfed:
sub q{
    for($start = -1; ++$start <~~@_;) {
        if($_[$start][0] ne ' ') {
            $row = $start;
            $col = $rowMove = 0;
            $colMove = 1;
            while($_[$row][$col] ne '#') {
                if($_[$row][$col] eq ':') {
                    return $_[$start][0];
                }
                ($rowMove, $colMove) =  $_[$row][$col] eq '/' ? (-$colMove,-$rowMove) :
                                        $_[$row][$col] eq '\\' ? ($colMove,$rowMove) :
                                        ($rowMove, $colMove);
                $row += $rowMove;
                $col += $colMove;
            }
        }
    }
}

This is my first Perl golf, so suggestions are welcome :)


text:
Excessive Integers
For a positive integer n with the prime factorization n = p1^e1 * p2^e2 * ... pk^ek where p1,...,pk are primes and e1,...,ek are positive integers, we can define two functions:

Ω(n) = e1+e2+...+ek the number of prime divisors (counted with multiplicity) (A001222)

ω(n) = k the number of distinct prime divisors. (A001221)

With those two functions we define the excess e(n) = Ω(n) - ω(n) (A046660). This can be considered as a measure of how close a number is to being squarefree.
Challenge
For a given positive integer n return e(n).

Examples
For n = 12 = 2^2 * 3 we have Ω(12) = 2+1 and ω(12) = 2 and therefore e(12) = Ω(12) - ω(12) = 1. For any squarefree number n we obivously have e(n) = 0. The first few terms are
1       0
2       0
3       0
4       1
5       0
6       0
7       0
8       2
9       1
10      0
11      0
12      1
13      0
14      0
15      0

Some more details in the OEIS wiki.

Maybe clarify that ^ is power

This is not necessary in my opinion. This symbol is used here and all over the internet, as well as on many calculators and in many programming languages.

MATL, 7 5 bytes
Yfd~s

Try it online! Or verify all test cases.
Explanation
Yf    % Implicit input. Obtain prime factors, sorted and with repetitions
d     % Consecutive differences
~     % Logical negate: zeros become 1, nonzeros become 0
s     % Sum. Implicit display

I was not aware how factor works in MATL, really cool=)

@flawr Do you mean YF (in the 7-byte version of the code) or Yf (5-byte)? The latter is as in MATLAB

The function for the exponents, the 5 byte now is even more clever=)

Brachylog, 11 bytes
$pPd:Pr:la-

Try it online!
Explanation
$pP            P is the list of prime factors of the Input
  Pd           Remove all duplicates in P
    :Pr        Construct the list [P, P minus duplicates]
       :la     Apply "length" to the two elements of that list
          -    Output is the subtraction of the first element by the second one

Mathematica, 23 bytes
PrimeOmega@#-PrimeNu@#&

Very boring. FactorInteger already takes up 13 bytes, and I can't see much that can be done with the remaining 10.

Jelly, 5 bytes
ÆfI¬S

Try it online!
Verify all testcases.
Port of Luis Mendo's answer in MATL.
ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display

For the previous approach, ÆF’SṪ would have worked I think

@Sp3000 You should post that

@LeakyNun I was trying to port it myself, but the definition of ¬ confused me. I didn't know it vectorized

@LuisMendo Indeed the Jelly docs are messy.

J, 11 10 bytes
Saved 1 byte thanks to Jonah.
1#.1-~:@q:

1#.1-~:@q: for 10 bytes.  nice idea using ~: btw.

05AB1E, 6 bytes
Òg¹fg-

Explanation
Òg      # number of prime factors with duplicates
     -  # minus
  ¹fg   # number of prime factors without duplicates

Try it online!

Haskell, 65 bytes
(c%x)n|x>n=c|mod n x>0=c%(x+1)$n|y<-div n x=(c+0^mod y x)%x$y
0%2

if that is one function: who is the input variable? who is the output? thank u...

(%) takes 3 input variables : an accumulator (c), an integer (x) and an integer (n) . It returns the excess of (n) when c is set to 0 and x to 2. So (0%2) is a partial function that takes n and returns its excess

05AB1E, 4 bytes
Ò¥_O

Port of @LuisMendo's MATL answer.
Try it online or verify the first 15 test cases.
Explanation:
Ò       # Get all prime factors with duplicates from the (implicit) input
        # (automatically sorted from lowest to highest)
 ¥      # Get all deltas
  _     # Check if it's equal to 0 (0 becomes 1; everything else becomes 0)
   O    # Take the sum (and output implicitly)

Husk, 5 4 bytes
ΣẊ=p

Try it online!
-1 byte from Dominic Van Essen.

4 bytes...

Pyth, 7 bytes
-lPQl{P

Try it online.

C, 74 bytes
f(n,e,r,i){r=0;for(i=2;n>1;i++,r+=e?e-1:e)for(e=0;n%i<1;e++)n/=i;return r;}

Ideone it!

Python 2, 57 56 bytes
f=lambda n,k=2:n/k and[f(n,k+1),(n/k%k<1)+f(n/k)][n%k<1]

Thanks to @JonathanAllan for golfing off 1 byte!
Test it on Ideone.

Ah nice - you can save a byte by using n/k%k<1

Right, n is already divisible by k at that point. Thanks!

Python 2, 100 99 98 96 bytes
n=input()
i=2
f=[]
while i<n:
 if n%i:i+=1
 else:n/=i;f+=i,
if-~n:f+=n,
print len(f)-len(set(f))

Most of the code is taken up by a golfed version of this SO answer, which stores the prime factors of the input in f. Then we simply use set manipulation to calculate the excess factors.
Thanks to Leaky Nun for saving 1 3 bytes!

Brachylog, 11 bytes
$p@b:la:-a+

Try it online!
Verify all testcases. (The wrapper is longer than the function...)
$p@b:la:-a+

$p            prime factorization
  @b          group blocks of equal elements
    :la       length of each
       :-a    each minus 1
          +   sum

Javascript (ES6), 53 51 46 bytes
e=(n,i=2)=>i<n?n%i?e(n,i+1):e(n/=i,i)+!(n%i):0

Saved 5 bytes thanks to Neil
Example:

e=(n,i=2)=>i<n?n%i?e(n,i+1):e(n/=i,i)+!(n%i):0

// computing e(n) for n in [1, 30]
for(var n = 1, list = []; n <= 30; n++) {
  list.push(e(n));
}
console.log(list.join(','));

You can save 5 bytes by calculating r recursively: f=(n,i=2)=>i<n?n%i?f(n,i+1):f(n/=i,i)+!(n%i):0.

S.I.L.O.S, 113 bytes
readIO
t=2
lbla
e=0
GOTO b
lblc
i/t
e+1
lblb
m=i
m%t
n=1
n-m
if n c
d=e
d/d
e-d
r+e
A=i
A-1
t+1
if A a
printInt r

Try it online!
A port of my answer in C.

So so close to beating C :(

Bash, 77 bytes
IFS=$'\n '
f=(`factor $1`)
g=(`uniq<<<"${f[*]}"`)
echo $((${#f[*]}-${#g[*]}))

Complete program, with input in $1 and output to stdout.
We set IFS to begin with a newline, so that the expansion "${f[*]}" is newline-separated.  We use arithmetic substitution to print the difference between the number of words in the factorisation with the result of filtering through uniq.  The number itself is printed as a prefix by factor, but it is also present after filtering, so falls out in the subtraction.

Japt, 6 bytes
k äÎxÌ

Try it
k äÎxÌ     :Implicit input of integer
k          :Prime factors
  ä        :Consecutive pairs reduced by
   Î       :  Signs of differences (0 or -1)
    x      :Sum of
     Ì     :  Signs of differences with -1 (0 -> 1 and -1 -> 0)

Factor + math.primes.factors math.unicode, 40 bytes
[ group-factors unzip Σ swap length - ]

Attempt This Online!
               ! 12
group-factors  ! { { 2 2 } { 3 1 } }
unzip          ! { 2 3 } { 2 1 }
Σ              ! { 2 3 } 3
swap           ! 3 { 2 3 }
length         ! 3 2
-              ! 1

Pyt, 4 bytes
ḋ₋¬Ʃ

Try it online!
Port of Leaky Nun's Jelly answer

Haskell, 87 bytes
import Data.Numbers.Primes
import Data.List
x=(\x->length x-length(nub x)).primeFactors

Try it online!

Kamilalisp, 15 bytes
[-&[⍴] #0 ⊙]@⋔⌹

Attempt This Online!

Nekomata, 3 bytes
ƒ←∑

Attempt This Online!
ƒ       Factor; returns a list of unique prime factors and a list of their exponents
 ←      Decrement the exponents
  ∑     Sum

Ruby -rprime, 31 bytes
->n{n.prime_division.sum{_2-1}}

Attempt This Online!

Python, (with sympy) 66 bytes
import sympy;lambda n:sum(x-1for x in sympy.factorint(n).values())

sympy.factorint returns a dictionary with factors as keys and their multiplicities as values, so the sum of the values is Ω(n) and the number of values is ω(n), so the sum of the decremented values is what we want.

GNU sed + coreutils, 55 bytes
(including +1 for -r flag)
s/^/factor /e
s/ ([^ ]+)(( \1)*)/\2/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.
Explanation
#!/bin/sed -rf

# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( \1)*)/\2/g
# count just the spaces
s/[^ ]//g
y/ /1/

C, 158
#define G(a,b) if(a)goto b
#define R return
f(n,i,j,o,w){if(!n)R 0;o=w=i=j=0;a:i+=2;b:if(n%i==0){++j;G(n/=i,b);}o+=!!j;w+=j;i+=(i==2);j=0;G(i*i<n,a);R w-o;}

In the start there is the goto instruction... even if this is more long
than yours it is more readable and right [if i not consider n too much big...]
one Language that has 10000 library functions is wrost than a
Language that with few, 20 or 30 library functions can do all better [because
we can not remember all these functions]
#define F for
#define P printf

main(i,r)
{F(i=0; i<100; ++i)
   r=f(i,0,0,0,0),P("[%u|%u]",i,r);
 R  0;
}

/*
 158
 [0|0][1|0][2|0][3|0][4|1][5|0][6|0][7|0][8|2]
 [9|0][10|0][11|0][12|1][13|0][14|0][15|0][16|3]
 [17|0][18|0][19|0][20|1][21|0][22|0][23|0][24|2][25|1][26|0][27|0] [28|1]
 [29|0][30|0][31|0][32|4][33|0][34|0][35|0][36|1]
 [37|0][38|0][39|0][40|2][41|0]
 */

CJam, 11 bytes
ri_mf,\mF,-

Try it online!
Explanation
ri_         Get an integer from input and duplicate it
   mf,      Get the number of prime factors (with repetition)
      \     Swap top 2 elements on the stack
       mF,  Get the number of prime factors (with exponents)
          - Subtract

APL(NARS) 35 chars, 70 bytes
{⍵=1:0⋄k-⍨+/+/¨{w=⍵⊃v}¨⍳k←≢v←∪w←π⍵}

the function π find the factorization in prime of its argument;
there is few to say it seems clear, but for me does more operations (from factorization) than the minimum...the range of count characters is out golfing languages because it seems too much count, but less than not golfing languages... test:
  f←{⍵=1:0⋄k-⍨+/+/¨{w=⍵⊃v}¨⍳k←≢v←∪w←π⍵}
  f¨1..15
0 0 0 1 0 0 0 2 1 0 0 1 0 0 0

Arturo, 47 bytes
$=>[k:tally factors.prime&(∑values k)-size k]

Try it!

Vyxal s, 3 bytes
ǐ¯†

Try it Online!
Ports 05AB1E. Vyncode makes the byte count worse.
Explained
ǐ¯†
ǐ    # Prime factors with duplicates
 ¯   # deltas
  †  # vectorised negation
# summed by the s flag