text:
To be or not to be
In the fewest bytes possible, determine whether the two values given each match one of the following:
First value
2      string or integer - whichever you prefer
to     case insensitive
too    case insensitive
two    case insensitive
t0     case insensitive (t zero)

Second value
b      case insensitive
be     case insensitive
bee    case insensitive
b3     case insensitive

Examples
2          'Bee'            true
'2'        'b'              true
'not to'   'be'             false
'that is'  'the question'   false

Generally return values are considered valid if truthy or falsy.

N0 l33t? “t0 b3”

@Draco18s I had so many questions last time I posted a question I thought it best to make it very clear.

Why does it have to be a function?

@rybo111 Well!  That seems like they didn't understand the concept then ;)

@manatwork Good point, added.

@Dennis Edited.

Can we take one string as input, with one space between the args?

@FryAmTheEggman I think they whole thing should match one of those strings.

@FryAmTheEggman The first and second values must both match one of the listed values. not to is not in the first list, so your example would be false.

Why is 2 not in quotes?

@JAtkin It's an integer example

Wait, we have to handle integers as input? (not a prob for my impl, but still a surprise)

This one begs for a Shakespeare solution.  Non-competing of course, as the byte count would undoubtedly be huge...

@DarrelHoffman I imagine one of the creators would like to attempt that!

@rybo111 It appears some of the answers are failing to permit the first input to be either a string '2' or an integer 2. Maybe you should make that clearer in the challenge spec

@LuisMendo OK. Either is fine. Supporting both is not necessary.

That is the question indeed.

Shakespeare, 4778 Bytes
Note: this answer is not meant to be a serious competitor
To Be or Not To Be, This is the Answer.

Hamlet, the main player in our story.
Horatio, Hamlet's guide through his internal struggles.
The Ghost, a handsome honest bold fair gentle king.
Claudius, the worthless usurper of the throne.
Ophelia, who Hamlet always writes two.
Polonius, the unfortunate third man caught between Hamlet and Claudius.
Brabantio, the greater.
Banquo, the lesser.
Emilia, the greater.
Egeus, the lesser.
Othello, the greater.
Orsino, the lesser.
Tybalt, the greater.
Titania, the lesser.
Valentine, who doubled is greater.
Viola, who doubled is lesser.

Act I: A simple question in so many words.

Scene I: Hamlet passes judgment over the cast.

[Enter Hamlet and Horatio]
Hamlet:
    Thou art the sum of a good healthy sunny warrior and a lovely day.
[Exit Horatio]
[Enter Claudius]
Hamlet:
    Thou art the sum of The Ghost and warm cute brave trustworthy hero.
[Exit Claudius]
[Enter Ophelia]
Hamlet:
    Thou art the sum of Claudius and a smooth spaceman.
[Exit Ophelia]
[Enter Polonius]
Hamlet:
    Thou art the sum of Ophelia and a plum.
[Exit Polonius]
[Enter Brabantio]
Hamlet:
    Thou art the sum of The Ghost and the sum of The Ghost and a rich kingdom.
[Exit Brabantio]
[Enter Banquo]
Hamlet:
    Thou art the sum of Brabantio and The Ghost.
[Exit Banquo]
[Enter Emilia]
Hamlet:
    Thou art the sum of Brabantio and the sum of joy and a gentle girl.
[Exit Emilia]
[Enter Egeus]
Hamlet:
    Thou art the sum of Emilia and The Ghost.
[Exit Egeus]
[Enter Othello]
Hamlet:
    Thou art the sum of Emilia and the sum of a cunning lover and the sweetest golden embroidered rose.
[Exit Othello]
[Enter Orsino]
Hamlet:
    Thou art the sum of Othello and The Ghost.
[Exit Orsino]
[Enter Tybalt]
Hamlet:
    Thou art the sum of Othello and the sum of happiness and fair fine heaven.
[Exit Tybalt]
[Enter Titania]
Hamlet:
    Thou art the sum of Tybalt and The Ghost.
[Exit Titania]
[Enter Valentine]
Hamlet:
    Thou art the sum of Tybalt and the sum of a happy day and a pony.
[Exit Valentine]
[Enter Viola]
Hamlet:
    Thou art the sum of Valentine and The Ghost.
[Exeunt]

Scene II: The beginning of Horatio's interrogation.
[Enter Hamlet and Horatio]
Hamlet:
Horatio:
    Open your mind.
    Art thou as good as Tybalt?  If so, let us proceed to Scene IV.
    Art thou as good as Titania?  If so, let us proceed to Scene IV.
    Art thou as good as Ophelia?  If not, let us proceed to Scene XII.

Scene III: Are we to?
Horatio:
    Open your mind.
    Art thou as good as The Ghost?  If so, let us proceed to Scene VII.
    Let us proceed to Scene XII.

Scene IV: Can we go further than t?
Horatio:
    Open your mind.
    Art thou as good as Claudius?  If so, let us proceed to Scene III.
    Art thou as good as Valentine?  If so, let us proceed to Scene VI.
    Art thou as good as Viola?  If so, let us proceed to Scene VI.
    Art thou as good as Othello?  If so, let us proceed to Scene V.
    Art thou as good as Orsino?  If not, let us proceed to Scene XII.

Scene V: Oone oor twoo?
Horatio:
    Open your mind.
    Art thou as good as The Ghost?  If so, let us proceed to Scene VII.
    Art thou as good as Othello?  If so, let us proceed to Scene III.
    Art thou as good as Orsino?  If so, let us proceed to Scene III.
    Let us proceed to Scene XII.

Scene VI: Hamlet desperately searches for whOo?.
Horatio:
    Open your mind.
    Art thou as good as Othello?  If so, let us proceed to Scene III.
    Art thou as good as Orsino?  If so, let us proceed to Scene III.
    Let us proceed to Scene XII.

Scene VII: Knowing to, what to do?
Horatio:
    Open your mind.
    Art thou as good as Brabantio?  If so, let us proceed to Scene VIII.
    Art thou as good as Banquo?  If not, let us proceed to Scene XII.

Scene VIII: Learning what to Bleive.
Horatio:
    Open your mind.
    Art thou as good as me?  If so, let us proceed to Scene XI.
    Art thou as good as Emilia?  If so, let us proceed to Scene X.
    Art thou as good as Egeus?  If so, let us proceed to Scene X.
    Art thou as good as Polonius?  If not, let us proceed to Scene XII.

Scene IX: The Eend is nigh?
Horatio:
    Open your mind.
    Art thou as good as me?  If so, let us proceed to Scene XI.
    Let us proceed to Scene XII.

Scene X: Wee may havee succeeeedeed.
Horatio:
    Open your mind.
    Art thou as good as Emilia?  If so, let us proceed to Scene IX.
    Art thou as good as Egeus?  If so, let us proceed to Scene IX.
    Art thou as good as me?  If not, let us proceed to Scene XII.

Scene XI: Hamlet is at peace.
Horatio:
    Thou art a beacon of happiness.
    Let us proceed to Scene XIII

Scene XII: The demons have won.
Horatio:
    Thou art nothing.

Scene XIII: Hamlet opens up.
Horatio:
    Hamlet! Open your heart.
[Exeunt]

Outputs 0 if false, 1 if true.
This could easily be shorter (and if people really want me to, the word lengths could be cut down), but to do so would be a slap to the face of good ol' Will.  I've always felt Horatio is the unsung hero of Hamlet, so I made sure that he was the one to deliver the intense monologue to Hamlet where Hamlet has to ultimately prove that he is as good as Horatio (who represents the newline).
The code itself is pretty simple.  All of the characters sans Hamlet are ascii values (In order:newline,space,0,2,3,B,b,E,e,O,o,T,t,V,v) and then the code is a simple state machine (specifically, a DFA) that transitions to Scene XI as an accept state and Scene XII as a reject state.
.
After making this, I just plugged it into Shakespeare, using the fact that I could drop down to the next state when they were numerically adjacent.  I only tested it with the version of Shakespeare I linked in the title, but I believe we define a language by an implementation iirc.

When I posted this question, I never envisaged I would get such a complex and yet very fitting answer!

Retina, 28

1 byte saved thanks to @MartinBüttner.

Quite possibly my quickest ever code-golf answer - 9 minutes after OP.
Input parameters are comma-separated.  Output is 1 for truthy and 0 for falsey.
i`^(2|t[ow]?o|t0),b(e?e?|3)$

Try it online.

I always love it when fixing bugs saves bytes!

@Neil yep - deleted code is debugged code :)

@DigitalTrauma Truly, only sufficiently penitent code can be allowed in our brave new world.

Pyth, 34 bytes
.A}Lrw1c2c." Wô-WûÄæ§Òé
}

Try it online: Demonstration
Explanation:
          ."...   packed string, gets decoded to: "2 TO TOO TWO T0 B BE BEE B3"
         c        split by spaces
       c2         split into 2 lists: [['2', 'TO', 'TOO', 'TWO', 'T0'],
                                       ['B', 'BE', 'BEE', 'B3']]
   L              for each list:
     w               read a line
    r 1              convert it to uppercase
  }                  and test if it is part of this list list
.A                test if both return true

Somehow if I remove the code before the packed string, the string becomes broken.

@FryAmTheEggman I did. The output was "!$7C<Q/=/LF$VF4K:.-E"

@FryAmTheEggman I tried a few times and compared the permalink, there was something missing. It seems it's because I copied and pasted, rather than using the link in the answer. I didn't know you'll miss some bytes when pasting packed strings into SE.

@busukxuan Yeah I just noticed the same thing :P SE hides most unprintable characters unfortunately.

This doesn't seem to pass the condition (t zero) for the first value

@NicRobertson Your right. No idea how I forgot about this case. Fixed it for a cost of 2 bytes.

Pyth, 41 bytes
&xrw0c"2 to too two t0"dxrw0c"b be bee b3

Try it here!
Straightforward list lookup. Prints an empty list as falsy value and a non-empty list as truthy value.
Looking or a better way tho, I don't really like this one.

Oracle SQL 11.2, 86 bytes
SELECT 1 FROM DUAL WHERE:1 IN('2','to','too','two','t0')AND:2 IN('b','be','bee','b3');

Returns one row for truthy and no row for falsey.

Perl 6, 45 44 bytes

Thanks to the folks in IRC for helping me golf this down
{@_~~(~2|/:i^t[0|oo?|wo]$/,/:i^b[ee?|3]?$/)}

usage
> my &f = {@_~~(~2|/:i^t[0|oo?|wo]$/,/:i^b[ee?|3]?$/)}
-> *@_ { #`(Block|309960640) ... }
> f("2", "Bee")
True
> f("2", "b")
True
> f("not to", "be")
False
> f("that is", "the question")
False

Non-competing alternative, 54 bytes
This is a nice alternative to the above if you think regexes are gross, but it is a tad longer. It could be golfed down a couple more bytes but since it's non-competing I'll leave it as is.
{@_».lc~~(qw<to too two t0 2>.any,<b be bee b3>.any)}

To anyone looking at this who doesn't know Perl 6. [ and ] denote a non-capturing group in a regex, which would be written as (?: and ) in Perl 5. To get a character class you have to place them in angle brackets <[ and ]>.

b2gills++, I didn't even think to mention the differences in Perl 6 regexes

I have had a downvote because someone didn't know that, so I always point it out.

Is there a PP&CG rule stopping you from posting the more elegant golf as its own answer? I think a slightly longer* version would be worthy. *I hereby decree that elegant golf idioms include not caring about (not counting) whitespace.

ES6, 56 48 45 bytes
(...a)=>/^(2|t0|t[wo]?o),b(ee?|3)?$/i.test(a)

Saved 5 bytes thanks to @user81655. Saved 3 bytes from some further optimisation. Saved another 3 bytes thanks to @Patrick Roberts.
t[wo]?o is the shortest regex I could think of to match all three homophones.
If it's permitted to pass the two values as a single parameter array, then the rest parameter can become a normal parameter, saving another 5 bytes.

@user81655 Not bad, but I've further improved it.

