Let's write a Minifier Background
Minifiers are used, commonly, when serving JavaScript to your Web Browser.  It is commonly used to reduce the number of bytes that have to be sent.  Saving bandwidth is useful for obvious reasons.  Some people use obfuscaters (that intentionally make code harder to read), I am not talking about those.
We will be minifying Python 2
I was debating on whether or not use JavaScript or Python for the minifying experience and I decided on Python for two reasons: white space matters and I think that will add an interesting dynamic the problem.  Additionally, using Python 2.7 will provide another dynamic, such as remove superfluous () during a print (i.e. print("Hello world") vs. print"Hello world"). I would have, personally, preferred to open it up to any language, but for some languages this process won't make a lot of sense for.  And, what language you decide to minify will directly impact your score (and if the language even can be minified).
Specs
Your goal is to only modify the code in a way that will not change it's functionality in anyway.  You may, of course, change variable names (inside your minifying program) as long as it doesn't effect output (keep track of scope).  Although I am giving you a specific program, please don't optimize for the test case as all standard loopholes are forbidden.
Score: length of the program after you minified it.
Input: Any Python 2.7 program (that contains no errors)
Output: A minified version.
Although your code should be able to accomodate all valid Python 2.7 input, it is necessary to test your script against something in order to prove it's effectiveness.
Click here to view the example program.
Making the problem more approachable
Feel free to use or modify any code found inside my solution (listed bellow). I did this to get you started with quote basic quote handling; however, you can expand it to indentation, and etc.
Example ways to minify Python
All white space could be replaced with the minimum possible amount (I acknowledge that in Python you can do some tricky stuff with tabs, but I'll leave that up to you to decide whether or not to implement it).
Example
The following:
def print_a_range(a):
    for i in range(a):
        print(i)

Could be:
def print_a_range(a):
 for i in range(a):
  print(i)

Technically, if there is only one line inside a loop, you can compress it even more:
def print_a_range(a):
 for i in range(a):print(i)  #Note, you can also remove the `()` here.

However, there is another way you can minify white space in Python:
The following:
print ([a * 2 for a in range(20) if a % 2 == 0])

Could be:
print([a*2for a in range(20)if a%2==0])

Note, that there is no need for a space between 2 and for.  Variable, functions, and keywords cannot start with a number.  So, the Python interpreter is okay with <num><keyword>, no space.  You should also note there does not have to a space between ) and if.
Note, you must not change the output of the program! So:
print"f(x)=x*2 is a great equation!"

The above print statement should stay the same because removing the space between 2 and is would modify the output.

Python 2.7, 2013 score
This program can be used as reference, and you are allowed to take the following code and modify it and then post it in your own solutions.
In hindsight, I maybe should have used regex for the quote handling too, but I think in its current state it may be enough to jump-start people into the problem.
Why I chose Python 2.7:  I thought it would be easier to test to see if I made the program crash via the exec keyword.
This code intakes the program as in.txt.
I figured I should at least get the ball rolling for whoever want to participate by writing a quote parser (that also happens to handle comments) and a brief example on how regex, when combined with the quote parser can really change the game in terms of complexity of this problem.
Note: there is still plenty of room for improvement in this minifier.  Like you could play around with indentation, variable names, and removing the parenthesis when they're being used my keywords, like print or yield.
import re

with open("in.txt","r") as fi:
    code = fi.read()

class QuoteHandler():
    def __init__(self):
        pass
    def loadCode(self,code):
        quoteFlag = False
        currentQuoteChar = ""
        ignoreNext = False
        inEndLineComment=False
        startLocation = 0

        self.reAddStrings = []

        outStr = ""

        for i, character in enumerate(code):
            if ignoreNext:
                ignoreNext = False
            elif inEndLineComment:
                if character in "\r\n":
                    inEndLineComment=False
            elif character == "#" and not quoteFlag:
                inEndLineComment = True
            elif character in "'\"" and (currentQuoteChar == character or not quoteFlag):
                if quoteFlag:
                    self.reAddStrings.append(code[startLocation+1:i])
                else:
                    currentQuoteChar = character
                    startLocation = i
                quoteFlag = not quoteFlag
            elif character == "\\":
                ignoreNext = True

            if not inEndLineComment and not quoteFlag:
                outStr+=character
        return outStr

    def find_all_locations(self,substr,code):
        return [m.start() for m in re.finditer(substr, code)]

    def unloadCode(self,code):
        temp = self.reAddStrings[::-1]
        for i, location in enumerate(list(self.find_all_locations('"',code))[::-1]):
            code = code[:location] + "\"" + temp[i] + code[location:]
        return code

def applyRegexes(code):#\w here?
    operatorRegexCleaner = ["([\d\/*\-\"=,'+{}:[\](\)])","[ \t]+","(\w)"]
    regexes = [
        [''.join(operatorRegexCleaner),r"\1\2"],
        [''.join(operatorRegexCleaner[::-1]),r"\1\2"],#removes whitespace between operators
        ["\n\s*\n","\n"]#removes empty lines
    ]
    for regex in regexes:
        code = re.sub(regex[0],regex[1],code)
    return code

qh = QuoteHandler()
code = qh.loadCode(code)
code = applyRegexes(code)
code = qh.unloadCode(code)
print(code)
exec(code)

Output of program:
def factor(factor_number):
    for n in range(2,factor_number):
        if factor_number % n==0:
            yield(n)
def gcd(a,b):
    """Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    """
    while b:
         a,b=b,a%b
    return a
class Apricot:
    def __init__(self):
        self.mold=False
    def get(self):
        return self.mold
    def update(self):
        self.mold=not self.mold
    def blue(self):return5
def tell_me_about_these_numbers(*a):
    print("%d is the first number!" % a[0])
    print("{} / 3 is {}".format(a[0],a[0]/3.))
    myFavorate=Apricot()
    for number in a:
        print list(factor(number))
        myFavorate.update()
    print[gcd(a,b)for a,b in zip(a[:-1],a[1:])]
    print(myFavorate.get())
tell_me_about_these_numbers(5,6,9,45,200)
print"Let's play with scope!"
a,b=10,9
def randomFunction(a):
    print(a)
randomFunction(b)
print(a)
for a in range(100):
    b+=a
print(a)
print(b)
li=[]
for i in range(10):
 li.append(i*2)
print(li)
print([i*2for i in range(10)])
a=c=b=d=e=f=g=h=i=j=k=l=m=n=o=p=q=r=s=t=u=v=w=x=y=z=5
print(a)
a-=1
print(a)
g=10
print(str(10**g+5)[::-1])
def blue_fish(a):
    def blue_fish(a):
        def blue_fish(a):
            return a
        a+=1
        return blue_fish(a)
    a-=1
    return blue_fish(a)
print(blue_fish(10))
def blue_fish(a):
    if a==0:
        return"0"
    return"1" +blue_fish(a-1)
print(blue_fish(5))
blue_fish=lambda a,b,c:a*b*c
print(blue_fish(1,2,3))
blue_fish=lambda*a:reduce(lambda a,b:a*b,a)
print(blue_fish(1,2,3))
print(max([[6,1],[5,2],[4,3],[3,4],[2,5],[1,6]],key=lambda a:a[1]))
print(zip(*[[1],[2],[3],[4],[5]]))
print"Now let's test to see if you handle quotes correctly:"
print"test \'many diffent\' \"types of \" quotes, even with \' \" trailing quotes"
print"""

Multi line quotes are great too!

"""
a=""" ::
one more multi-line quote won't hurt
"""
print a


Accentuated abjad English (ōcćnt̮ōt̖d ōbj̄d óngḷsh) An Abjad is a writing system where each symbol stands for a consonant, and where vowels are omitted. An impure Abjad is an abjad in which there are additionals symbols for vowels, usually diacritics.

Write a program or function that, given a string of lowercase text (i.e. nothing but ASCII letters from a to z, commas and spaces), outputs a corresponding impure abjad English transcript with the following rules:

Representation of vowels

Each vowel (i.e. a e i o u) is represented as an accent on the immediately preceding consonant. For instance, assuming the accent representing the vowel e is ́, the word wet will be transcribed as ẃt.

If a vowel is not preceded by a consonant (two or more vowels in a row, or a word starting with a vowel), the symbol o is used as a "blank consonant". For example, the word peep will be transcribed as ṕóp

Accent placement

Consonants that have ascenders are unpleasant to read when accentuated. Therefore, for those consonants, the symmetric accent will be displayed below the symbol instead of above. For instance, the letter combination te will be written t̖ rather than ́t

Those consonants are b d f h k l t.

Accents for vowels

We are using Unicode combining characters to display accents on every consonant possible. The combining characters used can be found here. Combining accents are placed directly after the symbol they are to be put on.

The accents are presented on arbitrary consonants in this list.

a

Above accent: U+0x0304, example: c̄

Below accent: U+0x0320, example: d̠
e

Above accent: U+0x0301, example: ć

Below accent: U+0x0316, example: d̖
i

Above accent: U+0x0307, example: ċ

Below accent: U+0x0323, example: ḍ
o

Above accent: U+0x030c, example: č

Below accent: U+0x032d, example: ḓ
u

Above accent: U+0x0311, example: c̑

Below accent: U+0x032e, example: d̮

Here is the list of all possible characters:

b̠ b̖ ḅ b̭ b̮
c̄ ć ċ č c̑
d̠ d̖ ḍ ḓ d̮
f̠ f̖ f̣ f̭ f̮
ḡ ǵ ġ ǧ g̑
h̠ h̖ ḥ h̭ ḫ
j̄ j́ j̇ ǰ j̑
k̠ k̖ ḳ k̭ k̮
l̠ l̖ ḷ ḽ l̮
m̄ ḿ ṁ m̌ m̑
n̄ ń ṅ ň n̑
p̄ ṕ ṗ p̌ p̑
q̄ q́ q̇ q̌ q̑
r̄ ŕ ṙ ř ȓ
s̄ ś ṡ š s̑
t̠ t̖ ṭ ṱ t̮
v̄ v́ v̇ v̌ v̑
w̄ ẃ ẇ w̌ w̑
x̄ x́ ẋ x̌ x̑
ȳ ý ẏ y̌ y̑
z̄ ź ż ž z̑
ō ó ȯ ǒ ȏ

Test cases

Input: programming puzzles and code golf

Output: přgr̄mṁng p̑zzl̖s ōnd čd̖ ǧlf

Input: the quick brown fox jumps over the lazy dog

Output: th̖ q̑ȯck břwn f̭x j̑mps ǒv́r th̖ l̠zy ḓg

Input: beautiful

Outpu: b̖ōȏṭf̮l

Input: one ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them

Output: ǒń ṙng ṱ ȓl̖ th̖m ōll, ǒń ṙng ṱ f̣nd th̖m, ǒń ṙng ṱ bṙng th̖m ōll ōnd ȯn th̖ d̠rkńss ḅnd th̖m

Scoring

This is code-golf, so the shortest program or function in bytes wins.

GNU sed, 168 158 134 105 98 85 byt̖s

ǒr 75 ch̠rs (b̭th ȯncl̮ḍng +1 f̭r th̖ -r fl̠g).

s/([bdfhklt])([aeiou])/\1\u\2/g;y/aeiouAEIOU/̠̖̣̭̮̄́̇̌̑/;s/\B[^ ,a-z]/o&/g

óxpl̠n̄ṭǒn

Wó s̄v́ ō ḅt ȏṡng th̖ čnstr̄ȯnt th̠t ȯnp̑t ȯs ōll ḽẃr-c̄ś.  Wó ȏpc̄ś ōny v̌ẃl f̭lḽẇng ō čnšn̄nt, b̖f̭ŕ čnv́rṭng ōll v̌ẃls ṱ ōcćnts.

#!/bin/sed -rf

s/([bdfhklt])([aeiou])/\1\u\2/g  # upcase vowel following ascender
y/aeiouAEIOU/̠̖̣̭̮̄́̇̌̑/
s/\B[^ ,a-z]/o&/g                # precede with 'o' if needed

