text:
Interpret Functional-Basic
About Functional-Basic
Functional-Basic (FB for short) is a language that only allows numbers and lists. Basic features, such as the if statement are missing in an attempt to simplify the language.
Everything in this language is immutable. input is always assigned to the script input, which can be either a number or a list.
Basic operators
Note that you must support the order of operations for these. (https://en.wikipedia.org/wiki/Order_of_operations#Definition)

+: Addition - Applies to both numbers and lists.
-: Subtraction - Only applies numbers.
*: Multiplication - Only applies numbers.
/: Division - Only applies numbers.
^: Exponentiation - Only applies numbers.

Functions you must implement

sum: List of numbers -> Number Sum a list of numbers. Sum of [] is 0.
product: List of numbers -> Number Get the product of a list. Product of [] is 1.
print: Anything -> [empty list] Print the value to standard out. Returns empty list. print always ends in a newline.

Output format of the print function
The output should look like how it would be coded literally into the program, with the minor change that one space is required after a comma in lists. The values infinity and negative infinity are Infinity and -Infinity respectively. Not a number is represented by NaN.
Syntax
The syntax for FB is very simplistic. Below is a description of each major section of the syntax.
Useful terms
identifier : a string of only letters

Variable declaration
Though I call them variables, they are really immutable. The only place where a space is required in the syntax is between the [name] and let. names will never contain numbers, just upper and lower case ASCII letters. For simplicity you can assume that identifiers will never be used twice, even in for loops. Also names will not overlap with built-ins (let, sum, for, ...). Syntax:
let [identifier] = [some expression][newline]

Some examples:
let sumOfLst=sum [1,2]
let prod    = product [2,2]

Numbers
Numbers in FB conform to the IEEE 754/854 standard, with implementations providing a minimum of 32-bit precision. NaN, Infinity and -Infinity will not occur in the program source, but may be a result of a calculation.
Lists
Lists have a very limited set of capabilities. You can add lists together with +, and you can map over them with for. No indexed array access is supported here. Lists can have nested list inside them, but if it does it won't have any numbers as direct sub-children (i.e. lists don't mix types). List have only 2 ways to be created, the literal syntax and by mapping over a list with a for loop.
Syntax is just like most list types in other languages.
Examples:
let b = []  <-- not sure what you can do with a empty list...
let c = [5, 6]
let d = [5, []]             <-- invalid
let e = [[5, 2, 6], [6]]    <-- valid
let f = [5] + 5             <-- invalid
let g = [5] + [5]           <-- valid
let h = [[6, 2], []] + []   <-- valid
let i = [[6, 2], []] + [5]  <-- invalid

For loops
For loops in FB behave much like map in other languages in that it returns a list with the function applied to each element of the list. For simplicity you will never have nested for loops. Identifiers from outer scopes may be used in the expression. The expression will always be on the same line.
Syntax:
for ([identifier] in [list, may
           be an identifier pointing to a list]) [expression]

Examples:
for(x in lst) x+1
let nList = for (bestNameEver in [2, 5, 6]) bestNameEver^2
let lstOfLsts = for (i in b) [b, b+1]
for(x in [1, 2, 3])print x

Functions
Really only 3 functions exist in FB, sum, product, and print. Refer to the list above for definition of how they should work. All functions have an arity of 1. Function application consists of the name of the function, a space and an expression as the argument. Functions will take the very next thing after them as their argument, even if it is another function. If the arg is another function it will force the evaluation of that function to receive it's arguments. Example:
print sum [5]
prints argument is sum.
print (sum) [5]
sum grabs the list since that is the next thing and evaluates it.
print (5)

Syntax:
[function name][minimum one space][expression as the argument]

Examples:
print [5, 1]
sum   [6, 7]
print 1+2    <-- This is invalid, because print grabs the `1`
                      and returns `[]`, and `[]+2` is invalid
print (1+2)  <-- This is valid

Other syntax features
Parenthesis are supported.
Example:
print ((1+2)*5)

Handling errors
You can assume that all programs you will receive are syntactically correct and will not violate any rules placed on numbers and lists. The only thing that results in a error case is division by zero (x/0). If you encounter a division by zero you simply halt execution of your program and print Division by zero! to either stdout or stderr.
Examples
Code and output. (> denotes code):
>print sum [1, 2, 3]
6

>print for (x in [1, 2, 3]) x+2
[3, 4, 5]

>let aFloat = 4.2
>let aInt = 5
>let aList = [aFloat, aInt]
>print product aList
21

>let x = for (y in [2.3, 5.6]) y/5*6
>print product x
18.5472

>let superSecretNumber = 0
>print superSecretNumber
0

Input: [2, 3, 4]
>for (i in input) print i*2
4
6
8

>let answerToLife = 6*9
>print answerToLife
54

>print print sum [5, 2]
7
[]

>let a = [1, 2, 3]
>let b = for (x in a) [x, x+1]
>print b
[[1, 2], [2, 3], [3, 4]]

>print print []
[]
[]

>print for (i in [1, 2, 3]) print i
1
2
3
[[], [], []]

Um... 42=6*9? Mind=blown!

Yup https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29

So do we need to have 6*9 set to 42?

@TanMath The answer to life is now 54!

And 42 / 2 = 21.... i think everyone still remembers that 9 + 10 joke

So function application binds tighter than exponentiation? PS Patience is a virtue

Yes it does, I am trying to simplify the parsing and evaluating of FB as much as possible. The way I am thinking of parsing it with my own code this would help greatly.

Just a quick example. sum list ^ 2. My imaginary parser sees the ^, grabs list and 2. It has a fit since list isn't a number. If function application is first sum list is evaluated first, and no problems all around. This could be fixed by adding parenthesis around (sum list) or by the parser noticing the improper type and looking for a function, but both of those are longer than the current way.

I suppose variables cannot be named let, sum, etc., right?

Correct, I should add that to the spec...

Ewww, infix notation!

I thought this was using prefix notation for functions, and infix for math operators (common)...

Python 2.7, 979
I'm sure I could golf it further, but I don't see the point yet as I'm the only answer for the moment - I'm a bit lazy
Here is the code of my interpreter :
import sys,re
V={}
S=lambda m:re.sub(' +',';',m).split(';')
def P(t):print t;return []
def E(t):
 if len(t)==1:return t[0]
 y=E(t[1:])
 return{'print':'P('+y+')','sum':'sum('+y+')','product':'reduce(lambda x,y:x*y'+y+',1)'}[t[0]]
def e(t):
 y=t[0]
 if y=='let':v=V[t[1]]=e(t[3:]);return v
 if y=='print':v=e(t[1:]);return P(v)
 if y=='sum':return sum(e(t[1:]))
 if y=='product':return reduce(lambda x,y:x*y,e(t[1:]),1)
 if y=='for':c=S(R(t[1][1:-1].replace('/',' ')));return eval('map(lambda %s:%s,%s)' % (c[0],E(t[2:]),str(e(c[2:]))))
 if y[0]=='[':v=V['input']=eval(re.sub('([a-zA-Z]+)',"V['\\1']",y));return v
 if re.match('[0-9]+',y):v=V['input']=eval(y);return v
 return V[y]
def R(s, u='[',e=']',r=''):
 m,b='',1
 for c in s:
  if b:
   m+=c
   if c==u:b=0
  else:
   m+=r if c==' 'else c
   if c==e:b=1
 return m
def i(s):
 try:e(S(R(R(s.replace('^','**'),'(',')','/'))))
 except ZeroDivisionError:print 'Division by zero!';sys.exit(1)
while 1:print '>',;i(raw_input())

You can play with it here

This tip may be of use to you. Nice job! I wonder if someone will go sub 600.


text:
Read the tables
Task
Read the contents of a table given a set of coordinates.
Table formatting
Tables will be in this basic format:
      |[name]|[name]|
---------------------
[name]| [val]|[val] |
[name]| [val]|[val] |

Column names are always unique within columns. Row names are also unique within rows. This includes names that are the same except whitespace. Values, col names and row names will never have |- inside them. Names and values will never have spaces inside them, but may have leading or trailing space. Col width is adjustable based on the header/content. Column width is always consistent from top to bottom.
Input
A table and a space separated list of [name]s.
Example
[table]
row col

If you are writing a function, these can be separate strings, otherwise the row col will always be the very last line in the input. row col has some flexibility for the format and may be represented many ways. (e.g. (row, col), r, c, ...). The only hard requirement is that it be one line, and that it must appear in the order col row.
Output
The contents of a cell specified by the input with no leading or trailing space from the cell.
Examples
In:
   |a|z |_*|
------------
atb|1|85|22|
b  |5|6 |e$|
/+*|8|we|th|
atb a

Out:
1

In:
  | x| b |
----------
ab|l |mmm|
b |le| l |
b b

Out:
l

In:
   |a|z |_*|  ab  |
-------------------
atb|1|85|22| 5    |
b  |5|6 |e$|  8   |
/+-|8|we|th| 126  |
atb ab

Out:
5

Will the cell requested in the input always exist in the table?

Oh, now I get it ;) Yes it will

It seems that the input will be given as a single string though you have not made it explicit. How much flexibility is there on input format? Is passing an array of values  to a function acceptable? (I'm guessing no, it has to be a string) Can the row/col be given as separate arguments to the table? (I'm guessing probably.) Please clarify.

Does that help?

Don't columns go up/down and rows go left/right? I believe the coordinates in your examples are reversed.

Hmm, quite right. I'll just change the input format to match what the answers do.

Unclear ... examples: table row col, text it must appear in the order col row. Probably a typo in the text and the examples are ok?

Yeah, thanks. I missed it on the last edit...