if you use the rest parameter for input, it will save you 3 bytes: (...a)=>/^(2|t0|t[wo]?o),b(ee?|3)?$/.test(a)

@PatrickRoberts Huh, I had thought about that, but I must have miscalculated, because I didn't think I was saving anything.

The i flag is missing.

@Florent Thanks for spotting that. (Maybe the examples should not be all lower case...)

05AB1E, 39 45 bytes
Code:
“2€„…«Œ† t0“' ¡)Ilrk\U“b€ïÍÝ b3“' ¡)Ilrk\>X>*

Try it online!
Uses CP-1252 encoding. Truthy is when a number is outputted and falsy is when nothing is outputted.
Non-competing version (39 bytes), works with the newest version:
“2€„…«Œ† t0“ð¡)IlkU“b€ïÍÝ b3“ð¡)Ilk>X>*

Python 2.7, 133 bytes
def e(a, b):
        c, d = """2,too,to,t0,two""","""be,b,bee,b3"""
        return a.lower() in c and b.lower() in d

print e('2', 'bee')

Not sure if we're supposed to post solutions if there's a smaller version in the comments but here's my version in Python.
Edit: Without the function it's only 73 bytes (and that's not even near the best answers. Forgive me I'm new
a, b = "to", "bee"
print a in "2 too to t0 two" and b in "be b bee b3"

Welcome to PPCG!  If you spent time writing and golfing an answer and didn't plagiarise (without attribution), then you're welcome to post your answer!

Oh and most languages have a golfing-tips style question here.  Python is no exception

Note that this does work with input of 2 (integer)

Also, by taking out unneeded spaces you can get this down to 98 bytes (you dont need to include print e('2', 'bee') in your count either)

Thanks digital trauma that looks very helpful.
And thank you wnnmaw, my text editor hates me but golf was never supposed to be pretty

This returns True also for e('oo', '3') and similar substrings.

@TheLateOne, Python isn't very golfable, so you will almost never beat the golfing languages like pyth or cjam, but getting in the 50, 60, or 70 range is pretty good for us on most challenges.  Don't get discouraged!

The first line can be a,b="to","bee" ...

@wnmaw Ok I'll just try to minimise my output then - pyth looks fun though so I might branch out once I'm more confident with optimising Python solutions

Ruby, 53 55 52 bytes
f=->(a,b){/^(2|t[wo]?o|t0)$/i=~a&&/^b(e?e?|3)$/i=~b}

I'll be honest, this is my first attempt at trying to golf a problem.
Function call in the form of f.call(firstValue, secondValue)
0 is Truthy, nil is Falsy.
Test it Here

Pyth, 39 bytes
-3 bytes by @FryAmtheEggman
.A.b}rN1cY\@Q,."0WÑ³5YYÅJB"."3EW´l¢ï

Try it here.

I'll fix it when I get to a computer.

PowerShell v3+, 74 70 bytes
param($a,$b)+($a-in-split'2 to too two t0')*($b-in-split'b be bee b3')

Doesn't use regex. Takes two input, checks if the first one is -in the array that's been dynamically created by the -split operator, converts that Boolean to an int with +, then multiplies that * with checking whether the second is -in the second array (which will automatically cast the Boolean as an int). This works because x*y == x&y if x and y can only be 1 or 0.
PowerShell by default is case-insensitive, so we get that for free. Will output 0 or 1 for falsey/truthy, respectively. Requires v3 or newer for the -in operator.
Edit -- Saved 4 bytes by using unary -split

Japt, 36 bytes
!Uv r"2|t(0|wo|oo?)" «Vv r"b(e?e?|3)

Maybe I missed something, but this should work completely. Test it online!

Python, 85 83 bytes
@Manatwork saved me two bytes.
This is pretty brute force, I'll look into regex solutions next.
lambda a,b:a.lower()in'2 to too two t0'.split()and b.lower()in['b','be','bee','b3']

For the first array: '2 to too two t0'.split() For the second array makes no difference.

Damn, yes, I tried '2,to,too,two,t0'.split(','). Silly me.

Python 2, 67 bytes
Uses Digital Trauma's regex. Input is a single string separated by a comma. Not sure if that format is allowed for input...
import re
f=lambda x:bool(re.match('^(2|t[ow]?o|t0),b(e?e?|3)$',x))

C# 6, 132 bytes
bool t(string x,string y)=>new[]{"2","to","too","two","t0"}.Contains(x.ToLower())&&new[]{"b","be","bee","b3"}.Contains(y.ToLower());

Ungolfed version (Only slightly more readable):
bool t(string x, string y) => new[] { "2", "to", "too", "two", "t0" }.Contains(x.ToLower()) && new[] { "b", "be", "bee", "b3" }.Contains(y.ToLower());

Groovy, 52 bytes
f={x,y->"$x $y"==~"(?i)(2|t([wo]o?|0)) (b(ee?|3)?)"}

==~ is a cool regex operator in groovy that checks for equality.
Tests:
Regex101 test.
assert f('2', 'Bee') == true
assert f('2', 'b') == true
assert f('not to', 'be') == false
assert f('that is', 'the question') == false

What if x is t and y is 0b?

What do you mean?

I'd expect f('t', '0b') to be false, but I'm concerned that your code would return true.

Ohhhh, Ok, I got it. Yep it would return the wrong thing.

MATL, 32 41 43 bytes
jk'^(2|t[ow]?o|t0),b(e?e?|3)$'XX

Same approach as @DigitalTrauma's Retina answer.
Inputs are separated by a comma. Truthy output is a string with the two inputs lowercased; falsy is no output.
Try it online!
j                                % input as a string
k                                % convert to lowercase
'^(2|t[ow]?o|t0),b(e?e?|3)$'     % regular expression to match the two inputs
XX                               % match regular expression


text:
Sort these bond ratings
The task
The credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer, and the "Big Three" credit rating agencies use a similar (though not identical) tiered rating system. These have a clear, logical order - using the S&P tiers, AAA > AA+ > AA > AA- > A+ > ... > BBB > B > ... > C. Moody's uses a similar system, but names their tiers differently (Aaa > Aa1 > Aa2 > ... > Baa1 > ... > C).
Your task is to design a program which takes as input a list of strings representing bond rating tiers and output the same list, sorted in descending order from the highest tier (AAA/Aaa) to the lowest tier (C).
Input / Output
You may choose the format of the input (list, one per argument, CSV file). You may assume that every item in the input list is a valid rating string and that all rating strings in a list came from the same rating agency. Additionally, you may assume that none of the funky NA-style ratings such as "NR" or "WR" will be included - this is strictly from "Aaa/AAA" to "C". There may be duplicate ratings in the input list, and if found they should not be removed.
You may also choose the format of the output as is appropriate for your language, with the only restriction being that it should be outputting some standard text encoding like UTF-8 or ASCII.
Rules and scoring
This is code golf, so lowest byte count wins, standard loopholes disallowed. Please specify what the input and output format is.
Example program and test cases
The example Python program below can be used as a standard example of the correct sort order. The lists Moody and SP are the orderings to use.
Moody = ['Aaa', 'Aa1', 'Aa2', 'Aa3', 'A1', 'A2', 'A3',
         'Baa1', 'Baa2', 'Baa3', 'Ba1', 'Ba2', 'Ba3',
         'B1', 'B2', 'B3', 'Caa', 'Ca', 'C']

SP = ['AAA', 'AA+', 'AA', 'AA-', 'A+', 'A', 'A-',
      'BBB+', 'BBB', 'BBB-', 'BB+', 'BB', 'BB-',
      'B+', 'B', 'B-', 'CCC', 'CC', 'C']

test_cases = [
    (['Aa2', 'Aaa', 'Aa1'], ['Aaa', 'Aa1', 'Aa2']),
    (['AA', 'AA-', 'AA+'], ['AA+', 'AA', 'AA-']),
    (['Baa1', 'Ba1', 'A1', 'B1', 'Aaa', 'C', 'Caa', 'Aa1'],
     ['Aaa', 'Aa1', 'A1', 'Baa1', 'Ba1', 'B1', 'Caa', 'C']),
    (['BBB+', 'BB+', 'A+', 'B+', 'AAA', 'C', 'CCC', 'AA+'],
     ['AAA', 'AA+', 'A+', 'BBB+', 'BB+', 'B+', 'CCC', 'C']),
    (['B3', 'B1', 'B2'], ['B1', 'B2', 'B3']),
    (['B-', 'B+', 'B'], ['B+', 'B', 'B-']),
    (['B3', 'Caa', 'Aa1', 'Caa', 'Ca', 'B3'],
     ['Aa1', 'B3', 'B3', 'Caa', 'Caa', 'Ca']),
    (['B-', 'CCC', 'AA+', 'CCC', 'CC', 'B-'],
     ['AA+', 'B-', 'B-', 'CCC', 'CCC', 'CC'])
]

mdy_sort = lambda x: Moody.index(x)
sp_sort = lambda x: SP.index(x)

for l_in, l_out in test_cases:
    sort_key = mdy_sort if set(l_in).issubset(set(Moody)) else sp_sort
    assert sorted(l_in, key=sort_key) == l_out

Test cases
In case the python-style test case formatting is inconvenient, I've output it as space-delimited input strings (grouped in two-line pairs input followed by output):
Aa2 Aaa Aa1
Aaa Aa1 Aa2

AA AA- AA+
AA+ AA AA-

Baa1 Ba1 A1 B1 Aaa C Caa Aa1
Aaa Aa1 A1 Baa1 Ba1 B1 Caa C

BBB+ BB+ A+ B+ AAA C CCC AA+
AAA AA+ A+ BBB+ BB+ B+ CCC C

B3 B1 B2
B1 B2 B3

B- B+ B
B+ B B-

B3 Caa Aa1 Caa Ca B3
Aa1 B3 B3 Caa Caa Ca

B- CCC AA+ CCC CC B-
AA+ B- B- CCC CCC CC

Note: I mention the "Big Three" but only specify Moody's and S&P here - the reason is that the third, Fitch, uses the same system as S&P when you don't take into account the NA-style ratings, so including Fitch would be redundant.

Dude, if this is your first post, I am damn well impressed. +1

@VoteToClose Long time listener, first time caller. ;)

Should the output be case sensitive?

@dev-null Yes, the output should be the same input strings, reordered.

Can you post some test cases?

@LuisMendo The test cases are in the example program, test_cases. The program runs the tests.

@Paul I know... but what if some of us don't have Python?

I assumed that anyone using the test cases would just copy-paste them and apply some text transformation to them to get them into their preferred input format. If there's a preferred format for test cases, I can add that to the main post.

Can the input lists contain any equal ratings?  If so should all equals be output, or remove duplicates?

@DigitalTrauma Yes, they can contain duplicates, and duplicates should not be removed. I will add a test case to this effect.

Note that customers in the B mega-tier are the most profitable for banks.

Pyth, 16 bytes
o+Xs}RGrN0N\z\,Q

We sort lexicographically by a key using @Neil's approach. Input and output are as lists; this does not mutate the list.
o+Xs}RGrN0N\z\,Q       Implicit: Q = input list
                        lambda N  (N is a bond rating)
       rN0               Convert N to lowercase
    }RG                  Map is-in G, the lowercase alphabet.
   s                     Sum the list of bools; the number of letters in N.
  X       N\z            Insert "z" at that position in N.
 +           \,          Append "," to the end.
                         This works because "," is between "+" and "-" lexicographically.
o              Q       Sort Q, using that lambda as a key.

Try it here. Test cases are all bond ratings of each rating scheme, with a duplicate thrown in.

ES6, 71 65 bytes
a=>a.sort((b,c)=>r(b)>r(c)||-1,r=s=>s.replace(/[^A-z]*$/,"z$&,"))

By inserting a z after the letters and suffixing a , we just have to sort the strings lexically.
Edit: Saved 6 bytes thanks to @user81655.

Nice idea. It could also be a bit shorter by defining a separate function for the replace and using $& inside it: a=>a.sort((b,c)=>(r=t=>t.replace(/[^A-z]*$/,"z$&,"))(b)>r(c)||-1)

