text:
Predict a Collision: Will the robber get away?
Think of a road as a number line, starting at 0 and continuing indefinitely:
.................................................................

There are two cars on the road: C and R. C is the cop who is trying to catch R, the robber. C starts at 0, and R starts somewhere on the road:
C.............................R..................................

The cop is already moving - he's chasing the robber. He has a constant speed. The robber just hopped into his car. He's accelerating. Each tick, the robber's speed increases by his acceleration.
Say the cop's speed is 7 and the robber's acceleration is 1. If the robber starts at 30, this is what the road would look like each tick:
C.............................R..................................
.......C.......................R.................................
..............C..................R...............................
.....................C..............R............................
............................C...........R........................
...................................C.........R...................
..........................................C........R.............
.................................................C........R......

After the last tick above, the robber's speed is equal to the cop's, and he's still ahead. Since the cop is moving at a constant speed and the robber is still speeding up, the robber escapes, so you output a truthy value. However, if the cop's speed had been 9...
C.............................R..................................
.........C.....................R.................................
..................C..............R...............................
...........................C........R............................
....................................C...R........................
.............................................X...................

... then the cop catches up to the robber before the robber can get away (marked by the X), so you output a falsey value.
Your Task
Given three inputs - the cop's speed, the robber's position, and the robber's acceleration - determine whether or not the robber will get away.
Rules

The cop always starts at 0.
All inputs will be positive integers.
The cop catches the robber if, after any tick, the cop's position is greater than or equal to the robber's position.
The robber gets away when he hasn't been caught yet and his speed is greater than the cop's.
Your program must terminate after output.
The robber accelerates before he moves each tick.

Test Cases
Cop Speed, Robber Position, Robber Acceleration -> Output

7, 30, 1 -> truthy
9, 30, 1 -> falsey
2, 1, 3 -> truthy
100, 100, 50 -> truthy
60, 60, 20 -> falsey
10, 1, 1 -> falsey
10, 50, 2 -> truthy
11, 50, 2 -> truthy
12, 50, 2 -> truthy
13, 50, 2 -> truthy
14, 50, 2 -> truthy
15, 50, 2 -> truthy
16, 50, 2 -> falsey
17, 50, 2 -> falsey
18, 50, 2 -> falsey
100, 451, 10 -> truthy

Reference Python 3 implementation that creates a visual also: Try it online!
This is code-golf, so shortest answer in bytes wins.

Sandbox (deleted)

Ohhhh... this isn't a cops and robbers challenge; that makes more sense.

Is the input guaranteed to be in the given format, or can we take input in whatever format we want (like robber acceleration, cop speed, robber position instead)?

@TehPers whatever you want (consistent each time), but if you're doing something different say so in your answer

Test case request: 100, 451, 10. (The answers don't all agree on the result).

@Neil added, good test case since cop is next to robber twice

Jelly, 9 bytes
_⁵Ḥ¤²÷÷8<

Try it online!
Port of Leaky Nun's Python 3 answer.
(full program) Takes arguments in order acceleration, position, speed.

Python 3, 29 bytes
lambda s,p,a:(a-2*s)**2<8*a*p

Try it online!
Explanation
The cop's position at time t is st.
The robber's position at time t is a(t)(t+1)/2 + p.
The signed distance from the cop to the robber is (a/2)t^2 + (a/2-s)t + p.
It never reaches zero if the discriminant is negative, the discriminant being (a/2 - s)^2 - 4(a/2)(p) = [(a-2s)^2-8ap]/4, which has the same sign as (a-2s)^2-8ap.

Try it online! - Shameless port to 05AB1E for 9-bytes (you may take it, as I'm bad with Physics, and probably couldn't do a just explanation).

Doesn't this fail for the "100, 451, 10 -> truthy" test case?

Am I missing something, or should we also check if there's an integer between the solutions of the quadratic equation (a/2)t^2 + (a/2-s)t + p = 0 -> 10t^2 - 50t + 61 = 0? For example, for 60, 61, 20 the robber easily gets away (the equation solutions: 2.1 and 2.9 being both between 2 and 3).

Cubically, 61 bytes
$:7(U1R3U1F3D2*1-1/1)6+7$-77*6$(-77777777D2F1U3R1U3!0{<0%6&})

Try it online! For this to work in TIO, you may need to replace & with &1 due to a bug in the interpreter.
This is a shameless port of Leaky Nun's answer.
Input is in the form a s p, where a is robber's acceleration, s is cop's speed, and p is robber's position.
If the acceleration is too high, this will fail. I don't know how high of an acceleration this program will support, but I know it isn't any higher than 1260. The limiting factor is that it stores the acceleration in the cube and checks if the cube is solved by checking only if the top face's sum is 0 (an incomplete check). It seems to work for acceleration = 50, but I haven't tested to see how high it can get.
How it works
$:7(U1R3U1F3D2*1-1/1)6
$:7                             Store the first number in the notepad
   (                )6          Loop until notepad is 0
    U1R3U1F3D2                  Rotate the cube a certain way
              *1-1/1            Subtract 1 from the notepad

+7$-77*6
+7                              Add first input to the notepad
  $-77                          Subtract second input from the notepad twice
      *6                        Multiply the notepad by itself (square it)

$(-77777777D2F1U3R1U3!0{<0%6&})
$                               Get next input
 (                            ) Loop indefinitely
  -77777777                     Subtract third input 8 times
           D2F1U3R1U3           "Unrotate" the cube
                     !0{     }  If the top face is 0
                        <0        Check if notepad < 0, store in notepad
                          %6      Output notepad as number
                            &     End the program

The 6 in %6 and *6 can be removed as they now can be called implicitly.

Japt, 13 bytes
²/W-V-U<o0W x

Test it online!
Explanation
U, V, and W are the implicit inputs. First, with Uo0W we create the range [0, W, 2*W, ...] until it reaches U. x then sums this, which gives how far the robber travels before reaching cop speed. We'll call this r.
Now, how far does the cop travel in this time? We can calculate this using U * (U // W - 1), which can be rearranged to (U * U) // W - U. We'll call this c.
Now for the final step: does the robber get away? All we need to do here is check if c < r + V, or rearranged, c - V < r.

Pyth, 11 bytes
This takes them in this order: Robber Acceleration, Cop Speed, Robber Position separated by a newline (as shown in the test suite).
<^-QyE2*8*E

Test Suite or Try it online!

Pyke, 14 bytes
Port of totallyhuman's Python answer. Returns 1 for truthy and 0 for falsy.
hQee-XQ1@Qe*}<

Try it here!

Explanation
hQee-XQ1@Qe*}< - Full program with implicit input added in the beginning (which automatically splits the components)