Retina, 90 bytes
s`^(?=.*\n(.*) (.*))((?\|)|.)*\|\s*\2\s*\|.*\n\1\s*((?<-a>\|)|[^|])*\|\s*([^\s|]*).*
$5

My first balancing group regex. It should be still well golfable. Will try to do it later.
The main idea is counting the pipes until the column name and then using the same amount of pipes up in the row starting with the desired row's name. After that we capture the next value which is the result.
Try it online here.

JavaScript (ES6), 108
t=>(S=s=>s.split(/ *\| */),t=t.split`
`,[y,x]=t.pop().split` `,S(t.find(r=>S(r)[0]==y))[S(t[0]).indexOf(x)])

TEST in Firefox

f=t=>(
 S=s=>s.split(/ *\| */),
 t=t.split`\n`,
 [y,x]=t.pop().split` `,
 S(t.find(r=>S(r)[0]==y))[S(t[0]).indexOf(x)]
)

function test(){
  r=f(T.value);
  O.textContent=r
}
test()
#T { width: 50%; height: 9em}
Input
<textarea id=T>   |a|z |_*|  ab  |
-------------------
atb|1|85|22| 5    |
b  |5|6 |e$|  8   |
/+-|8|we|th| 126  |
atb ab</textarea>

<button onclick="test()">Find</button>

Nice, BTW Why just in firefox? (FWIW I use firefox)

Last time I checked, Chrome had not yet implemented Destructuring assignment - Confirmed, this gives error in Chrome "Invalid left-hand side in assignment"

@JAtkin BTW why not an upvote?

I read from top to bottom, left a comment, had to do something else, and forgot ;)

Haskell, 117 116 111 bytes
import Data.Lists
s=splitOn"|".filter(>' ')
(t#b)a|l<-lines t=[c|r<-l,(d,c)<-zip(s$l!!0)$s r,d==a,s r!!0==b]!!0

Usage example:
*Main> ("  | x| b |\n----------\nab|l |mmm|\nb |le| l |\nb b" # "b") "b"
"l"

How it works:
s=splitOn"|".filter(>' ')         -- helper function to remove spaces and split a
                                  -- line at bars into words
l<-lines t                        -- split table at \n into lines and bind to l
[c|r<-l,                      ]   -- take c for every line r in l, where
       (d,c)<-zip(s$l!!0)$s r     -- a pair (d,c) is made by zipping the (split)
                                  -- header of the table with the (split) line r
        ,d==a                     -- and d (=header element) equals parameter a
        ,s r!!0==b                -- and the first word in r equals parameter b
                             !!0  -- pick the first (and only) element

source: Stack Exchange

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

sort: votes


text:
Superstitious Programming
Your challenge is extremely simple. Given a year as input, print all the months in that year that will contain a Friday the 13th according to the Gregorian calendar. Note that even though the Gregorian Calendar wasn't introduced until 1582, for simplicity's sake we will pretend that it has been in use since 0001 AD.
Rules

Full programs or functions are allowed.
You can take input as function arguments, from STDIN, or as command line arguments.
You are not allowed to use any date and time builtins.
You can safely assume that the input will be a valid year. If the input is smaller than 1, not a valid integer, or larger than your languages native number type, you do not have to handle this, and you get undefined behaviour.
Output can be numbers, in English, or in any other human readable format, so long as you specify the standard.
Make sure you account for leap-years. And remember, leap-years do not happen every 4 years!

Tips
Since there are so many different ways to go about this, I don't want to tell you how to do it. However, it might be confusing where to start, so here are a couple different reliable ways of determining the day of the week from a date.

Conway's doomsday-algorithm
Pick a start date with a known day of the week, such as Monday, January 1st, 0001 and find how far apart the two days are, and take that number mod 7.
Gauss's Algorithm
A variation on Gauss's Algorithm
Any of these methods

Sample IO
2016 --> May
0001 --> 4, 7
1997 --> Jun
1337 --> 09, 12
123456789 --> January, October

As usual, this is code-golf, so standard-loopholes apply, and shortest answer wins.

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

When run on Friday the 13th, it should reverse and output months that don't have a Friday the 13th. (Freaky Friday references for the win)

Related

Is this example right: 0001 --> 5? According to this page (and my code) it should be April and July.

@faubiguy my bad, you're right. That was on The Julian Calendar. Let me fix that.

By "you are not allowed to use any date or time builtins", is it that I can't convert to unix time either?

Related.

I'm waiting for someone to find the Mathematica builtin that solves this

There won't be any builtins to solve this because builtin date functions only work with calendars that actually exist.

Pyth, 73 Bytes
L?>b2QtQfq%+++13+/-*2.6?qT2 12%-T2 12 .2 1*5%yT4*4%yT100*6%yT400 7 5r1 13

Try it online!
Using the Gauss-Algorithm, like in my Python answer. ~55 bytes of the code are for the weekday calculation, so choosing a better algorithm could get this down by a lot I suppose...but hey, at least its working now! :)

Python 2, 157 144 136 Bytes
My solution uses the Gauss-Algorithm. Input is the year as Integer. Output is the list of months with a friday 13th as numbers (1-12).
Probably some more golfing possible, but its getting late... Gonna edit this one tomorrow und get this down a bit more. Suggestions are always welcome in the meantime!
def f(i):y=lambda m:(i-1,i)[m>2];print[m for m in range(1,13)if(13+int(2.6*((m-2)%12,12)[m==2]-.2)+y(m)%4*5+y(m)%100*4+y(m)%400*6)%7==5]

edit: Got it down to 144 by replacing the for-loop with a list comprehesion und making some other small adjustments.
edit2: Golfed it down to 136 with the suggestions from Morgan Thrapp and fixed the bug he discovered. Thanks a lot! :)

C - 164 153 112 bytes
I found a nice little solution using a heavily modified version of Schwerdtfeger's method. It encodes the necessary table in an integer using base 7, modified to fit in a signed 32-bit word. It outputs the month as an ASCII-character, with January encoded as 1, February as 2 and so on, with October encoded as :, November encoded as ; and December encoded as <.
t=1496603958,m;main(y){for(scanf("%d",&y),y--;(y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;t/=7)2-++m||y++;}

Here it is slightly ungolfed:
t=1496603958,m;
main(y){
  for(
    scanf("%d",&y),y--;
    (y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;
    t/=7
  )
    2-++m||y++;
}

I am sure there are a few ways to make it even smaller, but I think the algorithm, or a slight variation thereof, is nearly ideal for finding the months where Friday the 13th occurs (with respect to code size). Notes:

If a 64-bit word could have been used it would be possible to get rid of an annoying addition (+5).
The variable m isn't actually necessary, since the month we are looking at is deducible from t.

I leave my older answer below, seeing as it uses a completely different method not seen in other answers here.

This is based on a solution to a related problem (https://codegolf.stackexchange.com/a/22531/7682).
Y,M,D,d;main(y){for(scanf("%d",&y);Y<=y;++D>28+(M^2?M+(M>7)&1^2:!(Y&3)&&(Y%25||!(Y&15)))&&(D=1,M=M%12+1)<2&&Y++)(d=++d%7)^1||D^13||y^Y||printf("%d,",M);}

It basically simulates the Gregorian calendar, advancing one day at a time, printing the month when it is a Friday and the 13th. Here it is in a slightly more readable form:
Y,M,D,d;
main(y){
  for(
    scanf("%d",&y);
    Y<=y;
    ++D>28+(
      M^2
        ?M+(M>7)&1^2
        :!(Y&3)&&(Y%25||!(Y&15))
    )&&(
      D=1,
      M=M%12+1
    )<2&&Y++
  )
    (d=++d%7)^1||D^13||y^Y||
      printf("%d,",M);
}

impressive ecc but not find in 123456789 --> January, October
october

Hmm, it does for me. Might me some platform dependent reason? It works for me on a fairly modern Macbook Pro when compiling with Clang. Note that it outputs 1: for 123456789, where : denotes October. I clarified the encoding above.

Yes 1: here too; I not understood ':' was for October...

Perl - 141 107 103 bytes
$y=<>-1;map{$y++if++$i==3;print"$i "if($y+int($y/4)-int($y/100)+int($y/400))%7==$_}'634163152042'=~/./g

This uses a modified version of the formula for the Julian day to calculate the day of the week of March 13th, then uses the number of days of the week each month is offset from January to find the day of the week for the rest of the months, starting with the last 2 months of the previous year beginning in March then the first 10 months of the current year (to avoid calculating leap years twice).

Excel, 137 bytes
Takes input year in A1.  Output is non-separated list of Hexidecimal. (January = 0, December = B)
Uses Gauss's Algorithm for January and August.
=CHOOSE(MOD(6+5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,"","",1,"","",0,"")&CHOOSE(MOD(5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,9,35,"8B",5,"2A",7,4)

This answer currently uses date and time builtins, which is explicitly stated as against the rules in the challenge.

@Fors, Thanks for pointing that out.  Updated.

C,  276  219 bytes
#define R return
#define L(i) for(;i-->0;)
u(y,m){R m-1?30+((2773>>m)&1):28+(y%4==0&&y%100||y%400==0);}s(y,m,g){g+=4;L(m)g+=u(y,m),g%=7;L(y)g+=1+u(y,1),g%=7;R g;}z(y,m,r){m=12;L(m)s(y,m,13)-4||(r|=1<<(m+1));R r;}

input from stdin output in stdout try to http://ideone.com/XtuhGj [the debug function is z]
w(y,m,r){m=12;L(m)s(y,m,u(y,m))||(r|=1<<(m+1));R r;}
/*
// ritorna il numero dei giorni di anno=y mese=m con mese in 0..11
// m==1 significa febbraio   y%4?0:y%100?1:!(y%400) non funziona
u(y,m){R m-1?30+((2773>>m)&1):28+(y%4==0&&y%100||y%400==0);}

// argomenti anno:y[0..0xFFFFFFF]  mese:m[0..11]  giorno:g[1..u(y,m)]
// ritorna il numero del giorno[0..6]
s(y,m,g)
{g+=4; // correzione per il giorno di partenza anno mese giorno = 0,1,1
 L(m)g+=  u(y,m),g%=7; // m:0..m-1  somma mod 7 i giorni del mese dell'anno y
 L(y)g+=1+u(y,1),g%=7; // y:0..y-1  somma mod 7 gli anni da 0..y-1
                       // g+=1+u(y,1) poiche' (365-28)%7=1 e 1 e' febbraio
 R g;
}

// argomenti anno:y[0..0xFFFFFFF], m=0 r=0
// calcola tutti gli ultimi giorni del mese dell'anno y che cadono di lunedi'
// e mette tali mesi come bit, dal bit 1 al bit 12 [il bit 0 sempre 0] in r
w(y,m,r){m=12;L(m)s(y,m,u(y,m))||(r|=1<<(m+1));R r;}

// argomenti anno:y[0..0xFFFFFFF], m=0 r=0
//ritorna in r il numero dei mesi che ha giorno 13 di venerdi[==4]
// e mette tali mesi come bit, dal bit 1 al bit 12 [il bit 0 sempre 0] in r
z(y,m,r){m=12;L(m)s(y,m,13)-4||(r|=1<<(m+1));R r;}
*/

#define P printf
#define W while
#define M main
#define F for
#define U unsigned
#define N int
#define B break
#define I if
#define J(a,b)  if(a)goto b
#define G goto
#define P printf
#define D double
#define C unsigned char
#define A getchar()
#define O putchar
#define Y malloc
#define Z free
#define S sizeof
#define T struct
#define E else
#define Q static
#define X continue
M()
{N y,m,g,r,arr[]={1,297,1776,2000,2016,3385}, arr1[]={2016,1,1997,1337,123456789};
 C*mese[]={"gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"};
 C*giorno[]={"Lun","Mar","Mer","Gio","Ven","Sab","Dom"};
 P("Inserisci Anno mese giorno>");r=scanf("%d %d %d", &y, &m, &g);
 P("Inseriti> %d %d %d r=%d\n", y, m, g, r);
 I(r!=3||m>12||m<=0||g>u(y,m-1))R 0;
 r=s(y,m-1,g);// 12-> 11 -> 0..10
 P("Risultato=%d giorno=%s\n", r, giorno[r]);
 r=w(y,0,0);P(" r=%d ", r);P("\n");
 F(m=0;m<6;++m)
        {P("N anno=%d -->",arr[m]);
         r=w(arr[m],0,0); // ritorna in r i mesi tramite i suoi bit...
         F(y=1;y<13;++y) I(r&(1<<y))P("%s ",mese[y-1]);
         P("\n");
        }
 F(m=0;m<4;++m)
        {P("N anno=%d -->",arr1[m]);
         r=z(arr1[m],0,0); // ritorna in r i mesi tramite i suoi bit...
         F(y=1;y<13;++y) I(r&(1<<y))P("%s ",mese[y-1]);
         P("\n");
        }

}

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


text:
Parse RNA into codons
Introduction
RNA is the less famous cousin of DNA.
Its main purpose is to control the production of proteins in cells through a process called translation.
In this challenge, your task is to implement a part of this process where the RNA is split into codons.
This challenge is thematically related, but concentrates on another part of the translation process.
Codons
We will think of RNA as a long string over the alphabet of base pairs, AUCG.
In translation, RNA is split into non-overlapping chunks of three base pairs, called codons.
The process begins at a start codon, AUG, and ends at a stop codon, one of UAA, UAG or UGA.
Each codon (except the stop codons) corresponds to an amino acid, and the resulting string of amino acids forms the protein.
Input
Your input is a non-empty string of RNA.
Output
Your output is the list of codons in which the RNA is split, in any reasonable format.
In this simplified model, the process begins at the leftmost start codon AUG, which is included in the output.
It ends when a stop codon is encountered, or when we run out of RNA.
If the input contains no start codon, the output shall be an empty list.
Examples
Consider the input sequence
ACAUGGAUGGACUGUAACCCCAUGC

The parsing begins at the leftmost occurrence of AUG, at index 2.
It continues as follows:
AC AUG GAU GGA CUG UAA CCCCAUGC
   *   ^   ^   ^   +

The codon marked with * is the start codon, and those marked with ^ are also part of the output.
The stop codon is marked with +.
The correct output is
AUG,GAU,GGA,CUG

For the shorter input
ACAUGGAUGGACUGU

the process goes
AC AUG GAU GGA CUG U
   *   ^   ^   ^

This time, a stop codon is not encountered, so the process stops when we run out of base pairs.
The output is the same as above.
Rules and scoring
You can write a full program of a function.
The lowest byte count wins, and standard loopholes are disallowed.
Test cases
GGUACGGAUU ->
GGCGAAAUCGAUGCC -> AUG
ACAUGGAUGGACUGU -> AUG,GAU,GGA,CUG
AUGACGUGAUGCUUGA -> AUG,ACG
UGGUUAGAAUAAUGAGCUAG -> AUG,AGC
ACAUGGAUGGACUGUAACCCCAUGC -> AUG,GAU,GGA,CUG
CUAAGAUGGCAUGAGUAAUGAAUGGAG -> AUG,GCA
AAUGGUUUAAUAAAUGUGAUAUGAUGAUA -> AUG,GUU
UGUCACCAUGUAAGGCAUGCCCAAAAUCAG -> AUG
UAUAGAUGGUGAUGAUGCCAUGAGAUGCAUGUUAAU -> AUG,GUG,AUG,AUG,CCA
AUGCUUAUGAAUGGCAUGUACUAAUAGACUCACUUAAGCGGUGAUGAA -> AUG,CUU,AUG,AAU,GGC,AUG,UAC
UGAUAGAUGUAUGGAUGGGAUGCUCAUAGCUAUAAAUGUUAAAGUUAGUCUAAUGAUGAGUAGCCGAUGGCCUAUGAUGCUGAC -> AUG,UAU,GGA,UGG,GAU,GCU,CAU,AGC,UAU,AAA,UGU

The relationship of DNA to RNA to protein was once explained to me in computing terms that I could understand:  DNA equates to a program on a hard disk; RNA equates to that program loaded into memory; and protein equates to the output data produced as a result of that program running.

The Dogma of molecular biology is "DNA makes RNA makes protein." So DNA is fairly rare, and RNA is less famous, but far more common. Protein is most common of all.

@DigitalTrauma: As a geneticist I need to point out that this analogy is woefully inadequate to describe the reality of how DNA works. DNA is not some dead thing waiting to be transcribed into RNA so it can do something.

What actually occurs in practice if a piece of mRNA terminates before a stop codon (as in the simple example), meaning no stop triplet for a release factor to bind to?

@Jack hard disk contents are not necessarily dead things either - upgrades, auto updates, etc, though of course not self-healing to the extent I understand DNA to be. But you're right - It is a weak analogy. However I think it got my non-geneticist self a little closer to a layman understanding

The Dogma is also horribly wrong when it comes to some types of viruses.

@DigitalTrauma DNA -> RNA -> protein chain -> protein folding -> goes of and does awesome nature

@DigitalTrauma My analogy would be DNA = github repo online, RNA = downloaded source code, protein chain = after ./.configure, protein folding = compiled program (it's super duper complicated, our computers can't even fold programming)

Retina, 39 38 32 30 bytes
M!`AUG|\B\G...
U(AA|AG|GA)\D*

