text:
Find the nearest clock hands
Challenge
Given a number of seconds past midnight, output the smallest angle between any two hands on a clock face, using as few bytes as possible.
You may assume that the number of seconds is always less than 86400.
Angles may be represented in degrees or radians.
A reference solution is at: http://ideone.com/eVdgC0
Test Cases (results in degrees)
0 -> 0
60 -> 0.5
600 -> 5
3600 -> 0
5400 -> 45
6930 -> 84.75
50000 -> 63.333

Clarificarions

The clock has 3 hands: hours, minutes and seconds.
All hands move continuously, thus hour and minute hands can be found between graduations on the clock face.

Related challenge (minute and hour hands only, in degrees)

You should probably specificy that there is a second hand on the clock.

Can you add some test cases?

@BetaDecay, I've shown some in my answer.  They focus on hands pointing near 1, 6 and 11, so the 1 and 11 are closest in each case.

On some clocks, the minute hand jumps to the next minute when the second hand reaches the top. On others, it moves continuously. I figure this is a clock where it moves continuously? Also, while it's clear once you read carefully, I initially found "second hand" ambiguous, because most clocks have at least two hands anyway, so adding the "second hand" really adds a third hand.

@RetoKoradi But then again, no one refers to the second hand as the third hand and in turn would confuse more people if changed

I have updated the question to address these points.

@BetaDecay Certainly. I might have said something like: "The clocks has three hands: hours, minutes, and seconds."

CJam, 36 35 34 32 30 bytes
riP*30/_60/_C/]2m*::-:mc:mC$3=

The output is in radians. I've verified the solutions for all 86400 possible inputs.
Try it online in the CJam interpreter.
Idea
Since 2π radians is a full lap, each minute/second interval on the clock is 2π/60 = π/30 radians wide.
Thus, dividing the number of seconds by π/30 yields the position of the second hand.
The minute hand moves at one sixtieth of the pace of the second hand, so dividing the result from above by 60 yields the position of the minute hand.
Likewise, dividing the last result by 12 yields the position of the hour hand.
Note that our three quotient from above are not necessarily in the range [0,2π).
By calculating all nine possible differences of the hands' angles, we obtain three 0's (angular distance between a hand and itself) and the six distances between the different hands.
If the closest hands are on a half that does not include 12, one of the differences from above will be the desired output (mod 2π).
However, at 01:55:30 (for example), the hour hand is at an angle of 1.008 rad (57.75 deg) and the minute hand at an angle of 5.812 rad (333.00 deg) from 12, giving a difference of 4.804 rad (275.25 deg). By subtracting this result from a full lap, we obtain the angle measured "in the other direction", which equals 1.479 rad (84.75 rad).
Now, rather than mapping each angle θ in [0,2π) and conditionally subtracting the result from π, we can simply calculate arccos(cos(θ)), since cos is both periodic and even, and arccos always yields a value in [0,π).
Skipping over the three smallest results (all zero), the fourth smallest will be the desired output.
Code
ri                             e# Read an integer from STDIN.
  P*30/                        e# Multiply by π and divide by 30.
       _60/                    e# Divide a copy by 60.
           _C/                 e# Divide a copy by 12.
              ]2m*             e# Push the array of all pairs of quotients.
                  ::-          e# Replace each pair by its difference.
                     :mc       e# Apply cosine to each difference.
                        :mC    e# Apply arccosine to each cosine.
                           $3= e# Sort and select the fourth smallest element.

Alternate version (34 bytes)
rd6*_60/_C/]360f%2m*::m360X$f-+$6=

The output is in degrees and no trigonometric functions are used.
Try it online in the CJam interpreter.