@user81655 Bah, I originally had s="$1z$2," and although I realised that I could golf away the $1 it hadn't occurred to me that I could now golf away the $2 too...

Bash + GNU utilities, 45
Credit is due to @Neil for the approach.
sed s/$/e/|tr +-3 d-l|sort|tr -d e|tr d-l +-3

In my locale sort order, numbers sort before letters and - sorts before +.  So these characters are transliterated into the alphabet range so they sort in the right order.
Try it online.

source: Stack Exchange

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

sort: votes


text:
Arbitrary Precision Integer Division
We will be implementing division for arbitrarily large integers.
This is code-golf.
The task is to write a program or function that implements arbitrary precision integers and Division on them.
Note that many things that might make this very easy are disallowed, please make sure to read through the spec.
Input
You will be given 2 things as input:

a string of base 10 digits, call it \$n\$.
another string of base 10 digits, call it \$m\$

Assume that \$n>m>0\$ meaning that you will never be asked to divide by zero.
Output
You will output two numbers, \$Q\$ and \$R\$ where \$m\times Q+R=n\$ and \$0 \leq R < m\$
Specifications

Your submission should work for arbitrarily large integers (limited by available memory).

You may not use external libraries. If you need an external library for i/o, you may treat it as a built-in. (looking at things like iostream, etc).

If your language has a built-in that trivializes this, you may not use it. This includes (but may not be limited to) built-in types that can handle arbitrary precision integers.

If a language for some reason uses arbitrary precision integers by default, this functionality cannot be used to represent integers that could not be typically stored in a 64 bits.

Input and output MUST be in base 10. It does not matter how you store the numbers in memory or how you perform arithmetic on them, but i/o will be base 10.

You have 15 Seconds to output a result. This is to prohibit iterated subtraction.

The goal here is to actually implement arbitrary precision integers. If for some reason you are able to adhere to the challenge specs and successfully do this without implementing them, well I guess good for you, sounds valid.

Test Cases

In this case, inputs are \$39!\$ and \$30!\$

Input
n = 20397882081197443358640281739902897356800000000
m = 265252859812191058636308480000000

Output
Q = 76899763100160
R = 0

n is the sum of all factorials up to 50, plus 1. m is concatenated numbers up to 20.

input
n = 31035053229546199656252032972759319953190362094566672920420940313
m = 1234567891011121314151617181920

output
q = 25138393324103249083146424239449429
r = 62459510197626865203087816633

n is 205! + 200!. m is how many tears PeterTaylor has made me shed by tearing apart things I post in the sandbox.

Input
n = 271841734957981007420619769446411009306983931324177095509044302452019682761900886307931759877838550251114468516268739270368160832305944024022562873534438165159941045492295721222833276717171713647977188671055774220331117951120982666270758190446133158400369433755555593913760141099290463039666313245735358982466993720002701605636609796997120000000000000000000000000000000000000000000000000
m = 247

Output
q = 1100573825740813795225181252819477770473619155158611722708681386445423816849801159141424129060075102231232666057768175183676764503262931271346408394876267875141461722640873365274628650676808557279259873162169126398101692109801549256156915750794061370041981513180387019893765753438422927286098434193260562682052606153857091520795991080960000000000000000000000000000000000000000000000000
r = 0;

I'll probably add more test cases at some point.
Related
Sounds related, but really isn't

Does IO libraries count as external libraries?

@JohnsonSteward I'm not sure what you mean by that? I would default to "yes", but could you clarify?

@JohnsonSteward well I suppose it depends on what you are IOing? Is it code/a library of code?

What does "trivialize" mean?

I mean does iostream, IO, stdio.h or alike count as external libraries?

@JohnsonSteward No, those are fine. You need those for stdin.

@njpipeorgan a BigInt library is what I had in mind

@Liam But in languages like Mathematica, there is only one type called Integer, regardless of the magnitudes of numbers.

@njpipeorgan That is disallowed.

To be clear, is fixed-width (e.g. 32 or 64 bit) integer division allowed?

@DigitalTrauma I don't see why not. So yes.

Are negative numbers allowed?

@TheConstructor: from the rules: "assume that n>m>0", so no, negative numbers are not allowed.

Java 8, 485 bytes
Could reduce by another 5 bytes naming the function d instead of divide or another 16 bytes if not counting class-definition.
public class G{int l(String a){return a.length();}String s(String n,String m){while(l(n)>l(m))m=0+m;String a="";for(int c=1,i=l(n);i>0;c=c/10){c=n.charAt(--i)+c-m.charAt(i)+9;a=c%10+a;}return e(a);}String e(String a){return a.replaceAll("^0+(?=[0-9])","");}String divide(String n,String m){String q="",p=q,y;for(int b=0,i=0;b<=l(n);i--){y=n.substring(0,b);if(l(y)==l(p)&&p.compareTo(y)<=0||l(y)>l(p)){y=s(y,p);n=y+n.substring(b);q+=i;b=l(y)+1;i=10;p=m+0;}p=s(p,m);}return e(q)+","+n;}}

Can be used like this:
public static void main(String[] args) {
    G devision = new G();
    System.out.println(devision.divide("20397882081197443358640281739902897356800000000",
            "265252859812191058636308480000000"));
    System.out.println(devision.divide("31035053229546199656252032972759319953190362094566672920420940313",
            "1234567891011121314151617181920"));
    System.out.println(devision.divide(
            "271841734957981007420619769446411009306983931324177095509044302452019682761900886307931759877838550251114468516268739270368160832305944024022562873534438165159941045492295721222833276717171713647977188671055774220331117951120982666270758190446133158400369433755555593913760141099290463039666313245735358982466993720002701605636609796997120000000000000000000000000000000000000000000000000",
            "247"));
}

yielding
76899763100160,0
25138393324103249083146424239449429,62459510197626865203087816633
1100573825740813795225181252819477770473619155158611722708681386445423816849801159141424129060075102231232666057768175183676764503262931271346408394876267875141461722640873365274628650676808557279259873162169126398101692109801549256156915750794061370041981513180387019893765753438422927286098434193260562682052606153857091520795991080960000000000000000000000000000000000000000000000000,0

Ungolfed:
public class ArbitraryPrecisionDivision {

    /**
     * Length of String
     */
    int l(String a) {
        return a.length();
    }

    /**
     * substract m of n; n >= m
     */
    String s(String n, String m) {
        while (l(n) > l(m))
            m = 0 + m;
        String a = "";
        for (int c = 1, i = l(n); i > 0; c = c / 10) {
            c = n.charAt(--i) + c - m.charAt(i) + 9;
            a = c % 10 + a;
        }
        return e(a);
    }

    /**
     * trim all leading 0s
     */
    String e(String a) {
        return a.replaceAll("^0+(?=[0-9])", "");
    }

    /**
     * divide n by m returning n/m,n%m; m may not start with a 0!
     */
    String divide(String n, String m) {
        // q stores the quotient, p stores m*i, y are the b leading digits of n
        String q = "", p = q, y;
        for (int b = 0, i = 0; b <= l(n); i--) {
            y = n.substring(0, b);
            if (l(y) == l(p) && p.compareTo(y) <= 0 || l(y) > l(p)) {
                y = s(y, p);
                n = y + n.substring(b);
                q += i;
                b = l(y) + 1;
                i = 10;
                p = m + 0;
            }
            p = s(p, m);
        }
        return e(q) + "," + n;
    }

    public static void main(String[] args) {
        ArbitraryPrecisionDivision division = new ArbitraryPrecisionDivision();
        System.out.println(division.divide("20397882081197443358640281739902897356800000000",
                "265252859812191058636308480000000"));
        System.out.println(division.divide("31035053229546199656252032972759319953190362094566672920420940313",
                "1234567891011121314151617181920"));
        System.out.println(division.divide(
                "271841734957981007420619769446411009306983931324177095509044302452019682761900886307931759877838550251114468516268739270368160832305944024022562873534438165159941045492295721222833276717171713647977188671055774220331117951120982666270758190446133158400369433755555593913760141099290463039666313245735358982466993720002701605636609796997120000000000000000000000000000000000000000000000000",
                "247"));
    }
}

I sacrificed a bit of speed by not precalculating an array with m times 1 through 9 and starting with b=0 instead of b=l(m), but saved lots of bytes doing so. If you are interested in arbitrary precision addition see a previous version.
I guess this will not be the shortest solution, but maybe it gives a good start.

If you implement addition, multiplication, and subtraction for this as well, I'll make a 500 rep bounty to this. :D I love the idea of Stringy precision.

@VoteToClose will see to this tomorrow. Guess the hardest part is done.

Whats the name of the algorithm you used?

Python 2, 427 bytes
b=S=lambda l:sorted(l)[::-1]
A=lambda a,b,o=0:A(a^b,{n+1for n in[b&a,b-a][o]},o)if b else a
M=lambda a,*b:reduce(A,({n+m for n in a}for m in b))
def D(a,b):
 q=a-a
 while b<=S(a):n=max(a)-b[0];n-=S(M(b,n))>S(a);q|={n};a=A(a,M(b,n),1)
 return q,a
exec"a=b;b=[]\nfor d in raw_input():b=A(M(b,3,1),{i for i in range(4)if int(d)>>i&1})\n"*2
for n in D(a,S(b)):
 s=''
 while n:n,d=D(n,[3,1]);s=`sum(2**i for i in d)`+s
 print s or 0

Reads the input through STDIN, each number on a separate line, and prints the result to STDOUT.
Explanation
Instead of representing integers as arrays of digits, we represent each integer as the set of "on" bits in its binary representation.
That is, an integer n is represented as the set of indices of the bits that equal 1 in the binary representation of n.
For example, the number 10, 1010 in binary, is represented as the set {1, 3}.
This representation allows us to express some of the arithmetic operations rather succinctly, using Python's set operations.
To add two sets, we (recursively) take the sum of their symmetric difference, and the set of succeeding integers to their intersection (which corresponds to the collective carry, and hence eventually becomes the empty set, at which point we have the final sum.)
Similarly, to subtract two sets, we (recursively) take the difference of their symmetric difference, and the set of succeeding integers to their (set) difference (which corresponds to the collective borrow, and hence eventually becomes the empty set, at which point we have the final difference.)
The similarity of these two operations allows us to implement them as a single function (A).
Multiplication (M) is simply distributed addition: given two sets A and B, we take the sum, as described above, of all the sets {A+b | b∈B} (where A+b is the set {a+b | a∈A}).
Integer comparison becomes lexicographical comparison of the two sets, sorted in descending order.
To divide (D) two sets, A and B, we start with the empty set as the quotient, and repeatedly find the largest integer n, such that B+n is less than or equal to A (which is simply the difference between the maxima of A and B, possibly minus-1), add n as an element to the quotient, and subtract B+n from A, as described above, until A becomes less than B, i.e., until it becomes the remainder.
There is no free lunch, of course.
We pay the tax by having to convert from-, and to-, decimal.
In fact, the conversion to decimal is what takes most of the run time.
We do the conversion "the usual way", only using the above operations, instead of ordinary arithmetic.

Just out of curiosity: doesn't s=`sum(2**i for i in d)`+s utilize built-in arbitrary precision arithmetic during conversion?

@TheConstructor No. d is a single decimal digit, so i is between 0 and 3, and the whole sum is between 0 and 9.

APL (Dyalog Extended), 131 bytes
⌷∘⎕D⍤0{S←{⍵↓⍨(⊥⍨-∧/)⌽0=⍵}⋄L←<⍥≢∨=⍥≢∧{>/⍋⍵⍺}⋄⍺L⍵:0⍺⋄q a←(⍵∇⍨¯1↓⍺),¨0,⊢/⍺⋄S¨q(a{⍺L⍵:⍺⋄(⊃⌽q)+←1⋄(S(+⌿1 0⌽0 10⊤⊢)⍣≡⍺-⍵↑⍨-≢⍺)∇⍵}⍵)}⍥(⍎¨)