The trailing linefeed is significant.
Output as a linefeed-separated list.
Try it online.
Explanation
M!`AUG|\B\G...

This is match stage which turns the input into a linefeed-separated list of all matches (due to the !). The regex itself matches every codon starting from the first AUG. We achieve this with two separate options. AUG matches unconditionally, so that it can start the list of matches. The second match can be any codon (... matches any three characters), but the \G is a special anchor which ensures that this can only match right after another match. The only problem is that \G also matches at the beginning of the string, which we don't want. Since the input consists only of word characters, we use \B (any position that is not a word boundary) to ensure that this match is not used at the beginning of the input.
U(AA|AG|GA)\D*

This finds the first stop codon, matched as U(AA|AG|GA) as well as everything after it and removes it from the string. Since the first stage split the codons into separate lines, we know that this match is properly aligned with the start codon. We use \D (non-digits) to match any character, since . wouldn't go past the linefeeds, and the input won't contain digits.

Haskell, 115 112  bytes
import Data.Lists
fst.break(\e->elem e["UAA","UAG","UGA"]||length e<3).chunksOf 3.snd.spanList((/="AUG").take 3)

Usage example:
*Main> ( fst.break(\e->elem e["UAA","UAG","UGA"]||length e<3).chunksOf 3.snd.spanList((/="AUG").take 3) ) "AUGCUUAUGAAUGGCAUGUACUAAUAGACUCACUUAAGCGGUGAUGAA"
["AUG","CUU","AUG","AAU","GGC","AUG","UAC"]

How it works:
                spanList((/="AUG").take 3)  -- split input at the first "AUG"
             snd                            -- take 2nd part ("AUG" + rest)
     chunksOf 3                             -- split into 3 element lists
fst.break(\e->                              -- take elements from this list
           elem e["UAA","UAG","UGA"]||      -- as long as we don't see end codons
           length e<3)                      -- or run out of full codons

Vyxal 3, 25 bytes
"ᶠx„ẋİ⁻/3Ŀ:ƛ'u"\ᵇ„o+c]Ṙƒh

Try it Online!
There's my 26 25 byter
old explanation:
"ᶠx„ẋİ⁻/3Ŀ:ƛ'u"\ᵇ„o+=a]Ṙƒh
"ᶠx„ẋ                       # The first index of "aug"
     İ                      # Slice from here to the end
      ⁻                     # Split into parts of length 3
       /3Ŀ:                 # Keep only those whose length is 3 and duplicate
           ƛ        =a]     # for each codon, does it equal any of...
                  o         # overlapping pairs of....
              "\ᵇ„          # The string "aaga" --> ["aa", "ag", "ga"]
            'u              # with a "u" prepended to each ["uaa", "uag", "uga"]
                       Ṙƒh  # partition before truthy indices, take the first item.

Created with the help of Luminespire.

i feel like 26 is doable here but i cant seem to make it work for every test case

old me had a skill issue and was looking in the wrong place

Perl 5 -n, 40 bytes
map/UAA|UAG|UGA/?last:say,/AUG|\B\G.../g

Try it online!

Python 2, 185 bytes
i=input()
o=[]
if i.find('AUG')>=0:i=map(''.join,zip(*[iter(i[i.find('AUG'):])]*3))
else:print "";exit()
for j in i:
 if j not in['UGA','UAA','UAG']:o+=[j]
 else:break
print ','.join(o)

Explanation
Set i to input. Split it from 'AUG' to the end. Split into strings of three. Check if stop codon, and cut.
Try it here

JavaScript 88 82 70 69 chars
s=>/AUG(...)+?(?=(U(AA|AG|GA)|$))/.exec(s)[0].match(/.../g).join(",")

Usage Example:
(s=>/AUG(...)+?(?=(U(AA|AG|GA)|$))/.exec(s)[0].match(/.../g).join(","))("ACAUGGAUGGACUGUAACCCCAUGC")

Doesn't this fail for input without a stop codon?

You're right, I didn't see that was an option, fixing

Try s=>/AUG(...)+?(?=(U(AA|AG|GA)|$))/.exec(s)[0].match(/.../g).

Still fails for stop codons. (Try test case 3)

Ruby, 97 95 78 75 62 bytes
->(r){r.scan(/AUG|\B\G.../).join(?,).sub(/,U(AA|AG|GA).*/,'')}

I don't golf much, so I'm sure it can be improved.
Edit: Stole Borrowed Martin Büttner's excellent \B\G trick

MATL, 57 bytes
j'AUG(...)*?(?=(UAA|UAG|UGA|.?.?$))'XXtn?1X)tnt3\-:)3[]e!

This uses current version (9.3.1) of the language/compiler.
Input and output are through stdin and stdout. The output is separated by linebreaks.
Example
>> matl
 > j'AUG(...)*?(?=(UAA|UAG|UGA|.?.?$))'XXtn?1X)tnt3\-:)3[]e!
 >
> ACAUGGAUGGACUGUAACCCCAUGC
AUG
GAU
GGA
CUG

EDIT (June 12, 2016): to adapt to changes in the language, [] should be removed. The link below includes that modification
Try it online!
Explanation
The code is based on the regular expression
AUG(...)*?(?=(UAA|UAG|UGA|.?.?$))

This matches substrings starting with AUG, containing groups of three characters (...) and ending in either UAA, UAG, or UGA; or ending at the end of the string, and in this case there may be one last incomplete group (.?.?$). Lookahead ((?=...)) is used so that the stop codons are not part of the match. The matching is lazy (*?) in order to finish at the first stop codon found, if any.
j                                     % input string
'AUG(...)*?(?=(UAA|UAG|UGA|.?.?$))'   % regex
XX                                    % apply it. Push cell array of matched substrings
tn?                                   % if non-empty
1X)                                   % get first substring
tnt3\-:)                              % make length the largest possible multiple of 3
3[]e!                                 % reshape into rows of 3 columns
                                      % implicit endif
                                      % implicit display

Scala 2, 170 156 bytes
A port of @nimi's Haskell answer in Scala.
Saved 14 bytes thanks to @pacman256

Golfed version. Attempt This Online!
s=>{val q=s.indexOf("AUG");if(q>=0){val c=s.drop(q).grouped(3).toSeq;c.takeWhile(c=>c.size==3&& !Seq("UAA","UAG","UGA").contains(c))}else Seq.empty[String]}

Ungolfed version. Attempt This Online!
object RNASequenceProcessor {

  def main(args: Array[String]): Unit = {
    val rnaSequence = "AUGCUUAUGAAUGGCAUGUACUAAUAGACUCACUUAAGCGGUGAUGAA"
    val codingRegion = findCodingRegion(rnaSequence)
    println("["++codingRegion.mkString(",")++"]")
  }

  def findCodingRegion(sequence: String): Seq[String] = {
    // Find the start of the coding region (first occurrence of "AUG")
    val startOfCoding = sequence.indexOf("AUG")
    if (startOfCoding != -1) {
      // Extract the sequence from "AUG" onward
      val codingSequence = sequence.drop(startOfCoding)

      // Split the sequence into codons (chunks of 3 nucleotides)
      val codons = codingSequence.grouped(3).toSeq

      // Take codons until a stop codon is encountered or the codon length is less than 3
      codons.takeWhile(codon => codon.length == 3 && !Seq("UAA", "UAG", "UGA").contains(codon))
    } else {
      Seq.empty[String] // Return an empty sequence if "AUG" is not found
    }
  }
}

158 bytes

156 i think

JavaScript (Node.js), 67 bytes
s=>[/AUG(...)*?(?=UA[AG]|UGA|.?.?$)|$/.exec(s)[0].match(/.../g)]+''

Try it online!

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


text:
Create a CleverBot
CleverBot is a conversational AI that works fundamentally by repeating responses from real humans it has heard previously. It starts off pretty dumb, but once the database becomes (a lot) larger it begins sounding more like an actual person!
How your program should work

Output Hi!
Receive the user's reply as a string

The reply is added to a list of responses associated with the program's last output (eg. the first reply would associate with Hi!).

Output one of the responses associated with the reply from step 2

Every output has a list of responses associated with it.
The response should be randomly selected from the list of associated responses.
Matching of previous replies is case-insensitive and without symbols (only 0-9, A-Z and space are matched). For example, entering hi could return any response associated with hi, Hi!, ///H|||I\\\, etc.
If the user's reply does not match any previous responses, randomly select a response from the entire list of responses.

Repeat steps 2 and 3 indefinitely

Rules

Output must be exactly the same as the user originally entered it
If a reply that needs to be added to the list of responses is already in the list, it can be optionally be added again (so it appears in the list twice)
Input will never be empty and will only contain printable ASCII (code points 32 to 126)
All possible random values must have an equal chance of occurring
Must be a full program (not just a function)
Must output to STDOUT or closest equivalent
Must take input from STDIN or closest equivalent

Test Case
Hi!
> hi...
hi...
> HI
HI                               // could output "hi..." or "HI"
> How are you?
How are you?                     // could output "hi...", "HI" or "How are you?"
> Good.
Good.                            // could output "hi...", "HI", "How are you?" or "Good."
> ~!@#$*`'"(how ar%&e you_\|./<?
Good.
> Good.
~!@#$*`'"(how ar%&e you_\|./<?   // could output "~!@#..." or "Good."
> 2Good.
HI                               // could output any of the user's previous replies