Mathematica, 40 bytes
Min@Abs@Mod[#{11,708,719}/120,360,-180]&

Explanation: Let t be number of seconds since midnight. The position of each hand is
hour: t/120 (mod 360)
min:  t/10 (mod 360)
sec:  6t (mod 360)

To calculate the absolute angular distance between x degrees and y degrees, we can mod y - x by 360 into the range [-180, 180] and then take the absolute value. (Note that there is no restriction on x and y.) So this function just calculates the pairwise differences t/10-t/120, 6t-t/10, and 6t-t/120 and does that.

Sorry, not familiar with Mathematica, but does this actually accept an argument or variable for the number of seconds since midnight?

@Winny Yes, it's a pure function (indicated by &) and the first argument it's passed is referred to inside as #.

Python, 65
lambda n,l={720,60,1}:6*min((n/x-n/y)%60for x in l for y in{x}^l)

The distance traveled by the hour, minute, and second hand, in units of 1/60 of the circle are h,m,s = n/720, n/60, n/1. We can take these mod 60 to get their position on the circle from 0 to 60.
If we take their difference mod 60, we get the number of units that one is in front of the other. We take all six possible differences, find the min, then multiply by 6 to rescale to 360 degrees.
The two-layer list comprehension first chooses the first hand as represented by 720, 60, or 1, then chooses the other hand out of that set with the first choice removed via set xor.
I tested this exhaustively against the reference code.

C#, 163 152 bytes
This creates every hand twice to count for wrap-around, then loops through every combination and finds the minimum angle between hands.  Calculations are performed in 60 divisions, then multiplied by 6 to get degrees.
Indented for clarity:
float F(int s){
    float b=60,c;
    float[]a={c=s/b/b%12*5,c+b,c=s/b%b,c+b,s%=60,s+b};
    for(s=36;s-->0;)
        b=s%6!=s/6&(c=(c=a[s%6]-a[s/6])<0?-c:c)<b?c:b;
    return b*6;
}

Example output:
    0 seconds, 00:00:00, smallest angle is 0°
43200 seconds, 12:00:00, smallest angle is 0°
86399 seconds, 23:59:59, smallest angle is 0.09164429°
 3330 seconds, 00:55:30, smallest angle is 54.75°
39930 seconds, 11:05:30, smallest angle is 60.25001°
21955 seconds, 06:05:55, smallest angle is 65.49998°
21305 seconds, 05:55:05, smallest angle is 59.50001°
 5455 seconds, 01:30:55, smallest angle is 75.45831°
41405 seconds, 11:30:05, smallest angle is 44.95834°

Nice solution to account for wrap around

TI-BASIC, 17 bytes
min(cos⁻¹(cos(ΔList(Ans{6,.1,5!⁻¹,6

Uses Dennis's arccos(cos( to normalize distances; however, rather than calculating all pairwise distances, it only calculates the three needed using ΔList([seconds],[minutes],[hours],[seconds].
This program expects Degree mode and returns the answer in degrees.
EDIT: 5! is one byte shorter than 120.


text:
Cross platform... You wish
Write a program that will produce differing behaviors on as many different platforms as you can. Each differing platform awards one point (including an initial platform, meaning you can't score less than 1*). Mechanisms intended for determining the target/executing platform (e.g. through platform compilation statements or APIs like .NET's Environment.OSVersion.Platform) must not be used. The answer with the highest score wins (where upvotes are the tiebreakers).
For example, consider the following program in the Blub language: print (1+2). If this program were to print 3 on every platform it is compiled and run on, its score would be 1. However, if, for any reason, it were to print 4 on PDP-11s, its score would be 2. Etc. But the following C snippet, for example, is an invalid entry: #ifdef WIN32 ... #endif.

Definitions/details:

Distinct platform: the combination of a) the hardware architecture b) the OS and its MAJOR version number (e.g. 1.0.0 and 1.1.0 are considered the same OS)
Differing behavior: two behaviors are the same iff they produce similar side-effects (e.g. creating the same file with the same contents), or if the side-effect are errors of the same kind. For example, if a program segfaults on two distinct platforms, but the segfault message is different on these platforms, this is still considered the same behavior; while a program producing a zero-division error on one platform and a stack overflow (see what I did there? ;) error on another is producing different behavior.
All undefined behaviors are considered equivalent.
Program must be invoked in an equivalent manner on all platforms (however; this does mean you can pass command-line parameters if you so desire)

* Well, I guess you'd score zero if your program ran on zero platforms. But um... Yeah nevermind.

Must the program be ran in the same programming language on all platforms? e.g. what if I write a program that prints 1 on Windows and 2 on OSX, with the detail that I run it as a Python script on Windows and a C program on OSX?

@Geobits I consider OS versions with the same minor version number to be the same platform (same API).

@Mauris yes, the program must be run in the same language. Also, come to think of it, they should generally take the same command-line parameters (if any), so you can't just provide different arguments on different platforms. Thanks for the great corner-cases so far guys :)

Do difference browsers count as different platforms for JavaScript?

@vihan1086 Hmm... Lets say no. That's too easy ;)

"differing behavior" may need a more precise definition. For example, if a program crashes on multiple platforms, but with different errors, is that differing behavior?

@RetoKoradi No, I'll say that example is not differing behavior. Edited to include this rule.

I don't like this challenge. How do you test this on different platforms without having access to them?

@mbomb007 I'm sure there are a million APIs that are documented to behave differently on different platforms (which is what I expect most solutions will take advantage of), so answers shouldn't be too hard to verify. As for the ones that are bugs, well, we'll burn that bridge when we come to it.

What if I write a program that prints an uninitialized pointer?

@someuser that would be undefined behavior on every platform, and undefined behavior == undefined behavior.

If there are a million APIs that are documented to have different behavior on different platforms and you expect us to use that to our advantage, most of the answers will probably just be "look I found this on the internet, should work, can't test."

@AlexA. ok, well I guess I'm at a dead end. I suppose there isn't a way to verify solutions as this question stands and I can't think of any way to make that possible for every solution. Does anyone have any ideas? If not, then I guess we'll just have to close this.

@Jwosty How about you add an underhanded and allwo APIs that are meant to check for plattforms?

C
I will take a stab at it with a textbook-like example:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char a[] = {1,2,3,4,5,6,7,8};
    if (sizeof(&a) > sizeof(int)) {
        printf("foo %d %d\n", *(int *)a, *(long *)a);
    } else {
        printf("bar %d %d\n", *(int *)a, *(long *)a);
    }
}

64-bit Platform prints: foo
32-bit Platform prints: bar
Little Endian Platforms: 67305985
Big Endian Platforms: 16909060
So there is at least 4 combinations.
On top of that, some very old platforms has int defined as 16-bits. And some platform has long defined as 64-bits. So the result will be different as well.
C has been quite platform specific, if you dig deep enough. It is not hard to come up with thousands of combinations (2^10+).

Isn't this four because of the \n vs \n\r on *nix and windows?

I guess that's true if I divert the output into a file on Linux and read it on Windows. But I don't have a Windows C compiler to confirm that natively.

printf("\n"); does output \r\n on windows (redirecting stdout to a file on windows resulted in a 2 byte file).

16/32/64-bit x86/x64 assembly, 16 bytes, 4 combinations
Byte-code:
31 C9 41 E2 0A 66 49 41 74 05 0F 00 C0 03 C1 C3
Disassembly (16-bit):
    xor  cx, cx ;cx=0
    inc  cx     ;cx=1
    loop l1     ;fall through
    dec  cx     ;cx=FFFF
    inc  ecx    ;cx=0000
    je   l1     ;branch taken
    ;...
l1: ret
Disassembly (32-bit):
    xor  ecx, ecx ;ecx=0
    inc  ecx      ;ecx=1
    loop l1       ;fall through
    dec  cx       ;ecx=0000FFFF
    inc  ecx      ;ecx=00010000
    je   l1       ;branch not taken
    sldt ax       ;detect VMware, VirtualPC, Parallels, etc.
    add  ecx, eax ;conditionally modify ecx
l1: ret
Disassembly (64-bit):
    xor   ecx, ecx ;rcx=0 (implicit 64-bit zero-extension)
    loopq l1       ;rcx becomes FFFFFFFFFFFFFFFF, branch taken
    ...
l1: ret
It returns:
- CX=0000 in 16-bit mode;
- ECX=10000 in 32-bit non-virtual mode;
- ECX=(random) in 32-bit virtual mode;
- RCX=FFFFFFFFFFFFFFFF in 64-bit mode.

source: Stack Exchange

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

sort: votes


text:
Average Out Two Lists
Average out two lists
Challenge
Given two lists of positive integers, determine whether it is possible to rearrange the elements into two new lists such that the new lists have the same arithmetic mean (average).
Input
The input can be taken through STDIN or as function arguments. Input can be taken as a list, or if your language doesn't support lists (or anything similar such as arrays/dictionaries) then the input can be taken as a comma- or space-delimited string. That is,
"1 4 8 2 5,3 1 5 2 5"

is the same as:
[ [1,4,8,2,5], [3,1,5,2,5] ]

All input lists will be the same length.
Output
If you can create two new lists with the same average, your program/function should print or return the mean. If you can't, your program should output a sad face :(.
Note that the rearranged lists with equal means, if they exist, need not has the same length. Any number of swaps can be made to create the new lists.
Examples
1 4 8 2 5,3 1 5 2 5 -> 1 4 8 2 3,5 1 5 2 5 (swapped 3 and 5) -> 3.6
1 3 6 2,16 19 19 14 -> [[1,6,19,14],[3,2,16,19]] -> 10
2 6 2,6 3 5 -> 2 6,2 6 3 5 (moved 2) -> 4
90 80 20 1,40 60 28 18 -> :(

This is code-golf so shortest code in bytes wins. As always, standard loopholes are disallowed.

Can we swap any number of elements from each list? Can one list just give elements to the other? I don't understand what you mean by "valid permutation exists". Also, this needs more test cases.

@xnor you can just move one element, to another. I'll add a few more test cases

So, is this equivalent to, "Given a single list (their union), can in be partitioned into two nonempty lists with the same average ?"

@Fatalize yes, "Output lists may be different lengths"

@xnor Yes, pretty much

@vihan1086 Why not take a single list as input then? Your presentation seems needlessly complicated.

@xnor I originally posted this in the sandbox and I changed the challenge since. I'll go though and reword it

@vihan1086 Looking at your Sandbox post, many of these same requests for clarification were made there, and you said you clarified many of these points, but your edits didn't really make them clearer. You would have been better off replacing the confusing text rather than adding further text.

Updated my answer to fit the new specifications

@Kamehameha it won't result in 50 because that's not possible so it would output :(. The average of 33,33,34 is 33.3333...

@AlexA. you're right, that is a valid solution, I'll fix that. You can do as many swaps as you need

I made some changes to the wording to clarify things a bit. If it doesn't match your intent, please roll back the edit.

Pyth, 24 bytes
?}KcsJsQlJmcsdldtPyJK":(

Try it online: Demonstration
Thanks to Dennis for noticing an error and golfing one byte.
Explanation:
?}KcsJsQlJmcsdldtPyJK":(   implicit: Q = evaluated input
      sQ                   all numbers of Q
     J                     save them in J
  KcsJ  lJ                 average of J (sum(J) / len(J))
                           store in K
          m     tPyJ       map each nonempty subset d of J to:
           csdld             average of d
?}                         if K in ^:
                    K        print K
                     ":(   else print sad-face

Nice work, +1. But does Pyth really not have a built-in for computing the mean?

@AlexA. It now does have one (namely .O)

SWI-Prolog, 159 bytes
a(A,B):-append([A,B],R),permutation(R,S),append([Y,Z],S),sum_list(Y,I),sum_list(Z,J),length(Y,L),length(Z,M),L\=0,M\=0,I/L=:=J/M,W is J/M,write(W);write(':(').

Called as a([1,4,8,2,5],[3,1,5,2,5]).

Julia, 101 bytes
f(a,b)=(m=mean;p=filter(i->m(i[1])==m(i[2]),partitions([a,b],2));isempty(p)?":(":m(collect(p)[1][1]))

This creates a function that accepts two arrays and returns a string or a float accordingly.
Ungolfed + explanation:
function f(a,b)
    # Get the set of all 2-way partitions of the array [a,b]
    l = partitions([a,b], 2)

    # Filter the set of partitions to those where the two
    # contained arrays have equal means
    p = filter(i -> mean(i[1]) == mean(i[2]), l)

    # Return a frown if p is empty, otherwise return a mean
    isempty(p) ? ":(" : mean(collect(p)[1][1])
end

R, 94 Bytes
Basically the same as Jakubes I think.  If the mean of both lists matches the mean of any combination of the values in lists up to but not including the combined length of the list, output the mean otherwise the sad face.
if(mean(l<-scan())%in%unlist(sapply(2:length(l)-1,function(x)combn(l,x,mean))))mean(l)else':('

Test run
> if(mean(l<-scan())%in%unlist(sapply(2:length(l)-1,function(x)combn(l,x,mean))))mean(l)else':('
1: 1 4 8 2 5
6: 3 1 5 2 5
11:
Read 10 items
[1] 3.6
> if(mean(l<-scan())%in%unlist(sapply(2:length(l)-1,function(x)combn(l,x,mean))))mean(l)else':('
1: 90 80 20 1
5: 40 60 28 18
9:
Read 8 items
[1] ":("

Jelly, 23 bytes
FŒ!ŒṖL=2ƊƇÆmEƇƲ€ṀṀṀȯ⁾:(

Try it online!
Wildly inefficient, times out when the lengths of the input lists are \$\ge4\$
How it works
FŒ!ŒṖL=2ƊƇÆmEƇƲ€ṀṀṀȯ⁾:( - Main link. Takes a list of lists, l = [a,b]
F                       - Flatten
 Œ!                     - Yield all permutations
              Ʋ€        - Over each permutation, p:
   ŒṖ                   -   Yield all partitions of p
     L=2ƊƇ              -   Only keep those of length 2
          Æm            -   Take the mean of each
            EƇ          -   Only keep those where the means are equal
                ṀṀṀ     - Take the maximum three times. This yields 0 for impossible inputs and the mean for possible ones
                    ⁾:( - Yield the string ":("
                   ȯ    - Replace 0 with this string, or do nothing if not 0

Fails for 2 6 2,6 3 5 -> 2 6,2 6 3 5 (moved 2) -> 4. You're only splitting it into two parts of equal length now.

@KevinCruijssen very late, but fixed

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

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


text:
Quit Whining; Start Quining
Goal:
Write a function or program that, given an integer n, will output a program in the same language that is a quine with a period of n.
Description of Output Program:
The output program needs to be a program that, when run, ... will output a program... that will output a program... etc, until the nth program is the original (first) output program. So this is, in a way, a modular quine. That's how I think of it, anyway.
The resulting programs should all be distinct.
Example:
Input: 2
Program: modulus_quine(n)
Output: P → Q → P → ...
Scoring:
This is code-golf, so shortest code (for the generating program) wins.
Brownie points (-0 bytes, +1 thumbs up?) are given to anyone whose generating program IS their modular quine. This is where your program takes the input and outputs the first modular quine in the sequence, which outputs the next, etc. The resulting output programs must not prompt the user for input (until it gets back to the generator.)

@vihan1086 Nope. This was discussed in the sandbox. Taking an input and generating the quine is completely different. The program you're golfing isn't required to be a quine, but is rather the generator program/function.

The answer to the previous question doesn't take much modification (I managed it with a Levenshtein distance of 7) to get an answer to this one.

@PeterTaylor Good for you. Not everyone will find it so easy. Maybe try a different language.

Should the generator and the quine programs be in the same language?

@randomra Yes. Clarification added.

I still maintain that this is not a duplicate. This was discussed in the sandbox, and I think it's different enough. Just because Peter Taylor is using an esoteric programming language, where it's easy for him to alter his existing program to fit the requirements, doesn't mean it's so easy in any other language.

Also notice that the "duplicate" question is a code-challenge (but this is code-golf), and ALSO only has one answer (and with a score of 0). Give other people a chance to answer in a different language.

@Jwosty "The resulting programs should all be distinct."

GolfScript, 16 bytes
{%}+")1$~":x`+0x

Try it online in Web GolfScript.
Example run
$ echo -n 3 | golfscript quining.gs
{3 % ")1$~"}0)1$~
$ echo -n 3 | golfscript quining.gs | golfscript
{3 % ")1$~"}1)1$~
$ echo -n 3 | golfscript quining.gs | golfscript | golfscript
{3 % ")1$~"}2)1$~
$ echo -n 3 | golfscript quining.gs | golfscript | golfscript | golfscript
{3 % ")1$~"}0)1$~

Generator
                 # (implicit) Read from STDIN.
{%}+             # Concatenate the read input with the block.
                 # For example, "3"{%}+ -> {3 %}.
    ")1$~":x     # Push that string and save it in the the variable `x'.
            `+   # Inspect the string and concatenate it with the block.
                 # For example, {3 %}'")1$~"'+ -> {3 % ")1$~"}
              0x # Push a 0 and the string stored in `x'.

Modular quine
For example, the modular quine {3 % ")1$~"}0)1$~ works as follows.
{          }      # Define a block.
 3 %              # Take the integer on the stack modulo 3.
     ")1$~"       # Push that string.
            0)    # Push 0 and increment. Pushes 1.
              1$~ # Copy the block from the bottom of the stack and execute it.

The original copy of the block, the modified integer and the string the block pushed are printed, resulting in {3 % ")1$~"}1)1$~.
All printed programs have a trailing linefeed, which GolfScript prints automatically.

{%}+")1$~":n`+0 would be one byte shorter, but the original output program would lack the trailing newline present in all subsequent output programs.

Ruby, 100 bytes + brownie points
Generating program/zero-state:
;puts <<2.sub(/2*/){$&[/./]?$':?2*gets.to_i}*2,2
;puts <<2.sub(/2*/){$&[/./]?$':?2*gets.to_i}*2,2
2

Output for input of 3:
222;puts <<2.sub(/2*/){$&[/./]?$':?2*gets.to_i}*2,2
222;puts <<2.sub(/2*/){$&[/./]?$':?2*gets.to_i}*2,2
2

This program, when run, will not ask for input but output itself with the initial 222 on the first 2 rows replaced with 22. That will output a version where each row begins with 2, which will output the original program.
"2" lives a varied life here as (in order of appearance) a repeated digit in a no-op numeric literal, a HEREDOC reference, a regex literal, a character literal, a numeric argument to String#*, a numeric argument to puts, a character in a HEREDOC string, and finally a HEREDOC delimiter.

This is close, but not quite correct, since an input of 1 does not cause your program to print itself. Your program appends one too many 2s to the front of each of the first two lines for each n.

Underload, 29 bytes
(a(S)*)~^(a(:^)*)~*(^)*a(:^)*

Underload has no method to take input from the user, so I wrote a function rather than a complete program. The input is taken from the stack, the output is placed onto the stack (and can be printed with S).
Here's how to call it for an input of 1, ():
()(a(S)*)~^(a(:^)*)~*(^)*a(:^)*S

and it produces the following quine:
(a(:^)*a(S)*^):^

which runs like this:
(a(:^)*a(S)*^):^
(a(:^)*a(S)*^)(a(:^)*a(S)*^)^
(a(:^)*a(S)*^)a(:^)*a(S)*^
((a(:^)*a(S)*^))(:^)*a(S)*^
((a(:^)*a(S)*^):^)a(S)*^
(((a(:^)*a(S)*^):^))(S)*^
(((a(:^)*a(S)*^):^)S)^
((a(:^)*a(S)*^):^)S
program exits, with output (a(:^)*a(S)*^):^

As you can see, the modular quine of order 1 (i.e. just a normal quine) works by first generating a copy of itself, then generating a function to print that output, then running that function.
For higher orders, we just repeat the "generating a function to print that output" step (which is written in Underload as a(S)*). Here's how we call it for order 4 ((:::***) is 4):
(:::***)(a(S)*)~^(a(:^)*)~*(^)*a(:^)*S

Here's the program produced:
(a(:^)*a(S)*a(S)*a(S)*a(S)*^):^

which, when run, produces the following programs in turn:
((((a(:^)*a(S)*a(S)*a(S)*a(S)*^):^)S)S)S
(((a(:^)*a(S)*a(S)*a(S)*a(S)*^):^)S)S
((a(:^)*a(S)*a(S)*a(S)*a(S)*^):^)S
(a(:^)*a(S)*a(S)*a(S)*a(S)*^):^

The same technique probably works in other languages, although maybe not so concisely.
As a side note, Underload only has eight commands, so a hypothetical golfing version that represented each using 3 bits would use 29×3÷8 = 10⅞ bytes. That would make it the shortest solution here. Although it only has nine commands, one (()) uses two different characters, so the previous calculation isn't quite correct.

Python 3.8 (pre-release), 59 bytes
b=0;exec(s:=f"print('b=%d;exec(s:=%r)'%(-~b%{input()},s))")

Try it online!

You're right, my bad!

Python 3.8 (pre-release), 54 bytes
a=f'a=%r,-~%d%%{input()};print(a[0]%%a)';exec(a%(a,0))

Try it online!
Let say input is 3 this will output :
a='a=%r,-~%d%%3;print(a[0]%%a)',-~1%3;print(a[0]%a)

which will output :
a='a=%r,-~%d%%3;print(a[0]%%a)',-~2%3;print(a[0]%a)

which will output :
a='a=%r,-~%d%%3;print(a[0]%%a)',-~0%3;print(a[0]%a)

... and so on
How it works :
This solution uses the same idea than an other solution of mine on an other challenge
The main idea is to modify the second element of the tuple a each iterration inside the string with '-~%d'%a. -~x corresponds to an incrementation of 1.
Then we loop using a modulo equal to our input (using f-string to replace it in the base program)


text:
telgif: inverse figlet
figlet is utility that converts plain text to an ascii-art representation for use in banners and the like.  For example:
$ figlet "CODE GOLF"
  ____ ___  ____  _____    ____  ___  _     _____
 / ___/ _ \|  _ \| ____|  / ___|/ _ \| |   |  ___|
| |  | | | | | | |  _|   | |  _| | | | |   | |_
| |__| |_| | |_| | |___  | |_| | |_| | |___|  _|
 \____\___/|____/|_____|  \____|\___/|_____|_|

$

Write a program or function that takes the ascii-art output from figlet and returns it to its original plain text.
It may be helpful to you to install figlet.  I have version 2.2.5 which is what you get if you sudo apt-get install figlet on Ubuntu 14.04.  This figlet actually has several "fonts".  For the purposes of this context, we will just be dealing with the default standard font.
Input text will be no more that 80 characters wide, and will have been generated from plain text containing only the uppercase characters and space.
Your program may not call figlet or its source code in any way.
Example
Input:
    _    ____   ____ ____  _____ _____ ____ _   _ ___
   / \  | __ ) / ___|  _ \| ____|  ___/ ___| | | |_ _|
  / _ \ |  _ \| |   | | | |  _| | |_ | |  _| |_| || |
 / ___ \| |_) | |___| |_| | |___|  _|| |_| |  _  || |
/_/   \_\____/ \____|____/|_____|_|   \____|_| |_|___|

     _ _  ___     __  __ _   _  ___  ____   ___  ____
    | | |/ / |   |  \/  | \ | |/ _ \|  _ \ / _ \|  _ \
 _  | | ' /| |   | |\/| |  \| | | | | |_) | | | | |_) |
| |_| | . \| |___| |  | | |\  | |_| |  __/| |_| |  _ <
 \___/|_|\_\_____|_|  |_|_| \_|\___/|_|    \__\_\_| \_\

 ____ _____ _   ___     ____        ____  ____   _______
/ ___|_   _| | | \ \   / /\ \      / /\ \/ /\ \ / /__  /
\___ \ | | | | | |\ \ / /  \ \ /\ / /  \  /  \ V /  / /
 ___) || | | |_| | \ V /    \ V  V /   /  \   | |  / /_
|____/ |_|  \___/   \_/      \_/\_/   /_/\_\  |_| /____|

Output:
ABCDEFGHI
JKLMNOPQR
STUVWXYZ

Input:
 ____ _____  _    ____   __        ___    ____  ____
/ ___|_   _|/ \  |  _ \  \ \      / / \  |  _ \/ ___|
\___ \ | | / _ \ | |_) |  \ \ /\ / / _ \ | |_) \___ \
 ___) || |/ ___ \|  _ <    \ V  V / ___ \|  _ < ___) |
|____/ |_/_/   \_\_| \_\    \_/\_/_/   \_\_| \_\____/

Output:
STAR WARS

Note a previous edit of this question allowed inputs containing upper and lower case letters plus numerals.  It was pointed out that this caused several points of ambiguity with certain adjacent character combinations.  It became obvious that I needed to rigorously find a set of characters with no such collisions so that the contest is actually doable.  At first I tried all lowercase letters plus numerals with this shell one-liner:
for t in {0..9}{a..z} {a..z}{a..z} {a..z}{0..9} {0..9}{0..9} ; do figlet $t | tr '\n' ':'; echo ; done | sort | uniq -d | tr ':' '\n'

This yielded {j1, jl} and {i1, il} as ambiguous pairs.  So instead with all uppercase letters (as suggested by @AlexA.), there are no ambiguous pairs:
for t in {A-Z} ; do figlet $t | tr '\n' ':'; echo ; done | sort | uniq -d | tr ':' '\n'

I'd suggest a 'you may not call figlet' clause, because otherwise surely the shortest program will iterate over all possible strings, calling figlet on them, and then comparing for equality.

The source code of figlet can be found in the following git repo: git://git.debian.org/git/collab-maint/figlet.git (download with git clone).

Note: this challenge is very difficult to code, let alone code golf.

1 and l are not identical, but V1 and Vl are.

XOX and XDX are still really hard to discern... maybe that's a good kind of challenge, though?

@Mauris hard, but not impossible :)

For people who do not have a system that can run figlet, there are various online versions. Search for "figlet online". For example, this one looks fairly straightforward and ad free: http://www.network-science.de/ascii/. Make sure that you choose the "standard" font.

@RetoKoradi Thanks!  I checked the output and with the standard font, it does seem to match.

JavaScript, 946 bytes
i=>i.split(/\n *\n/).slice(n=0,-1).map(x=>[...(x=x.split`
`)[0]].map((_,i)=>parseInt([0,1,2,3,4].map(j=>"_/\\|".indexOf(x[j][i])+1).join(""),5)).map((n,i,x)=>o[x.slice(i).map(a=>v=v*5+a,v=0).find(v=>o[v])]||"").join``," 0JiivI1d5JysyKgx0X5qyZegzZfZ9mtZfO3288Q9CboCfG28CkO29Q9J1bg3N2d9pLh0dLfL2sLdwH14uLwdU1b4LkyYbbwY1Y2YhY1fjY1Y2YhY1fjY1Y2YhL3nfY126Y1Y2YhY20dY1Y2YhY1fjY1Y2YhR173PjP2P2P7RgjPjP2Fc6FsFtF1rDpcDhdB1ptBhdExgEfE2sSelvS6ySdwJ5wiSr3S6ySdwJaq4Jc21T8zaT1TrT2kA28bA2sAdwT3vT1TrT2kA1ufA1w2TwcT1TrT2kT1xlT1TrT2kA7ccTv58T1TrT2kT1crT1TrT2kT83tT1TrT2kT1crT1TrT2kO48kQ9CboCfG28CkO29Q9AvrtiA2sAdwA21mA1w2AacxM6z18A2cpp6A2sAdwA21mA1w2AacxA7yngA2sAdwA21mA1w2AacxA1ukibA2sAdwA21mA1w2AacxV1brpkV3V4VdV105jV3V4VdV2e9V3V4VdV105jV3V4VdV4md1V3V4VdV105jV3V4VdAruayA2sAdwA21mA1w2AacxAgc25A2sAdwA21mA1w2AacxWozq07rW3W4WdW3hl3vW3W4WdW8de5W3W4WdW3hl3vW3W4WdWg1p5dW3W4WdW3hl3vW3W4Wd".split(/(?=[A-Z ])/).map(x=>o[n+=parseInt(x.slice(1),36)]=x[0],o={})).join`
`

Try it online!
Note that figlet by default outputs two trailing blank lines; if those can be
assumed to not exist, like in the challenge examples, the initial slice can be
removed for -10 bytes. Otherwise, make sure the blank lines are
present in the "Input" field on TIO, or the last line of output will be omitted.
Explanation
At a high level, this scans the strings for patterns, and outputs the ones it
finds.
A single character can have multiple patterns; for example, these are all valid
patterns for A: (the first and last column are omitted, as they are not
necessary for matching)
   _
  / \
 / _ \
/ ___ \
_/   \_

_  _
_|/ \
 / _ \
/ ___ \
_/   \_

 _____
/ / \ \
 / _ \
/ ___ \
_/   \_

The first appears in bare As, or uncombined As such as in AX, the second
appears in TA, and the third appears in e.g. WAV:
    _      _____  _     __        _____     __
   / \    |_   _|/ \    \ \      / / \ \   / /
  / _ \     | | / _ \    \ \ /\ / / _ \ \ / /
 / ___ \    | |/ ___ \    \ V  V / ___ \ V /
/_/   \_\   |_/_/   \_\    \_/\_/_/   \_\_/
 -------       -------           -------

Thus, for every character, there is a pattern for:

Each triplet of characters with it at the center
Each pair of characters containing it
It on it's own

Some of these patterns are identical, for example, the As in VAV and WAV are
identical, and the As in AX, XA, and A are identical.
Each pattern needs a unique representation, and since this is code golf, it
should be as compact as possible.
Because the mega-characters have a fixed height of 5, but are not fixed-width,
the patterns are defined principally by columns.
First, each of the symbols in the pattern are converted to a single base-5 digit,
where  _/\| respectively correspond to 0-4, and other symbols are treated as
spaces.
   _
  / \
 / _ \
/ ___ \
_/   \_

0001000
0020300
0201030
2011103
1200032

Then, the 5 base-5 digits in a column are combined to make a single base-5
number.
00021, 00202, 02010, 10110, 03010, 00303, 00032

Represented in decimal, the column numbers are 11, 52, 255, 655, 380, 78, 16.
These numbers must be combined into one number that identifies the pattern. The
correct way would be to concatenate all of the base-5 numbers (or, equivalently,
to treat the list of column numbers as a base-3125 number).
As this is code-golf, the correct way will not be used, due to a bug that
happened to not break stuff for this set of patterns and is now considered a
byte-saving feature.
Thus, the column numbers are combined into one number that identifies the pattern:
   11 * 5^6
+  52 * 5^5
+ 255 * 5^4
+ 655 * 5^3
+ 380 * 5^2
+  78 * 5^1
+  16 * 5^0

= 585531

Now, these numbers are inserted into a giant lookup table, along with 0 for  :
{
  0: " ",
  585531: "A",
  591231: "A",
  // ...
}

At this point, the table could be serialized and plopped into the code, but it
is not very golfy. Thus, this explanation branches into two parts: matching the
patterns and compressing the lookup table.
Matching the Patterns
Matching the patterns is fairly simple. First, the input is split into
paragraphs; each paragraph is a line of mega-text. The paragraphs/mega-lines are
converted independently, and then joined again with newlines.
Each mega-line is first converted into an array of column numbers:
  ____ ___  ____  _____    ____  ___  _     _____
 / ___/ _ \|  _ \| ____|  / ___|/ _ \| |   |  ___|
| |  | | | | | | |  _|   | |  _| | | | |   | |_
| |__| |_| | |_| | |___  | |_| | |_| | |___|  _|
 \____\___/|____/|_____|  \____|\___/|_____|_|

[
  120, 253, 746, 756, 756, 871, 253, 746, 756,
  746, 377, 624, 626, 746, 756, 746, 377, 624,
  626, 771, 781, 856, 756, 504,   0, 120, 253,
  746, 756, 771, 776, 624, 253, 746, 756, 746,
  377, 624, 626, 621,   6,   6,   6, 624, 626,
  729, 780, 770, 750, 500
]

Then, this array is iterated across; for every number in the array:

If this number is in the lookup table, add the corresponding character to the
string and continue iteration.
Multiply the number by 5, and add the next number in the array. Go to #1,
and repeat until the number matches or there are no numbers left.

Note that it searches for a character starting at every column, regardless of
the previous matches. Additionally, the only way it finds no character starting
at a column is if it exhaustively checks all possible ending columns to the end
of the array, completely ignoring the fact that no patterns are longer than 12
columns.
After this highly inefficient process completes, the string will be CODE GOLF.
Compressing the Lookup Table
If the lookup table were simply serialized, it would be a whopping 23,094 bytes,
which is clearly unacceptable.
The lookup table is transformed as follows:
Original:
  0: " "
  12: A
  63: B
  209: A
  1040: C
  30: A
  512: C

Sorted:
  0: " "
  12: A
  30: A
  63: B
  209: A
  512: C
  1040: C

Difference from last:
  +0: " "
  +12: A
  +18: A
  +33: B
  +146: A
  +303: C
  +528: C

Final (numbers are encoded in base 36):
  " 0AcAiBxA42C8fCeo"

The final string is:
 0JiivI1d5JysyKgx0X5qyZegzZfZ9mtZfO3288Q9CboCfG28CkO29Q9J1bg3N2d9pLh0dLfL2sLdwH14uLwdU1b4LkyYbbwY1Y2YhY1fjY1Y2YhY1fjY1Y2YhL3nfY126Y1Y2YhY20dY1Y2YhY1fjY1Y2YhR173PjP2P2P7RgjPjP2Fc6FsFtF1rDpcDhdB1ptBhdExgEfE2sSelvS6ySdwJ5wiSr3S6ySdwJaq4Jc21T8zaT1TrT2kA28bA2sAdwT3vT1TrT2kA1ufA1w2TwcT1TrT2kT1xlT1TrT2kA7ccTv58T1TrT2kT1crT1TrT2kT83tT1TrT2kT1crT1TrT2kO48kQ9CboCfG28CkO29Q9AvrtiA2sAdwA21mA1w2AacxM6z18A2cpp6A2sAdwA21mA1w2AacxA7yngA2sAdwA21mA1w2AacxA1ukibA2sAdwA21mA1w2AacxV1brpkV3V4VdV105jV3V4VdV2e9V3V4VdV105jV3V4VdV4md1V3V4VdV105jV3V4VdAruayA2sAdwA21mA1w2AacxAgc25A2sAdwA21mA1w2AacxWozq07rW3W4WdW3hl3vW3W4WdW8de5W3W4WdW3hl3vW3W4WdWg1p5dW3W4WdW3hl3vW3W4Wd

I haven't done much kolmogorov-complexity, so if anyone has ideas on how to
compress this further, I'd love to hear them.

In theory you can save 158 bytes by specifying that the source is in ISO-8859-1, running that long string through atob, and substituting btoa\`` for it.

@Neil Good idea, but unfortunately I can't get the unprintables to work consistently. Also, it seems like the binary string is somehow longer? I don't know how that could be the case, though

Are you accidentally measuring the binary string in the wrong code page? atob generates ISO-8859-1, but you might have been measuring it in UTF-8 by mistake, which would double its length.


text:
Pair Capacitors
Capacitors are notorious for being manufactured with high tolerances. This is acceptable in many cases, but some times a capacity with tight tolerances is required. A common strategy to get a capacity with the exact value you need is to use two carefully measured capacitors in parallel such that their capacities add up to something in the range you need.
The goal in this challenge is, given a (multi) set of capacities, to pair the capacitors such that the total capacity of each pair is in a given range. You also need to find the best set of pairings, that is, the set of pairings such that as many pairs as possible are found.
Constraints

Input comprises in a format of choice

an unordered list of capacities representing the (multi) set of capacitors you have
a pair of capacities representing the lower and upper bound of the target range (inclusive)

all capacities in the input are positive integers smaller than 230, the unit is pF (not that that matters).
In addition to the list of capacities in the input, the set of capacitors you have also contains an infinite amount of capacitors with a value of 0 pF.
Output comprises in a format of choice a list of pairs of capacities such that the sum of each pair is in the target range specified. Neither the order of pairs nor the order of capacities within a pair is specified.
No capacity in the output may appear more often than it appears in the set of capacitors you have. In other words: The pairs you output must not overlap.
There shall be no possible output satisfying conditions 4 and 5 that contains more pairs of capacities than the output your program produces.
Your program shall terminate in O(n!) time where n is the length of the list representing the set of capacitors you have
Loopholes shall not be abused
The target range shall not be empty

Scoring
Your score is the length of your solution in octets. If your solution manages to solve this problem in polynomial time O(nk) for some k, divide your score by 10. I do not know if this is actually possible.
Sample input

range 100 to 100, input array 100 100 100, valid output:
0 100
0 100
0 100

range 100 to 120, input array 20 80 100, valid output:
0 100
20 80

the output 20 100 is not valid
range 90 to 100, input array 50 20 40 90 80 30 60 70 40, valid output:
0 90
20 80
30 70
40 60
40 50

range 90 to 90, input array 20 30 40 40 50 60 70 80 90, valid output:
0 90
20 70
30 60
40 50

range 90 to 110, input array 40 60 50, valid output:
40 60

I'm fairly certain this can easily be solved in O(n log n). First, pair any capacitor within the range to one with 0 pF. Sort the rest. Keep pairing the lowest and highest capacitor, if this is above the range discard the highest, if it's below discard the lowest.

Some input/output tests would be nice.

@orlp I've already asked, the OP is working on it

@orlp's algorithm works, but the proof is a shade long for a comment. In essence, a minimal counterexample must have a <= b <= c <= d such that a + d, a + c, b + d are all in the range but b + c isn't, but that gives a contradiction.

@orlp Is the provided sample input useful to you?

@FUZxxl It's fine.

You may want to have a sample input that is not sorted, since the description says that the input is unordered. Or did I misinterpret that, and we can define the input to be sorted?

@RetoKoradi Yeah, you cannot define the input to be sorted. I'm amending the test cases to demonstrate that.

CJam, 5.6
This is a direct re-implementation of the algorithm in orlp's answer. If you upvote my answer, please make sure that you also upvote this answer. I also suggest that the answer with the original algorithm is accepted, because I very much doubt that I would have figured out how to solve this elegantly in O(n*log(n)).
l~_,0a*+${(\)@_2$+4$~2$\>{;;\;\+}{<{;+}{oSop}?}?_,1>}g;;

Try it online
Sample input:
[90 100] [50 20 40 90 80 30 60 70 40]

Explanation:
l~      Get and interpret input.
_,      Get length of resistor list.
0a*+    Append the same number of 0 values.
$       Sort the list.
{       Loop until less than 2 entries in list.
  (       Pop off first value.
  \)      Pop off last value.
  @_      Pull first value to top, and copy it.
  2$      Copy last value to top.
  +       Add first and last value.
  4$~     Copy specified range to top, and unwrap the two values.
  2$      Copy sum to top.
  \>      Swap and compare for sum to be higher than top of range.
  {       It's higher.
    ;;\;    Some stack cleanup.
    \+      Put first value back to start of resistor list.
  }
  {       Not higher, so two cases left: value is in range, or lower.
    <       Compare if sum is lower than bottom of range.
    {       It's lower.
      ;+      Clean up stack and put last value back to end of resistor list.
    }
    {       Inside range, time to produce some output.
      o       Output first value.
      So      Output space.
      p       Output second value and newline.
    }?      Ternary operator for comparison with lower limit.
  }?      Ternary operator for comparison with upper limit.
  _,      Get length of remaining resistor list.
  1>      Check if greater 1.
}g      End of while loop for processing resistor list.
;;      Clean up stack, output was generated on the fly.

You can alter the output format to be more suitable for your language. The exact format of output is not specified, only the data you have to output is.

Python 2, 11.5
A Python golf for once:
(a,b),l=input()
l=[0]*len(l)+sorted(l)
while l:
 e=l[0]+l[-1]
 if a<=e<=b:print l[0],l[-1]
 l=l[e<=b:len(l)-(a<=e)]

I add one 0 pF capacitor for every regular one, there are never any more needed. Then we sort the capacitors and keep pairing the lowest and highest capacitor. If the sum is within the allowable range we print it, if it is above the range we discard the highest, if it's below discard the lowest.
Example input / output:
[[90,100], [20,30,40,40,50,60,70,80,90]]

0 90
20 80
30 70
40 60
40 50


text:
Bowl Filled with Water
You should write a program or function which receives the volume of a bowl and the volume of the water in it as input and outputs or returns an ASCII representation of a bowl with water in it with the desired volumes.
A bowl has the following structure:
 \     /
  \___/

The bowl has at least one _ character. The count of \'s and /'s are also positive and they are equal due to symmetry.
The volume of the bowl is the total number of _ and space characters between the \'s and /'s plus one for every pair of \ and /. This means the above bowl has the volume of 10:
 \     /  =>  xxxxx x (the last one is for the \/ pair)
  \___/        xxx x (the last one is for the \/ pair)

Note that two different bowl could have the same volume. E.g. both the following bowls have a volume of 18:
\       /
 \     /      \         /
  \___/        \_______/

We can pour some water into the bowl. The water is represented as a row of ~ characters instead of spaces inside the bowl. The bottom row has no spaces so it can not contain the ~'s. This means our example can be filled with water in only one way:
 \~~~~~/
  \___/

Other bowls could be filled in multiple ways:
 \~~~~~/   \     /
  \   /     \~~~/
   \_/       \_/

The volume of the water in a bowl is the volume of the bowl rows below the ~ characters. The above examples have water volumes of 4, 6 and 2 respectively.
Input

Two positive integers, the volume of the bowl and the volume of the water.
You can choose the order of the two numbers.
The two integer can be inputted in any common list format (list, tuple, array, etc.) or as two separate integers.
At least one valid bowl-water configuration is guaranteed for the input values.

Output

The ASCII representation of a bowl with water where the bowl and water volumes match the input.
If you choose to return the result instead of printing, it should be returned as single string (or your language's closest alternative).
Any trailing whitespace is allowed.
No unnecessary leading whitespace is allowed.
If there are multiple correct configurations you are free to choose which one you output but you can only output one of them.

Examples
Each input integer pair is followed by its one or more possible outputs.
6 2
\~~~/
 \_/

10 4
\~~~~~/
 \___/

24 8
\        /
 \~~~~~~/
  \    /
   \__/

42 12 //either of the two output is correct
\           /
 \         /
  \~~~~~~~/
   \     /
    \   /
     \_/

\               /
 \~~~~~~~~~~~~~/
  \___________/

90 68
\~~~~~~~~~~~~~~~~~~~~~/
 \                   /
  \                 /
   \               /
    \_____________/

102 42
\                     /
 \                   /
  \~~~~~~~~~~~~~~~~~/
   \               /
    \             /
     \___________/

This is code golf so the shortest entry wins.

CJam, 72 70 69 bytes
q~:QW=3m*{:,2ff*),)ff+}%{::)1fbQ=}=~W%ee_,S*W'_t@,~'~t.{S\+.*"\/".+N}