Try it online!
An anonymous function that takes n (dividend) on the left and m (divisor) on the right, and returns a 2-row char matrix of digits where the first row is the quotient and the second is the remainder.
This is an expansion of my "shitty" solution to ngn's CMC. It was really hard to get this right and short at the same time.
Ungolfed with comments
⍝ Post-processing: Map each digit (numeric 0-9) to respective chars
f←⌷∘⎕D⍤0{
  ⍝ Inner function, m f n → (n/m)(n%m), I/O as numeric digit vectors
  ⍝ S x → trim leading zeros of x, leaving a single zero if x is entirely 0
  S←{⍵↓⍨(⊥⍨-∧/)⌽0=⍵}
  ⍝ x L y → given two numbers as digit vectors, is x less than y?
  L←<⍥≢∨=⍥≢∧{>/⍋⍵⍺}

  ⍝ if ⍺<⍵, return quotient 0 and remainder ⍺
  ⍺L⍵:0⍺
  ⍝ get recursive result for (⍺/10) f ⍵,
  ⍝ multiply quotient by 10 (by appending 0),
  ⍝ and multiply remainder by 10 and add the last digit of ⍺ (by appending ⊢/⍺)
  q a←(⍵∇⍨¯1↓⍺),¨0,⊢/⍺
  ⍝ fix the quotient and remainder by repeatedly subtracting the remainder
  ⍝ and adding 1 to the quotient until it is right,
  ⍝ then trim leading zeros from both
  S¨q(a{
    ⍝ inner function with ⍺←remainder to fix, ⍵←divisor
    ⍝ done if ⍺ is less than ⍵
    ⍺L⍵:⍺
    ⍝ increment the last digit of q
    (⊃⌽q)+←1
    ⍝ subtract and fix negative digits by borrowing
    (S(+⌿1 0⌽0 10⊤⊢)⍣≡⍺-⍵↑⍨-≢⍺)∇⍵
  }⍵)
⍝ Pre-processing: convert the char vectors on both sides to numeric digit vectors
}⍥(⍎¨)

A fun fact: Dyalog APL has a library operator, dfns.big, designed to handle big integer arithmetic, but apparently its modulo function is buggy (returns the divisor when the remainder is zero), so it can't be used here anyway.

Mathematica, 251 bytes
r=Reverse;f=FoldPairList;s={0}~Join~#&;
p[a_,b_]:={First@#,#[[2,1,-1,2]]}/.{Longest[0..],x__}:>{x}&@Reap@f[Sow@{Length@#-1,Last@#}&@NestWhileList[r@f[{#~Mod~10,⌊#/10⌋}&[#+Subtract@@#2]&,0,r@Thread@{#,s@b}]&,Rest@#~Join~{#2},Order[#,s@b]<=0&]&,0s@b,s@a]

Explanation
Arithmetics on decimal numbers can easily be implemented by FoldPairList. For example,
times[lint_,m_]:=Reverse@FoldPairList[{#~Mod~10,⌊#/10⌋}&[m #2+#]&,0,Reverse@lint]

just mimics the process of doing multiplications by hand.
times[{1,2,3,4,5},8]
(* {9,8,7,6,0} *)

Test case
p[{1,2,3,4,5,6,7,8,9},{5,4,3,2,1}]
(* {{2,2,7,2},{3,9,4,7,7}} *)

means 123456789 / 54321=  2272...39477.

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

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


text:
Substitute numbers by their respective letter
Create a function or program that takes a number as input, and outputs a string where ASCII-code points for the lower and upper case alphabet are substituted by their character equivalents.

The upper case alphabet use the code points: 65-90
The lower case alphabet use the code points: 97-122

If any adjacent digits in the input equals the code point of a letter, then that letter shall replace the digits in the output string.
Rules:

The input will be a positive integer with between 1 and 99 digits
You can assume only valid input is given
You start substituting at the beginning of the integer (976 -> a6, not 9L)
The input can be on any suitable format (string representation is OK)
The output can be on any suitable format
Standard rules apply

Examples:
1234567
12345C

3456789
345CY

9865432
bA432

6566676869707172737475767778798081828384858687888990
ABCDEFGHIJKLMNOPQRSTUVWXYZ

6711110010100071111108102
Code000Golf

Shortest code in bytes win!

Leaderboard
The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

"The input will be a positive integer with between 1 and 99 digits" In just about any programming language I know, it'll be a string with between 1 and 99 digits, as even a 64-bit int only holds up to 19 decimal digits...

@T.J.Crowder I assume he meant integer in the mathematical sense, not the data type.

@T.J.Crowder valid point :-) Although, if I'm not mistaken, 1e99 is  technically still an integer. long int isn't enough, you need super long int.

@StewieGriffin: Hah! :-) I'm sure there's a language somewhere with such a thing.

Jolf, 18 16 bytes
Try it here! I knew that upperLower function would be useful someday! Replace ó with ΢, or just use the interpreter link. This is encoded in ISO 8859-7.
ρiLaΜGpwpuEdóH΅A
      pw           upper and lower
        pu         of the uppercase alphabet
     G    E        split by nothing (E = "")
    Μ      dóH     map each char to its numeric counterpart
  La               regex alternate array (e.g. La[1,2,3] => "1|2|3")
ρi            ΅A   replace input with the character code of the match (΅ is string lambda)

Perl, 39 38 bytes
(1 byte added for the -p flag.)
$"="|";s/@{[65..90,97..122]}/chr$&/ge

s/                           /          replace...
  @{[                      ]}           this string, treated as a regex:
     join"|",65..90,97..122             65|66|67|68|...|121|122
                                   /ge  ...with this string, eval()'d:
                                 $&     the entirety of the last match
                              chr       convert to char from ASCII code

Right Tool for the Job™.
The explanation is outdated after one small optimization (thanks dev-null!) that makes it a single byte shorter (but a bit less elegant): the $" variable represents what to join on when interpolating an arrray into a string, so setting $"="|" removes the need for join.
Demo:
llama@llama:~$ perl -pe '$"="|";s/@{[65..90,97..122]}/chr$&/ge'
1234567
12345C
3456789
345CY
9865432
bA432
6566676869707172737475767778798081828384858687888990
ABCDEFGHIJKLMNOPQRSTUVWXYZ
6711110010100071111108102
Code000Golf

I guess you can save a single byte by setting $"="|" instead of join?

eg. $"="|";s/@{[65..90,97..122]}/chr$&/ge

@dev-null That does work, thanks!

Javascript, 80 bytes
s=>s.replace(/6[5-9]|[78]\d|9[0789]|1[01]\d|12[012]/g,x=>String.fromCharCode(x))

See regex in action here: https://regex101.com/r/iX8bJ2/1

f=
s=>s.replace(/6[5-9]|[78]\d|9[0789]|1[01]\d|12[012]/g,x=>String.fromCharCode(x))

document.body.innerHTML = '
' +
    "f('1234567')\n" + f('1234567') + '\n\n' +
    "f('3456789')\n" + f('3456789') + '\n\n' +
    "f('9865432')\n" + f('9865432') + '\n\n' +
    "f('6566676869707172737475767778798081828384858687888990')\n" + f('6566676869707172737475767778798081828384858687888990') + '\n\n' +
    "f('6711110010100071111108102')\n" + f('6711110010100071111108102') +
'
'

Just for curiosity, one thing I learned here:
I can't change x=>String.fromCharCode(x) to String.fromCharCode because ...

CJam, 22 bytes
q{+'[,_el^{_is@\/*}/}*

Try it online!
Background
Simply replacing all occurrences of digit groups with the corresponding letters (in whatever order we may choose) will fail to comply with the left-to-right rule.
Instead, we can generate all prefixes of the input string, and attempt to make all possible substitutions while we're generating them. Since no code  point is contained in another code point, the order of these attempts is not important.
For example:
67466

6     -> 6
67    -> C
 C4   -> C4
 C46  -> C46
 C467 -> C4B

C4B

How it works
q                       Read all input from STDIN.
 {                  }*  Fold; push the first character, and for each subsequent
                        character, push it and do the following:
  +                       Append the character to the string on the stack.
   '[,_el^                Push the string of all ASCII letters.
                          See: http://codegolf.stackexchange.com/a/54348
          {       }/      For each ASCII letter:
           _                Push a copy of the letter.
            i               Convert to integer, i.e., compute its code point.
             s              Cast to string.
              @\            Rotate and swap.
                /           Split the modified input characters at occurrences (at
                            most one) of the string repr. of the code point.
                 *          Join, separating by the corresponding letter.

PHP, 110 102 101 68 67 bytes
Pretty hard challenge. This is the best I could come up with. This is a completely new version.
for($i=64;123>$i+=$i-90?1:7;)$t[$i]=chr($i)?><?=strtr($argv[1],$t);

Run like this:
php -r 'for($i=64;123>$i+=$i-90?1:7;)$t[$i]=chr($i)?><?=strtr($argv[1],$t);' 6711110010100071111108102;echo
> Code000Golf

Saved 8 bytes by using ctype_alpha instead of preg_match, thx to manatwork
Saved 1 byte by prepending 0 to the string instead of checking non-empty string: when the last character of the input is a 0, the substring I'm taking would be "0", which is falsy, whereas "00" is truthy, so it won't skip printing the last 0.
Saved a massive 33 bytes by using strtr after building an array with conversion pairs
Saved a byte by using short print tag

Yo will have to change the regular expression to #[A-Z]#i as the current one will happily allow “92” to be transformed in “\”. Or try ctype_alpha() instead of preg_match(). So far seems to work.

"0", which is falsy, whereas "00" is truthy Good going, PHP.

Python 3, 211 189 188 bytes
def f(c,i=0,n=""):
 while i<len(c):a=1;x=int(c[i:i+2]);a=2 if 64<x<91 or 96<x<100 else a;x=int(c[i:i+3]) if a<2 else x;a=3 if 99<x<123 else a;x=chr(x) if a>1 else c[i];n+=x;i+=a
 return n

Saved 23 bytes by replacing \n with ; thanks to Dennis

Test

If you use ; instead of line breaks, you can put the entire while loop on a single line. Also, the first line can become def f(c,i=0,n=""):.

a=1;a=2 if 64<x<91 or 96<x<100 else a -> a=1+(64<x<91or 96<x<100) etc

Vyxal, 10 9 bytes
JkBC:CV)R

Try it Online! Link includes test cases.
Port of @KevinCruijssen's 05AB1E answer.
-1 thanks to @KevinCruijssen
Explanation
JkBC:CV)R  # Implicit input
       )R  # Reduce by:
J          #  Append to the string
 kB        #  Push constant [A-Za-z]
   C       #  Convert to codepoints
    :C     #  Duplicate and convert back
      V    #  Replace codepoints with characters
           # Implicit output

rt can be R. 05AB1E lacks a reduce-by with body builtin, which is why I've used a cumulative reduce with last combination, but Vyxal doesn't have that limitation.

@KevinCruijssen thanks, updated