This is code-golf. Shortest answer in bytes wins!

Related.

Can there be two responses associated to one reply?

@TanMath Yes, there can and should. Each reply has a list of responses.

JavaScript (ES6) 155 148 bytes
c=t=>t.replace(/[^\dA-Z ]/gi,"");r=["Hi!"];for(a=[],m={};u=prompt(alert(o=r[new Date%r.length]));r=m[c(u)]||a)(m[o=c(o)]=m[o]||[]).push(u),a.push(u)

Less golfed:
c=t=>t.replace(/[^\dA-Z ]/gi,"");
r=["Hi!"];
for(a=[], m={}; u=prompt( alert( o=r[new Date%r.length] ) );
r= m [ c(u) ] || a )( m[ o=c(o) ] = m[o] || [] ).push(u), a.push(u)

3 bytes saved thanks to @balint

Use the date tehnique for randoms new Date%(r.length|0)


text:
Scheduling a chess tournament
Introduction
Right now I'm participating a chess tournament. I got inspired by the tournament schedule. Right now, I'm in a competition with three other players. That means with the four of us, we are playing 3 rounds. The schedule goes as following:
Round 1: 1-4 3-2
Round 2: 3-4 2-1
Round 3: 1-3 4-2

This is also known as Round Robin. Also, this is a valid schedule. We say that a schedule is valid, when it satisfies the following conditions:

Every player plays once against another player.
1-2 means that player 1 has white. Every player has or (N / 2 - 0.5) or (N / 2 + 0.5) times white, with N being the amount of rounds.

For example, in the above example, there are 3 rounds. So N = 3. As you can see, the amount of rounds equals the amount of players - 1. A player has either

N / 2 - 0.5 = 1 time white, or
N / 2 + 0.5 = 2 times white.

In the above example:

player 1 has 2 times white,
player 2 has 1 time white,
player 3 has 2 times white,
player 4 has 1 time white.

The task
Given an even integer > 1 representing the amount of players in the competition, output the tournament schedule.
Test cases:
Input = 4, that means N = 3
Input:     Output:
4          1-4 3-2
           3-4 2-1
           1-3 4-2

Input = 10, that means N = 9
Input:     Output:
10         1-10  2-9  3-8  4-7  5-6
           10-6  7-5  8-4  9-3  1-2
           2-10  3-1  4-9  5-8  6-7
           10-7  8-6  9-5  1-4  2-3
           3-10  4-2  5-1  6-9  7-8
           10-8  9-7  1-6  2-5  3-4
           4-10  5-3  6-2  7-1  8-9
           10-9  1-8  2-7  3-6  4-5
           5-10  6-4  7-3  8-2  9-1

Input = 12, that means N = 11
Input:     Output:
12         1-14    2-13   3-12   4-11   5-10   6-9    7-8
           14-8    9-7    10-6   11-5   12-4   13-3   1-2
           2-14    3-1    4-13   5-12   6-11   7-10   8-9
           14-9    10-8   11-7   12-6   13-5   1-4    2-3
           3-14    4-2    5-1    6-13   7-12   8-11   9-10
           14-10   11-9   12-8   13-7   1-6    2-5    3-4
           4-14    5-3    6-2    7-1    8-13   9-12   10-11
           14-11   12-10  13-9   1-8    2-7    3-6    4-5
           5-14    6-4    7-3    8-2    9-1    10-13  11-12
           14-12   13-11  1-10   2-9    3-8    4-7    5-6
           6-14    7-5    8-4    9-3    10-2   11-1   12-13
           14-13   1-12   2-11   3-10   4-9    5-8    6-7
           7-14    8-6    9-5    10-4   11-3   12-2   13-1

Of course, the extra whitespaces I used between the numbers is optional but not necessary. You may output it in any form you like, as long as it's readable.
Note: The above examples aren't just the only valid outputs. There certainly are more valid outputs.
This is code-golf, so the submission with the least amount of bytes wins!

I think that validity is underspecified. In particular, shouldn't it require that the number of rounds is one less than the number of players?

@PeterTaylor Yes, I forgot to mention that. I have edited it in the question

Do players have to be numbered 1 to N, or can they be numbered 0 to N-1?

@steveverrill Whatever fits best for you.

Do you have to separate the rounds in the outputs or is 1-4 3-2 3-4 2-1 1-3 4-2 for n=4 a valid output?

@randomra Rounds should be separated.

Python 2, 200 186 Bytes

n=input()
t=range(2,n+1)
for k in t:
 s=[1]+t
 c=[[s[x],s[-x-1]] for x in range(n/2)]
 if k%2:c[0].reverse()
 t=t[-1:]+t[:-1]
 print"\t".join(["-".join([str(y) for y in x]) for x in c])

Example output:

$ python chess.py
4
1-4     2-3
3-1     4-2
1-2     3-4

$ python chess.py
10
1-10    2-9     3-8     4-7     5-6
9-1     10-8    2-7     3-6     4-5
1-8     9-7     10-6    2-5     3-4
7-1     8-6     9-5     10-4    2-3
1-6     7-5     8-4     9-3     10-2
5-1     6-4     7-3     8-2     9-10
1-4     5-3     6-2     7-10    8-9
3-1     4-2     5-10    6-9     7-8
1-2     3-10    4-9     5-8     6-7

$ python chess.py
14
1-14    2-13    3-12    4-11    5-10    6-9     7-8
13-1    14-12   2-11    3-10    4-9     5-8     6-7
1-12    13-11   14-10   2-9     3-8     4-7     5-6
11-1    12-10   13-9    14-8    2-7     3-6     4-5
1-10    11-9    12-8    13-7    14-6    2-5     3-4
9-1     10-8    11-7    12-6    13-5    14-4    2-3
1-8     9-7     10-6    11-5    12-4    13-3    14-2
7-1     8-6     9-5     10-4    11-3    12-2    13-14
1-6     7-5     8-4     9-3     10-2    11-14   12-13
5-1     6-4     7-3     8-2     9-14    10-13   11-12
1-4     5-3     6-2     7-14    8-13    9-12    10-11
3-1     4-2     5-14    6-13    7-12    8-11    9-10
1-2     3-14    4-13    5-12    6-11    7-10    8-9

Or 135 Bytes, by using a less pretty (but still readable) output:

...
print c

Which produces something like:

$ python chess.py
4
[[1, 4], [2, 3]]
[[3, 1], [4, 2]]
[[1, 2], [3, 4]]

The less pretty answer is also a valid submission. So this is 135 bytes :)

I'd upvote you if you added a human explanation of your algorithm.


text:
Inverse symbolic calculator
This challenge is based on the idea of Plouffle's Inverter.
Write a program in any language that does the following:

Takes as input a non-negative rational number X written in decimal, for example 34.147425.
Returns a mathematical expression using only non-negative integers, whitespace, parentheses, and the following binary operators:

Addition +
Subtraction -
Multiplication *
Division /
Exponentiation ^

The expression should evaluate to X, or at least agree with all the digits of X. To continue the example, a correct output could be 13 + 20^(5/4) / 2, since 13 + 20^(5/4) / 2 = 34.1474252688...
Output may optionally be written in Polish notation (prefix) or reverse Polish notation (postfix), i.e. + 13 / ^ 20 / 5 4 2 is fine.

The program is subject to the following retrictions:

Standard loopholes are forbidden! In particular, the program cannot read any external lookup table.
The source code of the program must be shorten than 1024 characters.

The program with the lowest average compression ratio will win.
To determine your average compression ratio, you can to use the following Python script, or write your own equivalent program. Here is the list of 1000 random numbers.
import random

def f(x):
    # edit this function so that it will return
    # the output of your program given x as input
    return "1 + 1"

random.seed(666)

S = 1000 # number of samples

t = 0.0

for n in xrange(0, S):
    # pick a random decimal number
    x = random.uniform(0, 1000)

    # compute the compression ratio
    # length of output / length of input
    r = len(f(x).translate(None, " +-*/^()")) / float(len(str(x).translate(None, ".")))
    t += r

print "Your average compression ratio is:", t / S

Good luck!
NOTES:

Whitespaces in the output are not mandatory. Strings like 1+1, 1 +2, or 1 + 2, are all okay. Indeed, the script to compute the score does not count whitespaces and parenthesis in the length of the output. However, note that the use of whitespaces is necessary if you choose Polish or reverse Polish notation.
Regarding the usual infix notation, the precedence rules are the following: first all exponentiation (^), then all divisions (/), then all multiplications (*), then all additions (+) and all subtractions (-). But I do not know how much this could matter, since you can use parentheses.
A way to edit the function f in the script above can be the following, however I think that it depends on your operating system; on GNU/Linux it works. Name your program "inverter" (or "inverter.exe") and place it in the same directory as the Python script. Your program should get X as the first argument of command line and return the expression in STDOUT. Then edit f as follows:
import os
def f(x):
    return os.popen("./inverter " + str(x)).read()