h              - First input
 Qee           - Last Input halved (through integer division)
    -          - Subtact the above
     X         - Square.
             < - Is smaller than?
      Q1@      - The second input
         Qe*   - Multiplied by the last input
            }  - Doubled

Pyke, 15 bytes
My very first Pyke answer! Port of my Pyth solution, which is inspired by Leaky's Python submission. Returns 1 for truthy and 0 for falsy.
eQh}-XQe8*Q1@*<

Try it here!

Explanation
eQh}-XQe8*Q1@*< - Full program with implicit input added in the beginning (which automatically splits the components)

e               - End; last input in this case
 Qh             - The first input
   }            - Double
    -           - Subtact the above
     X          - Square.
              < - Is less than?
      Qe        - Last Input
        8*      - Times 8
             *  - Multiplied by
          Q1@   - The second input.

Ruby, 29 27 25 bytes
->c,p,a{(a-c-c)**2<8*p*a}

Try it online!
Got from 29 to 27 by stealing the idea of multipliying both sides by 4. (Leaky Nun's python answer)
Got from 27 to 25 by removing parens around lambda parameters (thanks totallyhuman)

Welcome to PPCG! You can golf your answer a little bit by renaming your function from hit to h or similar. You may also be able to save some bytes by changing from a method to a proc, like so: ->c,p,a{(c-a*0.5)**2<2*p*a}

You also need to replace collision in your TIO link with the correct method name.

Pssst, look at their username. :P

I'm pretty sure you don't need the parentheses around c,p,a.

C# (.NET Core), 33 bytes
(v,p,a)=>v/a*v<p+v/a*(1+v/a)*.5*a

Try it online!
I feel like this is off by one somewhere, but it passes for all test cases so it's possible that there simply aren't any test cases where the cop overtakes the robber for a single tick, or it might just work despite my reservations.

JavaScript (V8), 25 bytes
(c,r,a)=>(a-c*2)**2<8*r*a

Try it Online!

Python 2, 62 bytes
P=s=0;S,p,a=input()
while(s<S)*(P<p):s+=a;p+=s;P+=S
print s>=S

Try it online!

Swift 3, 55 bytes
Note that I declared the variable t because the expression would be too complex to be solved in reasonable time otherwise (Swift's fault!).
func f(a:Int,b:Int,c:Int){let t=c-2*a;print(t*t<8*c*b)}

Test Suite.
or 55 bytes, exact closure equivalent (I need the last part because it is a complex construct):
{let t=$2-2*$0;return t*t<8*$2*$1}as(Int,Int,Int)->Bool

Test Suite.
Swift 3, 57 bytes
func f(a:[Int]){let t=a[2]-2*a[0];print(t*t<8*a[2]*a[1])}

Test Suite.

Python 2, 30 bytes
lambda c,p,a:c/a*(c-a+c%a)/2<p

Try it online! The cop has c/a ticks in which to catch the robber, after which it has out-accelerated the cop. At the first tick the cop gains c-a on the robber while on the last tick he only gains c%a. Thus the total that the cop can gain is the product of the number of ticks and the average distance per tick. This is simply compared to the initial lead the robber has.

TI BASIC (TI-83/84 series), 18 bytes
Prompt C,R,A
(A-2C)²<8RA

Yet another port of itdoesntwork's influential Ruby solution.
Execution
Input order is cop speed, robber position, robber acceleration.
C=?7
R=?30
A=?1
               1

Recursiva, 19 16 bytes
>b*I/acIH+-ac%ac

Try it online!

Retina, 79 bytes
\d+
$*
$
;
{`(1+);
$1;$1
,(1+;(1+))
$2,$1
1`(1+),\1
$1,
.*,,.*

^(1+),.*;\1.*
1

Try it online! Explanation:
\d+
$*

Convert input to unary.
$
;

Make room for the robber's speed.
{`(1+);
$1;$1

Accelerate the robber on each pass.
,(1+;(1+))
$2,$1

Move the robber away from the cop.
1`(1+),\1
$1,

Move the cop towards the robber.
.*,,.*

Has the cop caught the robber?
^(1+),.*;\1.*
1

Does the robber out-speed the cop?

Python 2, 31 30 29 bytes
-1 byte thanks to Mr. Xcoder.
Started off as a port of the Ruby answer.
lambda c,p,a:(c-a/2)**2<2*p*a

Try it online!

.5 instead of 0.5 >_>

Haha, I thought it'd be just that much to port. XD Thanks!

a/2 uses integer division, could this go wrong?

It does use integer division. While I haven't worked out any math (to be honest, I'm not sure I could), it works for all the test cases.


text:
91 Bottles of ASCII-beer on the Wall
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs.
Here's the stack of bottles, each number is the bottle you should remove for that input (1-indexed):
https://pastebin.com/wSpZRMV6

Note, we're using 91 instead of 99 because 99 would result in an unstable stack of bottles.

Example
With 0 bottles missing (x=0):
             |=|
             | |
             | |
            /   \
           .     .
           |-----|
           |     |
           |-----|
           |_____|
        =============
         |=|     |=|
         | |     | |
         | |     | |
        /   \   /   \
       .     . .     .
       |-----| |-----|
       |     | |     |
       |-----| |-----|
       |_____| |_____|
    =====================
     |=|     |=|     |=|
     | |     | |     | |
     | |     | |     | |
    /   \   /   \   /   \
   .     . .     . .     .
   |-----| |-----| |-----|
   |     | |     | |     |
   |-----| |-----| |-----|
   |_____| |_____| |_____|
=============================
 [THERE ARE MORE UNDER THIS]

For the full output of 0, see here: https://pastebin.com/ZuXkuH6s

With 1 bottle missing (x=1):
         |=|     |=|
         | |     | |
         | |     | |
        /   \   /   \
       .     . .     .
       |-----| |-----|
       |     | |     |
       |-----| |-----|
       |_____| |_____|
    =====================
     |=|     |=|     |=|
     | |     | |     | |
     | |     | |     | |
    /   \   /   \   /   \
   .     . .     . .     .
   |-----| |-----| |-----|
   |     | |     | |     |
   |-----| |-----| |-----|
   |_____| |_____| |_____|
=============================
 [THERE ARE MORE UNDER THIS]

Once again, this is the first two rows from here: https://pastebin.com/ZuXkuH6s (with 1 removed)...

With 2 bottles missing:
                 |=|
                 | |
                 | |
                /   \
               .     .
               |-----|
               |     |
               |-----|
               |_____|
    =====================
     |=|     |=|     |=|
     | |     | |     | |
     | |     | |     | |
    /   \   /   \   /   \
   .     . .     . .     .
   |-----| |-----| |-----|
   |     | |     | |     |
   |-----| |-----| |-----|
   |_____| |_____| |_____|
=============================
 [THERE ARE MORE UNDER THIS]

[ADDITIONAL INPUTS REMOVED]

With 91 bottles missing (n = 91):
:(

You must output an unhappy face, because you're out of beer.

Rules

Bottles are to be removed left to right.
Shelves are removed when no beer remains on the top of the shelves.
For an input of 0, you are outputting 91 bottles stacked in a triangle.

The bottom row has 13 bottles, the top has 1.

1 space between each bottle on each shelf.
Shelves must be input between each row of bottles.

Shelves may use =, - or # as the character.
Shelves must be 3 wider (on each side) than the bottles they hold.

This is code-golf, lowest byte-count wins.

Could you provide, say, a pastebin of at least one of the entire test cases?

Are trailing spaces after a shelf's last bottle required?

Preceding spaces are required, as you are removing them left to right, the spaces to the right of the ASCII-art are up to you.

@ConorO'Brien seeing as you didn't specify which test case, I wish I had put an unhappy face in a pastebin ;P.

@MagicOctopusUrn Because that's a helpful way to make your challenge improve

Oh, I thought you had chosen 91 to prevent any kind of built-ins. o0

The full pastebin you linked to has a typo: the third to last row of = has 4 extra on each side, when it should only have 3.

Can we print a shelf under the bottom row or above the top row?

Charcoal, 99 91 bytes
Ａ⁻⁹¹ＮθＡ¹³η:(Ｗθ«Ａ⌊⟦θη⟧ζＡ⁻θζθＡ⁻η¹ηＦζ«↑⁴↖.\↑²←|=↓³←↙¹↓.Ｐ⁶↓²Ｐ⁶↓¹Ｐ______←| »¿θ«Ｍ⁹↑Ｍ³→×=⁻×⁸ζ³↑Ｍ⁴←

Try it online! Link is to verbose version of code. Actually the real version is only 83 70 bytes:
Ｆ¹⁵Ｆι⊞υκ:(Ｆ⁻⁹¹Ｎ«Ｆ¬⊟υ«Ｍ³±⁹×=⁺⁵×⁸⊟υ↑Ｍ⁴←»↑⁴↖.\↑²←|=↓³←↙¹↓.Ｐ⁶↓²Ｐ⁶↓¹Ｐ×_⁶←|←

Explanation:
Ｆ¹⁵Ｆι⊞υκ

Populate an array providing information as to where the shelves go and how long they are.
:(

Print an unhappy face, although this will be immediately overwritten by the first bottle of beer (if any).
Ｆ⁻⁹¹Ｎ«

Loop through the remaining bottles of beer.
   Ｆ¬⊟υ«

Check to see whether a shelf needs to be drawn.
        Ｍ³±⁹×=⁺⁵×⁸⊟υ↑Ｍ⁴←»

Print the shelf and position ready to draw the next bottle above it.
   ↑⁴↖.\↑²←|=↓³←↙¹↓.Ｐ⁶↓²Ｐ⁶↓¹Ｐ×_⁶←|←

Draw a bottle and position ready to draw another bottle.

Huh. Too bad this challenge isn't about 99 bottles of beer. Gotta get 8 bytes down :) :P

@HyperNeutrino I guess 88 wouldn't be any better?

@HyperNeutrino It is about 91 bottles though :p

@EriktheOutgolfer That's why I suggested golfing 8 bytes :P And yay he actually did golf 8 bytes :D

@HyperNeutrino Not exactly; I golfed 11, then ungolfed 3...

Hmm, I see Ａ⁻η¹η (Assign η-1 to η) used pretty often (same applies to +1). Why isn't there a shorter way to do this with just two or three bytes? It's  a pretty basic thing to do in loops.

@KevinCruijssen Normally you'd increment using a for loop. This is a while loop, so I have to do some thing more manually.

@KevinCruijssen Although, thinking about it, a for loop was the way to go all along... 13 bytes saved! (Well, I got a bit lucky with the ease of populating my array.)

Huh, I just noticed that I can use - for my shelves... that would save 2 bytes (remove the ×=).

Python 3, 306 299 265 253 255 252 247 244 bytes
Quick attempt, could be optimised
Edit: -2 bytes thanks to @MrXcoder
Edit: -32 bytes as trailing spaces is not needed
Edit: -12 bytes by combining the two functions
Edit: -5 bytes thanks to @musicman523
Edit: +7 bytes to remove the shelf after the last row
Edit: -3 bytes
Edit: -5 bytes due to a lambda function only being used once in a map
Edit: -3 bytes by using the string function center
def l(y,x=13,z=" "):b=min(x,91-y);A,D="  |%s|  ","|-----|";print(y<91and(l(y+x,x-1)or"".join(map(lambda t:((t+z)*b)[:-1].center(103)+"\n",(A%"=",A%z,A%z," /   \ ",".     .",D,"|     |",D,"|_____|")))+z*(49-4*x)+"="*(x*8+5)*(x<13))or(x>12)*":(")

Try it online!

@Mr.Xcoder that won't work for x = 2, x=4, x=5, x=7, ...

Oh, you're right. Sorry!

You can put d= in the header though, since it is not recursive for -2 bytes

248 bytes by removing the E variable

JavaScript (ES6), 251 256 bytes
Edit: Saved 2 bytes thanks to @dzaima.
Edit: Added 7 bytes to fix issue with parameter. :(
c=>(f=(c,w=13)=>c>0&&f(c-w,w-1)+(c=c<w?c:w,r=(n,s=' ')=>s.repeat(n),a='\n'+r(52-w*4),'  |=|  0  | |  0  | |  0 /   \\ 0.     .0|-----|0|     |0|-----|0|_____|'.split(0).map(x=>a+r((w-c)*8+2)+r(c,' '+x)).join('')+a+r(w*8+5,'#')),(c=91-c)?f(c).slice(6):':(')

Here's the (mostly) ungolfed version:
function (consumed) {
  let remaining = 91 - consumed;

  function inner (count, width = 13) {
    if (count <= 0) return false;

    function repeat (count, string = ' ') {
      return string.repeat(count);
    }

    const pattern = [
      '  |=|  ',
      '  | |  ',
      '  | |  ',
      ' /   \\ ',
      '.     .',
      '|-----|',
      '|     |',
      '|-----|',
      '|_____|' ];

    let clamped = Math.min(count, width);
    let alignment = '\n' + repeat((13 - width) * 4);
    let empty = alignment + repeat((width - clamped) * 8 + 2);
    let shelf = alignment + repeat((width * 8) + 5, '#');
    let bottles = pattern.map(row => empty + repeat(clamped, ' ' + row));

    return inner(count - width, width - 1) + bottles.join('') + shelf;
  }

  return (remaining) ? inner(remaining).slice(6) : ':(';
}

Test code

const golfed =

c=>(f=(c,w=13)=>c>0&&f(c-w,w-1)+(c=c<w?c:w,r=(n,s=' ')=>s.repeat(n),a='\n'+r(52-w*4),'  |=|  0  | |  0  | |  0 /   \\ 0.     .0|-----|0|     |0|-----|0|_____|'.split(0).map(x=>a+r((w-c)*8+2)+r(c,' '+x)).join('')+a+r(w*8+5,'#')),(c=91-c)?f(c).slice(6):':(')

console.log(golfed(91)); // :(
console.log(golfed(72));
//                                                          |=|     |=|     |=|     |=|     |=|     |=|
//                                                          | |     | |     | |     | |     | |     | |
//                                                          | |     | |     | |     | |     | |     | |
//                                                         /   \   /   \   /   \   /   \   /   \   /   \
//                                                        .     . .     . .     . .     . .     . .     .
//                                                        |-----| |-----| |-----| |-----| |-----| |-----|
//                                                        |     | |     | |     | |     | |     | |     |
//                                                        |-----| |-----| |-----| |-----| |-----| |-----|
//                                                        |_____| |_____| |_____| |_____| |_____| |_____|
//     #####################################################################################################
//      |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|     |=|
//      | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |
//      | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |
//     /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \   /   \
//    .     . .     . .     . .     . .     . .     . .     . .     . .     . .     . .     . .     . .     .
//    |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----|
//    |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     | |     |
//    |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----| |-----|
//    |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____| |_____|
// #############################################################################################################

Very impressive, great answer. I like your r "macro"; I felt like there could be a shorter method but nothing I tried brought it down any.

C (gcc), 360 358 bytes
#define P printf(
r,i,j;char*b[]={"  |=|  ","  | |  ","  | |  "," /   \\ ",".     .","|-----|","|     |","|-----|","|_____|"};w(n){P"%*c",n,' ');}main(n,a)char**a;{(n=-atoi(a[1]))<-90?P":(\n"):({while(++r<14)if((n+=r)>0){for(j=0;j<9;++j){w(4*(13-r)+1);for(i=r;i>0;)--i<n?P b[j]),w(1):w(8);P"\n");}if(r<13){w(4*(13-r)-2);for(i=0;++i<8*r+6;)P"=");P"\n");}}});}

Try it online!
Explanation:
#define P printf(
r,i,j;
char*b[]={
    "  |=|  ",
    "  | |  ",
    "  | |  ",
    " /   \\ ",
    ".     .",
    "|-----|",
    "|     |",
    "|-----|",
    "|_____|"};

// function to print `n` spaces:
w(n){P"%*c",n,' ');}

main(n,a)char**a;
{
    // no beer left?
    (n=-atoi(a[1]))<-90

        // sad face
        ?P":(\n")

        // else create stack
        // using GCC extension "expression statement" `({ <statement> })` here,
        // shorter than if-else or a function call
        :({
            // loop over 13 rows
            while(++r<14)

                // found non-empty row?
                if((n+=r)>0)
                {
                    // loop over text lines of beer bottles
                    for(j=0;j<9;++j)
                    {
                        w(4*(13-r)+1);

                        // for each bottle
                        for(i=r;i>0;)

                            // print either 8 spaces or line of the bottle
                            --i<n?P b[j]),w(1):w(8);P"\n");
                    }

                    // except for last row, ...
                    if(r<13)
                    {
                        // ... print shelf
                        w(4*(13-r)-2);
                        for(i=0;++i<8*r+6;)
                            P"=");
                        P"\n");
                    }
                }
        });
}