Pyth, 20 18 bytes
.Uu:G`CHHsrBG1+bZz

Same algorithm as @Dennis. It's a lot easier to code in Pyth on my phone than in Jelly.
                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +
       b
       Z
   z

Thanks @isaacg
Try it here.

You just can't stay off this site on your phone, can you...?

Especially when I have the luxury of coding in all printable ASCII :D

That is true, probably nice to take a break from all that jelly... You know, a balanced diet ;)

05AB1E, 12 11 bytes
Å»«žnÇDç:}θ

Try it online or verify all test cases or see a step-by-step reduction with just the first 9 bytes.
Explanation:
Å»         # Cumulative left reduce the (implicit) input-string by:
  «        #  Append the current character to the string
   žn      #  Push the builtin "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
     Ç     #  Convert it to a list of integer codepoints
      D    #  Duplicate this list
       ç   #  Convert each integer to its character again
           #  (so it's a list of the characters, instead of a string)
        :  #  Replace all integers with these characters (at the same indices)
           #  (would only replace 0 or 1 time)
}          # After the cumulative reduce-by is done:
 θ         # Pop the list, and only leave the last string
           # (after which it is output implicitly as result)

Ruby -p, 50 45 bytes
-5 bytes thanks to manatwork
gsub(/#{[*65..90,*97..122]*?|}/){$&.to_i.chr}

Attempt This Online!

You can use * instead of .join: “array * string_separator → new_string (…) When String argument string_separator is given, equivalent to array.join(string_separator)”.

@manatwork Ah, of course. Not sure how I missed that. Thanks!

Java (JDK), 164 169 bytes

-5 bytes thanks to @KevinCruijssen !

I tried without regexp, and it was surprisingly tricky to handle all the possibilities :')

I'm seven years late to the party, but nice challenge anyway!
s->{var r="";for(int i=0,j,a,m=s.length();i<m;r+=a>64&a<91|a>96&a<123?(char)(a+0*(i=j)):s.charAt(i++))for(j=i,a=0;j<m&&(a=a*10+s.charAt(j++)-48)>0&a<13;);return r;}

Try it online!

j=i+(a=0) can be j=i,a=0 for -2 bytes, and String r=""; can be var r=""; in JDK 10+ for another -3 bytes: try it online.

@KevinCruijssen Nice! I didn't know the trick about the "," :o And i wasn't fond of using Java>8 because of the computer i use, but i can't ignore your optimization ;) My answer has been updated

Python 3, 95 bytes
lambda x:re.sub("6[5-9]|[7-8]\d|90|9[7-9]|1[01]\d|12[0-2]",lambda r:chr(int(r[0])),x)
import re

Assuming we can take in strings, otherwise this would be 100 bytes.
Try it online!

Io, 228 bytes
As for these warnings... let's just ignore them.
s :=method(H,r(H slice(0,1),H slice(1)))
r :=method(H,T,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"foreach(i,H=H asMutable replaceSeq(i asString,i asCharacter))if(T=="",return H)r(list(H,T slice(0,1))join,T slice(1)))

Try it online!

PowerShell, 51 bytes
$args-replace(65..90+97..122-join'|'),{[char]+"$_"}

Try it online!
Explanation:

replace by RegExp 65|66|67|68|...|121|122
replace to result of {[char]+"$_"}:
    $_   object with matched string
   "$_"  matched string
  +"$_"  convert the string to int

[char]+"$_"  convert the int to char

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


text:
clickerhero mercenaries
Introduction
I have recently started playing clickerheroes again. In the recent patch they introduced a new mechanic to mercenaries: their lifetime. Instead of having a random chance at dying now they have a certain lifespan given by a geometric distribution of p = 0.2. They can be sent on quests to accumulate a premium currency called rubys. When they die you can revive them paying rubys.
The challenge
The amount of rewards they bring home are scaling linear with their level, while the revivecost is scaling exponentially, so at a certain level it is better to not revive a mercenary and instead hire a new one.
I wrote some code simulating this challenge but found that it was pretty long and there certainly must be a way to make it shorter.
Your job is to do that and find the level where not reviving makes the ruby return per day reach a maximum.
More information on mercenaries

The lifespan of a mercenary is given by a geometric distribution with p = 0.2 in days. Within the day the distribution is linear. Meaning that the chance to die at any given minute is the same as any other minute that day.
Doing a quest reduces the lifespan by the duration of that quest.
You can always choose from 4 quests.
The quest available are random and split in 2 parts.
The main objective is choosen from a pool of 5 where only 1 is finding rubies so the chance that it is a ruby quest is 1/5.
The other value is the duration, the possibilities are 5 min, 15 min, 30 min, 1 hour, 2 hours, 4 hours, 8 hours, 1 day and 2 days.
The reward is given by the base value 0.01112 rubies times the level times the duration/5min (eg 30 min = 6) times a durations factor, since longer quest gives diminishing returns, given in the table below.
5 min    1
15 min   0.8594
30 min   0.7785
1 hour   0.624
2 hours  0.5467
4 hours  0.4687
8 hours  0.3903
1 day    0.3125
2 days   0.25

This means we will always choose the shortest ruby quest and if there isn´t one the shortest other quest.
The cost to revive a mercenary is 10 + ceiling(1.5^level)
After reviving the quest is finished and then a new lifespan is generated
The level is going up by 1 for every day the mercenary spent questing and it starts at 1.

Input and Result
This program should require no input. In the case that your language is not able to generate values of a geometric distribution you may take random values from this list.
The result is a single number that represents at what point a mercenay should be discarded instead of revived.
The precision requirement is not a fixed value like 10%, but instead the accuracy should increase the more repetitions you run, so a perfect value should be theoretically possible given unlimited computation power.
The result of my simulation looks like this:

I used 50000 mercenarys per revive cap. Below 10000 gives spiky bits due to randomness

What do you mean by "within the day the distribution is linear'? What about precision issues?

the chance to die in the first minute of the day is 1/1440 the chance to die in the second is 1/1440 and so on. It should be precise in the sense that running more "lifes" should result in an increase in accuray.


text:
Sort these James Bond ratings
Introduction
My grandpa is a fan of James Bond, but he is always unsure on how to rank his favourite actors. As such, he is always making lists, which is a lot of work. He asked me to produce a program that will make his life easier, but I do not have time for that, I have to work! So I will count on you guys.
Challenge
The challenge is simple. The input will consist of a list, in the following format:
<number> <space> <actor's name> <newline>
Your task is to sort them based on the number at the beginning of the line, starting from the last, and ending with the first. All numbers should be removed.
However, my grandpa sometimes makes mistakes. As such, you will need to validate the data. If one of the names on the list doesn't refer to one of the actors who played Bond, you need to discard it. In case of repetitions, repeats should be removed, and the name should maintain the lowest weight it was associated with (example #3).
There is no limit to how many lines there may be.
The output only needs to be a list of some sort, whether it is an array, a comma separated string, just values separated by spaces, or something else entirely, i.e.
Pierce Brosnan, Sean Connery, David Niven
A trailing newline or space is allowed.
Example Input and Output
Input:

1 Sean Connery
2 Emma Watson
5 Timothy Dalton
4 Roger Moore
3 Daniel Craig

Output:

Timothy Dalton, Roger Moore, Daniel Craig, Sean Connery

Input:

2 Timothy Dalton
4 George Lazenby
5 George Lazenby
3 Bob Simmons

Output:

George Lazenby, Bob Simmons, Timothy Dalton

Input:

3 Sean Connery
2 Pierce Brosnan
1 Sean Connery

Output:

Pierce Brosnan, Sean Connery

As this is a code golf, shortest code (in bytes) wins!
Appendix
List of actors who played the role of Bond:

Barry Nelson
Bob Simmons
Sean Connery
Roger Moore
David Niven
George Lazenby
Timothy Dalton
Pierce Brosnan
Daniel Craig

Welcome to PPCG, and nice challenge! Note that Sean Connery appears twice on your list.

@DenhamCoote Fixed that and the mistake in the example output.

Does it matter which actor repetition we eliminate?

@FryAmTheEggman Oh, it would have to be the lowest value (2, in this case).

Can we assume all possible actors will be identified by two words (first name and last name)?

Emma Watson was great as James Bond.

@LuisMendo Yes, you can assume so.

What characters will appear in the names? Only letters?

hmm my answer is echo Sean Connery because everyone knows, there is only one bond

You forgot Peter Sellers.  Possibly Woody Allen.  I think there were a few others too.  (Hey, if you're going to count David Niven, you have to count the others in that movie.)

@DarrelHoffman Too late now, but true.

@MartinBüttner Only letters and a space (all names are 2 words separated by a space)

Pyth, 136 132 bytes
_{mtcd\ f}stcTdc"BarryNelson BobSimmons SeanConnery RogerMoore DavidNiven GeorgeLazenby TimothyDalton PierceBrosnan DanielCraig"dS.z

Try it here!
Explanation

_{mtcd\ f}stcTdc"BarryNelson BobSimmons ..."dS.z   # .z=list of all input lines
                                             S.z   # Sort input ascending
        f                                          # filter sorted lines with T being the current line
            cTd                                    # Split a line on spaces
          st                                       # Dicard the number and join first and last name
               c"BarryNelson BobSimmons ..."d      # Split the bond actor list on spaces...
         }                                         # only keep the lines which are in the actor list
   mtcd\                                           # remove the number from the filtered lines
_{                                                 # Remove duplicates from the mapping result and reverse the result

Small flaw, the ordering is the wrong way around (it's supposed to go from last to first, while yours is first to last).

@MKII Guess I overread that part...Fixed it!

Retina, 201 197 191

\d+
$0$*1
G`^1+ (Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$
+`\b((1+)\D*)¶(\2.+)
$3¶$1
+s`1+(\D+)¶(.*\1)
$2
1+

Try it online!
6 bytes saved thanks to Martin!
Whee, bubble sort with regex. Note that ten bytes are spent doing decimal to unary conversion at the beginning, if unary input is OK then that isn't needed. Also, if numbers can't be in people's names, then a couple more bytes can be saved by moving the line that removes non-Bond actors to the end and removing the 1+ (untested with \D version).
Explanation:
A Retina program is made up of several stages, so I will explain each stage separately.
Stage 1:
\d+
$0$*1

Replaces the numbers in the input with unary. This uses Retina's special replacement token: $* which repeats the character after a number of times equal to the preceding token's base 10 value.
Stage 2:
G`^1+ (Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$

The stuff before a ` in a stage changes the mode being used. This turns on grep mode, which means that each line that doesn't match the regex is discarded. The anchors are necessary to prevent near matches from slipping by.
Stage 3:
+`\b((1+)\D*)¶(\2.+)
$3¶$1

This is the sorting stage. The + in the mode signifies that this stage should be repeated until the replacement makes no change when applied (i.e. we reach a fixed point). The regex finds a word boundry, followed by some number of 1s and then all the rest of the line up to the newline. Then, if the next line has more 1s than it, the regex will match and we swap the lines.
Stage 4:
+s`1+(\D+)¶(.*\1)
$2

This stage uses the + mode again, but also uses s to make the . meta-character also match newlines. This removes duplicate lines, by matching for exact duplicates after the 1s and capturing the stuff after the first duplicate to replace the whole match with it. This will work without needing to consider the order of tie breaking, because the names are already sorted appropriately, with the larger numbers above, therefore we will always keep the smaller values.
Stage 5:

1+

Really simple one here, everything is in order, except we have a bunch of 1s in front of our Bonds, so we replace them and the space after them with nothing.

...Damn, this language impresses me more and more every day. Well done, Martin!

TSQL 426 bytes (includind data + input)
Golfed solution:
create table A(Name varchar(99))insert into A values('Barry Nelson'),('Bob Simmons'),('Sean Connery'),('Roger Moore'),('David Niven'),('George Lazenby'),('Timothy Dalton'),('Pierce Brosnan'),('Daniel Craig')declare @I as table (R int, N varchar(99))insert into @I values(3,'Sean Connery'),(2,'Pierce Brosnan'),(1,'Sean Connery')select N from(select N,min(R) R from @I where N in (select N from A) group by N) x order by R desc

Try it here
SQL excels (no pun intended) in this kind of task: relating sets, ordering, cutting off duplicates etc.
All you need is to create and populate a table of Actors like this:
create table Actor (Name varchar(99))
insert into Actor values
 ('Barry Nelson')
,('Bob Simmons')
,('Sean Connery')
,('Roger Moore')
,('David Niven')
,('George Lazenby')
,('Timothy Dalton')
,('Pierce Brosnan')
,('Daniel Craig')

Now if we use a table-variable as input we just need to get the intersection of both sets. Removing duplicates and ordering in SQL are really easy.
Example 1:
declare @Input as table (Rnk int, Name varchar(99))
insert into @Input values
 (1,'Sean Connery')
,(2,'Emma Watson')
,(5,'Timothy Dalton')
,(4,'Roger Moore')
,(3,'Daniel Craig')

select Name
from
(
    select Name, min(Rnk) as R
    from @Input
    where Name in (select Name from Actor)
    group by Name
) x
order by R desc

Example 2:
declare @Input as table (Rnk int, Name varchar(99))
insert into @Input values
 (2,'Timothy Dalton')
,(4,'George Lazenby')
,(5,'George Lazenby')
,(3,'Bob Simmons')

select Name
from
(
    select Name, min(Rnk) as R
    from @Input
    where Name in (select Name from Actor)
    group by Name
) x
order by R desc

The golfed version is just the full thing for example input 3
As a plus this SQL can work for older DBMS versions (even be rewrite to ANSI SQL) and run without problem in older computers than most languages.

Does it work with any number at the beginning of the line, or only single digits?

@MKII I used INT type so it ill accept anything in the range –2,147,483,648 to 2,147,483,647 also it ill accept that number of rows too =)