EDIT: As a consequence of the comment of Thomas Kwa, now the operators do not contribute to the length of the expression. The challenge should be more "challenging".

I've replaced most double quotes with backticks, since I think that it improves readability. If you disagree, feel free to roll the edit back. 2. Multiplication is missing from your precedence list. It matters because we have to account for parentheses in our 1024 bytes of code.

@Bob: regarding the rule change about accuracy: "agree with all the digits", does it mean that if X = 5.23 a value of 5.2301is ok, but 5.2299 not?

@nimi Yes, 5.2301 agrees with all the digits of X = 5.23, while 5.2299 does not.

This will almost certainly be won with rational approximation. There's no other way to get sufficient entropy to catch enough numbers when extra space is spent on operators.

This is more like RIES than Plouffe's inverter.

@Bob: it seems that your scoring script doesn't strip off newlines. You should add that as a remark.

@nimi but you are not suppose to use any newline. The output of the program should contain only the characters '0123456789 +-*/^()'

@Bob: from your first note: "the script to compute the score does not count whitespaces ... in the length of the output". Whitespace sometimes means space, tab and nl.

@nimi Ah, OK. By whitespaces I meant just whitespaces, not tabs, or newlines.

@ThomasKwa I think you are right, the challenge is better if the operators do not count in the length of the expression.

can we assume approximations are floored, ceilinged, and/or rounded?

@Sparr I am not sure what do you mean. As I wrote to nimi:  5.2301 agrees with all the digits of X = 5.23, while 5.2299 does not.

damn. python's str() function rounds, so it thinks 5.2299 shortens to 5.23

Haskell, 1.08404005439
import System.Environment
import Data.Ratio
import Data.Lists

main = do
   arg <- fmap head getArgs
   let number = read (arg ++ "5")
   let (_,_:decs) = span (/= '.') arg
   let acc = (read $ "0." ++ (decs >> "0") ++ "4999") :: Double
   putStr $ replace " % " "/" $ show $ approxRational number acc

This uses the approxRational function which converts a floating point number to a fraction with a accuracy of a given epsilon. It simply returns this fraction. As Haskell prints rationals with a % in-between, we have to replace it with the division sign /.
The accuracy parameter is calculated from the input number. We have to take into account that all the digits have to match, so 4.39 is fine for 4.3 but 4.29 isn't. I append a 5 to the number and the accuracy is a 4999 at the same decimal place as the appended 5, e.g.
12.347       -- input number
12.3475      -- append 5
 0.0004999   -- accuracy epsilon for the "approxRational" function.

E.g. 34.147425 -> 43777/1282.
Edit: the rules for accuracy have changed. The test case includes numbers with up to 11 decimal places and all have to match.
Edit II: it seems that the provides Python script doesn't strip off trailing newlines, so I've changed from putStrLn to putStr.
Edit III: again, new scoring rules

Nice. I edited my question so that the expression returned by the program should agree with all the digits of X. I do not think this would change your score, however it is better if you check.

Does Haskell have a way to shorten 0.000001 to e.g. 1e-6?

@ETHproductions: yes, 1e-6 also works, but this isn't codegolf ...

Ah, right. But it might come in handy if this gets really long, close to 1024 bytes ;)

@Bob: it does change the score dramatically. Now accuracy can be up to 11 decimal places instead of 6.

Python, 1.25927791772
I'm surprised no one else has tried the obvious approach, which incurs about 26% overhead:
from decimal import *
def simplify(numstr):
    numdec = Decimal(numstr)
    digits = -(numdec.as_tuple().exponent)
    num = float(numstr)
    return '{0:.0f}'.format(num * 10**digits) + '/10^' + str(digits)

This just converts XX.XXXX into XXXXXX/10^4 and so on. For the majority of test numbers, this means converting 12 digits (and an uncounted decimal point) to the same 12 digits plus three more (plus two uncounted symbols).