Try it online in the CJam interpreter.
Run time and memory usage are O(scary), so the last three test cases should be verified using the Java interpreter (and extra heap space).
Example run
$ time java -Xmx4G -jar cjam-0.6.5.jar bowl.cjam <<< '[42 102]'
\                     /
 \                   /
  \~~~~~~~~~~~~~~~~~/
   \               /
    \             /
     \___________/

real    0m40.669s
user    3m13.100s
sys     0m11.690s

How it works
q~:Q     e# Read from STIDN, evaluate and save the result in Q.
W=       e# Select the last element of Q (bowl volume B).
3m*      e# Push all vectors of {0,...,B-1} × {0,...,B-1} x {0,...,B-1}.

{        e# For each vector [X Y Z]:
  :,     e#   Push [[0 1 ... X-1] [0 1 ... Y-1] [0 1 ... Z-1]].
  2ff*   e#   Multiply each coordinate by 2.
  ),)    e#   Pop the last vector, compute its length and increment.
  ff+    e#   Add the result to each component of each vector.
}%       e# Result: [[Z Z+2 ... Z+2(X-1)] [Z Z+2 ... Z+2(Y-1)]]

{        e# Find:
  ::)    e#   Increment each coordinate (to account for the volume in "\/").
  1fb    e#   Sum the coordinate of both vectors.
  Q=     e#   Compare the result to Q (desired volumes).
}=       e# If they match, push the array and break.