Python 2, 436 bytes
Yikes!!
My method is too verbose, but anyway: it essentially 'draws' each row of bottles, adds in the spaces, and then 'erases' whatever necessary, printing whatever is left.
B=['  |=|   ','  | |   ','  | |   ',' /   \\  ','.     . ','|-----| ','|     | ','|-----| ','|_____| ']
N=lambda r:sum(n for n in range(1,r+1))
n=input()
R=0
while N(R)<n:R+=1
L=R-n+N(R-1)
e=range(1,R)+([R],[])[L!=0]
for r in range(1,14):
    if r in e:continue
    if(r-1 in e)<1:print('',' '*(1+(13-r)*4)+'='*(r*8-3))[r!=1]
    i=(0,R-L)[r==R];w=(8*i+(13-r)*4,0)[i==0];print'\n'.join([' '*w+((13-r)*4*' '+l*r)[w:]for l in B])
if n=91:print':('

Halvard Hummel's is much better.

source: Stack Exchange

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

sort: votes


text:
How related are two relatives?
The coefficient of relationship refers to how much DNA two persons have in common. A parent has 50% common DNA with their child (unless the parents are related), so to calculate it we have to find all pairs of directed disjoint paths starting at same node (common ancestor) and ending at each of the two siblings, and sum 2^-(m+n) for all pairs of paths of length m and n.
Your program should accept a list of pairs of numbers (or names if you prefer) representing parent-child relations followed by another pair of number for which it should output the coefficient of relationship (either as a fraction, a decimal number, or a percentage).
For example:
Format: [list of parent-child relations] pair of relatives we want to compare -> expected output
-----------------------------------------------
[(1,2)] (1, 2) -> 50% (parent-child)
[(1,2), (2, 3), (3, 4)] (2, 3) -> 50% (still parent-child, make sure your path pairs are disjoint)
[(1,3), (2, 3)] (1, 2) -> 0% (not related, make sure your paths are directed)
[(1, 2), (2, 3)] (1, 3) -> 25% (grandparent-child)
[(1, 3), (1, 4), (2, 3), (2, 4)] (3, 4) -> 50% (siblings)
[(1, 2), (1, 3)] (2, 3) -> 25% (half-siblings)
[(1, 3), (1, 4), (2, 3), (2, 4), (3, 5)] (4, 5) -> 25% (aunt/uncle-nephew/niece)
[(1, 3), (1, 4), (2, 3), (2, 4), (3, 5), (4, 6)] (5, 6) -> 12.5% (cousins)
[(1, 3), (1, 4), (2, 3), (2, 4), (5, 7), (5, 8), (6, 7), (6, 8), (3, 9), (7, 9), (4, 10), (8, 10)] (9, 10) -> 25% (double cousins)
[(1, 3), (1, 4), (2, 3), (2, 4), (3, 5), (4, 5)] (3, 5) -> 75% (parent-(child-with-sibling) incest)
[(1, 2), (1, 3), (2, 3)] (1, 3) -> 75% ((parent-and-grandparent)-(child-with-child) incest)