Mathematica, 1.1012 1.10976107226107
Rationalize[# + 5 (a = 10^(Floor@Log10@# - Length[First@RealDigits@# //. {a___, 0} :> {a}])), 5 a - 1*^-4 a]~ToString~InputForm &

So far, this has the lowest score! Gives the rational with the smallest denominator given the digits. (Sorry for the unreadability, forgot that this wasn't a golf contest for a minute.) Some testing:
In[1]:= f=Rationalize[#+5(a=10^(Floor@Log10@#-Length[First@RealDigits@#//.{a___,0}:>{a}])),5a-1*^-4a]~ToString~InputForm&;

In[2]:= f[811.359484104]

Out[2]= 9876679/12173

In[3]:= f[0.000000001]

Out[3]= 1/666666666

In[4]:= f[999.999999999]

Out[4]= 2000021150999/2000021151

Can you add an example?

Python, 1.9901028749
Continued fractions turn out to not be a serious contender, unfortunately.
from fractions import *
def simplify(numstr):
    frac = Fraction(numstr)
    terms = []
    while frac>0:
        terms.append(int(frac))
        frac -= int(frac)
        if frac > 0:
            frac = 1/frac
    for n in range(0,len(terms)):
        temp = 0
        for i in range(n,0,-1):
            temp = 1.0/(terms[i]+temp)
            # print i, terms[i], temp
        temp += terms[0]
        # print repr(temp)
        if repr(temp)[:len(numstr)] == numstr:
            break
    return '+1/('.join([str(x) for x in terms[:n+1]]) + ')' * n

examples:
141.352770092 141+1/(2+1/(1+1/(5+1/(20+1/(20+1/(1+1/(1)))))))
501.454292251 501+1/(2+1/(4+1/(1+1/(31+1/(1+1/(4+1/(1+1/(1+1/(2)))))))))
792.956685991 792+1/(1+1/(22+1/(11+1/(2+1/(6+1/(1+1/(2+1/(1+1/(2)))))))))
709.053823609 709+1/(18+1/(1+1/(1+1/(2+1/(1+1/(1+1/(1+1/(10+1/(58)))))))))

Python, 1.10900874126
Actually evaluating the continued fractions in my previous answer yields the equivalent of @LegionMammal978 s Mathematic answer, which I think is the naive optimum. Doing better than this will require getting creative with representing the integers, possibly including searching for sub-optimal fractions to get to easier-to-represent integers.
from fractions import *
def simplify(numstr):
    frac = Fraction(numstr)
    terms = []
    while frac>0:
        terms.append(int(frac))
        frac -= int(frac)
        if frac > 0:
            frac = 1/frac
    for n in range(0,len(terms)):
        temp = Fraction(0)
        for i in range(n,0,-1):
            temp = Fraction(1)/Fraction(terms[i]+temp)
            # print i, terms[i], temp
        temp += terms[0]
        if repr(float(temp))[:len(numstr)] == numstr:
            break
    return str(temp.numerator) + '/' + str(temp.denominator)

examples:
141.352770092 == 1992650/14097
501.454292251 == 5041120/10053
792.956685991 == 33373961/42088
709.053823609 == 154592878/218027

JavaScript 1.7056771894771656
Very simple, very bad score

F=x=>([x,d]=x.split`.`,n=+(x+d),d=+d.replace(/./g,9)+1,G=(a,b)=>b?G(b,a%b):a,g=G(n,d),(n/g)+'/'+(d/g))

test=[456.119648977, 903.32315398, 434.375496831, 500.626690792, 811.359484104,
553.673742554, 712.174768248, 123.142093787, 814.759762152, 385.493673216,
629.109959804, 891.825687728, 988.817827772, 16.7651557543, 967.455933006,
99.3802569984, 681.552992408, 169.770898456, 921.658967707, 610.512640655,
420.065644152, 702.514151372, 517.04720252, 86.3589856368, 960.117250449,
311.152728003, 620.240077706, 130.232920047, 901.22564153, 528.511688187,
50.841278105, 737.146071519, 836.88270257, 13.9544843156, 45.8723706867,
760.14443626, 256.035110545, 460.972156302, 217.514875811, 34.4165446011,
426.209854826, 500.979753237, 930.071200996, 751.301967463, 817.525354878,
918.861794618, 794.520266221, 531.896652685, 419.295924811, 927.526963939,
989.027382734, 82.1589263516, 965.904769963, 708.295178015, 778.541588483,
410.404428666, 894.612613172, 470.045387404, 460.773246884, 505.524899467,
451.852274382, 417.910824093, 883.45180574, 319.767238241, 544.794416784,
346.361844704, 122.300743514, 517.293385872, 748.134450425, 589.547392631,
870.937945528, 465.607198253, 379.697188157, 215.095671553, 471.696590273,
544.827425571, 883.01895272, 514.893297677, 703.800591, 788.816870867,
777.433484884, 990.615076538, 925.473132794, 494.964321255, 911.643885633,
103.244050895, 425.938382631, 421.075783639, 363.155392963, 301.617712632,
268.237096551, 42.0971441114, 252.071029659, 260.398845137, 433.781658026,
278.550969539, 446.456847155, 466.145132666, 23.1267325005, 92.2303701531,
792.994090972, 100.482658881, 796.600758817, 786.019664003, 328.859998399,
390.221668208, 750.32581915, 332.277362524, 983.205082197, 862.001172096,
823.825060923, 662.455639665, 926.337262367, 618.446017944, 696.465793349,
408.095136772, 519.31659792, 928.091368548, 177.367743543, 980.822594006,
401.832552937, 66.1163636071, 127.511709579, 291.85194129, 11.338995907,
880.568902788, 982.945394792, 491.753920356, 222.011915866, 317.023389252,
601.694693495, 871.340895438, 427.621115915, 886.273120812, 345.688431619,
248.992214068, 738.874584632, 109.03516681, 146.362341902, 447.713463802,
600.947018155, 415.419601291, 369.549014288, 141.697677152, 895.502232931,
528.201404793, 673.817459041, 215.852364841, 164.552047867, 764.085838441,
323.70504093, 197.868519457, 759.91813327, 369.341528152, 768.793424447,
111.674153727, 495.99248701, 363.669738825, 596.082713332, 747.205484326,
666.879146337, 102.908405893, 424.113319661, 476.379228696, 971.353959219,
162.634464034, 761.838583493, 767.799964665, 347.294217881, 353.760366385,
230.905221575, 125.898250349, 565.850510939, 667.61204275, 196.449923318,
279.792505368, 279.034332146, 533.902967966, 57.688797172, 153.08128158,
821.993175733, 982.886617074, 433.447389936, 29.0911289168, 442.422057169,
804.518563086, 500.73307383, 948.932673563, 723.030013363, 572.092408062,
853.660849797, 481.331513905, 942.064561235, 42.4709711072, 982.87325027,
352.171583912, 238.247057259, 823.238147233, 526.013997729, 644.51102393,
366.71793217, 933.49508788, 903.534625763, 857.169528071, 735.780465845,
378.732263357, 12.1875971069, 964.370964223, 419.654315024, 705.414457347,
353.953487281, 501.657967991, 849.706011343, 713.414932699, 827.420809946,
596.719004174, 609.780183857, 826.546581587, 76.33513551, 0.500492073649,
627.694684485, 186.236492637, 360.200893605, 478.625892592, 229.111877611,
423.754891888, 657.973373515, 16.9761882463, 974.491769915, 945.864753785,
237.454051339, 179.687469205, 418.658590265, 714.833543375, 318.816023475,
650.727666516, 488.596054138, 987.542619517, 216.006047902, 80.7125255243,
144.181653533, 266.522883823, 818.574355104, 600.21171237, 895.307289865,
198.329664663, 124.824876993, 31.1227116403, 541.348603643, 542.257190363,
304.231517157, 506.706000025, 84.9413478067, 170.491409724, 229.013799764,
671.014301245, 87.1441069227, 763.676724963, 742.639944243, 435.559778934,
383.882521911, 238.741657776, 647.17907848, 927.512981306, 549.612975568,
791.443454295, 701.809936899, 987.551368536, 91.3122813408, 398.587619734,
847.240295481, 470.53644512, 507.410113063, 540.35838629, 637.883207888,
982.322584309, 975.975221911, 371.493982019, 172.638439006, 747.126873375,
99.5418242164, 309.903703204, 640.628684948, 314.750618166, 146.000991772,
384.388581648, 217.815818267, 733.571499911, 690.506791178, 945.671862182,
344.854300466, 66.9720187046, 600.727439672, 98.4760964868, 295.60483304,
478.855074245, 490.351187811, 479.533769337, 239.205093033, 58.7686847649,
375.442162104, 615.561415277, 974.347539912, 743.935932659, 210.319831557,
782.442881822, 556.123534411, 774.571029531, 821.094541585, 782.478179678,
123.630035193, 652.088033798, 753.122074115, 303.840694329, 449.088557671,
38.4843483532, 173.031570335, 728.973326841, 226.816627623, 119.472479023,
705.899011665, 927.865200825, 157.998809157, 327.490515863, 225.137067487,
501.556087254, 167.031923234, 396.975128016, 826.305341676, 396.340544863,
569.58630546, 694.788762272, 10.1343501944, 369.36109683, 29.8034453658,
916.970188353, 985.814850566, 888.359275561, 689.939392935, 409.116566134,
144.938228502, 67.8210674843, 870.61549803, 563.639796984, 431.618386108,
145.691380363, 350.505911146, 326.638836654, 708.160936271, 345.738257395,
159.932627655, 311.885663889, 229.603462168, 110.746858295, 517.566252532,
231.2683822, 908.329966697, 999.286952896, 700.486300449, 532.543272168,
548.536320153, 248.586068291, 844.156717745, 477.281959996, 964.072712855,
157.863146561, 919.917761996, 187.741733233, 358.474587832, 541.364663045,
297.862474812, 673.876495999, 641.468684483, 934.366789232, 112.750864631,
179.36727691, 744.421362119, 954.914513373, 356.362877284, 642.423557253,
835.156704382, 145.847575914, 917.085464611, 633.00944503, 4.20412765537,
577.177004175, 774.63403371, 846.937269117, 978.134451441, 927.806763324,
3.39763102303, 650.528163199, 347.525631206, 378.956292306, 266.22945414,
175.085055263, 571.539823838, 274.670508282, 835.348780918, 190.612093018,
425.355323169, 283.050471535, 573.262462068, 236.809923974, 86.5812138421,
442.645729259, 376.598156438, 412.17611326, 575.13654395, 76.4906160271,
382.261334337, 419.108062252, 413.347694426, 726.1697083, 738.059837008,
228.479265313, 982.210601477, 693.205052764, 788.820483643, 279.491316277,
381.050856949, 914.836538216, 369.451591691, 828.975002455, 33.0866822761,
552.943575842, 229.194581446, 900.603947989, 697.081349116, 38.8501269177,
599.81038281, 199.242914298, 565.383604483, 241.671424615, 874.199638779,
294.933677019, 238.713921761, 953.886254575, 126.3147347, 156.308580451,
1.01666626965, 410.067483484, 969.052527031, 184.927913357, 282.530928636,
204.745328524, 450.670433109, 129.119772077, 581.256246505, 6.84233762299,
39.4666067908, 865.975624765, 868.401636982, 114.207339514, 921.542812579,
435.593193085, 346.934279797, 830.059520451, 691.952980275, 694.258623119,
548.775134898, 527.057955887, 267.64250387, 113.091700858, 210.713307935,
253.707632265, 832.083850441, 455.161145588, 403.528402677, 237.983049672,
903.782609365, 314.331975332, 209.862002009, 488.057537383, 905.587478495,
929.797161232, 325.793664626, 734.098176437, 519.087164488, 555.076580313,
97.8973027155, 260.92615898, 391.460005616, 187.462694014, 660.460370626,
861.783280209, 751.657352012, 528.280341385, 943.741294674, 204.705877292,
106.65265656, 17.8070044565, 233.101412197, 38.2613365534, 729.385921979,
773.529715946, 429.882870272, 166.782428109, 738.061383178, 381.289974545,
425.98872381, 405.120420988, 672.370449304, 276.696982879, 640.620718977,
244.652935713, 43.3611372718, 611.721720179, 552.336391617, 939.435275549,
337.333914132, 88.3768763311, 537.456873711, 98.6468535441, 601.024140128,
526.374477437, 959.339713851, 794.438445711, 419.365144317, 128.425263651,
894.306756225, 750.689349267, 849.804073407, 144.580034264, 5.21870382078,
316.954557791, 258.037070914, 907.185890899, 821.078874769, 73.0065239329,
902.397997543, 623.811378865, 278.742785334, 546.742289504, 306.338798014,
624.510083572, 278.778694986, 992.433419109, 568.791129496, 800.987198104,
817.781503455, 364.391142069, 229.768701593, 791.500313449, 523.97492671,
711.79222697, 841.514367793, 811.043873744, 312.112640331, 344.686366808,
362.852877349, 908.102021975, 77.1500991776, 383.192419609, 686.951731951,
220.529025627, 867.530056756, 14.3366282672, 408.594160445, 123.165786631,
998.59134116, 548.326927924, 94.1928597561, 324.065711084, 731.488189617,
665.464202995, 306.278211631, 986.173950386, 627.219661146, 333.954277825,
90.2956353646, 162.227112949, 272.511457828, 857.528739452, 503.843643462,
576.629152535, 548.024554676, 363.491120268, 679.874538441, 583.700940158,
106.952792329, 9.38392100562, 338.353858169, 293.571162077, 804.681145319,
767.462050744, 313.643862301, 468.190192547, 572.949085984, 350.221796616,
917.105455473, 303.54853149, 391.390619956, 504.247647998, 93.0135480388,
246.512166315, 908.97228941, 943.218403856, 530.309445245, 309.754887232,
959.789201543, 970.486542083, 797.580736004, 290.319550119, 846.108212188,
532.653666441, 887.339176163, 679.691675058, 912.533817736, 920.067525894,
222.511534133, 96.2743176283, 21.4898199044, 77.2132479765, 371.345880832,
436.959444929, 215.804186286, 399.231434773, 621.793520068, 670.184752989,
898.150427875, 223.481192922, 886.318270113, 516.799097006, 533.999918536,
713.480918784, 917.832970718, 372.788549636, 628.966711322, 944.179767515,
192.101163486, 343.997422161, 804.100009349, 931.645390583, 990.171180084,
260.766724798, 785.681499223, 356.704428677, 700.517830816, 951.584623525,
144.084686297, 259.528412476, 171.745260869, 139.015277926, 901.447521593,
620.501210347, 151.032781338, 46.1159165911, 425.230998623, 894.613060967,
625.179508617, 242.868974022, 106.982050541, 301.464135508, 573.158784529,
688.278622585, 464.999428923, 322.662480912, 110.118666284, 731.557589997,
946.121567036, 495.536592777, 721.786554826, 401.204812967, 523.199107158,
941.414041302, 13.1534875549, 156.596310513, 983.985066957, 371.429892366,
597.927750948, 983.992168593, 170.977999856, 83.6807794877, 817.971626168,
516.088416242, 827.937736139, 859.209288785, 615.315584986, 609.792111637,
554.693516004, 470.967675734, 223.237818744, 990.385531141, 530.824138102,
909.365555497, 994.864631519, 997.447332309, 328.212731713, 307.035914722,
409.123485776, 799.130975525, 967.234526581, 959.671441584, 353.229298604,
420.982728285, 76.7863969552, 28.5449571984, 210.265549753, 913.543941547,
315.091741118, 662.094750123, 852.203603892, 298.207293217, 509.30012338,
65.7679645109, 621.200794815, 935.510670259, 779.330025526, 937.283929747,
756.173490123, 733.792396159, 795.211149457, 302.088313881, 570.641269144,
757.135463505, 242.60845981, 457.593727034, 225.360079221, 142.221548109,
17.6336964488, 360.261380451, 623.475218825, 692.670820913, 584.185971173,
662.861929515, 276.807298644, 480.122225367, 954.608081636, 627.928577217,
459.835351987, 485.168643598, 793.612119132, 654.855590208, 271.958933288,
969.652698005, 976.785064283, 505.116414306, 797.184208528, 628.943525947,
959.160096155, 663.113680213, 768.371354051, 590.4585491, 773.296754989,
407.351603593, 88.0630070991, 905.529072694, 340.59794601, 439.12099902,
233.540790202, 364.088450076, 470.123174021, 102.448882161, 608.789225571,
392.768415134, 713.100614552, 209.2003898, 62.2154487033, 372.921756097,
492.623365519, 581.128110129, 820.570542768, 339.686321984, 713.824072462,
999.045113081, 306.938298797, 184.480805204, 465.144186806, 753.870865996,
78.4248974773, 914.793550949, 952.526126809, 745.524994917, 138.306312094,
727.779875346, 561.393678162, 772.777064716, 72.7542234799, 504.766493657,
753.225048814, 171.848362302, 941.292665664, 441.751526079, 63.0349316166,
535.273783514, 629.040768898, 808.08324249, 457.787416804, 187.372504534,
418.1266562, 433.695070727, 776.092568964, 211.004041498, 740.766035298,
816.391594543, 458.991042003, 94.0308738235, 624.589391691, 118.430830788,
178.888039553, 905.16710481, 148.542033271, 962.242139722, 35.5229349814,
716.472840429, 587.99823034, 252.557765324, 37.8879245566, 399.689202524,
383.425506008, 464.748020898, 308.786698798, 583.669994119, 231.746308268,
524.76171028, 897.374397044, 577.218755662, 562.645278506, 434.940887118,
254.327344231, 540.874257344, 123.680835723, 539.503191151, 816.484752836,
961.415099734, 349.660216271, 596.159995894, 595.762432693, 955.539005194,
687.809440375, 571.725613886, 308.13021345, 617.471476595, 701.003582396,
3.96581420188, 185.987820184, 48.1246847598, 539.131050625, 989.571379915,
249.821643429, 725.895300104, 711.034103146, 74.8291260662, 721.572101122,
142.992636014, 419.591421178, 984.914852359, 36.7363617464, 133.19819475,
380.054235605, 692.83285665, 827.597995374, 995.818667532, 126.589103128,
682.800070236, 466.330036969, 302.143073837, 786.240218566, 299.551583986,
430.07770804, 483.534119703, 473.617334239, 1.64416431436, 953.126991927,
251.892147628, 366.320222366, 137.6878957, 287.000037146, 348.549654758,
55.6668003422, 65.1444653143, 810.336733005, 247.448273359, 514.541152359,
545.299341596, 740.254480746, 607.431747363, 176.075079982, 922.502042696,
585.799132666, 5.53670276888, 304.467968825, 298.915106192, 561.78882135,
42.5914472262, 486.800635021, 61.0833598622, 944.347739678, 668.746271709,
756.586266764, 408.787974993, 161.622855, 76.9222121123, 273.398447299,
224.158188706, 869.44674983, 58.3114312618, 490.559449132, 439.137943547,
816.959032357, 73.0577752895, 613.711059891, 899.395509193, 230.235211112,
651.089914878, 418.795635547, 873.424446884, 897.792771782, 704.102385815,
518.126528796, 545.099037865, 104.410545145, 416.115870896, 617.579630637,
333.700660761, 698.454752336, 323.794560581, 614.778464988, 978.982432433,
656.459219246, 311.387615291, 262.993283002, 98.703803798, 316.038737757,
511.251635007, 597.716611457, 837.873132231, 985.745340467, 653.714321915,
759.002380543, 257.908251778, 764.546995782, 336.260865935, 746.604123567,
640.209566004, 448.844970845, 925.255475065, 972.485574416, 47.0841050739,
231.133339622, 994.520385942, 766.591528041, 355.476025092, 325.525579517,
591.707824382, 302.51618806, 250.791496027, 325.751078168, 148.78604636,
488.176440838, 760.361648381, 213.189413642, 509.565395067, 284.468094856,
567.126065507, 828.024492382, 938.902419548, 141.420420877, 719.989392811,
854.189823836, 545.746745299, 713.177111859, 800.749418944, 217.781813549,
692.416094897, 703.129981045, 607.928079305, 876.072026145, 983.933471359,
824.755945781, 472.143208136, 22.2541577801, 640.071388089, 52.8148724127,
646.607940231, 228.870749952, 824.59255967, 20.4078078906, 211.860134988,
176.392620646, 786.744977859, 983.183973543, 738.585099683, 75.976724176,
49.4604753001, 628.2042889, 991.358549436, 526.125428702, 836.487360003,
216.533860839, 654.106395874, 65.4049854833, 858.352891393, 777.146190395,
630.588944701, 141.352770092, 501.454292251, 792.956685991, 709.053823609];

console.log=(...x)=>O.textContent+=x.join` `+`\n`

console.log(test.length)
var r=0
test.forEach(v=>{
  v=v+''; // to decimal string
  var x=F(v);
  check = v==eval(x)
  if (!check) console.log ("Error",v,x,eval(x));
  else
    // console.log(v,x),
    r+=x.length/v.length

});
console.log(r/1000)
<pre id=O></pre>


text:
Brass Fingerings
For this challenge, you need to print out the fingerings for various brass instruments.
The notes an instrument can play (as well as their fingerings) are listed below:
    Cornet                       Baritone
    Trumpet  Bugle  French Horn  Euphonium  Tuba
A#0                                         0
B0
C1                                          1234
C#1                                         134
D1                                          234
D#1                                         14
E1                                          24
F1                                          4
F#1                                         23
G1                                          12
G#1                                         1
A1                                          2
A#1                              0          0
B1                  123          1234       24
C2                  13           134        4
C#2                 23           234        23
D2                  12           124        12
D#2                 1            14         1
E2                  2            24         2
F2                  0            4          0
F#2                 123          23         23
G2                  13           12         12
G#2                 23           1          1
A2                  12           2          2
A#2                 1            0          0
B2                  2            24         12
C3                  0            4          1
C#3                 23           23         2
D3                  12           12         0
D#3                 1            1          1
E3  123             2            2          2
F3  13              0            0          0
F#3 23              12           23         23
G3  12              1            12         12
G#3 1               2            1          1
A3  2               0            2          2
A#3 0               1            0          0
B3  123             2            12         12
C4  13              0            1          1
C#4 23              23           2          2
D4  12              12           0          0
D#4 1               1            1          1
E4  2               2            2          2
F4  0               0            0          0
F#4 23              2            23         23
G4  12       0      0            12         12
G#4 1               2            1          1
A4  2               0            2          2
A#4 0               1            0          0
B4  12              2            12
C5  1        0      0            1
C#5 2               23           2
D5  0               12           0
D#5 1               1            1
E5  2        0      2            2
F5  0               0            0
F#5 23
G5  12       0
G#5 1
A5  2
A#5 0

Input

A single string with a name of an instrument.  You can assume the name will always be one of the 7 listed above.
A note, which can be a single string or a string and integer.  You can assume the note will match one of the notes listed above.

Output

The fingering for the note on that instrument.  This can either be a list of integers (one for each digit), or a single integer.
If the instrument cannot play a given note (listed as blank above), return "Impossible"

Test Cases
Cornet D#3        Impossible
Cornet E3         123
Trumpet G4        12
Trumpet B4        12
Trumpet F#5       23
Bugle F#5         Impossible
Bugle G5          0
Bugle G1          Impossible
French Horn B1    123
French Horn C3    0
French Horn E5    2
French Horn A#5   Impossible
Baritone A#5      Impossible
Baritone A#2      0
Baritone B2       24
Baritone B1       1234
Euphonium F2      4
Tuba A#0          0
Tuba B0           Impossible
Tuba C1           1234
Tuba B1           24
Tuba G#4          1
Tuba B4           Impossible

Notes

Trumpet and Cornet have the same fingerings, as well as Baritone and Euphonium
These ranges aren't comprehensive.  I've tried to stick to the "standard" notes, but instruments can often go below (pedal notes) or above.
The notes listed are in concert pitch
You'll notice that there are a lot of patterns between the fingerings.  Finding those patterns is critical to golfing this well.

This is a code-golf, so the shortest answer in your favorite language wins!

This is the kind of weird info you learn on PPCG. The only wind instrument I play is tin whistle, but I understand the brass valves work as follows: valve 2 =-1 semitone, valve 1=-2 semitones, valve 3=-3 semitones, valve 4=-5 semitones. I find it odd that the tuba is different from the euphonium, I would think the fingerings should be the same, just an octave down. I think the blank line should be removed and a 124 inserted at the appropriate place. Am I right?

A little research shows it depends if your tuba is compensating or noncompensating. I am correct for a compensating tuba. http://www.norlanbewley.com/tuba/fingering-tuba-1.htm shows the B is indeed missed for a noncompensating tuba, though he skips a 14 instead of 124 at the D. It seems like basically you're tuning on the fly with the embocouchure. This question has given me more respect for tuba players! I guess we stick with the question as written then.

@steveverrill I was literally in the middle of saying that very thing :)

Oh another minor point: Normally the octave changes number between B and C, not between G and A. In reality all your A's and B's should be an octave lower than you have written them. Are you going to correct it, or leave it as it is? (easier to golf as it is.)

@steveverrill welp, my bad.  I have no idea how I didn't know that, as I have taken music theory courses.

You probably need to edit the test cases too.

Ruby, 292
->i,n{t='nberlu'.index(i[-2])%5
u,v=t<2?[4,24]:[13,123]
a=[]
'!&)+-259>EQR'.tr(?+,t==3??+:?)).bytes{|i|a[i,1]=[0,2,1,12,23,u,v,14,124,234,134,1234]}
p=n[0].ord*13/8%12+n[-1].to_i*12+n.size
p<17&&p-=1
f=a[x='i]udw'[t].ord-p]
('&!-!2'[t]..'QRKK>'[t])===x.chr&&p!=12&&(t<4||1>f)?f:"impossible"}

Explanation
The table below shows more clearly the similarities and differences between the instruments. Basically, a fingering of 0 corresponds to one of the harmonics of the main tube. Not all harmonics are available on all instruments. For example the French horn is the only one to use the 9th harmonic. Differences are apparent by spaces in the table, or highlighted with *
The bugle is simplest and has no valves. The other instruments have at least 3 valves. Valves are used to add bits of tube to the basic instrument to lower the pitch. Valve 2=-1 semitone, Valve 1=-2 semitones, Valve 3=-3 semitones, and valve 4 (if present) is -5 semitones. Valve 4 extends the range of the lower instruments, and is also used as an alternative fingering 4 or 24 for notes which are fingered as 13or 123 on instruments without a 4th valve.
All the notes from a particular harmonic downwards are fingered in the same way, up until the next harmonic down is reached. The harmonics are quite closely spaced in the upper range, but get sparser in the lower range. At the start of the code a table is built from the highest harmonic downwards by repeatedly inserting a complete set of 12 fingerings into the array. Some fingerings are unused because another harmonic is encountered before the lower fingerings are required. This data is not overwritten, it is pushed to the end of the array, so the end of the array contains a lot of garbage, but this does not matter.
Then all we have to do is transpose the input to the right place on the table and return the fingering. Also, we have to check if the note is in range. Rather than do this with the note itself, I do it with the position in the table of fingerings. This uses a more limited range of values.
   Corn         Bari
   Trum Bug HornEuphTuba
No                      ASC char    harmonic

49                  0   82  R   fundamental (repeat for tuba)
48              0   0   81  Q   fundamental (not available on tuba)
47              12341234
46              134 134
45              234 234
44              124
43              14  14
42  123*    123*24  24
41  13*     13* 4   4
40  23      23  23  23
39  12      12  12  12
38  1       1   1   1
37  2       2   2   2
36  0       0   0   0   69  E   2nd harmonic
35  123*    123*24  24
34  13*     13* 4   4
33  23      23  23  23
32  12      12  12  12
31  1       1   1   1
30  2       2   2   2
29  0   0   0   0   0   62  >   3rd harmonic
28  23      23  23  23
27  12      12  12  12
26  1       1   1   1
25  2       2   2   2
24  0   0   0   0   0   57  9   4th harmonic
23  12      12  12  12
22  1       1   1   1
21  2       2   2   2
20  0   0   0   0   0   53  5   5th harmonic
19  1       1   1   1
18  2       2   2   2
17  0   0   0   0   0   50  2   6th harmonic
16  23      23  23  23
15  12      12  12  12
14  1       1   1   1
13  2       2   2   2
12  0       0   0   0   45  -   8th harmonic
11          2*  12  12
10          0*  1   1   43  +   9th harmonic
9           2   2   2
8           0   0   0   41  )   10th harmonic
7           1   1   1
6           2   2   2
5           0   0   0   38  &   12th harrmonic
4           23      23
3           12      12
2           1       1
1           2       2
0           0       0   33  !   16th harmonic