~        e# Dump both vectors on the stack.
W%       e# Reverse the rightmost one (corresponds to the bowl volume).
ee       e# Enumerate its coordinates.
         e# [Z+2(Y-1) ... Z+2 Z] -> [[0 Z+2(Y-1)] ... [Y-2 Z+2] [Y-1 Z]].
_,S*     e# Compute the length (Y) and push a string of Y spaces.
W'_t     e# Replace the last space with an underscore.
@        e# Rotate the leftmost vector (corresponds to the water volume) on top.
,        e# Compute its length (X).
~'~t     e# Replace the space at index X from the right with a tilde.

.{       e# For each enumerates coordinate and the corresponding character:
  S\+    e#   Append the character to the string " ".
  .*     e#   Vectorized repetition: [1 2] " ~" -> [" " "~~"]
  "\/".+ e#   Append the first (second) solidus to the first (second) string.
  N      e#   Push a linefeed.
}

Javascript ES5, 364 bytes
This is what i could come up with quickly during my lunch, help me golf it out while my shift ends!
Source
function V(x,v) { // calculate volume of bowl/water
    for(i=v,j=x;i--;j+=2) {
      v+=j;
    }
    return v
}
function B(x,y,l) { // draw bowl/water
    for(s="",h=y,w = x+2*y;y--;s+="\n")
        for(i=w;i--;) {
            f= i>h-y-1 && w-i > h-y;
            s+=i==h-y-1?"/":
                w-i == h-y? "\\":
                y==l-1 && f? "~" :
                !y && f?"_":" "
        }
    return s;
}
n=prompt().split(" ");
b=+n[0]; // bowl volume
w=+n[1]; // water volume
for(x=b;x;x--)  // loop through possible widths
  for(y=b;y;y--)  // loop through possible heights
    if(V(x,y)==b) // check if we found bowl volume
       for(y2=y;y2;y2--) { // check possible water heights
         v = V(x,y2-1);
         if(v==w){ // see if volume matches
          alert(B(x,y,y2));
          x=1;break;
         }
       }