No person will have more than two parents and there will be no cycles in it. You can also assume that the number is the order in which they were born (so a < b in all (a, b)).

Can you clarify the task and what exactly m and n represent? If you would give a more concrete formula or something, it would be fine. What exactly do the pairs in the input represent?

@Mr.Xcoder: The lengths of the paths to both siblings.

Also, can you have one example of input and an explanation (with steps) on how you obtained that output?

50% seems awfully high for cousins. By my calculation, that should be 12.5%, since 1 and 2 each have path lengths of 2 to 5 and 6, so they should contribute 1/16th each, for a total of 1/8th.

@isaacg: Fixed it, I forgot to change the number after copy-pasting.

@Mr.Xcoder: In the case of uncle-nephew, we have disjoint path pairs (1 -> 3 -> 5, 1-> 4), (2 -> 3 -> 5, 2-> 4). Both pairs would have m=2, n=1, so 2^-3 for each pair * 2 pairs gives 2^-2 = 25%

@Runemoro Add it to the challenge, do not leave it here, in the comments.

Can we assume a < b for all pairs (a,b)?

@Zgarb No because the pairs represent directed edge.

@user202729 But the graph is acyclic, so it can be represented using such edges. All test cases satisfy it as well.

Can we assume the input graph is acyclic?

@isaacg Hmm, I assumed it is (otherwise time travel would be involved since someone is their own ancestor), but it isn't explicitly said in the challenge text...