commented in test program
#penultimate letter of instrument
                    range     16th harmonic
#n 0 baritone       A#1-F5    A#5
#b 1 tuba           A#0-A#4   A#4
#e 2 trumpet,cornet E3-A#5    A#6
#r 3 french horn    B1-F5     F5
#l 4 bugle          G4-G5     C7
#u 0 euphonium
g=->i,n{
  t='nberlu'.index(i[-2])%5                  #translate instrument into code above according to penultimate letter of name
  u,v=t<2?[4,24]:[13,123]                    #select fingerings for 4 valve or 3 valve instruments
  a=[]                                       #empty fingerings table
  '!&)+-259>EQR'.                            #list of harmonics as ascii codes + =9th harmonic, only on french horn
    tr(?+,t==3??+:?)).                       #if not french horn, delete the + and replace with duplicate of symbol before it )
      bytes{|i|a[i,1]=                       #for each value in the string, insert a complete table of 12 fingerings into a,
       [0,2,1,12,23,u,v,14,124,234,134,1234]}#pushing garbage fingerings to the end
   p=n[0].ord*13/8%12+                       #pitch of note depends on note name
     n[-1].to_i*12+n.size                    #+12*octave number. Length of string is 1 longer for sharp, so add this also.
   p<17&&p-=1                                #for tuba, consider pitch lowered by 1 if below D#1 to skip over the 124 fingering
   f=a[x='i]udw'[t].ord-p]                   #subtract p from 'i]udw'[t].ord to find x, the position of the fingering in the table. Assign the actual fingering to f
   ('&!-!2'[t]..'QRKK>'[t])===x.chr&&        #if x is in the range for the instrument
     p!=12&&                                 #and the note is not B0 (missing for tuba, completely out of range for other instruments)
    (t<4||1>f)?                              #and the instrument is not a bugle (or if it is, the fingering is 0)
      f:"impossible"                         #return the fingering. Otherwise return impossible.
}