Golfed:
(ran through minifier to compress, lunch shift ended)
function V(f,r){for(i=r,j=f;i--;j+=2)r+=j;return r}function B(r,y,n){for(s="",h=y,w=r+2*y;y--;s+="\n")for(i=w;i--;)f=i>h-y-1&&w-i>h-y,s+=i==h-y-1?"/":w-i==h-y?"\\":y==n-1&&f?"~":!y&&f?"_":" ";return s}for(n=prompt().split(" "),b=+n[0],w=+n[1],x=b;x;x--)for(y=b;y;y--)if(V(x,y)==b)for(y2=y;y2;y2--)if(v=V(x,y2-1),v==w){alert(B(x,y,y2)),x=1;break}

Perl, 227 172 bytes
Run with -n option:
/ /;for$h(1..$`){for$w(1..$`){for$l(1..($h*($w+$h)==$`)*$h){if($l*($w+$l)==$'){for(0..$h-1){print$"x$_."\\".($_<$h-1?$_==$h-$l-1?"~":$":"_")x($w+($h-$_-1)*2)."/
"}exit}}}}

Thanks to Dennis for help golfing this down.
Calculates bowl volume as height * (width + height), where width is the number of _ characters and height is the number of \ characters.
Each combination of height and width is tested in a pair of nested loops until the correct bowl volume is found, then another loop over possible water height levels is done to find if a the correct water volume is possible with that width.
It is possible to remove the third loop by just calculating the water level using the quadratic formula with a as 1, b as the width and c as the negative of the desired water volume, and checking if it's an integer, but that takes more bytes than just doing a loop. Here it is anyway (183 bytes):
/ /;for$h(1..$`){for$w(1..$`){if($h*($w+$h)==$`){$l=(sqrt($w*$w+4*$')-$w)/2;if(int$l==$l){for(0..$h-1){print$"x$_."\\".($_<$h-1?$_==$h-$l-1?"~":$":"_")x($w+($h-$_-1)*2)."/
"}exit}}}}

Python 2, 162 bytes
V,W=input()
r=1
while r*r<V:a=V/r-r;k=1;exec"if(a+k)*k==W*(V%r<1):i=1;exec\"print' '*~-i+'\%s/'%(' _~'[(i==r)-(i==r-k)]*(a+2*(r-i)));i+=1;\"*r;r=V\nk+=1\n"*r;r+=1

A little messy, but here's my first attempt. It tries all possible numbers of rows r, setting the number of base underscores to be a = V/r-r. Then it tries all possible water level heights k and checks if the bowl is valid, printing it if so.

C, 231 229 bytes
Early submission :) There's lots more golfing to do here.
v,V,w,h,H,i,j;main(c,a)char**a;{V=atoi(a[1]);v=atoi(a[2]);for(;++H;)for(h=0;h++<H;){for(w=1;h*h+w*h-h<v;++w);if(H*H+w*H-H==V){for(;H--;){printf("%*s",++i,"\\");for(j=0;j++<w-1+2*H;)putchar(H?H==h?'~':32:95);puts("/");}exit(0);}}}

Ungolfed:
int v,V,w,h,H,i,j;
int main(int c, char **a)
{
    V=atoi(a[1]); /* Volume of bowl */
    v=atoi(a[2]); /* Volume of water */

    for(;++H;) /* Make the bowl taller */
    {
        for(h=0;h++<H;) /* Make the water taller */
        {
            for(w=1;h*h+w*h-h<v;++w); /* Make the bowl wider until the water volume matches */
            if(H*H+w*H-H==V) /* if the bowl volume matches, then we're good */
            {
                for(;H--;) /* Print out the bowl, one line at a time */
                {
                    printf("%*s",++i,"\\"); /* Print the left edge */
                    /* Print the inside (either with air/water, the top of the water, or the bottom of the bowl */
                    for(j=0;j++<w-1+2*H;)
                        putchar(H?H==h?'~':32:95);
                    /* Print the right edge of the bowl */
                    puts("/");
                }
                exit(0); /* die, we're done */
            }
        }
    }
}

Is it possible to encounter a bowl that matches the bowl volume but cannot meet a water volume?

At least one valid bowl-water configuration is guaranteed for the input values. - OP

Python 2.7, 284 270 260 Bytes
def f(b,w,i=1,e='while s<%s:j+=2;s+=j'):
 while 1:
    i+=1;j=s=i;exec e%w
    if s==w:p=j;exec e%b
    if s==b:break
 h=(j-i)/2+1;t=w=i+(h-1)*2+1
 for j in range(h):r,s,t=((' '*(t-2),'_'*(i-1))[j==h-1],'~'*(t-2))[j==h-(p-i)/2-2],(w-t)/2,t-2;print" "*s+"\\"+r+"/"+" "*s

This basically calculates the height and width of the bucket and water and prints them.
Tried hard to remove the ugly while loop part at the start(wherein I calculate the height of the bucket and the height from where water should be drawn. Right now, all lines in the code except for the last one are for calculating the width and height). Still trying :P

Testing it for different cases -
>>> execfile("buckets.py")
(6, 2)
\~~~/
 \_/

(10, 4)
\~~~~~/
 \___/

(24, 8)
\        /
 \~~~~~~/
  \    /
   \__/

(42, 12)
\           /
 \         /
  \~~~~~~~/
   \     /
    \   /
     \_/

(90, 68)
\~~~~~~~~~~~~~~~~~~~~~/
 \                   /
  \                 /
   \               /
    \_____________/

(102, 42)
\                     /
 \                   /
  \~~~~~~~~~~~~~~~~~/
   \               /
    \             /
     \___________/


text:
Is 7 l8r than 9? (Is seven later than nine?)
This is a fairly simple code golf challenge. Your program, given an ASCII string, is to parse that string into two strings, which it will evaluate. If the second string is "later" than the first one, it will return a 1, if it is "earlier" than the first one, it will return a -1, and if they are the same, it will return 0. To clarify what "later" and "earlier" mean, let's take a look at ASCII character codes. You need to compare each character of the string, treating each of them as digits of a number. Later refers to a larger number, occurring after a smaller number. Strings will be formatted with a hyphen character to separate the two input groups.
Take a look at this example:

7-9 as an input should return 1.
7 converts to ASCII code 55, and 9 converts to ASCII code 57.
As 57 occurs numerically after 55, 9 is later than 7.

Another example:

LKzb-LKaj as an input should return -1
The ASCII code sequences for this are 76-75-122-98 and 76-75-97-106

This is a code golf challenge, and byte count is how entries will be scored.
Any input from the 95 printable ASCII characters is accepted, excluding spaces, and hyphens for anything but separating the input. In addition, strings are not guaranteed to be the same length.
Good luck!
EDIT: To be more clear, each character is to be treated like a digit in a number. In the example LKzb-LKaj, though j is later than b, z is later than a, and since it is a more significant digit, it takes precedence. A string supplied will always be at minimum 3 characters, eliminating empty strings from the scope of this problem.
EDIT: Here are some more test cases, for your help:

A-9 -> -1
11-Z -> -1
3h~J*-3h~J* -> 0
Xv-Y0 -> 1

Are the two strings guaranteed to be the same length?

No, they are not. A reasonable question. Will edit the question.

Are the numbers you're comparing in the second example 767512298 and 767597106, or are you doing character-by-character comparisons?  If the former, shouldn't the second be "later" and return 1? If the latter, this looks a lot like a regular compareTo() function.

The conversion is a bit confusing. If I understand correctly, are you essentially stringing together the character value of a string into one bigger integer? So "ABC" becomes the integer 979899? This would just mean to compare the two numbers then with a simple a>b.

You do not string together the character values, you treat them as one big base-127 (or however many character codes there are) number. The base isn't particularly important, you are doing character by character comparisons.

Can I create a function?

Test case 11-Z->-1 makes no sense given the current wording of the question. Z (90) is greater than 1 (49) and is the most significant letter. Please clarify how strings of different lengths are compared.

The most significant, in this case, refers to the letter with the most value. In binary, decimal, and most number systems, the most significant digit is the left most digit.

Yes @kirbyfan64sos, you can use a function.

And what about A-AA?

@SamWeaver I know leftmost is the most significant digit hence my confusion as to why 11>Z in your examples when 1<Z. There must be some undefined behaviour to do with strings of differing lengths or the example is wrong.

As previously explained: each string is to be treated as a digit in a base-127 number. If you were to count in this system, you would begin with a character, increment it up to the barrier of printable characters, ~ at 126, then would increment the next digit by one, returning the initial digit to !. Each increase in the most significant digit is equivalent to increment the second-most-significant digit by 127.

So any string of length n is later than all strings of length less than n?

Correct. Excellent observation.

Pyth - 11 bytes
Easy, uses ._ sign to get the sign and C to get char codes.
._-F_CMcz\-

Try it online here.
Test suite.
._               Sign of number
 -F              Fold subtraction (this finds difference of a tuple)
  _              Reverse list to get correct order of operands when subtracting
   CM            Map char, already treats strings as digits of base256 number
    c \-         Split by "-"
     z           Input

Very nice! Performs as expected.

CJam, 12 bytes
l'-/esfb~\-g

Try it online in the CJam interpreter.
How it works
l   e# Read a line from STDIN.
'-/ e# Split it at spaces.
es  e# Push the current time (milliseconds since epoch).
fb  e# Consider each string as digits in base huge-number.
~\  e# Dump the results and reverse their order.
-g  e# Subtract and apply sign function.

Excellent! This passes all test cases.

Java, 86 118
int f(String...s){return(int)Math.signum((s=s[0].split("-"))[1].compareTo(s[0])*(s[0].length()==s[1].length()?1:-1));}

A very strange way of comparing strings. Made a quick fix so it passes additional test cases, will look for more golfiness later.
Thanks to Vartan in comments for signum suggestion

Doesn't java's compare return 1,0,-1 anyways? I know it's not guaranteed to, but is there any case of it not? in which case return s[0].compareTo(s[1]);

This is nice, but it does not pass the test case of 11-Z returning -1, it returns 1.

Ah, this wasn't clear to me before those test cases were added. Fixed.

@Vartan No, it returns the difference in value at the first non-matching position (or the difference in length if there is one and all characters match). For example, "A".compareTo("Z") returns -25. Unfortunately.

Can you explain this line? i = a!=b ? b-a : s[1].compareTo(s[0]); I don't seem to get it... Also, you could maybe use Math.signum and save yourself declaring i;

If the lengths (a and b) aren't equal, the diff in lengths is the right sign. Otherwise, use compareTo (no strings of equal lengths need to be compared, longer numbers are always bigger since no leading zeroes are possible). It's going to change in a bit once I golf it down a bit more, I think I can rewrite it so it works differently.

Looks like it's functioning well now! Excellent work!

Perl, 31 bytes
#!/usr/bin/perl -p
/-/;$_=($`.$'^$`)cmp($'.$`^$')

30 bytes + 1 byte for -p. Accepts input on STDIN.
Explanation
When the operands to cmp have different lengths, like chicken and egg, they are aligned like this:
c  h  i  c  k  e  n
e  g  g  \0 \0 \0 \0

so that egg > chicken (\0 is a null byte). But we want them to be aligned like this:
c  h  i  c  k  e  n
\0 \0 \0 \0 e  g  g

so that chicken > egg.
To do this, we concatenate them, once with chicken before egg and once with egg before chicken:
c  h  i  c  k  e  n  e  g  g
e  g  g  c  h  i  c  k  e  n

Now that our two strings are the same length, we remove the leading word using an XOR to get:
\0 \0 \0 \0 \0 \0 \0 e  g  g
\0 \0 \0 c  h  i  c  k  e  n

And now we can use cmp to find which came first. (There, I said it!)

Very clever- Bravo!

Python 2, 88 characters
a=raw_input().split('-');print-cmp(*(map(ord,s.rjust(max(map(len,a)),'\0'))for s in a))

cmp doesn't do the right thing when you have two different length strings, so I have to pad both of them with the null character (which ord converts to 0) to handle that case. Unfortunately, that added about 35 characters, plus it's now two lines instead of one because I need both the length of the input and to iterate over it.

Unfortunately, this is not a valid solution. The following test case: 1-2, which should return 1 returns -1. Clever work though.

Whoops, it appears the operands are swapped. That's super weird, I tested it with a couple of your test cases and I thought it worked fine! No matter, I can change it without changing the character count. Give it a shot now.

Your edit did fix that case, but it now fails the 11-A case, which should return -1, instead of returning 1 in this example.

I don't like your rules for length. I fixed it at the cost of about 35 characters, and I don't think I could make it better.

Yeah, it's a tricky one. This edit accomplishes it though- well done.

I managed to get a shorter answer than yours by encoding the string into hex format then parsing that string as an int. In python 2, it seems to default to big-endianness for this. Thus, the 0 padding is no longer required.

No way? I'm surprised that works! Well done.

R, 54 Bytes
This requires the pracma library.  It splits the input string on the -.  Right justifies the strings.  Ranks them and does a diff.
So for 11-7 we end up with the strings "11" and " 7".  The rank of these is [2, 1].  The difference is -1.
For 3h~J*-3h~J* we get "3h~J*" and "3h~J*".  The rank of these is [1.5, 1.5] with a diff of 0.
diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))

Test Examples
> diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))
1: LKzb-LKaj
3:
Read 2 items
[1] -1
> diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))
1: A-9
3:
Read 2 items
[1] -1
> diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))
1: 11-Z
3:
Read 2 items
[1] -1
> diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))
1: 3h~J*-3h~J*
3:
Read 2 items
[1] 0
> diff(rank(pracma::strjust(scan(,'',sep='-'),"right")))
1: Xv-Y0
3:
Read 2 items
[1] 1