Also, can we assume no one has more than 2 parents?

@isaacg: Yes, (a, b) represents "a is the parent of b", so there will be no (directed) cycles and no person with over 2 parents.

The half-siblings example (i.e [(1, 3), (2, 3)] (3, 4)) seems to be missing a pairing: either (1, 4) or (2, 4).

Python 3, 259 247 226 bytes
lambda l,a,b:sum(2**-len({*m}^{*n})for v in{*sum(l,())}for m in p(v,a,l)for n in p(v,b,l)if not{*zip(m,m[1:])}&{*zip(n,n[1:])})
p=lambda i,j,l:sum([[[r+[i]for r in p(y,j,l)],[[y,x]]][j==y]for x,y in l if i==x],[])+[[i]]*(i==j)

Try it online!
This can probably be golfed down quite a bit, but for now I'm just happy it works.

Python3, 206 bytes:
lambda l,a:(a in l)/2+sum(2**-len((x|y)-(x&y))for x in f(a[0],l,a)for y in f(a[1],l,a)if x&y)
def f(n,l,o,p=[],K=1):
 for a,b in l:
  if(b==n)&(K:=[a,b]!=o):yield from f(a,l,o,p+[b]);K=0
 if K:yield{*p+[n]}

Try it online!

206

Wolfram Language (Mathematica), 188 166 154 bytes
e_~h~f_:=4Tr[2^-Tr[Length/@#]&/@Select[Flatten[Tuples[i@r_:=If[#==r,{{r}},FindPath[g,#,r,∞,All]];i/@f]&/@VertexList[g=Rule@@@e],1],DisjointQ@@Rest/@#&]]

Try it online!

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

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


text:
A program that outputs itself in reverse order
Well the title says it all.

Standard loopholes apply
Nothing to read from stdin, and output goes to stdout
1-byte-long programs are... nonsense. They don't qualify
A program with a single byte repeated is also a nonsense (like aaa)
Please mark it out if your program is a palindrome

Sample:

A program with source code
abcde

should output
edcba

Because this is a code-golf, the shortest program wins!

Is reading the contents of the file allowed, or is that off limits for this challenge?

RProgN 2, 3 bytes
1
0

Try it online!
Pretty sure this has been submitted before, but here's one in RProgN 2.
It outputs
0
1


text:
Maximum sub-array
Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum.
Give a description of your code if possible.
Sample input 1:
1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14

Sample output 1: 24
Description 1:
The biggest sum is yielded by cutting 6 7 -8 9 10 out and summing up.
Sample input 2: -1 -2 -3
Sample output 2: 0
Description 2: It's simple :) An empty subarray is the "biggest".
Requirement:

Don't read anything except stdin, and output should go to stdout.
Standard loopholes restrictions apply.

Ranking: The shortest program wins this code-golf.

Write a program that's as short as possible. I would recommend removing this requirement as it requires us to check every possible program in our language and make sure that we're using the shortest.

Requirement 2 is also unclear. Does it mean libraries? Custom libraries? Outsourcing the program? The latter is already prohibited by the standard loopholes.

Don't read anything except stdin, and don't write to anywhere except stdout. - Why?

Very similar, possibly a dupe. Also very similar.

Husk, 6 4 bytes
▲ṁ∫ṫ

Try it online!
      -- implicit input (list) xs  - eg. [-1,2,3]
   ṫ  -- get all tails of xs       -     [[-1,2,3],[2,3],[3],[]]
 ṁ∫   -- map & concat cumsum       -     [0,-1,1,4,0,2,5,0,3,0]
▲     -- get maximum               -     5

another 4 byter

Python 3, 61 bytes
a=b=0
for x in eval(input()):a=max(x,a+x);b=max(a,b)
print(b)

Try it online!
Algorithm stolen from Wikipedia.

This would be 7 bytes shorter in Python 2 (in case you still use ancient language versions)

Jelly, 6 bytes
ẆS€;0Ṁ

Try it online!

Pyth, 8 bytes
eS+0sM.:

Try it online!

How?

eS+0sM.:Q - Q is implicit, meaning input. Let's say it's [-1, -2, -3].

      .:  - All contiguous non-empty sublists. We have [[-1], [-2], [-3], [-1, -2], [-2, -3], [-1, -2, -3]].
    sM    - Get the sum of each sublist. [-1, -2, -3, -3, -5, -6]
  +0      - Append a 0 to the sum list. [0, -1, -2, -3, -3, -5, -6]
eS        - Maximum element. S gives us [-6, -5, -3, -3, -2, -1, 0], while e returns 0, the last element.

05AB1E, 4 bytes
ÎŒ0M

Try it online!
-1 thanks to Adnan.

Same tip as with Okx's answer: ÎŒOM should work for 4 bytes.

@Adnan Thanks I thought there was only a "1 and input" builtin...wait...does it? Shouldn't they be concatenated or something?

Nope, M searches for the largest number in the flattened version of the stack.

@Adnan ok...this is news to me lol

Haskell, 28 bytes
maximum.scanl((max<*>).(+))0

Try it online!

won't the maximum always be the last element in the returned  from scanl?  so foldl((max<*>).(+))0 ??

NVM i see my mistake!

@matthias If you see the edit history, you'll see that I made the sma mistake. :-)

C++, 197 195 187 bytes
-10 bytes thanks to Zacharý
#include<vector>
#include<numeric>
int f(std::vector<int>v){int i=0,j,t,r=0;for(;i<v.size();++i)for(j=i;j<v.size();++j){t=std::accumulate(v.begin()+i,v.begin()+j,0);if(t>r)r=t;}return r;}

Can you remove the braces after the first for loop?

Also, why do you have l and h anyways?

@Zacharý l and h was for the start and end index of the sub array

R, 54 bytes
a=b=0;for(x in scan()){a=max(x,a+x);b=max(a,b)};cat(b)

Try it online!
Algorithm taken from: Maximum subarray problem
R, 65 bytes
y=seq(x<-scan());m=0;for(i in y)for(j in y)m=max(m,sum(x[i:j]));m

Try it online!

Read x from stdin.
Set y as index of x.
Iterate twice over all possible nonempty subsets.
Compare sum of a subset with m (initially m=0).
Store maximum value in m.
Print value of m.

R, 72 bytes
n=length(x<-scan());m=0;for(i in 1:n)for(j in i:n)m=max(m,sum(x[i:j]));m

Try it online!

Read x from stdin.
Do a full search over all possible nonempty subsets.
Compare sum of a subset with m (initially m=0).
Store maximum value in m.
Print value of m.

Other unsuccessful ideas
58 bytes
Reduce(max,lapply(lapply(seq(x<-scan()),tail,x=x),cumsum))

63 bytes
Reduce(max,lapply(seq(x<-scan()),function(i)cumsum(tail(x,i))))

72 bytes
m=matrix(x<-scan(),n<-length(x),n);max(apply(m*lower.tri(m,T),2,cumsum))

a=b=0 works too. Also, you need to handle printing of the output. When run as a full program (through source) this doesn't print anything.

@JarkoDubbeldam, I have added cat(b), but if sourced with echo=TRUE it is enough to call b for printout.

I guess there isn't a clear definition on how full programs are run in R. There is rscript in commandline, and source in R itself. But usually flags needed when running a script are included in the bytecount. (I haven't personally managed to get rscript to work nicely with scan, but thats another thing.

You can use T=F instead of a=b=0 to save two bytes, because max will coerce b to numeric.

05AB1E, 4 bytes
-2 bytes thanks to Adnan
ÎŒOM

Try it online!

ÎŒOM should work for 4 bytes

@Adnan Cool, thanks.

Mathematica, 24 bytes
Max[Tr/@Subsequences@#]&

Haskell, 41 33 bytes
import Data.List
g=maximum.concatMap(map sum.inits).tails

maximum.(scanl(+)0=<<).scanr(:)[]

Try it online! thanks to Laikoni

Anonymous functions are allowed as submission, so you can drop the g=. Instead of concatMap you can use =<< from the list monad: Try it online! (33 bytes).

Gaia, 6 bytes
0+ḋΣ¦⌉

Try it online!

Ruby, 61 59 57 bytes
I just started learning Ruby, so this is what I came up with.
s=0
p [gets.split.map{|i|s=[j=i.to_i,s+j].max}.max,0].max

I first saw this algorithm at the Finnish version of this unfinished book.
It is very well explained at the page 23.
Try it online!

k, 14 bytes
|/,/+\'(1_)\0,

Try it online!
            0, /prepend a zero (in case we're given all negatives)
       (1_)\   /repeatedly remove the first element, saving each result
    +\'        /cumulative sum over each result, saving each result
  ,/           /flatten (fold concat)
|/             /maximum (fold max)

Japt, 11 bytes
£ãY mxÃc rw

Try it online!
Explanation
£ãY mxÃc rw
m@ãY mx} c rw   // Ungolfed
m@     }        // Map the input array by the following function, with Y=index
  ãY            //   Get all subsections in input array length Y
     mx         //   Sum each subsection
         c rw   // Flatten and get max

Alternate method, 11 bytes
From @ETHproductions; based on Brute Forces' Husk answer.
£sY å+Ãc rw

Gets all tails of the input array and cumulatively sums each. Then flattens the array and gets the max.
Try it online!

Nice, really nice. I didn't try to implement this challenge when I saw it earlier, but I did think of a different technique and expected it to come out around 15 bytes, so this is great.

Looking at the Husk answer, there is another efficient way: £sY å+Ãc rw (also 11 bytes)

@ETHproductions Pretty nice, I'll add that to this answer as an alternate method. Could that maybe be improved with some combination of reduce/concat, also like that Husk answer?

JavaScript, 58 bytes
m=Math.max;x=y=>eval("a=b=0;for(k of y)b=m(a=m(a+k,k),b)")

Golfed JS implementation of Kadane's algorithm. Made as short as possible.
Open to constructive suggestions!
What I learnt from this post: return value of eval - when its last statment is a for loop - is basically the last value present inside the loop. Cool!
EDIT: saved four bytes thanks to Justin's and Hermann's suggestions.

You can avoid the return by replacing {...;return b;} with eval("...;b") since eval returns the last statement.

@JustinMariner thanks! am always learning something new here :)

You can remove two more bytes by removing ;b, since it's returned from the for loop

@HermanLauenstein Oh, wow, thanks, that's useful!

J, 12 bytes
[:>./@,+/\\.

Similar to zgrep's K solution: the scan sum of all suffixes (produces a matrix), raze, take max
Try it online!
NOTE
for not too many more bytes, you can get an efficient solution (19 bytes golfed):
[: >./ [: ({: - <./)\ +/\

Japt -h, 4 bytes
ãx ñ

Try it
ãx ñ     :Implicit input of array
ã        :Sub-arrays
 x       :Reduced by addition
   ñ     :Sort
         :Implicit output of last element

Python 2, 52 51 bytes
f=lambda l:len(l)and max(sum(l),f(l[1:]),f(l[:-1]))

Try it online!

This seems to conflict (the otherwise unnecessary) requirement Don't read anything except stdin, and don't write to anywhere except stdout.

Common Lisp, 73 bytes
(lambda(a &aux(h 0)(s 0))(dolist(x a s)(setf h(max x(+ h x))s(max s h))))

Try it online!

MY, 11 bytes
⎕35ǵ'ƒ⇹(⍐↵

Try it online! MY is on TIO now! Woohoo!
How?

⎕ = evaluated input
 = subvectors
35ǵ' = chr(0x53) (Σ, sum)
ƒ = string as a MY function
⇹ = map
( = apply
⍐ = maximum
↵ = output with a newline.

Sum was fixed (0 on empty arrays) in order for this to work. Product was also fixed.

APL, 31 29 27 bytes
⌈/∊∘.{+/W[X/⍨⍺≤X←⍳⍵]}⍨⍳⍴W←⎕

Try it online! (modified so it will run on TryAPL)
How?

∊∘.{+/W[X/⍨⍺≤X←⍳⍵]}⍨⍳⍴W←⎕ Generate sums of subvectors
⌈/ Maximum

CJam, 24 bytes
q~:A,{)Aew{:+}%}%e_0+:e>

Function that takes array of numbers as input.
Try it Online
q~:A   e# Store array in 'A' variable
,{)Aew e# Get every possible sub-array of the array
{:+}%  e# Sum every sub array
}e_    e# flatten array of sums
0+     e# Add zero to the array
:e>    e# Return max value in array

Axiom, 127 bytes
f(a:List INT):Complex INT==(n:=#a;n=0=>%i;r:=a.1;for i in 1..n repeat for j in i..n repeat(b:=reduce(+,a(i..j));b>r=>(r:=b));r)

This would be O(#a^3) Algo; I copy it from the C++ one... results
(3) -> f([1,2,3,-4,-5,6,7,-8,9,10,-11,-12,-13,14])
   (3)  24
                                                    Type: Complex Integer
(4) -> f([])
   (4)  %i
                                                    Type: Complex Integer
(5) -> f([-1,-2,3])
   (5)  3
                                                    Type: Complex Integer

Scala, 105 bytes
val l=readLine.split(" ").map(_.toInt);print({for{b<-l.indices;a<-0 to b+2}yield l.slice(a,b+1).sum}.max)

I didn't find any better way to generate the sublists arrays.

Java 8, 242 bytes
import java.util.*;v->{List a=new Stack();for(String x:new Scanner(System.in).nextLine().split(" "))a.add(new Long(x));int r=0,l=a.size(),i=l,j,k,s;for(;i-->0;)for(j=l;--j>1;r=s>r?s:r)for(s=0,k=i;k<j;)s+=(long)a.get(k++);System.out.print(r);}

Try it here.
106 bytes without using STDIN/STDOUT requirement.. >.>
a->{int r=0,l=a.length,i=l,j,k,s;for(;i-->0;)for(j=l;--j>1;r=s>r?s:r)for(s=0,k=i;k<j;s+=a[k++]);return r;}

Try it here.
Explanation:
import java.util.*;      // Required import for List, Stack and Scanner

v->{                     // Method with empty unused parameter and no return-type
  List a=new Stack();    //  Create a List
  for(String x:new Scanner(System.in).nextLine().split(" "))
                         //  Loop (1) over the STDIN split by spaces as Strings
    a.add(new Long(x));  //   Add the String converted to a number to the List
                         //  End of loop (1) (implicit / single-line body)
  int r=0,               //  Result-integer
      l=a.size(),        //  Size of the List
      i=l,j,k,           //  Index-integers
      s;                 //  Temp sum-integer
  for(;i-->0;)           //  Loop (2) from `l` down to 0 (inclusive)
    for(j=l;--j>1;       //   Inner loop (3) from `l-1` down to 1 (inclusive)
        r=               //     After every iteration: change `r` to:
          s>r?           //      If the temp-sum is larger than the current `r`:
           s             //       Set `r` to the temp-sum
          :              //      Else:
           r)            //       Leave `r` the same
      for(s=0,           //    Reset the temp-sum to 0
          k=i;k<j;)      //    Inner loop (4) from `i` to `j` (exclusive)
        s+=(long)a.get(k++);
                         //     Add the number at index `k` in the List to this temp-sum
                         //    End of inner loop (4) (implicit / single-line body)
                         //   End of inner loop (3) (implicit / single-line body)
                         //  End of loop (2) (implicit / single-line body)
  System.out.print(r);   //  Print the result to STDOUT
}                        // End of method