Th̖ ǒdd-ḽǒḳng ch̠r̄ct̖rs ōŕ // čnt̠ȯṅng ōll t̖n ōcćnts (/̠̖̣̭̮̄́̇̌̑/).  óxp̄nd̖d ǒȏt ẇth sp̄ćs, th̖y w̌ȏld ḽǒk ḷk̖ / ̄ ́ ̇ ̌ ̑  ̠ ̖ ̣ ̭ ̮ /.

ǒȏtp̑t

přgr̄mṁng p̑zzl̖s ōnd čd̖ ǧlf
th̖ q̑ȯck břwn f̭x j̑mps ǒv́r th̖ l̠zy ḓg
b̖ōȏṭf̮l
ǒń ṙng ṱ ȓl̖ th̖m ōll, ǒń ṙng ṱ f̣nd th̖m, ǒń ṙng ṱ bṙng th̖m ōll ōnd ȯn th̖ d̠rkńss ḅnd th̖m


Flaming Doorknob Keyboards! Well, turns out Doorknob's
username on GitHub, Reddit, and other sites is
KeyboardFire. That gives me an idea...

The task

You work at KeyboardFire Inc., a company that makes special keyboards. And, by
"special", I mean that, whenever you press a key, something in your house lights
on fire! With the new KeyboardFire Doorknob series, the objects that light on fire
are doorknobs.

However, because of stupid government regulations, your users need to know which
doorknobs in their house wil light on fire.

Consider this ASCII art of a portion of a QWERTY keyboard:

1|2|3|4|5|6|7|8|9|0
 q|w|e|r|t|y|u|i|o|p
  a|s|d|f|g|h|j|k|l
   z|x|c|v|b|n|m

(The |'s represent the boundaries between keys.)

We can treat this exact ASCII drawing as a "graph" of sorts, where each character in the range [a-z0-9]
has an x (horizontal) and y (vertical) index, where (0,0) is 1. For instance,
the letter d has the coordinates (2,6) (pipes and spaces are included in the coordinate calculation).

Now let's think about each user's house. Every house can be drawn top-down view as
a 20x4 ASCII art (in this world where it's legal to sell destructive keyboards,
every house is the same size). We can use D's to mark the positions of each
doorknob in the house. Here's an example:

D         D  D     D
    D

              D  D

We'll call this the "house map". (Yes, that's a lot of doorknobs!)

Pressing any key will light the nearest doorknob on fire. For instance, if we take the previous coordinates of the letter d, the nearest doorknob (by Manhattan distance) is at
the coordinates (1,4). This is the doorknob that will light on fire when the
letter d is hit. If we were to mark the flaming doorknob with an F, the result
would be:

D         D  D     D
    F

              D  D

The specs

Your program will take two inputs:

A string that matches the pattern [a-z0-9]+.
A house map. This can be a string, a list of strings, or something equivalent.

You need to go through each letter of the string and light the respective
doorknob on fire (change its letter to an F). If the nearest doorknob is already
on fire, leave it as-is. If there is more than 1 doorknob that could be lit on fire
using the this method, you can light whichever one you want.

After the whole string is processed in this manner, you need to print the
resulting house map.

Code-golf, so shortest program wins. Standard loopholes banned as usual.

Example

String:

helloworld123

House map:

D    D       D     D
    D

              D  D

Possible results:

F    F       F     D
    F

              D  F

Or:

F    D       F     D
    F

              D  F

Or:

F    F       D     D
    F

              F  F

Or:

F    D       D     D
    F

              F  F

EDIT: Uh...is there a reason I have one answer, even with a +50 bounty? If you find the directions complicated/vague, I'd be glad if you posted in the comments or something...or of I'm doing anything wrong...