Clever. Nice work :)

PERL, 46 36 Bytes
print$2cmp$1if"@ARGV"=~/(\S+)-(\S+)/

Converts the argv list into a string, splits by the hyphen into a left and right sided no spaces arg, then returns a cmp call.

I suspect you can get rid of a number of spaces and the ;

Should be able to get away with: "@ARGV"=~/-/;print$`cmp$'
(untested)

Good idea to use cmp, but it doesn't work when the string lengths are different. "A" cmp "9" is 1 while "11" cmp "Z" is -1, even though both inputs should return the same value for this challenge.

CoffeeScript, 143 140 139
f=(s)->[a,b]=((t=s.split '-').map (y)->Array((m=Math.max) 1, 1+(m ((l=(c)->c.length) t[0]),l t[1])-l y).join('\u0000')+y);`b<a?-1:(b>a?1:0)`

Here is a jsfiddle with the results (look in the console)

perl5, 64
perl -aF- -pe '@f=map{length}@F;$_=$f[1]<=>$f[0]||$F[1]cmp$F[0]'

Just run it from the commandline. although it would look better with a new line but that costs 1 char.
perl -laF- -pe '@f=map{length}@F;$_=$f[1]<=>$f[0]||$F[1]cmp$F[0]'

This longer version handles mismatched lengths correctly.

/-/,$_=$\cmp$'would be easier, and you can skip the-aF-bit. Also, I count this a 20 (16 for$_=$F[1]cmp$F[0], and 4 for paF-, saved to a file and run as perl -paF- file.pl`).

As I noted on Eric's answer, cmp doesn't work when the two strings are of different lengths, like with 11-Z.

@ThisSuitIsBlackNot, fixed.

Nice. You can golf that down to 39 with /-/;$_=length$'<=>length$\||$' cmp$`and-p. ($`stores everything before the regex match,$'stores everything after.) Usingmapactually costs more bytes than just callinglength` twice.

Python 3, 84 bytes
x,y=[int.from_bytes(i.encode(),"big")for i in input().split("-")];print((x<y)-(y<x))

Split the string input by "-". Convert the unicode strings to bytes strings, then interpret these byte strings as big-endian integers. Finally do the comparison -- (un)fortunately cmp is no longer available in Python 3.
Python 2, 69 bytes
print -cmp(*[int(i.encode("hex"),16)for i in raw_input().split("-")])

You can shave off a character by removing the space between print and cmp.

Python 2, 79 bytes
Pretty simple solution, and it's easy to understand. Compares string lengths, then compares the strings lexigraphically.
Try it here
s,t=raw_input().split('-')
x,y=len(s),len(t)
print(x<y)*2-1if x-y else cmp(t,s)

JavaScript ES6, 46 43 bytes
f=s=>((a=s.split('-'))[1]>a[0])-(a[1]<a[0])

Good work, but this does not accomplish test case 2: 11-Z should return -1 but it returns 1.

@SamWeaver Indeed, that was added after the answer and breaks other answers also. Can you explain why '11'>'Z' when '11'<'ZZ' there is nothing in the question about how to compare string of different lengths or what value an empty string has.

The intent of the question never changed, I only added those test cases and clarification because I realized I was not clear enough in the beginning. You are right that I never defined the value of an empty string, and I will update the question accordingly. Those test cases did not change the behavior or goal of the question, merely clarified it. The examples you named function as such because each character must be treated as an individual "digit" in a number who's base is equivalent to all printable ASCII characters. This mechanic of the question never changed, simply became more clear.

@SamWeaver Changing from undefined behaviour to defined does change it. Nothing is not a character. Unless its the null character, which this handles.

F#, 53
fun s->let[|a;b|]=s="";s.Split[|'-'|]in b.CompareTo a

This is in the form an anonymous function (lambda), so you have to paste it and provide the parameter directly after is (or, using the piping notation). For example (in FSI):
> "7-9" |> fun s->let[|a;b|]=s="";s.Split[|'-'|]in b.CompareTo a
1
> "abc-abc" |> fun s->let[|a;b|]=s="";s.Split[|'-'|]in b.CompareTo a
0
> "LKzb-LKaj" |> fun s->let[|a;b|]=s="";s.Split[|'-'|]in b.CompareTo a
-1

Ruby, 59 bytes
a,b=gets.chomp.split ?-
p (b.size<=>a.size).nonzero?||b<=>a

05AB1E, 12 11 9 bytes
'-¡₄ö¥0.S

Try it online or verify all test cases.
Explanation:
'-¡          # Split the (implicit) input on '-'
             #  i.e. 'LKzb-LKaj' → ['LKzb','LKaj']
   ₄ö        # Convert both parts to a Base-1000 number
             #  i.e. ['LKzb','LKaj'] → [21020061037,21020036045]
     ¥       # Push the deltas (subtraction between each sub sequential pair) of the list
             #  i.e. [21020061037,21020036045] → [-24992]
      0.S    # Get the sign [1 for a>0; -1 for a<0; 0 for a==0] (and output implicitly)
             #  i.e. [-24992] → [-1]


text:
Non-idempotent Python
Write a few lines of Python code, X, that does not reference any global variables, such that
def method():
    X
    print(a)

method()

prints 1 but
def method():
    X
    X
    print(a)

method()

prints 2.

So, I hate to be a stickler, but it seems like vars and locals are actually global variables in Python:
def test_global_1():
    global vars, locals
    vars = lambda: 2
    locals = lambda: 3

def test_global_2():
    print(vars())
    print(locals())

test_global_1()
test_global_2()

Also, it looks like people would like to see objective winning criteria for puzzles like this. Code length doesn't really feel right here so perhaps we could make a system of brownie points for various novel features of the code? I'm not sure exactly what these could be but here's a start:

+1 for really truly no globals (no vars or locals)
+1 for being the first to post a particular technique
+1 for the shortest solution posted
+1 for a solution involving only a single Python statement
+1 for interesting "hacks" like joining at lexical non-boundaries
+1 for not using exceptions

And if you can think of more you could edit this question to add to the list.
Can this problem be solved without using exceptions and without using globals like vars and locals? I suspect it can, though I haven't figured out exactly how yet...

Good puzzle! I made sure not to scroll down so I could solve it myself without seeing anyone's answers. :D

Thanks for the puzzles Owen, and welcome to the site. There is a rule on the site that all questions must have an objective winning condition, so you should probably add one. One possibility is shortest length of X, but there are other options.

"all questions must have an objective winning condition" - Stupid rule imho. Who cares about a "winner" when we all actually most enjoy the puzzling and learning from the different answers.

Please add a [tag:code-golf] or [tag:popularity-contest] tag, depending on whether you want people to optimize for shortness code or for general popularity. I imagine code-golf is better for this challenge (popularity-contest is encouraged only for challenges that cannot be easily classified otherwise), but it's up to you.

Ongoing meta discussion.

You've added a scoring system, but also added the popularity contest tag, which means that a winner is decided by votes. What do you mean here? Perhaps you want votes just as a tiebreak?

You've added something saying 'vars' and 'locals' are in fact global variables, but I think your reasoning is flawed.  Prior to your defining 'vars' and 'locals', they weren't global variables; this can be verified by looking at globals().

The restrictions you're adding are starting to make me think an answer is provably impossible.  And I think your wording "a few lines of code" implies complete lines, which rules out clever hacks like joining at non-lexical boundaries.   So, could I win by providing a compelling impossibility proof?

@DonHatch An impossibility proof would count, yes.

Unfortunately question is on hold but I want to sneak in my answer anyway :P My code X would be a=method.a=method.__dict__.get('a',0)+1.

No fun allowed guys

def method():
    if 'a' not in vars():a=0
    a+=1
    if 'a' not in vars():a=0
    a+=1
    print(a)

Initializes the variable a to 0 only if it's not already initialized in the variables table. Then, increments it.
More briefly (thanks to histocrat for len):
def method():
    a=len(vars())+1
    a=len(vars())+1
    print(a)

If the two copies of X could be on the same line, we could do
a=0;a+=1;a

which doubles to
a=0;a+=1;aa=0;a+=1;a

with the "sacrificial lamb" aa eating up the second variable assignment.

I don't want to be a spoilsport posting this so fast, so how about we try for shortest code?

Slightly shorter variant: a=len(vars())+1

@histocrat Nice one, thanks!

Python
Thought of this solution, since try and except was the first way I thought of to determine if a variable existed yet or not.
def method():
    try:a+=1
    except:a=1
    print(a)

Python 2
def method():
    exec'';locals()['a']=locals().get('a',0)+1
    exec'';locals()['a']=locals().get('a',0)+1
    print a

method()

Basically, when exec is encountered in Python 2, it causes a special flag (0x01) to be removed from method.func_code.co_flags, which makes locals assignments have an effect. I exploited this to implement nonlocal support in Python 2 (see line 43 for the xor that modifies the flag).

Why not a = locals().get('a', 0) + 1?

@Vincent I was tiree. :O Fixed.

In that case you don't need exec'' any more ;)

@Vincent Eh, maybe I should just stick with the longer version. It felt more creative. Now it just seems a lot like a clone of the top-voted answer... :/

My first idea (and then smooshing it) was:
def method():
    a=2if'a'in vars()else 1
    a=2if'a'in vars()else 1
    print(a)

But histocrat's answer seems optimal.

My attempt. Uses the math module to track if X is run once or twice.
def module():
  import sys
  if 'math' in sys.modules:
    a+=1
  else:
    a=1
  import math

  import sys
  if 'math' in sys.modules:
    a+=1
  else:
    a=1
  import math

  print(a)

module()

def method():
    #### X-block
    try:a
    except NameError:a=1
    else:a=2
    ####
    print(a)