You don't need a subselect. You can just use order by min(R) desc with the inner select and remove the min(R) from the select. That should save 21 bytes.

Also there are some unnecessary spaces in the golfed version.

Using char instead of varchar will save another 6 bytes.

@raznagul Yeah i can save a few bytes removing some white space but I'm just answered the question for the fun. For sure you can use a fancier language to achieve less bytes. Changing varchar to char for sure can save a few more bytes but I don't few that correct because varchar is the correct type for the set of variable length strings. Corretcness trumps anything! Finally no I cannot avoid the subselect because OP don't stated I can fetch the the actor's RANK and that can be a loophole. If OP can agree with a result set like Pierce Brosnan,2;Sean Connery,1 so it's OK

Perl, 242 179 217 bytes
print reverse grep{/^(Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$/&&!$s{$_}++}map{s/\d+ //;$_}sort{($a=~/(\d+)/)[0]<=>($b=~/(\d+)/)[0]}<>;

Nicer formatted version, with comments:
print
     # reverse ranking order
     reverse
     # filter entries...
     grep {
         # only actual bonds
         /^(Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$/
         # only new bonds
         && !$s{$_}++
     } map {s/\d+ //;$_}         # remove leading digits+space
     # sort according to embedded numbers
     sort {($a=~/(\d+)/)[0] <=> ($b=~/(\d+)/)[0]}
     <>;                        # slurp input as list (list context)

Most of the size is the list of Bonds; I can't find a nice way of compressing that regex without allowing false positives.

Welcome to Programming Puzzles and Code Golf. Brilliant answer, +1. I was going to suggest that you add an explanation, but then I saw the edit. Maybe it's possible to compress the list of actors somehow...

@wizzwizz4 I tried a few things to make that regex smaller, but the decoding always seems to cost more than you save---it's too sparse in what it accepts.

Sadly, it needs to work with numbers, not only single digits. I am sorry, but I used the wrong term in the question.

@MKII aww, that costs me 38 bytes :(

If there's an eval in Perl, and a built-in compression system...

@wizzwizz4 what do you mean by a built-in compression system? I can't find a "generic" compression approach which doesn't increase the size of the bondlist.

What about Base 95? (I forgot that Perl wasn't a golfing language :-/) But maybe Base 95 could compress it. Or a lower base, if possible.

Replase reverse by descending sort: sort {($b=~/(\d+)/)[0]-($a=~/(\d+)/)[0]}

Python 2, 250 bytes:
lambda I:zip(*sorted({k:v for v,k in[x.split(' ',1)for x in I.split('\n')]if k in'Barry Nelson,Bob Simmons,Sean Connery,Roger Moore,David Niven,George Lazenby,Timothy Dalton,Pierce Brosnan,Daniel Craig'.split(',')}.items(),key=lambda t:-int(t[1])))[0]

Demo:
>>> L = ["Barry Nelson",
...     "Bob Simmons",
...     "Sean Connery",
...     "Roger Moore",
...     "David Niven",
...     "George Lazenby",
...     "Timothy Dalton",
...     "Pierce Brosnan",
...     "Daniel Craig"]

>>> I="""2 Timothy Dalton
... 4 George Lazenby
... 5 George Lazenby
... 3 Bob Simmons"""
>>> F(I,L)
('George Lazenby', 'Bob Simmons', 'Timothy Dalton')

>>> I = """1 Sean Connery
... 2 Emma Watson
... 5 Timothy Dalton
... 4 Roger Moore
... 3 Daniel Craig"""
>>>
>>> F(I,L)
('Timothy Dalton', 'Roger Moore', 'Daniel Craig', 'Sean Connery')

Let us continue this discussion in chat.

I just used dictionary comprehension in order to preserve the unique names, instead of set comprehension.

I'd pay to see Emma Watson as James Bond.

Does it work with any number at the beginning of the line, or only single digits?

PowerShell v3+, 227 219 bytes
$a=$args-split"`n"|sort|%{$c,$b=-split$_;$b-join' '}|?{$_-in('Barry Nelson,Bob Simmons,Sean Connery,Roger Moore,David Niven,George Lazenby,Timothy Dalton,Pierce Brosnan,Daniel Craig'-split',')}|select -u
$a[$a.count..0]

121 bytes of that is just the list of actors ...
Takes input $args and -splits it on newlines with `n. Pipe that to sort, which will sort the entries numerically ascending, which is OK for now. We pipe those to a foreach loop |%{...}, each iteration take the entry, -split it on spaces, then -join the second half back together with a space (i.e., stripping the numbers off the beginning). Those (ascending) sorted names are now left on the pipeline. We pipe those through a where with ? that ensures they're -in the approved list of actors. Finally, we select only the -unique entries, which for duplicates will select the first one it encounters (i.e., the lowest-weighted one) and discard the rest. We store the resultant array of names into $a.
So, now we've got a sorted ascending list of actors. Since the challenge requires descending, we do an in-place reversal operation on $a by indexing from $a.count down to 0.
Example
PS C:\Tools\Scripts\golfing> .\sort-these-james-bond-ratings.ps1 "1 Sean Connery`n2 Emma Watson`n5 Daniel Craig`n4 Roger Moore`n3 Daniel Craig"
Roger Moore
Daniel Craig
Sean Connery

Edit -- don't need to use [array]::Reverse() when indexing will do

Can you not just use sort -Des rather than the array reversal? Granted, this could be broken in later versions of PowerShell, but I don't think it likely or a real issue ;)

@VisualMelon I had considered that, but then the select -u would grab and retain the highest-valued ordering, rather than the lowest, so for my example the positions of Daniel Craig and Roger Moore would swap. My attempts to fix that resulted in longer code than the array reversal.

ah, yes, that makes sense, I wasn't able to run it and missed that completely - it's a shame there is so much waste just for that reversal...

Python 309 286 bytes
import sys
i='Barry Nelson.Bob Simmons.Sean Connery.Roger Moore.David Niven.George Lazenby.Timothy Dalton.Pierce Brosnan.Daniel Craig'.split('.')
print ', '.join(i.pop(i.index(x)) for x in zip(*sorted((x.strip().split(' ',1) for x in sys.stdin),None,lambda x:int(x[0]),1))[1] if x in i)

Does it work with any number at the beginning of the line, or only single digits?

it didn't, it does now though :)

Looks like you can get rid of some extra spaces in here, for example after print or after a ) or ]

JavaScript (ES6), 232 bytes
s=>s.split`
`.sort((a,b)=>(p=parseInt)(a)
l.replace(/\d+ /,"")).filter(l=>!p[l]&/^(Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$/.test(p[l]=l))

Explanation

var solution =

s=>
  s.split`
`
  .sort((a,b)=>                 // sort the list by the number
    (p=parseInt)(a)
l.replace(/\d+ /,"")) // remove the number at the beginning of each line
  .filter(l=>
    !p[l]&                      // remove duplicates

    // Bond actor regex
    /^(Barry Nelson|Bob Simmons|Sean Connery|Roger Moore|David Niven|George Lazenby|Timothy Dalton|Pierce Brosnan|Daniel Craig)$/

    .test(p[l]=l)               // test for bondness and add the line to p
  )
<textarea id="input" rows="6" cols="40">1 Sean Connery
2 Emma Watson
5 Timothy Dalton
4 Roger Moore
3 Daniel Craig</textarea>

<button onclick="result.textContent=solution(input.value)">Go</button>


text:
Congruence Relations
Given 3 positive integers a, b, and n (whose maximum values are the maximum representable integer value in your language), output a truthy value if a ≡ b (mod n), and falsey otherwise. For those unfamiliar with congruency relations, a ≡ b (mod n) is true iff a mod n = b mod n (or, equivalently, (a - b) mod n = 0).
Restrictions

Built-in congruence testing methods are forbidden
Built-in modulo operations are forbidden (this includes operations such as Python's divmod function, which return both the quotient and the remainder, as well as divisibility functions, residue system functions, and the like)

Test Cases
(1, 2, 3) -> False
(2, 4, 2) -> True
(3, 9, 10) -> False
(25, 45, 20) -> True
(4, 5, 1) -> True
(83, 73, 59) -> False
(70, 79, 29) -> False
(16, 44, 86) -> False
(28, 78, 5) -> True
(73, 31, 14) -> True
(9, 9, 88) -> True
(20, 7, 82) -> False

This is code-golf, so shortest code (in bytes) wins, with earliest submission as a tiebreaker.

How about divisibility functions?

@CᴏɴᴏʀO'Bʀɪᴇɴ Those work by testing remainders, so they are also forbidden. I'll clarify.

How about Python 2's integer floor division /?

Floating point division?

Base conversion?

Anything else that is not forbidden is allowed.

Can input be an array [a b] and a number n ?

@LuisMendo Sure, the input format isn't strict. Just as long as you get the 3 integers somehow, you're good.

@Mego I'm still not clear - If you allow regular division (float or integer) or base conversion, this becomes trivial.  Are those allowed?

I bet this challenge would be easy in a language where MAXINT is 1.

@Paul Boolfuck would qualify :)

Jelly, 5 bytes
_ÆD⁵e

Making heavy use of Anything else that is not forbidden is allowed.
Try it online!
How it works
_ÆD⁵e  Main link. Left input: a. Right input: b. Additional input: n

_      Subtract b from a.
 ÆD    Compute all divisors of the difference.
   ⁵e  Test if n is among the divisors.

Python 2, 27 bytes
lambda a,b,n:(a-b)/n*n==a-b

Checks if a-b is a multiple of n by dividing by n, which automatically floors, and seeing if multiplying back by n gives the same result.

Julia, 24 bytes
f(a,b,n,t=a-b)=t÷n==t/n

This is a function that accepts three integers and returns a boolean.
We simply test whether a - b integer divded by n is equal to a - b float divided by n. This will be true when there is no remainder from division, i.e. a - b | n, which implies that a - b (mod n) = 0.

Pyth, 7 bytes
!@UQ-FE

Uses Pyth's cyclic indexing.
  UQ         range(first line). [0,...,Q-1]
    -FE      Fold subtraction over the second line.
 @           Cyclic index UQ at -FE
!            Logical NOT

Minkolang 0.15, 14 11 bytes
nn-n$d:*=N.

Try it here! Input is expected as a b n.
Explanation:
n              Take number from input -> a
 n             Take number from input -> a, b
  -            Subtract               -> a-b
   n           Take number from input -> a-b, n
    $d         Duplicate stack        -> a-b, n, a-b, n
      :        Integer division       -> a-b, n, (a-b)//n
       *       Multiply               -> a-b, (a-b)//n*n
        =      1 if equal, 0 otherwise
         N.    Output as number and stop.

Haskell, 23 bytes
(a#b)n=div(a-b)n*n==a-b

Usage example: (28#78)5 ->  True.
Same method as in @xnor's answer.

MATL, 9 bytes
Sdt:i*0hm

Input format is
[a b]
n

Try it online!
S     % implicitly input [a, b]. Sort this array
d     % compute difference. Gives abs(a-b)
t:    % duplicate and generate vector [1,2,...,abs(a-b)]; or [] if a==b
i*    % input n and multiply to obtain [n,2*n,...,abs(a-b)*n]; or []
0h    % concatenate element 0
m     % ismember function. Implicitly display

Retina, 20
^(1+) \1*(1*) \1*\2$

Input is given in unary, space-separated, in order n a b.  Output 1 for truthy and 0 for falsey.
Try it online.

If you prefer decimal input then you can do this:
\d+
$&$*1
^(1+) \1*(1*) \1*\2$

Try it online.

APL, 15 bytes
{(⌊d)=d←⍺÷⍨-/⍵}

This is a dyadic function that accepts n on the left and a and b as an array on the right.
The approach here is basically the same as in my Julia answer. We test whether a - b / n is equal to the floor of itself, which will be true when a - b (mod n) = 0.

Save a four: d=⌊d←⎕÷⍨-/⎕

JavaScript (ES6), 27 bytes
@CᴏɴᴏʀO'Bʀɪᴇɴ posted a version which does not work; here is the "common algorithm" that people are using in a form which "works":
(a,b,n)=>n*(0|(a-b)/n)==a-b

The word "works" is in scare quotes because the shortcut we're using for Math.floor() implicitly truncates a number to be in the signed 32-bit range, so this cannot handle the full 52-bit-or-whatever space of integers that JavaScript can describe.

If this answer cannot handle all representable positive integers in the language, it is not valid.

@Mego: Given that some languages will be using 32-bit integers, I think that restriction is onerously arbitrary unless you further specify either the bit-width of the integers or else that the language must have bignums.

It's not at all arbitrary. The challenge clearly states that the inputs may be any 3 positive integers, up to the maximum representable integer value in the chosen language. If the submission might fail for a set of inputs in that range, it's not valid. Relevant meta post.

@Mego: Let me ask you point-blank: Are you going to object to the Haskell solution on the same criterion? (The Haskell solution is polymorphic because it does not have a signature and is not written in a way which invokes the Dreaded Monomorphism Restriction. For normal signed types it works perfectly well across the whole range; however there exists a set of inputs that you can put in -- a test set is (2, 150, 3) :: (Word8, Word8, Word8); the criterion you specify is explicitly "if theoretically an input exists that makes the answer invalid, the answer should be deemed invalid.")

I am not familiar with Haskell or its type system, so very few of those words meant anything to me.

@Mego: If you're wondering why I'm making a big deal out of this, the JavaScript number type contains noncontinuous integers around the 2^52-ish fringes, so that it becomes very possible that (a  - b) == a for certain values of a. An answer which has to be valid off in those borderlands is nearly impossible even if I take the byte penalty and replace (0|...) with Math.floor(...).

@Mego: You don't need to know Haskell. You just need to know the word "polymorphic" (accepting many types) and to understand that there exist numbers which nobody would have ever provided as realistic inputs to the function (in this case, numbers with the type of unsigned bytes) which cannot be subtracted without causing a numeric overflow that generates incorrectness. Your reading of an apparently-unrelated meta-post in strict "rules lawyer" mode would say that they need to accept a byte penalty to restrict the types that their function can be used in. Is that your intention?

CJam, 7 bytes
l~-\,=!

Input order is n a b.
Test it here.
Explanation
l~  e# Read input and evaluate to push n, a and b onto the stack.
-   e# Subtract b from a.
\,  e# Swap with n and turn into range [0 1 ... n-1].
=   e# Get (a-b)th element from that range, which uses cyclic indexing. This is
    e# equivalent to modulo, and as opposed to the built-in % it also works correctly
    e# for negative (a-b).
!   e# Negate, because a 0 result from the previous computation means they are congruent.

Python 3, 27 bytes
lambda a,b,n:pow(a-b,1,n)<1

pow(x,y,n) calculates (x**y)%n, so this is just (a-b)**1%n.

ES6, 28 bytes
(a,b,n)=>!/\./.test((a-b)/n)

Works by looking for a decimal point in (a-b)/n which I'm hoping is allowed.

Seriously, 10 bytes
,,,-A│\)/=

Takes input as N\nA\nB\n (capital letters used to distinguish from newlines).
Try it online
This uses the same method as @AlexA's answer
Explanation (capital letters used as variable names for explanatory purposes):
,,,-A│\)/=
,,,         push N, A, B
   -A       push C = abs(A-B)
     │      duplicate entire stack (result is [N, C, N, C])
      \)/=  1 if C//N == C/N (floored division equals float division)

F#, 24 bytes
fun a b n->(a-b)/n*n=a-b

Implements the same check as @xnor's answer.


text:
Parse nested digit-lead strings
The task
A string S is constructed with the following process:

Start with S being the empty string.
Insert at some position of S a string of the form ds, where d is a nonzero digit and s is a string of d lowercase ASCII letters. We say ds is a constituent of S.
Go to step 2 or stop.

Your task is to take such a string as input, and output its constituents concatenated into a single string, in the order of appearance of their leading digits.
The output must be a single string, and there can't be any delimiters (including newlines) between the constituents.
You can choose whether the input and output strings have quotes.
Note that the input and output will never be empty.
Example
Let's construct a string with the above process.
The structure of the constituents is highlighted in the final result.
S = ""              // Insert "3abc"
S = "3abc"          // Insert "2gh" after 'a'
S = "3a2ghbc"       // Insert "1x" before '3'
S = "1x3a2ghbc"     // Insert "3tty" after '3'
S = "1x33ttya2ghbc" // Final result
     └┘│└┴┴┘│└┴┘││
       └────┴───┴┘

The output is obtained by concatenating the constituents in the order of their digits.
In this case, the correct output is
"1x3abc3tty2gh"

Rules and scoring
You can write a full program or a function.
the lowest byte count wins, and standard loopholes are disallowed.
Test cases
1k -> 1k
4asdf -> 4asdf
111xyz -> 1z1y1x
8whatever3yes -> 8whatever3yes
8what3yesever -> 8whatever3yes
1x33ttya2ghbc -> 1x3abc3tty2gh
63252supernestedstrings2ok -> 6trings3eds2st5perne2su2ok
9long3yes4lo2ngwords11here -> 9longrdsre3yes4lowo2ng1e1h
9abc8de7fg6hi5jk4lm3o2pq1rstuvwxyzabcdefghijklmnopqrst -> 9abcopqrst8deijklmn7fgdefgh6hizabc5jkwxy4lmuv3ost2pq1r

JavaScript (ES6), 68 bytes
f=s=>s&&f(s.replace(/\d\D+$/,m=>(s=m.slice(0,i=++m[0]),m.slice(i))))+s

Explanation
Based on a simple concept:

Match the last digit n followed by n letters in the input string
Remove it from the input string and add it to the start of the output string
Repeat until the input string is empty

Recursion was the shortest way to do this in JavaScript.

f=s=>
  s&&                        // if the input string is empty, return the empty string
  f(                         // prepend the constituent before it
    s.replace(/\d\D+$/,m=>(  // match the last digit followed by every remaining letter
      s=m.slice(0,n=++m[0]), // set s to the constituent (n followed by n letters)
                             // (we must use s because it is our only local variable)
      m.slice(n)             // replace the match with only the letters after it
    ))
  )+s                        // append the constituent
<input type="text" id="input" value="9long3yes4lo2ngwords11here" />
<button onclick="result.textContent=f(input.value)">Go</button>

Haskell, 89 bytes
fst.p
p(d:s)|(h,(g,r))<-p<$>span('9'<)s,(a,b)<-splitAt(read[d])$h++r=(d:a++g,b)
p e=(e,e)

Try it online! Example usage: fst.p $ "1x33ttya2ghbc" yields "1x3abc3tty2gh".

Python 3, 173 159 bytes
k='123456789';y='';i=0
for t in x:
 i+=1
 if t in k:
  y+=t;n=int(t);m=0
  for z in x[i:]:
   if n:
    if z in k:m+=int(z)+1
    if m<1:y+=z;n-=1
    m-=m>0

Try it online!
Probably not the golfiest Python implementation.
The logic is almost straightforward:
it scans the string.
When it finds a digit it starts adding the characters that follow, as many as required (i.e. until the count corresponds to the digit). If it encounters digits before completing the task, it adds them to a counter corresponding to the number of characters to skip. When the counter reaches zero, it goes back to adding characters (i.e. until the count corresponds to the initial digit).
Note: Saved 14 bytes thanks to Wheat Wizard and HyperNeutrino

For one line if statements you don't need a linefeed for example if z in k:m+=N(z)+1.

Removing the N=int actually saves you 2 bytes. Renaming int is only beneficial after 4 uses.

Java 8, 152 bytes
s->{String t=s,r="";for(char c;!s.isEmpty();c=t.charAt(0),s=s.replace(t=c+(t.substring(1,c-47)),""),r=t+r)t=s.replaceAll(".*(\\d\\D+$)","$1");return r;}

Explanation:
Try it here.
s->{                        // Method with String as both parameter and return-type
  String t=s,               //  Temp-String, starting at the input-String
         r="";              //  Result-String, starting empty
  for(char c;!s.isEmpty();  //  Loop as long as the input-String `s` is not empty
                            //    After every iteration:
      c=t.charAt(0),        //     Get the leading digit from `t` as character
      s=s.replace(t=c+(t.substring(1,c-47))
                            //     Set `t` to the last substring (digit + `c` letters),
                  ,""),     //     and remove that sub-string from String `s`
      r=t+r)                //     And add the substring at the start of result-String `r`
    t=s.replaceAll(".*(\\d\\D+$)","$1");
                            //   Get the last digit + everything after it,
                            //   and set this substring to `t`
                            //  End of loop (implicit / single-line body)
  return r;                 //  Return result-String
}                           // End of method

Python 2, 151 147 135 bytes
d,D=[],[]
for c in input():
 if'/'<c<':':x=[[c]];d=x+d;D+=x
 else:y=d[0];y+=c;d=d[len(y)>int(y[0]):]
print''.join(''.join(w)for w in D)

Try it online!
Explanation:
The code keeps two lists of constituent groups, d and D.
Each character of the string is then scanned:

If it is a digit, a new group is added to both lists
Otherwise, the character is added to the latest group in d

When a group has the same length as its digit, the group is removed from d.
At the end, the D is concatenated, as the groups in D are in the original order.
Example:
Input = '1121xwyzv'
d = [], D = []
Loop each character in the input

c='1'
    d=[[1]], D=[[1]]
c='1'
    d=[[1], [1]], D=[[1], [1]]
c='2'
    d=[[2], [1], [1]], D=[[1], [1], [2]]
c='1'
    d=[[1], [2], [1], [1]], D=[[1], [1], [2], [1]]
c='x'
    d=[[1x], [2], [1], [1]], D=[[1], [1], [2], [1x]]
latest group in d is full:
    d=[[2], [1], [1]], D=[[1], [1], [2], [1x]]
c='w'
    d=[[2w], [1], [1]], D=[[1], [1], [2w], [1x]]
c='y'
    d=[[2wy], [1], [1]], D=[[1], [1], [2wy], [1x]]
latest group in d is full:
    d=[[1]], D=[[1], [1], [2wy], [1x]]
c='z'
    d=[[1z], [1]], D=[[1], [1z], [2wy], [1x]]
latest group in d is full:
    d=[[1]], D=[[1], [1z], [2wy], [1x]]
c='v'
    d=[[1v]], D=[[1v], [1z], [2wy], [1x]]
latest group in d is full:
    d=[], D=[[1v], [1z], [2wy], [1x]]
print D in order:
    '1v1z2wy1x'


text:
Bijective mapping from integers to a variable number of bits
A variable number of bits is an array of 0 or more bits. So [0, 1] is a variable number of bits, but so is [].
Write a function or program that, given an nonnegative integer returns a variable number of bits such that every integer has a one-to-one (bijective) mapping with an array.
There are an infinite amount of such mappings, you are free to construct one as you please, but it must be one-to-one. Your mapping must conceptually be one-to-one for an arbitrarily sized integer, but it's OK if your implementation fails for large integers due to numerical limits of types in your preferred language (e.g. C's int).
As an example of what is not a one-to-one mapping, is simply listing the binary digits of the integer. In such a system 5 becomes [1, 0, 1] (or 0b101), but it's not one-to-one, because 0b0101 or [0, 1, 0, 1] also means 5.
It should be fairly obvious that a mapping is not one-to-one if it skips an integer (e.g. it doesn't work for 5), but I'd like to make it clear that skipping a variable bit array is also not one-to-one. You must map to every possible variable bit array, including [].

Shortest code in bytes wins.

May we return a string of 0's and 1's?

@xnor Yes, a string of 0s and 1s is fine.

Jelly, 3 bytes
‘BḊ

Same idea as xnor: maps 0 1 2 3 4 ... to [] [0] [1] [0 0] [0 1] ...; the code is basically increment → binary → remove first.
Try it out online.

Python, 20 bytes
lambda n:bin(~n)[4:]

Test:
>> [bin(~n)[4:] for n in range(16)]
['', '0', '1', '00', '01', '10', '11', '000', '001', '010', '011', '100', '101', '110', '111', '0000']

Doing lambda n:bin(n+1)[3:] increments the input, then takes the binary representation with the first symbol removed ([3:] because the prefix 0b is two chars chars). Since any positive number starts with 1 in binary, this uniquely gives a binary representation.
A byte is saved by instead using the bit complement ~n to get the negation -(n+1), and removing the negative sign by chopping off one more symbol.

Inverse: lambda s:int('1'+s,2)-1.

Pyth, 5 bytes
t.BhQ

Simply a translation of xnor's answer into Pyth.
Q is eval()'d input(), h increments it, .B converts it to a binary string, and t takes the "tail" (which is everything except the first character).

Haskell, 41 38 30 29 bytes
l="":[b:x|x<-l,b<-"01"]
(l!!)

Usage example: (l!!) 4 -> "10".
Starting with the empty list as the first element, walk lazily through the list and append the current element with 0 and with 1 in front of it.
Edit: @xnor saved 3 11 bytes. Thanks!

Interesting idea. The iterated function can be written [(0:),(1:)]<*>

@xnor: Oh, you showed me the <*> trick before, but I forgot about it. Thanks again!

Ooh, you can define the whole list lazily: l=[]:[b:x|x<-l,b<-[0,1]];(l!!).

@xnor: Great! Thanks a lot! Oh, switching to strings saves one more byte.

I feel like there should be some shorter way to express [b:x|x<-l,b<-"01"] with a product or concat-map, but the product expression (:)<$>[0,1]<*>l goes in the wrong order, first prepending 0 to everything, never getting to 1 because the list is infinite. Do you have any ideas?

@xnor: this is a far as I can get: l="":(flip(:)<$>l<*>"01"). 2 bytes longer.

JavaScript (ES6), 29 bytes
x=>(~x).toString(2).slice(2)

Same idea as xnor.

f=x=>(~x).toString(2).slice(2);
[...Array(100)].map((v,x)=>A.textContent+=x + ': ' + f(x) + '\n')

This is readily extended to other bases as per http://codegolf.stackexchange.com/q/78990

Jolf, 4 bytes
Try it here!
wBhj
  hj  input + 1
 B    converted to binary
w     with first removed.

Very simple strategy, also happens to be the shortest.

Haskell, 35 bytes
h 1=[]
h n=mod n 2:h(div n 2)
h.(+1)

Haskell doesn't have a binary built-in, so the (reversed) conversion is done manually. To remove the initial 1, the base case has 1 transform to the empty list.
Edit: Saved a byte by conjugating by the +1 instead.
h 0=[]
h m=1-mod m 2:h(div(m+1)2-1)

C, 40 bytes
f(n){if(++n/2)putchar(n%2+48),f(n/2-1);}

Converts the input to bijective base 2 (with symbols 0 and 1), like the other answers.
ideone it!


text:
Strict partitions of a positive integer
OEIS A000009 counts the number of strict partitions of the integers. A strict partition of a nonnegative integer n is a set of positive integers (so no repetition is allowed, and order does not matter) that sum to n.
For example, 5 has three strict partitions: 5, 4,1, and 3,2.
10 has ten partitions:
10
9,1
8,2
7,3
6,4
7,2,1
6,3,1
5,4,1
5,3,2
4,3,2,1

Challenge
Given a nonnegative integer n<1000, output the number of strict partitions it has.
Test cases:
0 -> 1

42 -> 1426

Here is a list of the strict partition numbers from 0 to 55, from OEIS:
[1,1,1,2,2,3,4,5,6,8,10,12,15,18,22,27,32,38,46,54,64,76,89,104,122,142,165,192,222,256,296,340,390,448,512,585,668,760,864,982,1113,1260,1426,1610,1816,2048,2304,2590,2910,3264,3658,4097,4582,5120,5718,6378]

This is code-golf, so the shortest solution in bytes wins.

Pyth, 7 bytes
l{I#./Q

Try it online. Test suite.

Take the input (Q).
Find its partitions (./).
Filter it (#) on uniquify ({) not changing (I) the partition. This removes partitions with duplicates.
Find the result's length (l).

Python 2, 49 bytes
f=lambda n,k=1:n/k and f(n-k,k+1)+f(n,k+1)or n==0

The recursion branches at every potential summand k from 1 to n to decide whether it should be included. Each included summand is subtracted from the desired sum n, and at the end, if n=0 remains, that path is counted.

Mathematica, 11 bytes
PartitionsQ

Test case
PartitionsQ@Range[10]
(* {1,1,2,2,3,4,5,6,8,10} *)

Haskell, 39 bytes
f n=sum[1|x<-mapM(:[0])[1..n],sum x==n]

The function (:[0]) converts a number k to the list [k,0]. So,
mapM(:[0])[1..n]

computes the Cartesian product of [1,0],[2,0],...,[n,0], which gives all subsets of [1..n] with 0's standing for omitted elements. The strict partitions of n correspond to such lists with sum n. Such elements are counted by a list comprehension, which is shorter than length.filter.

Brilliant! I was looking for a replacement for subsequences (+ import) in my answer myself, but didn't succeed so far.

Python, 68 bytes
p=lambda n,d=0:sum(p(n-k,n-2*k+1)for k in range(1,n-d+1))if n else 1

Just call the anonymous function passing the nonnegative integer n as argument... and wait the end of the universe.

make it n>0, you save a byte and go faster (i believe you recurse on negative numbers) :P

Also, Memoizing this kind of speeds it up

Cant you change your if statement to: return sum(...)if n else 1

@randomra Of course, of course...

ES6, 64 bytes
f=(n,k=0)=>[...Array(n)].reduce((t,_,i)=>n-i>i&i>k?t+f(n-i,i):t,1)

Works by recursive trial subtraction. k is the number that was last subtracted, and the next number to be subtracted must be larger (but not so large that an even larger number cannot be subtracted). 1 is added because you can always subtract n itself. (Also since this is recursive I have to take care that all of my variables are local.)

05AB1E, 5 bytes
LæOQO

Try it online!
Note: this is extremely slow and will timeout for inputs greater than about 20.
Explanation:
L         # range 1..input
 æ        # list of subsets
  O       # sum each subset
   Q      # equal? (1 for each sum that equals the input, 0 otherwise)
    O     # sum the booleans

Haskell, 58 bytes
import Data.List
h x=sum[1|i<-subsequences[1..x],sum i==x]

Usage example: map h [0..10] -> [1,1,1,2,2,3,4,5,6,8,10].
It's a simple brute-force approach. Check the sums of all subsequences of 1..x. This works for x == 0, too, because all subsequences of [1..0] are [[]] and the sum of [] is 0.

Haskell, 43 bytes
0%0=1
_%0=0
n%k=n%(k-1)+(n-k)%(k-1)
f n=n%n

The binary function n%k counts the number of strict partitions of n into parts with a maximum part k, so the desired function is f n=n%n. Each value k can be included, which decreases n by k, or excluded, and either way the new maximum k is one lower, giving the recursion n%k=n%(k-1)+(n-k)%(k-1).

n%k|q<-k-1=n%q+(n-k)%q shaves a byte off of line 3.

Vyxal l, 24 bitsv2, 3 bytes
Ṅ'Þu

Try it Online!
Vyxal forever

Julia, 53 bytes
n->endof(collect(filter(p->p==∪(p),partitions(n))))

This is an anonymous function that accepts an integer and returns an integer. To call it, assign it to a variable.
We get the integer partitions using partitions, filter to only those with distinct summands, collect into an array, and find the last index (i.e. the length) using endof.

05AB1E, 8 bytes
ÅœʒDÙQ}g

Try it online or verify all test cases.
Explanation:
Åœ          # Get all integer partitions of the (implicit) input
            #  i.e. 5 → [[1,1,1,1,1],[1,1,1,2],[1,1,3],[1,2,2],[1,4],[2,3],[5]]
  ʒ   }     # Filter by:
   D        #  Duplicate the current partition
    Ù       #  Uniquify (removing any duplicated values from) this copied partition
            #   i.e. [1,1,1,1,1] → [1]
            #   i.e. [1,4] → [1,4]
     Q      #  Check if it's still the same
            #   i.e. [1,1,1,1,1] and [1] → 0 (falsey)
            #   i.e. [1,4] and [1,4] → 1 (truthy)
       g    # Then take the length of the filtered list (and implicitly output it)
            #  i.e. [[1,4],[2,5],[5]] → 3


text:
Connect the Dots
Given a series of os representing dots, connect them vertically or horizontally
Examples
Input:
o   o

o

Output:
o---o
|
|
o

Input:
o   o    o

    o

Output:
o---o----o
    |
    o

Spec

If you want the input padded with spaces to form a rectangle, please specify this in your answer
There will only be o, spaces, and newlines in the input
There will always be a pair of dots to connect
No two os will be directly adjacent
Dots should be connected with | and -, for vertical and horizontal connections respectively
No dot connections will overlap

Do you have to connect every legal pair or just connect the dots into 1 component? Can the dots always be connected into 1 component? "There will always be at least two dots to connect" would make more sense if I understand it right. A couple test cases could clear these up too.

@randomra you have t connect every legal pair, they won't always be 1 component

@Downgoat How about some more test cases that cover disconnected components and loops within a single component then? ;)

Japt, 33 29 bytes
Uy eV="o +o"_rS'|} y eV,_rS'-

Test it online!
How it works
Uy         // Transpose rows with columns in the input.
eV="o +o"  // Set V to the regex-string "o +o", and recursively replace each match Z with:
_rS'|}     //  Z with spaces replaced with "|"s.
y          // Transpose again.
eV,        // Recursively replace matches Z of V with:
_rS'-      //  Z with spaces replaced with "-"s.

Ruby, 137 133 bytes
->s{eval"s.split($/).map(&:chars)#{".map{|x|x.join.gsub(/o +(?=o)/){|x|x.tr' ',?|}.chars}.transpose"*2}.map(&:join)*$/".sub'?|','?-'}

This is absolutely horrible. Still trying to golf.
Input as a padded rectangle, please.
Newline for "readability":
eval"s.split($/).map(&:chars)#{".map{|x|x.join.gsub(/o +(?=o)/){|x|x.tr' ',?|}
.chars}.transpose"*2}.map(&:join)*$/".sub'?|','?-'

Alright, I'll input as a padded rectangle, but only because you asked so nicely.

Can you use \b instead of (?=o)?

@Justin Doesn't appear to work. :/

Retina, 80 bytes
T` `-`o.+o
Tm` `|`(?<=(?(1)!)^(?<-1>.)*o\D*¶(.)*) (?=(.)*¶\D*o(?<-2>.)*$(?(2)!))

Input needs to be padded.
Try it online!
Explanation
The first stage is pretty simple, it just turns all spaces into hyphens which are found between two os in the same line.
The second stage covers the |s. This is a bit trickier and requires balancing groups. The lookbehind
(?<=(?(1)!)^(?<-1>.)*o\D*¶(.)*)

checks that there's an o earlier in the same column. Remember that lookbehinds should be read from right to left. (.)* stores the horizontal position of match, \D*¶ checks skips to any character in the preceding lines, o matches literally. Then (?(1)!)^(?<-1>.)* ensures that the horizontal position of that o is the same.
The lookahead
(?=(.)*¶\D*o(?<-2>.)*$(?(2)!))

Does exactly the same thing in the opposite direction.