[['Cornet','D#3'],       #Impossible
['Cornet','E3'],         #123
['Trumpet','G4'],        #12
['Trumpet','B4'],        #12
['Trumpet','F#5'],       #23
['Trumpet','A#5'],        #0
['Trumpet','B5'],         #Impossible

['Bugle','F#5'],         #Impossible
['Bugle','G5'],          #0
['Bugle','G1'],          #Impossible
['Bugle','C4'],           #Impossible
['Bugle','G4'],           #0
['Bugle','C6'],           #Impossible

['French Horn','A#1'],    #Impossible
['French Horn','B1'],    #123
['French Horn','C3'],    #0
['French Horn','E5'],    #2
['French Horn','F5'],     #0
['French Horn','F#5'],    #Impossible
['French Horn','A#5'],   #Impossible

['Baritone','A#5'],      #Impossible
['Baritone','A#2'],      #0
['Baritone','B2'],       #24
['Baritone','A1'],        #Impossible
['Baritone','A#1'],       #0
['Baritone','B1'],       #1234
['Euphonium','F2'],      #4
['Euphonium','F5'],       #0
['Euphonium','F#5'],      #Impossible

['Tuba','A#0'],          #0
['Tuba','B0'],           #Impossible
['Tuba','C1'],           #1234
['Tuba','C#1'],           #134
['Tuba','D1'],            #234
['Tuba','D#1'],           #14
['Tuba','B1'],           #24
['Tuba','G#4'],          #1
['Tuba','A#4'],           #0
['Tuba','B4']].each{|c|  #Impossible
  puts c
  puts g[c[0],c[1]]
  puts
}


text:
Risky Phone Plan
You have a phone plan that lets you talk 180 minutes a day. Every day that you go over your daily limit you have to pay a fine of F = Men, where M is the number of minutes you went over and n is the number of days you have gone over (e.g if I went 20 minutes over the daily limit and it's my 2nd day going over, I have to pay 20*e2 = 147.78).
You will be given a list of 12-hour clock times. Even-indexed times represent the start of a phone call, odd-indexed times represent the end of a phone call. Using this list find out how much money the person has to pay in fines.
Notes

Please use an approximation of e that is at least as accurate as 2.718
You never need to round your answers or include a currency symbol.
The first time in the list will always be an A.M (morning) time.
Remember that in 12-hour time 1 comes after 12 (you can think of 12 as 0).
A day starts at 12:00 AM and ends at 11:59 PM
If a number is lower than the previous time, then that means that it is in the opposite (A.M./P.M) time range.
A call will never start in one day and end in another.

Test Cases
10:30
2:30
5:30
6:30

This person made two phone calls in one day. One from 10:30 A.M. to 2:30 P.M., another from 5:30 P.M to 6:30 P.M. In total, they talked for 5 hours this day, going 120 minutes over the daily limit. Since it's their first offense, they have to pay 120*e = $326.19 (yes, their phone plan is quite Draconic).

10:30
11:45
5:15
6:45
8:20
9:20
5:30
7:50
2:30
3:30

This person made several phone calls over 2 days. The first day they were on the phone from 10:30-11:45 A.M, 5:15-6:45 P.M., and 8:20-9:20 PM using a total of 225 minutes. That is an overage of 45 minutes. So their fine for the day is 45*e = $122.32.
The next day they talked from 5:30-7:50 A.M and 2:30-3:30 P.M., a total of 200 minutes. They went over by 20 minutes, and since it's their second offense they pay 20*e2 = $147.78
You output their total fee as $122.32 + $147.78 = $270.10

10:30
11:30
6:30
7:30
9:45
11:00
10:25
11:25
8:45
9:45
6:00
8:00
2:30
4:30

Day 1:

10:30-11:30 A.M., 6:30-7:30 P.M., 9:45-11:00 P.M. = 195 minutes
Fee: 15*e = $40.77

Day 2:

10:25-11:25 A.M., 8:45-9:45 P.M. = 120 minutes
Fee: $0

Day 3:

6:00 - 8:00 A.M., 2:30-4:30 P.M. = 240 minutes
Fee: 60*e2 = $443.34

Output: $40.77 + $0 + $443.34 = $484.11

This sounds a lot like VerizonMath

@user8 Yes, as you can see in the first test case.

Would the call log 8:00 9:00 7:00 6:00 be parsed as Day 1 8:00AM - 9:00PM, Day 2 7:00AM - 6:00PM or be invalid? If it's valid it would break the rule that "If a number is lower than the previous time, then that means that it is in the opposite (A.M./P.M) time range".

@user8 no, the first part is parsed as 8-9 AM, the 2nd part is invalid bcuz it crosses from day 1 to day 2.

Oh sorry, I meant to write Day 1 8:00AM - 9:00AM. But thanks for clarifying.

Perl 5, 185 bytes
@c=map{s/(.+):(.+)/$1%12*60+$2/er}<>;while(@c){$s=shift@c;$e=shift@c;$p+=0>($k=$e-$s)?720+$k:$k;if($e>$c[0]||$k<0){if($m||!@c){$f+=0>($p-=180)?0:$p*exp++$d;$p=0}$m=!$m}}printf'$%.2f',$f

Try it online!


text:
A loose spellchecker
John Doe used to be one of the fastest QWERTY keyboard typists in the world, but a recent head injury caused by a stampeding herd of downgoats has critically hampered his ability to type accurately. In a desperate effort to retain his reputation as a typing prodigy, he has tasked us with the creation of a spellchecker - well, sort of. This spellchecker's rigged so that John Doe can worry less about accuracy and more about speed.
Challenge
Here's the keyboard you'll be using. NOTE: non-spacebar keys are separated by 2 spaces, with the unshifted key followed by the shifted key.
`~   1!  2@  3#  4$  5%  6^  7&  8*  9(  0)  -_  =+
Tab  qQ  wW  eE  rR  tT  yY  uU  iI  oO  pP  [{  ]}  \|
     aA  sS  dD  fF  gG  hH  jJ  kK  lL  ;:  '"  enter
     zZ  xX  cC  vV  bB  nN  mM  ,<  .>  /?
             [    SPACEBAR    ]

Notice how I have arranged the keys to line up properly. This is crucial for this challenge to work.
Write a full program/function that, given 2 strings of equal length containing only characters from the above keyboard, outputs a truthy/falsy value according to the following:

If all characters' keys are at most 1 away (horizontally, vertically, or diagonally) from the characters' keys at the same index in string 2, then output truthily.

Example using a: Any characters in aAqQsSzZwWxX or \t (tab key) would return truthily.

Special cases: \n (enter key) would return truthily for any character in [{]}\|'" or \n. Spaces (spacebar key) would return truthily for any character in xXcCvVbBnNmM,< or spaces.

Otherwise, output falsily.
Note: Tabs and newlines will be actual representations instead of their escaped equivalents (\t and \n).

This is code-golf; shortest code wins.
Example test cases
String1     String2        Output
---------------------------------
asdf        QWeR        => true
cat         gsl         => false
12345       qWeRty      => true
John Doe    Jonh Deo    => false

"a recent head injury caused by a stampeding herd of downgoats" ಠ_______ಠ

Well, I mean, he did post some pretty badly-golfed answers...

@Downgoat I'll get you for what you did to him.

JavaScript (ES6), 287 bytes
(a,b)=>[...a].map((l,i)=>{p=k[g="indexOf"](l);q=k[g](o=b[i]);r=r?l==s|o==s?~m[g](l)&&~m[g](o):(x=(p%28/2|0)-(q%28/2|0))<2&x>-2&(y=(p/28|0)-(q/28|0))<2&y>-2:0},r=k=`\`~1!2@3#4$5%6^7&8*9(0)-_=+  \t qQwWeErRtTyYuUiIoOpP[{]}\\|  aAsSdDfFgGhHjJkKlL;:'"
     zZ${m="xXcCvVbBnNmM,<"}.>/?`,m+=s=" ")|r

Explanation
Returns 1 for true and 0 for false.
Note that the \t should be a literal tab character.
(a,b)=>
  [...a].map((l,i)=>{               // for each character l at index i in word A
      p=k[g="indexOf"](l);          // p = index of l in k
      q=k[g](o=b[i]);               // o = letter in word B, q = index of o in k
      r=r?                          // if r
        l==s|o==s?                  // if l or o is a space
          ~m[g](l)&&~m[g](o)        // check the space-matching characters for l and o
        :
          (x=(p%28/2|0)-(q%28/2|0)) // X distance between letters A and B
            <2&x>-2&                // if distance is 2 or greater, r = 0
          (y=(p/28|0)-(q/28|0))     // Y distance between letters A and B
            <2&y>-2                 // if distance is 2 or greater, r = 0
      :0                            // do nothing if r == 0
    },
    r=                              // r = result

    // Keyboard string, each row is 28 characters long, using spaces as padding
    k=`\`~1!2@3#4$5%6^7&8*9(0)-_=+  \t qQwWeErRtTyYuUiIoOpP[{]}\\|  aAsSdDfFgGhHjJkKlL;:'"
     zZ${m="xXcCvVbBnNmM,<"}.>/?`,

    m+=                             // m = list of characters that are adjacent to space
    s=" "                           // add space to the list, s = space character
  )
  |r                                // return r

Test

var solution = (a,b)=>[...a].map((l,i)=>{p=k[g="indexOf"](l);q=k[g](o=b[i]);r=r?l==s|o==s?~m[g](l)&&~m[g](o):(x=(p%28/2|0)-(q%28/2|0))<2&x>-2&(y=(p/28|0)-(q/28|0))<2&y>-2:0},r=k=`\`~1!2@3#4$5%6^7&8*9(0)-_=+  \t qQwWeErRtTyYuUiIoOpP[{]}\\|  aAsSdDfFgGhHjJkKlL;:'"
     zZ${m="xXcCvVbBnNmM,<"}.>/?`,m+=s=" ")|r
A = <input type="text" id="A" value="John Doe" />

B = <input type="text" id="B" value="Jonh Deo" />

<button onclick="result.textContent=solution(A.value,B.value)">Go</button>

Wow, nice job! Although you might be able to save some bytes by lowercasing the input before mapping it (I think). Just a tip that might not work...

@ՊՓԼՃՐՊՃՈԲՍԼ The problem is that my solution works by putting the characters in a 28x4 grid. If I don't include the upper-case letters I would need to pad it to 28 characters wide anyway. :( It might be possible to generate the upper-case letters in the grid though. I'll check how many bytes that takes... Nope, too many.