The try block checks if the variable a is defined.
If variable not defined,(this is only when X-block is present once) then NameError Exception is raised.
If variable is defined, (this is when X-block is present twice) then else will be entered .

Yeah, that's the solution I found by searching Google. Then I created my current solution, which is shorter.

@mbomb007 Yeah :P. Your way is shorter than using else

def method(a=[]):
  a.append(a)
  print len(a)

Edited in response to comment:  a is a list of empty lists of length n, where n is the number of time you've called method.  Calling this method twice prints 1 then 2.

Putting a=[] as a parameter is outside the parameters for this challenge.

Sorry, this is my answer, and it's not very good.  This is (arguably) a surprisingly non-idempotent operation in python, but there's no way to slot it into the format provided for the challenge without also making the challenge trivial.

Also, the challenge asks to print 1 or 2, not just two different things.


text:
C# program containing `? null :` that is still valid without `null`
I found an old post on Jon Skeet's blog that pointed out a puzzle from a tweet by Vladimir Reshetnikov:

C# quiz: write a valid C# program containing a sequence of three tokens ? null : that remains valid after we remove the null.

Note that the wording "three tokens" is important: "? null :" is a single string literal token, and comments are not tokens.
Neither the tweet replies nor the blog comments contain an answer (nor do later tweets or blog posts). I googled and couldn't find any other discussion of the problem aside from those two sources. I wasted over an hour trying different things to no avail, although I suspect it has something to do with Nullable types and case statements or maybe statement labels.
This seems right up PCG's alley, so I'll award the check to the first submission that compiles in .Net 4.x (specify version) both with and without the null present.

There's a comment on the blog post linking to an example that works for me in ideone and mono, at least. http://ideone.com/QUhTNw

I noticed that, but it doesn't work in .Net, so I don't think it's the intended solution. In any case I'll add a note to the question.

Using @downvoter does no good. It pinged me, since I was the only previous user to comment, even though I didn't downvote this (contrary to what my avatar would lead you to believe). However, I think it's safe to say that if the downvoter cared to elaborate, they would have.

Since it's possible that there might be more than one solution, I think it's a good idea to either never accept an answer or accept one after a week or so.


text:
MIRROR | ЯOЯЯIM
Challenge
Given the equation of a line and the coordinates of the vertices of a shape, output the coordinates of the shape when reflected across the given line.
Further Information
The line's equation will be given with a y and an x separated by an equals sign (there may not always be a y and an x). Some examples:
y=x
y=5.0
y=2.4x
x=6.6
y=2.0x+5.0
x=2.0y

The equation will always be supplied as a string.
The line will always be linear.
The equation will only contain +s or -s and any multiplication will be before an x or a y. The * is not used however, and the number will be placed directly before the variable.
A 0.0 is never used in the equation because there is no need for it to be shown.
The coordinates will be an array of length n>2 of arrays of length 2. Outputted coordinated must also be in a similar array.
No numbers supplied will be greater than (2^32)-1 or less than -((2^32)-1). All supplied numbers will be floats, and the output is expected to be the same.
The program may either be a full program or a function (a function may be easier for passing the coordinates).
Example
Input: y=5.0 [(0.0,0.0),(0.0,4.0),(5.0,0.0),(5.0,4.0)]
Output: [(0.0,10.0),(0.0,6.0),(5.0,10.0),(5.0,6.0)]

Input: x=3.5y [(1.14,2.04),(4.16,5.86),(6.02,0.86),(4.2,2.44)]
Output: [(2.05,-1.13),(6.63,-2.78),(5.57,2.45),(4.86,0.15)]

Winning
The shortest program in bytes wins.

Will the text for the line always have a variable by itself on the left? Also, will the only operations occurring in the line's formula be addition, subtraction, multiplication, and division? Do we need to support parentheses? Exponents?

As a side note, it'd be really helpful if you would write y=2.4x as y=2.4*x in the input, for example...

Good thing that the line is always linear. I hate those non-linear lines. :) Is it guaranteed that each variable only shows up in the equation once? For example, could it be: y=5x+3x+7?

Shouldn't the line in the example be y=4.5 instead?

@DLosc No matter which coordinate is which, the example looks more like a translation than a reflection to me. It adds the given x value to the coordinates, instead of mirroring at the line given by the value.

@RetoKoradi Yep, only once :)

@mbomb007 No exponents because the line is linear

Thanks for fixing the examples. Can you also answer @mbomb007's earlier questions? I think we need a much more precise definition of the expression syntax. Or do the examples cover all possible forms of the expression? Meaning that the only operators are the + and the multiplication with constants, where the * is not written? Are constants always floating point with digits before and after the decimal point?

@RetoKoradi Do you need any more clarification?

მƧƎ ɈqiɿɔƧɒvɒႱ, 54 47 88 65 60 67 bytes
JavaScript ES6
I've updated to the new question specifications.
(a,b)=>b.map(l=>([y,x]=l,l[g=a[0]>'x']+=l[g]-eval(a.slice(2))*2,l))

I've defined variables x and y to their corrosponding value so we can eval the expression to get the value. Using [x,y]=l, we can easilt set x to l[0] and y to l[1]
(a,b)=>b.map(l=>([x,y]=l,l[a[0]<'y'|0]+=eval(a.slice(2)),l))

Broken up:
(a,b)=>  // Function with args: a and b
  b.map(l=> . Loops through b
    (
      l[ // Gets x or y depending on condition
         a[0]<'y'|0 // x returns 0, y returns 1
      ]
      += // plus...
      eval( // evaluate the following expression
        a.slice(2).replace( // Replace the input expression
          /x|y/g, // Match 'x' and 'y'
          l=>
             `*l[${l<'y'|0}]`) // Multiple previous value by corresponding value
        )
    ,l)) // Returns new coordinates

The old version which didn't expect variables on the right-hand side, (47 bytes)
(a,b)=>b.map(l=>(l[a[0]<'y'|0]+=+a.slice(2),l))

Running it (second example):
[[2.05, -1.13], [6.63, -2.78], [5.57, 2.45], [4.86, 0.15]]

Wow the idea to eval the input is genius.


text:
All your bijective base are belong to us
Background
A bijective base b numeration, where b is a positive integer, is a bijective positional notation that makes use of b symbols with associated values of 1 to b.
Unlike its non-bijective counterpart, no symbol has a value of 0. This way, each non-negative integer n has a unique representation in bijective base b.
Popular bijective numerations include unary, bijective base 2 (used in bzip2's run-length encoding) and bijective base 26 (used to number columns in spreadsheets).
Definition
In this challenge, we define the set M of symbols as
123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<=>

and a function i from M to the natural number such that i('1') = 1, …, i('>') = 64.
Given a base b between 1 and 64 (both inclusive), we define that each non-negative integer n corresponds to the string ak…a0, consisting  of symbols of M, such that n = bki(ak)+…+b0i(a0).
This correspondence is well-defined and bijective. Since an empty sum is defined as 0, the integer 0 can be encoded as an empty string.
Task
Accept three strings as input:

An input base b between 1 and 64, encoded as a bijective base 64 string.
A non-negative integer n, encoded as a bijective base b string.
An output base B between 1 and 64, encoded as a bijective base 64 string.

Given these three inputs, encode n as a bijective base B string.
Test cases
All test cases specify the input in the order b, n, B.
Input:  "4" "" "8"
Output: ""

Input:  "A" "16" "2"
Output: "1112"

Input:  "2" "122" "A"
Output: "A"

Input:  "3" "31" "1"
Output: "1111111111"

Input:  ">" "Fe" "a"
Output: "RS"

Rules

You may read the three strings in any convenient order, as such, an array of strings, a string representation thereof, concatenated or separated by single-character delimiters of your choice.
If you choose to print the output to STDOUT, you may only print the symbols and (optionally) a trailing newline.
Base conversion built-ins of all kinds are allowed.
Standard code-golf rules apply.

CJam, 43
qA,s"?[a{A<":,:^+:Mf#):B;(bLa{(Bmd)M=\j\+}j

3 bytes eradicated with help from Dennis :) Try it online
Explanation:
The input is taken as bnB, concatenated into a single string.
q           read the input
A,s         make an array of numbers from 0 to 9 and convert to string
"?[a{A<"    push this string, which contains the ends of 3 character ranges:
             uppercase letters: ['A'…'[')
             lowercase letters: ['a'…'{')
             "<=>": ['<'…'?')
             they're in a special order for the symmetric difference below
:,          for each character, make a range of all characters smaller than it
:^          fold/reduce these 6 ranges using symmetric difference
+           concatenate with the digits before
:M          save in M; this is like the M from the statement,
             except it starts with a zero (for matching indexes)
f#          find the indexes in M of all characters from the input string
)           take out the last value from the array
:B;         save it in B and pop it
(           take out the first value
b           use it as a base and convert the remaining array to a number
             this works even if some of the digits are not in the "normal" range
La{…}j      calculate with memoized recursion, using an empty string for value 0
  (         decrement the number
  Bmd       divide by B and get the quotient and remainder
  )         increment the remainder (this is the last digit in bijective base B)
  M=        get the corresponding character from M
  \j        swap with the quotient, and convert the quotient recursively
  \+        swap again and concatenate

Oh, you can actually use the regular base conversion operator for the first base conversion? Now I feel silly for using all the code I have in my solution. :) I didn't realize that it would work with values that are outside the range of the base. Well, in hindsight, there's no good reason why it shouldn't.

@RetoKoradi yes, you can do that; one day it will be documented :)

Do you mind if I change my solution to use the base conversion? I normally try to avoid taking ideas from other solutions. But it really bugs me to let mine stand with such a sub-optimal approach. It's highly likely that your solution will still be shorter.

@RetoKoradi no problem, go ahead

Pip, 84 80 78 bytes
m:J[,tAZLCAZ"<=>"]p:$+(m@?^b)*(m@?a)**RV,#bs:m@?cWn:px:(mn-(p:n//s-!n%s)*s).xx

GitHub repository for Pip
Algorithms adapted from the Wikipedia article. Here's the explanation for a slightly ungolfed earlier version:
                 Implicit: initialize a,b,c from cmdline args; t=10;
                 AZ=uppercase alphabet; x=""
m:               Build lookup table m:
 (J,t)             0123456789 (i.e. join(range(10)))...
 .AZ               plus A-Z...
 .LCAZ             plus lowercase a-z...
 ."<=>"            plus <=>
f:{              Define f(a,b) to convert a from bijective base b to decimal:
 $+                Sum of...
  (m@?^a)            list of index of each character of a in m
  *                  multiplied item-wise by
  b**RV,#a           b to the power of each number in reverse(range(len(a)))
}
t:{              Define t(a,b) to convert a from decimal to bijective base b:
 x:""              Reset x to empty string (not needed if only calling the function once)
 Wa{               While a is not zero:
  p:a//b-!a%b        p = ceil(a/b) - 1 (= a//b if a%b!=0, a//b-1 otherwise)
  x:m@(a-p*b).x      Calculate digit a-p*b, look up the corresponding character in m, and
                     prepend to x
  a:p                p becomes the new a
 }
 x                 Return x
}
(t               Return result of calling t with these arguments:
 (f                Result of calling f with these arguments:
  b                  2nd cmdline arg
  m@?a)              1st cmdline arg's decimal value
 m@?c              3rd cmdline arg's decimal value
)
                 Print (implicit)

Sample run:
dlosc@dlosc:~/golf$ python pip.py bijectivebase.pip ">" "Fe" "a"
RS

Octave, 166 bytes
function z=b(o,x,n)
M=['1':'9','A':'Z','a':'z','<=>'];N(M)=1:64;n=N(n);x=polyval(N(x),N(o));z='';while x>0 r=mod(x,n);t=n;if r t=r;end;z=[M(t),z];x=fix(x/n)-(r<1);end

Multi-line version:
function z=b(o,x,n)
   M=['1':'9','A':'Z','a':'z','<=>'];
   N(M)=1:64;
   n=N(n);
   x=polyval(N(x),N(o));
   z='';
   while x>0
      r=mod(x,n);
      t=n;if r t=r;end;
      z=[M(t),z];
      x=fix(x/n)-(r<1);
   end
%end // implicit - not included above

Rather than create a map to convert a character to an index value, I just created the inverse lookup table N for ascii values 1..'z' and populated it with the indices at the appropriate values.
polyval evaluates the equation