EDIT 2: Bounty expires in under a day! Post something else! Please! PLEASE!!!! :(

Ruby, 229 bytes

->s,m{c=m.flat_map.with_index{|x,i|x.size.times.select{|j|x[j]==?D}.map{|y|[i,y]}}
s.chars{|h|x='1234567890qwertyuiop*asdfghjkl*zxcvbnm'.index h
x,y=(x%10)*2,x/10
a,b=c.min_by{|a,b|(y-a).abs+((y%2>0?x+1:x)-b).abs}
m[a][b]='F'}
m}

Not very good, but I just had to get the first answer in.

Slightly ungolfed / commented version:

#!/usr/bin/ruby

f = -> s, m {
    # get knob coords
    c = m.flat_map.with_index {|x, i| x.size.times.select{|j| x[j] == ?D }.map{|y| [i, y] } }
    # for each char in the string
    s.chars {|h|
        # note the asterisks to correct for offsets
        x = '1234567890qwertyuiop*asdfghjkl*zxcvbnm'.index h
        # get un-"staggered" x and y coords
        x, y = (x % 10) * 2, x / 10
        # add one to x for every other row to fit keyboard
        x += 1 if y % 2 > 0
        # find closest knob by Manhattan distance
        a, b = c.min_by{|a, b| (y - a).abs + (x - b).abs }
        # LIGHT IT ON FIRE!
        m[a][b] = 'F'
    }
    # return new map
    m
}

puts f['helloworld123', ['D    D       D     D', '    D', '', '              D  D']]


Simple Factorial Challenge In light of today's date...
A factorial of a number n, is the product of all the numbers from 1 to n inclusive.
The Challenge
Given an integer n where 0 <= n <= 420, find the sum of the digits of n!. It's that simple :P
Notes: I feel like this challenge isn't too simple, as some languages have a very hard time storing numbers that are fairly large. Also, coding a BigInteger datatype is fairly straightforward, but hard to golf.

Examples

Input: 100. Output: 648.
Input: 200. Output: 1404.
Input: 420. Output: 3672.

Scoring

The input and output can be given by any convenient method.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

EDIT: Ok, I guess it's actually easy...take a look at the Jelly answer below. Anyways, I guess we all know which one's going to be accepted. But, I'd still like to see some interesting ideas and tricks to this problem!

(old problem) JavaScript (Node.js), 99 94 92 88 86 83 80 78 bytes

f=(x,t=[...21+Array(999)])=>x?f(s=x-1,t.map(d=>-s+(s+=(t=~~d*x+t/10|0)%10))):s

Try it online!

well, first language without large number support

Thank Arnauld for 4 bytes

f = (x, t = ['2', '1', ...','.repeat(998)]) => // init x, t=1
  x ?
    f( // recursive x':=x-1, t'=t*x
      s = x-1, // s init to 0 when x==1, in next recursion just return
      t.map (
        b = // init b to NaN
        d =>
          -s + ( //  to return the added value
            s+= ( // -s + (s + k) == k
              b=
                ~~d*x+b/10 | 0
                // ~~d converts ',' to 0
                // b is initally NaN, after first iteration
                // it's zero, then the last digit sum result with carry
            ) % 10
          )
      )
    )
:
  s // the sum from x==1


The Uncommon Factor Number Based on a chat message
The Challenge
Given an input number \$n > 9\$, construct its reverse, ignoring leading zeros. Then, construct a list of all prime factors that the number and its reverse don't have in common. Multiply those factors together to create the Uncommon Factor Number of the input.
Or, to put it another way: if \$\text{rev}(n)\$ denotes the decimal reversal of integer \$n\$, calculate the product of \$n\$ and \$\text{rev}(n)\$ divided by the square of the \$\gcd(n, \text{rev}(n))\$.
Output that number.
Worked examples
For example, \$2244\$ reverses to \$4422\$. The prime factors of the first are \$[2, 2, 3, 11, 17]\$ and the prime factors of the reverse are \$[2, 3, 11, 67]\$. The numbers not in common multiplicities are \$[2, 17, 67]\$, so \$2278\$ is the output.
For another example, \$1234\$ reverses to \$4321\$. The product is \$5332114\$ and the GCD is \$1\$, so the output is \$5332114\$.
Further clarifications
Obviously a palindromic number will have all its factors in common with its reverse, so in such a case the output is \$1\$ \$\left(\frac{n\times n}{n^2}\right)\$. Obviously, it's also possible for the output to be the multiplication all factors (i.e., the gcd is \$1\$ -- the input and its reverse are co-prime), as in the case of the \$1234\$ example.
Rules

The input and output can be assumed to fit in your language's native integer type.
The input and output can be given in any convenient format.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples
in
out

17
1207

208
41704

315
1995

23876
101222302

05AB1E, 6 bytes

Code

Â‚D¿÷P

Uses the 05AB1E encoding. Try it online!

Explanation

Â‚        # Get the array [input, reversed(input)]
  D       # Duplicate that array
   ¿      # Calculate the GCD of the array
    ÷     # Divide each element in the array by the GCD
     P    # Product of that array


Output the ŋarâþ crîþ alphabet song without using (m)any letters Your goal is to write a program that takes no input and outputs the following text:

ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.

But there's a catch: for each letter (any character whose general category in Unicode starts with L) in your source, you get a penalty of 20 characters! (For reference, the text to be printed has 81 letters.)

The Perl 6 code below has 145 bytes and 84 letters, so it gets a score of 1,845:

say "ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos."

The code below has 152 bytes and 70 letters, so it gets a score of 1,552:

$_="C e N ŋa V o S;
Þ Š R L Ł.
M a P F G T Č;
în J i D Ð.
ar ħo ên ôn ân uħo;
Crþ Tŋ neŋ es nem.
elo cenvos.";s:g/<:Lu>/{$/.lc~'a'}/;.say

Standard loopholes are forbidden.

Originally, I thought of forbidding letters altogether, but I don't think there are many languages that make this possible. You're more than welcome to try.

(ŋarâþ crîþ [ˈŋaɹa̰θ kɹḭθ] is one of my conlangs. I wanted to capitalise its name here, but I get the ugly big eng here. Oh well, the language doesn't use capital letters in its romanisation anyway.)

Edit: realised that one of the lines is wrong, but I'll keep it since there are already answers. The correct version of the third line is ma a fa ga pa ta ča; at your choice, you may choose to produce the corrected text instead.

7, 410 characters, 154 bytes in 7's encoding, 0 letters = score 154

55104010504200144434451510201304004220120504005434473340353241135014335450302052254241052253052244241052335452241114014241310052340435303052335442302052335500302052335430302052313340435303135014243241310335514052312241341351052302245341351525755102440304030434030421030442030424030455733413512410523142410523030523112411350143355142410523414252410523102410523002410523413342411145257551220304010420030455741403

Try it online!

In a challenge that dislikes using letters, what better language to use than one consisting only of digits?

This is a full program that exits via crashing, so there's extraneous output to stderr, but stdout is correct.

Explanation

A 7 program, on its first iteration, simply pushes a number of elements to the stack (because out of the 12 commands that exist in 7, only 8 of them can be represented in a source program, and those 8 are specialised for writing code to push particular data structures to the stack). This program does not use the 6 command (which is the simplest way to create nested structures, but otherwise tends not to appear literally in a source program), so it's only the 7 commands that determine the structure; 7 pushes a new empty element to the top of stack (whereas the 0…5 commands just append to the top of stack). We can thus add whitespace to the program to show its structure:

551040105042001444344515102013040042201205040054344 7

33403532411350143354503020522542410522530522442410523354522411140142413100523
40435303052335442302052335500302052335430302052313340435303135014243241310335
514052312241341351052302245341351525 7

55102440304030434030421030442030424030455 7

33413512410523142410523030523112411350143355142410523414252410523102410523002
41052341334241114525 7

551220304010420030455 7

41403

The elements near the end of the program are pushed last, so are on top of the stack at the start of the second iteration. On this iteration, and all future iterations, the 7 interpreter automatically makes a copy of the top of the stack and interprets it as a program. The literal 41403 pushes the (non-literal, live code) 47463 (7 has 12 commands but only 8 of them have names; as such, I use bold to show the code, and non-bold to show the literal that generates that code, meaning that, e.g. 4 is the command that appends 4 to the top stack element). So the program that runs on the second iteration is 47463. Here's what that does:

47463
4       Swap top two stack elements, add an empty element in between
 7      Add an empty stack element to the top of stack
  4     Swap top two stack elements, add an empty element in between
   6    Work out which commands would generate the top stack element;
        append that to the element below (and pop the old top of stack)
    3   Output the top stack element, pop the element below

This is easier to understand if we look at what happens to the stack:

… d c b a 47463 (code to run: 47463)
… d c b 47463 empty a (code to run: 7463)
… d c b 47463 empty a empty (code to run: 463)
… d c b 47463 empty empty empty a (code to run: 63)
… d c b 47463 empty empty "a" (code to run: 3)
… d c b 47463 empty (code to run: empty)

In other words, we take the top of stack a, work out what code is most likely to have produced it, and output that code. The 7 interpreter automatically pops empty elements from the top of stack at the end of an iteration, so we end up with the 47463 back on top of the stack, just as in the original program. It should be easy to see what happens next: we end up churning through every stack element one after another, outputting them all, until the stack underflows and the program crashes. So we've basically created a simple output loop that looks at the program's source code to determine what to output (we're not outputting the data structures that were pushes to the stack by our 0…5 commands, we're instead recreating what commands were used by looking at what structures were created, and outputting those). Thus, the first piece of data output is 551220304010420030455 (the source code that generates the second-from-top stack element), the second is 3341351…114525 (the source code that generates the third-from-top stack element), and so on.

Obviously, though, these pieces of source code aren't being output unencoded. 7 contains several different domain-specific languages for encoding output; once a domain-specific language is chosen, it remains in use until explicitly cleared, but if none of the languages have been chosen yet, the first digit of the code being output determines which of the languages to use. In this program, only two languages are used: 551 and 3.

551 is pretty simple: it's basically the old Baudot/teletype code used to transmit letters over teletypes, as a 5-bit character set, but modified to make all the letters lowercase. So the first chunk of code to be output decodes like this:

551  22 03 04 01 04 20 03 04  55
     c  a  SP e  SP n  a  SP  reset output format

As can be seen, we're fitting each character into two octal digits, which is a pretty decent compression ratio. Pairs of digits in the 0-5 range give us 36 possibilities, as opposed to the 32 possibilities that Baudot needs, so the remaining four are used for special commands; in this case, the 55 at the end clears the remembered output format, letting us use a different format for the next piece of output we produce.

3 is conceptually even simpler, but with a twist. The basic idea is to take groups of three digits (again, in the 0-5 range, as those are the digits for which we can guarantee that we can recreate the original source code from its output), interpret them as a three-digit number in base 6, and just output it as a byte in binary (thus letting us output the multibyte characters in the desired output simply by outputting multiple bytes). The twist, though, comes from the fact that there are only 216 three-digit numbers (with possible leading zeroes) in base 6, but 256 possible bytes. 7 gets round this by linking numbers from 332₆ = 128₁₀ upwards to two different bytes; 332 can output either byte 128 or 192, 333 either byte 129 or 193, and so on, up to 515 which outputs either byte 191 or 255.

How does the program know which of the two possibilities to output? It's possible to use triplets of digits from 520 upwards to control this explicitly, but in this program we don't have to: 7's default is to pick all the ambiguous bytes in such a way that the output is valid UTF-8! It turns out that there's always at most one way to do this, so as long as it's UTF-8 we want (and we do in this case), we can just leave it ambiguous and the program works anyway.

The end of each of the 3… sections is 525, which resets the output format, letting us go back to 551 for the next section.


Row of natural numbers Definition

There is infinite row of concatenated natural numbers (positive integers, starting with 1):

1234567891011121314151617181920212223...

Challenge

Write program in any language, that accepts position number as an input, and outputs digit from that position in the row defined above.
Position number is arbitrary size positive integer. That is first position is 1, yielding output digit '1'
Input is either in decimal (eg. 13498573249827349823740000191), or e-notation (eg. 1.2e789) corresponding to positive integer.
Program has to end in reasonable time (10 seconds on modern PC/Mac), given very large index as an input (eg. 1e123456 - that is 1 with 123456 zeroes). So, simple iteration loop is not acceptable.
Program has to terminate with an error in 1 s, if given any invalid input. Eg. 1.23e (invalid), or 1.23e1 (equals to 12.3 - not an integer)
It's ok to use public BigNum library to parse/store numbers and do simple mathematical operations on them (+-*/ exp). No byte-penalty applied.
Shortest code wins.

TL;DR

Input: bignum integer
Output: digit at that position in infinite row 123456789101112131415...

Some acceptance test cases

in notation "Input: Output". All of them should pass.

1: 1
999: 9
10000000: 7
1e7: 7  (same as row above)
13498573249827349823740000191: 6
1.1e10001: 5
1e23456: 5
1.23456e123456: 4
1e1000000: 0
1.23e: error (invalid syntax)
0: error (out of bounds)
1.23e1: error (not an integer)

Bonus!

Output digit position number inside the number, and output number itself.
For example:

13498573249827349823740000191: 6 24 504062383738461516105596714

That's digit '6' at position 24 of number '504062383738461516105596714'

1e1000000: 0 61111 1000006111141666819445...933335777790000

Digit '0' at position 61111 of 999995-digit long number I'm not going to include here.

If you fulfill the bonus task, multiply size of your code by 0.75

Credit

This task was given at one of devclub.eu gatherings in year 2012, without large number requirement. Hence, most answers submitted were trivial loops.

Have fun!

CJam, 78 bytes
r_A,s-" e . .e"S/\a#[SSS"'./~'e/~i1$,-'e\]s"0]=~~_i:Q\Q=Qg&/
s,:L{;QAL(:L#9L*(*)9/-_1<}g(L)md_)p\AL#+_ps=

The program is 104 bytes long and qualifies for the bonus.
The newline is purely cosmetic. The first line parses the input, the second generates the output.
Try it online!
Idea
For any positive integer k, there are 9×10k-1 positive integers of exactly k digits (not counting leading zeroes). Thus, if we concatenate all of them, we obtain an integer of 9×n×10k-1.
Now, concatenating all integers of n or less digits yields an integer of

digits.
For a given input q, we try determine the highest n such that the above expression is smaller than q. We set n := ⌈log10q⌉-1, then n := ⌈log10q⌉-2, etc. until the desired expression becomes smaller than q, subtract the resulting expression from q (yielding r) and save the last value of n in l.
r now specifies the index in the concatenation of all positive integers of l+1 digits, which means that the desired output is the r%(l+1)th digit of the r/(l+1)th integer of l+1 digits.
Code (input parsing)
r_          e# Read from STDIN and duplicate.
A,s-        e# Remove all digits.
" e . .e"S/ e# Push ["" "e" "." ".e"].
\a#         e# Compute the index of the non-digit part in this array.

[SSS"'./~'e/~i1$,-'e\]s"0]

            e# Each element corresponds to a form of input parsing:
            e#   0 (only digits): noop
            e#   1 (digits and one 'e'): noop
            e#   2 (digits and one '.'): noop
            e#   3 (digits, one '.' then one 'e'):
            e#     './~    Split at dots and dump the chunks on the stack.
            e#     'e/~    Split the and chunks at e's and dump.
            e#     i       Cast the last chunk (exponent) to integer.
            e#     1$      Copy the chunk between '.' and 'e' (fractional part).
            e#     ,-      Subtract its length from the exponent.
            e#     'e\     Place an 'e' between fractional part and exponent.
            e#     ]s      Collect everything in a string.
            e#   -1 (none of the above): push 0

~           e# For s string, this evaluates. For 0, it pushes -1.
~           e# For s string, this evaluates. For -1, it pushes 0.
            e# Causes a runtime exception for some sorts of invalid input.
_i:Q        e# Push a copy, cast to Long and save in Q.
\Q=         e# Check if Q is numerically equal to the original.
Qg          e# Compute the sign of Q.
&           e# Logical AND. Pushes 1 for valid input, 0 otherwise.
/           e# Divide by Q the resulting Boolean.
            e# Causes an arithmetic exception for invalid input.

Code (output generation)
s,:L     e# Compute the number of digits of Q and save in L.
{        e# Do:
  ;      e#   Discard the integer on the stack.
  Q      e#   Push Q.
  AL(:L# e#   Push 10^(L=-1).
  9L*(   e#   Push 9L-1.
  *)     e#   Multiply and increment.
  9/     e#   Divide by 9.
  -      e#   Subtract from Q.
  _1<    e#   Check if the difference is non-positive.
}g       e# If so, repeat the loop.
(        e# Subtract 1 to account for 1-based indexing.
L)md     e# Push quotient and residue of the division by L+1.
_)p      e# Copy, increment (for 1-based indexing) and print.
\AL#+    e# Add 10^L to the quotient.
_p       e# Print a copy.
s        e# Convert to string.
2$=      e# Retrieve the character that corresponds to the residue.


Tell me my console dimensions! Output terminal dimensions (columns and rows) in any two-number decimal format*. For example, an output could be 80x25.

Inspiration. Prompt.
* Output must have both measures on a single or two consecutive lines, and there may be no more than one leading and/or trailing line of output (optionally followed by a newline). The (up to four) lines must be no longer than max(cols,1+len(str(cols))+len(str(rows))).


Day of the week of an ambiguous date Goal

Write a program or function that returns the day of the week for a date, eg.

01/06/2020  ->  Mon

However, it's unknown if the date is in the format mm/dd/yyyy or dd/mm/yyyy.  If you can be certain of the day of the week, return it.  If there is uncertainty, return an error.

02/07/2020  ->  Err  (Thu? Fri?)

Input

A date in the format #/#/####.

The numbers can optionally have leading zeros.
The year should be read verbatim, assume that 19 = 19 AD, not 19 = 2019 AD.
The separators can be any non-digit character.
Assume the input date is valid in at least one format (ie. not 13/13/2020).
At a minimum, support dates from 2000 through 2030 (which are likely covered by any modern OS and language with a date library.)

Requirements

If the first and second numbers:

are the same (03/03/2020), the date is unambiguous.
either is greater than 12 (13/09/2020, 09/13/2020), the date is unambiguous.
are different and both 12 or less (09/11/2020), the date is ambiguous.

Output

If the date is unambiguous, return the day of the week.
If the date is ambiguous:

If both versions of the date have the same day of the week, return the day of the week.
If both versions of the date have a different day of the week, return an error.

A day of the week should be returned as a string of the day's three-letter abbreviation ("Mon"), case-insensitive.
An error should be returned as any other three-character string, not all whitespace, eg. "Err", "NaN", "???".

Test Cases

02/07/2020  ->  Err
01/06/2020  ->  Mon
05/05/2020  ->  Tue
24/06/2020  ->  Wed
05/09/2030  ->  Thu
03/13/2020  ->  Fri
29/02/2020  ->  Sat
03/12/2000  ->  Sun

Scoring

The code with the least byte count in a week wins the tick.

Bash + GNU utilities, 97 96 93 85 80 76 73 58 56 51 bytes

(${d=date +%a -d$3-}$1-$2;$d$2-$1)|uniq|sed N\;cErr

Try it online!

5 bytes off thanks to user41805, who pointed out that I could use sed's c command instead of the final s command.

2 bytes off thanks to Nahuel Fouilleul. (Nahuel also helped by shaving 4 bytes off in an earlier version that has since been revamped.)

When I noticed that the separators can be any non-digit character, I changed the code to use spaces as the separator.

This is called with a command like

checkdate 01 06 2020

The output is on stdout.  (There's spurious output on stderr.)


Find the shortest bracket numbers Bracket numbers provide a simple way to express large integers using only left bracket, space, and right bracket ([ ]).
A bracket number is defined as a string of one or more pairs of matching brackets [...] called chunks, each separated from its neighbors by zero or more spaces.
The number of spaces between each chunk defines the hyperoperation between them. No spaces means addition, 1 space means multiplication, 2 spaces means exponentiation, 3 spaces means tetration, and so on. Higher order hyperoperations take precedence, so tetration occurs before exponentiation, exponentiation occurs before multiplication, etc. They are also right-associative, so a^b^c is computed as a^(b^c). (But a^b*c is still (a^b)*c.)
Each chunk may either be empty ([]) or contain another bracket number. Empty chunks have the value 0.  Non-empty chunks have the value of their contained bracket number plus 1.
Examples: (^^ is tetration, ^^^ is pentation)

[[]] has value 1 because it is 0 ([]) incremented by 1
[[[]]] has value 2 but so does [[]][[]] since the two ones ([[]]) are added
[[[]]] [[[[]]]  [[[[]]]]][[[]]] has value 20 = (2*((2^3)+1))+2
[[[]]]    [[[[]]]] has value 65536 = 2^^^3 = 2^^(2^^2) = 2^^4 == 2^(2^(2^2))
[[[[]]]]    [[[]]]    [[]] has value 7625597484987 = 3^^^(2^^^1) = 3^^^2 = 3^^3 = 3^(3^3)

In valid bracket numbers:

There will never be leading or trailing spaces.
There will always be at least one pair of matching brackets.
All left brackets will have a matching right bracket.
A space will never appear directly to the right of [ nor to the left of ].
The value is always a non-negative integer.

Challenge
Notice that there may be many forms for a bracket number that give the same value. [[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]] and [[[]]]   [[[[]]]] both represent 16, but the latter is much shorter.
Your challenge is to write an algorithm that attempts to find the shortest bracket number representation of a given value. For example, I believe the shortest way to represent 16 is with 17 characters as [[[]]]   [[[[]]]].
Scoring (Updated)
Let S be the set of integers from 1 to 256 (inclusive) as well as the following ten values:
8191 13071 524287 2147483647 1449565302 1746268229 126528612 778085967 1553783038 997599288

(The first 4 are Mersenne primes, the rest are random.)
The submission that generates the shortest set of bracket numbers for everything in S will win. Your score is the sum of the lengths of your bracket numbers for all values in S (smaller is better).
With your code please submit a list of your bracket numbers for all of S, the exact order is not terribly important. e.g.:
1=[[]]
2=[[[]]]
3=[[[[]]]]
...
2147483647=[...]
...

(I know this is not the optimal scoring method but I am not set up to run a bunch of random heuristic tests on each submission. Sorry :( )
Rules

You may not hardcode any bracket numbers besides the trivial incremental solutions ([], [[]], [[[]]], ...). Your program must actually be looking for optimally short representations. (Though the results may be suboptimal.)
Your algorithm should work for all non-negative integers below 2,147,483,648 (2^31). You may not specifically focus on the values in S.
For any particular input, your algorithm should run in at most 10 minutes on a decent modern computer (~2.5Ghz processor, ~6GB RAM).
In the (seemingly) rare chance of a tie the highest voted submission wins.
If you copy another solution or revise it without attribution you will be disqualified.


Print a bunch of uninteresting numbers! An uninteresting number (which I totally didn't make up only for this challenge) is created like this:

  Take a positive integer N
  Create a new number O by adding the digits of N at the end of N
  The final uninteresting number is O*N

For example for N=12:

  O = 1212
  O*N = 1212 * 12
  Final number is 14544

Input

A positive integer N (N > 0) or your language's equivalent. You don't have to catch incorrect input.

Output

The corresponding uninteresting number.

Test cases

  1 -> 11
  2 -> 44
  3 -> 99
 10 -> 10100
174 -> 30306276

Scoring

Shortest Code in Bytes wins.

05AB1E, 3 bytes
Ð«*

Explained
Ð    # triplicate input
 «   # conactenate
  *  # multiply

Try it online


Adding without using a + or - sign There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging.

The Challenge

You are to write a program that takes two natural numbers (whole numbers > 0) from STDIN, and prints the sum of the two numbers to STDOUT. The challenge is that you must use as few + and - signs as possible. You are not allowed to use any sum-like or negation functions.

Examples

input

123
468

output

591

input

702
720

output

1422

Tie Breaker:
If two programs have the same number of + and - characters, the winner is the person with fewer / * ( ) = . , and 0-9 characters.

Not Allowed: Languages in which the standard addition/subtraction and increment/decrement operators are symbols other than + or - are not allowed. This means that Whitespace the language is not allowed.

R (24 characters)
length(sequence(scan()))

What this does:

scan reads input from STDIN (or a file)
sequence generates integer sequences starting from 1 and concatenates the sequences.  For example, sequence(c(2, 3)) results in the vector 1 2 1 2 3
length calculates the number of elements in the concatenated vector

Example 1:
> length(sequence(scan()))
1: 123
2: 468
3:
Read 2 items
[1] 591

Example 2:
> length(sequence(scan()))
1: 702
2: 720
3:
Read 2 items
[1] 1422


Word Changer Reachability Word changer is a game where you are trying to turn one word into another via single-character edits, with each step being its own word. For this challenge, edits may be replacements, insertions, or deletions. For example, WINNER → LOSER can be done with this route (there may be others):

WINNER
DINNER
DINER
DINE
LINE
LONE
LOSE
LOSER

Phrased another way, you must be able to reach one word from the other going only through other words at a Levenshtein distance of 1 each time.

Coding

You will be given a word list and two words and you must output a valid route from one word to the other if a route exists or a distinct constant value or consistent behavior if no route exists.

You may assume that the input words are both in the word list
The word list can be taken in via any convenient flat format.

Lists, sets, tries, space-separated strings, and line-separated files are all valid (for instance), but a pre-computed graph of Levenshtein adjacency is not.

The output route should include both input words, but which starts and ends doesn't matter.
If no route is found, you can output a specific constant, a falsy value, empty list, throw an exception, exit with a nonzero code, or any other behavior that happens in finite time.
The route does not need to be optimal and there is no requirement of which route should be taken
Computational complexity does not matter, however your program must be provably guaranteed to terminate in a finite amount of time. (even if it would run beyond the heat death of the universe)
You may assume all words are entirely composed of letters in the same case

Example Test Cases

CAT → DOG; [CAT, DOG, COG, COT, FROG, GROG, BOG]

CAT, COT, COG, DOG

BATH → SHOWER; [BATH, SHOWER, HATH, HAT, BAT, SAT, SAW, SOW, SHOW, HOW]

No Route Found

BREAK → FIX; [BREAK, FIX, BEAK, BREAD, READ, BEAD, RED, BED, BAD, BID, FAD, FAX]

BREAK, BREAD, BEAD, BAD, FAD, FAX, FIX

BUILD → DESTROY; [BUILD, DESTROY, BUILT, GUILT, GUILD, GILD, GILL, BILL, DILL, FILL, DESTRUCT, STRUCTURE, CONSTRUCT]

No Route Found

CARD → BOARD; [CARD, BOARD, BARD]

CARD, BARD, BOARD

DEMON → ANGEL; [DEMON, ANGEL]

No Route Found

LAST → PAST; [LAST, PAST, BLAST, CAST, BLACK, GHOST, POST, BOAST]

LAST, PAST

INSERT → DELETE; This word list

INSERT, INVERT, INVENT, INBENT, UNBENT, UNBEND, UNBIND, UNKIND, UNKING, INKING, IRKING, DIRKING, DARKING, DARLING, ARLING, AILING, SIRING, SERING, SERINE, NERINE, NERITE, CERITE, CERATE, DERATE, DELATE, DELETE

05AB1E, 23 21 20 bytes

Prints a list of valid routes.
Saved 2 bytes thanks to Kevin Cruijssen.

æ€œ€`ʒü.LP}ʒ¬²Qsθ³Q*

Try it online!


Brainf*** code golf challenge - write a Brainf*** program that searches for the first non-zero cell The challenge is to write a brainf*** program that searches sequentially through memory for the first NON-zero cell.

The program should start somewhere in fairly low memory (there will probably be some overhead/counters/etc.). Once the program starts checking cells, it should continue to the right, checking every cell in sequence until it reaches the first non-zero cell, then stop.

Testing will be performed for several random cells and values. Examples might look like: m(13) = 1, or m(144) = 137, or m(983) = 231. The actual values will be randomly generated once and used for all entries. The cell values of 1 and 255 will also be tested.

Scoring - different from the usual
- code golf, lowest score wins
- in the case of a tie, earlier entry wins
- any continuous series of identical commands that changes pointer position or cell value counts as 1 point.

>                           1 point
> >                         1 point
> > > > > > > > > > > > > > > > > > > > > > > > > > 1 point
< < < < < < < < < < <       1 point
+ + + + + +                 1 point
- -                         1 point

[       opening a loop = 1 point

]       closing a loop required, so 0 points

one point for EACH input or output
. .             2 points
. . . . . .     6 points
,               1 point
, ,             2 points (not that anyone would ever do this)

The python 3 program I will use for scoring is found here:
http://pastebin.com/RJi72BHa

11 24 Points
Edit: Now, we do not change the value that is there and do not output it. This now behaves as expected for 255 as well.
+[-[[-<<+>>]<<+>>-<]>+]-<<[->>+<<]>>

This program searches for the first non-zero byte and exits. We expect the first value pointed at to be 0, and we require that the pointer be at least at cell 1 to begin with ("The program should start somewhere in fairly low memory").
Here's a little test, no funky interpreter required:
[ Search for the first non-zero cell            ]
[ http://codegolf.stackexchange.com/q/54432/31054   ]

[We require moving one cell to the right from the left end ] >

[Testing code: ]
>>>>>>>>> [... any number of > ...] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[ASCII code '0'] ++++++[-<++++++++>]
<<<<<<<<< [... the same number of < ...] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

[Find it and stop:  ]
+[-[[-<<+>>]<<+>>-<]>+]-<<[->>+<<]>>

>[Output, for checking: ]<
.

Example run:
~ Me$ bf f.bf
0


Generate a 5-pointed star Your challenge is generate a 5 pointed star like below. The star doesn't need to be filled.
Shortest code wins.

PHP, 1 character
Although very short it will probably not become the accepted answer.
☆

(this is U+2606). May work also in other languages (untested).


Your very own "for" instruction Your very own "for" instruction

Assuming you have the following input : a, b, c, d

Input can be in one-line using any format "a/b/c/d" or "a,b,c,d" etc..

You can also have 4 inputs.

You must code the following behaviour (pseudo-code here) :

var i = <a>
while (i <b> <c>)
    print i
    i = i + <d>
    print "\n"

Here are some tests cases :

input : 1,<,10,1
output :
1
2
3
4
5
6
7
8
9

One more :

input : 20,>,10,1
output :
20
21
22
23
24
25
26
27
...
infinite loop / program crashes

a is an integer, the initial value of i.
b is a string or a char, it can't be something else, the comparator used in the ending condition of the
for loop.

b can and must be one of the following strings :

- ">"
- "<"

c is an integer, the number used in the ending condition of the for
loop.
d is an integer that is added to i at every loop.

This is code-golf, the shortest answer wins !

JavaScript (ES6),  44  43 56 bytes

Saved 1 byte thanks to ETHproductions
Edit: fixed to comply with output requirements

(a,b,c,d)=>{for(s='';eval(a+b+c);a+=d)s+=a+`
`;alert(s)}

Test

let f =

(a,b,c,d)=>{for(s='';eval(a+b+c);a+=d)s+=a+`
`;alert(s)}

f(1,'<',7,2)


Write an interpreter for my new programming language I have a new programming language called Brussels-Sprout. Brussels-Sprout functions in an array of 256 boolean values, all initialized to zero, has one instruction pointer, and one "bit index".

After each (non-branching) instruction is executed, the instruction pointer is incremented by one. If the instruction pointer goes off the right side of the instruction array, the program terminates. Going off the left side is undefined behavior.

If the bit index is outside the bounds of the array, it should be reset to 0.

Brussels-Sprout uses the following keywords, which are always lowercase:

chew - Invert the value in the array at the bit index. (flip the bit at the bit index)

swallow - Increment the bit index.

vomit - Decrement the bit index.

complain - Output the bit at the bit index to stdout, or equivalent output log.

feedtodog - If the bit at the bit index is 0, skip the next instruction. Otherwise, increment instruction pointer by 1.

playwithfood - If the bit at the bit index is 1, jump backwards 2 instructions. Otherwise, increment instruction pointer by 1.

If an instruction not on this list is executed, undefined behavior occurs.

I'm sure that this sounds like a very certain other turing-tarpit programming language. But since this programming language operates in boolean values and not bytes, I think it is different.

Test cases:

chew complain -> 1
swallow chew swallow chew swallow vomit complain playwithfood -> 11
chew complain swallow chew complain swallow chew complain swallow complain -> 1110
chew feedtodog undefinedbehaviour complain -> 1

Your challenge is to write an interpreter for Brussels-Sprout. This is code golf, so shortest program wins!

Python 3 2, 200 187 149 146 136 bytes
-9bytes thanks to Cyoce
def f(n,a=[0]*256,x=0,z=0):
 while 1:y=a[z];exec'a[z]^=~1 z+=1 z-=1 print-y/2 if~y:x+=1 if~~y:x-=3'.split()["wlipdy".find(n[x][3])];x+=1

Input as list, exits by error. Bonus feature: you can specify start array, start IP, and start DP in that very exact order.


Sums of Consecutive Integers Before anyone says anything, similar and similar. But this is not a dupe.

Some positive integers can be written as the sum of at least two consecutive positive integers. For example, 9=2+3+4=4+5. Write a function that takes a positive integer as its input and prints as its output the longest sequence of increasing consecutive positive integers that sum to it (any format is acceptable, though -5 bytes if the output is the increasing sequence separated by + as shown above. If there exists no such sequence, then the number itself should be printed.

This is code golf. Standard rules apply. Shortest code in bytes wins.

Samples (note that formatting varies)

Input:   9
Output:  2,3,4

Input:   8
Output:  8

Input:   25
Output:  [3,4,5,6,7]

Python, 67 bytes

f=lambda n,R=[1]:n-sum(R)and f(n,[R+[R[-1]+1],R[1:]][sum(R)>n])or R

An oddly straightforward strategy: search for the interval R with the right sum.

If the sum is too small, shift the right endpoint of the interval up
one by appending the next highest number.
If the sum is too large, shift up the left endpoint by removing the smallest element
If the sum is correct, output R.

Since the bottom end of the interval only increases, longer intervals are found before shorter ones.


Python 3 - Tried Golfing My Assignment Note: This isn't as much a golfing challenge; it is more so asking for golfing suggestions.

Recently I had a Python assignment for my web development class, in order to check whether we could code. Since I already feel comfortable in Python, I decided to try and golf it, and I was wondering if people could point out things that I missed.

I already know that there are extra spaces in some places, but I'm more interested in conceptual things, like using while r: when r is a variable, and then waiting for it to "run out"!

The assignment

import random
from collections import Counter
s=l=''
c=['yellow','blue','white','green','Black', 'purple', 'silver', 'cyan', 'magenta', 'red']
n=[10,15,1,10,6,15,10,25,1,12,5,10,4,6,5,12,0,10,1,1]
o=i=0
for y in c:l+=y[0]*(random.randint(n[o],n[o+1]));o+=2
l=list(l)
print("Welcome to the CIMS Gumball Machine Simulator\nYou are starting with the following gumballs:")
for b in c:print(str(l.count(b[0])) + " "+b);random.shuffle(l)
print("Here are your random purchases:")
while 'r' in l:
    random.shuffle(l); r=l.pop(); s+=r
    for j in c:
        if j[0] == r:print(j.capitalize())
print("You purchased %i gumballs, for a total of $%.2f \nMost common gumball(s):" % (len(s),len(s)*25/100))
a=Counter(s).most_common()
m=[x[1] for x in a]
while m[0] == m[i]:
    for j in c:
        if j[0] == a[i][0]:print(j.capitalize(), end=" ")
if(i<(len(m)-1)):i+=1
else:break

Also: I'm sorry if this isn't an appropriate question for the code golf page, since it is not a challenge and will remove it on request.

Here's a whole bunch of micro-optimisations you can do:

Use .split() to create a long list (-17 bytes):

c=['yellow','blue','white','green','Black', 'purple', 'silver', 'cyan', 'magenta', 'red']
c='yellow blue white green Black purple silver cyan magenta red'.split()

Remove extraneous brackets (-2 bytes):

l+=y[0]*(random.randint(n[o],n[o+1]))
l+=y[0]*random.randint(n[o],n[o+1])

Use splat (-2 bytes):

random.randint(n[o],n[o+1])
random.randint(*n[o:o+2])

Use extended iterable unpacking to turn something into a list (-4 bytes):

l=list(l)
*l,=l

Import all the things (-15 bytes):

import random;random.randint;random.shuffle;random.shuffle
from random import*;randint;shuffle;shuffle

Use other functions that can do the same job here (-5 * 2 = -10 bytes):

j.capitalize()
j.title()

print separates by space by default (-11 bytes):

print(str(l.count(b[0])) + " "+b)
print(l.count(b[0]),b)

More unpacking (-3 bytes):

r=l.pop()
*l,r=l

Abuse side-effects (-1 byte, plus indents):

if j[0]==r:print(j.capitalize())
r!=j[0]or print(j.capitalize())

Anything reused and over 5 chars might be worth saving as a variable (-1 byte):

len(s);len(s)
L=len(s);L;L

Simplify fractions (-5 bytes):

len(s)*25/100
len(s)/4

Unary abuse (-4 bytes):

if(i<(len(m)-1)):i+=1
if~-len(m)>i:i+=1

Or the biggest one of all...

Look at your algorithm, and see if it needs changing altogether

from random import*
*s,P,S=print,shuffle
P("Welcome to the CIMS Gumball Machine Simulator\nYou are starting with the following gumballs:")
*l,c,C='yellow blue white green Black purple silver cyan magenta red'.split(),s.count
for x,y,z in zip(c,[10,1,6,10,1,5,4,5,0,1],[15,10,15,25,12,10,6,12,10,1]):n=randint(y,z);l+=[x]*n;P(n,x)
S(l)
P("Here are your random purchases:")
while'red'in l:S(l);*l,r=l;s+=r,;P(r.title())
L=len(s)
P("You purchased %i gumballs, for a total of $%.2f\nMost common gumball(s):"%(L,L/4))
for x in c:C(x)!=max(map(C,c))or P(x.title())

(If you ever find yourself importing Counter in a code-golf, you're probably doing something very wrong...)


Generate Ulam Numbers Given an integer n (where n < 10001) as input, write a program that will output the first n Ulam numbers. An Ulam number is defined as follows:

U1 = 1, U2 = 2.
For n > 2, Un is the smallest integer which is greater than Un-1 that is the sum of two distinct earlier terms in exactly one way.

For example, U3 is 3 (2+1), U4 is 4 (3+1) (note that (2+2) does not count as the terms are not distinct), and U5 is 6, (U5 is not 5 because 5 can be represented as either 2+3 or 4+1). Here are the first few Ulam numbers:

  1, 2, 3, 4, 6, 8, 11, 13, 16, 18, 26, 28, 36, 38, 47, 48, 53, 57, 62, 69, 72, 77, 82, 87, 97, 99

This is code golf, so the shortest entry wins.

CJam, 47 41 37 bytes

li4,1${__m*{_~<\:+*}%$2/z:^$2=+}*1><`

Try it online.

Example run

$ cjam <(echo 'li4,1${__m*{_~<\:+*}%$2/z:^$2=+}*1><`') <<< 26
[1 2 3 4 6 8 11 13 16 18 26 28 36 38 47 48 53 57 62 69 72 77 82 87 97 99]

How it works

This basic idea is the following:

Start with the array A := [ 0 U₁ U₂ ... Uₖ ].
Compute S, the array of all sums x + y such that x,y ∊ A and x < y.
Discard all non-unique sums from S. Since every Ulam number greater than 2 is both the sum of two smaller ones and the sum of zero and itself, this discards the Ulam numbers U₃, U₄, ... Uₖ.
The remaining array is [ U₁ U₂ Uₖ₊₁ ... ], so the next Ulam number is the third smallest element. Append it to A and go back to step 1.

li                                    " Read one integer (I) from STDIN.                  ";
  4,                                  " Push the array A = [ 0 1 2 3 ].                   ";
    1${                        }*     " Do the following I times:                         ";
       __m*                           " Push the Cartesian product A × A.                 ";
           {       }%                 " For each pair (x,y) in A × A:                     ";
            _~<\:+*                   " Compute (x + y) * (x < y).                        ";
                     $2               " Sort the resulting array.                         ";
                       /              " Split it into chunks of length 2.                 ";
                        z             " Transpose the resulting two-dimensional array.    ";
                         :^           " Compute the symmetric difference of its rows.     ";
                           $          " Sort the resulting array.                         ";
                            2=        " Extract its third element.                        ";
                              +       " Push it on the array A.                           ";
                                 1>   " Discard the first element of A (0).               ";
                                   <  " Discard all but the first I elements of A.        ";
                                    ` " Push a string representation of A.                ";


Destroy Them With Lazers Introduction

The arena is a flatland dotted with skyscrapers, which your enemies use for cover. You and your enemies shoot each other with lasers. All of you carry jet packs, allowing flight.

Which enemies can you hit with your laser, and which are hiding?

Problem

First, the size of an arena is given by an integer n on a single line. The following n lines contain n integers per line separated by a space. Each integer represents the height of the building at that location. Each building is a rectangular solid, 1 unit by 1 unit by height units.

Next, your location is given on a single line as three floating point numbers x, y, z.

Finally, the number of enemies are given by an integer m on a single line. The following m lines contain three floating point numbers per line separated by a space. These represent the  x, y, and z coordinates of an enemy. The coordinate system is defined as follows:

x is measured from left to right in the city input
y is measured from top to bottom
z is measured from the ground up

For each enemy, if an unobstructed line can be drawn from you to that enemy, output a positive integer. Otherwise, output a negative integer. Separate outputs with a new line.

Sample Input

Comments, denoted by '#', are present to help you quickly see what each line does. They will not be present in the actual input.

5              # Size of the map
0 0 0 0 0      # Buildings
0 0 0 0 0      # Buildings
4 4 4 4 4      # Buildings
0 0 0 0 0      # Buildings
0 0 0 0 0      # Buildings
2.5 0.0 4.0    # Your location
3              # Number of enemies
2.5 5.0 0.1    # Enemy location
2.5 5.0 5.0    # Enemy location
0.0 2.7 4.5    # Enemy location

Sample output

For the sample input above, we output the following:

-1
1
1

Assumptions

0 < n < 100
0 < m < 100
0 <= x <= n
0 <= y <= n
0 <= z < n
Players will not be located on or inside of a corner, edge, or side of a building
Your line of sight to an enemy will never be tangent to the corner, edge, or side of a building
A player is not an obstruction

Perl, 301 296 282

Edit 2: Actually, competition or not, there is no reason not to golf it a little further. Test it online.

Edit: Couple of parentheses gone, simpler regex to check for non-zero integer.

With newlines and indentation for readability:

sub i{<>=~/\S+/g}
@b=map[i],@r=0..<>-1;
print.1<=>(map{
    @a[1,0,2,4,3]=@a;
    @b=map{$i=$_;[map$b[$_][$i],@r]}@r;
    grep$a[3]
        &&($k=(($x=$_)-$a[0])/$a[3])**2<=$k
        &&pop[sort map@{$b[$_]}[$x-!!$x,$x],
                   ($_=$a[1]+$k*$a[4]),$_-/^\d+$/]
           >=$a[2]+$k*$a[5]
    ,@R=@r
}@a=map$_-shift@v,i,@u=@v=@$_),$/for([i])x<>

It requires 5.14 because of scalar (array reference) argument to pop.


PI window encryption This is a simple encryption method that uses PI digits to encode a message, the method is simple:

The key is just a positive integer that indicates where the window starts then:

Given a string to encrypt, containing only lowercase letters, no spaces, you take its length, then you find the Nth digit of PI and then proceeds to shift every letter to the right for the amount indicated by the digit.

For example, if the key is 2 and I want to encode house, I take a window of 5 digits from the second one: 14159 and then it becomes:

h -> i
o -> s
u -> v
s -> x
e -> n

a.- Your program/function/algorithm will receive two parameters, an string composed only of lowercase letters with no spaces and the key, which will be just a positive integer between 1 (1 refers to 3) and 1000, which could be more or less as I'm not quite sure how long does it take to compute PI with said accuracy because:

b.- You must compute PI yourself in your code, here is a neat webpage to compare with: Pi Day. The input should never have you calculate PI beyond the 1000 digit, meaning that length(message)+key <= 1000.

By computing Pi, I mean not harcode it in your code (silly for a code golf) nor use any embedded constant in your code nor any trigonometric identity (2*acos(0)) nor any web reference.

c.- The output will be just the encrypted string.

This is a code golf question, shorter code wins!

I'll be accepting the winning answer at July 14th, 2014.

Python - 370

Ok, nice one, finally got the pi thing working with thanks to link1 and link2.

from decimal import *
def f(s,n):
 j=len(s)
 getcontext().prec=j+n+5
 d=Decimal
 e=d(0)
 for k in range(0,j+n+5):
  e+=(d(16)**(-k)*(d(4)/(8*k+1)-d(2)/(8*k+4)-d(1)/(8*k+5)-d(1)/(8*k+6)))
 c=`e`.split("'")[1].replace('.','')
 t=''
 for i,l in enumerate(s):
  o=ord(l)
  for v in[0,32]:
   if 64+v<o<91+v:
    l=chr(((o-65-v)+int(c[i+n-1]))%26+65+v)
  t+=l
 print t

Example output:

>>> f('house',2)
isvxn

and another:

Wimt fcy d dnyh uhkvkv qhvadil

       >>> f('This was a very secret message',1)


I only pay with dollars As the title -- although discretely -- hints, I only pay with dollars.

The challenge

Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99. Then, return that same amount converted to USD.

Input

You will get a string as input. It will have the currency symbol followed by a number with two decimal places (which could be .00). There will either be decimal points . and/or commas , separating the number. The following currency symbols will come in the inputs:

  Euro: €Pound Sterling: £Yuan Renminbi: ¥

Also, there will be a comma or decimal point depending on the currency to separate the 'dollars' from the 'cents':

  Euro: #.###,##Pound Sterling: #,###.##Yuan Renminbi: #,###.##

Output

You will convert the input from the currency determined by the symbol to USD, rounding to two decimal places. The output will be in the format $#,###.##, and there will of course be more numbers on the left of the output if need be (EDIT: this means that there is an arbitrary number of commas in the output, just like in the input). The currency exchange rate we will be using are below.

You can assume that the input contains a symbol that is only one of the above (€ £ ¥ . ,)--that it is always valid.

Exchange rates

€1 : $1.10
£1 : $1.37
¥1 : $0.15

Examples

Input:
€1,37
£4.00
¥2,782,122.78

Respective output:
$1.51
$5.48
$417,318.42

Final words

If you use one of the above symbols (€, £, ¥), you may count them as 1 byte
This is code golf, so shortest code in bytes wins!

Python 3.6 (pre-release), 87
lambda s:f"${int(s.translate({46:'',44:''})[1:])*[110,15,0,137][ord(s[0])%4]/1e4:,.2f}"

Uses f-strings to evaluate the result and format it.
s.translate({46:'',44:''}) removes dots and commas from s, thus making it a valid int literal, then int(...) converts it into the actual int object.


Insist on a new filename At runtime, keep prompting for a line of input until the user input is not the name of an existing file or directory or other file system item, relative to the current working directory. Then return/print that last inputted filename. You may assume that all user inputs will be valid filenames.

Pseudo-code 1

myform = new form("GUI")
myform.mytxt = new editfield("")
myform.ok = new button("OK")
repeat
  waitfor(myform.ok,"click")
until not filesystem.exists(myform.mytxt.content)
return(myform.mytxt.content)

Pseudo-code 2

LET TEXT = "."
WHILE HASFILE(TEXT) DO
  TEXT = PROMPT("")
ENDWHILE
RETURN TEXT

Examples of user input which will cause re-prompting when on TIO:

.
..
.env.tio
/
/bin/[
/lost+found

Examples of user input which will return when on TIO:

...
env.tio
../../bin/]
/lost/found

Batch, 37 bytes

@set/ps=
@if exist %s% %0
@echo %s%

(For some reason current Windows 10 CMD.EXE corrupts the title when it executes the %0.)


Evaluate the Binomial Coefficient Given two nonnegative integers n,k such that 0 <= k <= n, return the binomial coefficient

c(n,k) := (n!) / (k! * (n-k)!)

Test cases

Most languages will probably have a built in function.

c(n,0) = c(n,n) = 1 for all n
c(n,1) = c(n,n-1) = n for all n
c(5,3) = 10
c(13,5) = 1287

Related challenges

Catalan Numbers  Compute the multinomial coefficient Generate Pascal's triangle m-nomial coefficient

JavaScript (ES6), 27 bytes
f=(n,k)=>k?n*f(n-1,k-1)/k:1


Generate all halting Smallfuck programs of length n Your task is to write a program that, given a number n, returns a list of all valid, halting Smallfuck programs of length n, in any order.

Actually, we're using a variation of Smallfuck called F2, which is just Smallfuck with a right-unbounded tape. For the purposes of this challenge, a program that moves left from the start of the tape is considered invalid, as is one with unbalanced brackets.

Scoring

Since solving this for every n is impossible (as it would require you to solve the halting problem), your submission's score will be the lowest n for which it returns an incorrect answer.

Each submission must be, at most, 1000 bytes (though you are encouraged to provide an ungolfed version as well). In the event of a tie, the earlier answer wins.

Test Cases

n = 1:

+ >

n = 2:

++ +> >+ >< >> []

n = 3:

+++ ++> +>+ +>< +>> >++ >+< >+> ><+ ><> >>+ >>< >>> >[] [+] [<] [>] []+ []>

n = 4:

++++ +++> ++>+ ++>< ++>> +>++ +>+< +>+> +><+ +><> +>>+ +>>< +>>> >+++ >++< >++> >+<+ >+<> >+>+ >+>< >+>> ><++ ><+> ><>+ ><>< ><>> >>++ >>+< >>+> >><+ >><< >><> >>>+ >>>< >>>> [][] ++[] +>[] ><[] >>[] [++] [+<] [+>] [<+] [<<] [<>] [>+] [><] [>>] []++ []+> []>+ []>< []>> +[+] +[>] >[+] >[<] >[>] >[]+ >[]< >[]> [+]+ [+]> [<]+ [<]> [>]+ [>]> [[]]

Please inform me if there are any more that I have forgotten to add.

Java (OpenJDK 8), Score: ???

This clocks in at 980 bytes, since I had so much to work with I decided to make it a little more readable.  Basically I'm generating all the possible programs for length n and iterating them n^x times for some x.  x is currently 3 but it can be modified arbitrarily to any size, limited only by the limitation of the JVM's precission.  This will work for arbitrarily large input values if x is increased, but I have it set to 3 for tio.

import java.util.*;
public class Main{
    public static void main(String[] args){
        int i = new Scanner(System.in).nextInt();
        int x = 3;
        l:for(int j=0;j<Math.pow(5, i);j++){
            try {
                String s="";
                for(int k=j;s.length()<i;k/=5)
                    s="+<>][".charAt(k%5)+s;
                Stack<Integer>y=new Stack<Integer>();
                Map<Integer,Integer>f=new HashMap<>(),b=new HashMap<>();
                for(int m=0; m<s.length();m++){
                    char c=s.charAt(m);
                    if(c=='[')y.push(m);
                    if(c==']'){int n=y.pop();f.put(n, m);b.put(m, n);}
                }
                if(y.size()>0)
                    continue;
                boolean[] t= new boolean[s.length()];
                int l=0,n=0;
                for(long m=0;l<s.length()&m<Math.pow(i,x);l++,m++){
                    switch(s.charAt(l)){
                    case'+':t[n]=!t[n];break;
                    case'>':n++;break;
                    case'<':n--; if(n < 0)continue l;break;
                    case'[':if(!t[n])l=f.get(l);break;
                    case']':l=b.get(l)-1;break;
                    }
                }
                if(l>=s.length()){
                    System.out.println(s);
                }
            } catch(Exception e){continue;}
        }
    }
}

Try it online!


Build a marginal tax calculator There have been some tax rate calculator problems here that depend on defined rates (specifically US federal rates), but none that have done it for arbitrary lists.

Your task is to build a program or function that will take an arbitrary list of marginal tax brackets and calculate the effective amount of tax paid on a given amount of taxable income.

Your program will take as input:

N pairs of numbers in the form (amt, rate), each representing a tax bracket.

amt is the amount of taxable income above which at which the tax rate starts to apply. These amounts will all be integers, and appear in increasing order.
rate is the tax rate, expressed as a decimal percentage from 0 to 100 inclusive.

The amount of taxable income, as a nonnegative integer.

If no rate is specified for $0, the rate is assumed to be 0%.

Alternatively, your program can also take as input two lists (amt1, amt2, ...) and (rate1, rate2, ...), containing the amounts and rates in the same order.

Your program will then output the payable tax, either to two decimal places, or rounded down to the nearest whole currency unit.

An example input (the most recent Canadian tax brackets, from 2016, with the basic personal tax credit applied and nothing else):

11474 15
45282 20.5
90563 26
140388 29
200000 33

393216

And its corresponding output:

108357.07  or  108357

The shortest program in any language to do this wins.

Haskell, 67 66 bytes

Thanks Damien for -1 byte.

This solution is in the form of an infix function, ?, of type (Integral b, RealFrac r) => [(r, r)] -> r -> b. The helper function, #, does the required calculations while ? serves to handle the IO specifications.

a?b=floor$reverse a#b
((m,p):r)#i|v<-min i m=p/100*(i-v)+r#v
_#_=0


My "keybore" is key-boring me! Help me find a minimal keystrokes Credits to @Agawa001 for coming up with this question.

Explanation

My new "keybore" only has 2 buttons, namely + and -.

The number in the memory starts at 0.

Each consecutive press of + or - will increment/decrement the memory for exactly how many times it has been pressed consecutively.

Therefore, if you press + 4 times, first time it adds 1, the second time it adds 2, the third time it adds 3, the fourth time it adds 4, giving you 10 (ten).

Now, if you press - 3 times, the first time it subtracts 1, the second time 2, the third time 3, leaving you with 4 (four).

TL;DR

Given a string of + and -, divide it at each change of character. Then each resulting string of m + symbols adds the m-th triangle number, and each string of n - symbols subtracts the n-th triangle number.

Walk-through

Now, if you still do not understand, I will show you how +++--+-- creates 1.

Program   | Counter | Memory
----------------------------
          |  0      | 0
+         | +1      | 1
++        | +2      | 3
+++       | +3      | 6
+++-      | -1      | 5
+++--     | -2      | 3
+++--+    | +1      | 4
+++--+-   | -1      | 3
+++--+--  | -2      | 1

Task

You will take a positive integer as input, either as functional argument or from STDIN.
Then, you will output/print the minimum number of keystrokes needed to create that number using the method above.

Testcases

Since rearranging the + or - runs gives the same number, for each such group only the lexicographically earliest sequence is listed.

Input | Output | Possible corresponding sequences
-------------------------------------------------
    4 |      5 | -+++-
    6 |      3 | +++
    9 |      5 | ++++-
   11 |      7 | +++-+++
   12 |      7 | +++++--, ++++-++
   19 |      8 | -++++++-
   39 |     12 | +++++++++---
   40 |     13 | +++++++++---+, ++++++++-+++-
   45 |      9 | +++++++++
   97 |     20 | ++++++++++++++--+---, +++++++++++++-++++--, ++++++++++++-++++++-
  361 |     34 | ++++++++++++++++++++++++++-+++-+++

Extra resources

Proof that any number can be made: basically, by repeating ++-, you can obtain any even number. To obtain the odd numbers, just put a + at the end.
Another general way to obtain any number. For example, to generate 50, a way is to press + 50 times, and then press - 49 times.
Solution of the first 50 numbers.
Obligatory JSFiddle.

Scoring

This is code-golf. Shortest solution in bytes wins.

MATL, 43 29 bytes
E:"@TFEqZ^!"@Y'tQ**s]vGE=a?@.

This is memory- and time-inefficient. The online compiler can handle up to input 45 only.
Try it online!
Here's a modified version with all test cases up to 40 (it takes almost a minute in the online compiler).
Explanation
This tests all possible key-press sequences of each length, in order of increasing length, until a valid sequence is found.
E:       % Range [1 2 ... 2*N] where N is implicit input. The required sequence length is
         % less than 2*N, so this is enough
"        % For each
  @      %   Push current value: length of sequence
  TFEq   %   Push array [1 -1]
  Z^     %   Cartesian power. Gives all possible sequences of 1, -1 of that length
  !      %   Transpose. Each sequence is now a row
  "      %   For each sequence
    @    %     Push current sequence
    Y'   %     Run-length decoding: Pushes an array of values 1 and -1, and then an
         %     array of run-lengths
    tQ*  %     Duplicate, add 1, multiply. Gives twice the triangular number for each run
    *    %     Multiply element-wise by 1 or -1 to produce correct sign
    s    %     Sum of array. This is the number produced by the current sequence
  ]      %   End for
  v      %   Concatenate all numbers into an array
  GE=a   %   True if any of those numbers equals twice the input
  ?      %   If so
    @    %     Push current sequence length. This is the final result
    .    %     Break loop
         %   End if
         % End for
         % Implicit display


Double-time is not double time Based on this challenge.
In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%.
Your task, is to write a program that outputs a positive even integer (higher than 0), and when each byte/character (your choice which) in your source code is duplicated, it should output the number multiplied by 1.5.
For example if your source code is ABC and that outputs 6, then AABBCC should output 9.
Following the original challenge's rules:
Rules

You must build a full program.
The initial source must be at least 1 byte long.
Both the integers must be in base 10 (outputting them in any other base or with scientific notation is forbidden).
Your program must not take input (or have an unused, empty input) and must not throw any error (compiler warnings are not considered errors).
Outputting the integers with trailing / leading spaces is allowed.
You may not assume a newline between copies of your source.
This is code-golf, so the fewest bytes in each language wins!
Default Loopholes apply.

I imagine this will be far less trivial than the original challenge, but hopefully we'll see some creative and unique answers!

Pylons, 7 5 4 bytes

Picked a random language on TIO used it

46vt

Explanation:

Try it Online!

46    # Stack is [4, 6]

v     # Reverse the stack [6, 4]

t     # take top of stack 4

Doubled:

4466   # Stack is [4, 4, 6, 6]

vv     # Reverse the stack twice so it's the same [4, 4, 6, 6]

tt     # take top of stack 6 and again which is 6 again

Saved 2 bytes thanks to  officialaimm

Saved 1 bytes thanks to  Veedrac


Let's do some location arithmetic! From the Wikipedia article:

  Location arithmetic (Latin arithmeticæ localis) is the additive (non-positional) binary numeral systems, which John Napier explored as a computation technique in his treatise Rabdology (1617), both symbolically and on a chessboard-like grid.

What?

Location numerals is a way of writing numbers using letters of the alphabet.

  Binary notation had not yet been standardized, so Napier used what he called location numerals to represent binary numbers. Napier's system uses sign-value notation to represent numbers; it uses successive letters from the English alphabet to represent successive powers of two: a = 2^0 = 1, b = 2^1 = 2, c = 2^2 = 4, d = 2^3 = 8, e = 2^4 = 16 and so on.

An example

ab = 1+2 = 3 in base 10

aabb = 1+1+2+2 = 6 in base 10

Note that aabb can be shortened to bc by replacing any 2 instances of a letter by a higher one.

Addition

You just concatenate the two numbers and simplify.

acd + bde = acdbde = abcdde = acebe = abcf = 39 in base 10

Subtraction

Just remove all digits appearing equally in both parts of the subtraction. Expanding (converting b to aa) may be necessary

abde- ad = be = 18 in base 10

Multiplication

This is a bit harder.

Lets say we want to multiply acd (13) by def (56). First you arrange acd vertically:

a
c
d

Then you add def after the first a:

a def
c
d

Now, c is 2 positions later in the alphabet than a, so we add 2 positions in the alphabet to def to make fgh. That is added to the second row.

a def
c fgh
d

Lastly, d is 1 position later in the alphabet than c, so we add 1 position in the alphabet to fgh to make ghi. That is added to the third row.

a def
c fgh
d ghi

Then you take the sum of the right: def + fgh + ghi = deffgghhi = deggghhi = deghhhi = deghii = deghj (728)

Another example of multiplication

Input:

bc * de

First:

b
c

Then

b ef
c

Then

b ef
c fg

Note that we wrote down ef on the first line. That's because bc starts with b, and b is the second letter in the alphabet, so we need to shift de by 1 letter, so it becomes ef.

Then

ef+fg

Output:

eh

Division

This is not part of this challenge, because it can get very complex.

Your actual challenge

Your program or function must take input as a string that looks like this:

a + b

And you must output:

ab

Of course, your program or function must support numbers of arbitrary length (up to the string or input limit of your language) with any of the operators +, -, or *. Some more examples:

Input:

ab + bd

Output:

acd

Input:

d - ab

Output:

ac

Input:

ab * cd

Output:

cf

Notes:

The order of letters in the output doesn't matter, but you can always assume that the order of letters in numbers in the input will be ascending (a before z).
You may take input with a trailing newline and output with a trailing newline.
You may not take input as a list of ab, * and bd for ab * bd.
The english alphabet is used (abcdefghijklmnopqrstuvwxyz)
Your output must be simplified (aa is not allowed, b is required)
The input will be simplified (b + c, not aa + bb or aa + aaaa)
You may require a space before and the operator (+, -, or *), or you may require there to be none.
There will only be one operator per input.
You may assume that the output and the input will never go over 2^27-1 (abcdefghijklmnopqrstuvwxyz)
This is code-golf, so the shortest answer in bytes wins!

JavaScript (ES6), 136 134 133 bytes

Saved 1 byte thanks to Luke

s=>[...a='abcdefghijklmnopqrstuvwxyz'].filter((c,i)=>eval(s.replace(/\w+/g,s=>[...s].reduce((p,c)=>p|1<<a.search(c),0)))&1<<i).join``

Test cases

let f =

s=>[...a='abcdefghijklmnopqrstuvwxyz'].filter((c,i)=>eval(s.replace(/\w+/g,s=>[...s].reduce((p,c)=>p|1<<a.search(c),0)))&1<<i).join``

console.log(f('ab + bd'));  // acd
console.log(f('d - ab'));   // ac
console.log(f('ab * cd'));  // cf


Display the mouse pointer trails... of the future! Inspired by this example of using d3js, I challenge you to create a canvas (or your language-of-choice equivalent) in which the mouse pointer trails will be displayed, with the following twist:

The Twist

You should not display the trails of where the mouse pointer was, but the "trails" of where it will (might) be in future.

You can do it by using either:

A time machine, or
Probabilistic estimations based on previous mouse
movements

Assumptions

In case you didn't choose the time machine implementation, when the mouse does not move for more than threshold milliseconds, you can display none of the trails. (The threshold value is up to you to choose).

The cursor image is up to you and does not have to be the same of the OS's cursor (you can even draw a plain small circles or dots).

No evil input will be tested: You can assume the movements are smooth. 'Smooth' definition for this case is: if the mouse movements were a function over the x and y axis of the canvas - it would be a continuous function.

Winning

The valid answer with the least characters in code will win. In case of a tie - the one that was posted first will win.

EDIT: The valid answer with the most upvotes will win. In case of a tie - the one that was posted first will win. You can be creational on the implementation, or be precise with the prediction. I'm not the judge anymore, we all are :)

A valid answer must include a way for me to play with (test! I meant test), either on an online tool or on a freely-downloadable compiler/interpreter/runtime/etc.

Javascript

My program predicts the direction of the pointer by using the average of the angular change in direction of the last 20 mouse moves.  It also uses the variance of the angular change to create a "cloud" of possible locations and directions of the pointer.  The color of each pointer in the "cloud" is supposed to represent the likelihood of it being the new position of the mouse pointer, where darker colors represents a greater likelihood.  The distance of the pointer cloud ahead of the mouse is calculated using the speed of mouse movement.  It doesn't make the best predictions but it looks neat.

Here's a fiddle: http://jsfiddle.net/5hs64t7w/4/

Increasing the size of the pointer cloud is interesting to see. It can be set by changing the cloudSize variable on the first line of the program. Here is a fiddle with a cloud size of 10: http://jsfiddle.net/5hs64t7w/5/

I used these sources to get formulas for circular mean and variance:
Circular Mean: http://en.wikipedia.org/wiki/Circular_mean
Circular Variance: http://www.ebi.ac.uk/thornton-srv/software/PROCHECK/nmr_manual/man_cv.html

Here is the code if anyone is interested:

    var cloudSize = 3;

    var canvas = document.getElementById('canvas_element');
    var c = canvas.getContext('2d');
    var prevX = -1;
    var prevY = -1;
    var curX = -1;
    var curY = -1;
    var distance = 0;
    var direction = 0;

    function drawMouse(x, y, angle, gray){
        var grayVal = Math.round(gray*255);
        var grayString = "rgb(" + grayVal + "," + grayVal +"," + grayVal + ")";
        c.fillStyle = grayString;
        c.strokeStyle = grayString;
        c.lineWidth = 1;
        c.beginPath();
        c.moveTo(x, y);
        c.lineTo(x + 16*Math.cos(angle + Math.PI/2.0 + Math.PI/8.0), y + 16*Math.sin(angle + Math.PI/2.0 + Math.PI/8.0));
        c.moveTo(x, y);
        c.lineTo(x + 16*Math.cos(angle + Math.PI/2.0 - Math.PI/8.0), y + 16*Math.sin(angle + Math.PI/2.0 - Math.PI/8.0));
        c.lineTo(x + 16*Math.cos(angle + Math.PI/2.0 + Math.PI/8.0), y + 16*Math.sin(angle + Math.PI/2.0 + Math.PI/8.0));
        c.stroke();
        c.fill();
        c.beginPath();
        c.moveTo(x, y);
        c.lineTo(x + 24*Math.cos(angle + Math.PI/2), y + 24*Math.sin(angle + Math.PI/2));
        c.stroke();
    }

    function sum(array){
        var s = 0.0;
        for(var i=0; i<array.length; i++){
            s += array[i];
        }
        return s;
    }

    var sins = [];
    var coss = [];
    var lengths = [];
    var times = [];
    var index = 0;
    var limit = 20;
    var variance = 0;
    var prevTime = new Date().getTime();
    function updateDistanceAndDirection(x, y){
        var angle = Math.atan2(prevY - curY, prevX - curX);
        sins[index] = Math.sin(angle);
        coss[index] = Math.cos(angle);
        lengths[index] = Math.sqrt((curX-prevX)*(curX-prevX) + (curY-prevY)*(curY-prevY));
        var time = new Date().getTime();
        times[index] = time - prevTime;

        variance = 1.0 - Math.sqrt(sum(coss)*sum(coss)+sum(sins)*sum(sins))/sins.length;

        direction = Math.atan2(1/sins.length*sum(sins),1/coss.length*sum(coss));
        var speed = sum(lengths)/(sum(times)/200);
        distance = Math.min(Math.max(40, speed), 100);
        prevTime = time;
        index = (index+1)%limit;
    }

    function drawMice(count){
        c.clearRect(0, 0, canvas.width, canvas.height);

        for(var i=count; i>=0; i--){
            var dir = direction + i*variance;
            drawMouse(curX - distance*Math.cos(dir), curY - distance*Math.sin(dir), dir - Math.PI/2, i/count);
            dir = direction - i*variance;
            drawMouse(curX - distance*Math.cos(dir), curY - distance*Math.sin(dir), dir - Math.PI/2, i/count);
        }
    }

    canvas.onmousemove = function (event) {
        curX = event.clientX;
        curY = event.clientY;

        updateDistanceAndDirection(curX, curY);

        drawMice(cloudSize);

        prevX = curX;
        prevY = curY;
    };


Let's simulate a random snowflake I saw this question on https://mathematica.stackexchange.com/ and I think it's pretty cool. Let's make the snowflake with other programming languages.

This is a quote from the original question:

  'Tis the season... And it's about time I posed my first question on Mathematica Stack Exchange. So, here's an holiday quest for you Graphics (and P-Chem?) gurus.

  What is your best code for generating a (random) snowflake? By random I mean with different shapes that will mimic the diversity exhibited by real snowflakes. Here's a link to have an idea: http://www.its.caltech.edu/~atomic/snowcrystals/ , more specifically here are the different types of snowflakes: http://www.its.caltech.edu/~atomic/snowcrystals/class/class.htm .
  Here we are trying to generate a single snowflake (possibly with different parameters to tune its shape), the more realistic, the better. Three dimensional renderings, for adding translucency and colors are also welcome. Unleash your fantasy, go beyond the usual fractals!

Rules:

Generate a random single snowflake.
The flake should be six-fold radial symmetry.
It doesn't need to be realistic. (But prefer)
Single character answers, like *, ⚹, ❅, ❄, ❆ are not allowed.
Most upvotes wins!


Paths & Wasting Time Premise

So recently I was about half an hour early to an appointment, and decided to wait outside. I also determined that it would look strange if I just stood motionlessly in front of the house. Therefore, I decided to go on a quick walk, within a limited area. I also concluded that if I started walking in circles that would make it obvious that I was loitering. So I was inspired to create my first Code Golf challenge.

Specification

You will be given a list, a map of the area, which will contain either " " or "#", which represent free spaces and obstacles of some sort. Free spaces can only be crossed once, and it takes 1 minute to cross it. Your initial position will be signified with a "@" per roguelike tradition, and the target will be represented with a "$" because that's what you're going to lose there. You will also be given an integer which will represent how many minutes you have to waste before not seeming as if you were intruding. When you land on the "$", it will have to have been the exact amount minutes (so if you were counting down, it will have to be 1 on an adjacent tile, and be 0 on the tile). It will always be possible to reach the destination. Your program or function will have to return a list showing the shortest path with <, >, ^, and v to represent the four possible directions.

Examples

Input:

[[" ", " ", " ", " "],
 ["@", " ", " ", "$"],
 [" ", " ", " ", " "],
 [" ", " ", " ", " "]]

and

5

Ouput:

[[">", ">", ">", "v"],
 ["^", " ", " ", "$"],
 [" ", " ", " ", " "],
 [" ", " ", " ", " "]]

Input:

[[" ", "#", " ", " ", " "],
 [" ", "#", " ", " ", " "],
 ["@", "#", " ", "$", " "],
 [" ", " ", " ", " ", " "],
 [" ", "#", " ", " ", " "],
 [" ", "#", " ", " ", " "]]

and

7

Output:

[[" ", "#", " ", " ", " "],
 [" ", "#", ">", "v", " "],
 ["v", "#", "^", "$", " "],
 [">", ">", "^", " ", " "],
 [" ", "#", " ", " ", " "],
 [" ", "#", " ", " ", " "]]

Input:

[[" ", "#", " ", " ", " "],
 [" ", "#", " ", " ", " "],
 ["@", "#", " ", "$", " "],
 [" ", " ", " ", " ", " "],
 [" ", "#", " ", " ", " "],
 [" ", "#", " ", " ", " "]]

and

17

Output:

[[" ", "#", " ", "v", "<"],
 [" ", "#", " ", "v", "^"],
 ["v", "#", " ", "$", "^"],
 [">", ">", "v", ">", "^"],
 [" ", "#", "v", "^", "<"],
 [" ", "#", ">", ">", "^"]]

Rules

Standard loopholes apply
Each tile must only be moved over once
The exact amount of time must be spent on the board
Only one path needs to be displayed in the case of multiple paths
This is a code golfing question so shortest answer wins
As per user202729's question in the comments, you may assume valid input.

Add a comment if any further clarification is required

JavaScript (ES6), 171 bytes
Takes input in currying syntax (a)(n). Outputs by modifying the input matrix.

a=>g=(n,y=a[F='findIndex'](r=>~(i=r[F](v=>v>'?'))),x=i,R=a[y])=>!n--|[-1,0,1,2].every(d=>(R[x]='<^>v'[d+1],(c=(a[Y=y+~-d%2]||0)[X=x+d%2])<1?g(n,Y,X):n|c!='$')&&(R[x]=' '))

Try it online!
Commented
a =>                           // a[] = input matrix
g = (                          // g = recursive function taking:
  n,                           //   n = number of remaining moves
                               //   (x, y) = current coordinates, initialized as follows:
  y = a[F = 'findIndex'](r =>  //     y = index of the row containing the starting point,
    ~(i = r[F](v => v > '?'))  //         found by iterating over all rows r until we
  ),                           //         find some i such that r[i] > '?'
  x = i,                       //     x = index of the column of the starting point
  R = a[y]                     //   R[] = current row
) =>                           //
  !n-- |                       // decrement n; force failure if we're out of moves
  [-1, 0, 1, 2].every(d =>     // for each direction d, where -1 = left, 0 = up,
    (                          // 1 = right and 2 = down:
      R[x] = '<^>v'[d + 1], (  //   update the current cell with the direction symbol
        c = (                  //   c = content of the new cell at (X, Y) with:
          a[Y = y + ~-d % 2]   //     Y = y + dy
          || 0                 //     (use a dummy value if this row does not exist)
        )[X = x + d % 2]       //     X = x + dx
      ) < 1 ?                  //   if c is a space:
        g(n, Y, X)             //     we can go on with a recursive call
      :                        //   else:
        n | c != '$'           //     return false if n = 0 and we've reached the target
    ) &&                       //   unless the above result is falsy,
    (R[x] = ' ')               //   restore the current cell to a space
  )                            // end of every()


Valid snakes on a plane Inspired by one of Vi Hart's videos (which are a treasure trove full of potential challenge ideas)

A snake is made up of segments of same length and the connection between each segment can be straight or make a 90° turn.
We can encode such a snake (up to a rotation, which depends on the initial direction) by writing down a slither, the direction of turns (Straight/Left/Right) it takes. This one, starting in the top left and pointing to the right

-+    +--+    SR    RSSR
 |  +-+  |     S  RSL  S
 +--+  --+     LSSL  SSR

Would be represented by the slither SRSLSSLRLRSSRSRSS

And of course a planar snake cannot intersect itself (like in SSSSLLLSS), that would result in a horrible pixelated Game Over.

Your task is to determine whether a slither is valid or not (results in at least one self-intersection)

Input
A string made from letters SLR with 2 < length < 10000
Output
Something Truthy if it is a valid slither and something Falsey if its not.

Test cases

__Valid__
SSLSLSRSRSSRSSSLLSSSRRLRSLRLLSSS
SRRLSLLRRLLSLRRSRLLRSRRLLRRSRLLSSLLRSRRLLRRSRLLRSRRLSLLRRLLSLRR (A hilbert curve)
RLLRSRRLSLLRRLLSLRRSRLLRSRRLLRRSRLLSSLLRSRRLLRRSRLLRSRRLSLLRRLLSLRRSRLLRSRRLLRRSRLLSSLLRSRRLLRR
SRRSRSRSSRSSRSSSRSSSRSSSSRSSSSRSSSSSRSSSSSRSSSSSSRSSSSSSRSSSSSS (Spiral)
SSSSSSSSSSLSSSSSSSLSSSSSSSSLSSSSSLSSSSSSLSSSLLRRLLRRLLSLSSSRRSSSSRSSSRSSSSSSRSSSSSRSSSSSSSSRSSSSSSSRSSSSSSSSS (bigger, squigglier spiral)
LRSLLRLSRSLLSRLSLRSLSSSLRRSSLSRRLRSRLRLSLRLLRLRSSLSLRLRSRSSSSSLSRRLSLSSSRRLRLRLRLRRLLSSLSSSRRLRLRLRLRLSLSSSSSSSSSSSSSRLRLLRLRLRLRLRLRLRLSLSSSLSLSLL

__Invalid__
SRRLSLLRRLLSLRRSRLLRSRRLLRRSRLLLLRSRRLLRRSRLLRSRRLSLLRRLLSLRR
SRRLSLLRRLLSLRRSRLLRSRRLLSRSSSRSSSSSSSRSRSSSSSSSRRLLRRSRLLRSRRLSLLRRLLSLRR
SRRSRSRSSRSSRSSSRSSSRSSSSSSSSSSRSSSSRSSSSSRSSSSSRSSSSSSRSSSSSSRSSSSSS
SSSSSSSSSSLSSSSSSSLSSSSSSSSLSSSSSLSSSSSSLSSSLLRRLRLRRLLSLSSSRRSSSSRSSSRSSSSSSRSSSSSRSSSSSSSSRSSSSSSSRSSSSSSSSS
LRSLLRLSRSLLSRLSLRSLSSSLRRSSLSRRLRSRLRLSLRLLRLRSSLSLRLRSRSSSSSLSRRLSLSSSRRLRLRLRLRRLLSSLSSSRRLRLRLRLRLSLSSSSSSSSSSSSSRLRLLRLRLRLRLRLRLRLSLSSSLSLSLLSLRLSLRSLRSLRSLSLSLRSRLSLRSLRLSRSLLLRLRLRRRRSLSLSSLLSLSLSLSSLLSLSLLRLRSLLRSRLSLSSLLLLSSSSSSSSSSSSSSSSSSSSRLRLLRRLRLRLLRLRLRLRLRLSSSSLSLRLLRLSLSSLSLSLSLSLRLLRLSLLLSRSSSSSSSSSSSSSSSRLRLRLLRLRLSLSRSRSSSLSRLRLRLRSLSLSLSRLLSRLSLSLSLSLSSLSLSLLSLSRLLRLRLRLRLRLRLRLRLRLRLSLSRLRLSLLRRLSLLSLSLSLSLSLLSLSLSLRLRLRLRLRLRLRLRLRLRRLRSLSLSLSLSLSLSLSSLSSSSSLSLSSSLSLSLSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS

You can draw the slithers here (R and L are flipped, but it doesnt affect validity)

Pyth, 22 20 bytes

ql{m+=Z*=T^.j)hCdzlz

Try it yourself or run the testsuite.

Note the ASCII values of SRL, respectively 83, 76, 82. I abuse the fact that:

  i 83 + 1 = 1
  i 76 + 1 = i
  i 82 + 1 = -i

From here I just keep a variable for the current position and current direction. For every character I multiply the current direction with the above complex number, then add it to the current position.

At the end I check if all the visited positions are unique.


Convert header levels to numbers Introduction

Nodes in tree structures (e.g. headings in a long document, law paragraphs, etc.) are often created by assigning a specific header level (h1, h2, etc.) to each item, but outputted with additional node numbers for each level (1., 1.1., etc.), e.g.:

1. Intro (h1)
1.1. About this (h2)
1.2. Target audience (h2)
2. Actual stuff (h1)
3. More stuff (h1)
3.1. Details (h2)
3.1.1. Special points (h3)
3.2. Specifics (h2)
3.2.1. Minutiae (h3)
3.2.2. Petitesses (h3)
3.3. Specifications (h2)
4. Index (h1)
5. Appendices (h1)

Input

Given (by any means) a list of header levels (the X's in hX above) like:

[1,2,2,1,1,2,3,2,3,3,2,1,1]

Input will always begin with a 1, and Inputn+1 is in the range [1,1+Inputn].

Input will only contain numbers in the range [1,256].

Output

Return (by any means) the list of lists (or matrix - see below) of node numbers (dot-separated above):

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

You may return scalars instead of one-element sub-lists:

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

You may return a matrix (or list of lists) which is padded with zeros so that all rows (sub-lists) have the same length:

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

Additional rules

The reverse process of all this is just the length of each sub-list. You must also include a reverse program in the same language. Your score is the total byte count of your two programs. If you return zero-padded results on the first prgram, your reverse code must handle such input.

Please explain your code so we all can learn from it.

This is code golf, because I'll need to read it on a phone screen and type it into a computer. - No, really, this is not meme-ness!

CJam (15 + 4 = 19 bytes)

Mq~{1$0+<))+}%`

Online demo

To reverse,

q~:,


Jelly, 12 11 bytes

+ɼ0x;R}ʋ/€S

Try it online!

A full program that takes a list of lists of integers as its argument and returns a list of integers. Can be adapted to work as a link by resetting the register to zero after each call (as implemented in the footer on TIO).

Saved a byte now list can be non-empty.