c1xk + c2xk-1 + ... + ckx0

using the decimal-converted input value as the vector of coefficients c and the original base as x. (Unfortunately, Octave's base2dec() rejects symbols out of the normal range.)
Once we have the input value in base 10, calculation of the value in the new base is straightforward.
Test driver:
% script bijecttest.m
a=b('4','','8');
disp(a);
a=b('A','16','2');
disp(a);
a=b('2','122','A');
disp(a);
a=b('3','31','1');
disp(a);
a=b('>','Fe','a');
disp(a);

Results:
>> bijecttest

1112
A
1111111111
RS
>>

Perl, 261 248 229 bytes
sub t{$b=0;$b*=$_[1],$b+=ord($1=~y/0-9A-Za-z<=>/\0-A/r)while$_[0]=~/(.)/g;return$b}sub r{$n=$_[0];$n-=$m=($n-1)%$_[1]+1,$d=(chr$m)=~y/\0-A/0-9A-Za-z<=>/r.$d,$n/=$_[1]while$n;print$d}@a=split/,/,<>;r(t(@a[1],t@a[0],64),t@a[2],64)

multi-line, while loops ungolfed:
sub t{ # convert bijective base string to number
    $b=0;
    while($_[0]=~/(.)/g)
        {$b*=$_[1];$b+=ord($1=~y/0-9A-Za-z<=>/\0-A/r)}
    return$b}
sub r{ # convert number to bijective base string
    $n=$_[0];
    while($n)
        {$n-=$m=($n-1)%$_[1]+1;$d=(chr$m)=~y/\0-A/0-9A-Za-z<=>/r.$d;$n/=$_[1]}
    print$d}
@a=split/,/,<>; # parse input
r(t(@a[1],t@a[0],64),t@a[2],64)

t is a function to parse a number from a bijective-base string of a given base. r is a function to generate a bijective-base string of a given base from a number. The 3 comma-separated parameters are parsed from stdin and the functions are called as needed.
Converting a positive number to a bijective base string is similar to a normal base. However where you would do something like this for a normal base:
string s = ""
while(n)
{
    c = (n % base)
    s = (c + '0') + s
    n -= c // not necessary because the division will take care of it
    n /= base
}

you adjust the mod to give a range from 1 to base instead of 0 to base - 1:
string s = ""
while(n)
{
    c = (((n-1) % base)+1)
    s = (c + '0') + s
    n -= c  // necessary in the case c = base
    n /= base
}

CJam, 73 70 69 55 51 48 bytes
Latest version uses the CJam base conversion operator for the conversion from the source base, which I hadn't thought of until I saw @aditsu's solution. It also applies a recent tip by @Dennis for constructing the "digit" string (https://codegolf.stackexchange.com/a/54348/32852), as well as some other ideas shared on chat.
lA,s'[,_el^+"<=>"+:Lf#Ll#bLl#:K;{(Kmd)L=\}hs-]W%

Input format is the value, followed by the source and destination base, with each of them on a separate line. For the empty string, leave the first line empty. Example input:
122
2
A

Try it online
Explanation:
l       Get and interpret value from input.
A,s     Build the list of 64 "digits". Start with [0..9]
'[,     Build character sequence from \0 to Z.
_el     Lower case copy of the same sequence.
^       Symmetric set difference gives only letters from both sequences.
+       Concatenate with sequence of decimal digits, creating [0..9A..Za..z].
"<=>"   Remaining 4 characters.
+       Concatenate, resulting in full 64 character "digit" string.
:L      ... and store it in variable L for repeated use.
f#      Look up input characters in digit list.
Ll#     Get source base from input, and look up value in digit list.
b       Base conversion. This produces the input value.
Ll#     Get destination base from input, and look up value in digit list.
:K;     Store it in variable K for use in loop, and pop it off stack.
{       Loop for generating output digits.
  (       Decrement to get ceiling minus 1 after division.
  Kmd     Calculate divmod of current value with destination base.
  )       Increment mod to get 1-based value for digit.
  L=      Look up digit character for digit value.
  \       Swap. Digit stays on stack for output, remaining value is processed
          in next loop iteration until it is 0.
}h      End of loop for generating output digits.
s       Final value is 0. Covert it to a string.
-       And subtract it from second but last value. This eliminates the 0,
        as well as the second but last value if it was a \0 character.
]       Wrap digits in array.
W%      Reverse array, to get result from MSB to LSB.

Python 2, ... 317 307 298 311 bytes
Definitely golfable. I really hate how strings have no item assignment and lists have no find. I'll look into a better way than my fast fix that I have now.
My method is to convert the input to a decimal number, then to the output base, then convert that to the bijective base.
Edit: Found that my program didn't work when converting to Unary. It cost 13 bytes to fix with e=F(o)<2, etc.
Try it here
R=range;M="".join(map(chr,R(48,58)+R(65,91)+R(97,123)))+"<=>"
b,s,o=input()
F=M.find
e=F(o)<2
B=lambda n:n and B(n/F(o)-e)+M[n%F(o)+e]or""
n=B(sum(F(s[~j])*F(b)**j for j in R(len(s))))
i=n.find('0')
n=list(n)
while-~i:n=n[:i-1]+[M[F(n[i-1])-1]]+[o]+n[i+1:];n=n["0"==n[0]:];i="".join(n).find('0')
print"".join(n)

I agree with your Python pet peeves.

@DLosc Thanks for the golf help.

is this [tag:code-bowling] ? :P

Lists have the .index() method.. Why not use that instead of find? Also, instead of saving F(b) and F(o) to variables, you only use them once, so just sub them in where necessary. Finally, 'n'[2::5] is shorter than ''.join(n) (replace apostrophes for backticks).

Also, I think you're over-complicating this.. Conversion from a string M bijective base b to decimal shouldn't take more than 35-40 bytes. Decimal to a string of bijective base B won't be much more than that.

I can't use backticks around n, since n can be a long. I cannot use .index() on the list, since the list isn't guaranteed to contain '0', and would throw an exception in such a case.

@Vioz- I'd have to use str(n)[2::5] or \n`[2:-1:5]`, both of which are longer.

Python 2, 167 Bytes
No special tricks in here really, except for the [2::5] slicing to get the charset at a lower byte count.
x=range;A=`map(chr,x(49,58)+x(65,91)+x(97,123))`[2::5]+'<=>'
r=A.find
b,n,B=input()
B=r(B)+1
d=0;s=''
for c in n:d=d*-~r(b)+r(c)+1
while d:d-=1;s=A[d%B]+s;d/=B
print s

Tests:
"4","","8"     >>> (empty string)
">","Fe","a"   >>> RS
"3","31","1"   >>> 1111111111
"A","16","2"   >>> 1112
"2","122","A"  >>> A

Jelly, 22 bytes
ØBḊ;“<=>”
i@€€¢ḅḃ2ƭ/ị¢

Try it online!


text:
Code Golf : Parsing google results
When you search something on google, within the results page, the user can see green links, for the first page of results.
In the shortest form possible, in bytes, using any language, display those links to stdout in the form of a list. Here is an example, for the first results of the stack exchange query :

Input :
you choose : the URL (www.google.com/search?q=stackexchange&ie=utf-8&oe=utf-8) or just stackexchange
Output :
french.stackexchange.com/, stackoverflow.com/, fr.wikipedia.org/wiki/Stack_Exchange_Network, en.wikipedia.org/wiki/Stack_Exchange,...

Rules :

You may use URL shorteners or other search tools/APIs as long as the results would be the same as searching https://www.google.com.

It's ok if your program has side effects like opening a web browser so the cryptic Google html/js pages can be read as they are rendered.

You may use browser plugins, userscripts...

If you can't use stdout, print it to the screen with, eg. a popup or javascript alert !

You don't need the ending / or the starting http(s)://

You should not show any other link

Shortest code wins !

Good luck !

EDIT :
This golf ends the 07/08/15.

Since you are using google.fr, do we have to use that as well?

You can use any google you want. I'm french, so I used .fr, but you could use .com or .anything :) Dosn't matter

And shortened URLs such as gogle.de are fine as well?

You may use URL shorteners or other search tools/APIs as long as the results would be the same as searching https://www.google.com, so yes

I've made some minor formatting changes - feel free to reverse any that are not how you want.

In case you're tempted: remember you can't parse HTML with regex

I can't find an online Python interpreter that will let me use urllib or anything web related.

@mbomb007 I'm pretty sure IdeOne supports urllib

The method I found for using urllib required import json as well. You seem to have done it without that.

can we use google.search API libraries?

Yup :) (But, by the way, did you see the date of the challenge ? It's cool, but, a few months old :p)

Bash + grep + lynx, 38
Since we can open a web browser, then I will use lynx:
lynx -dump $1|grep -Po '(?<=d:)[^&]+'

(Thanks to @manatwork for grep usage instead of sed)
We pass in the whole URL in as a parameter:
$ ./gr.sh "www.google.com/search?q=stackexchange&ie=utf-8&oe=utf-8"
http://stackexchange.com/
https://en.wikipedia.org/wiki/Stack_Exchange
https://twitter.com/stackexchange
https://play.google.com/store/apps/details?id=com.stackexchange.marvin
https://github.com/StackExchange/StackExchange.Redis
https://github.com/StackExchange/StackExchange.Redis/blob/master/Docs/Basics.md
https://www.crunchbase.com/organization/stack-exchange
$

Which gives the same list as:

Well that's handy :D

sed good. sed long. Try GNU grep: grep -Po '(?<=d:)[^&]+'

@manatwork Yes, of course - thanks!

Was the answer title copypasted? ;) None of bash, lynx or sed (and now grep) is part of coreutils.

@manatwork I was not implying that bash or lynx were part of coreutils - thats why they are listed separately.  For some reason I had the mistaken belief that grep and sed were coreutils - I've fixed that.

I believe you can also do: lynx -dump $1|grep -Po 'd:\K[^&]+' (untested)

Best answer to date !

Ruby, 91 77 bytes
require'open-uri';open(gets).read.scan(/ed:(.*?)\+/){|x|puts URI.decode x[0]}

Would've been shorter without all the requires. ARGH!!! EDIT: So, turns out, I don't need the second require! Thanks to @manatwork for pointing that out.
Older version (with the useless require):
require'open-uri';require 'uri';open(gets).read.scan(/ed:(.*?)\+/){|x|puts URI.decode x[0]}

Rules allow the use of command line options as long as you count them too: http://pastebin.com/PnpjnXji (If you feel this is unfair style, feel free to use only the change in the code block.)

Are you sure you need to explicitly require'uri'? In 2.1.2 I use the URI module becomes available after requiring open-uri.

@manatwork Thank you! Updated.

Just for my curiosity: any reason to not change the code block as in my pastebin alternative? (Of course, I'm curious about technical reasons, not personal reasons, if that hold you back.)

@manatwork I need to, but I was too lazy to figure out the byte count at the moment. :)

Wolfram Language (Mathematica), 135
StringJoin/@(Cases[URLExecute["www.google.com/search",{"q"->#},"XMLObject"],XMLElement["cite",_,l_]:>l,-1]/.XMLElement["b",_,{s_}]:>s)&

more readable:
StringJoin/@(Cases[
    URLExecute["www.google.com/search",{"q"->#},"XMLObject"],
    XMLElement["cite",_,l_]:>l,-1] /.
    XMLElement["b",_,{s_}]:>s)

Are the spaces really necessary? Without them, I get 136 bytes.

not necessary at all...I really should tighten this up..

Can you do something like this answer to shorten this?

Python 3, 141 bytes
Nowhere near Digital Trauma's answer, but it was fun to work out the regex :D
import re
print('\n'.join(map(lambda x:x[3:],re.findall('te>http[s]?://\w+\.[a-z]+[](/a-z\.)?]+',__import__("requests").get(input()).text))))

For input http://www.google.com/search?q=stackexchange&ie=utf-8&oe=utf-8 the program outputs:
https://en.wikipedia.org/wiki/
https://twitter.com/
https://play.google.com/store/apps/details?id...
https://www.crunchbase.com/organization/
https://www.facebook.com/
https://github.com/

Implements grc's tip

Do you really need to use __import__?

Also, use an [x for x in spam] construct instead of map. That will save you a good number of bytes.

Factor, 31 bytes
There happens to be a library for this.
[ google-search [ url>> ] map ]

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